本文整理汇总了Python中gi.repository.Gtk.Grid方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.Grid方法的具体用法?Python Gtk.Grid怎么用?Python Gtk.Grid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.Grid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def __init__(
self, colours, max_colour_val, num_rows, num_cols, horizontal,
selected_handler):
Gtk.Grid.__init__(self)
row = 0
col = 0
(ret, width, height) = Gtk.icon_size_lookup(Gtk.IconSize.BUTTON)
rgba = Gdk.RGBA()
for c in colours:
rgba.parse(c)
colour_square = ColourPaletteSquare(
rgba, width, height, max_colour_val)
colour_square.connect("button-release-event", selected_handler)
self.attach(colour_square, col, row, 1, 1)
if horizontal:
col += 1
if col == num_cols:
col = 0
row += 1
else:
row += 1
if row == num_rows:
row = 0
col += 1
示例2: init_ui
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def init_ui(self):
vbox0 = Gtk.VBox(spacing=5)
vbox0.set_border_width(5)
self.get_content_area().add(vbox0)
frame1 = Gtk.Frame()
vbox0.add(frame1)
self.grid = Gtk.Grid()
self.grid.set_row_spacing(10)
self.grid.set_column_spacing(10)
self.grid.set_margin_bottom(10)
self.grid.set_margin_start(10)
self.grid.set_margin_end(10)
self.grid.set_margin_top(10)
frame1.add(self.grid)
示例3: write_album
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def write_album(self, person):
self.vbox2 = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
scroll = Gtk.ScrolledWindow()
scroll.add(self.vbox2)
scroll.show_all()
self.stack.add_titled(scroll, 'album', _('Album'))
self.write_media(person.get_media_list(), None)
for event_ref in person.get_event_ref_list():
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
self.write_media(event.get_media_list(), event)
for family_handle in person.get_family_handle_list():
family = self.dbstate.db.get_family_from_handle(family_handle)
self.write_media(family.get_media_list(), None)
for event_ref in family.get_event_ref_list():
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
self.write_media(event.get_media_list(), event)
示例4: get_attribute_grid
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def get_attribute_grid(self, attrs):
grid = Gtk.Grid()
row = 0
for attr in attrs:
if str(attr.get_type()) != _('Order'):
label = widgets.BasicLabel('%s: ' % str(attr.get_type()))
grid.attach(label, 0, row, 1, 1)
label = widgets.BasicLabel(attr.get_value())
grid.attach(label, 1, row, 1, 1)
row += 1
grid.show_all()
return grid
##############################################################################
#
# Citations list
#
##############################################################################
示例5: config_panel
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def config_panel(self, configdialog):
"""
Function that builds the widget in the configuration dialog
"""
grid = Gtk.Grid()
grid.set_border_width(12)
grid.set_column_spacing(6)
grid.set_row_spacing(6)
configdialog.add_checkbox(grid,
_('Use shading'),
0, 'preferences.relation-shade')
configdialog.add_checkbox(grid,
_('Display edit buttons'),
1, 'preferences.releditbtn')
checkbox = Gtk.CheckButton(label=_('View links as website links'))
theme = self._config.get('preferences.relation-display-theme')
checkbox.set_active(theme == 'WEBPAGE')
checkbox.connect('toggled', self._config_update_theme)
grid.attach(checkbox, 1, 2, 8, 1)
return _('Layout'), grid
示例6: content_panel
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def content_panel(self, configdialog):
"""
Function that builds the widget in the configuration dialog
"""
grid = Gtk.Grid()
grid.set_border_width(12)
grid.set_column_spacing(6)
grid.set_row_spacing(6)
configdialog.add_checkbox(grid,
_('Show Details'),
0, 'preferences.family-details')
configdialog.add_checkbox(grid,
_('Vertical Details'),
1, 'preferences.vertical-details')
configdialog.add_checkbox(grid,
_('Show Siblings'),
2, 'preferences.family-siblings')
configdialog.add_checkbox(grid,
_('Show Tags'),
3, 'preferences.show-tags')
return _('Content'), grid
示例7: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def __init__(self, volctl):
self.volctl = volctl
self._win = Gtk.Window(type=Gtk.WindowType.POPUP)
self._win.connect("enter-notify-event", self._cb_enter_notify)
self._win.connect("leave-notify-event", self._cb_leave_notify)
self._grid = Gtk.Grid()
self._grid.set_column_spacing(2)
self._grid.set_row_spacing(self.SPACING)
self._frame = Gtk.Frame()
self._frame.set_shadow_type(Gtk.ShadowType.OUT)
self._frame.add(self._grid)
self._win.add(self._frame)
# gui objects by index
self._sink_scales = {}
self._sink_input_scales = {}
self._create_sliders()
self._win.show_all()
self._set_position()
# timeout
self._timeout = None
self._enable_timeout()
示例8: init_grid
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def init_grid(self):
# Create widgets
self.grid = Gtk.Grid()
self.rev = RevealerClass()
align = Gtk.Alignment()
self.eb = Gtk.EventBox()
# Set values
self.grid.set_row_spacing(1)
self.grid.set_column_spacing(3)
self.rev.set_reveal_child(False)
align.set_padding(2, 2, 5, 5)
self.eb.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.background))
self.grid.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.background))
# Connect signals
self.eb.connect("button-release-event", self.on_grid_release)
self.eb.connect("button-press-event", self.on_grid_click)
self.eb.connect('enter-notify-event', self.on_enter_notify)
self.eb.connect('leave-notify-event', self.on_leave_notify)
# Pack together
align.add(self.grid)
self.eb.add(align)
self.rev.add(self.eb)
self.add(self.rev)
### GtkWidget-related stuff
示例9: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def __init__(self):
Gtk.VBox.__init__(self, spacing=3, margin=5, vexpand=False)
## Plot options
self.plot_options_label = Gtk.Label(justify=Gtk.Justification.LEFT, xalign=0, margin_top=5)
self.plot_options_label.set_markup("<b>Plot Options:</b>")
self.pack_start(self.plot_options_label, expand=False, fill=True, padding=2)
grid0 = Gtk.Grid(column_spacing=3, row_spacing=2)
self.pack_start(grid0, expand=True, fill=False, padding=2)
# Plot CB
self.plot_cb = FCCheckBox(label='Plot')
grid0.attach(self.plot_cb, 0, 0, 2, 1)
# Tool dia for plot
l1 = Gtk.Label('Tool dia:', xalign=1)
grid0.attach(l1, 0, 1, 1, 1)
self.tooldia_entry = LengthEntry()
grid0.attach(self.tooldia_entry, 1, 1, 1, 1)
示例10: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def __init__(self):
Gtk.Window.__init__(self)
self.assistant = Gtk.Assistant()
grid = Gtk.Grid(margin=4)
grid.set_column_homogeneous(True)
self.add(grid)
self.grid = grid
self.status_label, self.status_button = self.draw_status_elements()
self.statistics_frame = self.draw_statistics_frame()
self.top_queries_frame = self.draw_top_queries_frame()
self.top_ads_frame = self.draw_top_ads_frame()
self.updates_frame = self.draw_updates_frame()
self.header_bar = self.draw_header_bar()
self.hosts_combo = self.draw_hosts_combo()
# Initial data fetch-and-display
self.fetch_data_and_update_display(
base_url, web_password)
# Create a timer --> self.on_timer will be called periodically
glib.timeout_add_seconds(update_interval_seconds, self.on_timer)
示例11: set_sensitive
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def set_sensitive(self, sensitive):
""" Override Gtk.Grid.set_sensitive()."""
if self.get_parent().get_sensitive() == sensitive:
return
self.get_parent().set_sensitive(sensitive)
for c in self.get_children():
c.set_active(sensitive)
示例12: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def __init__(self, application, plugin_klass):
super(PluginsConfigurationFrame, self).__init__()
self.application = application
self.config = application.config
self.plugin_klass = plugin_klass
self.option_widgets = {}
self.logger = logging.getLogger('KingPhisher.Client.' + self.__class__.__name__)
plugin_config = self.config['plugins'].get(plugin_klass.name) or {} # use or instead of get incase the value is actually None
grid = Gtk.Grid()
self.add(grid)
grid.set_property('margin-start', 12)
grid.set_property('column-spacing', 3)
grid.set_property('hexpand', True)
grid.set_property('row-spacing', 3)
grid.insert_column(0)
grid.insert_column(0)
grid.attach(self._get_title_box(), 0, 0, 2, 1)
for row, opt in enumerate(plugin_klass.options, 1):
grid.insert_row(row)
name_label = Gtk.Label()
name_label.set_property('tooltip-text', opt.description)
name_label.set_property('width-request', 175)
name_label.set_text(opt.display_name)
grid.attach(name_label, 0, row, 1, 1)
try:
widget = opt.get_widget(self.application, plugin_config.get(opt.name, opt.default))
except Exception:
self.logger.error("can not build configuration widget for plugin: {}, option: {}".format(plugin_klass.name, opt.name))
continue
widget.set_property('tooltip-text', opt.description)
grid.attach(widget, 1, row, 1, 1)
self.option_widgets[opt.name] = OptionWidget(opt, widget)
self.show_all()
示例13: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def __init__(self, text, title="Epoptes", markup=True,
icon_name="dialog-information"):
super().__init__(title=title, icon_name=icon_name)
self.set_position(Gtk.WindowPosition.CENTER)
grid = Gtk.Grid(column_spacing=10, row_spacing=10, margin=10)
self.add(grid)
image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.DIALOG)
grid.add(image)
# Always load the plain text first in case the markup parsing fails
label = Gtk.Label(
label=text, selectable=True, hexpand=True, vexpand=True,
halign=Gtk.Align.START, valign=Gtk.Align.START)
if markup:
label.set_markup(text)
grid.add(label)
button = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)
button.set_hexpand(False)
button.set_halign(Gtk.Align.END)
button.connect("clicked", Gtk.main_quit)
grid.attach(button, 1, 1, 2, 1)
self.set_focus_child(button)
accelgroup = Gtk.AccelGroup()
key, modifier = Gtk.accelerator_parse('Escape')
accelgroup.connect(
key, modifier, Gtk.AccelFlags.VISIBLE, Gtk.main_quit)
self.add_accel_group(accelgroup)
示例14: details_dialog
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def details_dialog(parent, infos):
dialog = Dialog(parent, _("Image details"))
grid = Gtk.Grid(row_spacing=12, column_spacing=12, column_homogeneous=True)
grid.attach(Gtk.Label('<b>' + _("Name") + '</b>',
use_markup=True, xalign=0.0), 0, 0, 1, 1)
grid.attach(Gtk.Label(infos['name'], xalign=0.0), 1, 0, 1, 1)
grid.attach(Gtk.Label('<b>' + _("Mode") + '</b>',
use_markup=True, xalign=0.0), 0, 1, 1, 1)
grid.attach(Gtk.Label(infos['mode'], xalign=0.0), 1,1, 1, 1)
grid.attach(Gtk.Label('<b>' + _("Size") + '</b>',
use_markup=True, xalign=0.0), 0, 2, 1, 1)
grid.attach(Gtk.Label(infos['size'], xalign=0.0), 1, 2, 1, 1)
if len(infos) > 3:
grid.attach(Gtk.Label('<b>' + _("Weight") + '</b>',
use_markup=True, xalign=0.0), 0, 3, 1, 1)
grid.attach(Gtk.Label(infos['weight'], xalign=0.0), 1, 3, 1, 1)
grid.attach(Gtk.Label('<b>' + _("Last change") + '</b>',
use_markup=True, xalign=0.0), 0, 4, 1, 1)
grid.attach(Gtk.Label(infos['last_change'], xalign=0.0), 1, 4, 1, 1)
close_button = Gtk.Button.new_with_label(_("Close"))
close_button.connect('clicked', dialog.close)
close_button.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION)
grid.attach(close_button, 0, 5, 2, 1)
dialog.dialog_box.add(grid)
dialog.launch()
示例15: _labelled_list_helper
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Grid [as 别名]
def _labelled_list_helper(self, desc, box):
grid = Gtk.Grid()
grid.attach(box, 0, 0, 1, 1)
i = 1
for text in desc[1:]:
label = Gtk.Label(text)
label.set_alignment(xalign=0, yalign=0.5)
label.set_padding(xpad=25, ypad=0)
label.get_style_context().add_class('normal_label')
grid.attach(label, 0, i, 1, 1)
i = i + 1
return grid