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


Python Gtk.HButtonBox方法代码示例

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


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

示例1: create_buttons

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HButtonBox [as 别名]
def create_buttons(self):
        """Creates and connects the Save, Cancel and Preview buttons"""

        spacing = 0

        button_box = Gtk.HButtonBox()

        button_box.set_border_width(5)
        button_box.set_layout(Gtk.ButtonBoxStyle.EDGE)
        button_box.set_spacing(spacing)

        self._cancel_button = Gtk.Button(stock=Gtk.STOCK_CANCEL)
        self._cancel_button.set_tooltip_text("Don't save changes (ESC)")
        button_box.add(self._cancel_button)

        self._preview_button = Gtk.Button(label="Preview")
        self._preview_button.set_tooltip_text("Show/ update preview (CTRL+P)")
        button_box.add(self._preview_button)

        self._ok_button = Gtk.Button(stock=Gtk.STOCK_SAVE)
        self._ok_button.set_tooltip_text("Update or create new LaTeX output (CTRL+RETURN)")
        button_box.add(self._ok_button)

        self._cancel_button.connect("clicked", self.cb_cancel)
        self._ok_button.connect("clicked", self.cb_ok)
        self._preview_button.connect('clicked', self.update_preview)

        return button_box 
开发者ID:textext,项目名称:textext,代码行数:30,代码来源:asktext.py

示例2: init

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HButtonBox [as 别名]
def init(self):
        """
        Constructs the GUI, consisting of a text area, and
        an Import and Clear buttons.
        """
        from gi.repository import Gtk
        # GUI setup:
        self.set_tooltip(_("Enter text to import and then click\n"
                           "the Import button at bottom"))
        # create
        self.import_text = Gtk.TextView()
        self.import_text.set_wrap_mode(Gtk.WrapMode.NONE)
        self.import_text.set_editable(True)
        import_button = Gtk.Button()
        clear_button = Gtk.Button()
        # layout
        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.add(self.import_text)
        buttonbox = Gtk.HButtonBox()
        buttonbox.set_layout(Gtk.ButtonBoxStyle.SPREAD)
        buttonbox.pack_start(clear_button, False, False, 0)
        buttonbox.pack_start(import_button, False, False, 0)
        vbox = Gtk.VBox()
        vbox.pack_start(scrolled_window, True, True, 0)
        vbox.pack_start(buttonbox, False, False, 0)
        scrolled_window = self.gui.get_container_widget()
        for widget in scrolled_window.get_children():
            widget.destroy()
        scrolled_window.add_with_viewport(vbox)
        scrolled_window.get_children()[0].set_shadow_type(Gtk.ShadowType.NONE)
        # bindings
        actiongroup = Gtk.ActionGroup('GrampletImportActions')
        actiongroup.add_actions([
            ('import', None, _("_Import"), '<Alt>i', None, self.run),
            ('clear', Gtk.STOCK_CLEAR, None, None, None, self.clear)])
        import_button.set_related_action(actiongroup.get_action('import'))
        clear_button.set_related_action(actiongroup.get_action('clear'))
        # show
        vbox.show_all() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:41,代码来源:ImportGramplet.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HButtonBox [as 别名]
def __init__(self):
	#~ def __init__(self, dir):
		GObject.GObject.__init__(self)
		self.set_title('Internationalizer')
		self.set_default_size(500, 500)
		#~ self.dir = dir

		vbox = Gtk.VBox()
		self.add(vbox)

		self.status_label = Gtk.Label()
		vbox.pack_start(self.status_label, False)

		hbox = Gtk.HBox()
		vbox.add(hbox)
		scrollwindow = Gtk.ScrolledWindow()
		hbox.add(scrollwindow)

		self.textview = Gtk.TextView()
		self.textview.set_left_margin(12)
		self.textview.set_right_margin(5)
		scrollwindow.add(self.textview)

		bbox = Gtk.HButtonBox()
		vbox.pack_start(bbox, False)

		savebutton = Gtk.Button(stock='gtk-save')
		savebutton.connect_object('clicked', self.__class__.save_file, self)
		bbox.add(savebutton)

		reloadbutton = Gtk.Button(stock='gtk-refresh')
		reloadbutton.connect_object('clicked', self.__class__.reload_file, self)
		bbox.add(reloadbutton)

		nextbutton = Gtk.Button(stock='gtk-forward')
		nextbutton.connect_object('clicked', self.__class__.next_tag, self)
		bbox.add(nextbutton)

		applybutton = Gtk.Button(stock='gtk-apply')
		applybutton.connect_object('clicked', self.__class__.apply_mark, self)
		bbox.add(applybutton) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:43,代码来源:internationalizer.py

