Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2012-06-20 18:01:34 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-06-20 18:01:34 (GMT)
commita7c2d99a7d302461d7f2e50a4bc1ea2e3fb8078d (patch)
treefdc001c1ae196fc98b0d01ec4cbef77526e2a197
parent0024c488270f3648c8086c2b391c89682319a74c (diff)
TamTamMini doesn't update display when scrolling with keyboard #3711
-rw-r--r--Mini/InstrumentPanel.py24
1 files changed, 24 insertions, 0 deletions
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)