summaryrefslogtreecommitdiff
path: root/jfr_playoff/gui/frames/team.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-06-02 23:42:38 +0200
committeremkael <emkael@tlen.pl>2019-06-02 23:42:38 +0200
commitd6692ee021a2c8c2b73b327aefaf43e139346e9c (patch)
treeaf7e0d2a1df9c406d121d9b032c927499f6a2192 /jfr_playoff/gui/frames/team.py
parentfe24609295876943391e572d3ec7a48f3f962e75 (diff)
Providing Teamy database list on DB settings change
Diffstat (limited to 'jfr_playoff/gui/frames/team.py')
-rw-r--r--jfr_playoff/gui/frames/team.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/jfr_playoff/gui/frames/team.py b/jfr_playoff/gui/frames/team.py
index 78b2be0..e7eb83d 100644
--- a/jfr_playoff/gui/frames/team.py
+++ b/jfr_playoff/gui/frames/team.py
@@ -139,19 +139,38 @@ class TeamFetchSettingsFrame(tk.Frame):
teams['max_teams'] = maxTeams
return teams
+ def _createDBList(self, values):
+ self.fetchDBField = ttk.OptionMenu(
+ self, self.fetchDB, *([''] + values))
+ self.fetchDBField.grid(row=0, column=3, sticky=tk.W+tk.E)
+
+ def _onDBListChange(self, *args):
+ self.fetchDBField.destroy()
+ self._createDBList(self.winfo_toplevel().getDBs())
+
+ def _sourceChange(self, *args):
+ self.fetchDBField.configure(state=tk.DISABLED)
+ self.fetchLink.configure(state=tk.DISABLED)
+ if self.fetchSource.get() == self.SOURCE_LINK:
+ self.fetchLink.configure(state=tk.NORMAL)
+ elif self.fetchSource.get() == self.SOURCE_DB:
+ self.fetchDBField.configure(state=tk.NORMAL)
+
def renderContent(self):
(ttk.Label(self, text=' ')).grid(row=0, column=0, rowspan=2)
self.fetchSource = tk.IntVar()
self.fetchSource.set(self.SOURCE_LINK)
+ self.fetchSource.trace('w', self._sourceChange)
(ttk.Radiobutton(
self, text='Baza danych',
variable=self.fetchSource, value=self.SOURCE_DB)).grid(
row=0, column=1, columnspan=2, sticky=tk.W)
self.fetchDB = tk.StringVar()
self.fetchDB.trace('w', self._changeNotify)
- (ttk.OptionMenu(self, self.fetchDB, '')).grid(
- row=0, column=3, sticky=tk.W+tk.E)
+ self._createDBList([])
+ self.winfo_toplevel().bind(
+ '<<DBListChanged>>', self._onDBListChange, add='+')
(ttk.Radiobutton(
self, text='Strona wyników',