示例4: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HButtonBox [as 别名]
def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate

        tool.Tool.__init__(self, dbstate, options_class, name)

        self.window_name = _('Media Verify Tool')
        ManagedWindow.__init__(self, uistate, [], self.__class__)

        self.dbstate = dbstate
        self.moved_files = []
        self.titles = [_('Moved/Renamed Files'), _('Missing Files'),
                       _('Duplicate Files'), _('Extra Files'),
                       _('No md5 Generated'), _('Errors')]
        self.models = []
        self.views = []

        window = Gtk.Window()
        vbox = Gtk.VBox()

        self.notebook = Gtk.Notebook()
        self.notebook.set_scrollable(True)
        for title in self.titles:
            self.create_tab(title)
        vbox.pack_start(self.notebook, True, True, 5)

        bbox = Gtk.HButtonBox()
        vbox.pack_start(bbox, False, False, 5)
        close = Gtk.Button(_('Close'))
        close.set_tooltip_text(_('Close the Media Verify Tool'))
        close.connect('clicked', self.close)
        generate = Gtk.Button(_('Generate'))
        generate.set_tooltip_text(_('Generate md5 hashes for media objects'))
        generate.connect('clicked', self.generate_md5)
        verify = Gtk.Button(_('Verify'))
        verify.set_tooltip_text(_('Check media paths and report missing, '
                                  'duplicate and extra files'))
        verify.connect('clicked', self.verify_media)
        export = Gtk.Button(_('Export'))
        export.set_tooltip_text(_('Export the results to a text file'))
        export.connect('clicked', self.export_results)
        fix = Gtk.Button(_('Fix'))
        fix.set_tooltip_text(_('Fix media paths of moved and renamed files'))
        fix.connect('clicked', self.fix_media)
        bbox.add(close)
        bbox.add(generate)
        bbox.add(verify)
        bbox.add(export)
        bbox.add(fix)
        vbox.show_all()

        window.add(vbox)
        window.set_size_request(500, 300)
        window.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_window(window, None, self.window_name)
        self.show()

        self.show_tabs() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:59,代码来源:MediaVerify.py

示例5: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HButtonBox [as 别名]
def __init__(self, manager, parent):
		Gtk.Window.__init__(self, title=_("Restore"))
		self.set_border_width(10)
		self.set_icon_name("view-refresh")
		self.set_position(Gtk.WindowPosition.CENTER)
		self.set_transient_for(parent)

		cfg = parent.load_config()

		vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
		self.add(vbox)

		backups_store = Gtk.ListStore(str)
		for d in cfg["dirs"]:
			backups_store.append([d["name"]])

		hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
		vbox.add(hbox)
		label = Gtk.Label(_("Backup name"), xalign=0)
		self.backup_name_combo = Gtk.ComboBox.new_with_model_and_entry(backups_store)
		self.backup_name_combo.set_entry_text_column(0)
		hbox.pack_start(label, True, True, 0)
		hbox.pack_start(self.backup_name_combo, False, True, 0)

		hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
		vbox.add(hbox)
		label = Gtk.Label(_("Backup date"), xalign=0)
		self.backup_date_entry = Gtk.Entry()
		self.backup_date_entry.set_text("latest")
		hbox.pack_start(label, True, True, 0)
		hbox.pack_start(self.backup_date_entry, False, True, 0)

		hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
		vbox.add(hbox)
		label = Gtk.Label(_("Backup path"), xalign=0)
		self.backup_path_entry = Gtk.Entry()
		hbox.pack_start(label, True, True, 0)
		hbox.pack_start(self.backup_path_entry, False, True, 0)

		hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
		vbox.add(hbox)
		label = Gtk.Label(_("Destination"), xalign=0)
		self.dest_folder_btn = Gtk.FileChooserButton.new(_("Choose a destination folder"), Gtk.FileChooserAction.SELECT_FOLDER)
		self.dest_folder_btn.set_filename("/")
		hbox.pack_start(label, True, True, 0)
		hbox.pack_start(self.dest_folder_btn, False, True, 0)

		hbox = Gtk.HButtonBox()
		vbox.add(hbox)

		button = Gtk.Button(_("Cancel"))
		button.connect("clicked", self.on_close_clicked)
		hbox.pack_end(button, False, False, 0)

		button = Gtk.Button(_("Restore"))
		if hasattr(Gtk, "STYLE_CLASS_SUGGESTED_ACTION"): # Since GTK 3.10
			button.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION)
		button.connect("clicked", self.on_restore_clicked)
		hbox.pack_end(button, False, False, 0)

		self.manager = manager 
开发者ID:emersion,项目名称:bups,代码行数:63,代码来源:gtk.py


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