From: benoit.pin Date: Mon, 31 Jan 2011 14:13:36 +0000 (+0000) Subject: Implémentation du double clic sur la sélection de la chanson. X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/commitdiff_plain/eb54dac20092c54228bdd9f227c7ad163bca382d?hp=d16b6e481bb75314ed3e4f7ae24ba6bde0378d2e Implémentation du double clic sur la sélection de la chanson. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@330 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/minwii/widgets/songfilebrowser.py b/src/minwii/widgets/songfilebrowser.py index f976ce6..6117218 100755 --- a/src/minwii/widgets/songfilebrowser.py +++ b/src/minwii/widgets/songfilebrowser.py @@ -6,6 +6,7 @@ $Id$ $URL$ """ +import pygame from pgu.gui import FileDialog import pgu.gui.basic as basic import pgu.gui.input as input @@ -57,6 +58,8 @@ class FileOpenDialog(FileDialog): self.body.tr() self.body.td(self.list, colspan=4, style=td_style) self.list.connect(CHANGE, self._item_select_changed_, None) + self.list.connect(CLICK, self._check_dbl_click_, None) + self._last_time_click = pygame.time.get_ticks() self.button_ok.connect(CLICK, self._button_okay_clicked_, None) self.body.tr() self.body.td(basic.Label("Fichier"), style=td_style, align=-1) @@ -256,6 +259,13 @@ class FileOpenDialog(FileDialog): self._current_sort = arg self.list.clear() self._list_dir_() + + def _check_dbl_click_(self, arg) : + if pygame.time.get_ticks() - self._last_time_click < 300 : + self._button_okay_clicked_(None) + else : + self._last_time_click = pygame.time.get_ticks() + # utils from unicodedata import decomposition