def _setup_columns(self): columns = self.view.get_columns() for col in columns: col.connect('notify::width', self.set_column_width) name = 'gui/col_width_%s' % (col.get_title()) width = settings.get_int_option(name, 200) col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) col.set_resizable(True) col.set_fixed_width(width)
def _configure_event(self, *e): pos = self.hsplitter.get_position() if pos != settings.get_int_option('gui/hsplitter', -1): settings.set_option('gui/hsplitter', pos) pos = self.vsplitter.get_position() if pos != settings.get_int_option('gui/vsplitter', -1): settings.set_option('gui/vsplitter', pos) (width, height) = self.window.get_size() if [width, height] != [settings.get_int_option("gui/mainw_"+key, -1) \ for key in ["width", "height"]]: settings.set_option('gui/mainw_height', height) settings.set_option('gui/mainw_width', width) (x, y) = self.window.get_position() if [x, y] != [settings.get_int_option("gui/mainw_"+key, -1) for \ key in ["x", "y"]]: settings.set_option('gui/mainw_x', x) settings.set_option('gui/mainw_y', y) return False
def _setup_position(self): """ Setup the position and sized """ width = settings.get_int_option('gui/mainw_width', 1000) height = settings.get_int_option('gui/mainw_height', 600) x = settings.get_int_option('gui/mainw_x', 10) y = settings.get_int_option('gui/mainw_y', 10) self.window.move(x, y) self.window.resize(width, height) pos = settings.get_int_option('gui/hsplitter', 400) self.hsplitter.set_position(pos) pos = settings.get_int_option('gui/vsplitter', 700) self.vsplitter.set_position(pos)
def set_column_width(self, col, *e): name = 'gui/col_width_%s' % (col.get_title()) w = col.get_width() if w != settings.get_int_option(name, -1): settings.set_option(name, w)