本文整理汇总了Python中gi.repository.Gtk.Separator方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.Separator方法的具体用法?Python Gtk.Separator怎么用?Python Gtk.Separator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.Separator方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_widget
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def build_widget(self):
"""
Build the widget that contains the view, see
:class:`~gui.views.pageview.PageView
"""
container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
container.set_border_width(12)
self.header = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.header.show()
self.stack = Gtk.Stack()
ss = Gtk.StackSwitcher()
ss.set_stack(self.stack)
self.stack.show()
ss.show()
container.set_spacing(6)
container.pack_start(self.header, False, False, 0)
container.pack_start(Gtk.Separator(), False, False, 0)
container.pack_start(ss, False, False, 0)
container.pack_start(self.stack, True, True, 0)
container.show_all()
return container
示例2: _add_separator
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def _add_separator(self):
sep = Gtk.Separator()
sep.set_property("orientation", Gtk.Orientation.VERTICAL)
self._toolarea.pack_start(sep, False, True, 0)
sep.show_all()
示例3: _create_sliders
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def _create_sliders(self):
pos = 0
# touching pa objects here!
pa_threaded_mainloop_lock(self.volctl.pa_mgr.mainloop)
# sinks
for _, sink in self.volctl.pa_mgr.pa_sinks.items():
scale, icon = self._add_scale(sink)
self._sink_scales[sink.idx] = scale
scale.connect("value-changed", self._cb_sink_scale_change)
self._update_scale(scale, sink.volume, sink.mute)
scale.set_margin_top(self.SPACING)
icon.set_margin_bottom(self.SPACING)
self._grid.attach(scale, pos, 0, 1, 1)
self._grid.attach(icon, pos, 1, 1, 1)
pos += 1
# separator
if not self.volctl.pa_mgr.pa_sink_inputs:
separator = Gtk.Separator().new(Gtk.Orientation.VERTICAL)
separator.set_margin_top(self.SPACING)
separator.set_margin_bottom(self.SPACING)
self._grid.attach(separator, pos, 0, 1, 2)
pos += 1
# sink inputs
for _, sink_input in self.volctl.pa_mgr.pa_sink_inputs.items():
scale, icon = self._add_scale(sink_input)
self._sink_input_scales[sink_input.idx] = scale
scale.connect("value-changed", self._cb_sink_input_scale_change)
self._update_scale(scale, sink_input.volume, sink_input.mute)
scale.set_margin_top(self.SPACING)
icon.set_margin_bottom(self.SPACING)
self._grid.attach(scale, pos, 0, 1, 1)
self._grid.attach(icon, pos, 1, 1, 1)
pos += 1
pa_threaded_mainloop_unlock(self.volctl.pa_mgr.mainloop)
示例4: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def __init__(self, app):
super(Statusbar, self).__init__()
self._app = app
# Default values
self.lock = False
self._errors = True
self._timer_id = 0
self._was_hidden = False
# Statusbar on the bottom
self.set_name("StatusBar") # Name for css
# Two labels for two sides of statusbar and one in the middle for
# additional info
self._left_label = Gtk.Label()
self._left_label.set_justify(Gtk.Justification.LEFT)
self._right_label = Gtk.Label()
self._right_label.set_justify(Gtk.Justification.RIGHT)
self._center_label = Gtk.Label()
self._center_label.set_justify(Gtk.Justification.CENTER)
self._center_label.set_hexpand(True)
# Add them all
self.attach(self._left_label, 0, 0, 1, 1)
self.attach(self._center_label, 1, 0, 1, 1)
self.attach(self._right_label, 2, 0, 1, 1)
# Padding and separator
padding = settings["commandline_padding"].get_value()
self.set_margin_start(padding)
self.set_margin_end(padding)
self.set_margin_top(padding)
self.set_margin_bottom(padding)
self.separator = Gtk.Separator()
# Connect signals
self._app["commandline"].search.connect("no-search-results",
self._on_no_search_results)
settings.connect("changed", self._on_settings_changed)
示例5: _update_bookmarks
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def _update_bookmarks(self):
ext_media = sorted(self.get_mounts(), key=self.sort, reverse=False)
bookmarks = sorted(self.bookmarks.get(), key=self.sort, reverse=False)
for child in self.bookmark_listbox.get_children():
self.bookmark_listbox.remove(child)
# Add the places
for path in self.places:
icon = self.icons.get_for_directory(path)
self.add_listbox_row(icon, path)
# Add the mounts
self.eject_btn_path_dict = {}
icon = self.icons.get_for_device('USBdrive')
for device in ext_media:
path, name, mount = device
if mount.can_eject():
self.add_listbox_row(icon, path, name, mount)
else:
self.add_listbox_row(icon, path, name)
# Add the seperator
row = Gtk.ListBoxRow()
row.set_selectable(False)
separator = Gtk.Separator()
row.add(separator)
self.bookmark_listbox.add(row)
# Add the bookmarks
for bookmark in bookmarks:
path, name = bookmark
if not os.path.exists(path):
continue
icon = self.icons.get_for_directory(path)
self.add_listbox_row(icon, path, name)
self.bookmark_listbox.show_all()
示例6: demo
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def demo():
view = GcodeView()
buf = view.get_buffer()
buf.set_text('''(TEST OF G-CODE HIGHLIGHTING)\n\nG1 X1.2454 Y2.3446 Z-10.2342 I0 J0 K0\n\nM3''')
view.highlight_line(3, None)
scrolled = Gtk.ScrolledWindow()
scrolled.set_hexpand(True)
scrolled.add(view)
view_map = GcodeMap()
view_map.set_view(view)
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
box.pack_start(scrolled, True, True, 0)
box.pack_start(Gtk.Separator(), False, False, 0)
box.pack_start(view_map, False, False, 0)
win = Gtk.Window()
win.set_default_size(400, 300)
win.add(box)
win.connect('destroy', Gtk.main_quit)
win.show_all()
Gtk.main()
示例7: add_section_separator
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def add_section_separator(self):
self.attach_large(Gtk.Separator())
示例8: _update
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def _update(self, notebook, *a):
for child in self.get_children():
child.destroy()
if self._angle in (90, 270): # Hack to introduce some empty space
label = Gtk.Label(label=' ')
self.pack_start(label, False, True, 0)
ipages = list(range(notebook.get_n_pages()))
if self._angle == 90:
ipages = reversed(ipages) # keep order the same in reading direction
for i in ipages:
child = notebook.get_nth_page(i)
button = Gtk.Button()
button.add(child.get_title_label())
if self.status_bar_style:
button_set_statusbar_style(button)
else:
button.set_relief(Gtk.ReliefStyle.NONE)
button.connect('clicked', self._on_click, child.tab_key)
if self._angle != 0:
button.get_child().set_angle(self._angle)
else:
self.pack_start(Gtk.Separator(), False, True, 0)
self.pack_start(button, False, True, 0)
button.show_all()
示例9: display_row_separators
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def display_row_separators(row, before):
# This was added in GTK 3.14, but since it really doesn't make much of a difference and is purely aesthetic, and
# prevents it from running on GTK 3.10 lets just set this when it is possible but not enforce it
# noinspection PyBroadException
try:
row.set_activatable(False)
row.set_selectable(False)
except:
pass
if before:
row.set_header(Gtk.Separator())
示例10: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Separator [as 别名]
def __init__(self, app):
"""Create the necessary objects and settings.
Args:
app: The main vimiv application to interact with.
"""
super(Library, self).__init__()
self._app = app
# Settings
self._positions = {}
border_width = settings["border_width"].get_value()
# Defaults
self.files = []
# Grid with treeview and border
self.grid = Gtk.Grid()
# A simple border
if border_width:
border = Gtk.Separator()
border.set_size_request(border_width, 1)
self.grid.attach(border, 1, 0, 1, 1)
# Pack everything
self.set_size_request(
settings["library_width"].get_value() - border_width, 10)
scrolled_win = Gtk.ScrolledWindow()
scrolled_win.set_vexpand(True)
scrolled_win.add(self)
scrolled_win.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self.grid.attach(scrolled_win, 0, 0, 1, 1)
# Treeview
self.set_enable_search(False)
# Select file when row activated
self.connect("row-activated", self.file_select, True)
# Handle key events
self.add_events(Gdk.EventMask.KEY_PRESS_MASK)
self.connect("key_press_event",
self._app["eventhandler"].on_key_press, "LIBRARY")
self.connect("button_press_event",
self._app["eventhandler"].on_click, "LIBRARY")
# Add the columns
for i, name in enumerate(["Num", "Name", "Size", "M"]):
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn(name, renderer, markup=i)
if name == "Name":
column.set_expand(True)
column.set_max_width(20)
self.append_column(column)
# Set the liststore model
self.set_model(self._liststore_create())
# Set the hexpand property if requested in the configfile
if not self._app.get_paths() and settings["expand_lib"].get_value():
self.set_hexpand(True)
# Connect signals
self._app.connect("paths-changed", self._on_paths_changed)
self._app["mark"].connect("marks-changed", self._on_marks_changed)
self._app["commandline"].search.connect("search-completed",
self._on_search_completed)
settings.connect("changed", self._on_settings_changed)