diff options
Diffstat (limited to 'atoidejouer/ui/panel/sound.py')
-rw-r--r-- | atoidejouer/ui/panel/sound.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/atoidejouer/ui/panel/sound.py b/atoidejouer/ui/panel/sound.py index 27a2062..406cc32 100644 --- a/atoidejouer/ui/panel/sound.py +++ b/atoidejouer/ui/panel/sound.py @@ -16,21 +16,24 @@ from atoidejouer.tools import image, sound, storage, ui logger = logging.getLogger('atoidejouer') +LABEL_MAX_LENGHT = 12 + COLOR_GREY_DARK = ui.get_color(0.5, 0.5, 0.5) COLOR_GREY_LIGHT = ui.get_color(0.75, 0.75, 0.75) COLOR_GREY_WHITE = ui.get_color(0.85, 0.85, 0.85) COLOR_WHITE = ui.get_color(1.0, 1.0, 1.0) -def _cb_on_click(button, panel_sound, key, event): - pass +def _cb_on_click(button, panel_sound, key): + # update edit panel + panel_sound.screen.panel_edit.refresh(key=key) def _cb_on_remove(panel_sound, key, button): # remove image on right click story.DB()._del(key) panel_sound.refresh() - # TODO - update edit panel + # update edit panel panel_sound.screen.panel_edit.refresh() @@ -44,9 +47,9 @@ def _add_simple_button(parent, icon_name, tooltip, cb): # .. remove button _button = gtk.Button() _button.show() - _button.set_tooltip_text(tooltip) # _('Remove ') + filename + _button.set_tooltip_text(tooltip) # cb - _button.connect('clicked', cb) # cb, self, filename + _button.connect('clicked', cb) # add parent.pack_start(_button, expand=False, fill=False) # add a remove image here @@ -156,7 +159,6 @@ class PanelSound(gtk.Frame): self.__remove(_index) def add_key(self, key, pos=None): - # .. _item_box = gtk.HBox(homogeneous=False, spacing=2) _item_box.show() self._scrolled_hbox.pack_start(_item_box, expand=False, fill=False) @@ -189,13 +191,16 @@ class PanelSound(gtk.Frame): # get pixbuff and update image _path = storage.get_image_path('sound', dir_='data') _item_img.set_from_pixbuf(image.get_pixbuf(_path, 96, 62)) + # manage label max length + _title = key.title + _title = _title[:len(_title) - LABEL_MAX_LENGHT]\ + if len(_title) > LABEL_MAX_LENGHT else _title # add label - _label = gtk.Label(key.name) + _label = gtk.Label(_title) _label.show() - # ... _vbox.pack_start(_label, expand=False, fill=True) # remove button - _add_simple_button(_item_box, 'less_small', _('Remove ') + key.name, + _add_simple_button(_item_box, 'less_small', _('Remove ') + key.title, partial(_cb_on_remove, self, key)) def refresh(self): |