diff options
author | Fred Wright <fw@fwright.net> | 2016-11-26 17:20:41 -0800 |
---|---|---|
committer | Jon Schlueter <jon.schlueter@gmail.com> | 2016-12-18 22:27:55 -0500 |
commit | 116c0b548aa8ce5430c9f19a40534b1056268f5b (patch) | |
tree | 105abf8b2b810a0018c0ac64f71c993ba09098a7 /xgps | |
parent | 40b8f6657f3766926900c7c552b0c25972d0230a (diff) | |
download | gpsd-116c0b548aa8ce5430c9f19a40534b1056268f5b.tar.gz |
Tweaks xgps and xgpsspeed UIs.
This makes a couple of minor improvements to the xgps[speed] UIs:
1) If a target (host/port/device) is specified, it is included in the
window title. This is especially useful when running multiple
instances pointing at different targets.
2) Interprets blank host and/or port fields in host:port:device
notation as the default values. This allows, e.g., specifying a
device without having to explicitly specify the default host/port.
Also replaces all hardcoded '2947' instances with gps.GPSD_PORT.
TESTED:
Tried various arguments, including using the option forms in
xgpsspeed. Also tried a long string of leading zeroes on the port
number to verify that a ridiculously long target string is taken in
stride.
Diffstat (limited to 'xgps')
-rwxr-xr-x | xgps | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -462,7 +462,7 @@ class Base(object): ("EPD", lambda s, r: s.update_err_degrees(r, "epd")), ) - def __init__(self, deg_type, rotate=0.0): + def __init__(self, deg_type, rotate=0.0, target=[]): self.deg_type = deg_type self.rotate = rotate self.conversions = unit_adjustments() @@ -473,7 +473,7 @@ class Base(object): self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL) if not self.window.get_display(): raise Exception("Can't open display") - self.window.set_title("xgps") + self.window.set_title(" ".join(["xgps"] + target)) self.window.connect("delete_event", self.delete_event) self.window.set_resizable(False) @@ -901,17 +901,20 @@ if __name__ == "__main__": 'm': gps.clienthelpers.deg_ddmm, 's': gps.clienthelpers.deg_ddmmss}[degreefmt] - (host, port, device) = ("localhost", "2947", None) + (host, port, device) = ("localhost", gps.GPSD_PORT, None) if len(arguments): args = arguments[0].split(":") - if len(args) >= 1: + if len(args) >= 1 and args[0]: host = args[0] - if len(args) >= 2: + if len(args) >= 2 and args[1]: port = args[1] if len(args) >= 3: device = args[2] + target = arguments[0:] + else: + target = [] - base = Base(deg_type=degreefmt, rotate=rotate) + base = Base(deg_type=degreefmt, rotate=rotate, target=target) base.set_units(unit_system) try: daemon = gps.gps(host=host, |