diff options
author | emkael <emkael@tlen.pl> | 2019-06-23 13:55:29 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-06-23 13:55:29 +0200 |
commit | f4627ece00ed7959c3fb4d2aa601366fb85ec7c1 (patch) | |
tree | 9748eca74e8a7c9bd2307e8e7fadc8e76865e92c /jfr_playoff | |
parent | 5d9ccd1ddee2aa4b9e651b68d20dabbc5fba3c4c (diff) |
Protocol for resetting tab data on "new" command
Diffstat (limited to 'jfr_playoff')
-rw-r--r-- | jfr_playoff/gui/__init__.py | 14 | ||||
-rw-r--r-- | jfr_playoff/gui/tabs.py | 7 |
2 files changed, 21 insertions, 0 deletions
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): |