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


Python Gtk.LinkButton方法代码示例

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


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

示例1: on_about

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import LinkButton [as 别名]
def on_about(self, *args):
		"""Action callback, showing the "about" dialog."""
		about_dialog = Gtk.AboutDialog(transient_for=self.props.active_window,
			copyright="© 2018-2020 Romain F. T.", authors=["Romain F. T."],
			# To tranlators: "translate" this by your name, it will be displayed
			# in the "about" dialog
			translator_credits=_("translator-credits"),
			# To translators: it's credits for the icons, consider that "Art
			# Libre" is proper name
			artists=["Tobias Bernard", "Romain F. T.",
			                       _("GNOME's \"Art Libre\" icon set authors")],
			comments=_("A drawing application for the GNOME desktop."),
			license_type=Gtk.License.GPL_3_0,
			logo_icon_name=APP_ID, version=str(self._version),
			website='https://maoschanz.github.io/drawing/',
			website_label=_("Official webpage"))
		bug_report_btn = Gtk.LinkButton(halign=Gtk.Align.CENTER, visible=True, \
		                    label=_("Report bugs or ideas"), uri=BUG_REPORT_URL)
		# about_dialog.get_content_area().add(bug_report_btn) # should i?
		about_dialog.run()
		about_dialog.destroy() 
开发者ID:maoschanz,项目名称:drawing,代码行数:23,代码来源:main.py

示例2: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import LinkButton [as 别名]
def __init__(self):
        self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL, title=_("Ask for permissions"))
        self.window.set_transient_for(mainwindow())
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        gtk_version = (Gtk.get_major_version(), Gtk.get_minor_version())
        if gtk_version >= (3, 12):
            vbox.props.margin_start = 9
            vbox.props.margin_end = 9
        else:
            vbox.props.margin_left = 9
            vbox.props.margin_right = 9
        vbox.props.margin_bottom = 9
        self.window.add(vbox)
        uistuff.keepWindowSize("externalsdialog", self.window, (320, 240), uistuff.POSITION_CENTER)

        label = Gtk.Label(_("Some PyChess features require further permission in order to download external components"))
        vbox.pack_start(label, True, True, 0)

        box = Gtk.Box()
        check_button = Gtk.CheckButton(_("database querying needs scoutfish"))
        check_button.set_active(conf.get("download_scoutfish"))
        check_button.connect("toggled", lambda w: conf.set("download_scoutfish", w.get_active()))
        box.add(check_button)
        link = "https://github.com/pychess/scoutfish"
        link_button = Gtk.LinkButton(link, link)
        box.add(link_button)
        vbox.pack_start(box, False, False, 0)

        box = Gtk.Box()
        check_button = Gtk.CheckButton(_("database opening tree needs chess_db"))
        check_button.set_active(conf.get("download_chess_db"))
        check_button.connect("toggled", lambda w: conf.set("download_chess_db", w.get_active()))
        box.add(check_button)
        link = "https://github.com/pychess/chess_db"
        link_button = Gtk.LinkButton(link, link)
        box.add(link_button)
        vbox.pack_start(box, False, False, 0)

        box = Gtk.Box()
        check_button = Gtk.CheckButton(_("ICC lag compensation needs timestamp"))
        check_button.set_active(conf.get("download_timestamp"))
        check_button.connect("toggled", lambda w: conf.set("download_timestamp", w.get_active()))
        box.add(check_button)
        link = "http://download.chessclub.com/timestamp/"
        link_button = Gtk.LinkButton(link, link)
        box.add(link_button)
        vbox.pack_start(box, False, False, 0)

        check_button = Gtk.CheckButton(_("Don't show this dialog on startup."))
        check_button.set_active(conf.get("dont_show_externals_at_startup"))
        check_button.connect("toggled", lambda w: conf.set("dont_show_externals_at_startup", w.get_active()))
        vbox.pack_start(check_button, True, True, 0)

        buttonbox = Gtk.ButtonBox()
        close_button = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
        close_button.connect("clicked", self.on_close_clicked)
        self.window.connect("delete_event", lambda w, a: self.window.destroy())
        buttonbox.add(close_button)
        vbox.pack_start(buttonbox, False, False, 0) 
开发者ID:pychess,项目名称:pychess,代码行数:61,代码来源:ExternalsDialog.py

