Skip to content

Commit

Permalink
filters: place reset buttons more evenly
Browse files Browse the repository at this point in the history
  • Loading branch information
Noiredd committed Feb 4, 2019
1 parent c9e5428 commit 3938986
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions filmatyk/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def buildUI(self):
self.yTo = yTo = tk.Spinbox(m, width=5, textvariable=self.year_to, command=self._updateTo)
yTo.bind('<KeyRelease>', self._updateTo)
yTo.grid(row=1, column=3, sticky=tk.NW)
ttk.Button(m, text='Reset', width=5, command=self.reset).grid(row=1, column=4, sticky=tk.NW)
ttk.Button(m, text='Reset', width=5, command=self.reset).grid(row=1, column=4, sticky=tk.NE)
m.grid_columnconfigure(4, weight=1) # for even placement of the reset button
def populateChoices(self, items:list):
all_years = set()
for item in items:
Expand Down Expand Up @@ -296,7 +297,7 @@ def buildUI(self):
command=self._update).pack(anchor=tk.W)
tk.Radiobutton(radios, text='dokładnie', variable=self.mode, value=2,
command=self._update).pack(anchor=tk.W)
ttk.Button(m, text='Reset', width=5, command=self.reset).grid(row=2, column=0, sticky=tk.SE)
ttk.Button(m, text='Reset', width=5, command=self.reset).grid(row=2, column=0, sticky=tk.NE)
def _update(self, event=None):
self.selected = self.getSelection()
if len(self.selected) == 0:
Expand Down Expand Up @@ -448,6 +449,7 @@ def buildUI(self):
rTo.bind('<KeyRelease>', self._updateTo)
rTo.grid(row=1, column=3, sticky=tk.NW)
ttk.Button(m, text='Reset', width=5, command=self.reset).grid(row=1, column=4, sticky=tk.NE)
m.grid_columnconfigure(4, weight=1)
def _updateTo(self, event=None):
self._update(to=True, event=event)
def _updateFrom(self, event=None):
Expand Down Expand Up @@ -523,6 +525,7 @@ def buildUI(self):
tdSpin.bind('<KeyRelease>', self._updateTo)
tdSpin.grid(row=2, column=3, sticky=tk.NW)
ttk.Button(m, text='Reset', width=5, command=self.reset).grid(row=1, column=4, rowspan=2, sticky=tk.E)
m.grid_columnconfigure(4, weight=2)
# shortcut buttons
sc = tk.Frame(m)
tk.Frame(sc, height=10).grid(row=0, column=0) # separator
Expand Down
18 changes: 9 additions & 9 deletions filmatyk/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ def __init__(self, debugMode=False):
movieDatabase = Database.restoreFromString('Movie', userdata.movies_data, self.api, self._setProgress)
self.databases.append(movieDatabase)
moviePresenter = Presenter(self, self.api, movieDatabase, userdata.movies_conf)
moviePresenter.addFilter(filters.YearFilter, row=0, column=0, sticky=tk.NW)
moviePresenter.addFilter(filters.RatingFilter, row=1, column=0, sticky=tk.NW)
moviePresenter.addFilter(filters.DateFilter, row=2, column=0, sticky=tk.NW)
moviePresenter.addFilter(filters.YearFilter, row=0, column=0, sticky=tk.EW)
moviePresenter.addFilter(filters.RatingFilter, row=1, column=0, sticky=tk.EW)
moviePresenter.addFilter(filters.DateFilter, row=2, column=0, sticky=tk.EW)
moviePresenter.addFilter(filters.GenreFilter, row=0, column=1, rowspan=3, sticky=tk.NW)
moviePresenter.addFilter(filters.CountryFilter, row=0, column=2, rowspan=3, sticky=tk.NW)
moviePresenter.addFilter(filters.DirectorFilter, row=0, column=3, rowspan=3, sticky=tk.NW)
Expand All @@ -174,9 +174,9 @@ def __init__(self, debugMode=False):
seriesDatabase = Database.restoreFromString('Series', userdata.series_data, self.api, self._setProgress)
self.databases.append(seriesDatabase)
seriesPresenter = Presenter(self, self.api, seriesDatabase, userdata.series_conf)
seriesPresenter.addFilter(filters.YearFilter, row=0, column=0, sticky=tk.NW)
seriesPresenter.addFilter(filters.RatingFilter, row=1, column=0, sticky=tk.NW)
seriesPresenter.addFilter(filters.DateFilter, row=2, column=0, sticky=tk.NW)
seriesPresenter.addFilter(filters.YearFilter, row=0, column=0, sticky=tk.EW)
seriesPresenter.addFilter(filters.RatingFilter, row=1, column=0, sticky=tk.EW)
seriesPresenter.addFilter(filters.DateFilter, row=2, column=0, sticky=tk.EW)
seriesPresenter.addFilter(filters.GenreFilter, row=0, column=1, rowspan=3, sticky=tk.NW)
seriesPresenter.addFilter(filters.CountryFilter, row=0, column=2, rowspan=3, sticky=tk.NW)
seriesPresenter.addFilter(filters.DirectorFilter, row=0, column=3, rowspan=3, sticky=tk.NW)
Expand All @@ -186,9 +186,9 @@ def __init__(self, debugMode=False):
gameDatabase = Database.restoreFromString('Game', userdata.games_data, self.api, self._setProgress)
self.databases.append(gameDatabase)
gamePresenter = Presenter(self, self.api, gameDatabase, userdata.games_conf)
gamePresenter.addFilter(filters.YearFilter, row=0, column=0, sticky=tk.NW)
gamePresenter.addFilter(filters.RatingFilter, row=1, column=0, sticky=tk.NW)
gamePresenter.addFilter(filters.DateFilter, row=2, column=0, sticky=tk.NW)
gamePresenter.addFilter(filters.YearFilter, row=0, column=0, sticky=tk.EW)
gamePresenter.addFilter(filters.RatingFilter, row=1, column=0, sticky=tk.EW)
gamePresenter.addFilter(filters.DateFilter, row=2, column=0, sticky=tk.EW)
gamePresenter.addFilter(filters.GenreFilter, row=0, column=1, rowspan=3, sticky=tk.NW)
gamePresenter.addFilter(filters.PlatformFilter, row=0, column=2, rowspan=3, sticky=tk.NW)
gamePresenter.addFilter(filters.GamemakerFilter, row=0, column=3, rowspan=3, sticky=tk.NW)
Expand Down

0 comments on commit 3938986

Please sign in to comment.