diff --git a/dzgui.sh b/dzgui.sh index 16080d6..84b1816 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -691,6 +691,7 @@ get_response_code(){ local url="$1" curl -Ls -I -o /dev/null -w "%{http_code}" "$url" } + fetch_ip_db(){ parse_dl_url(){ curl -Ls "$url" \ diff --git a/helpers/funcs b/helpers/funcs index 8bd58d4..d7f43a2 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -o pipefail + version="6.0.0" #CONSTANTS @@ -396,6 +397,7 @@ get_dist(){ logger INFO "Distance: $dist km" fi } + query_config(){ [[ -n $2 ]] && local key=$2 keys=( @@ -421,6 +423,7 @@ query_config(){ echo "${!i}" done } + align_versions_file(){ shift local mod="$1" @@ -482,6 +485,9 @@ test_cooldown(){ redact(){ sed 's@\(/home/\)[^/]*@\1REDACTED@g' } +redact(){ + sed 's@\(/home/\)[^/]*@\1REDACTED@g' +} logger(){ local date="$(date "+%F %T,%3N")" local tag="$1" diff --git a/helpers/ui.py b/helpers/ui.py index 81aaf3e..62ab55d 100644 --- a/helpers/ui.py +++ b/helpers/ui.py @@ -1343,7 +1343,6 @@ class ScrollableTree(Gtk.ScrolledWindow): self.treeview = TreeView() self.add(self.treeview) - class RightPanel(Gtk.Box): def __init__(self): super().__init__(spacing=6, orientation=Gtk.Orientation.VERTICAL) @@ -2745,7 +2744,8 @@ class TreeView(Gtk.TreeView): if column_title == "Map": column.set_fixed_width(300) - self.append_column(column) + if i != 10: + self.append_column(column) @update_window_labels def _update_multi_column(self, mode: RowType, port: int = 27016) -> None: @@ -4657,6 +4657,7 @@ class App(Gtk.Application): self.win = OuterWindow() self.win.set_icon_name("{app_name_lower}") + accel = Gtk.AccelGroup() accel.connect( Gdk.KEY_q, @@ -4684,6 +4685,35 @@ class App(Gtk.Application): self.win.halt_proc_and_quit() +def save_res_and_quit(window): + if window.props.is_maximized: + Gtk.main_quit() + return + rect = window.get_size() + + def write_json(rect): + data = {"res": { "width": rect.width, "height": rect.height } } + j = json.dumps(data, indent=2) + with open(res_path, "w") as outfile: + outfile.write(j) + logger.info("Wrote initial window size to '%s'" %(res_path)) + + if os.path.isfile(res_path): + with open(res_path, "r") as infile: + try: + data = json.load(infile) + data["res"]["width"] = rect.width + data["res"]["height"] = rect.height + with open(res_path, "w") as outfile: + outfile.write(json.dumps(data, indent=2)) + except json.decoder.JSONDecodeError: + logger.critical("JSON decode error in '%s'" %(res_path)) + write_json(rect) + else: + write_json(rect) + + Gtk.main_quit() + class ModSelectionPanel(Gtk.Box): def __init__(self): super().__init__(spacing=6)