from ui import models
import validation
import util
+import constants
class BaseUI():
menu_items = ("Settings", "About", "Refresh")
accounts_treeview = gtk.TreeView(model = self.accounts_model)
self.add_columns_to_accounts(accounts_treeview)
vbox.pack_start(accounts_treeview, False, False, 1)
+
+ clear_button = gtk.Button("Clear Cache")
+ clear_button.connect("clicked", self.on_clear_cache_clicked)
+ vbox.pack_start(clear_button, False, False, 1)
# all stock responses are negative, so we can use any positive value
new_button = dialog.add_button("New", RESPONSE_NEW)
dialog.destroy()
+ def on_clear_cache_clicked(self, button):
+ self.controller.clear_cache()
def get_selected_item(self, treeview, column):
def delete_account(self, treeview):
uid = self.get_selected_item(treeview, 0)
- self.controller.remove_account(uid)
+ self.controller.settings.remove_account(uid)
# refresh model
self.accounts_model.get_accounts()
treeview.append_column(column)
- def new_account_clicked(self, window):
+ def new_account_clicked(self, window, widget):
dialog = gtk.Dialog()
#get the vbox to pack all the settings into
result = dialog.run()
else:
valid_credentials = True
- self.controller.add_account(uid, api_key)
+ self.controller.settings.add_account(uid, api_key)
self.accounts_model.get_accounts()
else:
break
def about_clicked(self, button):
dialog = gtk.AboutDialog()
- dialog.set_website(self.controller.about_website)
- dialog.set_website_label(self.controller.about_website)
- dialog.set_name(self.controller.about_name)
- dialog.set_authors(self.controller.about_authors)
- dialog.set_comments(self.controller.about_text)
- dialog.set_version(self.controller.app_version)
+ dialog.set_website(constants.ABOUT_WEBSITE)
+ dialog.set_website_label(constants.ABOUT_WEBSITE)
+ dialog.set_name(constants.ABOUT_NAME)
+ dialog.set_authors(constants.ABOUT_AUTHORS)
+ dialog.set_comments(constants.ABOUT_TEXT)
+ dialog.set_version(constants.APP_VERSION)
dialog.run()
dialog.destroy()
self.win.connect("destroy", self.controller.quit)
self.win.show_all()
- # wait notification start --danny
+ wait_anim = hildon.hildon_banner_show_animation(self.win, None, "Loading overview...")
+ # it would seem that on diablo we have to wait for gtk to
+ # get its ass in gear...
+ while gtk.events_pending():
+ gtk.main_iteration()
# Create menu
menu = self.create_menu(self.win)
# Attach menu to the window
self.win.set_menu(menu)
-
# create the treeview --danny
self.char_model = models.CharacterListModel(self.controller)
treeview = gtk.TreeView(model = self.char_model)
self.win.add_with_scrollbar(treeview)
self.win.show_all()
- # wait notification end --danny
+ wait_anim.destroy()
def add_columns_to_treeview(self, treeview):
#Column 0 for the treeview
column.set_property("expand", True)
treeview.append_column(column)
- def refresh_clicked(self, button):
+ def refresh_clicked(self, button, window):
+ wait_anim = hildon.hildon_banner_show_animation(self.win, None, "Refreshing view...")
+ # let gtk catch up...
+ while gtk.events_pending():
+ gtk.main_iteration()
self.char_model.get_characters()
- # wait notification end --danny
+ wait_anim.destroy()
def do_charactersheet(self, treeview, path, view_column):
self.win.show_all()
- # wait notification start --danny
+ wait_anim = hildon.hildon_banner_show_animation(self.win, None, "Loading character sheet...")
+ # let gtk catch up...
+ while gtk.events_pending():
+ gtk.main_iteration()
# Create menu
# NOTE: we probably want a window-specific menu for this page, but the
self.win.add_with_scrollbar(vbox)
self.win.show_all()
- # wait notification end --danny
+ wait_anim.destroy()
# diablo doesnt have a glib module, but gobject module seems to have
# the same functions...
treeview.append_column(column)
- def refresh_clicked(self, button):
+ def refresh_clicked(self, button, window):
+ wait_anim = hildon.hildon_banner_show_animation(self.win, None, "Loading overview...")
+ # let gtk catch up...
+ while gtk.events_pending():
+ gtk.main_iteration()
self.skills_model.get_skills()
- # wait notification end --danny
+ wait_anim.destroy()
def update_live_sp(self):
self.live_sp_val = self.live_sp_val + self.spps * (self.UPDATE_INTERVAL / 1000)