Ticket #1759: 0001-Showing-Errors-Pallete-Mockup-V5.patch
File 0001-Showing-Errors-Pallete-Mockup-V5.patch, 23.1 KB (added by Dcastelo, 13 years ago) |
---|
-
extensions/deviceicon/network.py
From 8b76b39bfcc29d1382c85a7c334e5e037d1487b9 Mon Sep 17 00:00:00 2001 From: dcastelo <dcastelo@plan.ceibal.edu.uy> Date: Tue, 1 Jun 2010 11:36:35 -0300 Subject: [PATCH] Showing-Errors-Pallete-Mockup-V5.patch --- extensions/deviceicon/network.py | 189 ++++++++++++++++++++++++++------------ src/jarabe/model/network.py | 160 ++++++++++++++++++++++++++++++-- 2 files changed, 280 insertions(+), 69 deletions(-) diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py index 94a4293..d695fad 100644
a b from sugar.graphics.tray import TrayIcon 39 39 from sugar.graphics import xocolor 40 40 from sugar.util import unique_id 41 41 from sugar import profile 42 from sugar.graphics.icon import Icon 43 from sugar.graphics.menuitem import MenuItem 42 44 43 45 from jarabe.model import network 44 46 from jarabe.model.network import Settings … … _GSM_STATE_NOT_READY = 0 63 65 _GSM_STATE_DISCONNECTED = 1 64 66 _GSM_STATE_CONNECTING = 2 65 67 _GSM_STATE_CONNECTED = 3 66 _GSM_STATE_ NEED_AUTH= 468 _GSM_STATE_FAILED = 4 67 69 68 70 def frequency_to_channel(frequency): 69 71 ftoc = { 2412: 1, 2417: 2, 2422: 3, 2427: 4, … … class WiredPalette(Palette): 214 216 ip_address_text = "" 215 217 self._ip_address_label.set_text(ip_address_text) 216 218 219 217 220 class GsmPalette(Palette): 218 221 __gtype_name__ = 'SugarGsmPalette' 219 222 … … class GsmPalette(Palette): 227 230 def __init__(self): 228 231 229 232 Palette.__init__(self, label=_('Wireless modem')) 230 231 233 self._current_state = None 234 self._alert = False 232 235 233 self._toggle_state_item = gtk.MenuItem('')236 self._toggle_state_item = MenuItem('') 234 237 self._toggle_state_item.connect('activate', self.__toggle_state_cb) 235 238 self.menu.append(self._toggle_state_item) 236 239 self._toggle_state_item.show() 237 240 238 self.set_state(_GSM_STATE_NOT_READY)239 240 241 self.info_box = gtk.VBox() 241 242 242 self.data_label = gtk.Label() 243 self.data_label.props.xalign = 0.0 244 label_alignment = self._add_widget_with_padding(self.data_label) 245 self.info_box.pack_start(label_alignment) 246 self.data_label.show() 243 self.error_description_label = gtk.Label("") 244 self.error_description_label.set_line_wrap(True) 245 self.info_box.pack_start(self.error_description_label) 246 247 self.connection_info_box = gtk.HBox() 248 249 icon = Icon(icon_name='data-upload', icon_size=gtk.ICON_SIZE_MENU) 250 self.connection_info_box.pack_start(icon) 251 icon.show() 252 self._data_label_up = gtk.Label() 253 self._data_label_up.props.xalign = 0.0 254 label_alignment = self._add_widget_with_padding(self._data_label_up) 255 self.connection_info_box.pack_start(label_alignment) 256 self._data_label_up.show() 247 257 label_alignment.show() 248 258 249 self.connection_time_label = gtk.Label() 250 self.connection_time_label.props.xalign = 0.0 251 label_alignment = self._add_widget_with_padding( \ 252 self.connection_time_label) 253 self.info_box.pack_start(label_alignment) 254 self.connection_time_label.show() 259 icon = Icon(icon_name='data-download', icon_size=gtk.ICON_SIZE_MENU) 260 self.connection_info_box.pack_start(icon) 261 icon.show() 262 self._data_label_down = gtk.Label() 263 self._data_label_down.props.xalign = 0.0 264 label_alignment = self._add_widget_with_padding(self._data_label_down) 265 self.connection_info_box.pack_start(label_alignment) 266 self._data_label_down.show() 255 267 label_alignment.show() 268 269 self.info_box.pack_start(self.connection_info_box) 256 270 271 self._error_accept_item = MenuItem('') 272 self._error_accept_item.connect('activate', self.__error_accept_cb) 273 self.menu.append(self._error_accept_item) 274 257 275 self.info_box.show() 258 276 self.set_content(self.info_box) 259 277 278 self.set_state(_GSM_STATE_NOT_READY) 279 260 280 def _add_widget_with_padding(self, child, xalign=0, yalign=0.5): 261 281 alignment = gtk.Alignment(xalign=xalign, yalign=yalign, 262 282 xscale=1, yscale=0.33) … … class GsmPalette(Palette): 267 287 alignment.add(child) 268 288 return alignment 269 289 270 def set_state(self, state ):290 def set_state(self, state, reason=0): 271 291 self._current_state = state 272 self._update_label_and_text( )292 self._update_label_and_text(reason) 273 293 274 def _update_label_and_text(self): 294 def _update_label_and_text(self, reason=0): 295 275 296 if self._current_state == _GSM_STATE_NOT_READY: 276 297 self._toggle_state_item.get_child().set_label('...') 277 298 self.props.secondary_text = _('Please wait...') 278 299 279 300 elif self._current_state == _GSM_STATE_DISCONNECTED: 280 301 self._toggle_state_item.get_child().set_label(_('Connect')) 281 self.props.secondary_text = _('Disconnected') 282 302 if not self._alert: 303 self.props.secondary_text = _('Disconnected') 304 icon = Icon(icon_name='dialog-ok', \ 305 icon_size=gtk.ICON_SIZE_MENU) 306 self._toggle_state_item.set_image(icon) 307 283 308 elif self._current_state == _GSM_STATE_CONNECTING: 284 309 self._toggle_state_item.get_child().set_label(_('Cancel')) 285 310 self.props.secondary_text = _('Connecting...') 311 icon = Icon(icon_name='dialog-cancel', \ 312 icon_size=gtk.ICON_SIZE_MENU) 313 self._toggle_state_item.set_image(icon) 286 314 287 315 elif self._current_state == _GSM_STATE_CONNECTED: 288 316 self._toggle_state_item.get_child().set_label(_('Disconnect')) 289 self.props.secondary_text = _('Connected') 290 291 elif self._current_state == _GSM_STATE_NEED_AUTH: 292 self._toggle_state_item.get_child().set_label(_('Sim requires Pin/Puk')) 293 self.props.secondary_text = _('Authentication Error') 294 317 self.update_connection_time() 318 icon = Icon(icon_name='media-eject', \ 319 icon_size=gtk.ICON_SIZE_MENU) 320 self._toggle_state_item.set_image(icon) 321 322 elif self._current_state == _GSM_STATE_FAILED: 323 message_error = self._get_error_by_nm_reason(reason) 324 self.add_alert(_('Error: %s') % message_error[0], \ 325 message_error[1]) 295 326 else: 296 327 raise ValueError('Invalid GSM state while updating label and ' \ 297 328 'text, %s' % str(self._current_state)) 298 329 330 def add_alert(self, title, message): 331 self._alert = True 332 self.props.secondary_text = _("Connection Error") 333 self._error_accept_item.get_child().set_label(title) 334 self._error_accept_item.show() 335 self.error_description_label.set_text(message) 336 self.error_description_label.show() 337 self._toggle_state_item.set_sensitive(False) 338 339 def __error_accept_cb(self, alert): 340 self._alert = False 341 self._update_label_and_text() 342 self._error_accept_item.get_child().set_label('') 343 self._error_accept_item.hide() 344 self.error_description_label.hide() 345 self._toggle_state_item.set_sensitive(True) 346 self._full_request = [0, 0] 347 348 def update_connection_time(self, connection_time=None): 349 if (connection_time is not None): 350 self.props.secondary_text = _('Connected for ' + \ 351 connection_time.strftime('%H:%M:%S')) 352 else: 353 self.props.secondary_text = _('Connected for ' \ 354 + '00:00:00') 355 356 def update_stats(self, in_bytes, out_bytes): 357 in_KBytes = in_bytes / 1024 358 out_KBytes = out_bytes / 1024 359 self._data_label_up.set_text(_("%d KB") % (out_KBytes)) 360 self._data_label_down.set_text(_("%d KB") % (in_KBytes)) 361 362 def _get_error_by_nm_reason(self, reason): 363 if reason in [network.NM_DEVICE_STATE_REASON_NO_SECRETS, network.NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED]: 364 message = _('Suggestion: Check your Pin/Puk configuration.') 365 elif reason in [network.NM_DEVICE_STATE_REASON_PPP_DISCONNECT, network.NM_DEVICE_STATE_REASON_PPP_FAILED]: 366 message = _('Suggestion: Check your Access Point Name (APN) configuration') 367 elif reason in [network.NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER, network.NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT]: 368 message = _('Suggestion: Check the Number configuration.') 369 else: 370 message = '' 371 message_tuple = (network.NM_DEVICE_STATE_REASON_DESCRIPTION[reason], message) 372 return message_tuple 373 299 374 def __toggle_state_cb(self, menuitem): 300 375 if self._current_state == _GSM_STATE_NOT_READY: 301 376 pass … … class GsmPalette(Palette): 305 380 self.emit('gsm-disconnect') 306 381 elif self._current_state == _GSM_STATE_CONNECTED: 307 382 self.emit('gsm-disconnect') 308 elif self._current_state == _GSM_STATE_NEED_AUTH:309 self.emit('gsm-disconnect')310 383 else: 311 384 raise ValueError('Invalid GSM state while emitting signal, %s' % \ 312 385 str(self._current_state)) 313 386 314 387 315 388 class WirelessDeviceView(ToolButton): 316 389 … … class GsmDeviceView(TrayIcon): 747 820 signal_name='PppStats', 748 821 path=self._device.object_path, 749 822 dbus_interface=_NM_SERIAL_IFACE) 823 750 824 def create_palette(self): 751 825 palette = GsmPalette() 752 826 … … class GsmDeviceView(TrayIcon): 774 848 '/', 775 849 reply_handler=self.__connect_cb, 776 850 error_handler=self.__connect_error_cb) 851 else: 852 self._palette.add_alert(_('Connection Error'), \ 853 _('There is no gsm connection available')) 777 854 778 855 def __connect_cb(self, active_connection): 779 856 logging.debug('Connected successfully to gsm device, %s', … … class GsmDeviceView(TrayIcon): 807 884 808 885 def __state_changed_cb(self, new_state, old_state, reason): 809 886 logging.debug('State: %s to %s, reason %s', old_state, new_state, reason) 810 self._update_state(int(new_state) )887 self._update_state(int(new_state), int(old_state), int(reason)) 811 888 812 889 def __current_state_check_cb(self, properties): 813 self._update_state(int(properties['State']) )890 self._update_state(int(properties['State']), 0, 0) 814 891 815 892 def __current_state_check_error_cb(self, error): 816 893 raise RuntimeError('Error when checking gsm device state, %s' % error) 817 894 818 def _update_state(self, state ):895 def _update_state(self, state, old_state, reason): 819 896 gsm_state = None 820 897 821 898 if state is network.DEVICE_STATE_ACTIVATED: … … class GsmDeviceView(TrayIcon): 823 900 connection = network.find_gsm_connection() 824 901 if connection is not None: 825 902 connection.set_connected() 826 self._connection_timestamp = 903 self._connection_timestamp = time.time() - \ 827 904 connection.get_settings().connection.timestamp 828 905 self._connection_time_handler = gobject.timeout_add_seconds( \ 829 906 1, self.__connection_timecount_cb) 830 self._update_stats(0, 0) 831 self._update_connection_time() 832 self._palette.info_box.show() 907 self._palette.update_connection_time() 908 self._palette.update_stats(0, 0) 909 if self._palette is not None: 910 self._palette.connection_info_box.show() 833 911 834 912 elif state is network.DEVICE_STATE_DISCONNECTED: 835 913 gsm_state = _GSM_STATE_DISCONNECTED 836 914 self._connection_timestamp = 0 837 915 if self._connection_time_handler is not None: 838 916 gobject.source_remove(self._connection_time_handler) 839 self._palette.info_box.hide() 917 if self._palette is not None: 918 self._palette.connection_info_box.hide() 840 919 841 920 elif state in [network.DEVICE_STATE_UNMANAGED, 842 921 network.DEVICE_STATE_UNAVAILABLE, … … class GsmDeviceView(TrayIcon): 845 924 846 925 elif state in [network.DEVICE_STATE_PREPARE, 847 926 network.DEVICE_STATE_CONFIG, 848 network.DEVICE_STATE_IP_CONFIG]: 927 network.DEVICE_STATE_IP_CONFIG, 928 network.DEVICE_STATE_NEED_AUTH]: 849 929 gsm_state = _GSM_STATE_CONNECTING 850 851 elif state in [network.DEVICE_STATE_NEED_AUTH]:852 gsm_state = _GSM_STATE_ NEED_AUTH930 931 elif state == network.DEVICE_STATE_FAILED: 932 gsm_state = _GSM_STATE_FAILED 853 933 854 934 if self._palette is not None: 855 self._palette.set_state(gsm_state )935 self._palette.set_state(gsm_state, reason) 856 936 857 937 def disconnect(self): 858 938 self._bus.remove_signal_receiver(self.__state_changed_cb, … … class GsmDeviceView(TrayIcon): 861 941 dbus_interface=_NM_DEVICE_IFACE) 862 942 863 943 def __ppp_stats_changed_cb(self, in_bytes, out_bytes): 864 self._update_stats(in_bytes, out_bytes) 865 866 def _update_stats(self, in_bytes, out_bytes): 867 in_KBytes = in_bytes / 1024 868 out_KBytes = out_bytes / 1024 869 text = _("Data sent %d KB / received %d KB") % (out_KBytes, in_KBytes) 870 self._palette.data_label.set_text(text) 944 self._palette.update_stats(in_bytes, out_bytes) 871 945 872 946 def __connection_timecount_cb(self): 873 947 self._connection_timestamp = self._connection_timestamp + 1 874 self._update_connection_time() 948 connection_time = \ 949 datetime.datetime.fromtimestamp(self._connection_timestamp) 950 self._palette.update_connection_time(connection_time) 875 951 return True 876 952 877 def _update_connection_time(self):878 connection_time = datetime.datetime.fromtimestamp( \879 self._connection_timestamp)880 text = _("Connection time ") + connection_time.strftime('%H : %M : %S')881 self._palette.connection_time_label.set_text(text)882 953 954 883 955 class WirelessDeviceObserver(object): 884 956 def __init__(self, device, tray, device_type): 885 957 self._device = device … … class WiredDeviceObserver(object): 950 1022 del self._device_view 951 1023 self._device_view = None 952 1024 1025 953 1026 class GsmDeviceObserver(object): 954 1027 def __init__(self, device, tray): 955 1028 self._device = device -
src/jarabe/model/network.py
diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py index 3a949da..04391f8 100644
a b 18 18 # along with this program; if not, write to the Free Software 19 19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 20 21 from gettext import gettext as _ 21 22 import logging 22 23 import os 23 24 import time … … NM_ACTIVE_CONNECTION_STATE_UNKNOWN = 0 54 55 NM_ACTIVE_CONNECTION_STATE_ACTIVATING = 1 55 56 NM_ACTIVE_CONNECTION_STATE_ACTIVATED = 2 56 57 58 59 NM_DEVICE_STATE_REASON_UNKNOWN = 0 60 NM_DEVICE_STATE_REASON_NONE = 1 61 NM_DEVICE_STATE_REASON_NOW_MANAGED = 2 62 NM_DEVICE_STATE_REASON_NOW_UNMANAGED = 3 63 NM_DEVICE_STATE_REASON_CONFIG_FAILED = 4 64 NM_DEVICE_STATE_REASON_CONFIG_UNAVAILABLE = 5 65 NM_DEVICE_STATE_REASON_CONFIG_EXPIRED = 6 66 NM_DEVICE_STATE_REASON_NO_SECRETS = 7 67 NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT = 8 68 NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED = 9 69 NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED = 10 70 NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT = 11 71 NM_DEVICE_STATE_REASON_PPP_START_FAILED = 12 72 NM_DEVICE_STATE_REASON_PPP_DISCONNECT = 13 73 NM_DEVICE_STATE_REASON_PPP_FAILED = 14 74 NM_DEVICE_STATE_REASON_DHCP_START_FAILED = 15 75 NM_DEVICE_STATE_REASON_DHCP_ERROR = 16 76 NM_DEVICE_STATE_REASON_DHCP_FAILED = 17 77 NM_DEVICE_STATE_REASON_SHARED_START_FAILED = 18 78 NM_DEVICE_STATE_REASON_SHARED_FAILED = 19 79 NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED = 20 80 NM_DEVICE_STATE_REASON_AUTOIP_ERROR = 21 81 NM_DEVICE_STATE_REASON_AUTOIP_FAILED = 22 82 NM_DEVICE_STATE_REASON_MODEM_BUSY = 23 83 NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE = 24 84 NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER = 25 85 NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT = 26 86 NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED = 27 87 NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED = 28 88 NM_DEVICE_STATE_REASON_GSM_APN_FAILED = 29 89 NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING = 30 90 NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED = 31 91 NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT = 32 92 NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED = 33 93 NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED = 34 94 NM_DEVICE_STATE_REASON_FIRMWARE_MISSING = 35 95 NM_DEVICE_STATE_REASON_REMOVED = 36 96 NM_DEVICE_STATE_REASON_SLEEPING = 37 97 NM_DEVICE_STATE_REASON_CONNECTION_REMOVED = 38 98 NM_DEVICE_STATE_REASON_USER_REQUESTED = 39 99 NM_DEVICE_STATE_REASON_CARRIER = 40 100 101 102 103 NM_DEVICE_STATE_REASON_DESCRIPTION = { 104 NM_DEVICE_STATE_REASON_UNKNOWN: \ 105 _("The reason for the device state change \ is unknown"), 106 NM_DEVICE_STATE_REASON_NONE: \ 107 _("The state change is normal."), 108 NM_DEVICE_STATE_REASON_NOW_MANAGED: \ 109 _("The device is now managed."), 110 NM_DEVICE_STATE_REASON_NOW_UNMANAGED: \ 111 _("The device is no longer managed."), 112 NM_DEVICE_STATE_REASON_CONFIG_FAILED: \ 113 _("The device could not be readied for configuration."), 114 NM_DEVICE_STATE_REASON_CONFIG_UNAVAILABLE : \ 115 _("IP configuration could not be reserved \ 116 (no available address, timeout, etc)."), 117 NM_DEVICE_STATE_REASON_CONFIG_EXPIRED : \ 118 _("The IP configuration is no longer valid."), 119 NM_DEVICE_STATE_REASON_NO_SECRETS : \ 120 _("Secrets were required, but not provided."), 121 NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT : \ 122 _("The 802.1X supplicant disconnected from \ 123 the access point or authentication server."), 124 NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED : \ 125 _("Configuration of the 802.1X supplicant failed."), 126 NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED : \ 127 _("The 802.1X supplicant quit or failed unexpectedly."), 128 NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT : \ 129 _("The 802.1X supplicant took too long to authenticate."), 130 NM_DEVICE_STATE_REASON_PPP_START_FAILED : \ 131 _("The PPP service failed to start within the allowed time."), 132 NM_DEVICE_STATE_REASON_PPP_DISCONNECT : \ 133 _("The PPP service disconnected unexpectedly."), 134 NM_DEVICE_STATE_REASON_PPP_FAILED : \ 135 _("The PPP service quit or failed unexpectedly."), 136 NM_DEVICE_STATE_REASON_DHCP_START_FAILED : \ 137 _("The DHCP service failed to start within the allowed time."), 138 NM_DEVICE_STATE_REASON_DHCP_ERROR : \ 139 _("The DHCP service reported an unexpected error"), 140 NM_DEVICE_STATE_REASON_DHCP_FAILED : \ 141 _("The DHCP service quit or failed unexpectedly."), 142 NM_DEVICE_STATE_REASON_SHARED_START_FAILED : \ 143 _("The shared connection service failed to start."), 144 NM_DEVICE_STATE_REASON_SHARED_FAILED : \ 145 _("The shared connection service quit or failed unexpectedly"), 146 NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED : \ 147 _("The AutoIP service failed to start."), 148 NM_DEVICE_STATE_REASON_AUTOIP_ERROR : 149 _("The AutoIP service reported an unexpected error."), 150 NM_DEVICE_STATE_REASON_AUTOIP_FAILED : \ 151 _("The AutoIP service quit or failed unexpectedly."), 152 NM_DEVICE_STATE_REASON_MODEM_BUSY : \ 153 _("Dialing failed because the line was busy."), 154 NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE : \ 155 _("Dialing failed because there was no dial tone. "), 156 NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER : \ 157 _("Dialing failed because there was carrier."), 158 NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT : \ 159 _("Dialing timed out."), 160 NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED : \ 161 _("Dialing failed."), 162 NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED : \ 163 _("Modem initialization failed."), 164 NM_DEVICE_STATE_REASON_GSM_APN_FAILED : \ 165 _("Failed to select the specified GSM APN."), 166 NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING : \ 167 _("Not searching for networks."), 168 NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED : \ 169 _("Network registration was denied."), 170 NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT : \ 171 _("Network registration timed out."), 172 NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED : \ 173 _("Failed to register with the requested GSM network."), 174 NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED : \ 175 _("PIN check failed."), 176 NM_DEVICE_STATE_REASON_FIRMWARE_MISSING : \ 177 _("Necessary firmware for the device may be missing."), 178 NM_DEVICE_STATE_REASON_REMOVED : \ 179 _("The device was removed."), 180 NM_DEVICE_STATE_REASON_SLEEPING : \ 181 _("NetworkManager went to sleep."), 182 NM_DEVICE_STATE_REASON_CONNECTION_REMOVED : \ 183 _("The device's active connection was removed or disappeared."), 184 NM_DEVICE_STATE_REASON_USER_REQUESTED : 185 _("A user or client requested the disconnection."), 186 NM_DEVICE_STATE_REASON_CARRIER : 187 _("The device's carrier/link changed.") 188 } 189 57 190 NM_802_11_AP_FLAGS_NONE = 0x00000000 58 191 NM_802_11_AP_FLAGS_PRIVACY = 0x00000001 59 192 … … class NMSettingsConnection(dbus.service.Object): 444 577 def GetSecrets(self, setting_name, hints, request_new, reply, error): 445 578 logging.debug('Secrets requested for connection %s request_new=%s', 446 579 self.path, request_new) 447 if request_new or self._secrets is None: 448 # request_new is for example the case when the pw on the AP changes 449 response = SecretsResponse(self, reply, error) 450 try: 451 self.secrets_request.send(self, response=response) 452 except Exception: 453 logging.exception('Error requesting the secrets via dialog') 454 else: 455 reply(self._secrets.get_dict()) 456 457 580 if self._settings.connection.type is not 'gsm': 581 if request_new or self._secrets is None: 582 # request_new is for example the case when the pw on the AP changes 583 response = SecretsResponse(self, reply, error) 584 try: 585 self.secrets_request.send(self, response=response) 586 except Exception: 587 logging.exception('Error requesting the secrets via dialog') 588 else: 589 reply(self._secrets.get_dict()) 590 else: 591 if not request_new: 592 reply(self._secrets.get_dict()) 593 else: 594 raise Exception('The stored GSM secret has already been supplied ') 595 458 596 class AccessPoint(gobject.GObject): 459 597 __gsignals__ = { 460 598 'props-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,