From 88345d7b53c05a01b35d10ff4383c56e902bbc50 Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Sun, 6 Apr 2014 14:11:47 -0700 Subject: [PATCH] Split row changing code to _update_row method Signed-off-by: Sean Robinson --- wifiradar/gui/g2/__init__.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/wifiradar/gui/g2/__init__.py b/wifiradar/gui/g2/__init__.py index f7c557b..8ab3386 100644 --- a/wifiradar/gui/g2/__init__.py +++ b/wifiradar/gui/g2/__init__.py @@ -430,18 +430,7 @@ class RadarWindow: 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']) + self._update_row(profile, prow_iter) def _add_profile(self, profile): """ Add :data:`profile` to the list of APs shown to the user. @@ -458,6 +447,23 @@ class RadarWindow: wep, signal_none_pb, profile['mode'], profile['protocol'], profile['channel']]) + def _update_row(self, profile, row_iter): + """ Change the values displayed in :data:`row_iter` (a + :class:`gtk.TreeIter`) using :data:`profile`. + """ + wep = None + if profile['encrypted']: + wep = gtk.STOCK_DIALOG_AUTHENTICATION + # Update the Gtk objects. + self.pstore.set_value(row_iter, 2, pixbuf_from_known(profile['known'])) + self.pstore.set_value(row_iter, 3, profile['known']) + self.pstore.set_value(row_iter, 4, profile['available']) + self.pstore.set_value(row_iter, 5, wep) + self.pstore.set_value(row_iter, 6, pixbuf_from_signal(profile['signal'])) + self.pstore.set_value(row_iter, 7, profile['mode']) + self.pstore.set_value(row_iter, 8, profile['protocol']) + self.pstore.set_value(row_iter, 9, profile['channel']) + def create_new_profile(self, widget=None, profile=None, data=None): """ Respond to a user request to create a new AP profile. :data:`widget` is the widget sending the signal. :data:profile` -- 2.11.4.GIT