当前位置: 首页>>代码示例>>Python>>正文


Python Gtk.ListBox方法代码示例

本文整理汇总了Python中gi.repository.Gtk.ListBox方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.ListBox方法的具体用法?Python Gtk.ListBox怎么用?Python Gtk.ListBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gtk的用法示例。


在下文中一共展示了Gtk.ListBox方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: replace_all_instances

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
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) 
开发者ID:themix-project,项目名称:oomox,代码行数:19,代码来源:colors_list.py

示例2: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
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) 
开发者ID:michaldaniel,项目名称:ebook-viewer,代码行数:26,代码来源:chapters_list.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
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 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:9,代码来源:list.py

示例4: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
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) 
开发者ID:gramps-project,项目名称:addons-source,代码行数:11,代码来源:search_widget.py

示例5: add_to_panel

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
def add_to_panel(self, row):
        """
        Add found item to panel (ListBox).
        row - ListBoxRow
        """
        self.list_box.prepend(row)
        row.show_all() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:9,代码来源:search_widget.py

示例6: _setup_ui

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
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() 
开发者ID:buzz,项目名称:volctl,代码行数:28,代码来源:prefs.py

示例7: setup_box

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
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 
开发者ID:bilelmoussaoui,项目名称:Audio-Cutter,代码行数:36,代码来源:soundconfig.py

示例8: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
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) 
开发者ID:maoschanz,项目名称:dynamic-wallpaper-editor,代码行数:10,代码来源:view.py

示例9: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
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) 
开发者ID:AXeL-dev,项目名称:Dindo-Bot,代码行数:15,代码来源:custom.py

示例10: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ListBox [as 别名]
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) 
开发者ID:themix-project,项目名称:oomox,代码行数:13,代码来源:colors_list.py


注:本文中的gi.repository.Gtk.ListBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。