[Sugar-devel] [record] Fixes to the UI
anishmangal2002 at gmail.com
anishmangal2002 at gmail.com
Sun Jun 6 14:34:18 EDT 2010
From: anishmangal2002 <anishmangal2002 at gmail.com>
This patch fixes the Record ui which is broken since versions 0.86 and later.
---
model.py | 7 ++
record.py | 3 +-
ui.py | 206 +++++++++++++++++++++++++++++++++++++++++++++++++------------
3 files changed, 174 insertions(+), 42 deletions(-)
diff --git a/model.py b/model.py
index b7f592b..6fc2c66 100644
--- a/model.py
+++ b/model.py
@@ -254,6 +254,10 @@ class Model:
self.setUpdating( True )
self.setRecording( False )
self.ca.ui.FULLSCREEN = False
+ pos = []
+ pos.append({"position":"max", "window":self.ca.ui.maxWindow} )
+ pos.append({"position":"eye", "window":self.ca.ui.recordWindow} )
+ pos.append({"position":"prg", "window":self.ca.ui.progressWindow} )
self.ca.ui.updateVideoComponents()
@@ -321,8 +325,11 @@ class Model:
def startTakingPhoto( self ):
+ logging.debug('start taking photo')
self.setUpdating( True )
self.ca.glive.takePhoto()
+ self.ca.ui.FULLSCREEN = False
+ self.ca.ui.updateVideoComponents()
def savePhoto( self, pixbuf ):
diff --git a/record.py b/record.py
index ccd4295..432ef60 100644
--- a/record.py
+++ b/record.py
@@ -184,7 +184,8 @@ class Record(activity.Activity):
if (self.ui != None):
self.ui.updateButtonSensitivities( )
self.ui.doMouseListener( False )
- self.ui.hideAllWindows()
+ self.ui.actuallyHideAllWindows()
+
if (self.gplay != None):
self.gplay.stop( )
if (self.glive != None):
diff --git a/ui.py b/ui.py
index d89b819..6cad21a 100644
--- a/ui.py
+++ b/ui.py
@@ -369,7 +369,6 @@ class UI:
self.centered = True
self.setUp()
-
def _mapEventCb( self, widget, event ):
#when your parent window is ready, turn on the feed of live video
self.liveVideoWindow.disconnect(self.MAP_EVENT_ID)
@@ -461,9 +460,11 @@ class UI:
self.slowLiveVideoWindow.connect("visibility-notify-event", self._visibleNotifyCb)
self.recordWindow = RecordWindow(self)
+ self.recordWindow.set_geometry_hints(min_width=1, min_height=1)
self.addToWindowStack( self.recordWindow, self.windowStack[len(self.windowStack)-1] )
self.progressWindow = ProgressWindow(self)
+ self.progressWindow.set_geometry_hints(min_width=1, min_height=1)
self.addToWindowStack( self.progressWindow, self.windowStack[len(self.windowStack)-1] )
self.maxWindow = gtk.Window()
@@ -474,6 +475,7 @@ class UI:
self.addToWindowStack( self.maxWindow, self.windowStack[len(self.windowStack)-1] )
self.scrubWindow = ScrubberWindow(self)
+ self.scrubWindow.set_geometry_hints(min_width=1, min_height=1)
self.addToWindowStack( self.scrubWindow, self.windowStack[len(self.windowStack)-1] )
self.infWindow = gtk.Window()
@@ -525,6 +527,71 @@ class UI:
else:
self.ca.stopPipes()
+ def resizeWindows( self ):
+ if self.ca.m.MODE == Constants.MODE_PHOTO:
+ if self.LIVEMODE:
+ self.progressWindow.resize( 1, 1 )
+ self.pipBgdWindow.resize( 1, 1 )
+ self.playOggWindow.resize( 1, 1 )
+ self.livePhotoWindow.resize( 1, 1 )
+ self.slowLiveVideoWindow.resize( 1, 1 )
+ self.infWindow.resize( 1, 1 )
+ eyeDim = self.getEyeDim(self.FULLSCREEN)
+ self.recordWindow.resize( eyeDim[0], eyeDim[1] )
+ self.recordWindow.shutterBox.set_size_request(
+ self.controlBarHt, self.controlBarHt )
+ else :
+ pgdDim = self.getPgdDim( self.FULLSCREEN )
+ self.pipBgdWindow.resize( pgdDim[0], pgdDim[1] )
+ self.progressWindow.progBar.set_size_request( 1, 1 )
+ self.progressWindow.eb.set_visible_window( False )
+ self.progressWindow.resize( 1, 1 )
+ self.moveWinOffscreen(self.progressWindow)
+ self.playOggWindow.resize( 1, 1 )
+ self.recordWindow.resize( 1, 1 )
+ self.scrubWindow.resize( 1, 1 )
+ elif self.ca.m.MODE == Constants.MODE_VIDEO:
+ if self.LIVEMODE:
+ self.pipBgdWindow.resize( 1, 1 )
+ self.playOggWindow.resize( 1, 1 )
+ self.livePhotoWindow.resize( 1, 1 )
+ self.slowLiveVideoWindow.resize( 1, 1 )
+ self.infWindow.resize( 1, 1 )
+ prgDim = self.getPrgDim( self.FULLSCREEN )
+ prgLoc = self.getPrgLoc( self.FULLSCREEN )
+ self.progressWindow.resize( prgDim[0], prgDim[1] )
+ self.progressWindow.move( prgLoc[0], prgLoc[1] )
+ self.progressWindow.eb.set_visible_window(True)
+ else :
+ pgdDim = self.getPgdDim( self.FULLSCREEN )
+ self.pipBgdWindow.resize( pgdDim[0], pgdDim[1] )
+ self.progressWindow.progBar.set_size_request( 1, 1 )
+ self.progressWindow.eb.set_visible_window( False )
+ self.progressWindow.resize( 1, 1 )
+ self.moveWinOffscreen(self.progressWindow)
+ self.recordWindow.resize( 1, 1 )
+ self.liveVideoWindow.resize( 1, 1 )
+ elif self.ca.m.MODE == Constants.MODE_AUDIO:
+ if self.LIVEMODE:
+ self.pipBgdWindow.resize( 1, 1 )
+ self.playOggWindow.resize( 1, 1 )
+ self.livePhotoWindow.resize( 1, 1 )
+ self.slowLiveVideoWindow.resize( 1, 1 )
+ self.infWindow.resize( 1, 1 )
+ self.maxWindow.resize( 1, 1 )
+ prgDim = self.getPrgDim( self.FULLSCREEN )
+ prgLoc = self.getPrgLoc( self.FULLSCREEN )
+ self.progressWindow.resize( prgDim[0], prgDim[1] )
+ self.progressWindow.move( prgLoc[0], prgLoc[1] )
+ self.progressWindow.eb.set_visible_window(True)
+ else:
+ pgdDim = self.getPgdDim( self.FULLSCREEN )
+ self.pipBgdWindow.resize( pgdDim[0], pgdDim[1] )
+ self.progressWindow.progBar.set_size_request( 1, 1 )
+ self.progressWindow.eb.set_visible_window( False )
+ self.progressWindow.resize( 1, 1 )
+ self.moveWinOffscreen(self.progressWindow)
+ self.recordWindow.resize( 1, 1 )
def setUpWindowsSizes( self ):
pipDim = self.getPipDim(False)
@@ -637,18 +704,6 @@ class UI:
self.hideWidgetsTimer = time.time()
passedTime = 0
- if (passedTime >= 3):
- if (not self.hiddenWidgets):
- if (self.mouseInWidget(x,y)):
- self.hideWidgetsTimer = time.time()
- elif (self.RECD_INFO_ON):
- self.hideWidgetsTimer = time.time()
- elif (self.UPDATE_TIMER_ID != 0):
- self.hideWidgetsTimer = time.time()
- else:
- self.hideWidgets()
- self.hiddenWidgets = True
-
self.mx = x
self.my = y
return True
@@ -884,6 +939,10 @@ class UI:
kids[i].setButtClickedId(BUTT_CLICKED_ID)
+ def actuallyHideAllWindows( self ):
+ for i in range (0, len(self.windowStack)):
+ self.windowStack[i].hide_all()
+
def hideAllWindows( self ):
for i in range (0, len(self.windowStack)):
self.moveWinOffscreen( self.windowStack[i] )
@@ -1003,6 +1062,7 @@ class UI:
self.doMouseListener( True )
self.showLiveVideoTags()
self.LAST_MODE = -1 #force an update
+
self.updateVideoComponents()
self.resetWidgetFadeTimer()
@@ -1316,6 +1376,7 @@ class UI:
else:
#or, if there is no countdown, it might be because we are recording
self.clickShutter()
+ self.progressWindow.updateProgress( 1, Constants.istrFinishedRecording )
else:
#we're timing down something, but interrupted by user click or the timer completing
@@ -1455,15 +1516,77 @@ class UI:
elif (self.TRANSCODING):
pos.append({"position":"tmr", "window":self.progressWindow} )
- for i in range (0, len(self.windowStack)):
- self.windowStack[i].hide_all()
-
+ self.actuallyHideAllWindows()
self.hideAllWindows()
self.updatePos( pos )
+ self.resizeWindows()
for i in range (0, len(self.windowStack)):
self.windowStack[i].show_all()
+ if self.ca.m.MODE == Constants.MODE_PHOTO:
+ if not self.LIVEMODE:
+ self.progressWindow.vb.hide_all()
+ self.recordWindow.hbox.hide_all()
+ if self.RECD_INFO_ON == True:
+ self.scrubWindow.hide_all()
+ self.maxWindow.hide_all()
+ else:
+ pass
+
+ if self.FULLSCREEN:
+ self.infWindow.hide_all()
+ else:
+ pass
+
+ else :
+ self.infWindow.hide_all()
+ self.progressWindow.hide_all()
+ self.scrubWindow.hide_all()
+ elif self.ca.m.MODE == Constants.MODE_VIDEO:
+ if not self.LIVEMODE:
+ self.progressWindow.vb.hide_all()
+ self.recordWindow.hbox.hide_all()
+ if self.RECD_INFO_ON == True:
+ self.scrubWindow.hide_all()
+ self.maxWindow.hide_all()
+ else:
+ pass
+ if self.FULLSCREEN:
+ self.infWindow.hide_all()
+ else:
+ pass
+ else :
+ self.infWindow.hide_all()
+ self.scrubWindow.hide_all()
+ prgDim = self.getPrgDim( self.FULLSCREEN )
+ prgLoc = self.getPrgLoc( self.FULLSCREEN )
+ self.progressWindow.resize( prgDim[0], prgDim[1] )
+ self.progressWindow.move( prgLoc[0], prgLoc[1] )
+ logging.debug("resizeprgwin %d,%d" % (prgDim[0], prgDim[1]))
+ logging.debug(self.progressWindow.get_size())
+ elif self.ca.m.MODE == Constants.MODE_AUDIO:
+ if not self.LIVEMODE:
+ if self.RECD_INFO_ON == True:
+ self.scrubWindow.hide_all()
+ self.maxWindow.hide_all()
+ else:
+ pass
+ if self.FULLSCREEN:
+ self.infWindow.hide_all()
+ else:
+ pass
+ else:
+ self.infWindow.hide_all()
+ self.scrubWindow.hide_all()
+ prgDim = self.getPrgDim( self.FULLSCREEN )
+ prgLoc = self.getPrgLoc( self.FULLSCREEN )
+ self.progressWindow.resize( prgDim[0], prgDim[1] )
+ self.progressWindow.move( prgLoc[0], prgLoc[1] )
+ logging.debug("resizeprgwin %d,%d" % (prgDim[0], prgDim[1]))
+ logging.debug(self.progressWindow.get_size())
+ self.maxWindow.hide_all()
+
self.LAST_MODE = self.ca.m.MODE
self.LAST_FULLSCREEN = self.FULLSCREEN
self.LAST_LIVE = self.LIVEMODE
@@ -1659,7 +1782,6 @@ class UI:
if (self.RECD_INFO_ON):
self.bottomCenter.add( self.namePanel )
self.bottomCenter.show_all()
-
self.resetWidgetFadeTimer()
@@ -1774,6 +1896,7 @@ class UI:
if ( show ):
self.centerBox.add( self.backgdCanvasBox )
self.centerBox.show_all()
+ logging.debug("recording ended")
else:
self.backgdCanvas.setImage( None )
@@ -1913,22 +2036,22 @@ class ScrubberWindow(gtk.Window):
self.add( self.hbox )
self.button = gtk.Button()
- buttBox = gtk.EventBox()
- buttBox.add(self.button)
- buttBox.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
+ self.buttBox = gtk.EventBox()
+ self.buttBox.add(self.button)
+ self.buttBox.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
self.button.set_image( Constants.recPlayImg )
self.button.set_property('can-default', True)
self.button.set_relief(gtk.RELIEF_NONE)
self.button.set_size_request( self.ui.recordButtWd, self.ui.recordButtWd )
- buttBox.set_size_request( self.ui.recordButtWd, self.ui.recordButtWd )
+ self.buttBox.set_size_request( self.ui.recordButtWd, self.ui.recordButtWd )
#self.button.set_border_width( UI.dim_INSET/2 )
self.button.show()
- buttBox.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
+ self.buttBox.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
self.button.modify_bg( gtk.STATE_ACTIVE, Constants.colorBlack.gColor )
self.button.connect('clicked', self._buttonClickedCb)
- self.hbox.pack_start(buttBox, expand=False)
+ self.hbox.pack_start(self.buttBox, expand=False)
self.adjustment = gtk.Adjustment(0.0, 0.00, 100.0, 0.1, 1.0, 1.0)
self.hscale = gtk.HScale(self.adjustment)
@@ -2175,29 +2298,29 @@ class RecordWindow(gtk.Window):
self.shutterButton.set_image( Constants.recImg )
self.shutterButton.connect("clicked", self.ui._shutterClickCb)
- shutterBox = gtk.EventBox()
- shutterBox.add( self.shutterButton )
- shutterBox.set_size_request( self.ui.controlBarHt, self.ui.controlBarHt )
+ self.shutterBox = gtk.EventBox()
+ self.shutterBox.add( self.shutterButton )
+ self.shutterBox.set_size_request( self.ui.controlBarHt, self.ui.controlBarHt )
- shutterBox.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
+ self.shutterBox.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
self.shutterButton.modify_bg( gtk.STATE_ACTIVE, Constants.colorBlack.gColor )
- hbox = gtk.HBox()
- self.add( hbox )
+ self.hbox = gtk.HBox()
+ self.add( self.hbox )
leftPanel = gtk.VBox()
self.leftEvent = gtk.EventBox()
self.leftEvent.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
self.leftEvent.add( leftPanel )
self.leftEvent.set_size_request(self.ui.vw/2-self.ui.controlBarHt, -1)
- hbox.pack_start( self.leftEvent, expand=True )
+ self.hbox.pack_start( self.leftEvent, expand=True )
- hbox.pack_start( shutterBox, expand=False )
+ self.hbox.pack_start( self.shutterBox, expand=False )
rightPanel = gtk.VBox()
self.rightEvent = gtk.EventBox()
self.rightEvent.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
self.rightEvent.add( rightPanel )
- hbox.pack_start( self.rightEvent, expand=True )
+ self.hbox.pack_start( self.rightEvent, expand=True )
self.rightPanelLabel = gtk.Label()
rightPanel.pack_start( self.rightPanelLabel )
@@ -2249,14 +2372,14 @@ class ProgressWindow(gtk.Window):
self.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
self.modify_bg( gtk.STATE_INSENSITIVE, Constants.colorBlack.gColor )
- eb = gtk.EventBox()
- eb.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
- eb.modify_bg( gtk.STATE_INSENSITIVE, Constants.colorBlack.gColor )
- self.add( eb )
+ self.eb = gtk.EventBox()
+ self.eb.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
+ self.eb.modify_bg( gtk.STATE_INSENSITIVE, Constants.colorBlack.gColor )
+ self.add( self.eb )
- vb = gtk.VBox()
- vb.set_border_width(5) #todo: use variable
- eb.add(vb)
+ self.vb = gtk.VBox()
+ self.vb.set_border_width(5) #todo: use variable
+ self.eb.add(self.vb)
self.progBar = gtk.ProgressBar()
self.progBar.modify_bg( gtk.STATE_NORMAL, Constants.colorBlack.gColor )
@@ -2264,10 +2387,11 @@ class ProgressWindow(gtk.Window):
self.progBar.modify_bg( gtk.STATE_PRELIGHT, Constants.colorBlack.gColor )
self.progBar.modify_bg( gtk.STATE_SELECTED, Constants.colorBlack.gColor )
self.progBar.modify_bg( gtk.STATE_INSENSITIVE, Constants.colorBlack.gColor )
- vb.add( self.progBar )
+ self.vb.pack_start( self.progBar, True, True, 0 )
+ #self.vb.add( self.progBar )
hbox = gtk.HBox()
- vb.add( hbox )
+ self.vb.pack_start( hbox, True, True, 0 )
self.infoLabel = gtk.Label()
self.infoLabel.set_alignment( 1, .5 )
self.infoLabel.set_text( "<b><span foreground='black'>SPACE</span></b>")
--
1.6.3.3
More information about the Sugar-devel
mailing list