From 55659477f23a37170d7823ac17b7aed0f5e641c6 Mon Sep 17 00:00:00 2001 From: iovar Date: Mon, 18 Jun 2007 16:37:23 +0000 Subject: rmdMonitor.py: Inherits QDialog now, removed some unneeded show() calls, added wait for child proccess, removed frame and window members (window not needed as self is now the main widget, frame also unneeded since main widget is no longer a QMainWindow and can get the layout directly).Also closeEvent() is now directly reimplemented. rmdTrayIcon.py:Added exec_ call for rmdMonitor, state now doesn't change before encoding ends. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@360 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- qt-recordmydesktop/src/rmdMonitor.py | 35 +++++++++++++++++++---------------- qt-recordmydesktop/src/rmdTrayIcon.py | 3 +++ 2 files changed, 22 insertions(+), 16 deletions(-) (limited to 'qt-recordmydesktop/src') diff --git a/qt-recordmydesktop/src/rmdMonitor.py b/qt-recordmydesktop/src/rmdMonitor.py index b35f5a0..08450c8 100644 --- a/qt-recordmydesktop/src/rmdMonitor.py +++ b/qt-recordmydesktop/src/rmdMonitor.py @@ -37,16 +37,17 @@ import popen2 import os,fcntl,signal from rmdStrings import * -class rmdMonitor(object): +class rmdMonitor(QtGui.QDialog): labeString=monStrings['PleaseWait'] counter_fraction=0.0 - def destroy_and_kill(self,Event=None): + def closeEvent(self,Event=None): self.timed_id.stop() self.stop_encoding() def destroy(self,Event=None): - self.window.close() + self.close() + exit_ret=os.waitpid(self.rmdPid,0) self.parent.show() def update_counter(self): strstdout="" @@ -77,14 +78,15 @@ class rmdMonitor(object): flags = fcntl.fcntl(out_stream, fcntl.F_GETFL) fcntl.fcntl(out_stream, fcntl.F_SETFL, flags | os.O_NONBLOCK) self.rmdPid=childPid + self.stdout=out_stream + #self.window = QtGui.QDialog() + QtGui.QDialog.__init__(self) + #self.closeEvent=self.destroy_and_kill - self.window = QtGui.QMainWindow() - self.window.closeEvent=self.destroy_and_kill - - self.window.setWindowTitle("recordMyDesktop-encoder") + self.setWindowTitle("recordMyDesktop-encoder") - self.frame=QtGui.QFrame() + #self.frame=QtGui.QFrame() self.label=QtGui.QLabel(self.labeString) self.label.setAlignment(QtCore.Qt.AlignHCenter) @@ -92,7 +94,7 @@ class rmdMonitor(object): self.progressbar=QtGui.QProgressBar() self.counter_fraction=0 self.progressbar.setValue(self.counter_fraction) - self.stopbutton=QtGui.QPushButton(monStrings['Cancel'],self.window) + self.stopbutton=QtGui.QPushButton(monStrings['Cancel'],self) self.stopbutton.connect(self.stopbutton,QtCore.SIGNAL("clicked()"), self.stop_encoding) self.box=QtGui.QVBoxLayout() @@ -101,13 +103,13 @@ class rmdMonitor(object): 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.stopbutton.show() + self.setLayout(self.box) + #self.window.setCentralWidget(self.frame) + #self.label.show() + #self.progressbar.show() + #self.window.show() + self.timed_id=QtCore.QTimer(None) self.timed_id.connect(self.timed_id,QtCore.SIGNAL("timeout()"), self.update_counter) @@ -117,3 +119,4 @@ class rmdMonitor(object): + diff --git a/qt-recordmydesktop/src/rmdTrayIcon.py b/qt-recordmydesktop/src/rmdTrayIcon.py index 1d657b6..57a7ca7 100644 --- a/qt-recordmydesktop/src/rmdTrayIcon.py +++ b/qt-recordmydesktop/src/rmdTrayIcon.py @@ -72,6 +72,7 @@ class trayIcon(object): def __buttonPress__(self,ActivationReason): + button=0 if ActivationReason==QtGui.QSystemTrayIcon.Trigger: button=1 @@ -249,6 +250,8 @@ class trayIcon(object): os.kill(self.rmdPid,signal.SIGTERM) self.state=-1 monitor=imon.rmdMonitor(self.childP.fromchild,self.rmdPid,self.parent) + monitor.exec_() + self.state=0 else: self.__exit_status_dialog(exit_ret[1]) -- cgit v1.2.3