From 1a692068d0b4fa1f0f047631bafc1ffa08e865be Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Sun, 2 Mar 2014 03:05:03 -0700 Subject: [PATCH] Use gtk.gdk.lock context manager in place of threads_(enter|leave) Signed-off-by: Sean Robinson --- wifiradar/gui/g2/__init__.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/wifiradar/gui/g2/__init__.py b/wifiradar/gui/g2/__init__.py index 41bae6b..ac5dc14 100644 --- a/wifiradar/gui/g2/__init__.py +++ b/wifiradar/gui/g2/__init__.py @@ -424,21 +424,18 @@ class RadarWindow: boolean -- always return True """ - # Indicate to PyGtk that only one Gtk thread should run here - gtk.gdk.threads_enter() - self.update_network_info() - self.update_connect_buttons() - while True: - # Get APs scanned by iwlist - try: - ap = self.apQueue.get_nowait() - except Queue.Empty: - break - else: - self.update_ap_list(ap) - self.update_plist_items(ap) - # Allow other Gtk threads to run - gtk.gdk.threads_leave() + with gtk.gdk.lock: + self.update_network_info() + self.update_connect_buttons() + while True: + # Get APs scanned by iwlist + try: + ap = self.apQueue.get_nowait() + except Queue.Empty: + break + else: + self.update_ap_list(ap) + self.update_plist_items(ap) return True def pixbuf_from_known(self, known): -- 2.11.4.GIT