Add option to add victory events.

This commit is contained in:
luxick
2018-02-28 12:03:38 +01:00
parent eded5828fa
commit 2bc59cd8d2
5 changed files with 293 additions and 3 deletions

View File

@@ -5,10 +5,11 @@ from dsst_gtk3.handlers.season_handlers import SeasonHandlers
from dsst_gtk3.handlers.base_data_handlers import BaseDataHandlers
from dsst_gtk3.handlers.dialog_handlers import DialogHandlers
from dsst_gtk3.handlers.death_handlers import DeathHandlers
from dsst_gtk3.handlers.victory_handlers import VictoryHandlers
from dsst_sql import sql_func
class Handlers(SeasonHandlers, BaseDataHandlers, DialogHandlers, DeathHandlers):
class Handlers(SeasonHandlers, BaseDataHandlers, DialogHandlers, DeathHandlers, VictoryHandlers):
"""Single callback handler class derived from specialized handler classes"""
def __init__(self, app):
""" Initialize handler class
@@ -20,6 +21,7 @@ class Handlers(SeasonHandlers, BaseDataHandlers, DialogHandlers, DeathHandlers):
BaseDataHandlers.__init__(self, app)
DialogHandlers.__init__(self, app)
DeathHandlers.__init__(self, app)
VictoryHandlers.__init__(self, app)
@staticmethod
def do_delete_event(*args):

View File

@@ -0,0 +1,17 @@
from gi.repository import Gtk
from dsst_gtk3 import dialogs, gtk_ui
class VictoryHandlers:
"""Callback handlers for signals related to managing victory events"""
def __init__(self, app: 'gtk_ui.GtkUi'):
self.app = app
def do_add_victory(self, *_):
ep_id = self.app.get_selected_episode_id()
if not ep_id:
return
result = dialogs.show_edit_victory_dialog(self.app.ui, ep_id)
if result == Gtk.ResponseType.OK:
self.app.reload_for_season()
self.app.reload_for_episode()