Fix an issue with current_tab being locale-dependent

This commit is contained in:
DevilXD committed 2022-12-06 17:57:58 +01:00
1 parent 88736a3791
commit ba2ad2e50d
2 files changed
+40 -4

No files matched your search

+4 -4
View File
@@ -1051,8 +1051,8 @@ class Notebook:
kwargs["sticky"] = "nsew" kwargs["sticky"] = "nsew"
self._nb.add(widget, text=name, **kwargs) self._nb.add(widget, text=name, **kwargs)
def current_tab(self) -> str: def current_tab(self) -> int:
return self._nb.tab("current", "text") return self._nb.index("current")
def add_view_event(self, callback: abc.Callable[[tk.Event[ttk.Notebook]], Any]): def add_view_event(self, callback: abc.Callable[[tk.Event[ttk.Notebook]], Any]):
self._nb.bind("<<NotebookTabChanged>>", callback, True) self._nb.bind("<<NotebookTabChanged>>", callback, True)
@@ -1174,7 +1174,7 @@ class InventoryOverview:
frame.grid_remove() frame.grid_remove()
def _on_tab_switched(self, event: tk.Event[ttk.Notebook]) -> None: 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 # refresh only if we're switching to the tab
self.refresh() self.refresh()
@@ -1297,7 +1297,7 @@ class InventoryOverview:
"frame": campaign_frame, "frame": campaign_frame,
"status": status_label, "status": status_label,
} }
if self._manager.tabs.current_tab() == "Inventory": if self._manager.tabs.current_tab() == 1:
self._update_visibility(campaign) self._update_visibility(campaign)
self._canvas_update() self._canvas_update()
+36
View File
@@ -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