From a7c2d99a7d302461d7f2e50a4bc1ea2e3fb8078d Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Wed, 20 Jun 2012 18:01:34 +0000 Subject: TamTamMini doesn't update display when scrolling with keyboard #3711 --- diff --git a/Mini/InstrumentPanel.py b/Mini/InstrumentPanel.py index a9e8d4f..6ecb457 100644 --- a/Mini/InstrumentPanel.py +++ b/Mini/InstrumentPanel.py @@ -21,6 +21,8 @@ class InstrumentPanel( gtk.EventBox ): def __init__(self,setInstrument=None): gtk.EventBox.__init__(self) + self._scrolled_window = None + self.instrumentDB = InstrumentDB.getRef() self.setInstrument = setInstrument self.playInstrument = None @@ -229,6 +231,7 @@ class InstrumentPanel( gtk.EventBox ): if loadStage[2] == 2: self.loadData["instButton"].clickedHandler = self.loadData["instButton"].connect('clicked',self.handleInstrumentButtonClick, instrument) self.loadData["instButton"].connect('enter',self.handleInstrumentButtonEnter, instrument) + self.loadData["instButton"].connect('focus-in-event', self.handleInstrumentButtonFocus, instrument) loadStage[2] = 3 if timeout >= 0 and time.time() > timeout: return False @@ -325,6 +328,27 @@ class InstrumentPanel( gtk.EventBox ): if self.enterMode and self.playInstrument: self.playInstrument(instrument) + def handleInstrumentButtonFocus(self, widget, event, instrument): + if self._scrolled_window is None: + parent = widget.parent + while parent is not None: + if isinstance(parent, gtk.ScrolledWindow): + self._scrolled_window = parent + break + parent = parent.parent + else: + return + top = self._scrolled_window + + __, shift = widget.translate_coordinates(top, 0, 0) + if shift < 0: + top.props.vadjustment.props.value += shift + else: + shift += widget.get_allocation().height + Config.PANEL_SPACING + top_height = top.get_allocation().height + if shift > top_height: + top.props.vadjustment.props.value += (shift - top_height) + def handleMicRecButtonClick(self,widget,mic): self.recstate = False self.setInstrument(mic) -- cgit v0.9.1