[jokosher-devel] [PATCH] Standardising the slider functionality
- From: Thom Shutt <ts106 doc ic ac uk>
- To: jokosher-devel-list gnome org
- Subject: [jokosher-devel] [PATCH] Standardising the slider functionality
- Date: Sat, 19 May 2007 04:18:01 +0100
Here's my second attempt at implementing the right-click functionality
on the volume sliders. I've also added the same functionality to the
zoom in/out slider. Once again, all comments gratefully received!
Index: VUWidget.py
===================================================================
--- VUWidget.py (revision 1381)
+++ VUWidget.py (working copy)
@@ -114,6 +114,12 @@
widget -- reserved for GTK callbacks, don't use it explicitly.
mouse -- reserved for GTK callbacks, don't use it explicitly.
"""
+ #If the slider is right-clicked then set the volume to 100%
+ if mouse.button == 3:
+ self.mixerstrip.SetVolume(1.0)
+ self.queue_draw()
+ return True
+
if self.__YPosOverVolumeHandle(mouse.y):
response = gtk.gdk.pointer_grab(self.window, False, self._POINTER_GRAB_EVENTS, None, None, mouse.time)
self.fader_active = (response == gtk.gdk.GRAB_SUCCESS)
@@ -137,7 +143,7 @@
mouse -- reserved for GTK callbacks, don't use it explicitly.
"""
if not self.message_id:
- self.message_id = self.mainview.SetStatusBar(_("<b>Drag</b> the <b>slider</b> to alter volume levels"))
+ self.message_id = self.mainview.SetStatusBar(_("<b>Drag</b> the <b>slider</b> to alter volume levels - <b>Right-Click</b> to set the <b>slider</b> to 100%"))
oldHover = self.fader_hover
self.fader_hover = (0 < mouse.x < self.get_allocation().width) and self.__YPosOverVolumeHandle(mouse.y)
Index: RecordingView.py
===================================================================
--- RecordingView.py (revision 1381)
+++ RecordingView.py (working copy)
@@ -113,9 +113,10 @@
self.zoomSlider.set_draw_value(False)
self.zoomSlider.set_value(self.project.viewScale)
self.zoomtip = gtk.Tooltips()
- self.zoomtip.set_tip(self.zoomSlider, _("Zoom the timeline"),None)
+ self.zoomtip.set_tip(self.zoomSlider, _("Zoom the timeline - Right-Click to reset to the default level"),None)
self.zoomSlider.connect("value-changed", self.OnZoom)
+ self.zoomSlider.connect("button-press-event", self.OnZoomReset)
inbutton = gtk.Button()
inimg = gtk.image_new_from_stock(gtk.STOCK_ZOOM_IN, gtk.ICON_SIZE_BUTTON)
@@ -387,7 +388,21 @@
tmp = self.project.viewScale * 1.25
#setting the value will trigger the gtk event and call OnZoom for us.
self.zoomSlider.set_value(tmp)
+
+ #_____________________________________________________________________
+ def OnZoomReset(self, widget, mouse):
+ """
+ Calls OnZoom when the user resets the zoom to the default by right-clicking.
+
+ Parameters:
+ widget -- reserved for GTK callbacks, don't use it explicitly.
+ """
+ if mouse.button == 3:
+ tmp = (self.ZOOM_MAX_SCALE - self.ZOOM_MIN_SCALE) / 2
+ #setting the value will trigger the gtk event and call OnZoom for us.
+ self.zoomSlider.set_value(tmp)
+
#_____________________________________________________________________
def SetViewPosition(self, position):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]