diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | model.py | 18 | ||||
-rwxr-xr-x | record.py | 22 | ||||
-rw-r--r-- | ui.py | 37 |
4 files changed, 49 insertions, 33 deletions
@@ -1,3 +1,8 @@ +37 +* prevent duplicate thumbnails when shared (jedierikb) +* prevent changing modes when using timer (jedierikb, mikhak) +* fix audio mesh share (jedierikb, mikhak) + 36 * ui (jedierikb, mikhak, eben) * tubes @@ -80,18 +80,17 @@ class Model: return self.MODE == Constants.MODE_PHOTO - def displayThumb( self, type, forceUpdating ): + def displayThumb( self, recd, forceUpdating ): #to avoid Xlib: unexpected async reply error when taking a picture on a gst callback, always call with idle_add #this happens b/c this might get called from a gstreamer callback - - if (not type == self.MODE): + if (not recd.type == self.MODE): return if (forceUpdating): self.setUpdating( True ) - hash = self.mediaHashs[type] + hash = self.mediaHashs[recd.type] if (len(hash) > 0): - self.ca.ui.addThumb( hash[len(hash)-1] ) + self.ca.ui.addThumb(recd) if (forceUpdating): self.setUpdating( False ) @@ -199,7 +198,7 @@ class Model: audioHash = self.mediaHashs[Constants.TYPE_AUDIO] audioHash.append( recd ) - gobject.idle_add(self.displayThumb, Constants.TYPE_AUDIO, True) + gobject.idle_add(self.displayThumb, recd, True) self.doPostSaveVideo() self.meshShareRecd( recd ) @@ -256,9 +255,8 @@ class Model: videoHash = self.mediaHashs[Constants.TYPE_VIDEO] videoHash.append( recd ) - gobject.idle_add(self.displayThumb, Constants.TYPE_VIDEO, True) - self.doPostSaveVideo() + gobject.idle_add(self.displayThumb, recd, True) self.meshShareRecd( recd ) @@ -320,7 +318,7 @@ class Model: photoHash = self.mediaHashs[Constants.TYPE_PHOTO] photoHash.append( recd ) - gobject.idle_add(self.displayThumb, Constants.TYPE_PHOTO, True) + gobject.idle_add(self.displayThumb, recd, True) self.meshShareRecd( recd ) @@ -330,7 +328,7 @@ class Model: self.mediaHashs[recd.type].append( recd ) #updateUi, but don't lock up the buttons if they're recording or whatever - gobject.idle_add(self.displayThumb, recd.type, False) + gobject.idle_add(self.displayThumb, recd, False) def createNewRecorded( self, type ): @@ -426,7 +426,7 @@ class Record(activity.Activity): audioImgFilepath = recd.getAudioImageFilepath() destPath = os.path.join(Instance.tmpPath, "audioBundle") - destPath = utils.getUniqueFilepath(audioBundle, 0) + destPath = utils.getUniqueFilepath(destPath, 0) cmd = "cat " + str(filepath) + " " + str(audioImgFilepath) + " > " + str(destPath) self.__class__.log.debug(cmd) os.system(cmd) @@ -483,13 +483,21 @@ class Record(activity.Activity): cmd = "split -a 1 -b " + str(recd.mediaBytes) + " " + str(filepath) + " " + str(bundlePath) self.__class__.log.debug( cmd ) os.system( cmd ) - bundleName = os.path.basename(bundlePath) - recd.mediaFilename = str(bundleName) + "a" - recd.audioImageFilename = str(bundleName) + "b" - - else: - self.ui.showMeshRecd( recd ) + bundleName = os.path.basename(bundlePath) + mediaFilename = str(bundleName) + "a" + mediaFilepath = os.path.join(Instance.tmpPath, mediaFilename) + mediaFilepathExt = os.path.join(Instance.tmpPath, mediaFilename+".ogg") + os.rename(mediaFilepath, mediaFilepathExt) + audioImageFilename = str(bundleName) + "b" + audioImageFilepath = os.path.join(Instance.tmpPath, audioImageFilename) + audioImageFilepathExt = os.path.join(Instance.tmpPath, audioImageFilename+".png") + os.rename(audioImageFilepath, audioImageFilepathExt) + + recd.mediaFilename = os.path.basename(mediaFilepathExt) + recd.audioImageFilename = os.path.basename(audioImageFilepathExt) + + self.ui.showMeshRecd( recd ) elif part > numparts: self.__class__.log.error('More parts than required have arrived') @@ -98,6 +98,7 @@ class UI: self.RECD_INFO_ON = False
self.UPDATE_DURATION_ID = 0
self.UPDATE_TIMER_ID = 0
+ self.COUNTINGDOWN = False
#init
self.mapped = False
@@ -703,28 +704,27 @@ class UI: def updateButtonSensitivities( self ):
- self.recordWindow.shutterButton.set_sensitive( not self.ca.m.UPDATING )
switchStuff = ((not self.ca.m.UPDATING) and (not self.ca.m.RECORDING))
self.photoToolbar.set_sensitive( switchStuff )
self.videoToolbar.set_sensitive( switchStuff )
self.audioToolbar.set_sensitive( switchStuff )
- if (self.ca.m.UPDATING):
- self.ca.ui.setWaitCursor( self.ca.window )
- for i in range (0, len(self.windowStack)):
- self.ca.ui.setWaitCursor( self.windowStack[i].window )
- else:
- self.ca.ui.setDefaultCursor( self.ca.window )
- for i in range (0, len(self.windowStack)):
- self.ca.ui.setDefaultCursor( self.windowStack[i].window )
+ if (not self.COUNTINGDOWN):
+ if (self.ca.m.UPDATING):
+ self.ca.ui.setWaitCursor( self.ca.window )
+ for i in range (0, len(self.windowStack)):
+ self.ca.ui.setWaitCursor( self.windowStack[i].window )
+ else:
+ self.ca.ui.setDefaultCursor( self.ca.window )
+ for i in range (0, len(self.windowStack)):
+ self.ca.ui.setDefaultCursor( self.windowStack[i].window )
- if (self.ca.m.RECORDING):
- #self.recordWindow.shutterButton.modify_bg( gtk.STATE_NORMAL, Constants.colorRed.gColor )
- self.recordWindow.shutterButton.doRecordButton()
- else:
- #self.recordWindow.shutterButton.modify_bg( gtk.STATE_NORMAL, None )
- self.recordWindow.shutterButton.doNormalButton()
+ self.recordWindow.shutterButton.set_sensitive( not self.ca.m.UPDATING )
+ if (self.ca.m.RECORDING):
+ self.recordWindow.shutterButton.doRecordButton()
+ else:
+ self.recordWindow.shutterButton.doNormalButton()
kids = self.thumbTray.get_children()
for i in range (0, len(kids)):
@@ -1148,13 +1148,14 @@ class UI: if (timerTime > 0):
self.timerStartTime = time.time()
self.UPDATE_TIMER_ID = gobject.timeout_add( 500, self._updateTimerCb )
+ self.COUNTINGDOWN = True
+ self.ca.m.setUpdating(True)
else:
self.clickShutter()
else:
#or, if there is no countdown, it might be because we are recording
self.clickShutter()
-
else:
#we're timing down something, but interrupted by user click or the timer completing
self._completeTimer()
@@ -1162,6 +1163,8 @@ class UI: def _completeTimer( self ):
+ self.COUNTINGDOWN = False
+ self.ca.m.setUpdating(False)
self.recordWindow.updateCountdown(-1)
self.progressWindow.updateProgress( 1, "" )
gobject.source_remove( self.UPDATE_TIMER_ID )
@@ -1181,6 +1184,8 @@ class UI: timerTime = self.audioToolbar.getTimer()
if (passedTime >= timerTime):
+ self.COUNTINGDOWN = False
+ self.ca.m.setUpdating(False)
self.doShutter()
return False
else:
|