Skip to content

Commit

Permalink
Version 2.4.44.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSpen210 committed Dec 31, 2023
2 parents 0928dac + 921ca14 commit 411434c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

# Version 4.44.1

* Fix add-game prompt failing to appear if installed fresh.
* Remove some now-outdated splash screens.

------------------------------------------

# Version 4.44.0

### Enhancements:
Expand Down
Binary file removed images/splash_screen/abandoned-testing-track.jpg
Binary file not shown.
Binary file removed images/splash_screen/recursion.jpg
Binary file not shown.
8 changes: 8 additions & 0 deletions src/app/tk_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,14 @@ def center_win(window: Union[tk.Tk, tk.Toplevel], parent: Union[tk.Tk, tk.Toplev
window.geometry(f'+{x}+{y}')


def center_onscreen(window: Union[tk.Tk, tk.Toplevel]) -> None:
"""Center a window onscreen."""
x = (window.winfo_screenwidth() - window.winfo_width()) // 2
y = (window.winfo_screenheight() - window.winfo_height()) // 2

window.geometry(f'+{x}+{y}')


def _default_validator(value: str) -> str:
if not value.strip():
raise ValueError("A value must be provided!")
Expand Down
8 changes: 7 additions & 1 deletion src/ui_tk/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from loadScreen import suppress_screens
from app.dialogs import DEFAULT_TITLE, Dialogs, Icon, validate_non_empty
from app.errors import AppError
from app.tk_tools import set_window_icon
from app.tk_tools import set_window_icon, center_onscreen
from transtoken import TransToken

from app import TK_ROOT
Expand Down Expand Up @@ -240,6 +240,12 @@ async def prompt(
else:
query_cls = QueryValidator
win = query_cls(self.parent, title, message, initial_value, validator)

if self.parent is TK_ROOT:
# Force to be centered and visible - the root might be hidden if doing an early add-game.
TK_ROOT.deiconify()
center_onscreen(win)

await win.wait()
return win.result

Expand Down

0 comments on commit 411434c

Please sign in to comment.