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:
parent
e64a85ba36
commit
896454d1e4
3 changed files with 22 additions and 1 deletions
|
@ -77,6 +77,7 @@ class PysolMenubar(PysolMenubarTk):
|
||||||
quickplay=0,
|
quickplay=0,
|
||||||
demo=0,
|
demo=0,
|
||||||
highlight_piles=0,
|
highlight_piles=0,
|
||||||
|
autoscale=0,
|
||||||
find_card=0,
|
find_card=0,
|
||||||
rules=0,
|
rules=0,
|
||||||
pause=0,
|
pause=0,
|
||||||
|
@ -151,6 +152,8 @@ class PysolMenubar(PysolMenubarTk):
|
||||||
ms.quickplay = 1
|
ms.quickplay = 1
|
||||||
if opt.highlight_piles and game.getHighlightPilesStacks():
|
if opt.highlight_piles and game.getHighlightPilesStacks():
|
||||||
ms.highlight_piles = 1
|
ms.highlight_piles = 1
|
||||||
|
if opt.auto_scale:
|
||||||
|
ms.autoscale = 1
|
||||||
if game.canFindCard():
|
if game.canFindCard():
|
||||||
ms.find_card = 1
|
ms.find_card = 1
|
||||||
if game.app.getGameRulesFilename(game.id): # note: this may return ""
|
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.autodrop, "options.automaticplay.autodrop")
|
||||||
self.setMenuState(ms.autodeal, "options.automaticplay.autodeal")
|
self.setMenuState(ms.autodeal, "options.automaticplay.autodeal")
|
||||||
self.setMenuState(ms.quickplay, "options.automaticplay.quickplay")
|
self.setMenuState(ms.quickplay, "options.automaticplay.quickplay")
|
||||||
|
self.setMenuState(ms.autoscale, "options.cardsize.preserveaspectratio")
|
||||||
# Help menu
|
# Help menu
|
||||||
self.setMenuState(ms.rules, "help.rulesforthisgame")
|
self.setMenuState(ms.rules, "help.rulesforthisgame")
|
||||||
# Toolbar
|
# Toolbar
|
||||||
|
|
|
@ -95,6 +95,7 @@ class PysolMenubarTk(PysolMenubarTkCommon):
|
||||||
self._cancelDrag()
|
self._cancelDrag()
|
||||||
self.game.endGame(bookmark=1)
|
self.game.endGame(bookmark=1)
|
||||||
self.game.quitGame(bookmark=1)
|
self.game.quitGame(bookmark=1)
|
||||||
|
self.updateMenus()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tile (ttk)
|
# Tile (ttk)
|
||||||
|
|
|
@ -172,6 +172,7 @@ class PysolMenubarTkCommon:
|
||||||
accordion_deal_all=tkinter.BooleanVar(),
|
accordion_deal_all=tkinter.BooleanVar(),
|
||||||
sound=tkinter.BooleanVar(),
|
sound=tkinter.BooleanVar(),
|
||||||
auto_scale=tkinter.BooleanVar(),
|
auto_scale=tkinter.BooleanVar(),
|
||||||
|
preserve_aspect_ratio=tkinter.BooleanVar(),
|
||||||
spread_stacks=tkinter.BooleanVar(),
|
spread_stacks=tkinter.BooleanVar(),
|
||||||
center_layout=tkinter.BooleanVar(),
|
center_layout=tkinter.BooleanVar(),
|
||||||
cardback=tkinter.IntVar(),
|
cardback=tkinter.IntVar(),
|
||||||
|
@ -226,6 +227,7 @@ class PysolMenubarTkCommon:
|
||||||
tkopt.accordion_deal_all.set(opt.accordion_deal_all)
|
tkopt.accordion_deal_all.set(opt.accordion_deal_all)
|
||||||
tkopt.sound.set(opt.sound)
|
tkopt.sound.set(opt.sound)
|
||||||
tkopt.auto_scale.set(opt.auto_scale)
|
tkopt.auto_scale.set(opt.auto_scale)
|
||||||
|
tkopt.preserve_aspect_ratio.set(opt.preserve_aspect_ratio)
|
||||||
tkopt.spread_stacks.set(opt.spread_stacks)
|
tkopt.spread_stacks.set(opt.spread_stacks)
|
||||||
tkopt.center_layout.set(opt.center_layout)
|
tkopt.center_layout.set(opt.center_layout)
|
||||||
tkopt.cardback.set(self.app.cardset.backindex)
|
tkopt.cardback.set(self.app.cardset.backindex)
|
||||||
|
@ -522,7 +524,7 @@ class PysolMenubarTkCommon:
|
||||||
variable=self.tkopt.shisen_show_hint,
|
variable=self.tkopt.shisen_show_hint,
|
||||||
command=self.mOptShisenShowHint)
|
command=self.mOptShisenShowHint)
|
||||||
submenu.add_checkbutton(
|
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,
|
variable=self.tkopt.accordion_deal_all,
|
||||||
command=self.mOptAccordionDealAll)
|
command=self.mOptAccordionDealAll)
|
||||||
menu.add_separator()
|
menu.add_separator()
|
||||||
|
@ -541,6 +543,10 @@ class PysolMenubarTkCommon:
|
||||||
submenu.add_checkbutton(
|
submenu.add_checkbutton(
|
||||||
label=n_("&Auto scaling"), variable=self.tkopt.auto_scale,
|
label=n_("&Auto scaling"), variable=self.tkopt.auto_scale,
|
||||||
command=self.mOptAutoScale, accelerator=m+'0')
|
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 = MfxMenu(menu, label=n_("Card la&yout"))
|
||||||
submenu.add_checkbutton(
|
submenu.add_checkbutton(
|
||||||
label=n_("&Spread stacks"), variable=self.tkopt.spread_stacks,
|
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.canvas.setInitialSize(w, h)
|
||||||
self.app.top.wm_geometry("") # cancel user-specified geometry
|
self.app.top.wm_geometry("") # cancel user-specified geometry
|
||||||
# self.app.top.update_idletasks()
|
# self.app.top.update_idletasks()
|
||||||
|
self.updateMenus()
|
||||||
|
|
||||||
def mIncreaseCardset(self, *event):
|
def mIncreaseCardset(self, *event):
|
||||||
if self._cancelDrag(break_pause=True):
|
if self._cancelDrag(break_pause=True):
|
||||||
|
@ -1524,6 +1531,15 @@ Unsupported game for import.
|
||||||
self.tkopt.auto_scale.set(auto_scale)
|
self.tkopt.auto_scale.set(auto_scale)
|
||||||
self._updateCardSize()
|
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):
|
def mOptSpreadStacks(self, *event):
|
||||||
if self._cancelDrag(break_pause=True):
|
if self._cancelDrag(break_pause=True):
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue