This implements the lightbox by using a GtkOverlay as the child of GtkWindow and overlaying a transparent GdkPixbuf as needed. This works in both compositing and non-compositing modes. --- pyanaconda/ui/gui/__init__.py | 89 ++++++++++++++++++++++-------- pyanaconda/ui/gui/spokes/custom.py | 24 ++++---- pyanaconda/ui/gui/spokes/datetime_spoke.py | 4 +- pyanaconda/ui/gui/spokes/filter.py | 7 +-- pyanaconda/ui/gui/spokes/keyboard.py | 8 +-- pyanaconda/ui/gui/spokes/network.py | 4 +- pyanaconda/ui/gui/spokes/software.py | 4 +- pyanaconda/ui/gui/spokes/source.py | 10 ++-- pyanaconda/ui/gui/spokes/storage.py | 8 +-- pyanaconda/ui/gui/spokes/user.py | 3 +- pyanaconda/ui/gui/spokes/welcome.py | 6 +- pyanaconda/ui/gui/utils.py | 15 +---- 12 files changed, 105 insertions(+), 77 deletions(-)
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py index 0640418..7055414 100644 --- a/pyanaconda/ui/gui/__init__.py +++ b/pyanaconda/ui/gui/__init__.py @@ -21,13 +21,15 @@ import inspect, os, sys, time, site import meh.ui.gui
-from gi.repository import Gdk, Gtk, AnacondaWidgets, Keybinder +from contextlib import contextmanager + +from gi.repository import Gdk, Gtk, AnacondaWidgets, Keybinder, GdkPixbuf
from pyanaconda.i18n import _ from pyanaconda import product
from pyanaconda.ui import UserInterface, common -from pyanaconda.ui.gui.utils import enlightbox, gtk_action_wait, busyCursor, unbusyCursor +from pyanaconda.ui.gui.utils import gtk_action_wait, busyCursor, unbusyCursor import os.path
import logging @@ -249,6 +251,15 @@ class MainWindow(Gtk.Window): # Treat an attempt to close the window the same as hitting quit self.connect("delete-event", self._on_delete_event)
+ # Create a black, 50% opacity pixel that will be scaled to fit the lightbox overlay + self._transparent_base = AnacondaWidgets.make_pixbuf([0, 0, 0, 127], True, 1, 1, 1) + + # Contain everything in an overlay so the window can be overlayed with the transparency + # for the lightbox effect + self._overlay = Gtk.Overlay() + self._overlay_img = None + self._overlay.connect("get-child-position", self._on_overlay_get_child_position) + # Create a stack and a list of what's been added to the stack self._stack = Gtk.Stack() self._stack_contents = set() @@ -260,7 +271,9 @@ class MainWindow(Gtk.Window): # Set properties on the window self.set_decorated(False) self.maximize() - self.add(self._stack) + + self._overlay.add(self._stack) + self.add(self._overlay) self.show_all()
self._current_action = None @@ -274,6 +287,21 @@ class MainWindow(Gtk.Window): # Stop the window from being closed here return True
+ def _on_overlay_get_child_position(self, overlay_container, overlayed_widget, allocation, user_data=None): + overlay_allocation = overlay_container.get_allocation() + + # Scale the overlayed image's pixbuf to the size of the GtkOverlay + overlayed_widget.set_from_pixbuf(self._transparent_base.scale_simple( + overlay_allocation.width, overlay_allocation.height, GdkPixbuf.InterpType.NEAREST)) + + # Set the allocation for the overlayed image to the full size of the GtkOverlay + allocation.x = 0 + allocation.y = 0 + allocation.width = overlay_allocation.width + allocation.height = overlay_allocation.height + + return True + @property def current_action(self): return self._current_action @@ -326,6 +354,34 @@ class MainWindow(Gtk.Window): """Exit a spoke and return to a hub.""" self._setVisibleChild(self._current_action)
+ def lightbox_on(self): + # Add an overlay image that will be filled and scaled in get-child-position + self._overlay_img = Gtk.Image() + self._overlay_img.show_all() + self._overlay.add_overlay(self._overlay_img) + + def lightbox_off(self): + # Remove the overlay image + self._overlay_img.destroy() + self._overlay_img = None + + @contextmanager + def enlightbox(self, dialog): + """Display a dialog in a lightbox over the main window. + + :param GtkDialog: the dialog to display + """ + self.lightbox_on() + + # Set the dialog as transient for ourself + ANACONDA_WINDOW_GROUP.add_window(dialog) + dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS) + dialog.set_transient_for(self) + + yield + + self.lightbox_off() + class GraphicalUserInterface(UserInterface): """This is the standard GTK+ interface we try to steer everything to using. It is suitable for use both directly and via VNC. @@ -348,7 +404,7 @@ class GraphicalUserInterface(UserInterface): self._isFinal = isFinal self._quitDialog = quitDialog self._mehInterface = GraphicalExceptionHandlingIface( - self.lightbox_over_current_action) + self.mainWindow.lightbox_on)
ANACONDA_WINDOW_GROUP.add_window(self.mainWindow)
@@ -434,19 +490,6 @@ class GraphicalUserInterface(UserInterface): # Second, order them according to their relationship return self._orderActionClasses(standalones, hubs)
- def lightbox_over_current_action(self, window): - """ - Creates lightbox over current action for the given window. Or - DOES NOTHING IF THERE ARE NO ACTIONS. - - """ - - # if there are no actions (not populated yet), we can do nothing - if len(self._actions) > 0 and self._currentAction: - lightbox = AnacondaWidgets.Lightbox(parent_window=self.mainWindow) - ANACONDA_WINDOW_GROUP.add_window(lightbox) - window.main_window.set_transient_for(lightbox) - def _instantiateAction(self, actionClass): # Instantiate an action on-demand, passing the arguments defining our # spoke API and setting up continue/quit signal handlers. @@ -531,7 +574,7 @@ class GraphicalUserInterface(UserInterface): def showError(self, message): dlg = ErrorDialog(None)
- with enlightbox(self._currentAction.window, dlg.window): + with self.mainWindow.enlightbox(dlg.window): dlg.refresh(message) dlg.run() dlg.window.destroy() @@ -542,7 +585,7 @@ class GraphicalUserInterface(UserInterface): dlg = DetailedErrorDialog(None, buttons=[_("_Quit")], label=message)
- with enlightbox(self._currentAction.window, dlg.window): + with self.mainWindow.enlightbox(dlg.window): dlg.refresh(details) rc = dlg.run() dlg.window.destroy() @@ -557,7 +600,7 @@ class GraphicalUserInterface(UserInterface): dlg.add_buttons(_("_No"), 0, _("_Yes"), 1) dlg.set_default_response(1)
- with enlightbox(self._currentAction.window, dlg): + with self.mainWindow.enlightbox(dlg): rc = dlg.run() dlg.destroy()
@@ -632,7 +675,7 @@ class GraphicalUserInterface(UserInterface): return
dialog = self._quitDialog(None) - with enlightbox(self._currentAction.window, dialog.window): + with self.mainWindow.enlightbox(dialog.window): rc = dialog.run() dialog.window.destroy()
@@ -651,7 +694,7 @@ class GraphicalExceptionHandlingIface(meh.ui.gui.GraphicalIntf): """ :param lightbox_func: a function that creates lightbox for a given window - :type lightbox_func: GtkWindow -> None + :type lightbox_func: None -> None
""" meh.ui.gui.GraphicalIntf.__init__(self) @@ -663,7 +706,7 @@ class GraphicalExceptionHandlingIface(meh.ui.gui.GraphicalIntf): exc_window = meh_intf.mainExceptionWindow(text, exn_file) exc_window.main_window.set_decorated(False)
- self._lightbox_func(exc_window) + self._lightbox_func()
ANACONDA_WINDOW_GROUP.add_window(exc_window.main_window)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 5c91069..f555d85 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -82,7 +82,7 @@ from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import selectedRaidLeve from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import get_container_type_name, RAID_NOT_ENOUGH_DISKS from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import AddDialog, ConfirmDeleteDialog, DisksDialog, ContainerDialog, HelpDialog
-from pyanaconda.ui.gui.utils import setViewportBackground, enlightbox, fancy_set_sensitive, ignoreEscape +from pyanaconda.ui.gui.utils import setViewportBackground, fancy_set_sensitive, ignoreEscape from pyanaconda.ui.gui.utils import really_hide, really_show, GtkActionList, timed_action from pyanaconda.ui.categories.system import SystemCategory
@@ -1507,7 +1507,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): if d.format.type == "luks" and not d.format.exists] if new_luks: dialog = PassphraseDialog(self.data) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): rc = dialog.run()
if rc != 1: @@ -1526,7 +1526,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): if len(self._storage_playground.devicetree.findActions()) > 0: dialog = ActionSummaryDialog(self.data) dialog.refresh(self._storage_playground.devicetree.findActions()) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): rc = dialog.run()
if rc != 1: @@ -1604,7 +1604,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): dialog = AddDialog(self.data, mountpoints=self._storage_playground.mountpoints.keys()) dialog.refresh() - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): rc = dialog.run()
if rc != 1: @@ -1811,7 +1811,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): snapshots = (device.direct and not device.isleaf) dialog.refresh(getattr(device.format, "mountpoint", ""), device.name, root_name, snapshots=snapshots) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): rc = dialog.run()
if rc != 1: @@ -1836,12 +1836,12 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): dialog = SelectedDisksDialog(self.data) dialog.refresh(self._clearpartDevices, self._currentFreeInfo, showRemove=False, setBoot=False) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): dialog.run()
def on_help_clicked(self, button): help_window = HelpDialog(self.data) - with enlightbox(self.window, help_window.window): + with self.main_window.enlightbox(help_window.window): help_window.run()
def on_configure_clicked(self, button): @@ -1863,7 +1863,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): disks=self._clearpartDevices, free=self._currentFreeInfo, selected=self._device_disks) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): rc = dialog.run()
if rc != 1: @@ -1918,7 +1918,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): storage=self._storage_playground, exists=getattr(container, "exists", False))
- with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): rc = dialog.run() dialog.window.destroy()
@@ -2435,7 +2435,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): dlg.add_buttons(_("_Reset selections"), 0, _("_Preserve current selections"), 1) dlg.set_default_response(1)
- with enlightbox(self.window, dlg): + with self.main_window.enlightbox(dlg): rc = dlg.run() dlg.destroy()
@@ -2447,7 +2447,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): def on_refresh_clicked(self, *args): dialog = RefreshDialog(self.data, self.storage) ignoreEscape(dialog.window) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): rc = dialog.run() dialog.window.destroy()
@@ -2480,7 +2480,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): message_format=str(self._error)) dlg.set_decorated(False)
- with enlightbox(self.window, dlg): + with self.main_window.enlightbox(dlg): dlg.run() dlg.destroy()
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py index 68696c5..5504f95 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.py +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py @@ -29,7 +29,7 @@ from pyanaconda.ui.common import FirstbootSpokeMixIn from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.categories.localization import LocalizationCategory -from pyanaconda.ui.gui.utils import enlightbox, gtk_action_nowait, gtk_call_once +from pyanaconda.ui.gui.utils import gtk_action_nowait, gtk_call_once from pyanaconda.ui.gui.helpers import GUIDialogInputCheckHandler from pyanaconda.ui.helpers import InputCheck
@@ -1055,7 +1055,7 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke): def on_ntp_config_clicked(self, *args): self._config_dialog.refresh()
- with enlightbox(self.window, self._config_dialog.window): + with self.main_window.enlightbox(self._config_dialog.window): response = self._config_dialog.run()
if response == 1: diff --git a/pyanaconda/ui/gui/spokes/filter.py b/pyanaconda/ui/gui/spokes/filter.py index c342972..6405781 100644 --- a/pyanaconda/ui/gui/spokes/filter.py +++ b/pyanaconda/ui/gui/spokes/filter.py @@ -30,7 +30,6 @@ from pyanaconda.flags import flags from pyanaconda.i18n import CN_, CP_
from pyanaconda.ui.lib.disks import getDisks, isLocalDisk -from pyanaconda.ui.gui.utils import enlightbox from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.gui.spokes.advstorage.fcoe import FCoEDialog from pyanaconda.ui.gui.spokes.advstorage.iscsi import ISCSIDialog @@ -511,7 +510,7 @@ class FilterSpoke(NormalSpoke): disks = [disk for disk in self.disks if disk.name in self.selected_disks] free_space = self.storage.getFreeSpace(disks=disks)
- with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): dialog.refresh(disks, free_space, showRemove=False, setBoot=False) dialog.run()
@@ -550,7 +549,7 @@ class FilterSpoke(NormalSpoke): def on_add_iscsi_clicked(self, widget, *args): dialog = ISCSIDialog(self.data, self.storage)
- with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): dialog.refresh() dialog.run()
@@ -561,7 +560,7 @@ class FilterSpoke(NormalSpoke): def on_add_fcoe_clicked(self, widget, *args): dialog = FCoEDialog(self.data, self.storage)
- with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): dialog.refresh() dialog.run()
diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py index c001e38..f76fa84 100644 --- a/pyanaconda/ui/gui/spokes/keyboard.py +++ b/pyanaconda/ui/gui/spokes/keyboard.py @@ -25,7 +25,7 @@ from gi.repository import Gkbd, Gdk, Gtk from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.categories.localization import LocalizationCategory -from pyanaconda.ui.gui.utils import enlightbox, gtk_call_once, escape_markup, gtk_batch_map, timed_action +from pyanaconda.ui.gui.utils import gtk_call_once, escape_markup, gtk_batch_map, timed_action from pyanaconda import keyboard from pyanaconda import flags from pyanaconda.i18n import _, N_, CN_ @@ -424,7 +424,7 @@ class KeyboardSpoke(NormalSpoke): def on_add_clicked(self, button): self._add_dialog.refresh()
- with enlightbox(self.window, self._add_dialog.window): + with self.main_window.enlightbox(self._add_dialog.window): response = self._add_dialog.run()
if response == 1: @@ -541,7 +541,7 @@ class KeyboardSpoke(NormalSpoke): lay_var_spec) dialog.set_size_request(750, 350) dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS) - with enlightbox(self.window, dialog): + with self.main_window.enlightbox(dialog): dialog.show_all() dialog.run()
@@ -581,7 +581,7 @@ class KeyboardSpoke(NormalSpoke): def on_options_clicked(self, *args): self._switching_dialog.refresh()
- with enlightbox(self.window, self._switching_dialog.window): + with self.main_window.enlightbox(self._switching_dialog.window): response = self._switching_dialog.run()
if response != 1: diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index 73390e1..461377d 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -39,7 +39,7 @@ from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.spokes import NormalSpoke, StandaloneSpoke from pyanaconda.ui.categories.system import SystemCategory from pyanaconda.ui.gui.hubs.summary import SummaryHub -from pyanaconda.ui.gui.utils import gtk_call_once, enlightbox, escape_markup +from pyanaconda.ui.gui.utils import gtk_call_once, escape_markup from pyanaconda.ui.common import FirstbootSpokeMixIn
from pyanaconda import network @@ -1204,7 +1204,7 @@ class SecretAgent(dbus.service.Object):
content = self._get_content(setting_name, connection_hash) dialog = SecretAgentDialog(self.spoke.data, content=content) - with enlightbox(self.spoke.window, dialog.window): + with self.spoke.main_window.enlightbox(dialog.window): rc = dialog.run()
secrets = dbus.Dictionary() diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py index c585d67..f68dfd6 100644 --- a/pyanaconda/ui/gui/spokes/software.py +++ b/pyanaconda/ui/gui/spokes/software.py @@ -30,7 +30,7 @@ from pyanaconda import constants from pyanaconda.ui.communication import hubQ from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.gui.spokes.lib.detailederror import DetailedErrorDialog -from pyanaconda.ui.gui.utils import enlightbox, gtk_action_wait, escape_markup +from pyanaconda.ui.gui.utils import gtk_action_wait, escape_markup from pyanaconda.ui.categories.software import SoftwareCategory
import logging @@ -473,7 +473,7 @@ class SoftwareSelectionSpoke(NormalSpoke): C_("GUI|Software Selection|Error Dialog", "_Modify Software Source"), C_("GUI|Software Selection|Error Dialog", "Modify _Selections")], label=label) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): dialog.refresh(self._errorMsgs) rc = dialog.run()
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py index 17fcec8..2040ea6 100644 --- a/pyanaconda/ui/gui/spokes/source.py +++ b/pyanaconda/ui/gui/spokes/source.py @@ -38,7 +38,7 @@ from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.helpers import GUIDialogInputCheckHandler, GUISpokeInputCheckHandler from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.categories.software import SoftwareCategory -from pyanaconda.ui.gui.utils import enlightbox, fire_gtk_action +from pyanaconda.ui.gui.utils import fire_gtk_action from pyanaconda.iutil import ProxyString, ProxyStringError, cmp_obj_attrs from pyanaconda.ui.gui.utils import gtk_call_once, really_hide, really_show, fancy_set_sensitive from pyanaconda.threads import threadMgr, AnacondaThread @@ -1040,7 +1040,7 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler): else: dialog.refresh()
- with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): f = dialog.run(self._get_selected_partition())
if f and f.endswith(".iso"): @@ -1051,7 +1051,7 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler):
def on_proxy_clicked(self, button): dialog = ProxyDialog(self.data, self._proxyUrl) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): dialog.refresh() dialog.run()
@@ -1067,7 +1067,7 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler): return
dialog = MediaCheckDialog(self.data) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): unmount = not p.format.status mounts = get_mount_paths(p.path) # We have to check both ISO_DIR and the DRACUT_ISODIR because we @@ -1085,7 +1085,7 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler): return
dialog = MediaCheckDialog(self.data) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): dialog.run("/dev/" + self._cdrom.name)
def on_protocol_changed(self, combo): diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py index f531cc6..bc391c6 100644 --- a/pyanaconda/ui/gui/spokes/storage.py +++ b/pyanaconda/ui/gui/spokes/storage.py @@ -51,7 +51,7 @@ from pyanaconda.ui.gui.spokes.lib.detailederror import DetailedErrorDialog from pyanaconda.ui.gui.spokes.lib.resize import ResizeDialog from pyanaconda.ui.gui.spokes.lib.dasdfmt import DasdFormatDialog from pyanaconda.ui.categories.system import SystemCategory -from pyanaconda.ui.gui.utils import enlightbox, escape_markup, gtk_action_nowait, ignoreEscape +from pyanaconda.ui.gui.utils import escape_markup, gtk_action_nowait, ignoreEscape from pyanaconda.ui.helpers import StorageChecker
from pyanaconda.kickstart import doKickstartStorage, getAvailableDiskSpace @@ -681,7 +681,7 @@ class StorageSpoke(NormalSpoke, StorageChecker): self.clear_info()
def run_lightbox_dialog(self, dialog): - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): rc = dialog.run()
return rc @@ -908,7 +908,7 @@ class StorageSpoke(NormalSpoke, StorageChecker): C_("GUI|Storage|Error Dialog", "_Quit"), C_("GUI|Storage|Error Dialog", "_Modify Storage Layout")], label=label) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): errors = "\n".join(self.errors) dialog.refresh(errors) rc = dialog.run() @@ -924,7 +924,7 @@ class StorageSpoke(NormalSpoke, StorageChecker): "changes to your storage layout.")
dialog = DetailedErrorDialog(self.data, buttons=[_("_OK")], label=label) - with enlightbox(self.window, dialog.window): + with self.main_window.enlightbox(dialog.window): warnings = "\n".join(self.warnings) dialog.refresh(warnings) rc = dialog.run() diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py index 6fb6e8c..6fc8b1c 100644 --- a/pyanaconda/ui/gui/spokes/user.py +++ b/pyanaconda/ui/gui/spokes/user.py @@ -30,7 +30,6 @@ from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.categories.user_settings import UserSettingsCategory from pyanaconda.ui.common import FirstbootSpokeMixIn -from pyanaconda.ui.gui.utils import enlightbox from pyanaconda.ui.helpers import InputCheck from pyanaconda.ui.gui.helpers import GUISpokeInputCheckHandler, GUIDialogInputCheckHandler
@@ -598,7 +597,7 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler): self._user.groups.remove(self._wheel.name)
self._advanced.refresh() - with enlightbox(self.window, self._advanced.window): + with self.main_window.enlightbox(self._advanced.window): self._advanced.run()
self.admin.set_active(self._wheel.name in self._user.groups) diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py index 5c0ff83..cab1472 100644 --- a/pyanaconda/ui/gui/spokes/welcome.py +++ b/pyanaconda/ui/gui/spokes/welcome.py @@ -26,7 +26,7 @@ import langtable
from pyanaconda.ui.gui.hubs.summary import SummaryHub from pyanaconda.ui.gui.spokes import StandaloneSpoke -from pyanaconda.ui.gui.utils import enlightbox, setup_gtk_direction, escape_markup +from pyanaconda.ui.gui.utils import setup_gtk_direction, escape_markup from pyanaconda.ui.gui.spokes.lib.lang_locale_handler import LangLocaleHandler
from pyanaconda import localization @@ -309,7 +309,7 @@ class WelcomeLanguageSpoke(LangLocaleHandler, StandaloneSpoke): # Don't display the betanag dialog if this is the final release. if not isFinal: dlg = self.builder.get_object("betaWarnDialog") - with enlightbox(self.window, dlg): + with self.main_window.enlightbox(dlg): rc = dlg.run() dlg.destroy() if rc != 1: @@ -318,7 +318,7 @@ class WelcomeLanguageSpoke(LangLocaleHandler, StandaloneSpoke): if productName.startswith("Red Hat ") and \ is_unsupported_hw() and not self.data.unsupportedhardware.unsupported_hardware: dlg = self.builder.get_object("unsupportedHardwareDialog") - with enlightbox(self.window, dlg): + with self.main_window.enlightbox(dlg): rc = dlg.run() dlg.destroy() if rc != 1: diff --git a/pyanaconda/ui/gui/utils.py b/pyanaconda/ui/gui/utils.py index 51bcc0d..027cf12 100644 --- a/pyanaconda/ui/gui/utils.py +++ b/pyanaconda/ui/gui/utils.py @@ -24,8 +24,7 @@ from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.constants import NOTICEABLE_FREEZE -from contextlib import contextmanager -from gi.repository import Gdk, Gtk, GLib, AnacondaWidgets +from gi.repository import Gdk, Gtk, GLib import Queue import time import threading @@ -297,18 +296,6 @@ def unbusyCursor(): window = Gdk.get_default_root_window() window.set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
-@contextmanager -def enlightbox(mainWindow, dialog): - # importing globally would cause a circular dependency - from pyanaconda.ui.gui import ANACONDA_WINDOW_GROUP - - lightbox = AnacondaWidgets.Lightbox(parent_window=mainWindow.get_toplevel()) - ANACONDA_WINDOW_GROUP.add_window(lightbox) - dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS) - dialog.set_transient_for(lightbox) - yield - lightbox.destroy() - def ignoreEscape(dlg): """Prevent a dialog from accepting the escape keybinding, which emits a close signal and will cause the dialog to close with some return value