diff options
author | erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0> | 2007-10-10 15:27:39 (GMT) |
---|---|---|
committer | erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0> | 2007-10-10 15:27:39 (GMT) |
commit | 993d95b91c6acbf4bd15cc9773b365442f56ba1e (patch) | |
tree | 0454145e4c69c28f50ceef6061927d6afda89738 | |
parent | 19cd7c21180c9b5e5909d4a88faa9e1df0324850 (diff) |
remove initial setup listener
add removeThumbs
git-svn-id: http://mediamods.com/public-svn/camera-activity/Record.activity@578 574bc980-5f2d-0410-acbc-c8f9f0eb14e0
-rwxr-xr-x | RecordActivity.py | 2 | ||||
-rw-r--r-- | button.py | 13 | ||||
-rw-r--r-- | model.py | 56 | ||||
-rw-r--r-- | ui.py | 50 |
4 files changed, 72 insertions, 49 deletions
diff --git a/RecordActivity.py b/RecordActivity.py index 7cee0b4..b7340a0 100755 --- a/RecordActivity.py +++ b/RecordActivity.py @@ -260,7 +260,7 @@ class RecordActivity(activity.Activity): mediaObject.metadata['icon-color'] = colors mtype = self.m.mediaTypes[recd.type] - mmime = mtype[self.typeMime] + mmime = mtype[self.keyMime] mediaObject.metadata['mime_type'] = mmime #todo: make sure the file is still available before you ever get to this point... @@ -74,17 +74,22 @@ class RecdButton(TrayButton, gobject.GObject): palette = Palette(info) self.set_palette(palette) - rem_menu_item = gtk.MenuItem( self.ui.ca.istrRemove ) - rem_menu_item.connect('activate', self._itemRemoveCb) + self.rem_menu_item = gtk.MenuItem( self.ui.ca.istrRemove ) + self.ACTIVATE_REMOVE_ID = rem_menu_item.connect('activate', self._itemRemoveCb) palette.menu.append(rem_menu_item) rem_menu_item.show() - copy_menu_item = gtk.MenuItem( self.ui.ca.istrCopyToClipboard ) - copy_menu_item.connect('activate', self._itemCopyToClipboardCb) + self.copy_menu_item = gtk.MenuItem( self.ui.ca.istrCopyToClipboard ) + self.ACTIVATE_COPY_ID = copy_menu_item.connect('activate', self._itemCopyToClipboardCb) palette.menu.append(copy_menu_item) copy_menu_item.show() + def cleanUp( self ): + self.rem_menu_item.disconnect( self.ACTIVATE_REMOVE_ID ) + self.copy_menu_item.disconnect( self.ACTIVATE_COPY_ID ) + + def _itemRemoveCb(self, widget): self.ui.deleteThumbSelection( self.recd ) @@ -171,7 +171,7 @@ class Model: return self.MODE == self.MODE_PHOTO - def setupThumbs( self, type ): + def addThumb( self, type ): if (not type == self.MODE): return @@ -179,30 +179,45 @@ class Model: hash = self.mediaHashs[type] if (len(hash) > 0): self.ca.ui.addThumb( hash[len(hash)-1] ) - self.setUpdating( False ) + def setupThumbs( self, type ): + if (not type == self.MODE): + return + + #todo: clear the thumbs in the tray + self.ca.ui.removeAllThumbs() + + self.setUpdating( True ) + hash = self.mediaHashs[type] + for i in range (0, len(hash)): + self.ca.ui.addThumb( hash[i] ) + self.ca.ui.updateModeChange() + self.setUpdating(False) + + def showNextThumb( self, shownRecd ): print("showNext") if (shownRecd == None): self.showLastThumb() else: + hash = self.mediaHashs[self.MODE] if (len(hash) > 0): hash = self.mediaHashs[self.MODE] i = operator.indexOf( hash, shownRecd ) - i = i-1 - if (i<0): - i = len(hash)-1 + i = i+1 + if (i>=len(hash)): + i = 0 self.ca.ui.showThumbSelection( hash[i] ) - def showPrevThumb( self, shownRecd ): print("showPrev") if (shownRecd == None): self.showLastThumb() else: + hash = self.mediaHashs[self.MODE] if (len(hash) > 0): hash = self.mediaHashs[self.MODE] i = operator.indexOf( hash, shownRecd ) @@ -288,21 +303,6 @@ class Model: audioHash = self.mediaHashs[self.TYPE_AUDIO] audioHash.append( recd ) self.thumbAdded( self.TYPE_AUDIO ) - -# SJ KLEIN AUDIO SAVE TO DISK BEGIN -# audioPath = os.path.join(os.path.expanduser("~"), "Journal", "Audio") -# if (not os.path.exists(audioPath)): -# os.makedirs(audioPath) - -# whoWhen = self.ca.nickName + "_" + str(strftime( "%a_%b_%d__%I:%M:%S_%p", time.localtime(recd.time) )) -# audioFilepath = os.path.join( audioPath, whoWhen + ".wav" ) -# audioFilepath = self.getUniqueFilepath(audioFilepath, 0) -# shutil.copy( os.path.join(self.ca.tempPath,recd.mediaFilename), audioFilepath ) -# audioImageFilepath = os.path.join( audioPath, whoWhen + ".png" ) -# audioImageFilepath = self.getUniqueFilepath(audioImageFilepath, 0) -# shutil.copy( imagePath, audioImageFilepath ) -# SJ KLEIN AUDIO SAVE TO DISK END - self.doPostSaveVideo() self.meshShareRecd( recd ) @@ -567,41 +567,31 @@ class Model: def thumbAdded( self, type ): #to avoid Xlib: unexpected async reply error when taking a picture on a gst callback #this happens b/c this might get called from a gstreamer callback - gobject.idle_add(self.setupThumbs, type) + gobject.idle_add(self.addThumb, type) def doVideoMode( self ): if (self.MODE == self.MODE_VIDEO): return - self.setUpdating(True) self.MODE = self.MODE_VIDEO + self.setUpdating(True) gobject.idle_add( self.setupThumbs, self.MODE ) - #todo: move these into the setupThumbs call for the idle call - self.ca.ui.updateModeChange() - self.setUpdating(False) def doPhotoMode( self ): if (self.MODE == self.MODE_PHOTO): return - self.setUpdating(True) self.MODE = self.MODE_PHOTO - gobject.idle_add( self.setupThumbs, self.MODE ) - self.ca.ui.updateModeChange() - self.setUpdating(False) def doAudioMode( self ): if (self.MODE == self.MODE_AUDIO): return - self.setUpdating(True) self.MODE = self.MODE_AUDIO gobject.idle_add( self.setupThumbs, self.MODE ) - self.ca.ui.updateModeChange() - self.setUpdating(False) def setConstants( self ): @@ -128,6 +128,8 @@ class UI: def _toolboxSizeAllocateCb( self, widget, event ):
+ self.toolbox.disconnect( self.TOOLBOX_SIZE_ALLOCATE_ID)
+
toolboxHt = self.toolbox.size_request()[1]
self.vh = gtk.gdk.screen_height()-(self.thumbTrayHt+toolboxHt+self.controlBarHt)
self.vw = int(self.vh/.75)
@@ -513,14 +515,19 @@ class UI: if (keyname == 'KP_Page_Up'): #O, up
print("GAME UP")
if (self.LIVEMODE):
+ if (self.RECD_INFO_ON):
+ self.self.infoButtonClicked()
+ return
if (not self.ca.m.UPDATING):
self.doShutter()
else:
- self.LIVEMODE = True
- self.updateVideoComponents()
+ if (self.ca.m.MODE == self.ca.m.MODE_PHOTO):
+ self.resumeLiveVideo()
+ else:
+ self.resumePlayLiveVideo()
elif (keyname == 'KP_Page_Down'): #x, down
print("GAME X")
- elf.ca.m.showLastThumb()
+ self.ca.m.showLastThumb()
elif (keyname == 'KP_Home'): #square, left
print("GAME LEFT")
if (not self.LIVEMODE):
@@ -535,11 +542,19 @@ class UI: elif (keyname == 'Escape'):
if (self.FULLSCREEN):
self.FULLSCREEN = False
- self.updateVideoComponents()
- elif (keyname == "SpaceBar"): #todo
+ if (self.RECD_INFO_ON):
+ self.infoButtonClicked()
+ else:
+ self.updateVideoComponents()
+ elif (keyname == "Spacebar"): #todo
if (self.LIVEMODE):
if (not self.ca.m.UPDATING):
self.doShutter()
+ elif (keyname == 'i'):
+ print("i")
+ if (not self.LIVEMODE):
+ print("NOT LIVEMODE")
+ self.infoButtonClicked()
return False
@@ -685,6 +700,10 @@ class UI: def _liveButtonReleaseCb(self, widget, event):
+ self.resumeLiveVideo()
+
+
+ def resumeLiveVideo( self ):
self.livePhotoCanvas.setImage( None )
self.RECD_INFO_ON = False
@@ -698,6 +717,10 @@ class UI: def _playLiveButtonReleaseCb(self, widget, event):
+ self.resumePlayLiveVideo()
+
+
+ def resumePlayLiveVideo( self ):
self.ca.gplay.stop()
self.RECD_INFO_ON = False
@@ -1089,8 +1112,9 @@ class UI: pos.append({"position":"img", "window":self.livePhotoWindow} )
pos.append({"position":"pgd", "window":self.pipBgdWindow} )
pos.append({"position":"pip", "window":self.liveVideoWindow} )
- pos.append({"position":"inb", "window":self.infWindow} )
+ pos.append({"position":"inf", "window":self.infWindow} )
elif (self.TRANSCODING):
+ #todo: enlarge
pos.append({"position":"prg", "window":self.progressWindow} )
@@ -1174,10 +1198,6 @@ class UI: self.setPrgLocDim( pos[j]["window"])
- def removeThumbs( self ):
- pass
-
-
def removeThumb( self, recd ):
kids = self.thumbTray.get_children()
for i in range (0, len(kids)):
@@ -1188,9 +1208,17 @@ class UI: def addThumb( self, recd ):
butt = RecdButton( self, recd )
- butt.connect("clicked", self._thumbClicked, recd )
+ butt.connect( "clicked", self._thumbClicked, recd )
self.thumbTray.add_item( butt, len(self.thumbTray.get_children()) )
butt.show()
+ print("thumb added")
+
+
+ def removeThumbs( self ):
+ kids = self.thumbTray.get_children()
+ for i in range (0, len(kids)):
+ self.thumbTray.remove_item(kids[i])
+ kids[i].cleanUp()
def _thumbClicked( self, button, recd ):
|