diff --git a/pysollib/actions.py b/pysollib/actions.py index b1510860..14a8d994 100644 --- a/pysollib/actions.py +++ b/pysollib/actions.py @@ -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 diff --git a/pysollib/tile/menubar.py b/pysollib/tile/menubar.py index 76fb1434..7765fff2 100644 --- a/pysollib/tile/menubar.py +++ b/pysollib/tile/menubar.py @@ -95,6 +95,7 @@ class PysolMenubarTk(PysolMenubarTkCommon): self._cancelDrag() self.game.endGame(bookmark=1) self.game.quitGame(bookmark=1) + self.updateMenus() # # Tile (ttk) diff --git a/pysollib/ui/tktile/menubar.py b/pysollib/ui/tktile/menubar.py index ba1a46c6..03e5ee8a 100644 --- a/pysollib/ui/tktile/menubar.py +++ b/pysollib/ui/tktile/menubar.py @@ -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