1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Added Preserve aspect ratio option to the menu.

This commit is contained in:
Joe R 2021-08-05 17:29:15 -04:00
parent e64a85ba36
commit 896454d1e4
3 changed files with 22 additions and 1 deletions

View file

@ -77,6 +77,7 @@ class PysolMenubar(PysolMenubarTk):
quickplay=0,
demo=0,
highlight_piles=0,
autoscale=0,
find_card=0,
rules=0,
pause=0,
@ -151,6 +152,8 @@ class PysolMenubar(PysolMenubarTk):
ms.quickplay = 1
if opt.highlight_piles and game.getHighlightPilesStacks():
ms.highlight_piles = 1
if opt.auto_scale:
ms.autoscale = 1
if game.canFindCard():
ms.find_card = 1
if game.app.getGameRulesFilename(game.id): # note: this may return ""
@ -196,6 +199,7 @@ class PysolMenubar(PysolMenubarTk):
self.setMenuState(ms.autodrop, "options.automaticplay.autodrop")
self.setMenuState(ms.autodeal, "options.automaticplay.autodeal")
self.setMenuState(ms.quickplay, "options.automaticplay.quickplay")
self.setMenuState(ms.autoscale, "options.cardsize.preserveaspectratio")
# Help menu
self.setMenuState(ms.rules, "help.rulesforthisgame")
# Toolbar

View file

@ -95,6 +95,7 @@ class PysolMenubarTk(PysolMenubarTkCommon):
self._cancelDrag()
self.game.endGame(bookmark=1)
self.game.quitGame(bookmark=1)
self.updateMenus()
#
# Tile (ttk)

View file

@ -172,6 +172,7 @@ class PysolMenubarTkCommon:
accordion_deal_all=tkinter.BooleanVar(),
sound=tkinter.BooleanVar(),
auto_scale=tkinter.BooleanVar(),
preserve_aspect_ratio=tkinter.BooleanVar(),
spread_stacks=tkinter.BooleanVar(),
center_layout=tkinter.BooleanVar(),
cardback=tkinter.IntVar(),
@ -226,6 +227,7 @@ class PysolMenubarTkCommon:
tkopt.accordion_deal_all.set(opt.accordion_deal_all)
tkopt.sound.set(opt.sound)
tkopt.auto_scale.set(opt.auto_scale)
tkopt.preserve_aspect_ratio.set(opt.preserve_aspect_ratio)
tkopt.spread_stacks.set(opt.spread_stacks)
tkopt.center_layout.set(opt.center_layout)
tkopt.cardback.set(self.app.cardset.backindex)
@ -522,7 +524,7 @@ class PysolMenubarTkCommon:
variable=self.tkopt.shisen_show_hint,
command=self.mOptShisenShowHint)
submenu.add_checkbutton(
label=n_("Deal all cards (in Accordion type games)"),
label=n_("&Deal all cards (in Accordion type games)"),
variable=self.tkopt.accordion_deal_all,
command=self.mOptAccordionDealAll)
menu.add_separator()
@ -541,6 +543,10 @@ class PysolMenubarTkCommon:
submenu.add_checkbutton(
label=n_("&Auto scaling"), variable=self.tkopt.auto_scale,
command=self.mOptAutoScale, accelerator=m+'0')
submenu.add_checkbutton(
label=n_("&Preserve aspect ratio"),
variable=self.tkopt.preserve_aspect_ratio,
command=self.mOptPreserveAspectRatio)
submenu = MfxMenu(menu, label=n_("Card la&yout"))
submenu.add_checkbutton(
label=n_("&Spread stacks"), variable=self.tkopt.spread_stacks,
@ -1479,6 +1485,7 @@ Unsupported game for import.
self.app.canvas.setInitialSize(w, h)
self.app.top.wm_geometry("") # cancel user-specified geometry
# self.app.top.update_idletasks()
self.updateMenus()
def mIncreaseCardset(self, *event):
if self._cancelDrag(break_pause=True):
@ -1524,6 +1531,15 @@ Unsupported game for import.
self.tkopt.auto_scale.set(auto_scale)
self._updateCardSize()
def mOptPreserveAspectRatio(self, *event):
if self._cancelDrag(break_pause=True):
return
preserve_aspect_ratio = not self.app.opt.preserve_aspect_ratio
self.app.opt.preserve_aspect_ratio = preserve_aspect_ratio
self.tkopt.preserve_aspect_ratio.set(preserve_aspect_ratio)
self._updateCardSize()
def mOptSpreadStacks(self, *event):
if self._cancelDrag(break_pause=True):
return