class GuiManager(object): """ Main class, loads the gui and handles all events. """ def __init__(self): """ Creates the main window. """ # Attributes self.avaliable_modes = [] self.current_show = None self.current_season = None is_first_time = not os.path.exists(CONFIG_FILE) self.config = Config.get() # API try: self.api = getattr(Hosts, self.config.get_key("site")).api except Exception, error: self.api = Hosts.AVALIABLE_APIS[0] self.marks = SList(MARKS_FILE) self.favorites = SList(FAVORITES_FILE) self.accounts = ACCOUNTS self.settings_dialog = SettingsDialog(self) # Gtk builder self.builder = gtk.Builder() self.builder.add_from_file(MAIN_GUI_FILE) self.builder.connect_signals(self) # Getting the used widgets glade_objects = [ "main_window", "statusbar_label", "progress_box", "progress", "progress_label", "name_filter", "name_filter_clear", "name_list", "name_list_model", "file_viewer", "file_viewer_model", "mode_combo", "mode_liststore", "site_combo", "search_button", "search_clear", "search_entry", "search_hbox", "sidebar", "sidebar_vbox", "path_label", "info_window", "info_title", "info_label", "info_image", "file_viewer_menu", "error_label", "error_dialog", "header_hbox", "main_hpaned", "about_dialog", "site_liststore", ] for glade_object in glade_objects: setattr(self, glade_object, self.builder.get_object(glade_object)) # Set up the filter for the show list self.name_list_model_filter = self.name_list_model.filter_new() self.name_list_model_filter.set_visible_func( generic_visible_func, (self.name_filter, NAME_LIST_COLUMN_TEXT)) self.name_list.set_model(self.name_list_model_filter) # Get last mode, needs to be before the filling combo functions last_mode = self.config.get_key("last_mode") # Fill combobox self.fill_sites_combobox() self.fill_mode_combobox() # Set last window position and size last_x, last_y = self.config.get_key("last_window_pos") last_width, last_height = self.config.get_key("last_window_size") self.main_window.move(last_x, last_y) self.main_window.resize(last_width, last_height) # Now we show the window self.main_window.show_all() # Start on last mode try: self.mode_combo.set_active(self.avaliable_modes.index(last_mode)) except: self.set_mode_shows() # Login self.background_task(self.login_accounts, freeze=False) if is_first_time: wizard = Wizard(self.main_window) wizard.show()
# run linked lists from SList import SList from SLNode import SLNode sll = SList() sll.head = SLNode('Alice') sll.head.next = SLNode('Bob') sll.head.next.next = SLNode('Person') sll.print_all_vals() sll.insert_after('Bob', 'Stacy') sll.delete('Bob') sll.print_all_vals() sll.delete('Stacy') sll.print_all_vals() sll.prepend('The First!').prepend("the most first") sll.print_all_vals() sll.append('The Last!').append('The Most Last!') sll.print_all_vals()