From 99bc75f4c1d6cf1ce7599feb0cad04419fdd38d3 Mon Sep 17 00:00:00 2001 From: Joe R Date: Fri, 26 Nov 2021 19:13:02 -0500 Subject: [PATCH] Selected date format is saved and persists. --- pysollib/options.py | 3 +++ pysollib/tile/tkstats.py | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pysollib/options.py b/pysollib/options.py index effe752b..3bd1ad2e 100644 --- a/pysollib/options.py +++ b/pysollib/options.py @@ -107,6 +107,7 @@ last_gameid = integer game_holded = integer wm_maximized = boolean splashscreen = boolean +date_format = string mouse_type = string mouse_undo = boolean negative_bottom = boolean @@ -253,6 +254,7 @@ class Options: ('game_holded', 'int'), ('wm_maximized', 'bool'), ('splashscreen', 'bool'), + ('date_format', 'str'), ('mouse_type', 'str'), ('mouse_undo', 'bool'), ('negative_bottom', 'bool'), @@ -345,6 +347,7 @@ class Options: self.num_cards = False self.helpbar = False self.splashscreen = True + self.date_format = '%m-%d' self.mouse_button1 = 1 self.mouse_button2 = 2 self.mouse_button3 = 3 diff --git a/pysollib/tile/tkstats.py b/pysollib/tile/tkstats.py index 20cd2452..48f3d820 100644 --- a/pysollib/tile/tkstats.py +++ b/pysollib/tile/tkstats.py @@ -928,14 +928,14 @@ class ProgressionFrame(ttk.Frame): label_frame = ttk.LabelFrame(right_frame, text=_('Date format')) label_frame.pack(side='top', fill='x', pady=5) self.date_format = tkinter.StringVar() - self.date_format.set('%m-%d') + self.date_format.set(self.app.opt.date_format) b = ttk.Radiobutton(label_frame, text=_('MM-DD'), - command=self.updateGraph, + command=self.updateDateFormat, variable=self.date_format, value='%m-%d') b.pack(fill='x', expand=True, padx=3, pady=1) b = ttk.Radiobutton(label_frame, text=_('DD-MM'), - command=self.updateGraph, + command=self.updateDateFormat, variable=self.date_format, value='%d-%m') b.pack(fill='x', expand=True, padx=3, pady=1) @@ -1006,6 +1006,10 @@ class ProgressionFrame(ttk.Frame): self.updateGraph() + def updateDateFormat(self, *args): + self.app.opt.date_format = self.date_format.get() + self.updateGraph() + def updateGraph(self, *args): interval = self.variable.get() canvas = self.canvas