From 0d304b2870c00d75c198dd4e4ad1b0811026253e Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Sun, 6 Apr 2014 11:45:46 -0700 Subject: [PATCH] Auto-save configuration file after an order update As a nice side-effect, get rid of the last CONFIG-SAVE message. Signed-off-by: Sean Robinson --- wifiradar/__init__.py | 9 ++++++++- wifiradar/gui/g2/__init__.py | 2 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/wifiradar/__init__.py b/wifiradar/__init__.py index 8a8c37d..36038f2 100644 --- a/wifiradar/__init__.py +++ b/wifiradar/__init__.py @@ -149,9 +149,16 @@ class Main(object): logger.warning('unrecognized Message: "{}"'.format(msg)) def _profile_order_update(self, profile_order): - """ + """ Update the auto profile order in the configuration. + :data:`profile_order` is a list of profile names, in order. """ self.config.auto_profile_order = profile_order + try: + self.config.write() + except IOError as e: + self.msg_pipe.send(Message('ERROR', + 'Could not save configuration file:\n' + + '{}\n\n{}'.format(self.config.filename, e.strerror))) def _profile_edit_request(self, essid, bssid): """ Send a message with a profile to be edited. If a profile with diff --git a/wifiradar/gui/g2/__init__.py b/wifiradar/gui/g2/__init__.py index b6cc7ce..d9fe86d 100644 --- a/wifiradar/gui/g2/__init__.py +++ b/wifiradar/gui/g2/__init__.py @@ -636,8 +636,6 @@ class RadarWindow: auto_profile_order = [] self.pstore.foreach(self.profile_order_updater, auto_profile_order) self.msg_pipe.send(Message('PROFILE-ORDER-UPDATE', auto_profile_order)) - # Request saving the configuration file after the update. - self.msg_pipe.send(Message('CONFIG-SAVE', '')) # Make so we can be imported -- 2.11.4.GIT