From fd170e7a0f7017f929145bf15ade7c70870ec1ab Mon Sep 17 00:00:00 2001 From: iovar Date: Mon, 18 Sep 2006 03:13:38 +0000 Subject: changed names of select and traypopup, interface for 0.2 ready git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@53 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- gtk-recordmydesktop/istanbulSelect.py | 153 ------------------------------- gtk-recordmydesktop/istanbulTrayPopup.py | 97 -------------------- gtk-recordmydesktop/rmdPrefsWidget.py | 123 +++++++++++++++++++++++-- gtk-recordmydesktop/rmdSelect.py | 153 +++++++++++++++++++++++++++++++ gtk-recordmydesktop/rmdTrayIcon.py | 7 +- gtk-recordmydesktop/rmdTrayPopup.py | 97 ++++++++++++++++++++ gtk-recordmydesktop/setup.py | 2 +- 7 files changed, 372 insertions(+), 260 deletions(-) delete mode 100644 gtk-recordmydesktop/istanbulSelect.py delete mode 100644 gtk-recordmydesktop/istanbulTrayPopup.py create mode 100644 gtk-recordmydesktop/rmdSelect.py create mode 100644 gtk-recordmydesktop/rmdTrayPopup.py diff --git a/gtk-recordmydesktop/istanbulSelect.py b/gtk-recordmydesktop/istanbulSelect.py deleted file mode 100644 index a88be50..0000000 --- a/gtk-recordmydesktop/istanbulSelect.py +++ /dev/null @@ -1,153 +0,0 @@ -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# Istanbul - a desktop session recorder -# Copyright (C) 2005 Zaheer Abbas Merali (zaheerabbas at merali dot org) -# All rights reserved. - -# This file may be distributed and/or modified under the terms of -# the GNU General Public License version 2 as published by -# the Free Software Foundation. -# This file is distributed without any warranty; without even the implied -# warranty of merchantability or fitness for a particular purpose. -# See "LICENSE.GPL" in the source distribution for more information. - -# Headers in this file shall remain intact. - -#This file has been modified to be used in gtk-recordMyDesktop -#by John Varouhakis -#area_return list has been added to retrieve the values -#original file name is select.py in Istanbul-0.2.1 -import gtk -import gtk.gdk - -class GtkAreaSelector(gtk.Window): - def __init__(self,area_return): - self.area_return=area_return - gtk.Window.__init__(self) - self.set_app_paintable(True) - self.fullscreen() - self.connect("expose-event", self.expose_cb) - self.connect("button-press-event", self.button_press_cb) - self.connect("button-release-event", self.button_release_cb) - self.connect("motion-notify-event", self.motion_notify_cb) - self.connect("delete-event", self.delete_cb) - self.connect("realize", self.realize_cb) - root = gtk.gdk.get_default_root_window() - (width, height) = root.get_size() - self.root = root.get_image(0, 0, width, height) - self.x1 = self.y1 = -1 - self.x2 = self.y2 = 0 - self.show_all() - - def realize_cb(self, widget): - gdkwindow = self.window - gdkwindow.set_events(gdkwindow.get_events() | - gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | - gtk.gdk.POINTER_MOTION_MASK); - cursor = gtk.gdk.Cursor(gtk.gdk.CROSSHAIR) - gdkwindow.set_cursor(cursor) - gdkwindow.set_back_pixmap(None, False) - - def expose_cb(self, widget, event): - dashes = [ 1.0, 2.0 ] - cr = self.window.cairo_create() - cr.rectangle(event.area.x, event.area.y, event.area.width, - event.area.height) - cr.clip() - self.window.draw_image(self.style.black_gc, self.root, event.area.x, - event.area.y, event.area.x, event.area.y, event.area.width, - event.area.height) - cr.set_line_width(1.0) - cr.set_source_rgba (1.0, 0.0, 0.0, 1.0) - cr.set_dash (dashes, 0.0) - cr.move_to (self.x1 - 0.5, 0.0) - cr.line_to (self.x1 - 0.5, event.area.y + event.area.height) - cr.move_to (0.0, self.y1 - 0.5) - cr.line_to (event.area.x + event.area.width, self.y1 - 0.5) - cr.stroke () - - if self.x1 >= 0: - x = min(self.x1, self.x2) - y = min(self.y1, self.y2) - w = max(self.x1, self.x2) - x - h = max(self.y1, self.y2) - y - cr.set_dash ([], 0.0) - cr.rectangle ( x, y, w, h) - cr.fill() - cr.set_source_rgba (0.0, 0.0, 0.5, 0.5) - cr.rectangle (x + 0.5, y + 0.5, w - 1, h - 1) - cr.stroke() - - return False - - def motion_notify_cb(self, widget, event): - self.queue_draw() - - if self.x1 >= 0: - rect = gtk.gdk.Rectangle() - rect.x = min(self.x1, min(self.x2, event.x + 1)) - rect.width = max(self.x1, max(self.x2, event.x + 1)) - rect.x - rect.y = min(self.y1, min(self.y2, event.y + 1)) - rect.height = max(self.y1, max(self.y2, event.y + 1)) - rect.y - self.queue_draw_area(rect.x, rect.y, rect.width, rect.height) - - self.x2 = event.x + 1 - self.y2 = event.y + 1 - - return True - - def button_release_cb(self, widget, event): - if event.button == 1 and self.x1 >= 0: - self.x2 = event.x + 1 - self.y2 = event.y + 1 - # stop - self.area_return[0]=int(self.x1) - self.area_return[1]=int(self.y1) - self.area_return[2]=int(self.x2) - self.area_return[3]=int(self.y2) - dialog = gtk.Dialog(title=None, parent=None, flags=0, buttons=None) - label1 = gtk.Label("Recording area for the next session\n\t\t\tis set to:") - dialog.vbox.pack_start(label1, True, True, 0) - label1.show() - label2 = gtk.Label("(%d,%d) - (%d,%d)\n"%(self.area_return[0],self.area_return[1],self.area_return[2],self.area_return[3])) - dialog.vbox.pack_start(label2, True, True, 0) - label2.show() - button = gtk.Button(label=None, stock=gtk.STOCK_OK) - dialog.vbox.pack_start(button, True, True, 0) - def __destroy(button): - dialog.destroy() - button.connect("clicked", __destroy) - button.show() - dialog.set_size_request(300,128) - dialog.show() - self.destroy() - - return True - - def button_press_cb(self, widget, event): - if event.button != 1: - self.x1 = self.y1 = -1 - # stop - #print "(%d, %d) - (%d, %d)" % (self.x1, self.y1, self.x2, self.y2) - #self.area_return[0]=self.x1 - #self.area_return[1]=self.y1 - #self.area_return[2]=self.x2 - #self.area_return[3]=self.y2 - #print self.area_return - self.destroy() - return True - self.x1 = event.x - self.y1 = event.y - self.queue_draw() - return True - - def delete_cb(self, widget): - pass - -if __name__ == "__main__": - w = GtkAreaSelector() - w.show() - gtk.main() - - diff --git a/gtk-recordmydesktop/istanbulTrayPopup.py b/gtk-recordmydesktop/istanbulTrayPopup.py deleted file mode 100644 index 2ce7efd..0000000 --- a/gtk-recordmydesktop/istanbulTrayPopup.py +++ /dev/null @@ -1,97 +0,0 @@ -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# Istanbul - A desktop recorder -# Copyright (C) 2005 Zaheer Abbas Merali (zaheerabbas at merali dot org) -# Copyright (C) 2006 John N. Laliberte (allanonjl@gentoo.org) (jlaliberte@gmail.com) -# Portions Copyright (C) 2004,2005 Fluendo, S.L. (www.fluendo.com). -# All rights reserved. - - -# This file may be distributed and/or modified under the terms of -# the GNU General Public License version 2 as published by -# the Free Software Foundation. -# This file is distributed without any warranty; without even the implied -# warranty of merchantability or fitness for a particular purpose. -# See "COPYING" in the source distribution for more information. - -#gtk-recordMyDesktop - a graphical frontend for recordMyDesktop -#Copyright (C) 2006 John Varouhakis -#This file has been modified to be used in gtk-recordMyDesktop -#original file name is tray_popup.py in istanbul-0.2.1 - -import gtk -import locale, gettext -_ = gettext.gettext -import istanbulSelect as iSel -import rmdPrefsWidget as pW - -class TrayPopupMenu: - options=None - def __init__(self,values,optionsOpen): - self.optionsOpen=optionsOpen - self.values=values - self._setup_popup_menu() - self.selector = None - - def _setup_popup_menu(self): - self.popupmenu = gtk.Menu() - self._setup_about() - self._setup_prefs_widget() - self._setup_select_area() - self._setup_quit() - - def _prefs_widget(self,button): - if self.optionsOpen[0] ==0: - self.optionsOpen[0]=1 - self.options=pW.prefsWidget(self.values,self.optionsOpen) - else: - if self.options != None: - self.options.window.destroy() - self.optionsOpen[0]=0 - def _setup_prefs_widget(self): - self.popupmenu_prefs_widget = gtk.ImageMenuItem( - gtk.STOCK_PREFERENCES) - self.popupmenu_prefs_widget.connect('activate', self._prefs_widget) - self.popupmenu.add(self.popupmenu_prefs_widget) - - def _setup_about(self): - self.popupmenu_aboutitem = gtk.ImageMenuItem(gtk.STOCK_ABOUT) - self.popupmenu_aboutitem.connect('activate', self._about) - self.popupmenu.add(self.popupmenu_aboutitem) - - def _about(self, button): - aboutdialog = gtk.AboutDialog() - aboutdialog.set_name(_('gtk-recordMyDesktop')) - aboutdialog.set_version("0.2") - aboutdialog.set_comments(_('a graphical frontend for recordMyDesktop')) - aboutdialog.set_copyright(_('Copyright (C) John Varouhakis\nPortions Copyright (C) 2005-6 Zaheer Abbas Merali, John N. Laliberte\nPortions Copyright (C) Fluendo S.L.')) - aboutdialog.set_authors(['recordMyDesktop and gtk-recordMyDesktop\nis written by John Varouhakis','Portions of gtk-recordMyDesktop\nare taken from Istanbul\n(http://live.gnome.org/Istanbul)\nwritten by\nZaheer Abbas Merali and John N. Laliberte']) - aboutdialog.set_website('http://recordmydesktop.sourceforge.net') - aboutdialog.set_license('GPL-2') - aboutdialog.set_translator_credits(_('')) - aboutdialog.show_all() - - def _setup_select_area(self): - self.popupmenu_selectarea = gtk.ImageMenuItem( - _("_Select Area to Record")) - self.popupmenu.add(self.popupmenu_selectarea) - self.popupmenu_selectarea.connect("activate", self._select_area_cb) - - def _select_area_cb(self, menuitem): - self.popupmenu.hide() - self.selector = iSel.GtkAreaSelector(self.values[5]) - self.selector.show() - - def _setup_quit(self): - self.popupmenu_quititem = gtk.ImageMenuItem(gtk.STOCK_QUIT) - self.popupmenu_quititem.connect('activate', self._quit) - self.popupmenu.add(self.popupmenu_quititem) - - def _quit(self, button): - gtk.main_quit() - - def show(self): - self.popupmenu.show_all() - self.popupmenu.popup(None, None, None, 3, gtk.get_current_event_time()) - diff --git a/gtk-recordmydesktop/rmdPrefsWidget.py b/gtk-recordmydesktop/rmdPrefsWidget.py index 6d40ae6..6ca4b3f 100644 --- a/gtk-recordmydesktop/rmdPrefsWidget.py +++ b/gtk-recordmydesktop/rmdPrefsWidget.py @@ -36,10 +36,13 @@ import os class prefsWidget(object): - labelStrings=[_('Frames Per Second'),_('Sound Recording'),_('Startup Delay(secs)')] + labelStrings=[_('Frames Per Second'),_('Sound Recording'),_('Startup Delay(secs)'), + _('Channels'),_('Frequency'),_('Device'),_('Video Quality'),_('Sound Quality'), + _('Display'),_('Mouse Cursor'),_('Full shots at every frame'),_('MIT-Shm extension'), + _('Drop Frames(encoder)'),_('Shared Threshold'),_('Quick Subsampling')] mouseStrings=[_('Normal'),_('White'),_('Black'),_('None')] stateStrings=[_('Enabled'),_('Disabled')] - tabStrings=[_('Basic'),_('Sound'),_('Encoding'),_('Misc')] + tabStrings=[_('Basic'),_('Sound'),_('Encoding'),_('Advanced')] def destroy(self,Event=None): self.values[0]=self.fpsSpinButton.get_value_as_int() @@ -47,6 +50,19 @@ class prefsWidget(object): self.values[2]=self.soundComboBox.get_active() self.values[3]=self.fullComboBox.get_active() self.values[4]=self.pathEntry.get_text() + #self.values[5]=self.are + self.values[6]=self.delaySpinButton.get_value_as_int() + self.values[7]=self.channelsSpinButton.get_value_as_int() + self.values[8]=self.freqSpinButton.get_value_as_int() + self.values[9]=self.deviceEntry.get_text().replace(' ','') + self.values[10]=self.vidqSpinButton.get_value_as_int() + self.values[11]=self.soundqSpinButton.get_value_as_int() + self.values[12]=self.displayEntry.get_text().replace(' ','') + self.values[13]=self.sharedComboBox.get_active() + self.values[14]=self.frdropComboBox.get_active() + self.values[15]=self.thresSpinButton.get_value_as_int() + self.values[16]=self.quickComboBox.get_active() + self.window.destroy() self.optionsOpen[0]=0 @@ -75,7 +91,7 @@ class prefsWidget(object): self.boxes={} self.labelbox={} for i in range(4): - self.labelbox[i]=gtk.VBox(homogeneous=True, spacing=10) + self.labelbox[i]=gtk.VBox(homogeneous=False, spacing=20) self.notebook = gtk.Notebook() #basic page @@ -103,10 +119,10 @@ class prefsWidget(object): self.boxes[i]=gtk.HBox(homogeneous=False, spacing=0) self.boxes[i].pack_start(self.labels[i],expand=False,fill=False) self.labels[i].show() - self.labelbox[0].pack_start(self.boxes[i]) + self.labelbox[0].pack_start(self.boxes[i],expand=False,fill=False) self.boxes[3]=gtk.HBox(homogeneous=False, spacing=20) - self.labelbox[0].pack_start(self.boxes[3]) + self.labelbox[0].pack_start(self.boxes[3],expand=False,fill=False) placeholder2=gtk.Label("") placeholder2.show() self.labelbox[0].pack_start(placeholder2) @@ -128,20 +144,115 @@ class prefsWidget(object): for i in range(5): self.boxes[i].show() #sound page + for i in xrange(3,6): + self.labels[i]=gtk.Label(self.labelStrings[i]) + self.labels[i].set_justify(gtk.JUSTIFY_LEFT) + self.boxes[i+5]=gtk.HBox(homogeneous=False, spacing=0) + self.boxes[i+5].pack_start(self.labels[i],expand=False,fill=False) + self.labels[i].show() + #self.boxes[i+5].show() + self.labelbox[1].pack_start(self.boxes[i+5],expand=False,fill=False) + 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) + self.boxes[8].pack_end(self.channelsSpinButton,expand=False,fill=False) + self.channelsSpinButton.show() + self.boxes[8].show() + + self.freqAdjustment=gtk.Adjustment(value=self.values[8], lower=0,upper=44100, step_incr=1, page_incr=100, page_size=0) + self.freqSpinButton= gtk.SpinButton(self.freqAdjustment, climb_rate=0.5, digits=0) + self.boxes[9].pack_end(self.freqSpinButton,expand=False,fill=False) + self.freqSpinButton.show() + self.boxes[9].show() + + self.deviceEntry= gtk.Entry(max=0) + self.deviceEntry.set_text(self.values[9]) + self.boxes[10].pack_end(self.deviceEntry,expand=False,fill=False) + self.deviceEntry.show() + self.boxes[10].show() + + #encoding page + for i in xrange(6,8): + self.labels[i]=gtk.Label(self.labelStrings[i]) + self.labels[i].set_justify(gtk.JUSTIFY_LEFT) + self.boxes[i+5]=gtk.HBox(homogeneous=False, spacing=0) + self.boxes[i+5].pack_start(self.labels[i],expand=False,fill=False) + self.labels[i].show() + #self.boxes[i+5].show() + self.labelbox[2].pack_start(self.boxes[i+5],expand=False,fill=False) + self.vidqAdjustment=gtk.Adjustment(value=self.values[10], lower=0,upper=63, step_incr=1, page_incr=1, page_size=1) + self.vidqSpinButton= gtk.SpinButton(self.vidqAdjustment, climb_rate=0.5, digits=0) + self.boxes[11].pack_end(self.vidqSpinButton,expand=False,fill=False) + self.vidqSpinButton.show() + self.boxes[11].show() + self.soundqAdjustment=gtk.Adjustment(value=self.values[11], lower=-1,upper=10, step_incr=1, page_incr=1, page_size=1) + self.soundqSpinButton= gtk.SpinButton(self.soundqAdjustment, climb_rate=0.5, digits=0) + self.boxes[12].pack_end(self.soundqSpinButton,expand=False,fill=False) + self.soundqSpinButton.show() + self.boxes[12].show() + #misc page + for i in xrange(8,15): + self.labels[i]=gtk.Label(self.labelStrings[i]) + self.labels[i].set_justify(gtk.JUSTIFY_LEFT) + self.boxes[i+5]=gtk.HBox(homogeneous=False, spacing=0) + self.boxes[i+5].pack_start(self.labels[i],expand=False,fill=False) + self.labels[i].show() + #self.boxes[i+5].show() + self.labelbox[3].pack_start(self.boxes[i+5],expand=False,fill=False) + self.displayEntry= gtk.Entry(max=0) + self.displayEntry.set_text(self.values[12]) + self.boxes[13].pack_end(self.displayEntry,expand=False,fill=False) + self.displayEntry.show() + self.boxes[13].show() self.mouseComboBox = gtk.combo_box_new_text() for i in range(4): self.mouseComboBox.append_text(self.mouseStrings[i]) - self.mouseComboBox.set_active(self.values[0]) + self.mouseComboBox.set_active(self.values[1]) + self.boxes[14].pack_end(self.mouseComboBox,expand=False,fill=False) + self.mouseComboBox.show() + self.boxes[14].show() self.fullComboBox = gtk.combo_box_new_text() for i in range(2): self.fullComboBox.append_text(self.stateStrings[i]) self.fullComboBox.set_active(self.values[3]) + self.boxes[15].pack_end(self.fullComboBox,expand=False,fill=False) + self.fullComboBox.show() + self.boxes[15].show() + + self.sharedComboBox = gtk.combo_box_new_text() + for i in range(2): + self.sharedComboBox.append_text(self.stateStrings[i]) + self.sharedComboBox.set_active(self.values[13]) + self.boxes[16].pack_end(self.sharedComboBox,expand=False,fill=False) + self.sharedComboBox.show() + self.boxes[16].show() + self.frdropComboBox = gtk.combo_box_new_text() + for i in range(2): + self.frdropComboBox.append_text(self.stateStrings[i]) + self.frdropComboBox.set_active(self.values[14]) + self.boxes[17].pack_end(self.frdropComboBox,expand=False,fill=False) + self.frdropComboBox.show() + self.boxes[17].show() + + self.thresAdjustment=gtk.Adjustment(value=self.values[15], lower=0,upper=100, step_incr=1, page_incr=5, page_size=1) + self.thresSpinButton= gtk.SpinButton(self.thresAdjustment, climb_rate=0.5, digits=0) + self.boxes[18].pack_end(self.thresSpinButton,expand=False,fill=False) + self.thresSpinButton.show() + self.boxes[18].show() + + self.quickComboBox = gtk.combo_box_new_text() + for i in range(2): + self.quickComboBox.append_text(self.stateStrings[i]) + self.quickComboBox.set_active(self.values[16]) + self.boxes[19].pack_end(self.quickComboBox,expand=False,fill=False) + self.quickComboBox.show() + self.boxes[19].show() + #append and show for i in range(4): self.notebook.append_page(self.labelbox[i],gtk.Label(self.tabStrings[i])) diff --git a/gtk-recordmydesktop/rmdSelect.py b/gtk-recordmydesktop/rmdSelect.py new file mode 100644 index 0000000..a88be50 --- /dev/null +++ b/gtk-recordmydesktop/rmdSelect.py @@ -0,0 +1,153 @@ +# -*- Mode: Python -*- +# vi:si:et:sw=4:sts=4:ts=4 +# +# Istanbul - a desktop session recorder +# Copyright (C) 2005 Zaheer Abbas Merali (zaheerabbas at merali dot org) +# All rights reserved. + +# This file may be distributed and/or modified under the terms of +# the GNU General Public License version 2 as published by +# the Free Software Foundation. +# This file is distributed without any warranty; without even the implied +# warranty of merchantability or fitness for a particular purpose. +# See "LICENSE.GPL" in the source distribution for more information. + +# Headers in this file shall remain intact. + +#This file has been modified to be used in gtk-recordMyDesktop +#by John Varouhakis +#area_return list has been added to retrieve the values +#original file name is select.py in Istanbul-0.2.1 +import gtk +import gtk.gdk + +class GtkAreaSelector(gtk.Window): + def __init__(self,area_return): + self.area_return=area_return + gtk.Window.__init__(self) + self.set_app_paintable(True) + self.fullscreen() + self.connect("expose-event", self.expose_cb) + self.connect("button-press-event", self.button_press_cb) + self.connect("button-release-event", self.button_release_cb) + self.connect("motion-notify-event", self.motion_notify_cb) + self.connect("delete-event", self.delete_cb) + self.connect("realize", self.realize_cb) + root = gtk.gdk.get_default_root_window() + (width, height) = root.get_size() + self.root = root.get_image(0, 0, width, height) + self.x1 = self.y1 = -1 + self.x2 = self.y2 = 0 + self.show_all() + + def realize_cb(self, widget): + gdkwindow = self.window + gdkwindow.set_events(gdkwindow.get_events() | + gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | + gtk.gdk.POINTER_MOTION_MASK); + cursor = gtk.gdk.Cursor(gtk.gdk.CROSSHAIR) + gdkwindow.set_cursor(cursor) + gdkwindow.set_back_pixmap(None, False) + + def expose_cb(self, widget, event): + dashes = [ 1.0, 2.0 ] + cr = self.window.cairo_create() + cr.rectangle(event.area.x, event.area.y, event.area.width, + event.area.height) + cr.clip() + self.window.draw_image(self.style.black_gc, self.root, event.area.x, + event.area.y, event.area.x, event.area.y, event.area.width, + event.area.height) + cr.set_line_width(1.0) + cr.set_source_rgba (1.0, 0.0, 0.0, 1.0) + cr.set_dash (dashes, 0.0) + cr.move_to (self.x1 - 0.5, 0.0) + cr.line_to (self.x1 - 0.5, event.area.y + event.area.height) + cr.move_to (0.0, self.y1 - 0.5) + cr.line_to (event.area.x + event.area.width, self.y1 - 0.5) + cr.stroke () + + if self.x1 >= 0: + x = min(self.x1, self.x2) + y = min(self.y1, self.y2) + w = max(self.x1, self.x2) - x + h = max(self.y1, self.y2) - y + cr.set_dash ([], 0.0) + cr.rectangle ( x, y, w, h) + cr.fill() + cr.set_source_rgba (0.0, 0.0, 0.5, 0.5) + cr.rectangle (x + 0.5, y + 0.5, w - 1, h - 1) + cr.stroke() + + return False + + def motion_notify_cb(self, widget, event): + self.queue_draw() + + if self.x1 >= 0: + rect = gtk.gdk.Rectangle() + rect.x = min(self.x1, min(self.x2, event.x + 1)) + rect.width = max(self.x1, max(self.x2, event.x + 1)) - rect.x + rect.y = min(self.y1, min(self.y2, event.y + 1)) + rect.height = max(self.y1, max(self.y2, event.y + 1)) - rect.y + self.queue_draw_area(rect.x, rect.y, rect.width, rect.height) + + self.x2 = event.x + 1 + self.y2 = event.y + 1 + + return True + + def button_release_cb(self, widget, event): + if event.button == 1 and self.x1 >= 0: + self.x2 = event.x + 1 + self.y2 = event.y + 1 + # stop + self.area_return[0]=int(self.x1) + self.area_return[1]=int(self.y1) + self.area_return[2]=int(self.x2) + self.area_return[3]=int(self.y2) + dialog = gtk.Dialog(title=None, parent=None, flags=0, buttons=None) + label1 = gtk.Label("Recording area for the next session\n\t\t\tis set to:") + dialog.vbox.pack_start(label1, True, True, 0) + label1.show() + label2 = gtk.Label("(%d,%d) - (%d,%d)\n"%(self.area_return[0],self.area_return[1],self.area_return[2],self.area_return[3])) + dialog.vbox.pack_start(label2, True, True, 0) + label2.show() + button = gtk.Button(label=None, stock=gtk.STOCK_OK) + dialog.vbox.pack_start(button, True, True, 0) + def __destroy(button): + dialog.destroy() + button.connect("clicked", __destroy) + button.show() + dialog.set_size_request(300,128) + dialog.show() + self.destroy() + + return True + + def button_press_cb(self, widget, event): + if event.button != 1: + self.x1 = self.y1 = -1 + # stop + #print "(%d, %d) - (%d, %d)" % (self.x1, self.y1, self.x2, self.y2) + #self.area_return[0]=self.x1 + #self.area_return[1]=self.y1 + #self.area_return[2]=self.x2 + #self.area_return[3]=self.y2 + #print self.area_return + self.destroy() + return True + self.x1 = event.x + self.y1 = event.y + self.queue_draw() + return True + + def delete_cb(self, widget): + pass + +if __name__ == "__main__": + w = GtkAreaSelector() + w.show() + gtk.main() + + diff --git a/gtk-recordmydesktop/rmdTrayIcon.py b/gtk-recordmydesktop/rmdTrayIcon.py index 0df7dd4..4358b7c 100644 --- a/gtk-recordmydesktop/rmdTrayIcon.py +++ b/gtk-recordmydesktop/rmdTrayIcon.py @@ -30,8 +30,8 @@ pygtk.require('2.0') import gtk import egg.trayicon -import istanbulSelect as isel -import istanbulTrayPopup as iTP +import rmdSelect as isel +import rmdTrayPopup as iTP import os #values struct: @@ -56,7 +56,8 @@ import os class trayIcon(object): - values=[15,0,0,1,os.path.join(os.getenv('HOME'),'out.ogg'),[-1,-1,-1,-1],0] + values=[15,0,0,1,os.path.join(os.getenv('HOME'),'out.ogg'),[-1,-1,-1,-1],0, + 1,22050,'hw:0,0',63,10,"$DISPLAY",0,1,75,1] event_box = gtk.EventBox() state=0#0 stopped,1 recording,2 paused rmdPid=None diff --git a/gtk-recordmydesktop/rmdTrayPopup.py b/gtk-recordmydesktop/rmdTrayPopup.py new file mode 100644 index 0000000..7df1c87 --- /dev/null +++ b/gtk-recordmydesktop/rmdTrayPopup.py @@ -0,0 +1,97 @@ +# -*- Mode: Python -*- +# vi:si:et:sw=4:sts=4:ts=4 +# +# Istanbul - A desktop recorder +# Copyright (C) 2005 Zaheer Abbas Merali (zaheerabbas at merali dot org) +# Copyright (C) 2006 John N. Laliberte (allanonjl@gentoo.org) (jlaliberte@gmail.com) +# Portions Copyright (C) 2004,2005 Fluendo, S.L. (www.fluendo.com). +# All rights reserved. + + +# This file may be distributed and/or modified under the terms of +# the GNU General Public License version 2 as published by +# the Free Software Foundation. +# This file is distributed without any warranty; without even the implied +# warranty of merchantability or fitness for a particular purpose. +# See "COPYING" in the source distribution for more information. + +#gtk-recordMyDesktop - a graphical frontend for recordMyDesktop +#Copyright (C) 2006 John Varouhakis +#This file has been modified to be used in gtk-recordMyDesktop +#original file name is tray_popup.py in istanbul-0.2.1 + +import gtk +import locale, gettext +_ = gettext.gettext +import rmdSelect as iSel +import rmdPrefsWidget as pW + +class TrayPopupMenu: + options=None + def __init__(self,values,optionsOpen): + self.optionsOpen=optionsOpen + self.values=values + self._setup_popup_menu() + self.selector = None + + def _setup_popup_menu(self): + self.popupmenu = gtk.Menu() + self._setup_about() + self._setup_prefs_widget() + self._setup_select_area() + self._setup_quit() + + def _prefs_widget(self,button): + if self.optionsOpen[0] ==0: + self.optionsOpen[0]=1 + self.options=pW.prefsWidget(self.values,self.optionsOpen) + else: + if self.options != None: + self.options.window.destroy() + self.optionsOpen[0]=0 + def _setup_prefs_widget(self): + self.popupmenu_prefs_widget = gtk.ImageMenuItem( + gtk.STOCK_PREFERENCES) + self.popupmenu_prefs_widget.connect('activate', self._prefs_widget) + self.popupmenu.add(self.popupmenu_prefs_widget) + + def _setup_about(self): + self.popupmenu_aboutitem = gtk.ImageMenuItem(gtk.STOCK_ABOUT) + self.popupmenu_aboutitem.connect('activate', self._about) + self.popupmenu.add(self.popupmenu_aboutitem) + + def _about(self, button): + aboutdialog = gtk.AboutDialog() + aboutdialog.set_name(_('gtk-recordMyDesktop')) + aboutdialog.set_version("0.2") + aboutdialog.set_comments(_('a graphical frontend for recordMyDesktop')) + aboutdialog.set_copyright(_('Copyright (C) John Varouhakis\nPortions Copyright (C) 2005-6 Zaheer Abbas Merali, John N. Laliberte\nPortions Copyright (C) Fluendo S.L.')) + aboutdialog.set_authors(['recordMyDesktop and gtk-recordMyDesktop\nis written by John Varouhakis','Portions of gtk-recordMyDesktop\nare taken from Istanbul\n(http://live.gnome.org/Istanbul)\nwritten by\nZaheer Abbas Merali and John N. Laliberte']) + aboutdialog.set_website('http://recordmydesktop.sourceforge.net') + aboutdialog.set_license('GPL-2') + aboutdialog.set_translator_credits(_('')) + aboutdialog.show_all() + + def _setup_select_area(self): + self.popupmenu_selectarea = gtk.ImageMenuItem( + _("_Select Area to Record")) + self.popupmenu.add(self.popupmenu_selectarea) + self.popupmenu_selectarea.connect("activate", self._select_area_cb) + + def _select_area_cb(self, menuitem): + self.popupmenu.hide() + self.selector = iSel.GtkAreaSelector(self.values[5]) + self.selector.show() + + def _setup_quit(self): + self.popupmenu_quititem = gtk.ImageMenuItem(gtk.STOCK_QUIT) + self.popupmenu_quititem.connect('activate', self._quit) + self.popupmenu.add(self.popupmenu_quititem) + + def _quit(self, button): + gtk.main_quit() + + def show(self): + self.popupmenu.show_all() + self.popupmenu.popup(None, None, None, 3, gtk.get_current_event_time()) + diff --git a/gtk-recordmydesktop/setup.py b/gtk-recordmydesktop/setup.py index 626d422..46ba2dd 100644 --- a/gtk-recordmydesktop/setup.py +++ b/gtk-recordmydesktop/setup.py @@ -7,7 +7,7 @@ author_email='johnvarouhakis@gmail.com', description='A pyGTK frontend for recordMyDesktop', license='GNU GENERAL PUBLIC LICENSE Version 2', name='gtk-recordMyDesktop',version='0.2' , -py_modules=['rmdPrefsWidget','rmdTrayIcon','istanbulSelect','istanbulTrayPopup'], +py_modules=['rmdPrefsWidget','rmdTrayIcon','rmdSelect','rmdTrayPopup'], scripts=['gtk-recordMyDesktop'], data_files=[('/usr/share/applications/',['gtk-recordmydesktop.desktop']), ('/usr/share/pixmaps/',['gtk-recordmydesktop.png'])], -- cgit v1.2.3