diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-08-09 23:11:43 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-08-09 23:11:43 +0000 |
commit | c364387c6657769e29ade8fe16038a1c9b6fa1e0 (patch) | |
tree | 57e4a0e606ec4c32c70d41b185fe5e399801063d /qt-recordmydesktop/src | |
parent | b5244639d1b3e38b1c56e03e7f65b8da44970233 (diff) |
rmdConfig.py.in, rmdFrame.py, rmdPrefsWidget.py,
rmdSelectThumb.py, rmdSimple.py, rmdStrings.py,
rmdTrayIcon.py : Added follow mouse option in the
Preferences Widget and all relevant functionality
( save/load , defaults, string/tooltip). Also added
moveFrame method so that the frame can follow
the mouse.
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@406 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'qt-recordmydesktop/src')
-rw-r--r-- | qt-recordmydesktop/src/rmdConfig.py.in | 2 | ||||
-rw-r--r-- | qt-recordmydesktop/src/rmdFrame.py | 30 | ||||
-rw-r--r-- | qt-recordmydesktop/src/rmdPrefsWidget.py | 24 | ||||
-rw-r--r-- | qt-recordmydesktop/src/rmdSelectThumb.py | 34 | ||||
-rw-r--r-- | qt-recordmydesktop/src/rmdSimple.py | 11 | ||||
-rw-r--r-- | qt-recordmydesktop/src/rmdStrings.py | 5 | ||||
-rw-r--r-- | qt-recordmydesktop/src/rmdTrayIcon.py | 16 |
7 files changed, 83 insertions, 39 deletions
diff --git a/qt-recordmydesktop/src/rmdConfig.py.in b/qt-recordmydesktop/src/rmdConfig.py.in index 5d4184f..fa2fcd5 100644 --- a/qt-recordmydesktop/src/rmdConfig.py.in +++ b/qt-recordmydesktop/src/rmdConfig.py.in @@ -23,7 +23,7 @@ default_values=[15, #framerate #but when the value is set to this the argument is omitted 0, #shared memory,0 on 1 off 0, #reset recording area ,0 on 1 off - 75, #shared threshold.Removed at 0.3.4, preserved for compatibility of prefs file. + 1, #follow mouse,0 on 1 off 1, #quick subsampling,0 on 1 off "/tmp", #working directory 1, #on the fly encoding,0 on 1 off diff --git a/qt-recordmydesktop/src/rmdFrame.py b/qt-recordmydesktop/src/rmdFrame.py index ef05fc6..bb11778 100644 --- a/qt-recordmydesktop/src/rmdFrame.py +++ b/qt-recordmydesktop/src/rmdFrame.py @@ -29,13 +29,13 @@ class rmdFrame: borderwidth=6 outlinewidth=1 - def __init__(self,x,y,w,h): + def __init__(self,x,y,w,h,parent): self.window=QtGui.QWidget(None,QtCore.Qt.X11BypassWindowManagerHint|QtCore.Qt.WindowStaysOnTopHint) self.x=x self.y=y self.w=w self.h=h - + self.parent=parent self.mask = QtGui.QBitmap(self.w+self.borderwidth*2, self.h+self.borderwidth*2) self.mask.fill(QtCore.Qt.color1) @@ -49,9 +49,31 @@ class rmdFrame: self.window.move(self.x-self.borderwidth, self.y-self.borderwidth) self.window.show() + self.timer=QtCore.QTimer(None) + self.timer.connect(self.timer,QtCore.SIGNAL("timeout()"), + self.moveFrame) + self.timer.start(10) + self.screen_width=QtGui.qApp.desktop().width() + self.screen_height=QtGui.qApp.desktop().height() - def paintEvent(self,Event): + def moveFrame(self): + if self.parent.values[15]==0: + npos=QtGui.QCursor.pos() + x=npos.x()-self.w/2 + y=npos.y()-self.h/2 + x=(x>>1)<<1 + y=(y>>1)<<1 + if x<0:x=0 + if y<0:y=0 + if x+self.w>self.screen_width:x=self.screen_width-self.w + if y+self.h>self.screen_height:y=self.screen_height-self.h + if(x!=self.x or y!= self.y): + self.x=x + self.y=y + self.window.move(self.x-(self.borderwidth),self.y-(self.borderwidth)) + + def paintEvent(self,Event): painterw= QtGui.QPainter(self.window) painterw.fillRect(0,0,self.w+self.borderwidth*2, self.h+self.borderwidth*2, @@ -83,7 +105,7 @@ class rmdFrame: pass def destroy(self): - #self.area.destroy() + self.timer.stop() try: self.window.close() except: diff --git a/qt-recordmydesktop/src/rmdPrefsWidget.py b/qt-recordmydesktop/src/rmdPrefsWidget.py index 407a9f4..5aa8ede 100644 --- a/qt-recordmydesktop/src/rmdPrefsWidget.py +++ b/qt-recordmydesktop/src/rmdPrefsWidget.py @@ -42,7 +42,7 @@ from rmdStrings import * class prefsWidget(object): def __tooltips__(self): - for i in range(18): + for i in range(19): self.labels[i].setToolTip(htmlize(prefTooltipLabels[i])) self.jack_button.setToolTip(htmlize(prefJacktip)) self.jack_lsp_label.setToolTip(htmlize(prefJacktip)) @@ -60,6 +60,7 @@ class prefsWidget(object): self.values[12]=self.displayEntry.text().replace(' ','') self.values[13]=self.sharedComboBox.currentIndex() self.values[14]=self.areaResetComboBox.currentIndex() + self.values[15]=self.followMouseComboBox.currentIndex() self.values[16]=self.quickComboBox.currentIndex() self.values[17]=self.workdirEntry.text() self.values[18]=self.onTheFlyComboBox.currentIndex() @@ -211,7 +212,7 @@ class prefsWidget(object): self.boxes[9].insertWidget(-1,self.deviceEntry) #misc page - for i in xrange(10,18): + for i in xrange(10,19): self.labels[i]=QtGui.QLabel(prefLabelStrings[i],self.tabWidgets[3]) self.labels[i].setAlignment(QtCore.Qt.AlignLeft) self.boxes[i]=QtGui.QHBoxLayout() @@ -227,43 +228,48 @@ class prefsWidget(object): self.mouseComboBox = QtGui.QComboBox(self.tabWidgets[3]) for i in range(4): self.mouseComboBox.addItem(prefMouseStrings[i]) - self.mouseComboBox.setCurrentIndex(self.values[1]) + self.mouseComboBox.setCurrentIndex(self.values[15]) self.boxes[11].insertWidget(-1,self.mouseComboBox) + self.followMouseComboBox = QtGui.QComboBox(self.tabWidgets[3]) + for i in range(2): + self.followMouseComboBox.addItem(prefStateStrings[i]) + self.followMouseComboBox.setCurrentIndex(self.values[15]) + self.boxes[12].insertWidget(-1,self.followMouseComboBox) self.sharedComboBox = QtGui.QComboBox(self.tabWidgets[3]) for i in range(2): self.sharedComboBox.addItem(prefStateStrings[i]) self.sharedComboBox.setCurrentIndex(self.values[13]) - self.boxes[12].insertWidget(-1,self.sharedComboBox) + self.boxes[13].insertWidget(-1,self.sharedComboBox) self.winDecoComboBox = QtGui.QComboBox(self.tabWidgets[3]) for i in range(2): self.winDecoComboBox.addItem(prefStateStrings[i]) self.winDecoComboBox.setCurrentIndex(self.values[21]) - self.boxes[13].insertWidget(-1,self.winDecoComboBox) + self.boxes[14].insertWidget(-1,self.winDecoComboBox) self.tooltipsComboBox = QtGui.QComboBox(self.tabWidgets[3]) for i in range(2): self.tooltipsComboBox.addItem(prefStateStrings[i]) self.tooltipsComboBox.setCurrentIndex(self.values[24]) - self.boxes[14].insertWidget(-1,self.tooltipsComboBox) + self.boxes[15].insertWidget(-1,self.tooltipsComboBox) self.rFrameComboBox = QtGui.QComboBox(self.tabWidgets[3]) for i in range(2): self.rFrameComboBox.addItem(prefStateStrings[i]) self.rFrameComboBox.setCurrentIndex(self.values[25]) - self.boxes[15].insertWidget(-1,self.rFrameComboBox) + self.boxes[16].insertWidget(-1,self.rFrameComboBox) self.areaResetComboBox = QtGui.QComboBox(self.tabWidgets[3]) for i in range(2): self.areaResetComboBox.addItem(prefStateStrings[i]) self.areaResetComboBox.setCurrentIndex(self.values[14]) - self.boxes[16].insertWidget(-1,self.areaResetComboBox) + self.boxes[17].insertWidget(-1,self.areaResetComboBox) self.extraOptsEntry= QtGui.QLineEdit(self.values[26]) - self.boxes[17].insertWidget(-1,self.extraOptsEntry) + self.boxes[18].insertWidget(-1,self.extraOptsEntry) for i in range(4): self.tabWidgets[i].setLayout(self.labelbox[i]) diff --git a/qt-recordmydesktop/src/rmdSelectThumb.py b/qt-recordmydesktop/src/rmdSelectThumb.py index 3da48ec..045a1c8 100644 --- a/qt-recordmydesktop/src/rmdSelectThumb.py +++ b/qt-recordmydesktop/src/rmdSelectThumb.py @@ -68,8 +68,9 @@ class QtThumbSelector(QtGui.QLabel): 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 + if (((self.area_return[0]!=self.realFrame.x or + self.area_return[1]!=self.realFrame.y) and + self.caller.values[15]==1) 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]): @@ -93,19 +94,19 @@ class QtThumbSelector(QtGui.QLabel): 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)) + if self.selecting==1 or self.caller.values[15]==1: + 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() @@ -145,7 +146,8 @@ class QtThumbSelector(QtGui.QLabel): 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]) + self.area_return[3]-self.area_return[1], + self.caller) def closeEvent(self,event): self.realFrame.destroy() QtGui.QLabel.close(self) diff --git a/qt-recordmydesktop/src/rmdSimple.py b/qt-recordmydesktop/src/rmdSimple.py index 5c2be25..e4b3585 100644 --- a/qt-recordmydesktop/src/rmdSimple.py +++ b/qt-recordmydesktop/src/rmdSimple.py @@ -292,7 +292,7 @@ class simpleWidget(object): self.values[5]=[] for i in rmdConfig.default_values[5]: self.values[5].append(i) - #open for some future option + #loaded further bellow self.values.append(0) savefile.readline() self.values.append(int(savefile.readline())) @@ -338,6 +338,13 @@ class simpleWidget(object): self.values.append(rmdConfig.default_values[26]) else: self.values.append(savefile.readline().replace("\n","")) + p=savefile.readline() + if p=='': + self.values[15]=rmdConfig.default_values[15] + else: + t_followmouse=int(savefile.readline()) + if t_followmouse>1: t_followmouse=1 + self.values[15]=t_followmouse return True except: return False @@ -404,6 +411,8 @@ class simpleWidget(object): savefile.write("%d\n"%self.values[25]) savefile.write("#Extra options\n") savefile.write("%s\n"%self.values[26]) + savefile.write("#Follow mouse,1 disabled 0 enabled\n") + savefile.write("%d\n"%self.values[15]) savefile.flush() savefile.close() return True diff --git a/qt-recordmydesktop/src/rmdStrings.py b/qt-recordmydesktop/src/rmdStrings.py index b588d2c..4de1f4e 100644 --- a/qt-recordmydesktop/src/rmdStrings.py +++ b/qt-recordmydesktop/src/rmdStrings.py @@ -69,8 +69,8 @@ prefLabelStrings=[_('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'), + _('Follow Mouse'),_('MIT-Shm extension'),_('Include Window Decorations'), + _('Tooltips'),_('Outline Capture Area On Screen'), _('Reset Capture Area'), _('Extra Options'), _('Video Quality'),_('Sound Quality'), @@ -90,6 +90,7 @@ prefTooltipLabels=[_('By default, if you try to save under a filename that alrea _('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.'), + _('When This option is enabled, the capture\narea will follow your mouse cursor.\nEnabling this option will also enable full shots at\nevery frame, so it\'s not recommended\nfor large capture areas.'), _('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)'), diff --git a/qt-recordmydesktop/src/rmdTrayIcon.py b/qt-recordmydesktop/src/rmdTrayIcon.py index bd70af4..ae9b3cf 100644 --- a/qt-recordmydesktop/src/rmdTrayIcon.py +++ b/qt-recordmydesktop/src/rmdTrayIcon.py @@ -140,12 +140,14 @@ class trayIcon(object): 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[15]==1: + 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])) @@ -181,6 +183,8 @@ class trayIcon(object): self.execargs.append('--compress-cache') if self.parent.values[20] == True: self.execargs.append('--overwrite') + if self.parent.values[15] == 0: + self.execargs.append('--follow-mouse') if self.parent.values[22] == True: self.execargs.append('-use-jack') for i in self.parent.values[23]: |