[PATCH 1/3 v2] Maximize anaconda instead of running fullscreen (#1164457)

Vratislav Podzimek vpodzime at redhat.com
Thu Jan 15 07:14:11 UTC 2015


On Wed, 2015-01-14 at 13:10 -0500, David Shea wrote:
> A fullscreen anaconda is inconvenient when running outside of the
> regular installer media, since on Live installs some things are only
> configurable in the desktop environment, and on dir and image installs
> you might have other things to do while anaconda is running. Instead,
> maximize anaconda and use the hide-titlebar-when-maximized property to
> hide the titlebar on window managers that support it, which is really
> just GNOME.
> 
> Add an option to GraphicalUserInterface to start with a fullscreen
> anaconda for downstream users of the GUI that would prefer that
> behavior.
> ---
>  pyanaconda/anaconda.py        |  5 ++++-
>  pyanaconda/ui/gui/__init__.py | 38 +++++++++++++++++---------------------
>  2 files changed, 21 insertions(+), 22 deletions(-)
> 
> diff --git a/pyanaconda/anaconda.py b/pyanaconda/anaconda.py
> index 57116bb..7592650 100644
> --- a/pyanaconda/anaconda.py
> +++ b/pyanaconda/anaconda.py
> @@ -211,8 +211,11 @@ class Anaconda(object):
>  
>          if self.displayMode == 'g':
>              from pyanaconda.ui.gui import GraphicalUserInterface
> +            # Run the GUI in non-fullscreen mode, so live installs can still
> +            # use the window manager
>              self._intf = GraphicalUserInterface(self.storage, self.payload,
> -                                                self.instClass, gui_lock=self.gui_initialized)
> +                                                self.instClass, gui_lock=self.gui_initialized,
> +                                                fullscreen=False)
>  
>              # needs to be refreshed now we know if gui or tui will take place
>              addon_paths = addons.collect_addon_paths(constants.ADDON_PATHS,
> diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
> index bd6941d..a6a6610 100644
> --- a/pyanaconda/ui/gui/__init__.py
> +++ b/pyanaconda/ui/gui/__init__.py
> @@ -268,9 +268,18 @@ class ErrorDialog(GUIObject):
>  class MainWindow(Gtk.Window):
>      """This is a top-level, full size window containing the Anaconda screens."""
>  
> -    def __init__(self):
> +    def __init__(self, fullscreen):
> +        """Create a new anaconda main window.
> +
> +          :param bool fullscreen: if True, fullscreen the window, if false maximize
> +        """
>          Gtk.Window.__init__(self)
>  
> +        # Hide the titlebar when maximized if the window manager allows it.
> +        # This makes anaconda look full-screenish but without covering parts
> +        # needed to interact with the window manager, like the GNOME top bar.
> +        self.set_hide_titlebar_when_maximized(True)
> +
>          # Treat an attempt to close the window the same as hitting quit
>          self.connect("delete-event", self._on_delete_event)
>  
> @@ -300,12 +309,11 @@ class MainWindow(Gtk.Window):
>          self._accel_group = Gtk.AccelGroup()
>          self.add_accel_group(self._accel_group)
>  
> -        # Connect to window-state-event changes to catch when the user
> -        # maxmizes/unmaximizes the window.
> -        self.connect("window-state-event", self._on_window_state_event)
> -
> -        # Start the window as full screen
> -        self.fullscreen()
> +        # Make the window big
> +        if fullscreen:
> +            self.fullscreen()
> +        else:
> +            self.maximize()
>  
>          self._overlay.add(self._stack)
>          self.add(self._overlay)
> @@ -313,18 +321,6 @@ class MainWindow(Gtk.Window):
>  
>          self._current_action = None
>  
> -    def _on_window_state_event(self, window, event, user_data=None):
> -        # If the window is being maximized, fullscreen it instead
> -        if (Gdk.WindowState.MAXIMIZED & event.changed_mask) and \
> -                (Gdk.WindowState.MAXIMIZED & event.new_window_state):
> -            self.fullscreen()
> -
> -            # Return true to stop the signal handler since we're changing
> -            # state mid-stream here
> -            return True
> -
> -        return False
> -
>      def _on_delete_event(self, widget, event, user_data=None):
>          # Use the quit-clicked signal on the the current standalone, even if the
>          # standalone is not currently displayed.
> @@ -456,7 +452,7 @@ class GraphicalUserInterface(UserInterface):
>      """
>      def __init__(self, storage, payload, instclass,
>                   distributionText = product.distributionText, isFinal = product.isFinal,
> -                 quitDialog = QuitDialog, gui_lock = None):
> +                 quitDialog = QuitDialog, gui_lock = None, fullscreen=False):
>  
>          UserInterface.__init__(self, storage, payload, instclass)
>  
> @@ -467,7 +463,7 @@ class GraphicalUserInterface(UserInterface):
>  
>          self.data = None
>  
> -        self.mainWindow = MainWindow()
> +        self.mainWindow = MainWindow(fullscreen=fullscreen)
>  
>          self._distributionText = distributionText
>          self._isFinal = isFinal
Looks good to me.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list