本文整理汇总了Python中gi.repository.Gtk.HBox方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.HBox方法的具体用法?Python Gtk.HBox怎么用?Python Gtk.HBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.HBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def init(self):
self.selected_handles = set()
self.relationship_calc = get_relationship_calculator()
self.set_tooltip(_("Double-click name for details"))
self.set_text(_("No Family Tree loaded."))
self.set_use_markup(True)
self.gui.get_container_widget().remove(self.gui.textview)
vbox = Gtk.VBox()
hbox = Gtk.HBox()
pause_button = Gtk.Button(_("Pause"))
pause_button.connect("clicked", self.interrupt)
continue_button = Gtk.Button(_("Continue"))
continue_button.connect("clicked", self.resume)
copy_button = Gtk.Button(_("Copy"))
copy_button.connect("clicked", lambda widget: \
self.gui.pane.pageview.copy_to_clipboard('Person', self.selected_handles))
hbox.pack_start(pause_button, '', '', True)
hbox.pack_start(copy_button, '', '', True)
hbox.pack_start(continue_button, '', '', True)
vbox.pack_start(self.gui.textview, '', '', True)
vbox.pack_start(hbox, '', '', False)
self.gui.get_container_widget().add_with_viewport(vbox)
vbox.show_all()
示例2: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def __init__(self, option, dbstate, uistate, track, override=False):
Gtk.HBox.__init__(self)
self.__option = option
value_str = self.__option.get_value()
(copy_img, copy_dir) = value_str.split(', ',1)
self.cb_w = Gtk.CheckButton(label="")
self.cb_w.connect('toggled', self.__value_changed)
self.l_w = Gtk.Label(label=_('to directory:'))
self.l_w.set_sensitive(False)
self.fe_w = FileEntry(copy_dir, _('Save images in ...'))
self.fe_w.set_directory_entry(True)
self.fe_w.entry.connect('changed', self.__value_changed)
#self.fe_w.connect('changed', self.__value_changed)
# Update ReportBase/_FileEntry.py so that signal changed is OK
self.fe_w.set_sensitive(False)
self.cb_w.set_active(copy_img == 'True')
self.pack_start(self.cb_w, False, True, 0)
self.pack_end(self.fe_w, True, True, 0)
self.pack_end(self.l_w, False, True, 5)
self.set_tooltip_text(self.__option.get_help())
示例3: get_infobarmessage_content2
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def get_infobarmessage_content2(player,
heading_text,
message_text,
gametype=None):
hbox = Gtk.HBox()
image = Gtk.Image()
image.set_from_pixbuf(player.getIcon(size=24, gametype=gametype))
hbox.pack_start(image, False, False, 0)
label = Gtk.Label()
markup = player.getMarkup(gametype=gametype, long_titles=False)
label.set_markup(markup + heading_text)
hbox.pack_start(label, False, False, 0)
vbox = Gtk.VBox()
vbox.pack_start(hbox, False, False, 0)
label = Gtk.Label()
label.props.xalign = 0
label.props.xpad = 4
label.props.justify = Gtk.Justification.LEFT
label.props.wrap = True
label.set_width_chars(70)
label.set_text(message_text)
vbox.pack_start(label, False, False, 5)
return vbox
示例4: _get_notebook_label
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def _get_notebook_label(self, worksheet):
# Label from worksheet
label = worksheet.get_tab_label()
# FIXME: This should be handled by the editor, not the docviewer.
worksheet.editor.buffer.connect(
'changed', partial(self.on_buffer_changed, label))
# Close button
img = Gtk.Image.new_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
_, w, h = Gtk.IconSize.lookup(Gtk.IconSize.MENU)
btn = Gtk.Button()
btn.set_relief(Gtk.ReliefStyle.NONE)
btn.set_focus_on_click(False)
btn.add(img)
btn.connect(
'clicked', lambda b, w: self.remove_worksheet(w), worksheet)
# Put it together
hbox = Gtk.HBox()
hbox.pack_start(label, True, True, 3)
hbox.pack_end(btn, False, False, 0)
hbox.show_all()
return hbox
示例5: create_tab
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def create_tab(self, title, tab_child, icon=''):
tab_box = Gtk.HBox(False, 3)
close_button = Gtk.Button()
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
label = Gtk.Label(label=title)
if icon:
i = Gtk.Image()
i.set_from_stock(eval('Gtk.STOCK_' + icon), Gtk.IconSize.MENU)
tab_box.pack_start(i, False, False, 0)
close_button.connect("clicked", self.close_tab, tab_child)
close_button.set_image(image)
close_button.set_relief(Gtk.ReliefStyle.NONE)
tab_box.pack_start(label, True, True, 0)
tab_box.pack_end(close_button, False, False, 0)
tab_box.show_all()
if title in ['Loading dasm...', 'Code', 'Callgraph', 'Flowgraph', 'Interactive', 'Strings', "Sections", 'Hexdump', 'Bindiff', 'File info']:
close_button.hide()
return tab_box
示例6: help_text_factory
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def help_text_factory(text):
'''Create a label with an "info" icon in front of it. Intended for
informational text in dialogs.
@param text: the text to display
@returns: a C{Gtk.HBox}
'''
hbox = Gtk.HBox(spacing=12)
image = Gtk.Image.new_from_stock(Gtk.STOCK_INFO, Gtk.IconSize.BUTTON)
image.set_alignment(0.5, 0.0)
hbox.pack_start(image, False, True, 0)
label = Gtk.Label(label=text)
label.set_use_markup(True)
label.set_alignment(0.0, 0.0)
hbox.add(label)
return hbox
示例7: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def __init__(self, position):
GObject.GObject.__init__(self)
self.set_name('zim-sidepane')
self.key = position
# Add bar with label and close button
self.topbar = Gtk.HBox()
self.topbar.pack_end(self._close_button(), False, True, 0)
self.pack_start(self.topbar, False, True, 0)
# Add notebook
self.notebook = Gtk.Notebook()
self.notebook.set_show_border(False)
button = self._close_button()
self.notebook.set_action_widget(button, Gtk.PackType.END)
self.add(self.notebook)
self._update_topbar()
示例8: _add_load_plugin_bar
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def _add_load_plugin_bar(self, plugin_info):
key, name, activatable, klass = plugin_info
hbox = Gtk.HBox(False, 5)
label = Gtk.Label(label=_("Plugin \"%s\" is required to display this object") % name)
# T: Label for object manager - "%s" is the plugin name
hbox.pack_start(label, True, True, 0)
button = Gtk.Button(_("Enable plugin")) # T: Label for object manager
button.set_relief(Gtk.ReliefStyle.NONE)
hbox.pack_end(button, False, False, 0)
if activatable:
# Plugin can be enabled
def load_plugin(button):
PluginManager().load_plugin(key)
button.connect("clicked", load_plugin)
else:
button.set_sensitive(False)
return hbox
示例9: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def __init__(self):
GObject.GObject.__init__(self)
self.set_spacing(0)
self.set_homogeneous(False)
self._scroll_timeout = None
self._minwidth = MIN_BUTTON_WIDTH
self._anchor = None # tuple of (direction, n) - used in allocate
self._state = None # tuple of (allocation width, show scrollbars, first item, last item) - used in allocation
self._forw_button = ScrollButton(DIR_FORWARD)
self._back_button = ScrollButton(DIR_BACKWARD)
for button in (self._back_button, self._forw_button):
Gtk.HBox.add(self, button)
button.connect('button-press-event', self._on_button_press)
button.connect('button-release-event', self._on_button_release)
button.connect('clicked', self._on_button_clicked)
context = self.get_style_context()
context.add_class("linked")
示例10: get_view
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def get_view(self):
"""It's called from Preference. It creates the view and returns it"""
vbox = Gtk.VBox(False, 3)
# create columns
renderer = Gtk.CellRendererText()
renderer.set_property('editable', False)
column = Gtk.TreeViewColumn(_('Sensor'), renderer, text=0)
self._tree_view.append_column(column)
renderer = Gtk.CellRendererText()
renderer.set_property('editable', False)
column = Gtk.TreeViewColumn(_('Description'), renderer, text=1)
self._tree_view.append_column(column)
self._tree_view.expand_all()
sw = Gtk.ScrolledWindow()
sw.add_with_viewport(self._tree_view)
vbox.pack_start(sw, True, True, 0)
# add buttons
hbox = Gtk.HBox()
new_button = Gtk.Button.new_from_stock(Gtk.STOCK_NEW)
new_button.connect('clicked', self._on_edit_sensor)
hbox.pack_start(new_button, False, False, 0)
edit_button = Gtk.Button.new_from_stock(Gtk.STOCK_EDIT)
edit_button.connect('clicked', self._on_edit_sensor, False)
hbox.pack_start(edit_button, False, False, 1)
del_button = Gtk.Button.new_from_stock(Gtk.STOCK_DELETE)
del_button.connect('clicked', self._on_del_sensor)
hbox.pack_start(del_button, False, False, 2)
add_button = Gtk.Button.new_from_stock(Gtk.STOCK_ADD)
add_button.connect('clicked', self._on_add_sensor)
hbox.pack_end(add_button, False, False, 3)
vbox.pack_end(hbox, False, False, 1)
frame = Gtk.Frame.new(_('Sensors'))
frame.add(vbox)
return frame
示例11: run_recovery_dialog
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def run_recovery_dialog():
message = "Please enter your wallet seed or the corresponding mnemonic list of words, and the gap limit of your wallet."
dialog = Gtk.MessageDialog(
parent = None,
flags = Gtk.DialogFlags.MODAL,
buttons = Gtk.ButtonsType.OK_CANCEL,
message_format = message)
vbox = dialog.vbox
dialog.set_default_response(Gtk.ResponseType.OK)
# ask seed, server and gap in the same dialog
seed_box = Gtk.HBox()
seed_label = Gtk.Label(label='Seed or mnemonic:')
seed_label.set_size_request(150,-1)
seed_box.pack_start(seed_label, False, False, 10)
seed_label.show()
seed_entry = Gtk.Entry()
seed_entry.show()
seed_entry.set_size_request(450,-1)
seed_box.pack_start(seed_entry, False, False, 10)
add_help_button(seed_box, '.')
seed_box.show()
vbox.pack_start(seed_box, False, False, 5)
dialog.show()
r = dialog.run()
seed = seed_entry.get_text()
dialog.destroy()
if r==Gtk.ResponseType.CANCEL:
return False
if Wallet.is_seed(seed):
return seed
show_message("no seed")
return False
示例12: password_line
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def password_line(label):
password = Gtk.HBox()
password_label = Gtk.Label(label=label)
password_label.set_size_request(120,10)
password_label.show()
password.pack_start(password_label,False, False, 10)
password_entry = Gtk.Entry()
password_entry.set_size_request(300,-1)
password_entry.set_visibility(False)
password_entry.show()
password.pack_start(password_entry,False,False, 10)
password.show()
return password, password_entry
示例13: build_gui
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def build_gui(self):
"""
Build the GUI interface.
"""
top = Gtk.HBox()
self.photo = Photo()
self.photo.show()
view = Gtk.TreeView()
titles = [(_('Object'), 1, 250)]
self.model = ListModel(view, titles, list_mode="tree",
select_func=self.row_selected)
top.pack_start(view, True, True, 0)
top.pack_start(self.photo, True, False, 5)
top.show_all()
return top
示例14: display
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def display(self):
"""
Constructs the GUI, consisting of a message, and fields to enter the
name and password (commented out for now)
"""
# GUI setup:
dialog = Gtk.Dialog(_("Download media tool"),
self.uistate.window,
Gtk.DialogFlags.MODAL|
Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
label = Gtk.Label(_("Make sure you are connected to the internet "
"before starting this tool."))
label.set_line_wrap(True)
vbox = Gtk.VBox()
vbox.pack_start(label, True, True, 0)
# hbox1 = Gtk.HBox()
# label_name = Gtk.Label(_("Name") + ":")
# self.name_entry = Gtk.Entry()
# self.name_entry.set_text("%s" % name)
# hbox1.pack_start(label_name, False, False, 0)
# hbox1.pack_start(self.name_entry, True, True, 0)
# vbox.pack_start(hbox1, False)
#
# hbox2 = Gtk.HBox()
# label_password = Gtk.Label(_("Password") + ":")
# self.password_entry = Gtk.Entry()
# self.password_entry.set_text("%s" % password)
# hbox2.pack_start(label_password, False, False, 0)
# hbox2.pack_start(self.password_entry, True, True, 0)
# vbox.pack_start(hbox2, False)
dialog.vbox.set_spacing(10)
dialog.vbox.pack_start(vbox, True, True, 0)
dialog.show_all()
return dialog
示例15: insert_image
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HBox [as 别名]
def insert_image(self, widget):
self.insert_window_image = Gtk.Window()
self.insert_window_image.set_title("Insert Image")
self.insert_window_image.set_resizable(True)
self.insert_window_image.set_border_width(6)
self.insert_window_image.set_default_size(300, 250)
self.insert_window_image.set_position(Gtk.WindowPosition.CENTER)
vbox = Gtk.VBox()
label_alt_text = Gtk.Label("Alt Text:")
self.entry_alt_text_i = Gtk.Entry()
label_title = Gtk.Label("Title:")
self.entry_title_i = Gtk.Entry()
label_url = Gtk.Label("Path/Url:")
self.entry_url_i = Gtk.Entry()
vbox.pack_start(label_alt_text, self, False, False)
vbox.pack_start(self.entry_alt_text_i, self, False, False)
vbox.pack_start(label_title, self, False, False)
vbox.pack_start(self.entry_title_i, self, False, False)
vbox.pack_start(label_url, self, False, False)
self.hbox_url = Gtk.HBox()
self.hbox_url.pack_start(self.entry_url_i, self, True, False)
self.path_file_button = Gtk.FileChooserButton(title= "Select an image")
self.path_file_button.connect("file-set", self.file_chooser_button_clicked)
self.hbox_url.pack_start(self.path_file_button, self, False, False)
vbox.pack_start(self.hbox_url, self, False, False)
button = Gtk.Button("Insert Image")
vbox.pack_end(button, self, False, False)
self.insert_window_image.add(vbox)
self.insert_window_image.show_all()
button.connect("clicked", self.insert_image_cmd, self.insert_window_image)