本文整理汇总了Python中GuiBasic.open_url方法的典型用法代码示例。如果您正苦于以下问题:Python GuiBasic.open_url方法的具体用法?Python GuiBasic.open_url怎么用?Python GuiBasic.open_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiBasic
的用法示例。
在下文中一共展示了GuiBasic.open_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_menubar
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import open_url [as 别名]
def create_menubar(self):
"""Create the menu bar (file, help)"""
# Create a UIManager instance
uimanager = gtk.UIManager()
# Add the accelerator group to the top level window
accelgroup = uimanager.get_accel_group()
self.window.add_accel_group(accelgroup)
# Create an ActionGroup
actiongroup = gtk.ActionGroup('UIManagerExample')
self.actiongroup = actiongroup
# Create actions
entries = (
('ShredFiles', None, _('_Shred Files'),
None, None, self.cb_shred_file),
('ShredFolders', None, _('Sh_red Folders'),
None, None, self.cb_shred_file),
('WipeFreeSpace', None, _('_Wipe Free Space'),
None, None, self.cb_wipe_free_space),
('ShredQuit', None, _('S_hred Settings and Quit'),
None, None, self.cb_shred_quit),
('Quit', gtk.STOCK_QUIT, _('_Quit'), None,
None, lambda *dummy: gtk.main_quit()),
('File', None, _('_File')),
('Preferences', gtk.STOCK_PREFERENCES, _(
"Preferences"), None, None, self.cb_preferences_dialog),
('Edit', None, _("_Edit")),
('HelpContents', gtk.STOCK_HELP, _('Help Contents'), 'F1', None,
lambda link: GuiBasic.open_url(
help_contents_url, self.window)),
('ReleaseNotes', gtk.STOCK_INFO, _('_Release Notes'), None, None,
lambda link: GuiBasic.open_url(
release_notes_url, self.window)),
('SystemInformation', None, _('_System Information'), None,
None, lambda foo: self.diagnostic_dialog(self.window)),
('About', gtk.STOCK_ABOUT, _(
'_About'), None, None, self.about),
('Help', None, _("_Help")))
actiongroup.add_actions(entries)
actiongroup.get_action('Quit').set_property('short-label', '_Quit')
# Add the actiongroup to the uimanager
uimanager.insert_action_group(actiongroup, 0)
# Add a UI description
uimanager.add_ui_from_string(self.ui)
# Create a MenuBar
menubar = uimanager.get_widget('/MenuBar')
return menubar
示例2: about
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import open_url [as 别名]
def about(self, __event):
"""Create and show the about dialog"""
if 'nt' != os.name and (2, 16, 6) != gtk.gtk_version:
# workaround for broken GTK+
# (https://bugs.launchpad.net/bleachbit/+bug/797012)
gtk.about_dialog_set_url_hook(lambda dialog,
link: GuiBasic.open_url(link, self.window, False))
dialog = gtk.AboutDialog()
dialog.set_comments(_("Program to clean unnecessary files"))
dialog.set_copyright("Copyright (C) 2014 Andrew Ziem")
try:
dialog.set_license(open(license_filename).read())
except:
dialog.set_license(
_("GNU General Public License version 3 or later.\nSee http://www.gnu.org/licenses/gpl-3.0.txt"))
dialog.set_name(APP_NAME)
# TRANSLATORS: Maintain the names of translators here.
# Launchpad does this automatically for translations
# typed in Launchpad. This is a special string shown
# in the 'About' box.
dialog.set_translator_credits(_("translator-credits"))
dialog.set_version(APP_VERSION)
dialog.set_website(APP_URL)
dialog.set_transient_for(self.window)
if appicon_path and os.path.exists(appicon_path):
icon = gtk.gdk.pixbuf_new_from_file(appicon_path)
dialog.set_logo(icon)
dialog.run()
dialog.hide()
示例3: create_menubar
# 需要导入模块: import GuiBasic [as 别名]
# 或者: from GuiBasic import open_url [as 别名]
def create_menubar(self):
"""Create the menu bar (file, help)"""
# Create a UIManager instance
uimanager = gtk.UIManager()
# Add the accelerator group to the top level window
accelgroup = uimanager.get_accel_group()
self.window.add_accel_group(accelgroup)
# Create an ActionGroup
actiongroup = gtk.ActionGroup("UIManagerExample")
self.actiongroup = actiongroup
# Create actions
entries = (
("ShredFiles", None, _("_Shred Files"), None, None, self.cb_shred_file),
("ShredFolders", None, _("Sh_red Folders"), None, None, self.cb_shred_file),
("WipeFreeSpace", None, _("_Wipe Free Space"), None, None, self.cb_wipe_free_space),
("ShredQuit", None, _("S_hred Settings and Quit"), None, None, self.cb_shred_quit),
("Quit", gtk.STOCK_QUIT, _("_Quit"), None, None, lambda *dummy: gtk.main_quit()),
("File", None, _("_File")),
("Preferences", gtk.STOCK_PREFERENCES, _("Preferences"), None, None, self.cb_preferences_dialog),
("Edit", None, _("_Edit")),
(
"HelpContents",
gtk.STOCK_HELP,
_("Help Contents"),
"F1",
None,
lambda link: GuiBasic.open_url(help_contents_url, self.window),
),
(
"ReleaseNotes",
gtk.STOCK_INFO,
_("_Release Notes"),
None,
None,
lambda link: GuiBasic.open_url(release_notes_url, self.window),
),
(
"SystemInformation",
None,
_("_System Information"),
None,
None,
lambda foo: self.diagnostic_dialog(self.window),
),
("About", gtk.STOCK_ABOUT, _("_About"), None, None, self.about),
("Help", None, _("_Help")),
)
actiongroup.add_actions(entries)
actiongroup.get_action("Quit").set_property("short-label", "_Quit")
# Add the actiongroup to the uimanager
uimanager.insert_action_group(actiongroup, 0)
# Add a UI description
uimanager.add_ui_from_string(self.ui)
# Create a MenuBar
menubar = uimanager.get_widget("/MenuBar")
return menubar