summaryrefslogtreecommitdiff
path: root/qt-recordmydesktop/src
diff options
context:
space:
mode:
Diffstat (limited to 'qt-recordmydesktop/src')
-rw-r--r--qt-recordmydesktop/src/Makefile.am29
-rw-r--r--qt-recordmydesktop/src/__init__.py4
-rwxr-xr-xqt-recordmydesktop/src/qt-recordMyDesktop43
-rw-r--r--qt-recordmydesktop/src/qt-recordmydesktop.desktop12
-rw-r--r--qt-recordmydesktop/src/qt-recordmydesktop.svg99
-rw-r--r--qt-recordmydesktop/src/rmdConfig.py.in36
-rw-r--r--qt-recordmydesktop/src/rmdFrame.py98
-rw-r--r--qt-recordmydesktop/src/rmdMonitor.py118
-rw-r--r--qt-recordmydesktop/src/rmdPrefsWidget.py362
-rw-r--r--qt-recordmydesktop/src/rmdSelect.py84
-rw-r--r--qt-recordmydesktop/src/rmdSelectThumb.py164
-rw-r--r--qt-recordmydesktop/src/rmdSimple.py443
-rw-r--r--qt-recordmydesktop/src/rmdTrayIcon.py331
-rw-r--r--qt-recordmydesktop/src/rmdTrayPopup.py70
14 files changed, 1893 insertions, 0 deletions
diff --git a/qt-recordmydesktop/src/Makefile.am b/qt-recordmydesktop/src/Makefile.am
new file mode 100644
index 0000000..bf77338
--- /dev/null
+++ b/qt-recordmydesktop/src/Makefile.am
@@ -0,0 +1,29 @@
+include $(top_srcdir)/m4/python.mk
+
+bin_SCRIPTS=qt-recordMyDesktop
+
+qt_recordMyDesktopdir=$(pythondir)/qt-recordMyDesktop
+
+qt_recordMyDesktop_PYTHON = \
+ rmdSelect.py\
+ rmdTrayIcon.py\
+ rmdSelectThumb.py\
+ rmdTrayPopup.py\
+ rmdPrefsWidget.py\
+ rmdSimple.py\
+ rmdConfig.py\
+ rmdMonitor.py\
+ rmdFrame.py\
+ __init__.py
+
+desktopdir = $(datadir)/applications
+
+desktop_DATA =qt-recordmydesktop.desktop
+
+pixmapdir = $(datadir)/pixmaps
+pixmap_DATA = qt-recordmydesktop.png
+
+EXTRA_DIST=qt-recordMyDesktop qt-recordmydesktop.desktop qt-recordmydesktop.png qt-recordmydesktop.svg
+
+clean-local:
+ rm -rf *.pyc *.pyo
diff --git a/qt-recordmydesktop/src/__init__.py b/qt-recordmydesktop/src/__init__.py
new file mode 100644
index 0000000..7262f15
--- /dev/null
+++ b/qt-recordmydesktop/src/__init__.py
@@ -0,0 +1,4 @@
+#
+#
+#
+
diff --git a/qt-recordmydesktop/src/qt-recordMyDesktop b/qt-recordmydesktop/src/qt-recordMyDesktop
new file mode 100755
index 0000000..e8b8bb7
--- /dev/null
+++ b/qt-recordmydesktop/src/qt-recordMyDesktop
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+
+#/******************************************************************************
+#* qt-recordMyDesktop *
+#*******************************************************************************
+#* *
+#* Copyright (C) 2007 John Varouhakis *
+#* *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+#* *
+#* *
+#* *
+#* For further information contact me at johnvarouhakis@gmail.com *
+#******************************************************************************/
+
+from qt-recordMyDesktop import rmdSimple
+
+def main():
+ tr=rmdSimple.simpleWidget()
+
+
+main()
+
+
+
+
+
+
+
diff --git a/qt-recordmydesktop/src/qt-recordmydesktop.desktop b/qt-recordmydesktop/src/qt-recordmydesktop.desktop
new file mode 100644
index 0000000..5c79b89
--- /dev/null
+++ b/qt-recordmydesktop/src/qt-recordmydesktop.desktop
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=gtk-recordMyDesktop
+Comment=Frontend for recordMyDesktop
+Comment[fr]=Interface pour recordmydesktop
+Exec=gtk-recordMyDesktop
+Terminal=false
+Type=Application
+Icon=gtk-recordmydesktop.png
+Categories=AudioVideo;Recorder;
+StartupNotify=false
diff --git a/qt-recordmydesktop/src/qt-recordmydesktop.svg b/qt-recordmydesktop/src/qt-recordmydesktop.svg
new file mode 100644
index 0000000..2d76d5b
--- /dev/null
+++ b/qt-recordmydesktop/src/qt-recordmydesktop.svg
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.0"
+ width="468pt"
+ height="468pt"
+ viewBox="0 0 468 468"
+ preserveAspectRatio="xMidYMid meet"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docname="rmddb1.png.svg"
+ sodipodi:docbase="/home/iovar/workspace/recordMyDesktop/NO_CVS">
+ <defs
+ id="defs13">
+ <linearGradient
+ id="linearGradient2764">
+ <stop
+ style="stop-color:#32000c;stop-opacity:1;"
+ offset="0"
+ id="stop2776" />
+ <stop
+ id="stop2769"
+ offset="0.53846157"
+ style="stop-color:#7d001f;stop-opacity:1;" />
+ <stop
+ style="stop-color:#210019;stop-opacity:1;"
+ offset="1"
+ id="stop2768" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2764"
+ id="radialGradient2770"
+ cx="330.83143"
+ cy="238.79865"
+ fx="330.83143"
+ fy="238.79865"
+ r="61.69674"
+ gradientTransform="matrix(1,0,0,0.988932,0,2.643133)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2764"
+ id="radialGradient2772"
+ cx="233.28449"
+ cy="256.5222"
+ fx="233.28449"
+ fy="256.5222"
+ r="222.42589"
+ gradientTransform="matrix(1,0,0,0.950779,0,12.62635)"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-height="579"
+ inkscape:window-width="931"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:zoom="0.64786325"
+ inkscape:cx="292.5"
+ inkscape:cy="290.95646"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ inkscape:current-layer="svg2" />
+ <metadata
+ id="metadata4">
+Created by potrace 1.7, written by Peter Selinger 2001-2005
+<rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+</rdf:RDF>
+</metadata>
+ <path
+ style="fill:url(#radialGradient2772);stroke:none;fill-opacity:1.0"
+ id="path8"
+ d="M 124.3125,64.35 C -4.3875,121.3875 -29.25,270.5625 78.975,340.7625 C 127.2375,372.9375 127.2375,389.025 80.4375,400.725 C -11.7,424.125 86.2875,468 231.075,468 C 333.45,468 418.275,444.6 429.975,413.8875 C 434.3625,403.65 429.975,394.875 419.7375,394.875 C 368.55,393.4125 364.1625,368.55 408.0375,324.675 C 495.7875,238.3875 457.7625,106.7625 331.9875,59.9625 C 276.4125,38.025 178.425,40.95 124.3125,64.35 z M 381.7125,111.15 C 466.5375,153.5625 457.7625,289.575 370.0125,323.2125 C 282.2625,356.85 225.225,310.05 232.5375,212.0625 L 235.4625,168.1875 L 191.5875,219.375 C 152.1,267.6375 147.7125,269.1 111.15,250.0875 C 59.9625,222.3 62.8875,195.975 124.3125,137.475 C 194.5125,71.6625 286.65,61.425 381.7125,111.15 z M 383.175,429.975 C 345.15,451.9125 137.475,460.6875 125.775,440.2125 C 118.4625,428.5125 143.325,424.125 207.675,424.125 C 263.25,422.6625 310.05,415.35 327.6,402.1875 C 348.075,386.1 359.775,386.1 381.7125,399.2625 C 406.575,415.35 406.575,416.8125 383.175,429.975 z " />
+ <path
+ style="fill:url(#radialGradient2770);stroke:none;fill-opacity:1.0"
+ id="path10"
+ d="M 277.875,195.975 C 261.7875,216.45 266.175,219.375 305.6625,219.375 C 348.075,219.375 351,222.3 342.225,258.8625 L 331.9875,299.8125 L 364.1625,272.025 C 409.5,231.075 399.2625,184.275 342.225,178.425 C 314.4375,175.5 289.575,182.8125 277.875,195.975 z " />
+</svg>
diff --git a/qt-recordmydesktop/src/rmdConfig.py.in b/qt-recordmydesktop/src/rmdConfig.py.in
new file mode 100644
index 0000000..f3194c5
--- /dev/null
+++ b/qt-recordmydesktop/src/rmdConfig.py.in
@@ -0,0 +1,36 @@
+import os
+VERSION='@VERSION@'
+PREFIX='@PREFIX@'
+locale_install_dir=os.path.join('@DATADIR@'.replace("${prefix}",PREFIX), 'locale')
+
+#binary values expressed with 1 and zero instead of True and False
+#are upside down. That means 0 is enabled and 1 disabled
+
+default_values=[15, #framerate
+ 0, #cursor
+ True, #sound
+ 1, #full shots,0 on 1 off
+ os.path.join(os.getenv('HOME'),'out.ogg'), #filename
+ [-1,-1,-1,-1], #recording area(<0 means auto)
+ 0, #delay ,unused on 0.3
+ 1, #no of channels
+ 22050, #frequency
+ 'DEFAULT', #device
+ 63, #video quality
+ 10, #audio quality
+ "$DISPLAY", #display, this is not interpreted as an env variable
+ #but when the value is set to this the argument is omitted
+ 0, #shared memory,0 on 1 off
+ 1, #drop frames,unused in 0.3,0, removed at 0.3.4, preserved for compatibility of prefs file.
+ 75, #shared threshold.Removed at 0.3.4, preserved for compatibility of prefs file.
+ 1, #quick subsampling,0 on 1 off
+ "/tmp", #working directory
+ 1, #on the fly encoding,0 on 1 off
+ 1, #zero compression,0 on 1 off
+ False, #overwrite existing files
+ 0, #include window decorations, 0 on 1 off
+ False, #Use jack
+ [], #jack ports
+ 0, #tooltips,0 on 1 off
+ 0, #draw an on-screen frame, surrounding the capture area,0 on 1 off
+ ]
diff --git a/qt-recordmydesktop/src/rmdFrame.py b/qt-recordmydesktop/src/rmdFrame.py
new file mode 100644
index 0000000..ef05fc6
--- /dev/null
+++ b/qt-recordmydesktop/src/rmdFrame.py
@@ -0,0 +1,98 @@
+#/******************************************************************************
+#* qt-recordMyDesktop *
+#*******************************************************************************
+#* *
+#* Copyright (C) 2007 John Varouhakis *
+#* *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+#* *
+#* *
+#* *
+#* For further information contact me at johnvarouhakis@gmail.com *
+#******************************************************************************/
+from PyQt4 import QtGui,QtCore
+
+class rmdFrame:
+ borderwidth=6
+ outlinewidth=1
+
+ def __init__(self,x,y,w,h):
+ self.window=QtGui.QWidget(None,QtCore.Qt.X11BypassWindowManagerHint|QtCore.Qt.WindowStaysOnTopHint)
+ self.x=x
+ self.y=y
+ self.w=w
+ self.h=h
+
+ self.mask = QtGui.QBitmap(self.w+self.borderwidth*2,
+ self.h+self.borderwidth*2)
+ self.mask.fill(QtCore.Qt.color1)
+
+ self.window.paintEvent=self.paintEvent
+ self.window.setWindowTitle("qt-recordMyDesktop frame")
+
+ self.window.setFixedSize(self.w+self.borderwidth*2,
+ self.h+self.borderwidth*2)
+
+ self.window.move(self.x-self.borderwidth,
+ self.y-self.borderwidth)
+ self.window.show()
+
+ def paintEvent(self,Event):
+
+ painterw= QtGui.QPainter(self.window)
+ painterw.fillRect(0,0,self.w+self.borderwidth*2,
+ self.h+self.borderwidth*2,
+ QtGui.QBrush(QtCore.Qt.white,
+ QtCore.Qt.SolidPattern))
+ painterw.fillRect(self.outlinewidth,
+ self.outlinewidth,
+ self.w+(self.borderwidth-
+ self.outlinewidth)*2,
+ self.h+(self.borderwidth-
+ self.outlinewidth)*2,
+ QtGui.QBrush(QtCore.Qt.black,
+ QtCore.Qt.SolidPattern))
+ painterw.fillRect(self.borderwidth-self.outlinewidth,
+ self.borderwidth-self.outlinewidth,
+ self.w+self.outlinewidth*2,
+ self.h+self.outlinewidth*2,
+ QtGui.QBrush(QtCore.Qt.white,
+ QtCore.Qt.SolidPattern))
+ if self.window.mask().isEmpty():
+ painter = QtGui.QPainter(self.mask)
+ painter.fillRect(self.borderwidth,
+ self.borderwidth,
+ self.w,self.h,
+ QtGui.QBrush(QtCore.Qt.color0,
+ QtCore.Qt.SolidPattern))
+ self.window.setMask(self.mask)
+ def pass_e(self):
+ pass
+
+ def destroy(self):
+ #self.area.destroy()
+ try:
+ self.window.close()
+ except:
+ pass
+
+if __name__ == "__main__":
+ import sys
+
+ app=QtGui.QApplication(sys.argv)
+ app.values=[[-1,-1,-1,-1]]
+ w = rmdFrame(100,100,340,260)
+ app.exec_()
diff --git a/qt-recordmydesktop/src/rmdMonitor.py b/qt-recordmydesktop/src/rmdMonitor.py
new file mode 100644
index 0000000..4df7eab
--- /dev/null
+++ b/qt-recordmydesktop/src/rmdMonitor.py
@@ -0,0 +1,118 @@
+#/******************************************************************************
+#* qt-recordMyDesktop *
+#*******************************************************************************
+#* *
+#* Copyright (C) 2007 John Varouhakis *
+#* *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+#* *
+#* *
+#* *
+#* For further information contact me at johnvarouhakis@gmail.com *
+#******************************************************************************/
+
+
+from PyQt4 import QtGui,QtCore
+import locale, gettext
+import rmdConfig
+def _(s):
+ return QtCore.QString.fromUtf8(gettext.gettext(s))
+
+gettext.textdomain('qt-recordMyDesktop')
+gettext.bindtextdomain('qt-recordMyDesktop',rmdConfig.locale_install_dir)
+import popen2
+import os,fcntl,signal
+
+class rmdMonitor(object):
+ labeString=_("Please wait while your recording is being encoded\nWARNING!!!\nIf you press Cancel or close this window,\nthis proccess cannot be resumed!")
+
+ counter_fraction=0.0
+
+ def destroy_and_kill(self,Event=None):
+ self.timed_id.stop()
+ self.stop_encoding()
+ def destroy(self,Event=None):
+ self.window.close()
+ self.parent.show()
+ def update_counter(self):
+ strstdout=""
+ try:
+ strstdout=self.stdout.read()
+ if strstdout =='':
+ self.destroy()
+ except:
+ return True
+ try:
+ string=strstdout.replace("[","").replace("%] ","").replace("\n","").split("\r")
+ self.counter_fraction=max(self.counter_fraction,int(string.pop()))
+ if self.counter_fraction>100:
+ self.counter_fraction=100
+ self.progressbar.setValue(self.counter_fraction)
+ self.progressbar.update()
+ except:
+ pass
+
+ return True
+ def stop_encoding(self,Event=None):
+ try:
+ os.kill(self.rmdPid,signal.SIGINT)
+ except:
+ pass
+ def __init__(self,out_stream,childPid,parent):
+ self.parent=parent
+ flags = fcntl.fcntl(out_stream, fcntl.F_GETFL)
+ fcntl.fcntl(out_stream, fcntl.F_SETFL, flags | os.O_NONBLOCK)
+ self.rmdPid=childPid
+
+
+ self.window = QtGui.QMainWindow()
+ self.window.closeEvent=self.destroy_and_kill
+
+ self.window.setWindowTitle("recordMyDesktop-encoder")
+
+ self.frame=QtGui.QFrame()
+ self.label=QtGui.QLabel(self.labeString)
+
+ self.label.setAlignment(QtCore.Qt.AlignHCenter)
+
+ self.progressbar=QtGui.QProgressBar()
+ self.counter_fraction=0
+ self.progressbar.setValue(self.counter_fraction)
+ self.stopbutton=QtGui.QPushButton("Cancel",self.window)
+ self.stopbutton.connect(self.stopbutton,QtCore.SIGNAL("clicked()"),
+ self.stop_encoding)
+ self.box=QtGui.QVBoxLayout()
+ self.box.addWidget(self.label,0)
+ self.box.addWidget(self.progressbar,0)
+ self.box.addWidget(self.stopbutton,0)
+
+
+ self.stopbutton.show()
+ self.frame.setLayout(self.box)
+ self.window.setCentralWidget(self.frame)
+ self.label.show()
+ self.progressbar.show()
+ self.window.show()
+ self.stdout=out_stream
+ self.timed_id=QtCore.QTimer(None)
+ self.timed_id.connect(self.timed_id,QtCore.SIGNAL("timeout()"),
+ self.update_counter)
+ self.timed_id.start(100)
+
+
+
+
+
diff --git a/qt-recordmydesktop/src/rmdPrefsWidget.py b/qt-recordmydesktop/src/rmdPrefsWidget.py
new file mode 100644
index 0000000..4c9f5b7
--- /dev/null
+++ b/qt-recordmydesktop/src/rmdPrefsWidget.py
@@ -0,0 +1,362 @@
+#/******************************************************************************
+#* qt-recordMyDesktop *
+#*******************************************************************************
+#* *
+#* Copyright (C) 2007 John Varouhakis *
+#* *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+#* *
+#* *
+#* *
+#* For further information contact me at johnvarouhakis@gmail.com *
+#******************************************************************************/
+
+
+from PyQt4 import QtGui,QtCore
+import locale, gettext
+import rmdConfig
+def _(s):
+ return QtCore.QString.fromUtf8(gettext.gettext(s))
+def htmlize(s):
+ return "<html><body>"+s.replace("\n","<br>")+"</html></body>"
+gettext.textdomain('qt-recordMyDesktop')
+gettext.bindtextdomain('qt-recordMyDesktop',rmdConfig.locale_install_dir)
+import os
+
+
+
+
+class prefsWidget(object):
+ labelStrings=[_('Overwite Existing Files'),_('Working Directory'),
+ _('Frames Per Second'),_('Encode On the Fly'),_('Zero Compression'),
+ _('Quick Subsampling'),_('Full shots at every frame'),
+ _('Channels'),_('Frequency'),_('Device'),_('Display'),_('Mouse Cursor'),
+ _('MIT-Shm extension'),_('Include Window Decorations'),_('Tooltips'),
+ _('Outline Capture Area On Screen'),
+ _('Video Quality'),_('Sound Quality'),
+ _('Drop Frames(encoder)'),_('Startup Delay(secs)'),]
+ mouseStrings=[_('Normal'),_('White'),_('Black'),_('None')]
+ stateStrings=[_('Enabled'),_('Disabled')]#0,1
+ tabStrings=[_('Files'),_('Performance'),_('Sound'),_('Misc')]
+ tooltipLabels=[_('By default, if you try to save under a filename that already\nexists, the new file will be renamed\n(for example if you try to save as out.ogg and that file exists, your file will be named out.ogg.1).\nBy checking this box, this behavior is disabled and the old file is overwritten.\n'),
+ _('Directory where temporary files will be saved.'),
+ _('Frames Per Second'),
+ _('Encode simultaneously with the recording.\nThis will require a lot more processing power.\n'),
+ _('Do not apply compression on the temporary files.\nIf enabled, the program will need less processing power,\nin the expense of hard disk space.\nThis option is valid only when encoding on the fly is disabled.'),
+ _('This option, if enabled, will cause the program to require less\nprocessing power, but it might make the colors look a bit more blurry.'),
+ _('This option should be enabled when recording 3d windows.\nIt is also auto-enabled when recording a\nknown 3d compositing window manager.\n '),
+ _('Number of audio channels.'),
+ _('Sound frequency.'),
+ _('ALSA sound device, that is used for sound recording.'),
+ _('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)'),
+ _('Draw a frame on the screen, around the area\nthat will get captured.\n(This frame will remain throughout the recording.)')]
+ 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):
+ for i in range(16):
+ self.labels[i].setToolTip(htmlize(self.tooltipLabels[i]))
+ self.jack_button.setToolTip(htmlize(self.jacktip))
+ self.jack_lsp_label.setToolTip(htmlize(self.jacktip))
+ self.jack_lss_label.setToolTip(htmlize(self.jacktip))
+ self.jack_lsp_liststore.setToolTip(htmlize(self.jacktip))
+ self.jack_lsp_listSave.setToolTip(htmlize(self.jacktip))
+
+ def destroy(self,Event=None):
+ self.values[0]=self.fpsSpinButton.value()
+ self.values[1]=self.mouseComboBox.currentIndex()
+ self.values[3]=self.fullComboBox.currentIndex()
+ self.values[7]=self.channelsSpinButton.value()
+ self.values[8]=self.freqSpinButton.value()
+ self.values[9]=self.deviceEntry.text().replace(' ','')
+ self.values[12]=self.displayEntry.text().replace(' ','')
+ self.values[13]=self.sharedComboBox.currentIndex()
+ self.values[16]=self.quickComboBox.currentIndex()
+ self.values[17]=self.workdirEntry.text()
+ self.values[18]=self.onTheFlyComboBox.currentIndex()
+ self.values[19]=self.zeroCmpComboBox.currentIndex()
+ if self.overwriteFilesButton.checkState()==QtCore.Qt.Checked:
+ self.values[20]=True
+ else:
+ self.values[20]=False
+ self.values[21]=self.winDecoComboBox.currentIndex()
+ if self.jack_button.checkState()==QtCore.Qt.Checked:
+ self.values[22]=True
+ else:
+ self.values[22]=False
+ self.__getSelectedPorts__()
+ self.values[24]=self.tooltipsComboBox.currentIndex()
+ self.values[25]=self.rFrameComboBox.currentIndex()
+ self.optionsOpen[0]=0
+
+ def __getSelectedPorts__(self):
+ iters_t=[]
+ self.values[23]=[]
+ sel_rows=self.jack_lsp_listSave.count()
+ for i in range(sel_rows):
+ self.values[23].append(self.jack_lsp_listSave.item(i).text())
+ if sel_rows==0:
+ self.values[22]=False
+
+ def __subWidgets__(self):
+ self.labels={}
+ self.boxes={}
+ self.labelbox={}
+ self.tabWidgets={}
+ self.notebook = QtGui.QTabWidget(self.window)
+ for i in range(4):
+ self.labelbox[i]=QtGui.QVBoxLayout()
+ self.tabWidgets[i]=QtGui.QWidget()
+#Files page
+ for i in range(2):
+ self.labels[i]=QtGui.QLabel(self.labelStrings[i],self.tabWidgets[0])
+ self.labels[i].setAlignment(QtCore.Qt.AlignLeft)
+ self.boxes[i]=QtGui.QHBoxLayout()
+ self.boxes[i].insertWidget(-1,self.labels[i])
+ self.labelbox[0].insertLayout(-1,self.boxes[i])
+ self.labelbox[0].insertSpacing(-1,20)
+ self.labelbox[0].setSizeConstraint(QtGui.QLayout.SetMaximumSize)
+
+ self.overwriteFilesButton=QtGui.QCheckBox(self.tabWidgets[0])
+ if self.values[20]:
+ self.overwriteFilesButton.setCheckState(QtCore.Qt.Checked)
+ else:
+ self.overwriteFilesButton.setCheckState(QtCore.Qt.Unchecked)
+ self.boxes[0].insertWidget(-1,self.overwriteFilesButton)
+
+ self.workdirEntry= QtGui.QLineEdit(self.values[17],self.tabWidgets[0])
+ self.boxes[1].insertWidget(-1,self.workdirEntry)
+
+#Performance page
+ for i in xrange(2,7):
+ self.labels[i]=QtGui.QLabel(self.labelStrings[i],self.tabWidgets[1])
+ self.labels[i].setAlignment(QtCore.Qt.AlignLeft)
+ self.boxes[i]=QtGui.QHBoxLayout()
+ self.boxes[i].insertWidget(-1,self.labels[i])
+ self.labelbox[1].insertLayout(-1,self.boxes[i])
+ self.labelbox[1].insertSpacing(-1,20)
+ self.labelbox[1].setSizeConstraint(QtGui.QLayout.SetMaximumSize)
+
+ self.fpsSpinButton= QtGui.QSpinBox(self.tabWidgets[1])
+ self.fpsSpinButton.setRange(1,50)
+ self.fpsSpinButton.setValue(self.values[0])
+ self.boxes[2].insertWidget(-1,self.fpsSpinButton)
+
+ self.onTheFlyComboBox = QtGui.QComboBox(self.tabWidgets[1])
+ for i in range(2):
+ self.onTheFlyComboBox.addItem(self.stateStrings[i])
+ self.onTheFlyComboBox.setCurrentIndex(self.values[18])
+ self.boxes[3].insertWidget(-1,self.onTheFlyComboBox)
+
+ self.zeroCmpComboBox = QtGui.QComboBox(self.tabWidgets[1])
+ for i in range(2):
+ self.zeroCmpComboBox.addItem(self.stateStrings[i])
+ self.zeroCmpComboBox.setCurrentIndex(self.values[19])
+ self.boxes[4].insertWidget(-1,self.zeroCmpComboBox)
+
+ self.quickComboBox = QtGui.QComboBox(self.tabWidgets[1])
+ for i in range(2):
+ self.quickComboBox.addItem(self.stateStrings[i])
+ self.quickComboBox.setCurrentIndex(self.values[16])
+ self.boxes[5].insertWidget(-1,self.quickComboBox)
+
+ self.fullComboBox = QtGui.QComboBox(self.tabWidgets[1])
+ for i in range(2):
+ self.fullComboBox.addItem(self.stateStrings[i])
+ self.fullComboBox.setCurrentIndex(self.values[3])
+ self.boxes[6].insertWidget(-1,self.fullComboBox)
+
+#sound page
+ for i in xrange(7,10):
+ self.labels[i]=QtGui.QLabel(self.labelStrings[i],self.tabWidgets[2])
+ self.labels[i].setAlignment(QtCore.Qt.AlignLeft)
+ self.boxes[i]=QtGui.QHBoxLayout()
+ self.boxes[i].insertWidget(-1,self.labels[i])
+ self.labelbox[2].insertLayout(-1,self.boxes[i])
+ self.labelbox[2].insertSpacing(-1,20)
+ self.labelbox[2].setSizeConstraint(QtGui.QLayout.SetMaximumSize)
+
+ self.labelbox[2].insertSpacing(-1,15)
+ self.jack_button= QtGui.QCheckBox(_("Use Jack for audio capture."),self.tabWidgets[2])
+ self.jack_lsp_label=QtGui.QLabel(_("Available ports (double click to add):"),self.tabWidgets[2])
+ self.jack_lss_label=QtGui.QLabel(_("Selected ports (double click to remove):"),self.tabWidgets[2])
+ self.jack_lsp_liststore=QtGui.QListWidget(self.tabWidgets[2])
+ self.jack_lsp_liststore.setFixedHeight(100)
+ self.jack_lsp_listSave=QtGui.QListWidget(self.tabWidgets[2])
+ self.jack_lsp_listSave.setFixedHeight(100)
+
+
+ self.jack_lsp_refresh=QtGui.QPushButton(_("Refresh"),self.tabWidgets[2])
+ self.jack_box=QtGui.QVBoxLayout()
+ self.jack_box.insertWidget(-1,self.jack_button)
+ self.jack_box.insertWidget(-1,self.jack_lsp_label)
+ self.jack_box.insertWidget(-1,self.jack_lsp_liststore)
+ self.jack_box.insertWidget(-1,self.jack_lss_label)
+ self.jack_box.insertWidget(-1,self.jack_lsp_listSave)
+ self.jack_box.insertWidget(-1,self.jack_lsp_refresh)
+ self.labelbox[2].insertLayout(-1,self.jack_box)
+
+
+ if self.values[22]==True:
+ self.jack_button.setCheckState(QtCore.Qt.Checked)
+ else:
+ self.jack_button.setCheckState(QtCore.Qt.Unchecked)
+
+ self.channelsSpinButton= QtGui.QSpinBox(self.tabWidgets[2])
+ self.channelsSpinButton.setRange(1,2)
+ self.channelsSpinButton.setValue(self.values[7])
+ self.boxes[7].insertWidget(-1,self.channelsSpinButton)
+
+
+ self.freqSpinButton= QtGui.QSpinBox(self.tabWidgets[2])
+ self.freqSpinButton.setRange(0,44100)
+ self.freqSpinButton.setSingleStep(100)
+ self.freqSpinButton.setValue(self.values[8])
+ self.boxes[8].insertWidget(-1,self.freqSpinButton)
+
+ self.deviceEntry= QtGui.QLineEdit(self.values[9],self.tabWidgets[2])
+ self.boxes[9].insertWidget(-1,self.deviceEntry)
+
+#misc page
+ for i in xrange(10,16):
+ self.labels[i]=QtGui.QLabel(self.labelStrings[i],self.tabWidgets[3])
+ self.labels[i].setAlignment(QtCore.Qt.AlignLeft)
+ self.boxes[i]=QtGui.QHBoxLayout()
+ self.boxes[i].insertWidget(-1,self.labels[i])
+ self.labelbox[3].insertLayout(-1,self.boxes[i])
+ self.labelbox[3].insertSpacing(-1,20)
+ self.labelbox[3].setSizeConstraint(QtGui.QLayout.SetMaximumSize)
+
+ self.displayEntry= QtGui.QLineEdit(self.values[12])
+ self.boxes[10].insertWidget(-1,self.displayEntry)
+
+ self.mouseComboBox = QtGui.QComboBox(self.tabWidgets[3])
+ for i in range(4):
+ self.mouseComboBox.addItem(self.mouseStrings[i])
+ self.mouseComboBox.setCurrentIndex(self.values[1])
+ self.boxes[11].insertWidget(-1,self.mouseComboBox)
+
+
+ self.sharedComboBox = QtGui.QComboBox(self.tabWidgets[3])
+ for i in range(2):
+ self.sharedComboBox.addItem(self.stateStrings[i])
+ self.sharedComboBox.setCurrentIndex(self.values[13])
+ self.boxes[12].insertWidget(-1,self.sharedComboBox)
+
+ self.winDecoComboBox = QtGui.QComboBox(self.tabWidgets[3])
+ for i in range(2):
+ self.winDecoComboBox.addItem(self.stateStrings[i])
+ self.winDecoComboBox.setCurrentIndex(self.values[21])
+ self.boxes[13].insertWidget(-1,self.winDecoComboBox)
+
+ self.tooltipsComboBox = QtGui.QComboBox(self.tabWidgets[3])
+ for i in range(2):
+ self.tooltipsComboBox.addItem(self.stateStrings[i])
+ self.tooltipsComboBox.setCurrentIndex(self.values[24])
+ self.boxes[14].insertWidget(-1,self.tooltipsComboBox)
+
+
+ self.rFrameComboBox = QtGui.QComboBox(self.tabWidgets[3])
+ for i in range(2):
+ self.rFrameComboBox.addItem(self.stateStrings[i])
+ self.rFrameComboBox.setCurrentIndex(self.values[25])
+ self.boxes[15].insertWidget(-1,self.rFrameComboBox)
+
+
+ for i in range(4):
+ self.tabWidgets[i].setLayout(self.labelbox[i])
+ self.notebook.insertTab(-1,self.tabWidgets[i],self.tabStrings[i])
+ self.notebook.show()
+ return
+
+ def addPort(self,lwi):
+ pli=lwi.clone()
+ self.jack_lsp_listSave.insertItem(-1,pli)
+ def remPort(self,lwi):
+ self.jack_lsp_listSave.takeItem(self.jack_lsp_listSave.row(lwi))
+
+ def __runJackLSP__(self,button=None):
+ 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()
+ if ports!=[]:
+ for i in ports:
+ self.ports.append(i.replace('\n',""))
+ self.jack_lsp_liststore.setEnabled(True)
+ else:
+ failed=1
+ self.ports.append(_("jack_lsp returned no ports."))
+ self.ports.append(_("Make sure that jackd is running."))
+ self.jack_lsp_liststore.setEnabled(False)
+ self.jack_lsp_listSave.setEnabled(False)
+ self.values[23]=[]
+ for i in self.values[23]:
+ self.jack_lsp_listSave.insertItem(-1,QtGui.QListWidgetItem(i))
+ for i in self.ports:
+ self.jack_lsp_liststore.insertItem(-1,QtGui.QListWidgetItem(i))
+
+
+ def __makeCons__(self):
+ self.jack_button.connect(self.jack_button,QtCore.SIGNAL("clicked()"),self.__jack_enabled_check__)
+ self.jack_lsp_refresh.connect(self.jack_lsp_refresh,QtCore.SIGNAL("clicked()"),self.__runJackLSP__)
+ self.jack_lsp_liststore.connect(self.jack_lsp_liststore,QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem *)"),self.addPort)
+ self.jack_lsp_listSave.connect(self.jack_lsp_listSave,QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem *)"),self.remPort)
+
+ def __jack_enabled_check__(self):
+ val=False
+ if self.jack_button.checkState()==QtCore.Qt.Checked:
+ val=True
+ else:
+ val=False
+ self.channelsSpinButton.setEnabled(not val)
+ self.freqSpinButton.setEnabled(not val)
+ self.deviceEntry.setEnabled(not val)
+ self.jack_lsp_liststore.setEnabled(val)
+ self.jack_lsp_listSave.setEnabled(val)
+ self.jack_lsp_refresh.setEnabled(val)
+
+ def __init__(self,values,optionsOpen):
+ self.values=values
+ self.ports=[]
+ self.optionsOpen=optionsOpen
+ self.window = QtGui.QWidget()
+ self.window.closeEvent= self.destroy
+
+ self.window.setWindowTitle("recordMyDesktop")
+ self.__subWidgets__()
+ self.__makeCons__()
+ self.__runJackLSP__()
+ self.__jack_enabled_check__()
+ if self.values[24]==0:
+ self.__tooltips__()
+ self.window.show()
+
+
+
+
+
+
+
+
+
+
diff --git a/qt-recordmydesktop/src/rmdSelect.py b/qt-recordmydesktop/src/rmdSelect.py
new file mode 100644
index 0000000..6a2264c
--- /dev/null
+++ b/qt-recordmydesktop/src/rmdSelect.py
@@ -0,0 +1,84 @@
+#/******************************************************************************
+#* qt-recordMyDesktop *
+#*******************************************************************************
+#* *
+#* Copyright (C) 2007 John Varouhakis *
+#* *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+#* *
+#* *
+#* *
+#* For further information contact me at johnvarouhakis@gmail.com *
+#******************************************************************************/
+
+from PyQt4 import QtGui,QtCore
+
+class QtAreaSelector(QtGui.QLabel):
+ def __init__(self,area_return):
+ self.area_return=area_return
+ QtGui.QLabel.__init__(self,None,QtCore.Qt.WindowStaysOnTopHint)
+ self.x1=self.y1=-1
+ self.x2=self.y2=0
+ self.pix=QtGui.QPixmap.grabWindow(QtGui.QApplication.desktop().winId())
+ siz=QtGui.QApplication.desktop().screenGeometry()
+ (self.width, self.height)=(siz.width(),siz.height())
+ def paintEvent(self, event):
+ painter = QtGui.QPainter(self)
+ painter.drawPixmap(0,0,self.pix)
+ 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
+ painter.fillRect(x,y,w,h,QtGui.QBrush(QtCore.Qt.red,QtCore.Qt.CrossPattern))
+ def mouseMoveEvent(self, event):
+ if self.x1 >= 0:
+ rect = QtCore.QRect()
+ 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.x2 = event.x() + 1
+ self.y2 = event.y() + 1
+ self.update()
+ def mouseReleaseEvent(self, event):
+ if event.button() == 1 and self.x1 >= 0:
+ self.x2 = event.x() + 1
+ self.y2 = event.y() + 1
+ self.area_return[0]=min(int(self.x1),int(self.x2))
+ self.area_return[1]=min(int(self.y1),int(self.y2))
+ self.area_return[2]=max(int(self.x1),int(self.x2))
+ self.area_return[3]=max(int(self.y1),int(self.y2))
+ self.close()
+ def mousePressEvent(self, event):
+ if event.button() != 1:
+ self.x1 = self.y1 = -1
+ self.close()
+ self.x1 = event.x()
+ self.y1 = event.y()
+
+
+if __name__ == "__main__":
+ import sys
+ p=[[-1,-1,-1,-1]]
+ app=QtGui.QApplication(sys.argv)
+ w = QtAreaSelector(p[0])
+ w.showFullScreen()
+ app.exec_()
+ print p[0]
+
+
diff --git a/qt-recordmydesktop/src/rmdSelectThumb.py b/qt-recordmydesktop/src/rmdSelectThumb.py
new file mode 100644
index 0000000..bfca01d
--- /dev/null
+++ b/qt-recordmydesktop/src/rmdSelectThumb.py
@@ -0,0 +1,164 @@
+#/******************************************************************************
+#* qt-recordMyDesktop *
+#*******************************************************************************
+#* *
+#* Copyright (C) 2007 John Varouhakis *
+#* *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+#* *
+#* *
+#* *
+#* For further information contact me at johnvarouhakis@gmail.com *
+#******************************************************************************/
+
+from PyQt4 import QtGui,QtCore
+import sys
+import rmdConfig
+from rmdFrame import *
+
+class QtThumbSelector(QtGui.QLabel):
+ def __init__(self,parent,caller,area_return,hidden,update_interval=500):
+ self.area_return=area_return
+ self.selecting=0
+ self.realFrame=None
+ self.caller=caller
+ self.hidden=hidden
+ QtGui.QLabel.__init__(self,parent)
+ self.x1=self.y1=-1
+ self.x2 = self.y2 = -1
+ self.root=QtGui.QApplication.desktop().winId()
+ self.pix=QtGui.QPixmap.grabWindow(self.root)
+ siz=QtGui.QApplication.desktop().screenGeometry()
+ (self.wwidth, self.wheight)=(siz.width(),siz.height())
+
+ self.factor=1;
+ twidth=self.wwidth
+ while twidth>320 or self.factor<4:
+ twidth/=2
+ self.factor*=2
+ self.setFixedSize(self.wwidth/self.factor,self.wheight/self.factor)
+ self.setSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.QSizePolicy.Preferred)
+ self.timed_id=QtCore.QTimer(None)
+ self.timed_id.connect(self.timed_id,QtCore.SIGNAL("timeout()"),
+ self.update_image)
+ self.timed_id.start(update_interval)
+ self.capPos=0
+ self.pixt=None
+ self.pixflag=0
+ self.fragSize=64
+ def update_image(self):
+ if self.selecting==0 and self.hidden[0]==0:
+ self.pixt=QtGui.QPixmap.grabWindow(self.root,0,self.capPos,self.wwidth,self.fragSize)
+ self.pixflag=1
+ self.update()
+
+ def update(self):
+ QtGui.QLabel.update(self)
+ if self.realFrame!=None:
+ if (self.area_return[0]!=self.realFrame.x or
+ self.area_return[1]!=self.realFrame.y or
+ self.area_return[2]-self.area_return[0]!=self.realFrame.w or
+ self.area_return[3]-self.area_return[1]!=self.realFrame.h or
+ self.caller.values[25]):
+ self.realFrame.destroy()
+ self.realFrame=None
+ if self.realFrame==None and self.caller.values[25]==0 :
+ self.__draw_frame__()
+
+ def paintEvent(self, event):
+
+ if self.pixt!=None and self.pixflag==1:
+ self.pixflag=0
+ painter2 = QtGui.QPainter(self.pix)
+ painter2.drawPixmap(0,self.capPos,self.wwidth,self.fragSize,self.pixt)
+ if self.capPos<self.wheight:
+ self.capPos+=self.fragSize
+ if self.capPos>self.wheight:
+ self.capPos=self.wheight-self.fragSize
+ else:
+ self.capPos=0
+
+ painter = QtGui.QPainter(self)
+ painter.drawPixmap(0,0,self.wwidth/self.factor,self.wheight/self.factor,self.pix)
+
+ 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
+ painter.fillRect(x,y,w,h,QtGui.QBrush(QtCore.Qt.red,QtCore.Qt.CrossPattern))
+ elif self.area_return[0]>=0 or self.area_return[1]>=0 or self.area_return[2]>=0 or self.area_return[3]>=0:
+ x = max(0, self.area_return[0])/self.factor
+ y = max(0, self.area_return[1])/self.factor
+ w = min(self.wwidth, self.area_return[2])/self.factor - x
+ h = min(self.wheight, self.area_return[3])/self.factor - y
+ painter.fillRect(x,y,w,h,QtGui.QBrush(QtCore.Qt.red,QtCore.Qt.CrossPattern))
+ def mouseMoveEvent(self, event):
+ if self.x1 >= 0:
+ rect = QtCore.QRect()
+ 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.x2 = event.x() + 1
+ self.y2 = event.y() + 1
+ self.update()
+ def mouseReleaseEvent(self, event):
+ if event.button() == 1:
+ self.selecting=0
+ if self.x1 >= 0:
+ self.x2 = event.x() + 1
+ self.y2 = event.y() + 1
+ self.area_return[0]=max(0,min(int(self.x1),int(self.x2))*self.factor)
+ self.area_return[1]=max(0,min(int(self.y1),int(self.y2))*self.factor)
+ self.area_return[2]=min(self.wwidth,max(int(self.x1),int(self.x2))*self.factor)
+ self.area_return[3]=min(self.wheight,max(int(self.y1),int(self.y2))*self.factor)
+ self.update()
+ def mousePressEvent(self, event):
+ if event.button() != 1:
+ self.x1 = self.y1 =-1
+ self.area_return[0]=-1
+ self.area_return[1]=-1
+ self.area_return[2]=-1
+ self.area_return[3]=-1
+ self.update()
+ elif event.button() == 1:
+ self.selecting=1
+ self.x1 = event.x()
+ self.y1 = event.y()
+ def __draw_frame__(self):
+ self.realFrame=rmdFrame(self.area_return[0],
+ self.area_return[1],
+ self.area_return[2]-self.area_return[0],
+ self.area_return[3]-self.area_return[1])
+ def closeEvent(self,event):
+ self.realFrame.destroy()
+ QtGui.QLabel.close(self)
+
+if __name__ == "__main__":
+ import sys
+ p=[[-1,-1,-1,-1]]
+ hidden=[0]
+ app=QtGui.QApplication(sys.argv)
+ app.values=rmdConfig.default_values
+ w = QtThumbSelector(None,app,p[0],hidden)
+ w.show()
+ app.exec_()
+ print p[0]
+
+
+
diff --git a/qt-recordmydesktop/src/rmdSimple.py b/qt-recordmydesktop/src/rmdSimple.py
new file mode 100644
index 0000000..b64e48f
--- /dev/null
+++ b/qt-recordmydesktop/src/rmdSimple.py
@@ -0,0 +1,443 @@
+#/******************************************************************************
+#* qt-recordMyDesktop *
+#*******************************************************************************
+#* *
+#* Copyright (C) 2007 John Varouhakis *
+#* *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+#* *
+#* *
+#* *
+#* For further information contact me at johnvarouhakis@gmail.com *
+#******************************************************************************/
+
+
+from PyQt4 import QtGui,QtCore
+import locale, gettext
+import rmdConfig
+def _(s):
+ return QtCore.QString.fromUtf8(gettext.gettext(s))
+def htmlize(s):
+ return "<html><body>"+s.replace("\n","<br>")+"</html></body>"
+gettext.textdomain('qt-recordMyDesktop')
+gettext.bindtextdomain('qt-recordMyDesktop',rmdConfig.locale_install_dir)
+import os,sys
+
+from rmdTrayIcon import *
+import rmdPrefsWidget as pW
+import rmdSelectThumb as sT
+
+class simpleWidget(object):
+ hidden=[0]
+ labelStrings=[_('Video Quality'),_('Sound Quality')]
+ buttonStrings=[_('Advanced'),_('Select Window')]
+ tooltipLabels=[_('Click here to select a window to record'),
+ _('Click to start the recording.\nThis window will hide itself.'),
+ _('Click to choose a filename and location.\nDefault is out.ogg in your home folder.\nIf the file already exists, the new one\nwill have a number attached on its name\n(this behavior can be changed )'),
+ _('Click to exit the program.'),
+ _('Select the video quality of your recording.\n(Lower quality will require more proccessing power,\nso it\'s recommended, when encoding on the fly,\nto leave at 100)'),
+ _('Enable/Disable sound recording.'),
+ _('Select the audio quality of your recording.'),
+ _('Click here to access more options.')]
+ tipLabelStrings=[_('\nLeft click and drag, on the preview image,\nto select an area for recording.\nRight click on it, to reset the area.')]
+
+ options=None
+ optionsOpen=[0]
+ def __subWidgets__(self):
+ self.labelbox=QtGui.QVBoxLayout()
+
+ self.NBox=QtGui.QHBoxLayout()
+ self.NEBox=QtGui.QVBoxLayout()
+ self.NEVQBox=QtGui.QHBoxLayout()
+ self.NESQBox=QtGui.QHBoxLayout()
+ self.NETABox=QtGui.QVBoxLayout()
+ self.NWBox=QtGui.QVBoxLayout()
+
+
+
+ self.NBox.insertLayout(-1,self.NWBox)
+ self.NBox.insertSpacing(-1,20)
+ self.NBox.insertLayout(-1,self.NEBox)
+ self.NEBox.insertLayout(-1,self.NEVQBox)
+ self.NEBox.insertLayout(-1,self.NESQBox)
+ self.NEBox.insertSpacing(-1,10)
+ self.NEBox.insertLayout(-1,self.NETABox)
+
+ self.SBox=QtGui.QHBoxLayout()
+ self.SEBox=QtGui.QHBoxLayout()
+ self.SWBox=QtGui.QHBoxLayout()
+ self.SBox.insertLayout(-1,self.SWBox)
+ self.SBox.insertSpacing(-1,100)
+ self.SBox.insertLayout(-1,self.SEBox)
+
+ self.labelbox.insertLayout(-1,self.NBox)
+ self.labelbox.insertLayout(-1,self.SBox)
+
+ self.image=sT.QtThumbSelector(self.window,self,self.values[5],self.hidden)
+
+ self.NWBox.insertWidget(-1,self.image)
+ self.NWBox.setGeometry(QtCore.QRect(0,0,self.image.width(),self.image.height()))
+ #quality
+ self.v_quality=QtGui.QSlider(self.window)
+ self.v_quality.setMaximum(100)
+ self.v_quality.setMinimum(0)
+ self.v_quality.setTracking(True)
+ self.v_quality.setValue(int(round((float(self.values[10])*100.0)/63.0)))
+ self.v_quality.setOrientation(QtCore.Qt.Horizontal)
+
+
+ self.s_button= QtGui.QCheckBox(self.window)
+ if self.values[2]:
+ self.s_button.setCheckState(QtCore.Qt.Checked)
+ else:
+ self.s_button.setCheckState(QtCore.Qt.Unchecked)
+ self.s_quality=QtGui.QSlider(self.window)
+ self.s_quality.setMaximum(100)
+ self.s_quality.setMinimum(0)
+ self.s_quality.setTracking(True)
+ self.s_quality.setValue(int(round(float(self.values[11])*10.0)))
+ self.s_quality.setOrientation(QtCore.Qt.Horizontal)
+ self.s_quality.setEnabled(self.values[2])
+
+ self.v_label=QtGui.QLabel(" "+self.labelStrings[0],self.window)
+ self.s_label=QtGui.QLabel(self.labelStrings[1],self.window)
+
+ self.advanced_button=QtGui.QPushButton(self.buttonStrings[0],self.window)
+ self.tipLabel=QtGui.QLabel(self.tipLabelStrings[0],self.window)
+
+ self.NEVQBox.insertWidget(-1,self.v_label)
+ self.NEVQBox.insertWidget(-1,self.v_quality)
+ self.NESQBox.insertWidget(-1,self.s_button)
+ self.NESQBox.insertWidget(-1,self.s_label)
+ self.NESQBox.insertWidget(-1,self.s_quality)
+ self.NETABox.insertWidget(-1,self.advanced_button)
+ self.NETABox.insertWidget(-1,self.tipLabel)
+
+ self.win_button=QtGui.QPushButton(self.buttonStrings[1],self.window)
+ self.start_button=QtGui.QPushButton(_("Record"),self.window)
+ self.file_button=QtGui.QPushButton(_("Save As"),self.window)
+ self.quit_button=QtGui.QPushButton(_("Quit"),self.window)
+ self.SWBox.insertWidget(-1,self.win_button)
+ self.SWBox.insertWidget(-1,self.start_button)
+ self.SEBox.insertWidget(-1,self.file_button)
+ self.SEBox.insertWidget(-1,self.quit_button)
+
+
+ self.win_button.show()
+ self.start_button.show()
+ self.file_button.show()
+ self.quit_button.show()
+
+ self.v_quality.show()
+ self.s_button.show()
+ self.s_quality.show()
+ self.v_label.show()
+ self.s_label.show()
+ self.tipLabel.show()
+ self.advanced_button.show()
+
+ self.window.setLayout(self.labelbox)
+ def __tooltips__(self):
+ self.win_button.setToolTip(htmlize(self.tooltipLabels[0]))
+ self.start_button.setToolTip(htmlize(self.tooltipLabels[1]))
+ self.file_button.setToolTip(htmlize(self.tooltipLabels[2]))
+ self.quit_button.setToolTip(htmlize(self.tooltipLabels[3]))
+ self.v_quality.setToolTip(htmlize(self.tooltipLabels[4]))
+ self.v_label.setToolTip(htmlize(self.tooltipLabels[4]))
+ self.s_button.setToolTip(htmlize(self.tooltipLabels[5]))
+ self.s_quality.setToolTip(htmlize(self.tooltipLabels[6]))
+ self.s_label.setToolTip(htmlize(self.tooltipLabels[6]))
+ self.advanced_button.setToolTip(htmlize(self.tooltipLabels[7]))
+
+ def __exit__(self,Event=None):
+ if self.exited==0:
+ self.update()
+ self.exited=1
+ self.optionsOpen[0]=0
+ if self.save_prefs()==False:
+ print "Warning!!!Couldn't save preferences"
+ sys.exit()
+ def hide(self,Event=None):
+ self.window.hide()
+ self.hidden[0]=1
+ def show(self,Event=None):
+ self.window.show()
+ self.hidden[0]=0
+ def __swap_visibility__(self,event=None):
+ if event.type()==QtCore.QEvent.WindowStateChange:
+ if self.window.windowState() == QtCore.Qt.WindowMinimized:
+ 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
+ self.options=pW.prefsWidget(self.values,self.optionsOpen)
+ else:
+ if self.options != None:
+ self.options.window.close()
+ self.optionsOpen[0]=0
+ def close_advanced(self):
+ if self.options != None:
+ if self.optionsOpen[0] ==1:
+ self.options.window.close()
+ self.optionsOpen[0]=0
+
+ def __fileSelect__(self,Event=None):
+ tfilename=QtGui.QFileDialog.getSaveFileName(self.window,'',self.values[4],"*.ogg *.ogg.*;; *.*")
+ if tfilename!= '':
+ self.values[4]=tfilename
+ def __select_window__(self,button=None):
+ 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()
+ stderr.close()
+ x=y=width=height=None
+ for i in wid:
+ if i.lstrip().startswith('Absolute upper-left X:'):
+ x=int(i.split(' ')[len(i.split(' '))-1])
+ elif i.lstrip().startswith('Absolute upper-left Y'):
+ y=int(i.split(' ')[len(i.split(' '))-1])
+ elif i.lstrip().startswith('Width:'):
+ width=int(i.split(' ')[len(i.split(' '))-1])
+ elif i.lstrip().startswith('Height:'):
+ height=int(i.split(' ')[len(i.split(' '))-1])
+ if x<0:
+ width+=x
+ x=0
+ if y<0:
+ height+=y
+ y=0
+ if width+x>self.wwidth: width=self.wwidth-x
+ if height+y>self.wheight: height=self.wheight-y
+ self.values[5][0]=x
+ self.values[5][1]=y
+ self.values[5][2]=width+x
+ self.values[5][3]=height+y
+ self.image.x1=-1
+ self.image.update()
+
+ def __makeCons__(self):
+ self.advanced_button.connect(self.advanced_button,QtCore.SIGNAL("clicked()"),self.advanced)
+ self.file_button.connect(self.file_button,QtCore.SIGNAL("clicked()"),self.__fileSelect__)
+ self.quit_button.connect(self.quit_button,QtCore.SIGNAL("clicked()"),self.__exit__)
+ self.start_button.connect(self.start_button,QtCore.SIGNAL("clicked()"),self.trayIcon.record_ext)
+ self.s_button.connect(self.s_button,QtCore.SIGNAL("clicked()"),self.__sound_check__)
+ self.win_button.connect(self.win_button,QtCore.SIGNAL("clicked()"),self.__select_window__)
+
+ def __sound_check__(self,widget=None):
+ self.s_quality.setEnabled(self.values[2])
+ if self.s_button.checkState()==QtCore.Qt.Checked:
+ self.values[2]=True
+ else:
+ self.values[2]=False
+
+ def update(self) :
+ self.values[10]=int(round((float(self.v_quality.value())*63.0)/100.0))
+ self.values[11]=int(round(float(self.s_quality.value())/10.0))
+ if self.values[10]>63:
+ self.values[10]=63
+ if self.values[11]>10:
+ self.values[11]=10
+ def load_prefs(self):
+ path=os.path.join(os.getenv("HOME"),".qt-recordmydesktop")
+ try:
+ self.values=[]
+ savefile=open(path,"r")
+ #the header
+ savefile.readline()
+ savefile.readline()
+ #the options,each has a coment above
+ for i in range(2):
+ savefile.readline()
+ self.values.append(int(savefile.readline()))
+ savefile.readline()
+ self.values.append(int(savefile.readline())==1)
+ savefile.readline()
+ self.values.append(int(savefile.readline()))
+ savefile.readline()
+ self.values.append(savefile.readline().replace("\n",""))
+ #recording area is not saved
+ self.values.append(rmdConfig.default_values[5])
+ for i in range(3):
+ savefile.readline()
+ self.values.append(int(savefile.readline()))
+ savefile.readline()
+ self.values.append(savefile.readline().replace("\n",""))
+ for i in range(2):
+ savefile.readline()
+ self.values.append(int(savefile.readline()))
+ savefile.readline()
+ self.values.append(savefile.readline().replace("\n",""))
+ for i in range(4):
+ savefile.readline()
+ self.values.append(int(savefile.readline()))
+ savefile.readline()
+ self.values.append(savefile.readline().replace("\n",""))
+ for i in range(2):
+ savefile.readline()
+ 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()))
+ p=savefile.readline()
+ if p=='':
+ self.values.append(rmdConfig.default_values[25])
+ else:
+ self.values.append(int(savefile.readline()))
+ return True
+ except:
+ return False
+ def save_prefs(self):
+ try:
+ path=os.path.join(os.getenv("HOME"),".qt-recordmydesktop")
+ savefile=open(path,"w")
+ savefile.write("#Order and overall number of lines must be preserved\n")
+ savefile.write("#For this file to be read correctly\n")
+ savefile.write("#Framerate\n")
+ savefile.write("%d\n"%self.values[0])
+ savefile.write("#Cursor(0 xfixes,1 white,2 black,3 none)\n")
+ savefile.write("%d\n"%self.values[1])
+ savefile.write("#Sound,0 disabled 1 enabled\n")
+ savefile.write("%d\n"%self.values[2])
+ savefile.write("#Full shots,1 disabled 0 enabled\n")
+ savefile.write("%d\n"%self.values[3])
+ savefile.write("#Filename\n")
+ savefile.write("%s\n"%self.values[4])
+ savefile.write("#Delay,seconds\n")
+ savefile.write("%d\n"%self.values[6])
+ savefile.write("#Number of channels\n")
+ savefile.write("%d\n"%self.values[7])
+ savefile.write("#Frequency\n")
+ savefile.write("%d\n"%self.values[8])
+ savefile.write("#Sound-device\n")
+ savefile.write("%s\n"%self.values[9])
+ savefile.write("#Video quality(0-63)\n")
+ savefile.write("%d\n"%self.values[10])
+ savefile.write("#Audio quality(0-10)\n")
+ savefile.write("%d\n"%self.values[11])
+ savefile.write("#Display\n")
+ savefile.write("%s\n"%self.values[12])
+ savefile.write("#Shared memory,1 disabled 0 enabled\n")
+ savefile.write("%d\n"%self.values[13])
+ savefile.write("#Drop frames(encoder option),1 disabled 0 enabled.Unused at 0.3.0, removed at 0.3.4, preserved for compatibility of prefs file.\n")
+ savefile.write("%d\n"%self.values[14])
+ savefile.write("#Shared memory threshold,0-100. Removed at 0.3.4,"
+ " preserved for compatibility of prefs file\n")
+ savefile.write("%d\n"%self.values[15])
+ savefile.write("#Quick subsampling,1 disabled 0 enabled\n")
+ savefile.write("%d\n"%self.values[16])
+ savefile.write("#Working directory(temporary files)\n")
+ savefile.write("%s\n"%self.values[17])
+ savefile.write("#On the fly encoding,1 disabled 0 enabled\n")
+ savefile.write("%d\n"%self.values[18])
+ savefile.write("#Zero compression,1 disabled 0 enabled\n")
+ 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.write("#draw an on-screen frame, surrounding the capture area\n")
+ savefile.write("%d\n"%self.values[25])
+ savefile.flush()
+ savefile.close()
+ return True
+ except:
+ return False
+
+ def __init__(self):
+ if self.load_prefs()==False:
+ self.values= rmdConfig.default_values
+ self.optionsOpen=[0]
+ self.minimized=0
+ self.exited=0
+ self.window = QtGui.QWidget()
+
+ self.window.closeEvent= self.__exit__
+ self.window.changeEvent=self.__swap_visibility__
+ self.window.setWindowTitle("recordMyDesktop")
+
+ siz=QtGui.QApplication.desktop().screenGeometry()
+ (self.wwidth, self.wheight)=(siz.width(),siz.height())
+ self.factor=1;
+ twidth=self.wwidth
+ while twidth>320 or self.factor<4:
+ twidth/=2
+ self.factor*=2
+
+ self.__subWidgets__()
+
+ self.trayIcon=trayIcon(self)
+ self.__makeCons__()
+
+ if self.values[24]==0:
+ self.__tooltips__()
+
+ self.window.show()
+
+
+
+if __name__ == "__main__":
+ import sys
+
+ app=QtGui.QApplication(sys.argv)
+ w = simpleWidget()
+ app.exec_()
+
+
+
+
+
+
+
+
diff --git a/qt-recordmydesktop/src/rmdTrayIcon.py b/qt-recordmydesktop/src/rmdTrayIcon.py
new file mode 100644
index 0000000..b9a3bd0
--- /dev/null
+++ b/qt-recordmydesktop/src/rmdTrayIcon.py
@@ -0,0 +1,331 @@
+#/******************************************************************************
+#* qt-recordMyDesktop *
+#*******************************************************************************
+#* *
+#* Copyright (C) 2007 John Varouhakis *
+#* *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+#* *
+#* *
+#* *
+#* For further information contact me at johnvarouhakis@gmail.com *
+#******************************************************************************/
+
+
+from PyQt4 import QtGui,QtCore
+import locale, gettext
+import rmdConfig
+def _(s):
+ return QtCore.QString.fromUtf8(gettext.gettext(s))
+gettext.textdomain('qt-recordMyDesktop')
+gettext.bindtextdomain('qt-recordMyDesktop',rmdConfig.locale_install_dir)
+
+import rmdTrayPopup as iTP
+import rmdMonitor as imon
+import os,signal,popen2,fcntl
+
+#values struct:
+
+#0 fps
+#1 mouse
+#2 sound on/off
+#3 full
+#4 path
+#5 area
+#6 delay
+#7 channels
+#8 frequency
+#9 device
+#10 v_quality
+#11 s_quality
+#12 display
+#13 shared memory
+#14 drop-frames
+#15 shared threshold
+#16 quick subsampling
+
+
+class trayIcon(object):
+ #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]
+ exit_status={
+ 0:_('Success'),
+ 1*256:_('Error while parsing the arguments.'),
+ 2*256:_('Initializing the encoder failed(either vorbis or theora)'),
+ 3*256:_('Could not open/configure sound card.'),
+ 4*256:_('Xdamage extension not present.'),
+ 5*256:_('Shared memory extension not present.'),
+ 6*256:_('Xfixes extension not present.'),
+ 7*256:_('XInitThreads failed.'),
+ 8*256:_('No $DISPLAY environment variable and none specified as argument.'),
+ 9*256:_('Cannot connect to Xserver.'),
+ 10*256:_('Color depth is not 24bpp.'),
+ 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')
+ }
+
+
+ state=0#0 stopped,1 recording,2 paused
+ rmdPid=None
+ optionsOpen=[1]
+ reopen=0
+ timed_id=None
+
+ def __set_icon__(self,widget,icon):
+ widget.setIcon(QtGui.QIcon(self.__get_icon_location__(icon)))
+
+
+ def __buttonPress__(self,ActivationReason):
+ button=0
+ if ActivationReason==QtGui.QSystemTrayIcon.Trigger:
+ button=1
+ elif ActivationReason==QtGui.QSystemTrayIcon.Context:
+ button=3
+ #print button
+ if button==1 and self.state>=0:
+ if self.state == 0:
+ if self.optionsOpen[0]==1:
+ self.parent.hide()
+ self.optionsOpen[0]=0
+ self.reopen=1
+ self.__set_icon__(self.trayIcon,"stop")
+ self.state=1
+ self.__execRMD__()
+ elif self.state== 1:
+ self.__set_icon__(self.trayIcon,"start")
+ self.state=0
+ self.__stopRMD__()
+ elif self.state == 2 :
+ self.__set_icon__(self.trayIcon,"stop")
+ self.state=1
+ self.__pauseRMD__()
+
+
+ elif button == 3 and self.state>=0:
+ if self.state == 0:
+ pass
+ self.tray_popup.popupmenu.popup(QtGui.QCursor.pos())
+ elif self.state == 1:
+ self.__set_icon__(self.trayIcon,"pause")
+ self.state=2
+ self.__pauseRMD__()
+ elif self.state ==2:
+ self.__set_icon__(self.trayIcon,"stop")
+ self.state=1
+ self.__pauseRMD__()
+ def record_ext(self,button=None):
+ if self.state == 0:
+ if self.optionsOpen[0]==1:
+ self.parent.hide()
+ self.optionsOpen[0]=0
+ self.reopen=1
+ self.__set_icon__(self.trayIcon,"stop")
+ self.state=1
+ self.__execRMD__()
+
+ def __execRMD__(self):
+ self.parent.close_advanced()
+ self.parent.update()
+ self.execargs=["recordmydesktop","-o",'%s'%self.parent.values[4],
+ "-fps","%d"%self.parent.values[0]]
+ if self.parent.values[2]==False :
+ self.execargs.append("--no-sound")
+ if self.parent.values[1] == 1:
+ self.execargs.append("-dummy-cursor")
+ self.execargs.append("white")
+ elif self.parent.values[1] == 2:
+ self.execargs.append("-dummy-cursor")
+ self.execargs.append("black")
+ elif self.parent.values[1] == 3:
+ self.execargs.append("--no-cursor")
+
+ if self.parent.values[3] == 0:
+ self.execargs.append("--full-shots")
+ if self.parent.values[13] == 1:
+ self.execargs.append("--no-shared")
+ if self.parent.values[5][0]>0 :
+ self.execargs.append('-x')
+ self.execargs.append('%d'%self.parent.values[5][0])
+ if self.parent.values[5][1]>0:
+ self.execargs.append('-y')
+ self.execargs.append('%d'%self.parent.values[5][1])
+ if self.parent.values[5][2]>0 and self.parent.values[5][3]>0:
+ self.execargs.append('-width')
+ self.execargs.append('%d'%(self.parent.values[5][2]-self.parent.values[5][0]))
+ self.execargs.append('-height')
+ self.execargs.append('%d'%(self.parent.values[5][3]-self.parent.values[5][1]))
+ for i in range(4):
+ self.parent.values[5][i]=-1
+ if self.parent.values[6]>0:
+ self.execargs.append('-delay')
+ self.execargs.append('%d'%self.parent.values[6])
+ self.execargs.append('-channels')
+ self.execargs.append('%d'%self.parent.values[7])
+ self.execargs.append('-freq')
+ self.execargs.append('%d'%self.parent.values[8])
+ 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')
+ self.execargs.append('%d'%self.parent.values[11])
+ if self.parent.values[12] != "$DISPLAY":
+ self.execargs.append('-display')
+ self.execargs.append('%s'%self.parent.values[12])
+ if self.parent.values[16] == 0:
+ self.execargs.append('--quick-subsampling')
+ self.execargs.append('-workdir')
+ self.execargs.append('%s'%self.parent.values[17])
+ if self.parent.values[18] == 0:
+ self.execargs.append('--on-the-fly-encoding')
+ if self.parent.values[19] == 0:
+ 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')
+ portstring=""
+ for i in self.parent.values[23]:
+ portstring+=i+","
+ portstring=portstring.rstrip(",")
+ self.execargs.append(portstring)
+ #print execargs
+
+
+
+ self.childP=popen2.Popen3(self.execargs,"t")
+ flags = fcntl.fcntl(self.childP.childerr, fcntl.F_GETFL)
+ fcntl.fcntl(self.childP.childerr, fcntl.F_SETFL, flags | os.O_NONBLOCK)
+ self.rmdPid=self.childP.pid
+ self.timed_id=QtCore.QTimer(None)
+ self.timed_id.connect(self.timed_id,QtCore.SIGNAL("timeout()"),
+ self.__check_status__)
+ self.timed_id.start(1000)
+
+ def __exit_status_dialog(self,status):
+ #first try to write down a log for examination
+ try:
+ error_log=open(os.path.join(os.getenv("HOME"),"qt-recordMyDesktop-crash.log"),"w")
+ error_log.write("#This is the command given at initialization:\n")
+ for i in self.execargs:
+ error_log.write("%s "%i)
+ error_log.write("\n\n\n#recordMyDesktop stderror output:\n")
+ try:
+ for err_line in self.childP.childerr.readlines():
+ error_log.write(err_line)
+ except:
+ error_log.write("Couldn't write stderror of recordMyDesktop!\n")
+ self.childP.childerr.close()
+ except:
+ print "Couldn't write error log.\n"
+ self.dialog = QtGui.QWidget()
+ self.label1=None
+ try:
+ self.label1 = QtGui.QLabel("\t\t"+_("Recording is finished.\nrecordMyDesktop has exited with status")+
+ ": %d\n"%(status)+_("Description")+":%s\n"%(self.exit_status[int(status)]))
+ except:
+ self.label1 = QtGui.QLabel("\t\t"+_("Recording is finished.\nrecordMyDesktop has exited with uknown\nerror code")+": %d \n"%(status))
+ self.label1.setAlignment(QtCore.Qt.AlignHCenter)
+ self.dialogbutton = QtGui.QPushButton("Ok",self.dialog)
+ self.dialogbutton.connect(self.dialogbutton,QtCore.SIGNAL("clicked()"),self.dialog.close )
+ self.dialogLayout=QtGui.QVBoxLayout()
+ self.dialogLayout.addWidget(self.label1)
+ self.dialogLayout.addWidget(self.dialogbutton)
+
+ self.label1.show()
+ self.dialogbutton.show()
+ self.dialog.setLayout(self.dialogLayout)
+ self.dialog.resize(300,128)
+ self.dialog.show()
+
+ def __pauseRMD__(self):
+ os.kill(self.rmdPid,signal.SIGUSR1)
+
+ def __stopRMD__(self):
+ if self.timed_id!=None:
+ self.timed_id.stop()
+ self.timed_id=None
+ exit_ret=os.waitpid(self.rmdPid,os.WNOHANG)
+ if exit_ret[0] == 0:
+ os.kill(self.rmdPid,signal.SIGTERM)
+ self.state=-1
+ monitor=imon.rmdMonitor(self.childP.fromchild,self.rmdPid,self.parent)
+ self.state=0
+ else:
+ self.__exit_status_dialog(exit_ret[1])
+ self.parent.show()
+ self.rmdPid=None
+ if self.reopen==1:
+ self.optionsOpen[0]=1
+ self.reopen=0
+
+ #print exit_ret
+ def __check_status__(self):
+ if self.rmdPid!=None:
+ exit_ret=os.waitpid(self.rmdPid,os.WNOHANG)
+ if exit_ret[0] != 0:
+ self.state=0
+ self.__set_icon__(self.trayIcon,"start")
+ self.__exit_status_dialog(exit_ret[1])
+ self.rmdPid=None
+ if self.reopen==1:
+ self.parent.show()
+ self.optionsOpen[0]=1
+ self.reopen=0
+ self.timed_id.stop()
+ return False
+ else:
+ return True
+ else:
+ self.timed_id.stop()
+ return False
+ def __get_icon_location__(self,name):
+ if name=="start":
+ return "icons/rec1.png"
+ elif name=="stop":
+ return "icons/stop1.png"
+ elif name=="pause":
+ return "icons/pause1.png"
+
+ def __init__(self,parent):
+ self.parent=parent
+ self.trayIcon=QtGui.QSystemTrayIcon(None)
+ self.__set_icon__(self.trayIcon,"start")
+ self.tray_popup=iTP.TrayPopupMenu(self.parent,self.parent.values,self.optionsOpen)
+ self.trayIcon.connect(self.trayIcon,QtCore.SIGNAL("activated(QSystemTrayIcon::ActivationReason)"),self.__buttonPress__)
+ self.trayIcon.show()
+
+
+if __name__ == "__main__":
+ import sys
+
+ app=QtGui.QApplication(sys.argv)
+ app.values=rmdConfig.default_values
+ w = trayIcon(app)
+ app.exec_()
+
+
+
+
+
+
diff --git a/qt-recordmydesktop/src/rmdTrayPopup.py b/qt-recordmydesktop/src/rmdTrayPopup.py
new file mode 100644
index 0000000..0c3b5c4
--- /dev/null
+++ b/qt-recordmydesktop/src/rmdTrayPopup.py
@@ -0,0 +1,70 @@
+#/******************************************************************************
+#* qt-recordMyDesktop *
+#*******************************************************************************
+#* *
+#* Copyright (C) 2007 John Varouhakis *
+#* *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+#* *
+#* *
+#* *
+#* For further information contact me at johnvarouhakis@gmail.com *
+#******************************************************************************/
+
+from PyQt4 import QtGui,QtCore
+import locale, gettext
+import rmdConfig
+def _(s):
+ return QtCore.QString.fromUtf8(gettext.gettext(s))
+gettext.textdomain('qt-recordMyDesktop')
+gettext.bindtextdomain('qt-recordMyDesktop',rmdConfig.locale_install_dir)
+
+import rmdSelect as iSel
+import sys
+#import rmdPrefsWidget as pW
+
+class TrayPopupMenu:
+ options=None
+ def __init__(self,parent,values,optionsOpen):
+ self.parent=parent
+ self.optionsOpen=optionsOpen
+ self.values=values
+ self._setup_popup_menu()
+ self.selector = None
+ def _setup_popup_menu(self):
+ self.popupmenu = QtGui.QMenu()
+ self.popupmenu.addAction(_("Preferences"),self._prefs_widget)
+ self.popupmenu.addAction(_("_Select Area On Screen").replace("_",""),self._select_area_cb)
+ self.popupmenu.addAction(_("Quit"),self.parent.window.close)
+
+ def _prefs_widget(self):
+ if self.optionsOpen[0] ==0:
+ self.optionsOpen[0]=1
+ self.parent.show()
+ else:
+ self.parent.hide()
+ self.optionsOpen[0]=0
+
+ def _select_area_cb(self):
+ self.popupmenu.hide()
+ self.selector = iSel.QtAreaSelector(self.values[5])
+ self.selector.showFullScreen()
+ self.parent.image.x1=-1
+ def show(self):
+ QtGui.QMenu.show(self.popupmenu)
+ def hide(self):
+ self.popupmenu.hide()
+
© All Rights Reserved