From 054c0f036853f470a66612784feac39650ac3c8d Mon Sep 17 00:00:00 2001 From: Joe R Date: Tue, 28 Jan 2025 23:32:15 -0500 Subject: [PATCH] Enable log for demo games --- po/de_pysol.po | 6 ++++++ po/fr_pysol.po | 6 ++++++ po/it_pysol.po | 6 ++++++ po/pl_pysol.po | 6 ++++++ po/pt_BR_pysol.po | 6 ++++++ po/pysol.pot | 6 ++++++ po/ru_pysol.po | 6 ++++++ pysollib/app_statistics.py | 19 +++++++------------ pysollib/tile/tkstats.py | 4 +++- pysollib/ui/tktile/menubar.py | 3 +++ 10 files changed, 55 insertions(+), 13 deletions(-) diff --git a/po/de_pysol.po b/po/de_pysol.po index dd6532e8..c877b794 100644 --- a/po/de_pysol.po +++ b/po/de_pysol.po @@ -4370,6 +4370,9 @@ msgstr "Aktuelle Sitzung" msgid "Log" msgstr "Protokoll" +msgid "Demo Log" +msgstr "" + #: pysollib/tile/tkstats.py:523 data/pysolfc.glade:1404 msgid "Full log" msgstr "Volles Protokoll" @@ -5171,6 +5174,9 @@ msgstr "Kommentare..." msgid "Log..." msgstr "" +msgid "Demo Log..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:427 msgid "D&emo statistics..." msgstr "D&emo Statistiken..." diff --git a/po/fr_pysol.po b/po/fr_pysol.po index 70b18ffc..a21722b4 100644 --- a/po/fr_pysol.po +++ b/po/fr_pysol.po @@ -4421,6 +4421,9 @@ msgstr "Session en cours" msgid "Log" msgstr "Journal" +msgid "Demo Log" +msgstr "" + #: pysollib/tile/tkstats.py:523 data/pysolfc.glade:1404 msgid "Full log" msgstr "Journal complet" @@ -5222,6 +5225,9 @@ msgstr "&Commentaires..." msgid "Log..." msgstr "Journal..." +msgid "Demo Log..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:427 msgid "D&emo statistics..." msgstr "Statistiques d&émo..." diff --git a/po/it_pysol.po b/po/it_pysol.po index 28eba487..08a8b3ef 100644 --- a/po/it_pysol.po +++ b/po/it_pysol.po @@ -4485,6 +4485,9 @@ msgstr "Questa sessione" msgid "Log" msgstr "Log" +msgid "Demo Log" +msgstr "" + #: pysollib/tile/tkstats.py:523 data/pysolfc.glade:1404 msgid "Full log" msgstr "Log completo" @@ -5288,6 +5291,9 @@ msgstr "&Commenti..." msgid "Log..." msgstr "Log..." +msgid "Demo Log..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:427 msgid "D&emo statistics..." msgstr "Statistiche d&emo..." diff --git a/po/pl_pysol.po b/po/pl_pysol.po index c77f81c8..c028d1d9 100644 --- a/po/pl_pysol.po +++ b/po/pl_pysol.po @@ -4438,6 +4438,9 @@ msgstr "Bieżąca sesja" msgid "Log" msgstr "Log" +msgid "Demo Log" +msgstr "" + #: pysollib/tile/tkstats.py:523 data/pysolfc.glade:1404 msgid "Full log" msgstr "Kompletny log" @@ -5242,6 +5245,9 @@ msgstr "Komentarze..." msgid "Log..." msgstr "Log..." +msgid "Demo Log..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:427 msgid "D&emo statistics..." msgstr "D&emo statystyk..." diff --git a/po/pt_BR_pysol.po b/po/pt_BR_pysol.po index 486409d1..6ddcb2de 100644 --- a/po/pt_BR_pysol.po +++ b/po/pt_BR_pysol.po @@ -4444,6 +4444,9 @@ msgstr "Sessão atual" msgid "Log" msgstr "registro" +msgid "Demo Log" +msgstr "" + #: pysollib/tile/tkstats.py:523 data/pysolfc.glade:1404 msgid "Full log" msgstr "Registro completo" @@ -5244,6 +5247,9 @@ msgstr "&Comentários..." msgid "Log..." msgstr "Registro" +msgid "Demo Log..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:427 msgid "D&emo statistics..." msgstr "Estatísticas de D&emo..." diff --git a/po/pysol.pot b/po/pysol.pot index d34ef7a5..6248391f 100644 --- a/po/pysol.pot +++ b/po/pysol.pot @@ -4224,6 +4224,9 @@ msgstr "" msgid "Log" msgstr "" +msgid "Demo Log" +msgstr "" + #: pysollib/tile/tkstats.py:523 data/pysolfc.glade:1404 msgid "Full log" msgstr "" @@ -4974,6 +4977,9 @@ msgstr "" msgid "Log..." msgstr "" +msgid "Demo Log..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:427 msgid "D&emo statistics..." msgstr "" diff --git a/po/ru_pysol.po b/po/ru_pysol.po index 9f74cb27..3924c6c6 100644 --- a/po/ru_pysol.po +++ b/po/ru_pysol.po @@ -4494,6 +4494,9 @@ msgstr "Текущая сессия" msgid "Log" msgstr "Лог" +msgid "Demo Log" +msgstr "" + #: pysollib/tile/tkstats.py:523 data/pysolfc.glade:1404 msgid "Full log" msgstr "Полный лог" @@ -5311,6 +5314,9 @@ msgstr "&Комментарии..." msgid "Log..." msgstr "Лог..." +msgid "Demo Log..." +msgstr "" + #: pysollib/ui/tktile/menubar.py:427 msgid "D&emo statistics..." msgstr "Статистика демо..." diff --git a/pysollib/app_statistics.py b/pysollib/app_statistics.py index ba839b05..9b87ce02 100644 --- a/pysollib/app_statistics.py +++ b/pysollib/app_statistics.py @@ -115,18 +115,13 @@ class Statistics: game.GAME_VERSION) # full log if status >= 0: - if player is None: - # demo - ret = self.updateGameStat(player, game, status) - else: - # player - if player not in self.prev_games: - self.prev_games[player] = [] - self.prev_games[player].append(log) - if player not in self.all_prev_games: - self.all_prev_games[player] = [] - self.all_prev_games[player].append(log) - ret = self.updateGameStat(player, game, status) + if player not in self.prev_games: + self.prev_games[player] = [] + self.prev_games[player].append(log) + if player not in self.all_prev_games: + self.all_prev_games[player] = [] + self.all_prev_games[player].append(log) + ret = self.updateGameStat(player, game, status) # session log if player not in self.session_games: self.session_games[player] = [] diff --git a/pysollib/tile/tkstats.py b/pysollib/tile/tkstats.py index 692269f1..cfc1b159 100644 --- a/pysollib/tile/tkstats.py +++ b/pysollib/tile/tkstats.py @@ -377,7 +377,7 @@ class TreeFormatter(PysolStatsFormatter): return 1 def writeLog(self, player, prev_games, sort_by='date'): - if not player or not prev_games: + if not prev_games: return 0 num_rows = 0 results = self.getLogResults(player, prev_games) @@ -520,6 +520,8 @@ class LogDialog(MfxDialog): kw = self.initKw(kw) title = _('Log') + if player is None: + title = _('Demo Log') MfxDialog.__init__(self, parent, title, kw.resizable, kw.default) self.top.wm_minsize(400, 200) diff --git a/pysollib/ui/tktile/menubar.py b/pysollib/ui/tktile/menubar.py index 1c0cb4e0..5abdc055 100644 --- a/pysollib/ui/tktile/menubar.py +++ b/pysollib/ui/tktile/menubar.py @@ -620,6 +620,9 @@ class PysolMenubarTkCommon: menu.add_command( label=n_("Log..."), command=lambda: self.mPlayerStats(mode=103)) + menu.add_command( + label=n_("Demo Log..."), + command=lambda: self.mPlayerStats(mode=1103)) menu.add_separator() menu.add_command( label=n_("&Comments..."),