def save_state(self): """We save the state, which is basically the tab_index list""" # Update the visiblity status of all tabs # Leave tabs we dont know anything about it the state as they # might come from a plugin for i, (name, visible) in enumerate(self.state): log.debug('Testing name: %s', name) if name in self.tabs: self.state[i] = (name, self.tabs[name].is_visible) log.debug('Set to %s', self.state[i]) state = self.state save_pickled_state_file('tabs.state', state)
def save_state(self): # Get the current sort order of the view column_id, sort_order = self.liststore.get_sort_column_id() # Setup state dict state = { 'columns': {}, 'sort_id': column_id, 'sort_order': int(sort_order) if sort_order else None } for index, column in enumerate(self.listview.get_columns()): state['columns'][column.get_title()] = { 'position': index, 'width': column.get_width() } save_pickled_state_file('peers_tab.state', state)
def save_state(self, filename): """Saves the listview state (column positions and visibility) to filename.""" # A list of ListViewColumnStates state = [] # Workaround for all zero widths after removing column on shutdown if not any(c.get_width() for c in self.treeview.get_columns()): return # Get the list of TreeViewColumns from the TreeView for counter, column in enumerate(self.treeview.get_columns()): # Append a new column state to the state list state.append(self.create_column_state(column, counter)) state += self.removed_columns_state self.state = state save_pickled_state_file(filename, state)