[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] [PATCH 06/12] Fixes Gtk warnings related to xgps/xgpsspeed er
From: |
Fred Wright |
Subject: |
[gpsd-dev] [PATCH 06/12] Fixes Gtk warnings related to xgps/xgpsspeed error boxes. |
Date: |
Fri, 8 Apr 2016 10:07:47 -0700 |
The Gtk MessageDialog function gives a warning if no parent window is
specified. Since the main window already exists in those cases, it's
simply a matter of passing the extra argument to MessageDialog.
This has the side effect of changing the position of the dialog box,
such that it's centered over the parent window rather than being near
its upper left-hand corner. In the xgps case, it appears to be
centered over whichever subwindow was most recently updated.
TESTED:
Verified that both the gpsd not running and gpsd stopped running cases
no longer produce warning messages on the terminal.
---
xgps | 6 ++++--
xgpsspeed | 2 ++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/xgps b/xgps
index 79fd3fb..62cdb3a 100755
--- a/xgps
+++ b/xgps
@@ -850,7 +850,8 @@ class Base:
def handle_hangup(self, _source, _condition):
"Handle hangup condition from the daemon."
- w = Gtk.MessageDialog(type=Gtk.MessageType.ERROR,
+ w = Gtk.MessageDialog(parent=self.window,
+ type=Gtk.MessageType.ERROR,
flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
buttons=Gtk.ButtonsType.CANCEL)
w.connect("destroy", lambda _unused: Gtk.main_quit())
@@ -908,7 +909,8 @@ if __name__ == "__main__":
base.watch(daemon, device)
base.main()
except socket.error:
- w = Gtk.MessageDialog(type=Gtk.MessageType.ERROR,
+ w = Gtk.MessageDialog(parent=base.window,
+ type=Gtk.MessageType.ERROR,
flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
buttons=Gtk.ButtonsType.CANCEL)
w.set_markup("gpsd is not running.")
diff --git a/xgpsspeed b/xgpsspeed
index 1a47b3e..b0dda09 100755
--- a/xgpsspeed
+++ b/xgpsspeed
@@ -608,6 +608,7 @@ class Main(object):
def handle_hangup(self, _dummy, _unused):
w = Gtk.MessageDialog(
+ parent=self.window,
type=Gtk.MessageType.ERROR,
flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
buttons=Gtk.ButtonsType.OK
@@ -653,6 +654,7 @@ class Main(object):
Gtk.main()
except SocketError:
w = Gtk.MessageDialog(
+ parent=self.window,
type=Gtk.MessageType.ERROR,
flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
buttons=Gtk.ButtonsType.OK
--
2.8.0
- [gpsd-dev] Python 3 Updates, Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 01/12] Fixes Python C extensions for Python 3 compatibility., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 02/12] Fixes fake.py 'packet' import for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 04/12] Fixes xgps for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 05/12] Fixes a client.py exception for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 06/12] Fixes Gtk warnings related to xgps/xgpsspeed error boxes.,
Fred Wright <=
- [gpsd-dev] [PATCH 07/12] Changes type checks in misc.py:isotime to use isinstance()., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 03/12] Forces Python 3 import behavior in all gps/* modules., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 09/12] Fixes gpscat and test_maidenhead.py for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 08/12] Removes unnecessary Unicode literal from xgps., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 10/12] Fixes fake.py and gpsfake for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 12/12] Removes redundant polystr/polybytes defs from client.py., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 11/12] Adds "target Python" support to SConstruct., Fred Wright, 2016/04/08
- Re: [gpsd-dev] Python 3 Updates, Gary E. Miller, 2016/04/08
- Re: [gpsd-dev] Python 3 Updates, Eric S. Raymond, 2016/04/09