Use the chardet module to try to detect what encoding the SSID uses. Add a column to the wireless network ListStore in the network spoke to store the original byte sequence (also encoded as a string because GLib is awful at storing byte sequences).
From: David Shea dshea@redhat.com
Use the chardet module to try to detect what encoding the SSID uses. Add a column to the wireless network ListStore in the network spoke to store the original byte sequence (also encoded as a string because GLib is awful at storing byte sequences). --- anaconda.spec.in | 3 + pyanaconda/ui/gui/spokes/network.glade | 164 +++++++++++++++++---------------- pyanaconda/ui/gui/spokes/network.py | 50 ++++++++-- 3 files changed, 128 insertions(+), 89 deletions(-)
diff --git a/anaconda.spec.in b/anaconda.spec.in index 93c0052..70e2f29 100644 --- a/anaconda.spec.in +++ b/anaconda.spec.in @@ -176,6 +176,9 @@ Requires: anaconda-user-help >= %{helpver} Requires: yelp Requires: python3-gobject
+# Needed by the network spoke +Requires: python3-chardet + # Needed to compile the gsettings files BuildRequires: gsettings-desktop-schemas
diff --git a/pyanaconda/ui/gui/spokes/network.glade b/pyanaconda/ui/gui/spokes/network.glade index 37a5901..ad46683 100644 --- a/pyanaconda/ui/gui/spokes/network.glade +++ b/pyanaconda/ui/gui/spokes/network.glade @@ -158,6 +158,8 @@ <column type="guint"/> <!-- column-name security --> <column type="guint"/> + <!-- column-name ssid --> + <column type="gchararray"/> </columns> </object> <object class="AnacondaSpokeWindow" id="networkWindow"> @@ -357,9 +359,9 @@ <object class="GtkLabel" id="label_wired_device"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">Wired</property> <property name="ellipsize">end</property> + <property name="xalign">0</property> <attributes> <attribute name="weight" value="bold"/> <attribute name="scale" value="1.2"/> @@ -375,8 +377,8 @@ <object class="GtkLabel" id="label_wired_status"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">Cable unplugged</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -414,8 +416,8 @@ <object class="GtkLabel" id="heading_wired_slaves"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Slaves</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -437,9 +439,9 @@ <object class="GtkLabel" id="heading_wired_dns"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="label" translatable="yes">DNS</property> <property name="xalign">1</property> <property name="yalign">0</property> - <property name="label" translatable="yes">DNS</property> </object> <packing> <property name="left_attach">0</property> @@ -450,10 +452,10 @@ <object class="GtkLabel" id="label_wired_dns"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> <property name="label">127.0.0.1</property> <property name="wrap">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -464,8 +466,8 @@ <object class="GtkLabel" id="heading_wired_route"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Default Route</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -476,8 +478,8 @@ <object class="GtkLabel" id="label_wired_route"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">127.0.0.1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -488,8 +490,8 @@ <object class="GtkLabel" id="heading_wired_subnet"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Subnet Mask</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -500,8 +502,8 @@ <object class="GtkLabel" id="label_wired_subnet"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">127.0.0.1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -512,8 +514,8 @@ <object class="GtkLabel" id="heading_wired_ipv6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">IPv6 Address</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -524,8 +526,8 @@ <object class="GtkLabel" id="label_wired_ipv6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">::1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -536,8 +538,8 @@ <object class="GtkLabel" id="heading_wired_ipv4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">IPv4 Address</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -548,8 +550,8 @@ <object class="GtkLabel" id="label_wired_ipv4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">127.0.0.1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -560,8 +562,8 @@ <object class="GtkLabel" id="heading_wired_speed"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Speed</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -572,8 +574,8 @@ <object class="GtkLabel" id="label_wired_speed"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">1 Mb/s</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -584,8 +586,8 @@ <object class="GtkLabel" id="heading_wired_mac"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Hardware Address</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -596,8 +598,8 @@ <object class="GtkLabel" id="label_wired_mac"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">AA:BB:CC:DD:55:66:77:88</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -608,8 +610,8 @@ <object class="GtkLabel" id="heading_wired_parent"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Parent</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -620,8 +622,8 @@ <object class="GtkLabel" id="heading_wired_vlanid"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">VLAN ID</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -776,9 +778,9 @@ <object class="GtkLabel" id="label_wireless_device"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">Wireless</property> <property name="ellipsize">end</property> + <property name="xalign">0</property> <attributes> <attribute name="weight" value="bold"/> <attribute name="scale" value="1.2"/> @@ -794,8 +796,8 @@ <object class="GtkLabel" id="label_wireless_status"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">Not connected</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -813,8 +815,8 @@ <object class="GtkLabel" id="heading_wireless_mac"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Hardware Address</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -825,8 +827,8 @@ <object class="GtkLabel" id="heading_wireless_speed"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Speed</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -837,8 +839,8 @@ <object class="GtkLabel" id="heading_wireless_ipv4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">IPv4 Address</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -849,8 +851,8 @@ <object class="GtkLabel" id="heading_wireless_ipv6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">IPv6 Address</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -861,8 +863,8 @@ <object class="GtkLabel" id="heading_wireless_route"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Default Route</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -873,9 +875,9 @@ <object class="GtkLabel" id="heading_wireless_dns"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="label" translatable="yes">DNS</property> <property name="xalign">1</property> <property name="yalign">0</property> - <property name="label" translatable="yes">DNS</property> </object> <packing> <property name="left_attach">0</property> @@ -886,8 +888,8 @@ <object class="GtkLabel" id="label_wireless_mac"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">AA:BB:CC:DD:55:66:77:88</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -899,8 +901,8 @@ <object class="GtkLabel" id="label_wireless_speed"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">1 Mb/s</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -912,8 +914,8 @@ <object class="GtkLabel" id="label_wireless_ipv4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">127.0.0.1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -925,8 +927,8 @@ <object class="GtkLabel" id="label_wireless_ipv6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">::1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -938,8 +940,8 @@ <object class="GtkLabel" id="label_wireless_route"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">127.0.0.1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -951,10 +953,10 @@ <object class="GtkLabel" id="label_wireless_dns"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> <property name="label">127.0.0.1</property> <property name="wrap">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -986,8 +988,8 @@ <object class="GtkLabel" id="heading_wireless_security"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Security</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -998,10 +1000,10 @@ <object class="GtkLabel" id="heading_wireless_network_name"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="GUI|Network|Wireless">_Network Name</property> <property name="use_underline">True</property> <property name="mnemonic_widget">combobox_wireless_network_name</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1012,8 +1014,8 @@ <object class="GtkLabel" id="heading_hotspot_network_name"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Network Name</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1024,8 +1026,8 @@ <object class="GtkLabel" id="heading_hotspot_security_key"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Security Key</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1036,8 +1038,8 @@ <object class="GtkLabel" id="label_wireless_security"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">WPA</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1068,9 +1070,9 @@ <object class="GtkLabel" id="label_hotspot_network_name"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">My Hot Spot</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1082,9 +1084,9 @@ <object class="GtkLabel" id="label_hotspot_security_key"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">My Secret</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1223,9 +1225,9 @@ <object class="GtkLabel" id="label_mobilebb_device"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">Mobile Broadband</property> <property name="ellipsize">end</property> + <property name="xalign">0</property> <attributes> <attribute name="weight" value="bold"/> <attribute name="scale" value="1.2"/> @@ -1241,8 +1243,8 @@ <object class="GtkLabel" id="label_mobilebb_status"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">Not connected</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -1260,8 +1262,8 @@ <object class="GtkLabel" id="heading_mobilebb_imei"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">IMEI</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1272,8 +1274,8 @@ <object class="GtkLabel" id="heading_mobilebb_speed"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Speed</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1284,8 +1286,8 @@ <object class="GtkLabel" id="heading_mobilebb_provider"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Provider</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1296,9 +1298,9 @@ <object class="GtkLabel" id="label_mobilebb_imei"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">1234567890</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1310,9 +1312,9 @@ <object class="GtkLabel" id="label_mobilebb_speed"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">1 Mb/s</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1324,9 +1326,9 @@ <object class="GtkLabel" id="label_mobilebb_provider"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">SuperTel Supremo </property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1338,9 +1340,9 @@ <object class="GtkLabel" id="label_mobilebb_ipv4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">127.0.0.1</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1352,8 +1354,8 @@ <object class="GtkLabel" id="label_mobilebb_ipv6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1365,8 +1367,8 @@ <object class="GtkLabel" id="label_mobilebb_route"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1378,9 +1380,9 @@ <object class="GtkLabel" id="label_mobilebb_dns"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="selectable">True</property> <property name="xalign">0</property> <property name="yalign">0</property> - <property name="selectable">True</property> </object> <packing> <property name="left_attach">1</property> @@ -1404,8 +1406,8 @@ <object class="GtkLabel" id="heading_mobilebb_ipv4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">IP Address</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1416,8 +1418,8 @@ <object class="GtkLabel" id="heading_mobilebb_ipv6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">IPv6 Address</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1428,8 +1430,8 @@ <object class="GtkLabel" id="heading_mobilebb_route"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Default Route</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1440,9 +1442,9 @@ <object class="GtkLabel" id="heading_mobilebb_dns"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="label" translatable="yes">DNS</property> <property name="xalign">1</property> <property name="yalign">0</property> - <property name="label" translatable="yes">DNS</property> </object> <packing> <property name="left_attach">0</property> @@ -1540,9 +1542,9 @@ <object class="GtkLabel" id="label_vpn_device"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">VPN</property> <property name="ellipsize">end</property> + <property name="xalign">0</property> <attributes> <attribute name="weight" value="bold"/> <attribute name="scale" value="1.2"/> @@ -1558,8 +1560,8 @@ <object class="GtkLabel" id="label_vpn_status"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">Not connected</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -1577,8 +1579,8 @@ <object class="GtkLabel" id="heading_vpn_service_type"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">VPN Type</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1589,8 +1591,8 @@ <object class="GtkLabel" id="heading_vpn_gateway"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Gateway</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1601,8 +1603,8 @@ <object class="GtkLabel" id="heading_vpn_group_name"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Group Name</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1613,8 +1615,8 @@ <object class="GtkLabel" id="heading_vpn_group_password"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">Group Password</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1625,8 +1627,8 @@ <object class="GtkLabel" id="heading_vpn_username"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes">User Name</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1637,9 +1639,9 @@ <object class="GtkLabel" id="label_vpn_service_type"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">openvpn</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1651,9 +1653,9 @@ <object class="GtkLabel" id="label_vpn_gateway"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">AA:BB:CC:DD:55:66:77:88</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1665,9 +1667,9 @@ <object class="GtkLabel" id="label_vpn_group_name"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">SEKRIT</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1679,9 +1681,9 @@ <object class="GtkLabel" id="label_vpn_group_password"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">**********</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1693,9 +1695,9 @@ <object class="GtkLabel" id="label_vpn_username"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">smithy</property> <property name="selectable">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -1806,9 +1808,9 @@ <object class="GtkLabel" id="label_proxy_device"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">Proxy</property> <property name="ellipsize">end</property> + <property name="xalign">0</property> <attributes> <attribute name="weight" value="bold"/> <attribute name="scale" value="1.2"/> @@ -1824,8 +1826,8 @@ <object class="GtkLabel" id="label_proxy_status"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">Not connected</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -1855,10 +1857,10 @@ <object class="GtkLabel" id="heading_proxy_method"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="GUI|Network|Proxy">_Method</property> <property name="use_underline">True</property> <property name="mnemonic_widget">combobox_proxy_mode</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1880,10 +1882,10 @@ <object class="GtkLabel" id="heading_proxy_url"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="GUI|Network|Proxy">_Configuration URL</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entry_proxy_url</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1905,10 +1907,10 @@ <object class="GtkLabel" id="heading_proxy_http"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="GUI|Network|Proxy">HTTP _Proxy</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entry_proxy_http</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1919,10 +1921,10 @@ <object class="GtkLabel" id="heading_proxy_https"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="GUI|Network|Proxy">H_TTPS Proxy</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entry_proxy_https</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1933,10 +1935,10 @@ <object class="GtkLabel" id="heading_proxy_ftp"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="GUI|Network|Proxy">_FTP Proxy</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entry_proxy_ftp</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1947,10 +1949,10 @@ <object class="GtkLabel" id="heading_proxy_socks"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="GUI|Network|Proxy">_Socks Host</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entry_proxy_socks</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -1961,10 +1963,10 @@ <object class="GtkLabel" id="label_proxy_warning"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label">WPAD warning...</property> <property name="wrap">True</property> <property name="width_chars">50</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -2462,10 +2464,10 @@ updates available for you.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> - <property name="yalign">0</property> <property name="label" translatable="yes">Passwords or encryption keys are required to access the wireless network</property> + <property name="xalign">0</property> + <property name="yalign">0</property> </object> <packing> <property name="expand">False</property> diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index 74e5aa8..878d4cb 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -61,6 +61,7 @@ # Used for ascii_letters and hexdigits constants import string # pylint: disable=deprecated-module from uuid import uuid4 +import chardet
from dbus.mainloop.glib import DBusGMainLoop DBusGMainLoop(set_as_default=True) @@ -508,15 +509,17 @@ def on_wireless_ap_changed_cb(self, combobox, *args): if not dev_cfg: return
- ap_obj_path, ssid_target = combobox.get_model().get(itr, 0, 1) - self.selected_ssid = ssid_target + ap_obj_path, ssid_target, ssid_bytes = combobox.get_model().get(itr, 0, 1, 6) if ap_obj_path == "ap-other...": return
+ # Decode the SSID byte array back into bytes (see _add_ap) + self.selected_ssid = ssid_bytes.encode('latin1') + log.info("network: selected access point: %s", ssid_target)
try: - uuid = nm.nm_ap_setting_value(ssid_target, "connection", "uuid") + uuid = nm.nm_ap_setting_value(ssid_bytes, "connection", "uuid") nm.nm_activate_device_connection(dev_cfg.device.get_iface(), uuid) except nm.UnmanagedDeviceError as e: log.debug("network: on_wireless_ap_changed: %s", e) @@ -528,8 +531,7 @@ def on_wireless_ap_changed_cb(self, combobox, *args): values.append(['connection', 'uuid', str(uuid4()), 's']) values.append(['connection', 'id', ssid_target, 's']) values.append(['connection', 'type', '802-11-wireless', 's']) - ssid = [ord(c) for c in ssid_target] - values.append(['802-11-wireless', 'ssid', ssid, 'ay']) + values.append(['802-11-wireless', 'ssid', ssid_bytes, 'ay']) values.append(['802-11-wireless', 'mode', 'infrastructure', 's']) log.debug("network: adding connection for WPA-Enterprise AP %s", ssid_target) nm.nm_add_connection(values) @@ -1030,6 +1032,27 @@ def _set_device_info_value(self, dev_type_str, info, value_str): value_label.show() value_label.set_label(value_str)
+ def _decode_ssid(self, ssid): + # Try to figure out what character encoding will turn the jumble of + # bytes returned as an SSID into a string that can be displayed. + + # chardet is pretty crummy at detecting utf-8 for whatever reason, so + # go ahead and try it. If it looks like utf-8, it probably is. This + # also conveniently covers the usual, ascii-only case. + try: + return ssid.decode('utf-8') + except UnicodeDecodeError: + pass + + # See if chardet comes up with something useful + detected = chardet.detect(ssid) + if detected and 'encoding' in detected: + return ssid.decode(detected['encoding']) + + # If that didn't work just give up and use latin1, since that'll take + # any kind of garbage + return ssid.decode('latin1') + # TODO NM_GI_BUGS use glib methods for mode and security (dbus obj or nm obj?) def _add_ap(self, ap, active=False): ssid = ap.get_ssid() @@ -1051,13 +1074,24 @@ def _add_ap(self, ap, active=False): security = self._ap_security_dbus(ap)
store = self.builder.get_object("liststore_wireless_network") + + ssid_str = self._decode_ssid(ssid) + + # gobject has about three dozen different array types, and yet none + # of them can be put into a ListStore. Decode the ssid as latin1 to + # get the original byte representation as a string, which is gross, + # but has a 1:1 relationship between charcters and bytes so is + # reversible. + ssid_bytes = ssid.decode('latin1') + # the third column is for sorting itr = store.append([ap.get_path(), - ssid, - ssid, + ssid_str, + ssid_str, ap.get_strength(), mode, - security]) + security, + ssid_bytes]) if active: self.builder.get_object("combobox_wireless_network_name").set_active_iter(itr)
In reply to line 1081 of pyanaconda/ui/gui/spokes/network.py:
Should be able to do that with a `GBytes`, no?
In reply to line 1081 of pyanaconda/ui/gui/spokes/network.py:
$ cat test.glade
``` <?xml version="1.0" encoding="UTF-8"?> <!-- Generated with glade 3.18.3 --> <interface> <requires lib="gtk+" version="3.12"/> <object class="GtkListStore" id="test_store"> <columns> <!-- column-name str --> <column type="gchararray"/> <!-- column-name bytes --> <column type="GBytes"/> </columns> </object> <object class="GtkWindow" id="test_window"> <property name="can_focus">False</property> <child> <object class="GtkComboBox" id="combobox1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="model">test_store</property> <child> <object class="GtkCellRendererText" id="comborenderer"/> <attributes> <attribute name="text">0</attribute> </attributes> </child> </object> </child> </object> </interface> ```
dshea@dhcp-189-44:~/tmp$ cat test.py
``` #!/usr/bin/python3
import gi gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
builder = Gtk.Builder.new_from_file('test.glade') store = builder.get_object('test_store')
store.append(['asdf', b'asdf'])
window = builder.get_object('test_window') window.connect('delete-event', Gtk.main_quit) window.show_all() Gtk.main() ```
dshea@dhcp-189-44:~/tmp$ python3 test.py
(test.py:18369): Gtk-WARNING **: Unknown type GBytes specified in treemodel test_store
(test.py:18369): Gtk-WARNING **: gtkliststore.c:516: Invalid type (null)
Traceback (most recent call last): File "test.py", line 11, in <module> store.append(['asdf', b'asdf']) File "/usr/lib64/python3.4/site-packages/gi/overrides/Gtk.py", line 956, in append return self._do_insert(-1, row) File "/usr/lib64/python3.4/site-packages/gi/overrides/Gtk.py", line 947, in _do_insert row, columns = self._convert_row(row) File "/usr/lib64/python3.4/site-packages/gi/overrides/Gtk.py", line 857, in _convert_row result.append(self._convert_value(cur_col, value)) File "/usr/lib64/python3.4/site-packages/gi/overrides/Gtk.py", line 875, in _convert_value return GObject.Value(self.get_column_type(column), value) File "/usr/lib64/python3.4/site-packages/gi/overrides/GObject.py", line 216, in __init__ self.init(value_type) TypeError: Must be gobject.GType, not gobject.GType
Ok, this is because `type_name_mangle("GBytes")` -> `gbytes_get_type`. This is clearly a GTK+ bug but in the meantime you could work around it by doing:
``` from gi.repository import GLib GLib.Bytes # Force the gtype to be registered by side effect ```
This having to force types to be registered to use Glade has been a pain point with it forever.
Ok, this is because type_name_mangle("GBytes") -> gbytes_get_type. This is clearly a GTK+ bug but in the meantime you could work around it by doing:
$ cat test.py ``` #!/usr/bin/python3
import gi gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib
GLib.Bytes
builder = Gtk.Builder.new_from_file('test.glade') store = builder.get_object('test_store')
store.append(['asdf', b'asdf'])
window = builder.get_object('test_window') window.connect('delete-event', Gtk.main_quit) window.show_all() Gtk.main() ```
$ python3 test.py Traceback (most recent call last): File "test.py", line 13, in <module> store.append(['asdf', b'asdf']) File "/usr/lib64/python3.4/site-packages/gi/overrides/Gtk.py", line 956, in append return self._do_insert(-1, row) File "/usr/lib64/python3.4/site-packages/gi/overrides/Gtk.py", line 947, in _do_insert row, columns = self._convert_row(row) File "/usr/lib64/python3.4/site-packages/gi/overrides/Gtk.py", line 857, in _convert_row result.append(self._convert_value(cur_col, value)) File "/usr/lib64/python3.4/site-packages/gi/overrides/Gtk.py", line 875, in _convert_value return GObject.Value(self.get_column_type(column), value) File "/usr/lib64/python3.4/site-packages/gi/overrides/GObject.py", line 218, in __init__ self.set_value(py_value) File "/usr/lib64/python3.4/site-packages/gi/overrides/GObject.py", line 283, in set_value self.set_boxed(py_value) File "/usr/lib64/python3.4/site-packages/gi/overrides/GObject.py", line 231, in set_boxed _gobject._gvalue_set(self, boxed) TypeError: Expected Boxed
The list store doesn't know how to auto-coerce Python `bytes` to GBytes, so you'd need:
``` store.append(['asdf', GLib.Bytes.new(b'asdf')]) ```
anaconda-patches@lists.fedorahosted.org