[PATCH newui] Keep nm-c-e windows above hub/spoke/lightbox.

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

 



---
 pyanaconda/ui/gui/hubs/__init__.py  |    2 +
 pyanaconda/ui/gui/spokes/network.py |   41 ++++++++++++++++++++++++++++++----
 pyanaconda/ui/gui/spokes/network.ui |    9 +++++++
 3 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py
index 40cc6ef..d18b2b6 100644
--- a/pyanaconda/ui/gui/hubs/__init__.py
+++ b/pyanaconda/ui/gui/hubs/__init__.py
@@ -100,7 +100,9 @@ class Hub(UIObject):
         # signals from going to the underlying (but still displayed) Hub and
         # prevent the user from switching away.  It's up to the spoke's back
         # button handler to kill its own layer of main loop.
+        self.window.hide()
         Gtk.main()
+        self.window.show()
         action.apply()
 
     def _createBox(self):
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index a7eb3b6..9394037 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -38,6 +38,7 @@ from pyanaconda.ui.gui import UIObject
 from pyanaconda.ui.gui.spokes import NormalSpoke, StandaloneSpoke
 from pyanaconda.ui.gui.categories.software import SoftwareCategory
 from pyanaconda.ui.gui.hubs.summary import SummaryHub
+from pyanaconda.ui.gui.utils import enlightbox
 
 from pyanaconda.network import NetworkDevice, netscriptsDir, kickstartNetworkData, getActiveNetDevs
 
@@ -46,7 +47,6 @@ import dbus
 import socket
 import subprocess
 import struct
-import time
 from dbus.mainloop.glib import DBusGMainLoop
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
@@ -224,8 +224,13 @@ class NetworkControlBox():
         NetworkManager.DeviceType.WIFI,
     ]
 
-    def __init__(self, builder):
+    @staticmethod
+    def run_nmce(uuid):
+        subprocess.Popen(["nm-connection-editor", "--edit", "%s" % uuid])
+
+    def __init__(self, builder, configure_callback=run_nmce):
 
+        self.run_config_tool = configure_callback
         self.builder = builder
 
         # these buttons are only for vpn and proxy
@@ -436,7 +441,7 @@ class NetworkControlBox():
             print "DBG: no connection to be edited found"
             return
 
-        subprocess.Popen(["nm-connection-editor", "--edit", "%s" % uuid])
+        self.run_config_tool(uuid)
 
     def on_wireless_enabled(self, *args):
         switch = self.builder.get_object("device_wireless_off_switch")
@@ -927,7 +932,11 @@ class NetworkSpoke(NormalSpoke):
 
     def __init__(self, *args, **kwargs):
         NormalSpoke.__init__(self, *args, **kwargs)
-        self.network_control_box = NetworkControlBox(self.builder)
+        def run_nmce_cb(uuid):
+            embedder = NMCEEmbedder(self.data)
+            embedder.run(self.window, uuid)
+        self.network_control_box = NetworkControlBox(self.builder,
+            configure_callback=run_nmce_cb)
 
     def apply(self):
         self.data.network.network = []
@@ -985,7 +994,11 @@ class NetworkStandaloneSpoke(StandaloneSpoke):
 
     def __init__(self, *args, **kwargs):
         StandaloneSpoke.__init__(self, *args, **kwargs)
-        self.network_control_box = NetworkControlBox(self.builder)
+        def run_nmce_cb(uuid):
+            embedder = NMCEEmbedder(self.data)
+            embedder.run(self.window, uuid)
+        self.network_control_box = NetworkControlBox(self.builder,
+            configure_callback=run_nmce_cb)
         parent = self.builder.get_object("AnacondaStandaloneWindow-action_area5")
         parent.add(self.network_control_box.vbox)
 
@@ -1049,6 +1062,24 @@ def getKSNetworkData(device):
 
     return retval
 
+class NMCEEmbedder(UIObject):
+    builderObjects = ["nmceEmbedder"]
+    mainWidgetName = "nmceEmbedder"
+    uiFile = "spokes/network.ui"
+    def run(self, spoke, uuid):
+        from gi.repository import AnacondaWidgets
+        self.lb = AnacondaWidgets.lb_show_over(spoke)
+
+        self.lb.set_keep_below(True)
+        spoke.set_keep_below(True)
+
+        proc = subprocess.Popen(["nm-connection-editor", "--edit", "%s" %
+                                  uuid])
+        GLib.child_watch_add(proc.pid, self.on_nmce_exited)
+
+    def on_nmce_exited(self, pid, condition):
+        self.lb.destroy()
+
 if __name__ == "__main__":
 
     win = Gtk.Window()
diff --git a/pyanaconda/ui/gui/spokes/network.ui b/pyanaconda/ui/gui/spokes/network.ui
index 49c75c2..7394d08 100644
--- a/pyanaconda/ui/gui/spokes/network.ui
+++ b/pyanaconda/ui/gui/spokes/network.ui
@@ -2216,4 +2216,13 @@ updates available for you.</property>
       </object>
     </child>
   </object>
+  <object class="GtkWindow" id="nmceEmbedder">
+    <property name="can_focus">False</property>
+    <property name="modal">True</property>
+    <property name="window_position">center</property>
+    <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
+  </object>
 </interface>
-- 
1.7.7.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux