diff --git a/html-src/howtoplay.html b/html-src/howtoplay.html
index 4aa8c257..1f15acd3 100644
--- a/html-src/howtoplay.html
+++ b/html-src/howtoplay.html
@@ -17,6 +17,7 @@ Right mouse button (or double-click the left button):
Middle mouse button (or Ctrl-click the right button):
- View partially overlapped cards
+
- If enabled, this can also be used to peek at face-down cards
Ctrl-click the left mouse button:
diff --git a/po/de_pysol.po b/po/de_pysol.po
index d4d98b83..3253cfeb 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-05-12 21:40-0400\n"
+"PO-Revision-Date: 2023-05-18 18:49-0400\n"
"Last-Translator: H. Schaekel \n"
"Language-Team: German\n"
"Language: de\n"
@@ -2552,6 +2552,9 @@ msgstr "Karten hervorheben"
msgid "Enable highlight same rank"
msgstr "Gleichen Rang hervorheben"
+msgid "Enable face-down peek"
+msgstr ""
+
#: pysollib/kivy/menubar.py:576
msgid "Highlight no matching"
msgstr "Nicht passende hervorheben"
@@ -3712,6 +3715,9 @@ msgstr "Hervorhebung Karten: "
msgid "Highlight same rank: "
msgstr "Gleichen Rang hervorheben: "
+msgid "Face-down peeks: "
+msgstr ""
+
#: pysollib/pysolgtk/tkstats.py:533 pysollib/tile/tkstats.py:620
#: pysollib/tk/tkstats.py:615
msgid ""
@@ -5058,6 +5064,9 @@ msgstr "Hervorhebung Karten:"
msgid "Enable highlight same &rank"
msgstr "Gleichen Rang hervorheben:"
+msgid "Enable face-down &peek"
+msgstr ""
+
#: pysollib/ui/tktile/menubar.py:503
#, fuzzy
msgid "Highlight &no matching"
diff --git a/po/fr_pysol.po b/po/fr_pysol.po
index e523d479..75f04e7c 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-05-12 21:40-0400\n"
+"PO-Revision-Date: 2023-05-18 18:49-0400\n"
"Last-Translator: Eric Rausch \n"
"Language-Team: French\n"
"Language: fr\n"
@@ -2592,6 +2592,9 @@ msgstr "Surbrillance des cartes"
msgid "Enable highlight same rank"
msgstr "Surbrillance des équivalents"
+msgid "Enable face-down peek"
+msgstr ""
+
#: pysollib/kivy/menubar.py:576
msgid "Highlight no matching"
msgstr "Surbrillance sans correspondance"
@@ -3762,6 +3765,9 @@ msgstr "Surbrillance cartes: "
msgid "Highlight same rank: "
msgstr "Surbrillance valeurs identiques: "
+msgid "Face-down peeks: "
+msgstr ""
+
#: pysollib/pysolgtk/tkstats.py:533 pysollib/tile/tkstats.py:620
#: pysollib/tk/tkstats.py:615
msgid ""
@@ -5102,6 +5108,9 @@ msgstr "Surbrillance des &cartes"
msgid "Enable highlight same &rank"
msgstr "Surbrillance des &équivalents"
+msgid "Enable face-down &peek"
+msgstr ""
+
#: pysollib/ui/tktile/menubar.py:503
msgid "Highlight &no matching"
msgstr "Surbrilla&nce incorrectes"
diff --git a/po/it_pysol.po b/po/it_pysol.po
index c4c4b11f..6a57b308 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-05-12 21:40-0400\n"
+"PO-Revision-Date: 2023-05-18 18:51-0400\n"
"Last-Translator: Giuliano Colla \n"
"Language-Team: Italiano \n"
"Language: it\n"
@@ -2608,6 +2608,9 @@ msgstr "Abilita evidenzia &carte"
msgid "Enable highlight same rank"
msgstr "Abilita evidenzia stesso valo&re"
+msgid "Enable face-down peek"
+msgstr ""
+
#: pysollib/kivy/menubar.py:576
#, fuzzy
msgid "Highlight no matching"
@@ -3823,6 +3826,9 @@ msgstr "Evidenzia carte: "
msgid "Highlight same rank: "
msgstr "Evidenzia stesso valore: "
+msgid "Face-down peeks: "
+msgstr ""
+
#: pysollib/pysolgtk/tkstats.py:533 pysollib/tile/tkstats.py:620
#: pysollib/tk/tkstats.py:615
msgid ""
@@ -5168,6 +5174,9 @@ msgstr "Abilita evidenzia &carte"
msgid "Enable highlight same &rank"
msgstr "Abilita evidenzia stesso valo&re"
+msgid "Enable face-down &peek"
+msgstr ""
+
#: pysollib/ui/tktile/menubar.py:503
msgid "Highlight &no matching"
msgstr "Abilita non corrispondenti"
diff --git a/po/pl_pysol.po b/po/pl_pysol.po
index 95055aff..0fd9ccc2 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: 2023-05-12 21:41-0400\n"
+"PO-Revision-Date: 2023-05-18 18:51-0400\n"
"Last-Translator: Jerzy Trzeciak \n"
"Language-Team: Polish \n"
"Language: pl\n"
@@ -2642,6 +2642,9 @@ msgstr "Włącz podświetlanie kart"
msgid "Enable highlight same rank"
msgstr "Podświetlaj karty o jednakowej sile"
+msgid "Enable face-down peek"
+msgstr ""
+
#: pysollib/kivy/menubar.py:576
#, fuzzy
msgid "Highlight no matching"
@@ -3857,6 +3860,9 @@ msgstr "Podświetlenie kart: "
msgid "Highlight same rank: "
msgstr "Podświetlenie jednakowych wartości: "
+msgid "Face-down peeks: "
+msgstr ""
+
#: pysollib/pysolgtk/tkstats.py:533 pysollib/tile/tkstats.py:620
#: pysollib/tk/tkstats.py:615
msgid ""
@@ -5216,6 +5222,9 @@ msgstr "Włącz podświetlanie kart"
msgid "Enable highlight same &rank"
msgstr "Podświetlaj karty o jednakowej sile"
+msgid "Enable face-down &peek"
+msgstr ""
+
#: pysollib/ui/tktile/menubar.py:503
msgid "Highlight &no matching"
msgstr "Podświetlaj brak dopasowa&nia"
diff --git a/po/pt_BR_pysol.po b/po/pt_BR_pysol.po
index 0bee27d7..1db360ab 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-05-12 21:41-0400\n"
+"PO-Revision-Date: 2023-05-18 18:51-0400\n"
"Last-Translator: Matheus Knack \n"
"Language-Team: \n"
"Language: pt_BR\n"
@@ -2613,6 +2613,9 @@ msgstr "Ativar realçamento de cartas"
msgid "Enable highlight same rank"
msgstr "Aitvar realçamento de mesmo valor"
+msgid "Enable face-down peek"
+msgstr ""
+
#: pysollib/kivy/menubar.py:576
msgid "Highlight no matching"
msgstr "Realçar sem correspondencia"
@@ -3785,6 +3788,9 @@ msgstr "Cartas de destaque: "
msgid "Highlight same rank: "
msgstr "Destaque a mesma classificação: "
+msgid "Face-down peeks: "
+msgstr ""
+
#: pysollib/pysolgtk/tkstats.py:533 pysollib/tile/tkstats.py:620
#: pysollib/tk/tkstats.py:615
msgid ""
@@ -5124,6 +5130,9 @@ msgstr "Ativar realce &cartas"
msgid "Enable highlight same &rank"
msgstr "Ativar o mesmo realce &classificar"
+msgid "Enable face-down &peek"
+msgstr ""
+
#: pysollib/ui/tktile/menubar.py:503
msgid "Highlight &no matching"
msgstr "Realçe não encontrado"
diff --git a/po/pysol.pot b/po/pysol.pot
index 20d684a4..6918082c 100644
--- a/po/pysol.pot
+++ b/po/pysol.pot
@@ -2421,6 +2421,9 @@ msgstr ""
msgid "Enable highlight same rank"
msgstr ""
+msgid "Enable face-down peek"
+msgstr ""
+
#: pysollib/kivy/menubar.py:576
msgid "Highlight no matching"
msgstr ""
@@ -3576,6 +3579,9 @@ msgstr ""
msgid "Highlight same rank: "
msgstr ""
+msgid "Face-down peeks: "
+msgstr ""
+
#: pysollib/pysolgtk/tkstats.py:533 pysollib/tile/tkstats.py:620
#: pysollib/tk/tkstats.py:615
msgid ""
@@ -4851,6 +4857,9 @@ msgstr ""
msgid "Enable highlight same &rank"
msgstr ""
+msgid "Enable face-down &peek"
+msgstr ""
+
#: pysollib/ui/tktile/menubar.py:503
msgid "Highlight &no matching"
msgstr ""
diff --git a/po/ru_pysol.po b/po/ru_pysol.po
index 6914a1c4..93dfe861 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-05-12 21:41-0400\n"
+"PO-Revision-Date: 2023-05-18 18:53-0400\n"
"Last-Translator: Skomoroh \n"
"Language-Team: Russian \n"
"Language: ru\n"
@@ -2621,6 +2621,9 @@ msgstr "Разрешить показывать &карты"
msgid "Enable highlight same rank"
msgstr "Разрешить показывать карты &одного достоинства"
+msgid "Enable face-down peek"
+msgstr ""
+
#: pysollib/kivy/menubar.py:576
#, fuzzy
msgid "Highlight no matching"
@@ -3834,6 +3837,9 @@ msgstr "Подсветка карт: "
msgid "Highlight same rank: "
msgstr "Подсветка карт одного достоинства: "
+msgid "Face-down peeks: "
+msgstr ""
+
#: pysollib/pysolgtk/tkstats.py:533 pysollib/tile/tkstats.py:620
#: pysollib/tk/tkstats.py:615
msgid ""
@@ -5192,6 +5198,9 @@ msgstr "Разрешить показывать &карты"
msgid "Enable highlight same &rank"
msgstr "Разрешить показывать карты &одного достоинства"
+msgid "Enable face-down &peek"
+msgstr ""
+
#: pysollib/ui/tktile/menubar.py:503
msgid "Highlight &no matching"
msgstr "Подсветка отсутствия &совпадения"
diff --git a/pysollib/game/__init__.py b/pysollib/game/__init__.py
index c45668b2..271a7f41 100644
--- a/pysollib/game/__init__.py
+++ b/pysollib/game/__init__.py
@@ -187,7 +187,9 @@ def _stats__is_perfect(stats):
# stats.quickplay_moves == 0 and
stats.highlight_piles == 0 and
stats.highlight_cards == 0 and
- stats.shuffle_moves == 0)
+ stats.shuffle_moves == 0 and
+ stats.hints == 0 and
+ stats.peeks == 0)
def _highlightCards__calc_item(canvas, delta, cw, ch, s, c1, c2, color):
@@ -400,6 +402,7 @@ class GameHints(NewStruct):
@attr.s
class GameStatsStruct(NewStruct):
hints = attr.ib(default=0) # number of hints consumed
+ peeks = attr.ib(default=0) # number of peeks consumed
# number of highlight piles consumed
highlight_piles = attr.ib(default=0)
# number of highlight matching cards consumed
diff --git a/pysollib/kivy/menubar.py b/pysollib/kivy/menubar.py
index a1498807..407d7d56 100644
--- a/pysollib/kivy/menubar.py
+++ b/pysollib/kivy/menubar.py
@@ -577,6 +577,11 @@ class OptionsMenuDialog(LMenuDialog):
self.menubar.tkopt.highlight_samerank,
self.menubar.mOptEnableHighlightSameRank)
+ self.addCheckNode(tv, rg,
+ _('Enable face-down peek'),
+ self.menubar.tkopt.peek_facedown,
+ self.menubar.mOptEnablePeekFacedown)
+
self.addCheckNode(tv, rg,
_('Highlight no matching'),
self.menubar.tkopt.highlight_not_matching,
diff --git a/pysollib/options.py b/pysollib/options.py
index 62b5782e..84082c5e 100644
--- a/pysollib/options.py
+++ b/pysollib/options.py
@@ -77,6 +77,7 @@ highlight_piles = boolean
highlight_cards = boolean
highlight_samerank = boolean
highlight_not_matching = boolean
+peek_facedown = boolean
stuck_notification = boolean
mahjongg_show_removed = boolean
mahjongg_create_solvable = integer(0, 2)
@@ -226,6 +227,7 @@ class Options:
('highlight_cards', 'bool'),
('highlight_samerank', 'bool'),
('highlight_not_matching', 'bool'),
+ ('peek_facedown', 'bool'),
('stuck_notification', 'bool'),
('mahjongg_show_removed', 'bool'),
('mahjongg_create_solvable', 'int'),
@@ -317,6 +319,7 @@ class Options:
self.highlight_cards = True
self.highlight_samerank = True
self.highlight_not_matching = True
+ self.peek_facedown = False
self.stuck_notification = False
self.mahjongg_show_removed = False
self.mahjongg_create_solvable = 2 # 0 - none, 1 - easy, 2 - hard
diff --git a/pysollib/pysolgtk/tkstats.py b/pysollib/pysolgtk/tkstats.py
index f37057c9..20024280 100644
--- a/pysollib/pysolgtk/tkstats.py
+++ b/pysollib/pysolgtk/tkstats.py
@@ -527,7 +527,8 @@ class Status_StatsDialog(MfxMessageDialog): # MfxDialog
w1 = (_('Highlight piles: ') + str(stats.highlight_piles) + '\n' +
_('Highlight cards: ') + str(stats.highlight_cards) + '\n' +
_('Highlight same rank: ') +
- str(stats.highlight_samerank) + '\n')
+ str(stats.highlight_samerank) + '\n' +
+ _('Face-down peeks: ') + str(stats.peeks) + '\n')
if game.s.talon:
if game.gameinfo.redeals != 0:
w2 += _('\nRedeals: ') + str(game.s.talon.round - 1)
diff --git a/pysollib/stack.py b/pysollib/stack.py
index f634eb8b..855eeb42 100644
--- a/pysollib/stack.py
+++ b/pysollib/stack.py
@@ -1016,17 +1016,31 @@ class Stack:
return 0
i = self._findCard(event)
positions = len(self.cards) - i - 1
- if i < 0 or positions <= 0 or not self.cards[i].face_up:
+ peeked = False
+ if i < 0:
+ return 0
+ if not self.cards[i].face_up:
+ if not self.game.app.opt.peek_facedown:
+ return 0
+ else:
+ self.game.stats.peeks += 1
+ self.cards[i].showFace()
+ peeked = True
+ elif positions <= 0:
return 0
# print self.cards[i]
self.cards[i].item.tkraise()
self.canvas.update_idletasks()
self.game.sleep(self.game.app.opt.timeouts['raise_card'])
- if TOOLKIT == 'tk':
- self.cards[i].item.lower(self.cards[i+1].item)
- elif TOOLKIT == 'gtk':
- for c in self.cards[i+1:]:
- c.tkraise()
+ if peeked:
+ self.cards[i].showBack()
+ if positions > 0:
+ if TOOLKIT == 'tk':
+ self.cards[i].item.lower(self.cards[i+1].item)
+ elif TOOLKIT == 'gtk':
+ for c in self.cards[i+1:]:
+ c.tkraise()
+
self.canvas.update_idletasks()
return 1
diff --git a/pysollib/tile/tkstats.py b/pysollib/tile/tkstats.py
index 4a4dc22c..ce60c795 100644
--- a/pysollib/tile/tkstats.py
+++ b/pysollib/tile/tkstats.py
@@ -615,7 +615,8 @@ class Status_StatsDialog(MfxMessageDialog):
w1 = (_("Highlight piles: ") + str(stats.highlight_piles) + "\n" +
_("Highlight cards: ") + str(stats.highlight_cards) + "\n" +
_("Highlight same rank: ") +
- str(stats.highlight_samerank) + "\n")
+ str(stats.highlight_samerank) + "\n" +
+ _('Face-down peeks: ') + str(stats.peeks) + '\n')
if game.s.talon:
if game.gameinfo.redeals != 0:
w2 = w2 + _("\nRedeals: ") + str(game.s.talon.round - 1)
diff --git a/pysollib/tk/tkstats.py b/pysollib/tk/tkstats.py
index 8bcf669d..6e6954b5 100644
--- a/pysollib/tk/tkstats.py
+++ b/pysollib/tk/tkstats.py
@@ -614,7 +614,8 @@ class Status_StatsDialog(MfxMessageDialog):
w1 = (_("Highlight piles: ") + str(stats.highlight_piles) + "\n" +
_("Highlight cards: ") + str(stats.highlight_cards) + "\n" +
_("Highlight same rank: ") + str(stats.highlight_samerank) +
- "\n")
+ "\n" +
+ _('Face-down peeks: ') + str(stats.peeks) + '\n')
if game.s.talon:
if game.gameinfo.redeals != 0:
w2 = w2 + _("\nRedeals: ") + str(game.s.talon.round - 1)
diff --git a/pysollib/ui/tktile/menubar.py b/pysollib/ui/tktile/menubar.py
index ca308276..b95da623 100644
--- a/pysollib/ui/tktile/menubar.py
+++ b/pysollib/ui/tktile/menubar.py
@@ -225,6 +225,7 @@ class PysolMenubarTkCommon:
highlight_cards=tkinter.BooleanVar(),
highlight_samerank=tkinter.BooleanVar(),
highlight_not_matching=tkinter.BooleanVar(),
+ peek_facedown=tkinter.BooleanVar(),
stuck_notification=tkinter.BooleanVar(),
mahjongg_show_removed=tkinter.BooleanVar(),
shisen_show_hint=tkinter.BooleanVar(),
@@ -288,6 +289,7 @@ class PysolMenubarTkCommon:
tkopt.highlight_cards.set(opt.highlight_cards)
tkopt.highlight_samerank.set(opt.highlight_samerank)
tkopt.highlight_not_matching.set(opt.highlight_not_matching)
+ tkopt.peek_facedown.set(opt.peek_facedown)
tkopt.stuck_notification.set(opt.stuck_notification)
tkopt.shrink_face_down.set(opt.shrink_face_down)
tkopt.shade_filled_stacks.set(opt.shade_filled_stacks)
@@ -597,6 +599,10 @@ class PysolMenubarTkCommon:
label=n_("Enable highlight same &rank"),
variable=self.tkopt.highlight_samerank,
command=self.mOptEnableHighlightSameRank)
+ submenu.add_checkbutton(
+ label=n_("Enable face-down &peek"),
+ variable=self.tkopt.peek_facedown,
+ command=self.mOptEnablePeekFacedown)
submenu.add_checkbutton(
label=n_("Highlight &no matching"),
variable=self.tkopt.highlight_not_matching,
@@ -1532,6 +1538,12 @@ Unsupported game for import.
self.app.opt.highlight_samerank = self.tkopt.highlight_samerank.get()
# self.game.updateMenus()
+ def mOptEnablePeekFacedown(self, *args):
+ if self._cancelDrag(break_pause=False):
+ return
+ self.app.opt.peek_facedown = self.tkopt.peek_facedown.get()
+ # self.game.updateMenus()
+
def mOptEnableHighlightNotMatching(self, *args):
if self._cancelDrag(break_pause=False):
return