Skip to content

Commit

Permalink
Add fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Oct 30, 2024
1 parent f448248 commit d0ca03a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions html-src/howtoplay.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,5 @@ <h2>Undocumented key bindings</h2>
<li> <i>Ctrl-U</i> - Play the next music song
<li> <i>Ctrl-W</i> - Select game, using old game select window
<li> <i>F5</i> - Refresh the game layout
<li> <i>F11</i> - Toggle fullscreen display
</ul>
4 changes: 4 additions & 0 deletions pysollib/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,10 @@ def wm_withdraw(self):
wm_withdraw(self.top)
self.top.busyUpdate()

def wm_toggle_fullscreen(self):
self.opt.wm_fullscreen = not self.opt.wm_fullscreen
self.top.attributes("-fullscreen", self.opt.wm_fullscreen)

def loadImages1(self):
# load dialog images
dirname = os.path.join("images", "logos")
Expand Down
2 changes: 2 additions & 0 deletions pysollib/game/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@ def newGame(self, random=None, restart=0, autoplay=1, shuffle=True,
# unhide toplevel when we use a progress bar
if not self.preview:
wm_map(self.top, maximized=self.app.opt.wm_maximized)
self.top.attributes('-fullscreen', self.app.opt.wm_fullscreen)
self.top.busyUpdate()
if TOOLKIT == 'gtk':
# FIXME
Expand Down Expand Up @@ -910,6 +911,7 @@ def restoreGame(self, game, reset=1):
if not self.preview:
self.updateMenus()
wm_map(self.top, maximized=self.app.opt.wm_maximized)
self.top.attributes('-fullscreen', self.app.opt.wm_fullscreen)
self.setCursor(cursor=self.app.top_cursor)
self.stats.update_time = time.time()
self.busy = old_busy
Expand Down
3 changes: 3 additions & 0 deletions pysollib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def calcCustomMouseButtonsBinding(binding_format):
last_gameid = integer
game_holded = integer
wm_maximized = boolean
wm_fullscreen = boolean
splashscreen = boolean
date_format = string
mouse_type = string
Expand Down Expand Up @@ -287,6 +288,7 @@ class Options:
('last_gameid', 'int'),
('game_holded', 'int'),
('wm_maximized', 'bool'),
('wm_fullscreen', 'bool'),
('splashscreen', 'bool'),
('date_format', 'str'),
('mouse_type', 'str'),
Expand Down Expand Up @@ -490,6 +492,7 @@ def __init__(self):
self.last_gameid = 0 # last game played
self.game_holded = 0 # gameid or 0
self.wm_maximized = 1
self.wm_fullscreen = 0
self.save_games_geometry = False
# saved games geometry (gameid: (width, height))
self.games_geometry = {}
Expand Down
4 changes: 4 additions & 0 deletions pysollib/ui/tktile/menubar.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ def _createMenubar(self):
self._bindKey(ctrl, "Down", self.mSelectNextGameById)

self._bindKey("", "F5", self.refresh)
self._bindKey("", "F11", self.togglefullscreen)

if os.name == 'posix' and platform.system() != 'Darwin':
self._bindKey('Alt-', 'F4', self.mQuit)
Expand Down Expand Up @@ -2030,6 +2031,9 @@ def refresh(self, *event):
self.game.endGame(bookmark=1)
self.game.quitGame(bookmark=1)

def togglefullscreen(self, *event):
self.app.wm_toggle_fullscreen()

#
# toolbar support
#
Expand Down

0 comments on commit d0ca03a

Please sign in to comment.