[PATCH 5/6] Network spoke: implement status and completed methods

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

 



completed(): any device is connected
status(): info about which devices are connected (to which APs)
---
 pyanaconda/ui/gui/spokes/network.py |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index ee3f557..d59fc59 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -327,13 +327,42 @@ class NetworkSpoke(NormalSpoke):
 
     @property
     def completed(self):
-        # enabled?
-        pass
+        return self.status != _("Not connected")
 
     @property
     def status(self):
+        """ A short string describing which devices are connected. """
+        active_wired_devs = []
+        active_wireless_devs = []
+
+        for con in self.client.get_active_connections():
+            device = con.get_devices()[0]
+            if device.get_device_type() == NetworkManager.DeviceType.ETHERNET:
+                active_wired_devs.append(device.get_iface())
+            elif device.get_device_type() == NetworkManager.DeviceType.WIFI:
+                active_wireless_devs.append([device.get_iface(),
+                                    device.get_active_access_point().get_ssid()])
+
+        numdevs = len(active_wired_devs) + len(active_wireless_devs)
+        if numdevs:
+            if numdevs == 1:
+                if active_wired_devs:
+                    msg = _("Wired (%s) connected") % active_wired_devs[0]
+                else:
+                    msg = _("Wireless (%s) connected to %s" %
+                            tuple(active_wireless_devs[0]))
+
+            else:
+                devlist = ", ".join(active_wired_devs +
+                                    ["%s (%s)" % (iface, ap) for iface, ap in
+                                     active_wireless_devs])
+                msg = _("Connected devices: %s") % devlist
+        else:
+            msg = _("Not connected")
+
         # active connections?
-        pass
+
+        return msg
 
     def populate(self):
         NormalSpoke.populate(self)
-- 
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