def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'accelerators', _('Associations')) # create interface container = Gtk.ScrolledWindow() container.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container.set_shadow_type(Gtk.ShadowType.IN) self._associations = Gtk.TreeStore(str, str) self._list = Gtk.TreeView(model=self._associations) self._list.set_rules_hint(True) self._list.set_headers_visible(False) cell_title = Gtk.CellRendererText() cell_command = Gtk.CellRendererText() col_title = Gtk.TreeViewColumn(None, cell_title, text=0) col_title.set_min_width(200) col_title.set_resizable(True) col_command = Gtk.TreeViewColumn(None, cell_command, text=1) col_command.set_resizable(True) col_command.set_expand(True) self._list.append_column(col_title) self._list.append_column(col_command) # create add menu self._add_menu = Gtk.Menu() item_add_mime_type = Gtk.MenuItem(label=_('Add mime type')) item_add_mime_type.connect('activate', self.__add_mime_type) item_add_application = Gtk.MenuItem( label=_('Add application to mime type')) item_add_application.connect('activate', self.__add_application) self._add_menu.append(item_add_mime_type) self._add_menu.append(item_add_application) self._add_menu.show_all() # create controls hbox_controls = Gtk.HBox(homogeneous=False, spacing=5) button_add = Gtk.Button(stock=Gtk.STOCK_ADD) button_add.connect('clicked', self.__button_add_clicked) # pack interface container.add(self._list) hbox_controls.pack_start(button_add, False, False, 0) self.pack_start(container, True, True, 0) self.pack_end(hbox_controls, False, False, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'operation', _('Operation')) # create frames frame_general = Gtk.Frame(label=_('General')) vbox_general = Gtk.VBox(False, 0) vbox_general.set_border_width(5) frame_mounts = Gtk.Frame(label=_('Mounts')) vbox_mounts = Gtk.VBox(False, 0) vbox_mounts.set_border_width(5) frame_confirmations = Gtk.Frame(label=_('Confirmation')) vbox_confirmations = Gtk.VBox(False, 0) vbox_confirmations.set_border_width(5) # create components self._checkbox_trash_files = Gtk.CheckButton(_('Delete items to trashcan')) self._checkbox_reserve_size = Gtk.CheckButton(_('Reserve free space on copy/move')) self._checkbox_automount_on_start = Gtk.CheckButton(_('Automount drives on start up')) self._checkbox_automount_on_insert = Gtk.CheckButton(_('Automount removable drives when inserted')) self._checkbox_confirm_delete = Gtk.CheckButton(_('Show confirmation dialog before deleting items')) self._checkbox_trash_files.connect('toggled', self._parent.enable_save) self._checkbox_reserve_size.connect('toggled', self._parent.enable_save) self._checkbox_automount_on_start.connect('toggled', self._parent.enable_save) self._checkbox_automount_on_insert.connect('toggled', self._parent.enable_save) self._checkbox_confirm_delete.connect('toggled', self._confirm_delete_toggle) # pack user interface vbox_general.pack_start(self._checkbox_trash_files, False, False, 0) vbox_general.pack_start(self._checkbox_reserve_size, False, False, 0) vbox_mounts.pack_start(self._checkbox_automount_on_start, False, False, 0) vbox_mounts.pack_start(self._checkbox_automount_on_insert, False, False, 0) vbox_confirmations.pack_start(self._checkbox_confirm_delete, False, False, 0) frame_general.add(vbox_general) frame_mounts.add(vbox_mounts) frame_confirmations.add(vbox_confirmations) self.pack_start(frame_general, False, False, 0) self.pack_start(frame_mounts, False, False, 0) self.pack_start(frame_confirmations, False, False, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'commands', _('Commands')) # create list box container = Gtk.ScrolledWindow() container.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container.set_shadow_type(Gtk.ShadowType.IN) self._commands = Gtk.ListStore(str, str) self._list = Gtk.TreeView() self._list.set_model(self._commands) self._list.set_rules_hint(True) # create and configure cell renderers cell_title = Gtk.CellRendererText() cell_title.set_property('editable', True) cell_title.set_property('mode', Gtk.CellRendererMode.EDITABLE) cell_title.connect('edited', self._edited_command, 0) cell_command = Gtk.CellRendererText() cell_command.set_property('editable', True) cell_command.set_property('mode', Gtk.CellRendererMode.EDITABLE) cell_command.connect('edited', self._edited_command, 1) # create and pack columns col_title = Gtk.TreeViewColumn(_('Title'), cell_title, text=Column.TITLE) col_title.set_min_width(200) col_title.set_resizable(True) col_command = Gtk.TreeViewColumn(_('Command'), cell_command, text=Column.COMMAND) col_command.set_resizable(True) col_command.set_expand(True) self._list.append_column(col_title) self._list.append_column(col_command) container.add(self._list) # create controls button_box = Gtk.HBox(False, 5) button_add = Gtk.Button(stock=Gtk.STOCK_ADD) button_add.connect('clicked', self._add_command) button_delete = Gtk.Button(stock=Gtk.STOCK_DELETE) button_delete.connect('clicked', self._delete_command) image_up = Gtk.Image() image_up.set_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.BUTTON) button_move_up = Gtk.Button(label=None) button_move_up.add(image_up) button_move_up.set_tooltip_text(_('Move Up')) button_move_up.connect('clicked', self._move_command, -1) image_down = Gtk.Image() image_down.set_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.BUTTON) button_move_down = Gtk.Button(label=None) button_move_down.add(image_down) button_move_down.set_tooltip_text(_('Move Down')) button_move_down.connect('clicked', self._move_command, 1) # pack ui button_box.pack_start(button_add, False, False, 0) button_box.pack_start(button_delete, False, False, 0) button_box.pack_end(button_move_down, False, False, 0) button_box.pack_end(button_move_up, False, False, 0) self.pack_start(container, True, True, 0) self.pack_start(button_box, False, False, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'accelerators', _('Key bindings')) # create list box container = Gtk.ScrolledWindow() container.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container.set_shadow_type(Gtk.ShadowType.IN) self._accels = Gtk.TreeStore(str, str, int, int, int, int) self._accels.set_sort_column_id(Column.TITLE, Gtk.SortType.ASCENDING) self._list = Gtk.TreeView() self._list.set_model(self._accels) self._list.set_rules_hint(True) self._list.set_enable_search(True) self._list.set_search_column(Column.TITLE) # create and configure cell renderers cell_name = Gtk.CellRendererText() cell_primary = Gtk.CellRendererAccel() cell_secondary = Gtk.CellRendererAccel() cell_primary.set_property('accel-mode', Gtk.CellRendererAccelMode.OTHER) cell_primary.set_property('editable', True) cell_primary.connect('accel-edited', self.__accel_edited, True) cell_primary.connect('accel-cleared', self.__accel_cleared, True) cell_secondary.set_property('accel-mode', Gtk.CellRendererAccelMode.OTHER) cell_secondary.set_property('editable', True) cell_secondary.connect('accel-edited', self.__accel_edited, False) cell_secondary.connect('accel-cleared', self.__accel_cleared, False) # create and pack columns col_name = Gtk.TreeViewColumn(_('Description'), cell_name, markup=Column.TITLE) col_name.set_min_width(200) col_name.set_resizable(True) col_name.set_sort_column_id(Column.TITLE) col_name.set_sort_order(Gtk.SortType.ASCENDING) col_primary = Gtk.TreeViewColumn(_('Primary'), cell_primary, accel_key=Column.PRIMARY_KEY, accel_mods=Column.PRIMARY_MODS) col_primary.set_min_width(100) col_secondary = Gtk.TreeViewColumn(_('Secondary'), cell_secondary, accel_key=Column.SECONDARY_KEY, accel_mods=Column.SECONDARY_MODS) col_secondary.set_min_width(100) self._list.append_column(col_name) self._list.append_column(col_primary) self._list.append_column(col_secondary) # warning label label_warning = Gtk.Label( label=_('<b>Note:</b> You can only edit accelerators from ' 'objects created at least once in current session. ' 'To disable accelerator press <i>Backspace</i> ' 'in assign mode.')) label_warning.set_alignment(0, 0) label_warning.set_use_markup(True) label_warning.set_line_wrap(True) label_warning.connect('size-allocate', self._adjust_label) label_note = Gtk.Label( label=_('Double click on accelerator to assign new one.')) label_note.set_alignment(0, 0) # pack interface container.add(self._list) self.pack_start(label_warning, False, False, 0) self.pack_start(container, True, True, 0) self.pack_start(label_note, False, False, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'item_list', _('Item List')) notebook = Gtk.Notebook() # create frames label_look_and_feel = Gtk.Label(label=_('Look & feel')) label_hidden_files = Gtk.Label(label=_('Hidden files')) label_operation = Gtk.Label(label=_('Operation')) label_directories = Gtk.Label(label=_('Directories')) label_columns = Gtk.Label(label=_('Columns')) # vertical boxes vbox_look_and_feel = Gtk.VBox(False, 0) vbox_hidden_files = Gtk.VBox(False, 0) vbox_operation = Gtk.VBox(False, 0) vbox_directory = Gtk.VBox(False, 0) vbox_columns = Gtk.VBox(False, 0) vbox_look_and_feel.set_border_width(5) vbox_hidden_files.set_border_width(5) vbox_operation.set_border_width(5) vbox_directory.set_border_width(5) vbox_directory.set_spacing(5) vbox_columns.set_border_width(5) # file list options self._checkbox_row_hinting = Gtk.CheckButton(_('Row hinting')) self._checkbox_case_sensitive = Gtk.CheckButton( _('Case sensitive item sorting')) self._checkbox_number_sensitive = Gtk.CheckButton( _('Number sensitive item sorting')) self._checkbox_single_click = Gtk.CheckButton( _('Single click navigation')) self._checkbox_right_click = Gtk.CheckButton( _('Right click selects items')) self._checkbox_show_headers = Gtk.CheckButton(_('Show list headers')) self._checkbox_media_preview = Gtk.CheckButton(_('Fast media preview')) self._checkbox_show_expanders = Gtk.CheckButton( _('Show tree expanders')) self._checkbox_second_extension = Gtk.CheckButton( _('Support second level extension')) self._checkbox_row_hinting.connect('toggled', self._parent.enable_save) self._checkbox_case_sensitive.connect('toggled', self._parent.enable_save) self._checkbox_number_sensitive.connect('toggled', self._parent.enable_save) self._checkbox_single_click.connect('toggled', self._parent.enable_save) self._checkbox_right_click.connect('toggled', self._parent.enable_save) self._checkbox_show_headers.connect('toggled', self._parent.enable_save) self._checkbox_media_preview.connect('toggled', self._parent.enable_save) self._checkbox_show_expanders.connect('toggled', self._parent.enable_save) self._checkbox_second_extension.connect('toggled', self._parent.enable_save) # file access mode format hbox_mode_format = Gtk.HBox(False, 5) label_mode_format = Gtk.Label(label=_('Access mode format:')) label_mode_format.set_alignment(0, 0.5) self._combobox_mode_format = Gtk.ComboBoxText.new() self._combobox_mode_format.connect('changed', self._parent.enable_save) self._combobox_mode_format.append(str(AccessModeFormat.OCTAL), _('Octal')) self._combobox_mode_format.append(str(AccessModeFormat.TEXTUAL), _('Textual')) # grid lines hbox_grid_lines = Gtk.HBox(False, 5) label_grid_lines = Gtk.Label(label=_('Show grid lines:')) label_grid_lines.set_alignment(0, 0.5) self._combobox_grid_lines = Gtk.ComboBoxText.new() self._combobox_grid_lines.connect('changed', self._parent.enable_save) self._combobox_grid_lines.append(str(Gtk.TreeViewGridLines.NONE), _('None')) self._combobox_grid_lines.append(str(Gtk.TreeViewGridLines.HORIZONTAL), _('Horizontal')) self._combobox_grid_lines.append(str(Gtk.TreeViewGridLines.VERTICAL), _('Vertical')) self._combobox_grid_lines.append(str(Gtk.TreeViewGridLines.BOTH), _('Both')) # selection color hbox_selection_color = Gtk.HBox(False, 5) label_selection_color = Gtk.Label(label=_('Selection color:')) label_selection_color.set_alignment(0, 0.5) self._button_selection_color = Gtk.ColorButton() self._button_selection_color.set_use_alpha(False) self._button_selection_color.connect('color-set', self._parent.enable_save) # selection indicator hbox_indicator = Gtk.HBox(False, 5) label_indicator = Gtk.Label(label=_('Selection indicator:')) label_indicator.set_alignment(0, 0.5) self._combobox_indicator = Gtk.ComboBoxText.new_with_entry() self._combobox_indicator.connect('changed', self._parent.enable_save) self._combobox_indicator.set_size_request(100, -1) self._combobox_indicator.append_text(u'\u25b6', ) self._combobox_indicator.append_text(u'\u25e2', ) self._combobox_indicator.append_text(u'\u25c8', ) self._combobox_indicator.append_text(u'\u263b', ) self._combobox_indicator.append_text(u'\u2771', ) self._combobox_indicator.append_text(u'\u2738', ) self._combobox_indicator.append_text(u'\u2731', ) # quick search label_quick_search = Gtk.Label(label=_('Quick search combination:')) label_quick_search.set_alignment(0, 0.5) label_quick_search.set_use_markup(True) self._checkbox_control = Gtk.CheckButton(_('Control')) self._checkbox_alt = Gtk.CheckButton(_('Alt')) self._checkbox_shift = Gtk.CheckButton(_('Shift')) self._checkbox_control.connect('toggled', self._parent.enable_save) self._checkbox_alt.connect('toggled', self._parent.enable_save) self._checkbox_shift.connect('toggled', self._parent.enable_save) hbox_quick_search = Gtk.HBox(False, 5) vbox_time_format = Gtk.VBox(False, 0) label_time_format = Gtk.Label(label=_('Date format:')) label_time_format.set_alignment(0, 0.5) self._entry_time_format = Gtk.Entry() self._entry_time_format.set_tooltip_markup( '<b>' + _('Time is formed using the format located at:') + '</b>\n' 'http://docs.python.org/library/time.html#time.strftime') self._entry_time_format.connect('changed', self._parent.enable_save) # hidden files table_always_visible = Gtk.Table(rows=3, columns=1, homogeneous=False) table_always_visible.set_row_spacing(1, 5) self._checkbox_show_hidden = Gtk.CheckButton(_('Show hidden files')) self._checkbox_show_hidden.connect('toggled', self._parent.enable_save) container_always_visible = Gtk.ScrolledWindow() container_always_visible.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container_always_visible.set_shadow_type(Gtk.ShadowType.IN) label_always_visible = Gtk.Label( label=_('Always visible files and directories:')) label_always_visible.set_alignment(0, 0.5) self._always_visible_store = Gtk.ListStore(str) self._always_visible_list = Gtk.TreeView( model=self._always_visible_store) self._always_visible_list.set_headers_visible(False) cell_name = Gtk.CellRendererText() col_name = Gtk.TreeViewColumn(None, cell_name, text=0) self._always_visible_list.append_column(col_name) hbox_always_visible = Gtk.HBox(False, 5) button_add_always_visible = Gtk.Button(stock=Gtk.STOCK_ADD) button_add_always_visible.connect('clicked', self._add_always_visible) button_delete_always_visible = Gtk.Button(stock=Gtk.STOCK_DELETE) button_delete_always_visible.connect('clicked', self._delete_always_visible) # create list of directories container_directory = Gtk.ScrolledWindow() container_directory.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container_directory.set_shadow_type(Gtk.ShadowType.IN) self._checkbox_load_directories = Gtk.CheckButton( _('Load specified tabs instead of saved')) self._checkbox_load_directories.connect('toggled', self._parent.enable_save) self._directory_store = Gtk.ListStore(str, bool, bool) self._directory_list = Gtk.TreeView(model=self._directory_store) cell_directory = Gtk.CellRendererText() cell_left_list = Gtk.CellRendererToggle() cell_right_list = Gtk.CellRendererToggle() cell_left_list.connect('toggled', self._toggle_path, Source.LEFT) cell_right_list.connect('toggled', self._toggle_path, Source.RIGHT) col_directory = Gtk.TreeViewColumn(_('Directory'), cell_directory, text=DirectoryColumn.PATH) col_directory.set_min_width(200) col_directory.set_resizable(True) col_directory.set_expand(True) col_left_list = Gtk.TreeViewColumn(_('Left list'), cell_left_list, active=DirectoryColumn.LEFT_LIST) col_right_list = Gtk.TreeViewColumn(_('Right list'), cell_right_list, active=DirectoryColumn.RIGHT_LIST) self._directory_list.append_column(col_directory) self._directory_list.append_column(col_left_list) self._directory_list.append_column(col_right_list) hbox_directory = Gtk.HBox(False, 5) button_add_directory = Gtk.Button(stock=Gtk.STOCK_ADD) button_add_directory.connect('clicked', self.__button_add_clicked) button_delete_directory = Gtk.Button(stock=Gtk.STOCK_DELETE) button_delete_directory.connect('clicked', self._delete_path) image_up = Gtk.Image() image_up.set_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.BUTTON) button_directory_move_up = Gtk.Button(label=None) button_directory_move_up.add(image_up) button_directory_move_up.set_tooltip_text(_('Move Up')) button_directory_move_up.connect('clicked', self._move_path, -1) image_down = Gtk.Image() image_down.set_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.BUTTON) button_directory_move_down = Gtk.Button(label=None) button_directory_move_down.add(image_down) button_directory_move_down.set_tooltip_text(_('Move Down')) button_directory_move_down.connect('clicked', self._move_path, 1) self._menu_add_directory = Gtk.Menu() menu_item_custom = Gtk.MenuItem(_('Custom directory')) menu_item_separator = Gtk.SeparatorMenuItem() menu_item_left_directory = Gtk.MenuItem(_('Left directory')) menu_item_right_directory = Gtk.MenuItem(_('Right directory')) menu_item_custom.connect('activate', self._add_path, Source.CUSTOM) menu_item_left_directory.connect('activate', self._add_path, Source.LEFT) menu_item_right_directory.connect('activate', self._add_path, Source.RIGHT) self._menu_add_directory.append(menu_item_custom) self._menu_add_directory.append(menu_item_separator) self._menu_add_directory.append(menu_item_left_directory) self._menu_add_directory.append(menu_item_right_directory) self._menu_add_directory.show_all() # create columns editor hbox_columns = Gtk.HBox(False, 5) container_columns = Gtk.ScrolledWindow() container_columns.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container_columns.set_shadow_type(Gtk.ShadowType.IN) container_plugin = Gtk.ScrolledWindow() container_plugin.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) container_plugin.set_shadow_type(Gtk.ShadowType.IN) container_plugin.set_size_request(170, -1) # create variable to store active extension to self._extensions = {} self._active_extension = None # create column list self._columns_store = Gtk.ListStore(str, int, bool, str) self._columns_list = Gtk.TreeView() self._columns_list.set_model(self._columns_store) self._columns_list.set_rules_hint(True) self._columns_list.set_enable_search(True) self._columns_list.set_search_column(Column.NAME) cell_name = Gtk.CellRendererText() cell_size = Gtk.CellRendererText() cell_visible = Gtk.CellRendererToggle() cell_font_size = Gtk.CellRendererSpin() cell_size.set_property('editable', True) cell_size.set_property('mode', Gtk.CellRendererMode.EDITABLE) cell_size.connect('edited', self._edited_column_size) cell_font_size.set_property('editable', True) cell_font_size.set_property('mode', Gtk.CellRendererMode.EDITABLE) adjustment = Gtk.Adjustment(0, 0, 100, 1, 10, 0) cell_font_size.set_property('adjustment', adjustment) cell_font_size.connect('edited', self._edited_column_font_size) cell_visible.connect('toggled', self._toggle_column_visible) col_name = Gtk.TreeViewColumn(_('Column'), cell_name, text=Column.NAME) col_name.set_min_width(150) col_name.set_resizable(True) col_name.set_expand(True) col_size = Gtk.TreeViewColumn(_('Size'), cell_size, text=Column.SIZE) col_size.set_min_width(50) col_visible = Gtk.TreeViewColumn(_('Visible'), cell_visible, active=Column.VISIBLE) col_visible.set_min_width(50) col_font_size = Gtk.TreeViewColumn(_('Font'), cell_font_size, text=Column.FONT_SIZE) col_font_size.set_min_width(50) self._columns_list.append_column(col_name) self._columns_list.append_column(col_size) self._columns_list.append_column(col_font_size) self._columns_list.append_column(col_visible) # create plugin list self._extension_store = Gtk.ListStore(str, str) self._extension_list = Gtk.TreeView() self._extension_list.set_model(self._extension_store) self._extension_list.set_headers_visible(False) self._extension_list.connect('cursor-changed', self._handle_cursor_change) cell_name = Gtk.CellRendererText() col_name = Gtk.TreeViewColumn(None, cell_name, text=ExtensionColumn.NAME) self._extension_list.append_column(col_name) # pack interface container_directory.add(self._directory_list) container_columns.add(self._columns_list) container_plugin.add(self._extension_list) container_always_visible.add(self._always_visible_list) hbox_always_visible.pack_start(button_add_always_visible, False, False, 0) hbox_always_visible.pack_start(button_delete_always_visible, False, False, 0) table_always_visible.attach(label_always_visible, 0, 1, 0, 1, xoptions=Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) table_always_visible.attach( container_always_visible, 0, 1, 1, 2, xoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL) table_always_visible.attach(hbox_always_visible, 0, 1, 2, 3, xoptions=Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) hbox_directory.pack_start(button_add_directory, False, False, 0) hbox_directory.pack_start(button_delete_directory, False, False, 0) hbox_directory.pack_end(button_directory_move_down, False, False, 0) hbox_directory.pack_end(button_directory_move_up, False, False, 0) hbox_columns.pack_start(container_plugin, False, False, 0) hbox_columns.pack_start(container_columns, True, True, 0) hbox_indicator.pack_start(label_indicator, False, False, 0) hbox_indicator.pack_start(self._combobox_indicator, False, False, 0) hbox_selection_color.pack_start(label_selection_color, False, False, 0) hbox_selection_color.pack_start(self._button_selection_color, False, False, 0) hbox_quick_search.pack_start(label_quick_search, False, False, 0) hbox_quick_search.pack_start(self._checkbox_control, False, False, 0) hbox_quick_search.pack_start(self._checkbox_alt, False, False, 0) hbox_quick_search.pack_start(self._checkbox_shift, False, False, 0) hbox_mode_format.pack_start(label_mode_format, False, False, 0) hbox_mode_format.pack_start(self._combobox_mode_format, False, False, 0) hbox_grid_lines.pack_start(label_grid_lines, False, False, 0) hbox_grid_lines.pack_start(self._combobox_grid_lines, False, False, 0) vbox_time_format.pack_start(label_time_format, False, False, 0) vbox_time_format.pack_start(self._entry_time_format, False, False, 0) vbox_look_and_feel.pack_start(self._checkbox_row_hinting, False, False, 0) vbox_look_and_feel.pack_start(self._checkbox_show_headers, False, False, 0) vbox_look_and_feel.pack_start(self._checkbox_media_preview, False, False, 0) vbox_look_and_feel.pack_start(self._checkbox_show_expanders, False, False, 0) vbox_look_and_feel.pack_start(hbox_mode_format, False, False, 5) vbox_look_and_feel.pack_start(hbox_grid_lines, False, False, 5) vbox_look_and_feel.pack_start(hbox_selection_color, False, False, 5) vbox_look_and_feel.pack_start(hbox_indicator, False, False, 5) vbox_hidden_files.pack_start(self._checkbox_show_hidden, False, False, 0) vbox_hidden_files.pack_start(table_always_visible, True, True, 0) vbox_operation.pack_start(self._checkbox_case_sensitive, False, False, 0) vbox_operation.pack_start(self._checkbox_number_sensitive, False, False, 0) vbox_operation.pack_start(self._checkbox_single_click, False, False, 0) vbox_operation.pack_start(self._checkbox_right_click, False, False, 0) vbox_operation.pack_start(self._checkbox_second_extension, False, False, 0) vbox_operation.pack_start(hbox_quick_search, False, False, 5) vbox_operation.pack_start(vbox_time_format, False, False, 5) vbox_directory.pack_start(self._checkbox_load_directories, False, False, 0) vbox_directory.pack_start(container_directory, True, True, 0) vbox_directory.pack_start(hbox_directory, False, False, 0) vbox_columns.pack_start(hbox_columns, True, True, 0) notebook.append_page(vbox_look_and_feel, label_look_and_feel) notebook.append_page(vbox_hidden_files, label_hidden_files) notebook.append_page(vbox_operation, label_operation) notebook.append_page(vbox_directory, label_directories) notebook.append_page(vbox_columns, label_columns) self.pack_start(notebook, True, True, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'view_and_edit', _('View & Edit')) # viewer options frame_view = Gtk.Frame(label=_('View')) vbox_view = Gtk.VBox(False, 0) vbox_view.set_border_width(5) self._checkbox_view_word_wrap = Gtk.CheckButton(_('Wrap long lines')) self._checkbox_view_word_wrap.connect('toggled', self._parent.enable_save) # editor options frame_edit = Gtk.Frame(label=_('Edit')) vbox_edit = Gtk.VBox(False, 0) vbox_edit.set_border_width(5) # installed application self._radio_application = Gtk.RadioButton( label=_('Use installed application')) self._radio_application.connect('toggled', self._parent.enable_save) align_application = Gtk.Alignment.new(0, 0, 1, 0) align_application.set_padding(0, 10, 15, 15) vbox_application = Gtk.VBox(False, 0) vbox_application.set_border_width(5) self._store = Gtk.ListStore(str, str, str) self._combobox_application = Gtk.ComboBox(model=self._store) self._combobox_application.connect('changed', self._parent.enable_save) cell_icon = Gtk.CellRendererPixbuf() cell_name = Gtk.CellRendererText() self._combobox_application.pack_start(cell_icon, False) self._combobox_application.pack_start(cell_name, True) self._combobox_application.add_attribute(cell_icon, 'icon-name', Column.ICON) self._combobox_application.add_attribute(cell_name, 'text', Column.NAME) # external options self._radio_external = Gtk.RadioButton(group=self._radio_application, label=_('Use external command')) self._radio_external.connect('toggled', self._parent.enable_save) align_external = Gtk.Alignment.new(0, 0, 1, 0) align_external.set_padding(0, 10, 15, 15) vbox_external = Gtk.VBox(False, 0) vbox_external.set_border_width(5) label_editor = Gtk.Label(label=_('Command line:')) label_editor.set_alignment(0, 0.5) label_editor.set_use_markup(True) self._entry_editor = Gtk.Entry() self._entry_editor.connect('changed', self._parent.enable_save) self._checkbox_terminal_command = Gtk.CheckButton( _('Execute command in terminal tab')) self._checkbox_terminal_command.connect('toggled', self._parent.enable_save) # pack ui vbox_view.pack_start(self._checkbox_view_word_wrap, False, False, 0) vbox_application.pack_start(self._combobox_application, False, False, 0) align_application.add(vbox_application) vbox_external.pack_start(label_editor, False, False, 0) vbox_external.pack_start(self._entry_editor, False, False, 0) vbox_external.pack_start(self._checkbox_terminal_command, False, False, 0) align_external.add(vbox_external) vbox_edit.pack_start(self._radio_application, False, False, 0) vbox_edit.pack_start(align_application, False, False, 0) vbox_edit.pack_start(self._radio_external, False, False, 0) vbox_edit.pack_start(align_external, False, False, 0) frame_view.add(vbox_view) frame_edit.add(vbox_edit) self.pack_start(frame_view, False, False, 0) self.pack_start(frame_edit, False, False, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'toolbar', _('Toolbar')) self._toolbar_manager = self._application.toolbar_manager # create list box container = Gtk.ScrolledWindow() container.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container.set_shadow_type(Gtk.ShadowType.IN) self._store = Gtk.ListStore(str, str, str, str, str) self._list = Gtk.TreeView() self._list.set_model(self._store) cell_icon = Gtk.CellRendererPixbuf() cell_name = Gtk.CellRendererText() cell_name.set_property('editable', True) cell_name.set_property('mode', Gtk.CellRendererMode.EDITABLE) cell_name.connect('edited', self._edited_name, 0) cell_type = Gtk.CellRendererText() # create name column col_name = Gtk.TreeViewColumn(_('Name')) col_name.set_min_width(200) col_name.set_resizable(True) # pack and configure renderes col_name.pack_start(cell_icon, False) col_name.pack_start(cell_name, True) col_name.add_attribute(cell_icon, 'icon-name', Column.ICON) col_name.add_attribute(cell_name, 'text', Column.NAME) # create type column col_type = Gtk.TreeViewColumn(_('Type'), cell_type, markup=Column.DESCRIPTION) col_type.set_resizable(True) col_type.set_expand(True) # add columns to the list self._list.append_column(col_name) self._list.append_column(col_type) container.add(self._list) # create controls button_box = Gtk.HBox(False, 5) button_add = Gtk.Button(stock=Gtk.STOCK_ADD) button_add.connect('clicked', self._add_widget) button_delete = Gtk.Button(stock=Gtk.STOCK_DELETE) button_delete.connect('clicked', self._delete_widget) button_edit = Gtk.Button(stock=Gtk.STOCK_EDIT) button_edit.connect('clicked', self._edit_widget) image_up = Gtk.Image() image_up.set_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.BUTTON) button_move_up = Gtk.Button(label=None) button_move_up.add(image_up) button_move_up.set_tooltip_text(_('Move Up')) button_move_up.connect('clicked', self._move_widget, -1) image_down = Gtk.Image() image_down.set_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.BUTTON) button_move_down = Gtk.Button(label=None) button_move_down.add(image_down) button_move_down.set_tooltip_text(_('Move Down')) button_move_down.connect('clicked', self._move_widget, 1) # pack ui button_box.pack_start(button_add, False, False, 0) button_box.pack_start(button_delete, False, False, 0) button_box.pack_start(button_edit, False, False, 0) button_box.pack_end(button_move_down, False, False, 0) button_box.pack_end(button_move_up, False, False, 0) # toolbar style label_style = Gtk.Label(label=_('Toolbar style:')) list_styles = Gtk.ListStore(str, int) list_styles.append((_('Icons'), Gtk.ToolbarStyle.ICONS)) list_styles.append((_('Text'), Gtk.ToolbarStyle.TEXT)) list_styles.append((_('Both'), Gtk.ToolbarStyle.BOTH)) list_styles.append((_('Both horizontal'), Gtk.ToolbarStyle.BOTH_HORIZ)) renderer = Gtk.CellRendererText() self._combobox_styles = Gtk.ComboBox(model=list_styles) self._combobox_styles.pack_start(renderer, True) self._combobox_styles.add_attribute(renderer, 'text', 0) self._combobox_styles.connect('changed', self._parent.enable_save) # toolbar icon size label_icon_size = Gtk.Label(label=_('Icon size:')) list_icon_size = Gtk.ListStore(str, int) list_icon_size.append( (_('Small toolbar icon'), Gtk.IconSize.SMALL_TOOLBAR)) list_icon_size.append( (_('Large toolbar icon'), Gtk.IconSize.LARGE_TOOLBAR)) list_icon_size.append((_('Same as drag icons'), Gtk.IconSize.DND)) list_icon_size.append((_('Same as dialog'), Gtk.IconSize.DIALOG)) renderer = Gtk.CellRendererText() self._combobox_icon_size = Gtk.ComboBox(model=list_icon_size) self._combobox_icon_size.pack_start(renderer, True) self._combobox_icon_size.add_attribute(renderer, 'text', 0) self._combobox_icon_size.connect('changed', self._parent.enable_save) style_box = Gtk.HBox(False, 5) style_box.pack_start(label_style, False, False, 0) style_box.pack_start(self._combobox_styles, False, False, 0) size_box = Gtk.HBox(False, 5) size_box.pack_start(label_icon_size, False, False, 0) size_box.pack_start(self._combobox_icon_size, False, False, 0) self.pack_start(style_box, False, False, 0) self.pack_start(size_box, False, False, 0) self.pack_start(container, True, True, 0) self.pack_start(button_box, False, False, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'terminal', _('Terminal')) # create vte terminal options align_vte = Gtk.Alignment.new(0, 0, 1, 0) align_vte.set_padding(0, 10, 15, 15) self._vbox_vte = Gtk.VBox(False, 0) self._radio_vte = Gtk.RadioButton(label=_('VTE based terminal')) self._radio_vte.connect('toggled', self._parent.enable_save) # option for showing scrollbars self._checkbox_scrollbars_visible = Gtk.CheckButton(_('Show scrollbars when needed')) self._checkbox_scrollbars_visible.connect('toggled', self._parent.enable_save) # option for custom font self._align_font = Gtk.Alignment.new(0, 0, 0, 0) self._align_font.set_padding(0, 0, 15, 15) hbox_font = Gtk.HBox(False, 5) self._checkbox_system_font = Gtk.CheckButton(_('Use the system fixed width font')) self._checkbox_system_font.connect('toggled', self.__toggled_system_font) label_font = Gtk.Label(label=_('Font:')) label_font.set_alignment(0, 0.5) self._button_font = Gtk.FontButton() self._button_font.connect('font-set', self._parent.enable_save) # option for cursor shape hbox_cursor_shape = Gtk.HBox(False, 5) label_cursor_shape = Gtk.Label(label=_('Cursor shape:')) label_cursor_shape.set_alignment(0, 0.5) list_cursor_shape = Gtk.ListStore(str, int) list_cursor_shape.append((_('Block'), CursorShape.BLOCK)) list_cursor_shape.append((_('I-Beam'), CursorShape.IBEAM)) list_cursor_shape.append((_('Underline'), CursorShape.UNDERLINE)) cell_cursor_shape = Gtk.CellRendererText() self._combobox_cursor_shape = Gtk.ComboBox(model=list_cursor_shape) self._combobox_cursor_shape.connect('changed', self._parent.enable_save) self._combobox_cursor_shape.pack_start(cell_cursor_shape, True) self._combobox_cursor_shape.add_attribute(cell_cursor_shape, 'text', 0) # option for allowing bold text in terminal self._checkbox_allow_bold = Gtk.CheckButton(_('Allow bold text')) self._checkbox_allow_bold.connect('toggled', self._parent.enable_save) # option for automatically hiding mouse when typing self._checkbox_autohide_mouse = Gtk.CheckButton(_('Automatically hide mouse when typing')) self._checkbox_autohide_mouse.connect('toggled', self._parent.enable_save) # create external terminal options align_external = Gtk.Alignment.new(0, 0, 1, 0) align_external.set_padding(0, 0, 15, 15) self._vbox_external = Gtk.VBox(False, 5) self._radio_external = Gtk.RadioButton(group=self._radio_vte, label=_('External terminal')) vbox_command = Gtk.VBox(False, 0) label_command = Gtk.Label(label=_('Command line:')) label_command.set_alignment(0, 0.5) self._entry_command = Gtk.Entry() self._entry_command.connect('changed', self._parent.enable_save) vbox_command2 = Gtk.VBox(False, 0) label_command2 = Gtk.Label(label=_('Command line for executing specific program:')) label_command2.set_alignment(0, 0.5) self._entry_command2 = Gtk.Entry() self._entry_command2.connect('changed', self._parent.enable_save) label_note = Gtk.Label(label=_( '<small><i>Note:' '\n\tOmitting {0} will open new terminal application instead of tab.' '\n\t{0} will be replaced with socket/window id.' '\n\t{1} will be replaced with specified command and its parameters.' '\n\t{2} will be replaced with current working directory.' '</i></small>' )) label_note.set_alignment(0, 0) label_note.set_use_markup(True) # pack interface hbox_font.pack_start(label_font, False, False, 0) hbox_font.pack_start(self._button_font, True, True, 0) self._align_font.add(hbox_font) hbox_cursor_shape.pack_start(label_cursor_shape, False, False, 0) hbox_cursor_shape.pack_start(self._combobox_cursor_shape, False, False, 0) vbox_command.pack_start(label_command, False, False, 0) vbox_command.pack_start(self._entry_command, False, False, 0) vbox_command2.pack_start(label_command2, False, False, 0) vbox_command2.pack_start(self._entry_command2, False, False, 0) self._vbox_vte.pack_start(self._checkbox_scrollbars_visible, False, False, 0) self._vbox_vte.pack_start(self._checkbox_system_font, False, False, 0) self._vbox_vte.pack_start(self._align_font, False, False, 0) self._vbox_vte.pack_start(hbox_cursor_shape, False, False, 5) self._vbox_vte.pack_start(self._checkbox_allow_bold, False, False, 0) self._vbox_vte.pack_start(self._checkbox_autohide_mouse, False, False, 0) self._vbox_external.pack_start(vbox_command, False, False, 0) self._vbox_external.pack_start(vbox_command2, False, False, 0) self._vbox_external.pack_start(label_note, False, False, 0) align_vte.add(self._vbox_vte) align_external.add(self._vbox_external) self.pack_start(self._radio_vte, False, False, 0) self.pack_start(align_vte, False, False, 0) self.pack_start(self._radio_external, False, False, 0) self.pack_start(align_external, False, False, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'display', _('Display')) notebook = Gtk.Notebook() # main window options label_main_window = Gtk.Label(label=_('Main window')) vbox_main_window = Gtk.VBox(False, 0) vbox_main_window.set_border_width(5) self._checkbox_hide_on_close = Gtk.CheckButton( _('Hide main window on close')) self._checkbox_multiple_instances = Gtk.CheckButton( _('Allow multiple instances')) self._checkbox_show_toolbar = Gtk.CheckButton(_('Show toolbar')) self._checkbox_show_titlebar = Gtk.CheckButton(_('Show titlebar')) self._checkbox_show_command_bar = Gtk.CheckButton( _('Show command bar')) self._checkbox_horizontal_split = Gtk.CheckButton( _('Horizontal split')) self._checkbox_dark_theme = Gtk.CheckButton(_('Dark theme')) self._checkbox_hide_on_close.connect('toggled', self._parent.enable_save, True) self._checkbox_multiple_instances.connect('toggled', self._parent.enable_save, True) self._checkbox_show_toolbar.connect('toggled', self._parent.enable_save) self._checkbox_show_titlebar.connect('toggled', self._parent.enable_save) self._checkbox_show_command_bar.connect('toggled', self._parent.enable_save) self._checkbox_horizontal_split.connect('toggled', self._parent.enable_save) self._checkbox_dark_theme.connect('toggled', self._parent.enable_save) # tab options label_tabs = Gtk.Label(label=_('Tabs')) vbox_tabs = Gtk.VBox(False, 0) vbox_tabs.set_border_width(5) self._checkbox_focus_new_tab = Gtk.CheckButton( _('Focus new tab after opening')) self._checkbox_tab_close_button = Gtk.CheckButton( _('Show close button')) self._checkbox_always_show_tabs = Gtk.CheckButton( _('Show tab(s) even if there is only one')) self._checkbox_superuser_notification = Gtk.CheckButton( _('Change title bar color when started as super user')) self._checkbox_focus_new_tab.connect('toggled', self._parent.enable_save) self._checkbox_tab_close_button.connect('toggled', self._parent.enable_save) self._checkbox_always_show_tabs.connect('toggled', self._parent.enable_save) self._checkbox_superuser_notification.connect('toggled', self._parent.enable_save) # status bar table = Gtk.Table(2, 2, False) table.set_col_spacing(0, 5) table.set_row_spacings(5) label_status_bar = Gtk.Label(label=_('Show status bar:')) label_status_bar.set_alignment(0, 0.5) list_status_bar = Gtk.ListStore(str, int) list_status_bar.append((_('Always'), StatusVisible.ALWAYS)) list_status_bar.append((_('When needed'), StatusVisible.WHEN_NEEDED)) list_status_bar.append((_('Never'), StatusVisible.NEVER)) cell_status_bar = Gtk.CellRendererText() self._combobox_status_bar = Gtk.ComboBox(model=list_status_bar) self._combobox_status_bar.connect('changed', self._parent.enable_save) self._combobox_status_bar.pack_start(cell_status_bar, True) self._combobox_status_bar.add_attribute(cell_status_bar, 'text', 0) # expand tabs label_expand_tab = Gtk.Label(label=_('Expanded tabs:')) label_expand_tab.set_alignment(0, 0.5) list_expand_tab = Gtk.ListStore(str, int) list_expand_tab.append((_('None'), TabExpand.NONE)) list_expand_tab.append((_('Active'), TabExpand.ACTIVE)) list_expand_tab.append((_('All'), TabExpand.ALL)) cell_expand_tab = Gtk.CellRendererText() self._combobox_expand_tabs = Gtk.ComboBox(model=list_expand_tab) self._combobox_expand_tabs.connect('changed', self._parent.enable_save) self._combobox_expand_tabs.pack_start(cell_expand_tab, True) self._combobox_expand_tabs.add_attribute(cell_expand_tab, 'text', 0) # other options label_other = Gtk.Label(label=_('Other')) vbox_other = Gtk.VBox(False, 0) vbox_other.set_border_width(5) self._checkbox_hide_window_on_minimize = Gtk.CheckButton( _('Hide operation window on minimize')) self._checkbox_show_notifications = Gtk.CheckButton( _('Show notifications')) self._checkbox_show_notifications.set_sensitive( self._application.notification_manager.available) self._checkbox_network_path_completion = Gtk.CheckButton( _('Use path completion on non-local paths')) self._checkbox_hide_window_on_minimize.connect( 'toggled', self._parent.enable_save) self._checkbox_show_notifications.connect('toggled', self._parent.enable_save) self._checkbox_network_path_completion.connect( 'toggled', self._parent.enable_save) # size format hbox_size_format = Gtk.HBox(False, 5) label_size_format = Gtk.Label(label=_('Size format:')) label_size_format.set_alignment(0, 0.5) list_size_format = Gtk.ListStore(str, int) list_size_format.append((_('Localized'), SizeFormat.LOCAL)) list_size_format.append( (_('SI <small>(1 kB = 1000 B)</small>'), SizeFormat.SI)) list_size_format.append( (_('IEC <small>(1 KiB = 1024 B)</small>'), SizeFormat.IEC)) cell_size_format = Gtk.CellRendererText() self._combobox_size_format = Gtk.ComboBox(model=list_size_format) self._combobox_size_format.connect('changed', self._parent.enable_save) self._combobox_size_format.pack_start(cell_size_format, True) self._combobox_size_format.add_attribute(cell_size_format, 'markup', 0) # pack ui hbox_size_format.pack_start(label_size_format, False, False, 0) hbox_size_format.pack_start(self._combobox_size_format, False, False, 0) table.attach(label_status_bar, 0, 1, 0, 1, xoptions=Gtk.AttachOptions.FILL) table.attach(self._combobox_status_bar, 1, 2, 0, 1, xoptions=Gtk.AttachOptions.FILL) table.attach(label_expand_tab, 0, 1, 1, 2, xoptions=Gtk.AttachOptions.FILL) table.attach(self._combobox_expand_tabs, 1, 2, 1, 2, xoptions=Gtk.AttachOptions.FILL) vbox_main_window.pack_start(self._checkbox_hide_on_close, False, False, 0) vbox_main_window.pack_start(self._checkbox_multiple_instances, False, False, 0) vbox_main_window.pack_start(self._checkbox_show_toolbar, False, False, 0) vbox_main_window.pack_start(self._checkbox_show_titlebar, False, False, 0) vbox_main_window.pack_start(self._checkbox_show_command_bar, False, False, 0) vbox_main_window.pack_start(self._checkbox_horizontal_split, False, False, 0) vbox_main_window.pack_start(self._checkbox_dark_theme, False, False, 0) vbox_tabs.pack_start(self._checkbox_focus_new_tab, False, False, 0) vbox_tabs.pack_start(self._checkbox_tab_close_button, False, False, 0) vbox_tabs.pack_start(self._checkbox_always_show_tabs, False, False, 0) vbox_tabs.pack_start(self._checkbox_superuser_notification, False, False, 0) vbox_tabs.pack_start(table, False, False, 5) vbox_other.pack_start(self._checkbox_hide_window_on_minimize, False, False, 0) vbox_other.pack_start(self._checkbox_show_notifications, False, False, 0) vbox_other.pack_start(self._checkbox_network_path_completion, False, False, 0) vbox_other.pack_start(hbox_size_format, False, False, 0) notebook.append_page(vbox_main_window, label_main_window) notebook.append_page(vbox_tabs, label_tabs) notebook.append_page(vbox_other, label_other) self.pack_start(notebook, True, True, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'plugins', _('Plugins')) # create interface container = Gtk.ScrolledWindow() container.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container.set_shadow_type(Gtk.ShadowType.IN) # create list box self._plugins = Gtk.ListStore( bool, # active str, # location str, # name str, # author str, # version str, # contact str, # site str # description ) self._list = Gtk.TreeView() self._list.set_model(self._plugins) self._list.set_rules_hint(True) self._list.connect('cursor-changed', self.__handle_cursor_change) # create and configure cell renderers cell_active = Gtk.CellRendererToggle() cell_active.connect('toggled', self._toggle_plugin) cell_name = Gtk.CellRendererText() cell_author = Gtk.CellRendererText() cell_version = Gtk.CellRendererText() # create and pack columns col_active = Gtk.TreeViewColumn(_('Active'), cell_active, active=Column.ACTIVE) col_name = Gtk.TreeViewColumn(_('Plugin name'), cell_name, text=Column.NAME) col_name.set_resizable(True) col_name.set_expand(True) col_version = Gtk.TreeViewColumn(_('Version'), cell_version, text=Column.VERSION) col_author = Gtk.TreeViewColumn(_('Author'), cell_author, text=Column.AUTHOR) col_author.set_resizable(True) self._list.append_column(col_active) self._list.append_column(col_name) self._list.append_column(col_version) self._list.append_column(col_author) # create description self._label_description = Gtk.Label() self._label_description.set_use_markup(True) self._label_description.set_line_wrap(True) self._label_description.set_selectable(True) self._label_description.set_padding(5, 5) self._label_description.connect('size-allocate', self.__adjust_label) self._expander_description = Gtk.Expander(label=_('Description')) self._expander_description.add(self._label_description) # create controls hbox_controls = Gtk.HBox(False, 5) image_contact = Gtk.Image() image_contact.set_from_icon_name('gnome-stock-mail-new', Gtk.IconSize.BUTTON) self._button_contact = Gtk.Button() self._button_contact.set_label(_('Contact')) self._button_contact.set_image(image_contact) self._button_contact.set_sensitive(False) self._button_contact.connect('clicked', self.__handle_contact_button_click) image_home_page = Gtk.Image() image_home_page.set_from_stock(Gtk.STOCK_HOME, Gtk.IconSize.BUTTON) self._button_home_page = Gtk.Button() self._button_home_page.set_label(_('Visit site')) self._button_home_page.set_image(image_home_page) self._button_home_page.set_sensitive(False) self._button_home_page.connect('clicked', self.__handle_home_page_button_click) # pack containers container.add(self._list) hbox_controls.pack_start(self._button_contact, False, False, 0) hbox_controls.pack_start(self._button_home_page, False, False, 0) self.pack_start(container, True, True, 0) self.pack_start(self._expander_description, False, False, 0) self.pack_start(hbox_controls, False, False, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'bookmarks', _('Bookmarks')) # mounts checkbox self._checkbox_show_mount_points = Gtk.CheckButton( _('Show mount points in bookmarks menu')) self._checkbox_show_mount_points.connect('toggled', self._parent.enable_save) # system bookmarks checkbox self._checkbox_system_bookmarks = Gtk.CheckButton( _('Show system bookmarks')) self._checkbox_system_bookmarks.connect('toggled', self._parent.enable_save) # bookmarks checkbox self._checkbox_add_home = Gtk.CheckButton( _('Add home directory to bookmarks menu')) self._checkbox_add_home.connect('toggled', self._parent.enable_save) # create list box container = Gtk.ScrolledWindow() container.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container.set_shadow_type(Gtk.ShadowType.IN) self._bookmarks = Gtk.ListStore(str, str) self._list = Gtk.TreeView() self._list.set_model(self._bookmarks) self._list.set_rules_hint(True) cell_title = Gtk.CellRendererText() cell_title.set_property('editable', True) cell_title.set_property('mode', Gtk.CellRendererMode.EDITABLE) cell_title.connect('edited', self._edited_bookmark, 0) cell_command = Gtk.CellRendererText() cell_command.set_property('editable', True) cell_command.set_property('mode', Gtk.CellRendererMode.EDITABLE) cell_command.connect('edited', self._edited_bookmark, 1) col_title = Gtk.TreeViewColumn(_('Title'), cell_title, text=Column.NAME) col_title.set_min_width(200) col_title.set_resizable(True) col_command = Gtk.TreeViewColumn(_('Location'), cell_command, text=Column.URI) col_command.set_resizable(True) col_command.set_expand(True) self._list.append_column(col_title) self._list.append_column(col_command) container.add(self._list) # create controls button_box = Gtk.HBox(False, 5) button_add = Gtk.Button(stock=Gtk.STOCK_ADD) button_add.connect('clicked', self._add_bookmark) button_delete = Gtk.Button(stock=Gtk.STOCK_DELETE) button_delete.connect('clicked', self._delete_bookmark) image_up = Gtk.Image() image_up.set_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.BUTTON) button_move_up = Gtk.Button(label=None) button_move_up.add(image_up) button_move_up.set_tooltip_text(_('Move Up')) button_move_up.connect('clicked', self._move_bookmark, -1) image_down = Gtk.Image() image_down.set_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.BUTTON) button_move_down = Gtk.Button(label=None) button_move_down.add(image_down) button_move_down.set_tooltip_text(_('Move Down')) button_move_down.connect('clicked', self._move_bookmark, 1) # pack ui button_box.pack_start(button_add, False, False, 0) button_box.pack_start(button_delete, False, False, 0) button_box.pack_end(button_move_down, False, False, 0) button_box.pack_end(button_move_up, False, False, 0) # pack checkboxes vbox = Gtk.VBox(False, 0) vbox.pack_start(self._checkbox_show_mount_points, False, False, 0) vbox.pack_start(self._checkbox_system_bookmarks, False, False, 0) vbox.pack_start(self._checkbox_add_home, False, False, 0) self.pack_start(vbox, False, False, 0) self.pack_start(container, True, True, 0) self.pack_start(button_box, False, False, 0)
def __init__(self, parent, application): SettingsPage.__init__(self, parent, application, 'sessions', _('Sessions')) self._options = application.tab_options self._manager = None # create list box container = Gtk.ScrolledWindow() container.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) container.set_shadow_type(Gtk.ShadowType.IN) self._store = Gtk.ListStore.new((str, bool, int, int)) self._list = Gtk.TreeView.new_with_model(self._store) self._list.set_rules_hint(True) # create cell renderers cell_name = Gtk.CellRendererText() cell_name.set_property('editable', True) cell_name.set_property('mode', Gtk.CellRendererMode.EDITABLE) cell_name.connect('edited', self._handle_edited_name, 0) cell_locked = Gtk.CellRendererToggle() cell_locked.set_property('activatable', True) cell_locked.connect('toggled', self._handle_lock_toggled, 0) cell_count = Gtk.CellRendererText() # create columns col_name = Gtk.TreeViewColumn(_('Name'), cell_name, text=Column.NAME) col_name.set_min_width(200) col_name.set_resizable(True) col_name.set_expand(True) col_locked = Gtk.TreeViewColumn(_('Locked'), cell_locked, active=Column.LOCKED) col_count = Gtk.TreeViewColumn(_('Session manager'), cell_count, text=Column.TAB_COUNT) self._list.append_column(col_name) self._list.append_column(col_locked) self._list.append_column(col_count) # create controls button_box = Gtk.HBox(False, 5) button_add = Gtk.Button(stock=Gtk.STOCK_ADD) button_add.connect('clicked', self._handle_add_session) button_delete = Gtk.Button(stock=Gtk.STOCK_DELETE) button_delete.connect('clicked', self._handle_delete_session) image_up = Gtk.Image() image_up.set_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.BUTTON) button_move_up = Gtk.Button(label=None) button_move_up.add(image_up) button_move_up.set_tooltip_text(_('Move up')) button_move_up.connect('clicked', self._handle_move_session, -1) image_down = Gtk.Image() image_down.set_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.BUTTON) button_move_down = Gtk.Button(label=None) button_move_down.add(image_down) button_move_down.set_tooltip_text(_('Move down')) button_move_down.connect('clicked', self._handle_move_session, 1) # pack interface container.add(self._list) button_box.pack_start(button_add, False, False, 0) button_box.pack_start(button_delete, False, False, 0) button_box.pack_end(button_move_down, False, False, 0) button_box.pack_end(button_move_up, False, False, 0) self.pack_start(container, True, True, 0) self.pack_start(button_box, False, False, 0)