diff --git a/html-src/assist_options.html b/html-src/assist_options.html index c3b1ccc7..47ca57e0 100644 --- a/html-src/assist_options.html +++ b/html-src/assist_options.html @@ -63,3 +63,9 @@ moved as a unit. Using this does not disqualify you from getting a perfect game

The find card feature will locate and highlight any face-up instances of the chosen card. Using this does not disqualify you from getting a perfect game. + +

Show Full Picture

+

+In puzzle type games, the show full picture option will give you an image of what the +puzzle looks like when it's completed. Using this does not disqualify you from +getting a perfect game. diff --git a/po/de_pysol.po b/po/de_pysol.po index edb892ec..904c32e1 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: 2023-09-22 21:55-0400\n" +"PO-Revision-Date: 2023-09-27 20:03-0400\n" "Last-Translator: H. Schaekel \n" "Language-Team: German\n" "Language: de\n" @@ -4836,6 +4836,9 @@ msgstr "Keine passenden hervorheben:" msgid "Find card" msgstr "Karte suchen" +msgid "Full picture" +msgstr "" + msgid "Icon Style" msgstr "" @@ -5044,6 +5047,9 @@ msgstr "Sp&ielfeldstapel hervorheben:" msgid "&Find card..." msgstr "Karte suchen (&F)" +msgid "Sh&ow full picture..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:442 msgid "&Demo" msgstr "&Demo" diff --git a/po/fr_pysol.po b/po/fr_pysol.po index f64075fa..9011e016 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: 2023-09-22 21:54-0400\n" +"PO-Revision-Date: 2023-09-27 20:02-0400\n" "Last-Translator: Eric Rausch \n" "Language-Team: French\n" "Language: fr\n" @@ -4886,6 +4886,9 @@ msgstr "Sans correspondance:" msgid "Find card" msgstr "Trouver carte" +msgid "Full picture" +msgstr "" + msgid "Icon Style" msgstr "" @@ -5094,6 +5097,9 @@ msgstr "Surbrillance p&iles" msgid "&Find card..." msgstr "&Trouver carte..." +msgid "Sh&ow full picture..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:442 msgid "&Demo" msgstr "&Démo" diff --git a/po/it_pysol.po b/po/it_pysol.po index 5c2b30ae..75212f69 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: 2023-09-22 21:54-0400\n" +"PO-Revision-Date: 2023-09-27 20:02-0400\n" "Last-Translator: Giuliano Colla \n" "Language-Team: Italiano \n" "Language: it\n" @@ -4951,6 +4951,9 @@ msgstr "Evidenzia non corrispondenti:" msgid "Find card" msgstr "Trova carta" +msgid "Full picture" +msgstr "" + msgid "Icon Style" msgstr "" @@ -5160,6 +5163,9 @@ msgstr "Evidenzia p&ile" msgid "&Find card..." msgstr "&Trova carta..." +msgid "Sh&ow full picture..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:442 msgid "&Demo" msgstr "&Demo" diff --git a/po/pl_pysol.po b/po/pl_pysol.po index b0cc2f12..0d0b9d06 100644 --- a/po/pl_pysol.po +++ b/po/pl_pysol.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PySolFC\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-12-10 10:19-0500\n" -"PO-Revision-Date: 2023-09-22 21:55-0400\n" +"PO-Revision-Date: 2023-09-27 20:01-0400\n" "Last-Translator: Jerzy Trzeciak \n" "Language-Team: Polish \n" "Language: pl\n" @@ -4906,6 +4906,9 @@ msgstr "Podświetlenie niepasujących:" msgid "Find card" msgstr "Znajdź kartę" +msgid "Full picture" +msgstr "" + msgid "Icon Style" msgstr "Wygląd ikon" @@ -5114,6 +5117,9 @@ msgstr "Podśw&ietl stosy" msgid "&Find card..." msgstr "Znajdź kartę..." +msgid "Sh&ow full picture..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:442 msgid "&Demo" msgstr "&Demo" diff --git a/po/pt_BR_pysol.po b/po/pt_BR_pysol.po index 3dc335fc..6d070329 100644 --- a/po/pt_BR_pysol.po +++ b/po/pt_BR_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: 2023-09-22 21:52-0400\n" +"PO-Revision-Date: 2023-09-27 20:02-0400\n" "Last-Translator: Matheus Knack \n" "Language-Team: \n" "Language: pt_BR\n" @@ -4908,6 +4908,9 @@ msgstr "Sem correspondência:" msgid "Find card" msgstr "Encontrar carta" +msgid "Full picture" +msgstr "" + msgid "Icon Style" msgstr "" @@ -5116,6 +5119,9 @@ msgstr "Surbrillance pilhas" msgid "&Find card..." msgstr "&Encontrar carta..." +msgid "Sh&ow full picture..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:442 msgid "&Demo" msgstr "&Demonstração" diff --git a/po/pysol.pot b/po/pysol.pot index 914a458e..3ae6fd24 100644 --- a/po/pysol.pot +++ b/po/pysol.pot @@ -4639,6 +4639,9 @@ msgstr "" msgid "Find card" msgstr "" +msgid "Full picture" +msgstr "" + msgid "Icon Style" msgstr "" @@ -4847,6 +4850,9 @@ msgstr "" msgid "&Find card..." msgstr "" +msgid "Sh&ow full picture..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:442 msgid "&Demo" msgstr "" diff --git a/po/ru_pysol.po b/po/ru_pysol.po index 80d5caa9..c94d5495 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: 2023-09-22 21:52-0400\n" +"PO-Revision-Date: 2023-09-27 20:02-0400\n" "Last-Translator: Skomoroh \n" "Language-Team: Russian \n" "Language: ru\n" @@ -4975,6 +4975,9 @@ msgstr "Подсветка отсутствия совпадения:" msgid "Find card" msgstr "Найти карту" +msgid "Full picture" +msgstr "" + msgid "Icon Style" msgstr "" @@ -5183,6 +5186,9 @@ msgstr "П&оказать группы" msgid "&Find card..." msgstr "&Найти карту..." +msgid "Sh&ow full picture..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:442 msgid "&Demo" msgstr "&Демо" diff --git a/pysollib/actions.py b/pysollib/actions.py index 31881d2f..3c82db9d 100644 --- a/pysollib/actions.py +++ b/pysollib/actions.py @@ -44,6 +44,7 @@ from pysollib.pysoltk import PysolMenubarTk, PysolToolbarTk from pysollib.pysoltk import Status_StatsDialog, Top_StatsDialog from pysollib.pysoltk import TimeoutsDialog from pysollib.pysoltk import create_find_card_dialog +from pysollib.pysoltk import create_full_picture_dialog from pysollib.pysoltk import create_solver_dialog from pysollib.settings import DEBUG from pysollib.settings import PACKAGE_URL, TITLE @@ -83,6 +84,7 @@ class PysolMenubar(PysolMenubarTk): highlight_piles=0, autoscale=0, find_card=0, + full_picture=0, rules=0, pause=0, custom_game=0, @@ -164,6 +166,8 @@ class PysolMenubar(PysolMenubarTk): ms.autoscale = 1 if game.canFindCard(): ms.find_card = 1 + if game.canShowFullPicture(): + ms.full_picture = 1 if game.app.getGameRulesFilename(game.id): # note: this may return "" ms.rules = 1 if not game.finished: @@ -206,6 +210,7 @@ class PysolMenubar(PysolMenubarTk): self.setMenuState(ms.hint, "assist.hint") self.setMenuState(ms.highlight_piles, "assist.highlightpiles") self.setMenuState(ms.find_card, "assist.findcard") + self.setMenuState(ms.full_picture, "assist.showfullpicture") self.setMenuState(ms.demo, "assist.demo") self.setMenuState(ms.demo, "assist.demoallgames") # Options menu @@ -528,6 +533,10 @@ class PysolMenubar(PysolMenubarTk): create_find_card_dialog(self.game.top, self.game, self.app.getFindCardImagesDir()) + def mFullPicture(self, *args): + if self.game.canShowFullPicture(): + create_full_picture_dialog(self.game.top, self.game) + def mSolver(self, *args): create_solver_dialog(self.game.top, self.app) diff --git a/pysollib/game/__init__.py b/pysollib/game/__init__.py index b0a0c511..d2d15d53 100644 --- a/pysollib/game/__init__.py +++ b/pysollib/game/__init__.py @@ -3483,6 +3483,9 @@ class Game(object): def canFindCard(self): return self.gameinfo.category not in (GI.GC_MATCHING, GI.GC_PUZZLE) + def canShowFullPicture(self): + return self.gameinfo.category == GI.GC_PUZZLE + # # subclass hooks # diff --git a/pysollib/kivy/fullpicturedialog.py b/pysollib/kivy/fullpicturedialog.py new file mode 100644 index 00000000..05526a7a --- /dev/null +++ b/pysollib/kivy/fullpicturedialog.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# -*- mode: python; coding: utf-8; -*- +# ---------------------------------------------------------------------------# +# +# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 2003 Mt. Hood Playing Card Co. +# Copyright (C) 2005-2009 Skomoroh +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ---------------------------------------------------------------------------# + +# imports +# import os +# import traceback + +# PySol imports + +# Toolkit imports +# from tkutil import after, after_cancel +# from tkutil import bind, unbind_destroy, makeImage +# from tkcanvas import MfxCanvas, MfxCanvasGroup +# from tkcanvas import MfxCanvasImage, MfxCanvasRectangle + +# from pysollib.settings import TITLE + +# ************************************************************************ +# * +# ************************************************************************ + + +full_picture_dialog = None + + +def create_full_picture_dialog(parent, game): + pass + ''' + global full_picture_dialog + try: + full_picture_dialog.wm_deiconify() + full_picture_dialog.tkraise() + except Exception: + # traceback.print_exc() + full_picture_dialog = FullPictureDialog(parent, game) + ''' + + +def connect_game_full_picture_dialog(game): + pass + ''' + try: + full_picture_dialog.connectGame(game) + except Exception: + pass + ''' + + +def destroy_full_picture_dialog(): + pass + ''' + global full_picture_dialog + try: + full_picture_dialog.destroy() + except Exception: + # traceback.print_exc() + pass + full_picture_dialog = None + ''' + + +''' +''' diff --git a/pysollib/kivy/menubar.py b/pysollib/kivy/menubar.py index 1c906384..325706fb 100644 --- a/pysollib/kivy/menubar.py +++ b/pysollib/kivy/menubar.py @@ -39,6 +39,7 @@ from pysollib.kivy.LApp import LTopLevel from pysollib.kivy.LApp import LTreeNode from pysollib.kivy.LApp import LTreeRoot from pysollib.kivy.findcarddialog import destroy_find_card_dialog +from pysollib.kivy.fullpicturedialog import destroy_full_picture_dialog from pysollib.kivy.selectcardset import SelectCardsetDialogWithPreview from pysollib.kivy.selectgame import SelectGameDialog from pysollib.kivy.solverdialog import connect_game_solver_dialog @@ -50,6 +51,7 @@ from pysollib.mfxutil import Struct from pysollib.mygettext import _ from pysollib.pysoltk import MfxMessageDialog from pysollib.pysoltk import connect_game_find_card_dialog +from pysollib.pysoltk import connect_game_full_picture_dialog from pysollib.settings import SELECT_GAME_MENU from pysollib.settings import TITLE @@ -1465,6 +1467,10 @@ class PysolMenubarTk: connect_game_find_card_dialog(game) else: destroy_find_card_dialog() + if game.canShowFullPicture(): + connect_game_full_picture_dialog(game) + else: + destroy_full_picture_dialog() connect_game_solver_dialog(game) # create a GTK-like path diff --git a/pysollib/pysolgtk/fullpicturedialog.py b/pysollib/pysolgtk/fullpicturedialog.py new file mode 100644 index 00000000..4a26eab6 --- /dev/null +++ b/pysollib/pysolgtk/fullpicturedialog.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- mode: python; coding: utf-8; -*- +# --------------------------------------------------------------------------- +# +# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 2003 Mt. Hood Playing Card Co. +# Copyright (C) 2005-2009 Skomoroh +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# --------------------------------------------------------------------------- + +# imports +# import os +# from six.moves import tkinter +# import traceback + +# # PySol imports + +# # Toolkit imports +# from tkutil import after, after_cancel +# from tkutil import bind, unbind_destroy, makeImage +# from tkcanvas import MfxCanvas, MfxCanvasGroup, MfxCanvasImage, \ +# MfxCanvasRectangle + + +# ************************************************************************ +# * +# ************************************************************************ + +full_picture_dialog = None + + +def create_full_picture_dialog(parent, game): + pass + + +def connect_game_full_picture_dialog(game): + pass + + +def destroy_full_picture_dialog(): + pass diff --git a/pysollib/pysolgtk/menubar.py b/pysollib/pysolgtk/menubar.py index 9dd19ba8..0c18846f 100644 --- a/pysollib/pysolgtk/menubar.py +++ b/pysollib/pysolgtk/menubar.py @@ -28,6 +28,8 @@ import re from findcarddialog import connect_game_find_card_dialog, \ destroy_find_card_dialog +from fullpicturedialog import connect_game_full_picture_dialog, \ + destroy_full_picture_dialog import gtk from gtk import gdk @@ -81,6 +83,10 @@ class PysolMenubarTk: connect_game_find_card_dialog(game) else: destroy_find_card_dialog() + if game.canShowFullPicture(): + connect_game_full_picture_dialog(game) + else: + destroy_full_picture_dialog() # # create menubar diff --git a/pysollib/pysoltk.py b/pysollib/pysoltk.py index ebbb7178..91cba1a3 100644 --- a/pysollib/pysoltk.py +++ b/pysollib/pysoltk.py @@ -30,6 +30,7 @@ if TOOLKIT == 'tk': from pysollib.ui.tktile.tkcanvas import * # noqa: F401,F403 from pysollib.ui.tktile.tkwrap import * # noqa: F401,F403 from pysollib.ui.tktile.findcarddialog import * # noqa: F401,F403 + from pysollib.ui.tktile.fullpicturedialog import * # noqa: F401,F403 if USE_TILE: from pysollib.tile.tkwidget import * # noqa: F401,F403 from pysollib.tile.tkhtml import * # noqa: F401,F403 @@ -74,6 +75,7 @@ elif TOOLKIT == 'kivy': from pysollib.kivy.tkcanvas import * # noqa: F401,F403 from pysollib.kivy.tkwrap import * # noqa: F401,F403 from pysollib.kivy.findcarddialog import * # noqa: F401,F403 + from pysollib.kivy.fullpicturedialog import * # noqa: F401,F403 from pysollib.kivy.tkwidget import * # noqa: F401,F403 from pysollib.kivy.tkhtml import * # noqa: F401,F403 from pysollib.kivy.edittextdialog import * # noqa: F401,F403 @@ -107,6 +109,7 @@ else: # gtk from pysollib.pysolgtk.colorsdialog import * # noqa: F401,F403 from pysollib.pysolgtk.fontsdialog import * # noqa: F401,F403 from pysollib.pysolgtk.findcarddialog import * # noqa: F401,F403 + from pysollib.pysolgtk.fullpicturedialog import * # noqa: F401,F403 from pysollib.pysolgtk.solverdialog import * # noqa: F401,F403 from pysollib.pysolgtk.gameinfodialog import * # noqa: F401,F403 from pysollib.pysolgtk.toolbar import * # noqa: F401,F403 diff --git a/pysollib/tile/menubar.py b/pysollib/tile/menubar.py index 803b1ce0..1920b9c9 100644 --- a/pysollib/tile/menubar.py +++ b/pysollib/tile/menubar.py @@ -25,6 +25,9 @@ from pysollib.mygettext import _, n_ from pysollib.settings import TITLE from pysollib.ui.tktile.findcarddialog import connect_game_find_card_dialog from pysollib.ui.tktile.findcarddialog import destroy_find_card_dialog +from pysollib.ui.tktile.fullpicturedialog import \ + connect_game_full_picture_dialog +from pysollib.ui.tktile.fullpicturedialog import destroy_full_picture_dialog from pysollib.ui.tktile.menubar import MfxMenu, PysolMenubarTkCommon from pysollib.ui.tktile.solverdialog import connect_game_solver_dialog from pysollib.util import CARDSET @@ -58,6 +61,12 @@ class PysolMenubarTk(PysolMenubarTkCommon): def _destroy_find_card_dialog(self): return destroy_find_card_dialog() + def _connect_game_full_picture_dialog(self, game): + return connect_game_full_picture_dialog(game) + + def _destroy_full_picture_dialog(self): + return destroy_full_picture_dialog() + def _connect_game_solver_dialog(self, game): return connect_game_solver_dialog(game) diff --git a/pysollib/tk/menubar.py b/pysollib/tk/menubar.py index a12120e5..4fd3c063 100644 --- a/pysollib/tk/menubar.py +++ b/pysollib/tk/menubar.py @@ -26,6 +26,9 @@ from pysollib.mygettext import _ from pysollib.ui.tktile.findcarddialog import \ connect_game_find_card_dialog, \ destroy_find_card_dialog +from pysollib.ui.tktile.fullpicturedialog import \ + connect_game_full_picture_dialog, \ + destroy_full_picture_dialog from pysollib.ui.tktile.menubar import PysolMenubarTkCommon from pysollib.ui.tktile.solverdialog import connect_game_solver_dialog from pysollib.util import CARDSET @@ -53,6 +56,12 @@ class PysolMenubarTk(PysolMenubarTkCommon): def _destroy_find_card_dialog(self): return destroy_find_card_dialog() + def _connect_game_full_picture_dialog(self, game): + return connect_game_full_picture_dialog(game) + + def _destroy_full_picture_dialog(self): + return destroy_full_picture_dialog() + def _connect_game_solver_dialog(self, game): return connect_game_solver_dialog(game) diff --git a/pysollib/ui/tktile/fullpicturedialog.py b/pysollib/ui/tktile/fullpicturedialog.py new file mode 100644 index 00000000..c413cbfa --- /dev/null +++ b/pysollib/ui/tktile/fullpicturedialog.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python +# -*- mode: python; coding: utf-8; -*- +# --------------------------------------------------------------------------- +# +# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 2003 Mt. Hood Playing Card Co. +# Copyright (C) 2005-2009 Skomoroh +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# --------------------------------------------------------------------------- + +from pysollib.mygettext import _ +from pysollib.settings import TITLE +from pysollib.ui.tktile.tkcanvas import MfxCanvas, MfxCanvasGroup +from pysollib.ui.tktile.tkcanvas import MfxCanvasImage +from pysollib.ui.tktile.tkutil import bind, unbind_destroy + +from six.moves import tkinter + + +class FullPictureDialog(tkinter.Toplevel): + CARD_IMAGES = {} # key: (type, rank, suit) + + def __init__(self, parent, game): + tkinter.Toplevel.__init__(self) + title = TITLE + ' - ' + _('Full picture') + self.title(title) + self.wm_resizable(False, False) + self.cardsettype = '' + self.images = {} + self.label_width = 0 + self.label_height = 0 + + # if size == 'large': + # self.images_dir = os.path.join(dir, 'large', cs_type) + # self.label_width, self.label_height = LARGE_EMBLEMS_SIZE + # else: + # self.images_dir = os.path.join(dir, 'small') + # self.label_width, self.label_height = SMALL_EMBLEMS_SIZE + + self.canvas = MfxCanvas(self, bg='white') + # self.canvas = MfxCanvas(self, bg='black') + self.canvas.pack(expand=True, fill='both') + # + self.groups = [] + self.highlight_items = None + self.busy = False + self.connectGame(game) + # + bind(self, "WM_DELETE_WINDOW", self.destroy) + bind(self, "", self.destroy) + # + + def createCardLabel(self, suit, rank, x0, y0): + canvas = self.canvas + group = MfxCanvasGroup(canvas) + # + im = self.images.getFace(0, 0, rank) + FullPictureDialog.CARD_IMAGES[rank] = im + cim = MfxCanvasImage(canvas, x0, y0, image=im, anchor='nw') + cim.addtag(group) + cim.lower() + + self.groups.append(group) + + def connectGame(self, game): + self.images = game.app.subsampled_images + # + # self.images_dir = dir + self.label_width = self.images.CARDW + self.label_height = self.images.CARDH + self.cardsettype = game.gameinfo.subcategory + # + # self.images_dir = dir + self.canvas.delete('all') + self.game = game + cards = game.gameinfo.trumps + + dx, dy = self.label_width, self.label_height + i = 0 + k = 0 + + for card in cards: + x, y = dx * k + 2, dy * i + 2 + self.createCardLabel(suit=0, rank=card, x0=x, y0=y) + k += 1 + if k >= self.cardsettype: + k = 0 + i += 1 + if k > 0: + i += 1 + + w, h = dx*self.cardsettype+2, dy*i+2 + self.canvas.config(width=w, height=h) + self.wm_iconname(TITLE + " - " + game.getTitleName()) + self.wm_geometry('') # cancel user-specified geometry + + def destroy(self, *args): + for group in self.groups: + unbind_destroy(group) + unbind_destroy(self) + self.wm_withdraw() + tkinter.Toplevel.destroy(self) + + +full_picture_dialog = None + + +def create_full_picture_dialog(parent, game): + global full_picture_dialog + try: + full_picture_dialog.wm_deiconify() + full_picture_dialog.tkraise() + except Exception: + # traceback.print_exc() + full_picture_dialog = FullPictureDialog(parent, game) + + +def connect_game_full_picture_dialog(game): + try: + full_picture_dialog.connectGame(game) + except Exception: + pass + + +def destroy_full_picture_dialog(): + global full_picture_dialog + try: + full_picture_dialog.destroy() + except Exception: + # traceback.print_exc() + pass + full_picture_dialog = None diff --git a/pysollib/ui/tktile/menubar.py b/pysollib/ui/tktile/menubar.py index 1e201c87..d055bbab 100644 --- a/pysollib/ui/tktile/menubar.py +++ b/pysollib/ui/tktile/menubar.py @@ -347,6 +347,10 @@ class PysolMenubarTkCommon: self._connect_game_find_card_dialog(game) else: self._destroy_find_card_dialog() + if game.canShowFullPicture(): + self._connect_game_full_picture_dialog(game) + else: + self._destroy_full_picture_dialog() self._connect_game_solver_dialog(game) # create a GTK-like path @@ -534,6 +538,9 @@ class PysolMenubarTkCommon: menu.add_command( label=n_("&Find card..."), command=self.mFindCard, accelerator="F3") + menu.add_command( + label=n_("Sh&ow full picture..."), + command=self.mFullPicture) menu.add_separator() menu.add_command( label=n_("&Demo"),