def _build_interface(self): self.list = gtkwidgets.simplelist.SimpleList( headers=["Theme", "Active"], types=[int, str, bool], selection_type='multiple') #self.list = common.list_view_new_text(select_multiple=False) self.pack_start(self.list) self.hbox = gtk.HBox() self.hbox.set_spacing(6) self.pack_start(self.hbox, False, False) self.button_add = gtk.Button(stock=gtk.STOCK_ADD) #self.button_add.set_sensitive(False) self.hbox.pack_start(self.button_add) self.button_remove = gtk.Button(stock=gtk.STOCK_REMOVE) self.button_remove.set_sensitive(False) self.hbox.pack_start(self.button_remove) self.filechooserdialog = common.filechooserdialog_new_with_filters( title=_('Select a theme archive'), parent=common.widget_get_top_parent(self), filters=[ common.filefilters['all'], common.filefilters['msstyles'] # ,common.filefilters['archives'] ], default_filter='msstyles', action=gtk.FILE_CHOOSER_ACTION_OPEN, on_response_func=self._dialog_response) self.list.connect('changed', self.list_changed) self.list.connect('toggled', self.theme_toggled) self.button_add.connect('clicked', self.button_add_clicked) self.button_remove.connect('clicked', self.button_remove_clicked) self.show_all()
def _build_interface(self): self.list = gtkwidgets.simplelist.SimpleList( headers = ["Theme", "Active"], types = [int, str, bool], selection_type = 'multiple' ) #self.list = common.list_view_new_text(select_multiple=False) self.pack_start(self.list) self.hbox = gtk.HBox() self.hbox.set_spacing(6) self.pack_start(self.hbox, False, False) self.button_add = gtk.Button(stock=gtk.STOCK_ADD) #self.button_add.set_sensitive(False) self.hbox.pack_start(self.button_add) self.button_remove = gtk.Button(stock=gtk.STOCK_REMOVE) self.button_remove.set_sensitive(False) self.hbox.pack_start(self.button_remove) self.filechooserdialog = common.filechooserdialog_new_with_filters( title = _('Select a theme archive'), parent = common.widget_get_top_parent(self), filters = [ common.filefilters['all'] ,common.filefilters['msstyles'] # ,common.filefilters['archives'] ], default_filter = 'msstyles', action = gtk.FILE_CHOOSER_ACTION_OPEN, on_response_func = self._dialog_response ) self.list.connect('changed', self.list_changed) self.button_add.connect('clicked', self.button_add_clicked) self.button_remove.connect('clicked', self.button_remove_clicked) self.show_all()
def _build_interface(self): self.vbox = gtk.VBox() self.vbox.set_spacing(6) self.vbox_top = gtk.VBox() self.vbox_top.set_spacing(0) self.list = common.list_view_new_icon_and_text(headers=['', _('Drive'), _('Mapping')], number_of_text_columns=2, select_multiple=False) self.vbox_top.pack_start(self.list, True, True) self.hbox_buttons = gtk.HBox() self.hbox_buttons.set_spacing(6) self.button_add = gtk.Button(stock=gtk.STOCK_ADD) self.button_add.set_sensitive(True) self.hbox_buttons.pack_start(self.button_add, False, False) self.button_remove = gtk.Button(stock=gtk.STOCK_REMOVE) self.button_remove.set_sensitive(False) self.hbox_buttons.pack_start(self.button_remove, False, False) self.button_auto = common.button_new_with_image('gtk-refresh', label=_("Autodetect"), use_underline=False) self.hbox_buttons.pack_end(self.button_auto, False, False) self.vbox_top.pack_start(self.hbox_buttons, False, False) self.vbox.pack_start(self.vbox_top, True, True) self.vbox_bottom = gtk.VBox() self.vbox_bottom.set_spacing(6) self.path_entry = gtk.Entry() self.path_button = gtk.Button(_('Browse...')) self.path_box = common.new_label_with_widget('%s: ' % _('Path'), [ self.path_entry, self.path_button ]) self.vbox_bottom.pack_start(self.path_box, False, True) #self.expander = gtk.Expander(_('Advanced')) #self.vbox_bottom.pack_start(self.expander, False, True) self.vbox_expander = gtk.VBox() self.vbox_expander.set_spacing(6) #self.expander.add(self.vbox_expander) self.vbox_bottom.pack_start(self.vbox_expander, False, True) self.device_entry = gtk.Entry() self.device_button = gtk.Button(_('Browse...')) self.device_box = common.new_label_with_widget('%s: ' % _('Device'), [ self.device_entry, self.device_button ]) self.vbox_expander.pack_start(self.device_box, False, True) self.hbox_toggle = gtk.HBox() self.device_toggle = gtk.CheckButton(_('Use device file for path')) self.hbox_toggle.pack_end(self.device_toggle, False, True) self.vbox_expander.pack_start(self.hbox_toggle, False, True) self.type = gtk.combo_box_new_text() for d_type,d_name in self.DRIVE_TYPES: self.type.append_text(d_name) self.type_box = common.new_label_with_widget('%s: ' % _('Type'), self.type) self.vbox_bottom.pack_start(self.type_box, False, True) self.vbox.pack_start(self.vbox_bottom, False, True) self.list.connect('changed', self.list_changed) self.button_add.connect('clicked', self.button_add_clicked) self.button_remove.connect('clicked', self.button_remove_clicked) self.button_auto.connect('clicked', self.button_auto_clicked) self.path_entry.connect('changed', self.path_changed) self.path_button.connect('clicked', self.button_path_clicked) self.type.connect('changed', self.type_changed) self.device_entry.connect('changed', self.device_changed) self.device_button.connect('clicked', self.button_device_clicked) self.device_toggle.connect_after('toggled', self.device_toggled) self.list.renderers[1].connect('edited', self.drive_letter_edit) self.list.renderers[1].set_property('editable', True) self.list.renderers[2].connect('edited', self.drive_mapping_edit) self.list.renderers[2].set_property('editable', True) self.frame = common.frame_wrap(self.vbox, self.title) self.pack_start(self.frame, True, True) self.sizable = [self.path_box.widget, self.type] self.show_all() self.hbox_toggle.hide() self.filechooserdialog_path = common.filechooserdialog_new_with_filters( title = _('Select which folder the drive should be mapped to'), parent = common.widget_get_top_parent(self), action = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, on_response_func = self.path_dialog_response) self.filechooserdialog_device = common.filechooserdialog_new_with_filters( title = _('Select which device file the drive use'), parent = common.widget_get_top_parent(self), action = gtk.FILE_CHOOSER_ACTION_OPEN, on_response_func = self.device_dialog_response)
def _build_interface(self): self.vbox = gtk.VBox() self.vbox.set_spacing(6) self.vbox_top = gtk.VBox() self.vbox_top.set_spacing(0) self.list = common.list_view_new_icon_and_text( headers=['', _('Drive'), _('Mapping')], number_of_text_columns=2, select_multiple=False) self.vbox_top.pack_start(self.list, True, True) self.hbox_buttons = gtk.HBox() self.hbox_buttons.set_spacing(6) self.button_add = gtk.Button(stock=gtk.STOCK_ADD) self.button_add.set_sensitive(True) self.hbox_buttons.pack_start(self.button_add, False, False) self.button_remove = gtk.Button(stock=gtk.STOCK_REMOVE) self.button_remove.set_sensitive(False) self.hbox_buttons.pack_start(self.button_remove, False, False) self.button_auto = common.button_new_with_image('gtk-refresh', label=_("Autodetect"), use_underline=False) self.hbox_buttons.pack_end(self.button_auto, False, False) self.vbox_top.pack_start(self.hbox_buttons, False, False) self.vbox.pack_start(self.vbox_top, True, True) self.vbox_bottom = gtk.VBox() self.vbox_bottom.set_spacing(6) self.path_entry = gtk.Entry() self.path_button = gtk.Button(_('Browse...')) self.path_box = common.new_label_with_widget( '%s: ' % _('Path'), [self.path_entry, self.path_button]) self.vbox_bottom.pack_start(self.path_box, False, True) #self.expander = gtk.Expander(_('Advanced')) #self.vbox_bottom.pack_start(self.expander, False, True) self.vbox_expander = gtk.VBox() self.vbox_expander.set_spacing(6) #self.expander.add(self.vbox_expander) self.vbox_bottom.pack_start(self.vbox_expander, False, True) self.device_entry = gtk.Entry() self.device_button = gtk.Button(_('Browse...')) self.device_box = common.new_label_with_widget( '%s: ' % _('Device'), [self.device_entry, self.device_button]) self.vbox_expander.pack_start(self.device_box, False, True) self.hbox_toggle = gtk.HBox() self.device_toggle = gtk.CheckButton(_('Use device file for path')) self.hbox_toggle.pack_end(self.device_toggle, False, True) self.vbox_expander.pack_start(self.hbox_toggle, False, True) self.type = gtk.combo_box_new_text() for d_type, d_name in self.DRIVE_TYPES: self.type.append_text(d_name) self.type_box = common.new_label_with_widget('%s: ' % _('Type'), self.type) self.vbox_bottom.pack_start(self.type_box, False, True) self.vbox.pack_start(self.vbox_bottom, False, True) self.list.connect('changed', self.list_changed) self.button_add.connect('clicked', self.button_add_clicked) self.button_remove.connect('clicked', self.button_remove_clicked) self.button_auto.connect('clicked', self.button_auto_clicked) self.path_entry.connect('changed', self.path_changed) self.path_button.connect('clicked', self.button_path_clicked) self.type.connect('changed', self.type_changed) self.device_entry.connect('changed', self.device_changed) self.device_button.connect('clicked', self.button_device_clicked) self.device_toggle.connect_after('toggled', self.device_toggled) self.list.renderers[1].connect('edited', self.drive_letter_edit) self.list.renderers[1].set_property('editable', True) self.list.renderers[2].connect('edited', self.drive_mapping_edit) self.list.renderers[2].set_property('editable', True) self.frame = common.frame_wrap(self.vbox, self.title) self.pack_start(self.frame, True, True) self.sizable = [self.path_box.widget, self.type] self.show_all() self.hbox_toggle.hide() self.filechooserdialog_path = common.filechooserdialog_new_with_filters( title=_('Select which folder the drive should be mapped to'), parent=common.widget_get_top_parent(self), action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, on_response_func=self.path_dialog_response) self.filechooserdialog_device = common.filechooserdialog_new_with_filters( title=_('Select which device file the drive use'), parent=common.widget_get_top_parent(self), action=gtk.FILE_CHOOSER_ACTION_OPEN, on_response_func=self.device_dialog_response)