Load MySQL connection from config file.
This commit is contained in:
@@ -8,7 +8,7 @@ class BaseDataHandlers:
|
||||
self.app = app
|
||||
|
||||
def do_manage_players(self, *_):
|
||||
result = dialogs.show_manage_players_dialog(self.app.ui, 'Manage Players')
|
||||
dialogs.show_manage_players_dialog(self.app.ui, 'Manage Players')
|
||||
|
||||
def do_add_player(self, entry):
|
||||
if entry.get_text():
|
||||
@@ -17,7 +17,7 @@ class BaseDataHandlers:
|
||||
self.app.reload_base_data()
|
||||
|
||||
def do_manage_enemies(self, *_):
|
||||
result = dialogs.show_manage_enemies_dialog(self.app.ui, self.app.get_selected_season_id())
|
||||
dialogs.show_manage_enemies_dialog(self.app.ui, self.app.get_selected_season_id())
|
||||
|
||||
def on_player_name_edited(self, _, index, value):
|
||||
row = self.app.ui.get_object('all_players_store')[index]
|
||||
@@ -33,6 +33,12 @@ class BaseDataHandlers:
|
||||
.execute()
|
||||
self.app.reload_base_data()
|
||||
|
||||
def do_add_drink(self, entry):
|
||||
if entry.get_text():
|
||||
sql.Drink.create(name=entry.get_text(), vol=0)
|
||||
entry.set_text('')
|
||||
self.app.reload_base_data()
|
||||
|
||||
def on_drink_name_edited(self, _, index, value):
|
||||
row = self.app.ui.get_object('drink_store')[index]
|
||||
sql.Drink.update(name=value)\
|
||||
|
||||
@@ -16,5 +16,5 @@ class DeathHandlers:
|
||||
self.app.reload_for_season()
|
||||
self.app.reload_for_episode()
|
||||
|
||||
def on_penalty_drink_changed(self, widget, path, text):
|
||||
def on_penalty_drink_changed(self, _, path, text):
|
||||
self.app.ui.get_object('player_penalties_store')[path][2] = text
|
||||
|
||||
@@ -11,7 +11,7 @@ class DialogHandlers:
|
||||
""" Signal Handler for Add Player to Episode Button in Manage Episode Dialog
|
||||
:param combo: Combo box with all the available players
|
||||
"""
|
||||
player_id = util.Util.get_combo_value(combo, 0)
|
||||
player_id = util.get_combo_value(combo, 0)
|
||||
if player_id:
|
||||
self.app.ui.get_object('add_player_combo_box').set_active(-1)
|
||||
player = sql.Player.get(sql.Player.id == player_id)
|
||||
@@ -28,10 +28,3 @@ class DialogHandlers:
|
||||
|
||||
def do_manage_drinks(self, *_):
|
||||
result = dialogs.show_manage_drinks_dialog(self.app.ui)
|
||||
|
||||
def do_add_drink(self, entry):
|
||||
if entry.get_text():
|
||||
store = self.app.ui.get_object('drink_store')
|
||||
drink = sql.Drink.create(name=entry.get_text(), vol='0')
|
||||
store.append([drink.id, drink.name, drink.vol])
|
||||
entry.set_text('')
|
||||
|
||||
@@ -24,9 +24,9 @@ class Handlers(SeasonHandlers, BaseDataHandlers, DialogHandlers, DeathHandlers,
|
||||
VictoryHandlers.__init__(self, app)
|
||||
|
||||
@staticmethod
|
||||
def do_delete_event(*args):
|
||||
def do_delete_event(*_):
|
||||
""" Signal will be sent when app should close
|
||||
:param args: Arguments to the delete event
|
||||
:param _: Arguments to the delete event
|
||||
"""
|
||||
Gtk.main_quit()
|
||||
|
||||
@@ -35,4 +35,4 @@ class Handlers(SeasonHandlers, BaseDataHandlers, DialogHandlers, DeathHandlers,
|
||||
@staticmethod
|
||||
def do_delete_database(*_):
|
||||
sql_func.drop_tables()
|
||||
sql_func.create_tables()
|
||||
sql_func.create_tables()
|
||||
|
||||
@@ -20,7 +20,7 @@ class SeasonHandlers:
|
||||
season_id = self.app.get_selected_season_id()
|
||||
if not season_id:
|
||||
return
|
||||
episode = dialogs.show_episode_dialog(self.app.ui, 'Create new Episode', season_id)
|
||||
dialogs.show_episode_dialog(self.app.ui, 'Create new Episode', season_id)
|
||||
self.app.reload_for_season()
|
||||
|
||||
def on_selected_episode_changed(self, *_):
|
||||
|
||||
@@ -14,4 +14,4 @@ class VictoryHandlers:
|
||||
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()
|
||||
self.app.reload_for_episode()
|
||||
|
||||
Reference in New Issue
Block a user