diff --git a/pysollib/actions.py b/pysollib/actions.py index ce7a9d81..65899f30 100644 --- a/pysollib/actions.py +++ b/pysollib/actions.py @@ -780,7 +780,14 @@ class PysolMenubar(PysolMenubarTk): def mOptPlayerOptions(self, *args): if self._cancelDrag(break_pause=False): return + wasPaused = False + if not self.game.pause: + self.game.doPause() + wasPaused = True d = PlayerOptionsDialog(self.top, _("Set player options"), self.app) + if self.game.pause: + if wasPaused: + self.game.doPause() if d.status == 0 and d.button == 0: self.app.opt.confirm = bool(d.confirm) self.app.opt.update_player_stats = bool(d.update_stats) @@ -797,7 +804,14 @@ class PysolMenubar(PysolMenubarTk): def mOptColors(self, *args): if self._cancelDrag(break_pause=False): return + wasPaused = False + if not self.game.pause: + self.game.doPause() + wasPaused = True d = ColorsDialog(self.top, _("Set colors"), self.app) + if self.game.pause: + if wasPaused: + self.game.doPause() text_color = self.app.opt.colors['text'] if d.status == 0 and d.button == 0: self.app.opt.colors['text'] = d.text_color @@ -815,7 +829,14 @@ class PysolMenubar(PysolMenubarTk): def mOptFonts(self, *args): if self._cancelDrag(break_pause=False): return + wasPaused = False + if not self.game.pause: + self.game.doPause() + wasPaused = True d = FontsDialog(self.top, _("Set fonts"), self.app) + if self.game.pause: + if wasPaused: + self.game.doPause() if d.status == 0 and d.button == 0: self.app.opt.fonts.update(d.fonts) self._cancelDrag() @@ -825,7 +846,14 @@ class PysolMenubar(PysolMenubarTk): def mOptTimeouts(self, *args): if self._cancelDrag(break_pause=False): return + wasPaused = False + if not self.game.pause: + self.game.doPause() + wasPaused = True d = TimeoutsDialog(self.top, _("Set timeouts"), self.app) + if self.game.pause: + if wasPaused: + self.game.doPause() if d.status == 0 and d.button == 0: self.app.opt.timeouts['demo'] = d.demo_timeout self.app.opt.timeouts['hint'] = d.hint_timeout diff --git a/pysollib/app.py b/pysollib/app.py index 3ddb1650..3e15c22f 100644 --- a/pysollib/app.py +++ b/pysollib/app.py @@ -971,9 +971,16 @@ class Application: 'correct_type': t[0]}, strings=(_("&OK"),), default=0) def selectCardset(self, title, key): + wasPaused = False + if not self.game.pause: + self.game.doPause() + wasPaused = True d = SelectCardsetDialogWithPreview( self.top, title=title, app=self, manager=self.cardset_manager, key=key) + if self.game.pause: + if wasPaused: + self.game.doPause() cs = self.cardset_manager.get(d.key) if d.status != 0 or d.button != 0 or d.key < 0 or cs is None: return None diff --git a/pysollib/ui/tktile/menubar.py b/pysollib/ui/tktile/menubar.py index d28292d6..402b4a6e 100644 --- a/pysollib/ui/tktile/menubar.py +++ b/pysollib/ui/tktile/menubar.py @@ -279,6 +279,9 @@ class PysolMenubarTkCommon: self._createMenubar() self.top = top + # Sometimes, this needs to be tracked between methods + self.wasPaused = False + if self.progress: self.progress.update(step=1) @@ -1251,6 +1254,10 @@ class PysolMenubarTkCommon: self.tkopt.gameid_popular.set(self.game.id) def _mSelectGameDialog(self, d): + if self.game.pause: + if self.wasPaused: + self.game.resizeGame() + self.game.doPause() if d.status == 0 and d.button == 0 and d.gameid != self.game.id: self.tkopt.gameid.set(d.gameid) self.tkopt.gameid_popular.set(d.gameid) @@ -1287,6 +1294,10 @@ class PysolMenubarTkCommon: bookmark = self.game.gsaveinfo.bookmarks[-2][0] del self.game.gsaveinfo.bookmarks[-2] after_idle(self.top, self.__restoreCursor) + self.wasPaused = False + if not self.game.pause: + self.game.doPause() + self.wasPaused = True d = self._calcSelectGameDialogWithPreview()( self.top, title=_("Select game"), app=self.app, gameid=self.game.id, @@ -1594,8 +1605,15 @@ Unsupported game for import. def mOptSoundDialog(self, *args): if self._cancelDrag(break_pause=False): return + wasPaused = False + if not self.game.pause: + self.game.doPause() + wasPaused = True self._calcSoundOptionsDialog()( self.top, _("Sound settings"), self.app) + if self.game.pause: + if wasPaused: + self.game.doPause() self.tkopt.sound.set(self.app.opt.sound) def mOptAutoFaceUp(self, *args): @@ -1935,11 +1953,18 @@ Unsupported game for import. key = self.app.tabletile_index if key <= 0: key = self.app.opt.colors['table'] # .lower() + wasPaused = False + if not self.game.pause: + self.game.doPause() + wasPaused = True d = self._calcSelectTileDialogWithPreview()( self.top, app=self.app, title=_("Select table background"), manager=self.app.tabletile_manager, key=key) + if self.game.pause: + if wasPaused: + self.game.doPause() if d.status == 0 and d.button == 0: if isinstance(d.key, str): tile = self.app.tabletile_manager.get(0) @@ -2169,6 +2194,10 @@ Unsupported game for import. self.game.quitGame(bookmark=1) def wizardDialog(self, edit=False): + wasPaused = False + if not self.game.pause: + self.game.doPause() + wasPaused = True from pysollib.wizardutil import write_game, reset_wizard WizardDialog = self._calcWizardDialog() @@ -2177,6 +2206,9 @@ Unsupported game for import. else: reset_wizard(None) d = WizardDialog(self.top, _('Solitaire Wizard'), self.app) + if self.game.pause: + if wasPaused: + self.game.doPause() if d.status == 0 and d.button == 0: try: if edit: