Skip to content

Commit

Permalink
[GUI] Added select/deselect all button in variable selection dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Callidior committed Apr 19, 2021
1 parent 420a16c commit 8dfec21
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions maxdiv/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,10 +1149,13 @@ def body(self, master):
self._intro = ttk.Label(master, text = 'Please select the variables to be loaded:')
self._vars = [tkinter.BooleanVar(self, value = True) for i in range(nv)]
self._btns = [ttk.Checkbutton(master, text = self.options[i], variable = self._vars[i]) for i in range(nv)]
self._checkAllVar = tkinter.BooleanVar(self, value = True)
self._checkAllBtn = ttk.Checkbutton(master, text = 'Select/deselect all', variable = self._checkAllVar, command = self.toggleAll)

self._intro.grid(row = 0, column = 0, columnspan = columns, sticky = W, padx = PADDING, pady = PADDING)
self._checkAllBtn.grid(row = 1, column = 0, columnspan = columns, sticky = W, padx = PADDING, pady = PADDING)
for i in range(nv):
self._btns[i].grid(row = i % rows + 1, column = i // rows, sticky = W, padx = PADDING, pady = PADDING)
self._btns[i].grid(row = i % rows + 2, column = i // rows, sticky = W, padx = PADDING, pady = PADDING)

# Record range
if self.numRecords > 1:
Expand All @@ -1172,11 +1175,17 @@ def body(self, master):
self._txtFirstRecord.pack(side = 'left', padx = 2)
self._lblRecRange2.pack(side = 'left')
self._txtLastRecord.pack(side = 'left', padx = (2, 0))
self._frmRecRange.grid(row = rows + 2, column = 0, columnspan = columns, sticky = W, padx = PADDING, pady = PADDING)
self._frmRecRange.grid(row = rows + 3, column = 0, columnspan = columns, sticky = W, padx = PADDING, pady = PADDING)

self.resizable(False, False)
return None


def toggleAll(self):

for var in self._vars:
var.set(self._checkAllVar.get())


def apply(self):

Expand Down

0 comments on commit 8dfec21

Please sign in to comment.