示例3: show_file_info

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import LinkButton [as 别名]
def show_file_info(self, b=None):
    print('show_file_info')
    fmd = self.get_fmd()
    msg = '\n' + fmd.details()
    if self.cast:
      msg += '\nDevice: %s (%s)' % (self.cast.device.model_name, self.cast.device.manufacturer) 
    msg += '\nChromecast: v%s' % (__version__)
    dialogWindow = Gtk.MessageDialog(self.win,
                          Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
                          Gtk.MessageType.INFO,
                          Gtk.ButtonsType.OK,
                          msg)
    dialogWindow.set_title('File Info')
    dialogWindow.set_default_size(1, 400)
    
    if self.cast:
      title = 'Error playing %s' % os.path.basename(self.fn)
      body = '''
[Please describe what happened here...]

[Please link to the download here...]

```
[If possible, please run `ffprobe -i <fn>` and paste the output here...]
```

------------------------------------------------------------

%s

%s

```%s```''' % (msg, fmd, fmd._important_ffmpeg)
      url = 'https://github.com/keredson/gnomecast/issues/new?title=%s&body=%s' % (urllib.parse.quote(title), urllib.parse.quote(body))
      dialogWindow.add_action_widget(Gtk.LinkButton(url, label="Report File Doesn't Play"), 10)
      

    dialogBox = dialogWindow.get_content_area()
    buffer1 = Gtk.TextBuffer()
    buffer1.set_text(fmd._ffmpeg_output)
    text_view = Gtk.TextView(buffer=buffer1)
    text_view.set_editable(False)
    scrolled_window = Gtk.ScrolledWindow()
    scrolled_window.set_border_width(5)
    # we scroll only if needed
    scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
    scrolled_window.add(text_view)
    dialogBox.pack_end(scrolled_window, True, True, 0)

    dialogWindow.show_all()
    response = dialogWindow.run()
    dialogWindow.destroy() 
开发者ID:keredson,项目名称:gnomecast,代码行数:54,代码来源:gnomecast.py

示例4: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import LinkButton [as 别名]
def __init__(self, parent):
		Dialog.__init__(self, parent,
			_('Templates'), help='Help:Templates', buttons=Gtk.ButtonsType.CLOSE,
			defaultwindowsize=(400, 450))
			# T: Dialog title

		label = Gtk.Label()
		label.set_markup('<b>' + _('Templates') + '</b>')
			# T: Section in dialog
		label.set_alignment(0.0, 0.5)
		self.vbox.pack_start(label, False, True, 0)

		hbox = Gtk.HBox()
		self.vbox.pack_start(hbox, True, True, 0)

		self.view = TemplateListView()
		self.view.connect('row-activated', self.on_selection_changed)
		hbox.pack_start(ScrolledWindow(self.view), True, True, 0)

		vbbox = Gtk.VButtonBox()
		vbbox.set_layout(Gtk.ButtonBoxStyle.START)
		hbox.pack_start(vbbox, False, True, 0)

		view_button = Gtk.Button.new_with_mnemonic(_('_View')) # T: button label
		view_button.connect('clicked', self.on_view)

		copy_button = Gtk.Button.new_with_mnemonic(_('_Copy')) # T: Button label
		copy_button.connect('clicked', self.on_copy)

		edit_button = Gtk.Button.new_with_mnemonic(_('_Edit')) # T: Button label
		edit_button.connect('clicked', self.on_edit)

		delete_button = Gtk.Button.new_with_mnemonic(_('_Remove')) # T: Button label
		delete_button.connect('clicked', self.on_delete)

		for b in (view_button, copy_button, edit_button, delete_button):
			b.set_alignment(0.0, 0.5)
			vbbox.add(b)

		browse_button = Gtk.Button.new_with_mnemonic(_('Browse')) # T: button label
		browse_button.connect('clicked', self.on_browse)
		self.add_extra_button(browse_button)

		self._buttonbox = vbbox
		self._delete_button = delete_button
		self.on_selection_changed()

		## Same button appears in export dialog
		url_button = Gtk.LinkButton(
			'https://zim-wiki.org/more_templates.html',
			_('Get more templates online') # T: label for button with URL
		)
		self.vbox.pack_start(url_button, False, True, 0) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:55,代码来源:templateeditordialog.py


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