[pitivi] mainwindow: Show the window only after setting the perspective



commit 873d14db7866e790aafe57fbacd82f59b85848d6
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue Oct 1 00:15:06 2019 +0200

    mainwindow: Show the window only after setting the perspective

 pitivi/application.py | 3 +--
 pitivi/mainwindow.py  | 6 ++++++
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index af73f111..6f2e8507 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -200,9 +200,9 @@ class Pitivi(Gtk.Application, Loggable):
                 self.gui.present()
             # No need to show the welcome wizard.
             return
+
         self.create_main_window()
         self.gui.show_perspective(self.gui.greeter)
-        self.gui.show()
 
     def create_main_window(self):
         if self.gui:
@@ -214,7 +214,6 @@ class Pitivi(Gtk.Application, Loggable):
     def do_open(self, giofiles, unused_count, unused_hint):
         assert giofiles
         self.create_main_window()
-        self.gui.show()
         if len(giofiles) > 1:
             self.warning("Opening only one project at a time. Ignoring the rest!")
         project_file = giofiles[0]
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 62599bbe..aafe08a7 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -17,6 +17,7 @@
 # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 """Pitivi's main window."""
+# pylint: disable=too-many-instance-attributes
 import os
 from gettext import gettext as _
 from urllib.parse import unquote
@@ -162,6 +163,7 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
         self.debug("Screen size is %sx%s", screen_width, screen_height)
         return min_size.width >= 0.9 * screen_width
 
+    # pylint: disable=attribute-defined-outside-init
     def __set_keyboard_shortcuts(self):
         self.app.shortcuts.register_group("win", _("Project"), position=20)
 
@@ -246,6 +248,7 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
         """Displays the specified perspective."""
         if self.__perspective is perspective:
             return
+
         if self.__perspective:
             # Remove the current perspective before adding the
             # specified perspective because we can only add one
@@ -254,5 +257,8 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
         self.log("Displaying perspective: %s", type(perspective).__name__)
         self.__perspective = perspective
         self.set_titlebar(perspective.headerbar)
+        # The window must be shown only after setting the headerbar with
+        # set_titlebar. Otherwise we get a warning things can go wrong.
+        self.show()
         self.add(perspective.toplevel_widget)
         perspective.refresh()


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