[pitivi: 22/94] Prevent the main window to go fullscreen when we show the startup wizard because the startup wizard



commit 8a67d925325545da7f9923ebe0d18d2bdd22afd0
Author: Alex BÄluÈ <alexandru balut gmail com>
Date:   Fri Aug 26 10:06:02 2011 +0200

    Prevent the main window to go fullscreen when we show the startup wizard because the startup wizard will be modal and hidden in the back of the main window

 pitivi/application.py   |    9 ++++++---
 pitivi/ui/mainwindow.py |   19 +++++++++----------
 2 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 4f40e7c..fc5d18b 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -301,8 +301,8 @@ class FullGuiPitivi(GuiPitivi):
     but not when we start with the welcome dialog.
     """
 
-    def _createGui(self):
-        return PitiviMainWindow(self)
+    def _createGui(self, **kargs):
+        return PitiviMainWindow(self, **kargs)
 
 
 class ProjectCreatorGuiPitivi(FullGuiPitivi):
@@ -373,7 +373,10 @@ class StartupWizardGuiPitivi(FullGuiPitivi):
 
     def _createGui(self):
         self.wizard = StartUpWizard(self)
-        return FullGuiPitivi._createGui(self)
+        # Prevent the main window to go fullscreen because at least
+        # the Metacity window manager will refuse to bring
+        # the startup wizard window in front of the main window.
+        return FullGuiPitivi._createGui(self, allow_full_screen=False)
 
     def _showGui(self):
         FullGuiPitivi._showGui(self)
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 1d1888f..3d38803 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -168,7 +168,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
     @cvar project: The current project
     @type project: L{Project}
     """
-    def __init__(self, instance):
+    def __init__(self, instance, allow_full_screen=True):
         """ initialize with the Pitivi object """
         gtk.Window.__init__(self)
         Loggable.__init__(self)
@@ -182,7 +182,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
         self.prefsdialog = None
         create_stock_icons()
         self._setActions(instance)
-        self._createUi(instance)
+        self._createUi(instance, allow_full_screen)
 
         self.app = instance
         self.manager = RecentManager()
@@ -344,7 +344,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
         self.uimanager.insert_action_group(self.actiongroup, 0)
         self.uimanager.add_ui_from_file(os.path.join(get_ui_dir(), "mainwindow.xml"))
 
-    def _createUi(self, instance):
+    def _createUi(self, instance, allow_full_screen):
         """ Create the graphical interface """
         self.set_title("%s" % (APPNAME))
         self.connect("delete-event", self._deleteCb)
@@ -438,8 +438,8 @@ class PitiviMainWindow(gtk.Window, Loggable):
         self.set_default_size(width, height)
         if height == -1 and width == -1:
             self.maximize()
-        if self.settings.mainWindowFullScreen:
-            self.toggleFullScreen()
+        if allow_full_screen and self.settings.mainWindowFullScreen:
+            self.setFullScreen(True)
         # timeline toolbar
         # FIXME: remove toolbar padding and shadow. In fullscreen mode, the
         # toolbar buttons should be clickable with the mouse cursor at the
@@ -464,14 +464,13 @@ class PitiviMainWindow(gtk.Window, Loggable):
     def _connectToSourceList(self):
         self.sourcelist.connect('play', self._sourceListPlayCb)
 
-    def toggleFullScreen(self):
+    def setFullScreen(self, fullscreen):
         """ Toggle the fullscreen mode of the application """
-        if not self.is_fullscreen:
+        if fullscreen:
             self.fullscreen()
-            self.is_fullscreen = True
         else:
             self.unfullscreen()
-            self.is_fullscreen = False
+        self.is_fullscreen = fullscreen
 
     #TODO check if it is the way to go
     def setActionsSensitive(self, action_names, sensitive):
@@ -573,7 +572,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
         self.app.shutdown()
 
     def _fullScreenCb(self, unused_action):
-        self.toggleFullScreen()
+        self.setFullScreen(not self.is_fullscreen)
 
     def _fullScreenAlternateCb(self, unused_action):
         # Nothing more, nothing less.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]