From ba2ad2e50de8d4df13182a3925b267057d355ee0 Mon Sep 17 00:00:00 2001 From: DevilXD Date: Tue, 6 Dec 2022 17:57:58 +0100 Subject: [PATCH] Fix an issue with current_tab being locale-dependent --- gui.py | 8 ++++---- run_dev.bat | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 run_dev.bat diff --git a/gui.py b/gui.py index f12f776..c7453d6 100644 --- a/gui.py +++ b/gui.py @@ -1051,8 +1051,8 @@ class Notebook: kwargs["sticky"] = "nsew" self._nb.add(widget, text=name, **kwargs) - def current_tab(self) -> str: - return self._nb.tab("current", "text") + def current_tab(self) -> int: + return self._nb.index("current") def add_view_event(self, callback: abc.Callable[[tk.Event[ttk.Notebook]], Any]): self._nb.bind("<>", callback, True) @@ -1174,7 +1174,7 @@ class InventoryOverview: frame.grid_remove() def _on_tab_switched(self, event: tk.Event[ttk.Notebook]) -> None: - if self._manager.tabs.current_tab() == "Inventory": + if self._manager.tabs.current_tab() == 1: # refresh only if we're switching to the tab self.refresh() @@ -1297,7 +1297,7 @@ class InventoryOverview: "frame": campaign_frame, "status": status_label, } - if self._manager.tabs.current_tab() == "Inventory": + if self._manager.tabs.current_tab() == 1: self._update_visibility(campaign) self._canvas_update() diff --git a/run_dev.bat b/run_dev.bat new file mode 100644 index 0000000..b2d4e75 --- /dev/null +++ b/run_dev.bat @@ -0,0 +1,36 @@ +@echo off +set /p "choice=Install PyInstaller so you can build an EXEcutable? (y/n) " +set dirpath=%~dp0 +if "%dirpath:~-1%" == "\" set dirpath=%dirpath:~0,-1% +git --version > nul +if %errorlevel% NEQ 0 goto NOGIT +if not exist "%dirpath%\env" ( + echo: + echo Creating the env folder... + python -m venv "%dirpath%\env" + if %errorlevel% NEQ 0 goto NOPYTHON +) +echo: +echo Installing requirements.txt... +"%dirpath%\env\scripts\pip" install wheel +"%dirpath%\env\scripts\pip" install -r "%dirpath%\requirements.txt" +echo: +echo Installing PyInstaller... +if "%choice%" == "y" "%dirpath%\env\scripts\pip" install pyinstaller +"%dirpath%\env\scripts\python" "%dirpath%\env\scripts\pywin32_postinstall.py" -install -silent +goto DONE +:NOPYTHON +echo: +echo No python executable found in path! +pause +goto END +:NOGIT +echo: +echo No git executable found in path! +pause +goto END +:DONE +echo: +echo All done! +pause +:END