From e279417db3df4788751d478835e26e16d1a04bdc Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sat, 22 Nov 2014 14:16:03 -0800 Subject: [PATCH] Added --front and --height to update GUI --- CHANGES.txt | 2 ++ commands/update_cmd.py | 15 +++++++++++++++ commands/update_gui.py | 11 ++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index d89576c5..b850f88e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,8 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014 v6.0.5 Nov 22 2014 (w/Gamma 1) . (kfsone) Added "import" sub-command for loading 1+ stations from a file +. (kfsone) Added "--height" (-H) option to update GUI +. (kfsone) Added "--front" (-F) to keep the update gui infront of TD . (kfsone) Added Pilot's Federation/Jameson Memorial v6.0.4 Nov 21 2014 (Beta 3.9.1) diff --git a/commands/update_cmd.py b/commands/update_cmd.py index 5f4d3daf..a2d2ee79 100644 --- a/commands/update_cmd.py +++ b/commands/update_cmd.py @@ -57,6 +57,21 @@ default=False, dest='gui', ), + ParseArgument('--height', '-H', + help="[GUI] Specify height of the window", + type=int, + default=800, + ), + ParseArgument('--front', '-F', + help=( + "[GUI] Keep the GUI infront of other windows; " + "this allows you to put the window infront of " + "the game UI if you run the game in windowed mode." + ), + action='store_true', + default=False, + dest='alwaysOnTop', + ), MutuallyExclusiveGroup( ParseArgument('--sublime', help='Like --editor but uses Sublime Text (2 or 3), which is nice.', diff --git a/commands/update_gui.py b/commands/update_gui.py index 8269aff3..8bfe47f1 100644 --- a/commands/update_gui.py +++ b/commands/update_gui.py @@ -17,7 +17,14 @@ class UpdateGUI(tk.Canvas): """ def __init__(self, root, tdb, cmdenv): - super().__init__(root, borderwidth=0, width=500, height=440) + width = cmdenv.width or 512 + height = cmdenv.height or 640 + sticky = 1 if cmdenv.alwaysOnTop else 0 + + super().__init__(root, borderwidth=0, width=width, height=height) + root.geometry("{}x{}-0+0".format( + width+32, height + )) self.root = root self.tdb = tdb @@ -32,6 +39,8 @@ def __init__(self, root, tdb, cmdenv): self.results = None self.headings = [] + root.wm_attributes("-topmost", sticky) + self.bind_all("", self.onMouseWheel) self.vsb = tk.Scrollbar(root, orient="vertical", command=self.yview) self.configure(yscrollcommand=self.vsb.set)