From f4627ece00ed7959c3fb4d2aa601366fb85ec7c1 Mon Sep 17 00:00:00 2001 From: emkael Date: Sun, 23 Jun 2019 13:55:29 +0200 Subject: Protocol for resetting tab data on "new" command --- jfr_playoff/gui/__init__.py | 14 ++++++++++++++ jfr_playoff/gui/tabs.py | 7 +++++++ 2 files changed, 21 insertions(+) (limited to 'jfr_playoff') diff --git a/jfr_playoff/gui/__init__.py b/jfr_playoff/gui/__init__.py index ffd9d00..4b1441b 100644 --- a/jfr_playoff/gui/__init__.py +++ b/jfr_playoff/gui/__init__.py @@ -10,6 +10,7 @@ class PlayoffGUI(tk.Tk): ttk.Style().configure('TLabelframe', padding=5) self.geometry('920x640') self.tabs = {} + self.newFileIndex = 0 def run(self): self.notebook = ttk.Notebook(self) @@ -17,8 +18,21 @@ class PlayoffGUI(tk.Tk): for tab in tabs.__all__: self.tabs[tab] = globals()[tab](self.notebook) self.notebook.add(self.tabs[tab], text=self.tabs[tab].title) + self.newFile() self.mainloop() + def _setValues(self, config): + for tab in self.tabs.values(): + tab.setValues(config) + + def _resetValues(self): + self._setValues({}) + + def newFile(self): + self.newFileIndex += 1 + self.title('Nowa drabinka %d' % (self.newFileIndex)) + self._resetValues() + def getDbConfig(self): return self.tabs['NetworkTab'].getDB() diff --git a/jfr_playoff/gui/tabs.py b/jfr_playoff/gui/tabs.py index 9d41f91..1eaa074 100644 --- a/jfr_playoff/gui/tabs.py +++ b/jfr_playoff/gui/tabs.py @@ -21,15 +21,22 @@ class PlayoffTab(ttk.Frame): ttk.Frame.__init__(self, master) self.frame = ttk.Frame(self) self.frame.pack(fill=tk.BOTH, expand=True, padx=5, pady=5) + self.initData() self.renderContent(self.frame) @property def title(self): pass + def initData(self): + pass + def renderContent(self, container): pass + def setValues(self, config): + pass + class MainSettingsTab(PlayoffTab): @property def title(self): -- cgit v1.2.3