Add create season function.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
from dsst_gtk3 import dialogs, util
|
||||
import datetime
|
||||
|
||||
from dsst_gtk3 import dialogs, util, gtk_ui
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
class DialogHandlers:
|
||||
@@ -27,3 +30,20 @@ class DialogHandlers:
|
||||
|
||||
def do_manage_drinks(self, *_):
|
||||
result = dialogs.show_manage_drinks_dialog(self.app.ui)
|
||||
|
||||
def do_show_date_picker(self, entry: 'Gtk.Entry', *_):
|
||||
dialog = self.app.ui.get_object('date_picker_dialog')
|
||||
result = dialog.run()
|
||||
dialog.hide()
|
||||
if result == Gtk.ResponseType.OK:
|
||||
date = self.app.ui.get_object('date_picker_calendar').get_date()
|
||||
date_string = '{}-{:02d}-{:02d}'.format(date.year, date.month +1, date.day)
|
||||
entry.set_text(date_string)
|
||||
|
||||
@staticmethod
|
||||
def do_set_today(cal: 'Gtk.Calendar'):
|
||||
"""Set date of a Gtk Calendar to today
|
||||
:param cal: Gtk.Calendar
|
||||
"""
|
||||
cal.select_month = datetime.date.today().month
|
||||
cal.select_day = datetime.date.today().day
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from dsst_gtk3 import dialogs, gtk_ui
|
||||
from dsst_gtk3 import dialogs, gtk_ui, reload
|
||||
|
||||
|
||||
class SeasonHandlers:
|
||||
@@ -7,12 +7,14 @@ class SeasonHandlers:
|
||||
self.app = app
|
||||
|
||||
def do_add_season(self, *_):
|
||||
name = dialogs.enter_string_dialog(self.app.ui, 'Name for the new Season')
|
||||
if name:
|
||||
season = dialogs.edit_season(self.app.ui)
|
||||
if season:
|
||||
self.app.update_season(season)
|
||||
self.app.reload()
|
||||
|
||||
def do_season_selected(self, *_):
|
||||
self.app.season_changed = True
|
||||
self.app.episodes.valid = False
|
||||
self.app.season_stats.valid = False
|
||||
self.app.reload()
|
||||
|
||||
def do_add_episode(self, *_):
|
||||
@@ -23,8 +25,7 @@ class SeasonHandlers:
|
||||
self.app.reload()
|
||||
|
||||
def on_selected_episode_changed(self, *_):
|
||||
self.app.ep_changed = True
|
||||
self.app.reload()
|
||||
reload.reload_episode_stats(self.app)
|
||||
|
||||
def on_episode_double_click(self, *_):
|
||||
self.app.ui.get_object('stats_notebook').set_current_page(1)
|
||||
|
||||
Reference in New Issue
Block a user