diff --git a/po/de_pysol.po b/po/de_pysol.po index 3358a096..14669003 100644 --- a/po/de_pysol.po +++ b/po/de_pysol.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: PySol 0.0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-12-10 10:19-0500\n" -"PO-Revision-Date: 2022-07-06 18:33-0400\n" +"PO-Revision-Date: 2022-07-17 09:21-0400\n" "Last-Translator: H. Schaekel \n" "Language-Team: German\n" "Language: de\n" @@ -3471,6 +3471,12 @@ msgstr "Bewegungen/total" msgid "Games played: won/lost" msgstr "Gespielt: gewonnen/verloren" +msgid "Number of cards" +msgstr "" + +msgid "Help info" +msgstr "" + #: pysollib/pysolgtk/tkhtml.py:437 pysollib/ui/tktile/tkhtml.py:314 #, python-format msgid "" diff --git a/po/fr_pysol.po b/po/fr_pysol.po index 897a7ee5..3ecf1486 100644 --- a/po/fr_pysol.po +++ b/po/fr_pysol.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 1.02\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-12-10 10:19-0500\n" -"PO-Revision-Date: 2022-07-06 18:33-0400\n" +"PO-Revision-Date: 2022-07-17 09:19-0400\n" "Last-Translator: Eric Rausch \n" "Language-Team: French\n" "Language: fr\n" @@ -3517,6 +3517,12 @@ msgstr "Déplacements/Total déplacements" msgid "Games played: won/lost" msgstr "Jeux finis: gagnés/perdus" +msgid "Number of cards" +msgstr "" + +msgid "Help info" +msgstr "" + #: pysollib/pysolgtk/tkhtml.py:437 pysollib/ui/tktile/tkhtml.py:314 #, python-format msgid "" diff --git a/po/it_pysol.po b/po/it_pysol.po index f08b4bf1..01074655 100644 --- a/po/it_pysol.po +++ b/po/it_pysol.po @@ -12,7 +12,7 @@ msgstr "" "Project-Id-Version: it_pysol\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-12-10 10:19-0500\n" -"PO-Revision-Date: 2022-07-06 18:32-0400\n" +"PO-Revision-Date: 2022-07-17 09:19-0400\n" "Last-Translator: Giuliano Colla \n" "Language-Team: Italiano \n" "Language: it\n" @@ -3578,6 +3578,12 @@ msgstr "Mosse/Mosse totali" msgid "Games played: won/lost" msgstr "Giocati: vinti/perduti" +msgid "Number of cards" +msgstr "" + +msgid "Help info" +msgstr "" + #: pysollib/pysolgtk/tkhtml.py:437 pysollib/ui/tktile/tkhtml.py:314 #, python-format msgid "" diff --git a/po/pl_pysol.po b/po/pl_pysol.po index 1ffb9975..85e9fd10 100644 --- a/po/pl_pysol.po +++ b/po/pl_pysol.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-12-10 10:19-0500\n" -"PO-Revision-Date: 2022-07-06 18:32-0400\n" +"PO-Revision-Date: 2022-07-17 09:19-0400\n" "Last-Translator: Jerzy Trzeciak \n" "Language-Team: Polish \n" "Language: pl\n" @@ -3619,6 +3619,12 @@ msgstr "Ruchy/Ruchy ogółem" msgid "Games played: won/lost" msgstr "Gry rozegrane: wygrane/przegrane" +msgid "Number of cards" +msgstr "" + +msgid "Help info" +msgstr "" + #: pysollib/pysolgtk/tkhtml.py:437 pysollib/ui/tktile/tkhtml.py:314 #, fuzzy, python-format msgid "" diff --git a/po/pysol.pot b/po/pysol.pot index d0da18e4..41e6527c 100644 --- a/po/pysol.pot +++ b/po/pysol.pot @@ -3343,6 +3343,12 @@ msgstr "" msgid "Games played: won/lost" msgstr "" +msgid "Number of cards" +msgstr "" + +msgid "Help info" +msgstr "" + #: pysollib/pysolgtk/tkhtml.py:437 pysollib/ui/tktile/tkhtml.py:314 #, python-format msgid "" diff --git a/po/ru_pysol.po b/po/ru_pysol.po index 8d3a622f..8086bdc6 100644 --- a/po/ru_pysol.po +++ b/po/ru_pysol.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-12-10 10:19-0500\n" -"PO-Revision-Date: 2022-07-06 18:31-0400\n" +"PO-Revision-Date: 2022-07-17 09:18-0400\n" "Last-Translator: Skomoroh \n" "Language-Team: Russian \n" "Language: ru\n" @@ -3589,6 +3589,12 @@ msgstr "Ходов/Всего ходов" msgid "Games played: won/lost" msgstr "Игр: выиграно/проиграно" +msgid "Number of cards" +msgstr "" + +msgid "Help info" +msgstr "" + #: pysollib/pysolgtk/tkhtml.py:437 pysollib/ui/tktile/tkhtml.py:314 #, python-format msgid "" diff --git a/pysollib/app.py b/pysollib/app.py index 3cb0e439..3a126b52 100644 --- a/pysollib/app.py +++ b/pysollib/app.py @@ -46,7 +46,7 @@ from pysollib.mygettext import _ from pysollib.options import Options from pysollib.pysolrandom import PysolRandom, construct_random from pysollib.pysoltk import HTMLViewer -from pysollib.pysoltk import HelpStatusbar, PysolStatusbar +from pysollib.pysoltk import PysolStatusbar from pysollib.pysoltk import MfxDialog, MfxExceptionDialog, MfxMessageDialog from pysollib.pysoltk import MfxScrolledCanvas, TclError from pysollib.pysoltk import PysolProgressBar @@ -356,10 +356,8 @@ class Application: # create the statusbar(s) self.statusbar = PysolStatusbar(self.top) self.statusbar.show(self.opt.statusbar) - self.statusbar.config('gamenumber', self.opt.statusbar_game_number) - self.statusbar.config('stuck', self.opt.statusbar_stuck) - self.helpbar = HelpStatusbar(self.top) - self.helpbar.show(self.opt.helpbar) + for w, v in self.opt.statusbar_vars.items(): + self.statusbar.config(w, v) # create the canvas self.scrolled_canvas = MfxScrolledCanvas(self.top, propagate=True) self.canvas = self.scrolled_canvas.canvas diff --git a/pysollib/game/__init__.py b/pysollib/game/__init__.py index 53a0f48f..f5123fcf 100644 --- a/pysollib/game/__init__.py +++ b/pysollib/game/__init__.py @@ -3382,10 +3382,10 @@ class Game(object): kw = dict([(args[i], args[i+1]) for i in range(0, len(args), 2)]) if not kw: kw = {'info': '', 'help': ''} - if 'info' in kw and self.app.opt.statusbar and self.app.opt.num_cards: + if 'info' in kw and self.app.opt.statusbar: self.app.statusbar.updateText(info=kw['info']) - if 'help' in kw and self.app.opt.helpbar: - self.app.helpbar.updateText(info=kw['help']) + if 'help' in kw and self.app.opt.statusbar: + self.app.statusbar.updateText(help=kw['help']) # # Piles descriptions diff --git a/pysollib/options.py b/pysollib/options.py index 7d652ea8..34595ceb 100644 --- a/pysollib/options.py +++ b/pysollib/options.py @@ -31,7 +31,7 @@ import pysollib.settings from pysollib.mfxutil import Image, USE_PIL, print_err from pysollib.mygettext import _ from pysollib.mygettext import myGettext -from pysollib.pysoltk import TOOLBAR_BUTTONS, TOOLKIT +from pysollib.pysoltk import STATUSBAR_ITEMS, TOOLBAR_BUTTONS, TOOLKIT from pysollib.resource import CSI @@ -127,6 +127,7 @@ center_layout = boolean recent_gameid = int_list favorite_gameid = int_list visible_buttons = string_list +visible_status = string_list translate_game_names = boolean solver_presets = string_list solver_show_progress = boolean @@ -250,10 +251,10 @@ class Options: ('toolbar_compound', 'str'), ('toolbar_size', 'int'), ('statusbar', 'bool'), - ('statusbar_game_number', 'bool'), - ('statusbar_stuck', 'bool'), - ('num_cards', 'bool'), - ('helpbar', 'bool'), + # ('statusbar_game_number', 'bool'), + # ('statusbar_stuck', 'bool'), + # ('num_cards', 'bool'), + # ('helpbar', 'bool'), ('num_recent_games', 'int'), ('last_gameid', 'int'), ('game_holded', 'int'), @@ -349,11 +350,14 @@ class Options: self.toolbar_vars = {} for w in TOOLBAR_BUTTONS: self.toolbar_vars[w] = True # show all buttons + self.statusbar_vars = {} + for w, x in STATUSBAR_ITEMS: + self.statusbar_vars[w] = True self.statusbar = True - self.statusbar_game_number = False # show game number in statusbar - self.statusbar_stuck = False # show stuck indicator - self.num_cards = False - self.helpbar = False + # self.statusbar_game_number = False # show game number in statusbar + # self.statusbar_stuck = False # show stuck indicator + # self.num_cards = False + # self.helpbar = False self.splashscreen = True self.date_format = '%m-%d' self.mouse_button1 = 1 @@ -590,6 +594,9 @@ class Options: visible_buttons = [b for b in self.toolbar_vars if self.toolbar_vars[b]] config['general']['visible_buttons'] = visible_buttons + visible_status = [b for b in self.statusbar_vars + if self.statusbar_vars[b]] + config['general']['visible_status'] = visible_status if 'none' in config['general']['solver_presets']: config['general']['solver_presets'].remove('none') @@ -731,6 +738,10 @@ class Options: if visible_buttons is not None: for key in TOOLBAR_BUTTONS: self.toolbar_vars[key] = (key in visible_buttons) + visible_status = self._getOption('general', 'visible_status', 'list') + if visible_status is not None: + for key, label in STATUSBAR_ITEMS: + self.statusbar_vars[key] = (key in visible_status) myGettext.language = self.language diff --git a/pysollib/tile/statusbar.py b/pysollib/tile/statusbar.py index a3b47ab8..344f58f5 100644 --- a/pysollib/tile/statusbar.py +++ b/pysollib/tile/statusbar.py @@ -155,10 +155,11 @@ class PysolStatusbar(MfxStatusbar): ('moves', _('Moves/Total moves'), 10), ('gamenumber', _('Game number'), 26), ('stats', _('Games played: won/lost'), 12), + ('info', _('Number of cards'), 12), ): self._createLabel(n, tooltip=t, width=w) # - label = self._createLabel('info', expand=True) + label = self._createLabel('help', expand=True) label.config(padding=(8, 0)) self._createSizegrip() diff --git a/pysollib/ui/tktile/menubar.py b/pysollib/ui/tktile/menubar.py index cdadcf2b..64a7cd3a 100644 --- a/pysollib/ui/tktile/menubar.py +++ b/pysollib/ui/tktile/menubar.py @@ -13,7 +13,7 @@ from pysollib.settings import TITLE, WIN_SYSTEM from pysollib.settings import USE_FREECELL_SOLVER from pysollib.ui.tktile.tkconst import COMPOUNDS, CURSOR_WATCH, EVENT_HANDLED from pysollib.ui.tktile.tkconst import EVENT_PROPAGATE -from pysollib.ui.tktile.tkconst import TOOLBAR_BUTTONS +from pysollib.ui.tktile.tkconst import STATUSBAR_ITEMS, TOOLBAR_BUTTONS from pysollib.ui.tktile.tkutil import after_idle, bind from six.moves import tkinter @@ -71,6 +71,18 @@ def createToolbarMenu(menubar, menu): command=menubar.mOptToolbar) +def createStatusbarMenu(menubar, menu): + menu.add_checkbutton( + label=n_("Show &statusbar"), variable=menubar.tkopt.statusbar, + command=menubar.mOptStatusbar) + menu.add_separator() + for comp, label in STATUSBAR_ITEMS: + menu.add_checkbutton( + label=label, + variable=menubar.tkopt.statusbar_vars[comp], + command=lambda m=menubar, w=comp: m.mOptStatusbarConfig(w)) + + def createResamplingMenu(menubar, menu): tearoff = menu.cget('tearoff') submenu = MfxMenu(menu, label=n_('R&esampling'), tearoff=tearoff) @@ -247,9 +259,12 @@ class PysolMenubarTkCommon: pause=tkinter.BooleanVar(), theme=tkinter.StringVar(), toolbar_vars={}, + statusbar_vars={}, ) for w in TOOLBAR_BUTTONS: self.tkopt.toolbar_vars[w] = tkinter.BooleanVar() + for w, x in STATUSBAR_ITEMS: + self.tkopt.statusbar_vars[w] = tkinter.BooleanVar() def _setOptions(self): tkopt, opt = self.tkopt, self.app.opt @@ -295,8 +310,8 @@ class PysolMenubarTkCommon: tkopt.toolbar_size.set(opt.toolbar_size) tkopt.toolbar_relief.set(opt.toolbar_relief) tkopt.statusbar.set(opt.statusbar) - tkopt.num_cards.set(opt.num_cards) - tkopt.helpbar.set(opt.helpbar) + # tkopt.num_cards.set(opt.num_cards) + # tkopt.helpbar.set(opt.helpbar) tkopt.demo_logo.set(opt.demo_logo) tkopt.splashscreen.set(opt.splashscreen) tkopt.mouse_type.set(opt.mouse_type) @@ -304,6 +319,8 @@ class PysolMenubarTkCommon: tkopt.negative_bottom.set(opt.negative_bottom) for w in TOOLBAR_BUTTONS: tkopt.toolbar_vars[w].set(opt.toolbar_vars.get(w, False)) + for w, x in STATUSBAR_ITEMS: + tkopt.statusbar_vars[w].set(opt.statusbar_vars.get(w, False)) def connectGame(self, game): self.game = game @@ -714,15 +731,7 @@ class PysolMenubarTkCommon: submenu = MfxMenu(menu, label=n_("&Toolbar")) createToolbarMenu(self, submenu) submenu = MfxMenu(menu, label=n_("Stat&usbar")) - submenu.add_checkbutton( - label=n_("Show &statusbar"), variable=self.tkopt.statusbar, - command=self.mOptStatusbar) - submenu.add_checkbutton( - label=n_("Show &number of cards"), variable=self.tkopt.num_cards, - command=self.mOptNumCards) - submenu.add_checkbutton( - label=n_("Show &help bar"), variable=self.tkopt.helpbar, - command=self.mOptHelpbar) + createStatusbarMenu(self, submenu) menu.add_checkbutton( label=n_("&Demo logo"), variable=self.tkopt.demo_logo, command=self.mOptDemoLogo) @@ -1768,6 +1777,9 @@ Unsupported game for import. if self.app.statusbar.show(side, resize=resize): self.top.update_idletasks() + def mOptStatusbarConfig(self, w): + self.statusbarConfig(w, self.tkopt.statusbar_vars[w].get()) + def mOptNumCards(self, *event): if self._cancelDrag(break_pause=False): return @@ -1921,6 +1933,13 @@ Error while saving game. self.app.toolbar.config(w, v) self.top.update_idletasks() + def statusbarConfig(self, w, v): + if self._cancelDrag(break_pause=False): + return + self.app.opt.statusbar_vars[w] = v + self.app.statusbar.config(w, v) + self.top.update_idletasks() + # # stacks descriptions # diff --git a/pysollib/ui/tktile/tkconst.py b/pysollib/ui/tktile/tkconst.py index f4cbbddb..d9c9de55 100644 --- a/pysollib/ui/tktile/tkconst.py +++ b/pysollib/ui/tktile/tkconst.py @@ -72,3 +72,13 @@ TOOLBAR_BUTTONS = ( "quit", "player", ) + +STATUSBAR_ITEMS = ( + ('stuck', "'You Are Stuck' indicator"), + ('time', 'Playing time'), + ('moves', 'Moves/Total moves'), + ('gamenumber', 'Game number'), + ('stats', 'Games played: won/lost'), + ('info', 'Number of cards'), + ('help', 'Help info') +)