diff options
Diffstat (limited to 'gtk-recordmydesktop/src')
-rw-r--r-- | gtk-recordmydesktop/src/rmdConfig.py.in | 8 | ||||
-rw-r--r-- | gtk-recordmydesktop/src/rmdPrefsWidget.py | 135 | ||||
-rw-r--r-- | gtk-recordmydesktop/src/rmdSimple.py | 53 | ||||
-rw-r--r-- | gtk-recordmydesktop/src/rmdTrayIcon.py | 13 |
4 files changed, 192 insertions, 17 deletions
diff --git a/gtk-recordmydesktop/src/rmdConfig.py.in b/gtk-recordmydesktop/src/rmdConfig.py.in index 8753c59..ec77854 100644 --- a/gtk-recordmydesktop/src/rmdConfig.py.in +++ b/gtk-recordmydesktop/src/rmdConfig.py.in @@ -15,7 +15,7 @@ default_values=[15, #framerate 0, #delay ,unused on 0.3 1, #no of channels 22050, #frequency - 'hw:0,0', #device + 'DEFAULT', #device 63, #video quality 10, #audio quality "$DISPLAY", #display, this is not interpreted as an env variable @@ -27,5 +27,9 @@ default_values=[15, #framerate "/tmp", #working directory 1, #on the fly encoding,0 on 1 off 1, #zero compression,0 on 1 off - False #overwrite existing files + False, #overwrite existing files + 0, #include window decorations, 0 on 1 off + False, #Use jack + [], #jack ports + 0, #tooltips,0 on 1 off ]
\ No newline at end of file diff --git a/gtk-recordmydesktop/src/rmdPrefsWidget.py b/gtk-recordmydesktop/src/rmdPrefsWidget.py index f9ae395..0e432d6 100644 --- a/gtk-recordmydesktop/src/rmdPrefsWidget.py +++ b/gtk-recordmydesktop/src/rmdPrefsWidget.py @@ -43,7 +43,8 @@ class prefsWidget(object): _('Frames Per Second'),_('Encode On the Fly'),_('Zero Compression'), _('Quick Subsampling'),_('Shared Threshold'),_('Full shots at every frame'), _('Channels'),_('Frequency'),_('Device'),_('Display'),_('Mouse Cursor'), - _('MIT-Shm extension'),_('Video Quality'),_('Sound Quality'), + _('MIT-Shm extension'),_('Include Window Decorations'),_('Tooltips'), + _('Video Quality'),_('Sound Quality'), _('Drop Frames(encoder)'),_('Startup Delay(secs)'),] mouseStrings=[_('Normal'),_('White'),_('Black'),_('None')] stateStrings=[_('Enabled'),_('Disabled')]#0,1 @@ -62,12 +63,14 @@ class prefsWidget(object): _('Connection to the Xserver.'), _('The mouse cursor that will be drawn.\nNormal is for the real cursor that you see while recording,\nwhile black and white are fake cursors, drawn by the program.\nYou can also disable cursor drawing.'), _('Use the MIT-Shared memory extension, whenever appropriate,\n depending on the rest of the program settings.\nDisabling this option is not recommended,\nas it may severely slow down the program.'), - ] + _('When selecting a window via the "Select Window" button,\ninclude that window\'s decorations in the recording area.'), + _('Enable or disable tooltips, like this one.\n(Requires restart)')] + jacktip=_("Enable this option to record audio through\nJACK. The Jack server must be running in order to\nobtain the ports that will be recorded.\nThe audio recorded from each one\nwill be written on a channel of its own.\nrecordMyDesktop must be compiled with JACK\nsupport for this option to work.") def __tooltips__(self): self.tooltips=gtk.Tooltips() - for i in range(14): + for i in range(16): self.tooltips.set_tip(self.eboxes[i],self.tooltipLabels[i]) - + self.tooltips.set_tip(self.jack_ebox,self.jacktip) def destroy(self,Event=None): self.values[0]=self.fpsSpinButton.get_value_as_int() @@ -84,7 +87,10 @@ class prefsWidget(object): self.values[18]=self.onTheFlyComboBox.get_active() self.values[19]=self.zeroCmpComboBox.get_active() self.values[20]=self.overwriteFilesButton.get_active() - + self.values[21]=self.winDecoComboBox.get_active() + self.values[22]=self.jack_button.get_active() + self.__getSelectedPorts__() + self.values[24]=self.tooltipsComboBox.get_active() self.window.destroy() self.optionsOpen[0]=0 @@ -94,7 +100,14 @@ class prefsWidget(object): self.optionsOpen[0]=0 self.window.destroy() - + def __getSelectedPorts__(self): + iters_t=[] + self.values[23]=[] + sel_rows=self.jack_lsp_listview.get_selection().get_selected_rows() + for i in sel_rows[1]: + iters_t.append(self.jack_lsp_listview.get_model().get_iter(i)) + for i in iters_t: + self.values[23].append(self.jack_lsp_listview.get_model().get_value(i,0)) def __subWidgets__(self): self.labels={} @@ -187,6 +200,46 @@ class prefsWidget(object): self.eboxes[i].add(self.boxes[i]) self.labelbox[2].pack_start(self.eboxes[i],expand=False,fill=False) + self.jack_button= gtk.CheckButton(_("Use Jack for audio capture.")) + self.jack_lsp_label=gtk.Label(_("Select the ports you want to record from\n" + "(hold Ctrl to select multiple entries):")) + + self.jack_lsp_liststore=gtk.ListStore(str) + + self.jack_lsp_listview=gtk.TreeView(self.jack_lsp_liststore) + self.jack_lsp_tvc = gtk.TreeViewColumn(_("Available Ports")) + self.jack_lsp_listview.append_column(self.jack_lsp_tvc) + self.cell = gtk.CellRendererText() + self.jack_lsp_tvc.pack_start(self.cell, True) + self.jack_lsp_tvc.add_attribute(self.cell, 'text', 0) + self.jack_lsp_listview.set_search_column(0) + self.jack_lsp_listview.set_reorderable(True) + self.jack_lsp_listview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) + + self.jack_lsp_refresh=gtk.Button(None,gtk.STOCK_REFRESH) + self.jack_box=gtk.VBox(homogeneous=False, spacing=10) + self.jack_box.pack_start(self.jack_button,expand=False,fill=False) + self.jack_box.pack_start(self.jack_lsp_label,expand=False,fill=False) + self.jack_box.pack_start(self.jack_lsp_listview,expand=False,fill=False) + self.jack_box.pack_start(self.jack_lsp_refresh,expand=False,fill=False) + + self.jack_button.set_active(self.values[22]) + self.jack_button.show() + self.jack_lsp_label.show() + self.jack_lsp_listview.show() + self.jack_lsp_refresh.show() + + self.jack_ebox=gtk.EventBox() + self.jack_ebox.add(self.jack_box) + self.jack_box.show() + + sep1=gtk.HSeparator() + + self.labelbox[2].pack_start(sep1,expand=False,fill=False) + self.labelbox[2].pack_start(self.jack_ebox,expand=False,fill=False) + sep1.show() + self.jack_ebox.show() + self.channelsAdjustment=gtk.Adjustment(value=self.values[7], lower=1,upper=2, step_incr=1, page_incr=1, page_size=1) self.channelsSpinButton= gtk.SpinButton(self.channelsAdjustment, climb_rate=0.5, digits=0) @@ -206,7 +259,7 @@ class prefsWidget(object): self.boxes[10].pack_end(self.deviceEntry,expand=False,fill=False) #misc page - for i in xrange(11,14): + for i in xrange(11,16): self.labels[i]=gtk.Label(self.labelStrings[i]) self.labels[i].set_justify(gtk.JUSTIFY_LEFT) self.boxes[i]=gtk.HBox(homogeneous=False, spacing=0) @@ -237,7 +290,21 @@ class prefsWidget(object): self.sharedComboBox.show() self.boxes[13].pack_end(self.sharedComboBox,expand=False,fill=False) - for i in range(14): + self.winDecoComboBox = gtk.combo_box_new_text() + for i in range(2): + self.winDecoComboBox.append_text(self.stateStrings[i]) + self.winDecoComboBox.set_active(self.values[21]) + self.winDecoComboBox.show() + self.boxes[14].pack_end(self.winDecoComboBox,expand=False,fill=False) + + self.tooltipsComboBox = gtk.combo_box_new_text() + for i in range(2): + self.tooltipsComboBox.append_text(self.stateStrings[i]) + self.tooltipsComboBox.set_active(self.values[24]) + self.tooltipsComboBox.show() + self.boxes[15].pack_end(self.tooltipsComboBox,expand=False,fill=False) + + for i in range(16): self.boxes[i].show() self.eboxes[i].show() @@ -248,17 +315,65 @@ class prefsWidget(object): for i in range(4): self.labelbox[i].show() self.notebook.show() - + def __runJackLSP__(self,button=None): + if button!=None: + self.__getSelectedPorts__() + self.ports=[] + failed=0 + (stdin,stdout,stderr)=os.popen3(['jack_lsp'],'t') + ports=stdout.readlines() + stdin.close() + stdout.close() + stderr.close() + self.jack_lsp_liststore.clear() + self.jack_lsp_listview.get_selection().unselect_all() + if ports!=[]: + for i in ports: + self.ports.append(i.replace('\n',"")) + self.jack_lsp_listview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) + else: + failed=1 + self.ports.append(_("jack_lsp returned no ports.")) + self.ports.append(_("Make sure that jackd is running.")) + self.jack_lsp_listview.get_selection().set_mode(gtk.SELECTION_NONE) + self.values[23]=[] + k=0 + for i in self.values[23]: + self.jack_lsp_liststore.append([i]) + self.jack_lsp_listview.get_selection().select_path((k,)) + k+=1 + for i in self.ports: + if i not in self.values[23]: + self.jack_lsp_liststore.append([i]) + #we are selecting the first one to prevent messing the args + if (not failed) and self.values[23]==[]: + self.jack_lsp_listview.get_selection().select_path((0,)) + #print self.jack_lsp_listview.get_selection().get_selected_rows() + def __makeCons__(self): + self.jack_button.connect("clicked",self.__jack_enabled_check__) + self.jack_lsp_refresh.connect("clicked",self.__runJackLSP__) + + def __jack_enabled_check__(self,widget): + self.channelsSpinButton.set_sensitive(not widget.get_active()) + self.freqSpinButton.set_sensitive(not widget.get_active()) + self.deviceEntry.set_sensitive(not widget.get_active()) + self.jack_lsp_listview.set_sensitive(widget.get_active()) + self.jack_lsp_refresh.set_sensitive(widget.get_active()) def __init__(self,values,optionsOpen): self.values=values + self.ports=[] 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") self.__subWidgets__() - self.__tooltips__() + self.__makeCons__() + self.__runJackLSP__() + self.__jack_enabled_check__(self.jack_button) + if self.values[24]==0: + self.__tooltips__() self.window.show() def main(self): diff --git a/gtk-recordmydesktop/src/rmdSimple.py b/gtk-recordmydesktop/src/rmdSimple.py index 145d51b..196db5e 100644 --- a/gtk-recordmydesktop/src/rmdSimple.py +++ b/gtk-recordmydesktop/src/rmdSimple.py @@ -184,6 +184,13 @@ class simpleWidget(object): def show(self,Event=None): self.window.show() self.hidden[0]=0 + def __swap_visibility__(self,widget=None,event=None): + if event.changed_mask==gtk.gdk.WINDOW_STATE_ICONIFIED: + if self.minimized==0: + self.hidden[0]=self.minimized=1 + else: + self.hidden[0]=self.minimized=0 + def advanced(self,button=None): if self.optionsOpen[0] ==0: self.optionsOpen[0]=1 @@ -213,7 +220,10 @@ class simpleWidget(object): self.fileSel.set_filename(self.values[4]) self.fileSel.show() def __select_window__(self,button): - (stdin,stdout,stderr)=os.popen3(['xwininfo','-frame'],'t') + xwininfo_com=['xwininfo','-frame'] + if self.values[21]==1: + xwininfo_com=['xwininfo'] + (stdin,stdout,stderr)=os.popen3(xwininfo_com,'t') wid=stdout.readlines() stdin.close() stdout.close() @@ -249,6 +259,7 @@ class simpleWidget(object): self.start_button.connect("clicked",self.trayIcon.record_ext) 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 __sound_check__(self,widget): self.s_quality.set_sensitive(widget.get_active()) self.values[2]=widget.get_active() @@ -300,6 +311,31 @@ class simpleWidget(object): self.values.append(int(savefile.readline())) savefile.readline() self.values.append(int(savefile.readline())==1) + #new options for 0.3.3 + p=savefile.readline() + if p=='': + self.values.append(rmdConfig.default_values[21]) + else: + self.values.append(int(savefile.readline())) + p=savefile.readline() + if p=='': + self.values.append(rmdConfig.default_values[22]) + self.values.append(rmdConfig.default_values[23]) + else: + self.values.append(int(savefile.readline())==1) + p=savefile.readline() + if p=='': + self.values.append(rmdConfig.default_values[23]) + else: + ports_t=savefile.readline().split(' ') + #get rid of the trailing \n + ports_t.pop() + self.values.append(ports_t) + p=savefile.readline() + if p=='': + self.values.append(rmdConfig.default_values[24]) + else: + self.values.append(int(savefile.readline())) return True except: return False @@ -349,7 +385,16 @@ class simpleWidget(object): savefile.write("%d\n"%self.values[19]) savefile.write("#overwrite existing files,0 disabled 1 enabled\n") savefile.write("%d\n"%self.values[20]) - + savefile.write("#Include window decorations,1 disabled 0 enabled\n") + savefile.write("%d\n"%self.values[21]) + savefile.write("#Use jack\n") + savefile.write("%d\n"%self.values[22]) + savefile.write("#last used jack ports\n") + for i in self.values[23]: + savefile.write("%s "%i) + savefile.write("\n") + savefile.write("#Tooltips,1 disabled 0 enabled\n") + savefile.write("%d\n"%self.values[24]) savefile.flush() savefile.close() return True @@ -360,6 +405,7 @@ class simpleWidget(object): if self.load_prefs()==False: self.values= rmdConfig.default_values self.optionsOpen=[0] + self.minimized=0 self.exited=0 self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("destroy", self.__exit__) @@ -375,7 +421,8 @@ class simpleWidget(object): self.trayIcon=trayIcon(self) self.__makeCons__() - self.__tooltips__() + if self.values[24]==0: + self.__tooltips__() self.s_quality.set_sensitive(self.values[2]) self.s_button.set_active(self.values[2]) self.window.show() diff --git a/gtk-recordmydesktop/src/rmdTrayIcon.py b/gtk-recordmydesktop/src/rmdTrayIcon.py index f7255be..44753ba 100644 --- a/gtk-recordmydesktop/src/rmdTrayIcon.py +++ b/gtk-recordmydesktop/src/rmdTrayIcon.py @@ -82,6 +82,10 @@ class trayIcon(object): 11*256:_('Improper window specification.'), 12*256:_('Cannot attach shared memory to proccess.'), 13*256:_('Cannot open file for writting.'), + 14*256:_('Cannot load the Jack library (dlopen/dlsym error on libjack.so).'), + 15*256:_('Cannot create new client.'), + 16*256:_('Cannot activate client.'), + 17*256:_('Port registration/connection failure.'), 11:_('Segmentation Fault') } @@ -194,8 +198,9 @@ class trayIcon(object): self.execargs.append('%d'%self.parent.values[7]) self.execargs.append('-freq') self.execargs.append('%d'%self.parent.values[8]) - self.execargs.append('-device') - self.execargs.append('%s'%self.parent.values[9]) + if self.parent.values[9]!='DEFAULT': + self.execargs.append('-device') + self.execargs.append('%s'%self.parent.values[9]) self.execargs.append('-v_quality') self.execargs.append('%d'%self.parent.values[10]) self.execargs.append('-s_quality') @@ -217,6 +222,10 @@ class trayIcon(object): self.execargs.append('--zero-compression') if self.parent.values[20] == True: self.execargs.append('--overwrite') + if self.parent.values[22] == True: + self.execargs.append('-use-jack') + for i in self.parent.values[23]: + self.execargs.append(i) #print execargs |