From 89716cd5074959f90ec5eb26c0783324e68f028f Mon Sep 17 00:00:00 2001 From: iovar Date: Fri, 7 Dec 2007 07:24:05 +0000 Subject: rmdPrefsWidget.py, rmdSimple.py: added shortcuts for common actions ctr+r,ctr+s,ctr+h,ctr+q,,ctr+p,esc git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@464 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- gtk-recordmydesktop/src/rmdPrefsWidget.py | 15 ++++++++++++++- gtk-recordmydesktop/src/rmdSimple.py | 32 +++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 3 deletions(-) (limited to 'gtk-recordmydesktop/src') diff --git a/gtk-recordmydesktop/src/rmdPrefsWidget.py b/gtk-recordmydesktop/src/rmdPrefsWidget.py index 49257f8..76d2faf 100644 --- a/gtk-recordmydesktop/src/rmdPrefsWidget.py +++ b/gtk-recordmydesktop/src/rmdPrefsWidget.py @@ -337,6 +337,14 @@ class prefsWidget(object): self.jack_button.connect("clicked",self.__jack_enabled_check__) self.jack_lsp_refresh.connect("clicked",self.__runJackLSP__) + def __register_shortcuts__(self): + self.parent.advanced_button.add_accelerator("clicked",self.accel_group, + ord('P'), gtk.gdk.CONTROL_MASK, + gtk.ACCEL_VISIBLE) + self.parent.advanced_button.add_accelerator("clicked",self.accel_group, + gtk.gdk.keyval_from_name("Escape"),0, + gtk.ACCEL_VISIBLE) + def __jack_enabled_check__(self,widget): self.channelsSpinButton.set_sensitive(not widget.get_active()) self.freqSpinButton.set_sensitive(not widget.get_active()) @@ -344,16 +352,21 @@ class prefsWidget(object): self.jack_lsp_listview.set_sensitive(widget.get_active()) self.jack_lsp_refresh.set_sensitive(widget.get_active()) - def __init__(self,values,optionsOpen): + def __init__(self,parent,values,optionsOpen): self.values=values self.ports=[] + self.parent=parent self.optionsOpen=optionsOpen self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("destroy", self.destroy) self.window.set_border_width(10) self.window.set_title("recordMyDesktop: "+smplButtonStrings[0]) + self.accel_group = gtk.AccelGroup() + self.window.add_accel_group(self.accel_group) + self.__subWidgets__() self.__makeCons__() + self.__register_shortcuts__() self.__runJackLSP__() self.__jack_enabled_check__(self.jack_button) if self.values[24]==0: diff --git a/gtk-recordmydesktop/src/rmdSimple.py b/gtk-recordmydesktop/src/rmdSimple.py index b9693db..19ea25c 100644 --- a/gtk-recordmydesktop/src/rmdSimple.py +++ b/gtk-recordmydesktop/src/rmdSimple.py @@ -187,7 +187,7 @@ class simpleWidget(object): def advanced(self,button=None): if self.optionsOpen[0] ==0: self.optionsOpen[0]=1 - self.options=pW.prefsWidget(self.values,self.optionsOpen) + self.options=pW.prefsWidget(self,self.values,self.optionsOpen) #self.parent.show() else: if self.options != None: @@ -253,6 +253,32 @@ class simpleWidget(object): self.s_button.connect("clicked",self.__sound_check__) self.win_button.connect("clicked",self.__select_window__) self.window.connect("window-state-event",self.__swap_visibility__) + + def __register_shortcuts__(self): + self.advanced_button.add_accelerator("clicked",self.accel_group, + ord('P'), gtk.gdk.CONTROL_MASK, + gtk.ACCEL_VISIBLE) + self.file_button.add_accelerator("clicked",self.accel_group, + ord('S'), gtk.gdk.CONTROL_MASK, + gtk.ACCEL_VISIBLE) + self.quit_button.add_accelerator("clicked",self.accel_group, + ord('Q'), gtk.gdk.CONTROL_MASK, + gtk.ACCEL_VISIBLE) + self.start_button.add_accelerator("clicked",self.accel_group, + ord('R'), gtk.gdk.CONTROL_MASK, + gtk.ACCEL_VISIBLE) + + self.trayIcon.tray_popup.popupmenu_prefs_widget.add_accelerator( + "activate",self.accel_group, + ord('H'), gtk.gdk.CONTROL_MASK, + gtk.ACCEL_VISIBLE + ) + self.trayIcon.tray_popup.popupmenu_prefs_widget.add_accelerator( + "activate",self.accel_group, + gtk.gdk.keyval_from_name("Escape"),0, + gtk.ACCEL_VISIBLE + ) + def __sound_check__(self,widget): self.s_quality.set_sensitive(widget.get_active()) self.values[2]=widget.get_active() @@ -445,7 +471,8 @@ class simpleWidget(object): self.window.set_border_width(10) self.window.set_title("recordMyDesktop") self.__subWidgets__() - + self.accel_group = gtk.AccelGroup() + self.window.add_accel_group(self.accel_group) #self.timed_id=gobject.timeout_add(2000,self.__update_image__) #if resolution is low let it decide size on it's own @@ -455,6 +482,7 @@ class simpleWidget(object): self.trayIcon=trayIcon(self) self.__makeCons__() + self.__register_shortcuts__() if self.values[24]==0: self.__tooltips__() self.s_quality.set_sensitive(self.values[2]) -- cgit v1.2.3