From 759095bf9508784cb57eedd3b026793c1411cc92 Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Sun, 6 Apr 2014 14:02:11 -0700 Subject: [PATCH] Move update_plist_items to update_profile This brings the method name in line with other related methods (e.g. edit_profile) and moves it nearer to other profile methods. Signed-off-by: Sean Robinson --- wifiradar/gui/g2/__init__.py | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/wifiradar/gui/g2/__init__.py b/wifiradar/gui/g2/__init__.py index 03da2ef..f7c557b 100644 --- a/wifiradar/gui/g2/__init__.py +++ b/wifiradar/gui/g2/__init__.py @@ -272,7 +272,7 @@ class RadarWindow: self.edit_profile(msg.details) elif msg.topic == 'PROFILE-UPDATE': with gtk.gdk.lock: - self.update_plist_items(msg.details) + self.update_profile(msg.details) elif msg.topic == 'PROFILE-UNLIST': with gtk.gdk.lock: self.delete_profile(msg.details) @@ -339,32 +339,6 @@ class RadarWindow: self.disconnect_button.hide() self.connect_button.show() - def update_plist_items(self, profile): - """ Updates the display of :data:`profile`. - """ - if profile['roaming']: - prow_iter = self.get_row_by_ap(profile['essid']) - else: - prow_iter = self.get_row_by_ap(profile['essid'], profile['bssid']) - - if prow_iter is None: - # the AP is not in the list of APs on the screen - self.add_profile(profile) - else: - # the AP is in the list of APs on the screen - wep = None - if profile['encrypted']: - wep = gtk.STOCK_DIALOG_AUTHENTICATION - # Update the Gtk objects. - self.pstore.set_value(prow_iter, 2, pixbuf_from_known(profile['known'])) - self.pstore.set_value(prow_iter, 3, profile['known']) - self.pstore.set_value(prow_iter, 4, profile['available']) - self.pstore.set_value(prow_iter, 5, wep) - self.pstore.set_value(prow_iter, 6, pixbuf_from_signal(profile['signal'])) - self.pstore.set_value(prow_iter, 7, profile['mode']) - self.pstore.set_value(prow_iter, 8, profile['protocol']) - self.pstore.set_value(prow_iter, 9, profile['channel']) - def _set_ap_col_value(self, column, cell, model, iter): """ Set the text attribute of :data:`column` to the first two :data:`model` values joined by a newline. This is for @@ -443,6 +417,32 @@ class RadarWindow: config.raw = False self.msg_pipe.send(Message('PREFS-UPDATE', config)) + def update_profile(self, profile): + """ Updates the display of :data:`profile`. + """ + if profile['roaming']: + prow_iter = self.get_row_by_ap(profile['essid']) + else: + prow_iter = self.get_row_by_ap(profile['essid'], profile['bssid']) + + if prow_iter is None: + # the AP is not in the list of APs on the screen + self._add_profile(profile) + else: + # the AP is in the list of APs on the screen + wep = None + if profile['encrypted']: + wep = gtk.STOCK_DIALOG_AUTHENTICATION + # Update the Gtk objects. + self.pstore.set_value(prow_iter, 2, pixbuf_from_known(profile['known'])) + self.pstore.set_value(prow_iter, 3, profile['known']) + self.pstore.set_value(prow_iter, 4, profile['available']) + self.pstore.set_value(prow_iter, 5, wep) + self.pstore.set_value(prow_iter, 6, pixbuf_from_signal(profile['signal'])) + self.pstore.set_value(prow_iter, 7, profile['mode']) + self.pstore.set_value(prow_iter, 8, profile['protocol']) + self.pstore.set_value(prow_iter, 9, profile['channel']) + def _add_profile(self, profile): """ Add :data:`profile` to the list of APs shown to the user. """ -- 2.11.4.GIT