Python gi.repository.Gtk.ListBox() Examples
The following are 12
code examples of gi.repository.Gtk.ListBox().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.Gtk
, or try the search function
.
Example #1
Source File: colors_list.py From oomox with GNU General Public License v3.0 | 6 votes |
def replace_all_instances(self, _menu_item): # pylint:disable=unused-argument color_selection_dialog = OomoxColorSelectionDialog( self.transient_for, self.get_fuzzy_sibling(OomoxColorButton).gtk_color ) color_selection_dialog.run() new_color = color_selection_dialog.gtk_color if new_color: new_color.string = convert_gdk_to_theme_color(new_color) old_color = self.get_fuzzy_sibling(OomoxColorButton).gtk_color old_color.string = convert_gdk_to_theme_color(old_color) cousins = self.get_fuzzy_ancestor(Gtk.ListBox).get_children() for lbr in cousins: if isinstance(lbr, ColorListBoxRow) and lbr.color_button.gtk_color is not None: if convert_gdk_to_theme_color(lbr.color_button.gtk_color) == old_color.string: lbr.set_value(new_color.string, connected=True)
Example #2
Source File: chapters_list.py From ebook-viewer with GNU General Public License v3.0 | 6 votes |
def __init__(self, data, chapter): """ Holds data that is chapter name and chapter_link that is link to chapter file. For use as ListBox element. :param data: :param chapter: """ super(Gtk.ListBoxRow, self).__init__() # Remember chapter name and file link self.data = data self.chapter_link = chapter # Just a bunch of label styling label = Gtk.Label(xalign=0) label.set_text(data) label.set_justify(Gtk.Justification.LEFT) try: label.set_margin_start(10) except AttributeError: label.set_margin_left(10) label.set_width_chars(20) label.set_ellipsize(Pango.EllipsizeMode.END) self.add(label)
Example #3
Source File: list.py From Authenticator with GNU General Public License v2.0 | 5 votes |
def __init__(self): GObject.GObject.__init__(self) Gtk.ListBox.__init__(self) self.set_selection_mode(Gtk.SelectionMode.NONE) self.get_style_context().add_class("accounts-list") self.state = AccountsListState.NORMAL self.selected_rows_count = 0
Example #4
Source File: search_widget.py From addons-source with GNU General Public License v2.0 | 5 votes |
def __init__(self, max_height=-1): Gtk.ScrolledWindow.__init__(self) self.list_box = Gtk.ListBox() self.add(self.list_box) self.max_height = max_height self.connect("draw", self.set_max_height)
Example #5
Source File: search_widget.py From addons-source with GNU General Public License v2.0 | 5 votes |
def add_to_panel(self, row): """ Add found item to panel (ListBox). row - ListBoxRow """ self.list_box.prepend(row) row.show_all()
Example #6
Source File: prefs.py From volctl with GNU General Public License v2.0 | 5 votes |
def _setup_ui(self): self.set_type_hint(Gdk.WindowTypeHint.NORMAL) box = self.get_content_area() hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) box.pack_start(hbox, True, True, 20) self.listbox = Gtk.ListBox() self.listbox.set_selection_mode(Gtk.SelectionMode.NONE) hbox.pack_start(self.listbox, True, True, 10) row = Gtk.ListBoxRow() row.set_activatable(False) hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) row.add(hbox) label = Gtk.Label(xalign=0) label.set_markup("<b>volctl settings</b>") hbox.pack_start(label, False, True, 10) self.listbox.add(row) self._setup_auto_hide() self._setup_auto_hide_timeout() self._setup_mouse_wheel_step() self._setup_mixer_command() self.show_all() self._set_timeout_show()
Example #7
Source File: soundconfig.py From Audio-Cutter with GNU General Public License v3.0 | 5 votes |
def setup_box(list_): """Setup a listbox from a list of (label, widget).""" # Setup the listbox listbox = Gtk.ListBox() listbox.get_style_context().add_class("config-list-box") listbox.set_halign(Gtk.Align.FILL) listbox.set_valign(Gtk.Align.FILL) listbox.set_selection_mode(Gtk.SelectionMode.NONE) def _resize_listbox_childs(listbox): """Set the listbox childs to have the same height.""" max_height = 0 for row in listbox.get_children(): height = row.get_allocated_height() if height > max_height: max_height = height for row in listbox.get_children(): row.props.height_request = max_height for label, widget in list_: box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6) widget.set_valign(Gtk.Align.CENTER) label_ = Gtk.Label(label=label) label_.get_style_context().add_class("config-list-box-label") box.pack_start(label_, False, False, 12) box.pack_end(widget, False, False, 12) listboxrow = Gtk.ListBoxRow() listboxrow.get_style_context().add_class("config-list-box-row") listboxrow.add(box) listbox.add(listboxrow) listbox.connect("realize", _resize_listbox_childs) return listbox
Example #8
Source File: view.py From dynamic-wallpaper-editor with GNU General Public License v3.0 | 5 votes |
def __init__(self, window): super().__init__(window) self.list_box = Gtk.ListBox(visible=True, expand=True, \ selection_mode=Gtk.SelectionMode.NONE) label = Gtk.Label(visible=True, \ label=_("Add new pictures, or open an existing XML file.")) self.list_box.set_placeholder(label) self.add_to_view(self.list_box)
Example #9
Source File: custom.py From Dindo-Bot with MIT License | 5 votes |
def __init__(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=5) self.count = 0 frame = Gtk.Frame() scrolled_window = Gtk.ScrolledWindow(hscrollbar_policy=Gtk.PolicyType.NEVER) self.listbox = Gtk.ListBox() self.listbox.set_selection_mode(Gtk.SelectionMode.SINGLE) self.listbox.connect('row-activated', self.on_row_activated) scrolled_window.add(self.listbox) frame.add(scrolled_window) self.pack_start(frame, True, True, 0) self.stack = Gtk.Stack() self.pack_end(self.stack, False, False, 0)
Example #10
Source File: colors_list.py From oomox with GNU General Public License v3.0 | 5 votes |
def __init__(self, color_edited_callback, theme_reload_callback, transient_for): self.transient_for = transient_for super().__init__() self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) self.color_edited_callback = color_edited_callback self.theme_reload_callback = theme_reload_callback self.listbox = Gtk.ListBox() self.listbox.set_selection_mode(Gtk.SelectionMode.NONE) self.build_theme_model_rows() self.add(self.listbox)
Example #11
Source File: chapters_list.py From ebook-viewer with GNU General Public License v3.0 | 5 votes |
def __init__(self, window): """ Provides the List Box with chapters index and navigation based around them :param window: Main application window reference, serves as communication hub """ super(Gtk.ListBox, self).__init__() self.__window = window # Only one chapter can be selected at a time # set_current_chapter() method relies on this self.set_selection_mode(Gtk.SelectionMode.SINGLE) self.connect('row_activated', self.__on_listbox_row_activated) self.__populate_listbox()
Example #12
Source File: custom.py From Dindo-Bot with MIT License | 4 votes |
def __init__(self, parent=None, allow_moving=True): Gtk.Frame.__init__(self) self.parent = parent self.allow_moving = allow_moving self.perform_scroll = False self.add_callback = None self.delete_callback = None self.activate_callback = None ## ListBox vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(vbox) self.listbox = Gtk.ListBox() self.listbox.set_selection_mode(Gtk.SelectionMode.SINGLE) self.listbox.connect('size-allocate', self.on_size_allocate) self.listbox.connect('row-activated', self.on_row_activated) scrolled_window = Gtk.ScrolledWindow() scrolled_window.add(self.listbox) vbox.pack_start(scrolled_window, True, True, 0) ## ActionBar actionbar = Gtk.ActionBar() vbox.pack_end(actionbar, False, False, 0) default_buttons_box = ButtonBox(linked=True) actionbar.pack_start(default_buttons_box) if allow_moving: # Move up self.move_up_button = Gtk.Button() self.move_up_button.set_tooltip_text('Move up') self.move_up_button.set_image(Gtk.Image(icon_name='go-up-symbolic')) self.move_up_button.connect('clicked', self.on_move_up_button_clicked) default_buttons_box.add(self.move_up_button) # Move down self.move_down_button = Gtk.Button() self.move_down_button.set_tooltip_text('Move down') self.move_down_button.set_image(Gtk.Image(icon_name='go-down-symbolic')) self.move_down_button.connect('clicked', self.on_move_down_button_clicked) default_buttons_box.add(self.move_down_button) # Delete self.delete_button = Gtk.Button() self.delete_button.set_tooltip_text('Delete') self.delete_button.set_image(Gtk.Image(icon_name='edit-delete-symbolic')) self.delete_button.connect('clicked', self.on_delete_button_clicked) default_buttons_box.add(self.delete_button) # Clear all self.clear_all_button = Gtk.Button() self.clear_all_button.set_tooltip_text('Clear all') self.clear_all_button.set_image(Gtk.Image(icon_name='edit-clear-all-symbolic')) self.clear_all_button.connect('clicked', self.on_clear_all_button_clicked) default_buttons_box.add(self.clear_all_button) # Initialise default buttons status self.reset_buttons() # Buttons box self.buttons_box = ButtonBox(linked=True) actionbar.pack_end(self.buttons_box)