Skip to content

Commit

Permalink
Added show full picture option for puzzle type games.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Sep 28, 2023
1 parent 0112e83 commit a28aaee
Show file tree
Hide file tree
Showing 19 changed files with 388 additions and 6 deletions.
6 changes: 6 additions & 0 deletions html-src/assist_options.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ <h2>Find Card</h2>
<p>
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.

<h2>Show Full Picture</h2>
<p>
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.
8 changes: 7 additions & 1 deletion po/de_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
"Language-Team: German\n"
"Language: de\n"
Expand Down Expand Up @@ -4836,6 +4836,9 @@ msgstr "Keine passenden hervorheben:"
msgid "Find card"
msgstr "Karte suchen"

msgid "Full picture"
msgstr ""

msgid "Icon Style"
msgstr ""

Expand Down Expand Up @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion po/fr_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
"Language-Team: French\n"
"Language: fr\n"
Expand Down Expand Up @@ -4886,6 +4886,9 @@ msgstr "Sans correspondance:"
msgid "Find card"
msgstr "Trouver carte"

msgid "Full picture"
msgstr ""

msgid "Icon Style"
msgstr ""

Expand Down Expand Up @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion po/it_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
"Language-Team: Italiano <[email protected]>\n"
"Language: it\n"
Expand Down Expand Up @@ -4951,6 +4951,9 @@ msgstr "Evidenzia non corrispondenti:"
msgid "Find card"
msgstr "Trova carta"

msgid "Full picture"
msgstr ""

msgid "Icon Style"
msgstr ""

Expand Down Expand Up @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion po/pl_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
"Language-Team: Polish <[email protected]>\n"
"Language: pl\n"
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion po/pt_BR_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
"Language-Team: \n"
"Language: pt_BR\n"
Expand Down Expand Up @@ -4908,6 +4908,9 @@ msgstr "Sem correspondência:"
msgid "Find card"
msgstr "Encontrar carta"

msgid "Full picture"
msgstr ""

msgid "Icon Style"
msgstr ""

Expand Down Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions po/pysol.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4639,6 +4639,9 @@ msgstr ""
msgid "Find card"
msgstr ""

msgid "Full picture"
msgstr ""

msgid "Icon Style"
msgstr ""

Expand Down Expand Up @@ -4847,6 +4850,9 @@ msgstr ""
msgid "&Find card..."
msgstr ""

msgid "Sh&ow full picture..."
msgstr ""

#: pysollib/ui/tktile/menubar.py:442
msgid "&Demo"
msgstr ""
Expand Down
8 changes: 7 additions & 1 deletion po/ru_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
"Language-Team: Russian <[email protected]>\n"
"Language: ru\n"
Expand Down Expand Up @@ -4975,6 +4975,9 @@ msgstr "Подсветка отсутствия совпадения:"
msgid "Find card"
msgstr "Найти карту"

msgid "Full picture"
msgstr ""

msgid "Icon Style"
msgstr ""

Expand Down Expand Up @@ -5183,6 +5186,9 @@ msgstr "П&оказать группы"
msgid "&Find card..."
msgstr "&Найти карту..."

msgid "Sh&ow full picture..."
msgstr ""

#: pysollib/ui/tktile/menubar.py:442
msgid "&Demo"
msgstr "&Демо"
Expand Down
9 changes: 9 additions & 0 deletions pysollib/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
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
Expand Down Expand Up @@ -83,6 +84,7 @@ def __init__(self, app, top, progress=None):
highlight_piles=0,
autoscale=0,
find_card=0,
full_picture=0,
rules=0,
pause=0,
custom_game=0,
Expand Down Expand Up @@ -164,6 +166,8 @@ def _updateMenuState(self):
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:
Expand Down Expand Up @@ -206,6 +210,7 @@ def _updateMenus(self):
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
Expand Down Expand Up @@ -528,6 +533,10 @@ def mFindCard(self, *args):
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)

Expand Down
3 changes: 3 additions & 0 deletions pysollib/game/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3483,6 +3483,9 @@ def deleteStackDesc(self):
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
#
Expand Down
83 changes: 83 additions & 0 deletions pysollib/kivy/fullpicturedialog.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
# ---------------------------------------------------------------------------#

# 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
'''


'''
'''
6 changes: 6 additions & 0 deletions pysollib/kivy/menubar.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
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
Expand All @@ -50,6 +51,7 @@
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

Expand Down Expand Up @@ -1465,6 +1467,10 @@ def connectGame(self, game):
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
Expand Down
Loading

0 comments on commit a28aaee

Please sign in to comment.