我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用gi.repository.Gtk.AboutDialog()。
def __init__(self, parent): Gtk.AboutDialog.__init__(self, parent=parent) self.set_program_name('PyFlowChart') self.set_version('0.9.3.1') self.set_comments('A program to create interactive cirriculum flowcharts') self.set_logo_icon_name('applications-accessories') self.set_copyright('© 2016 Jim Heald') self.set_license_type(Gtk.License.BSD) self.set_authors(['Jim Heald https://github.com/steelcowboy']) self.connect('response', self.hide_dialog) self.connect('delete-event', self.hide_dialog)
def fix_dialog(self, dialog, text): if text: dialog.set_markup(text) dialog.set_modal(True) headerbar = dialog.get_header_bar() if headerbar: # This is a temporary fix for the duplicate buttons bug # in 'Gtk.AboutDialog' when 'use_header_bar' property is set. if type(dialog) == Gtk.AboutDialog: for i in headerbar: if type(i) != Gtk.StackSwitcher: i.destroy() box = dialog.get_content_area() box.set_border_width(10)
def about(self, window, logo, ver): dialog = Gtk.AboutDialog(self, use_header_bar=True) dialog.set_program_name(browser_name) dialog.set_version("{} (WebKit {})".format(version, ver)) dialog.set_logo(logo) dialog.set_authors([authors]) dialog.set_translator_credits(translators) dialog.set_website(website) dialog.set_website_label(website) dialog.set_comments(comments) dialog.set_license_type(Gtk.License.GPL_3_0) dialog.set_transient_for(window) self.fix_dialog(dialog, None) dialog.run() dialog.destroy()
def on_about(*args): # *args: was menuitem '''Builds and shows the about dialog.''' config = get_config() with open(config.program_dir + '/data/credits.json') as f: credits = json.loads(f.read()) about = Gtk.AboutDialog() about.set_program_name("Sleep Inhibitor") about.set_version(config.version) about.set_comments("Prevent your computer from going to sleep.") #about.set_website("http://www.learngtk.org/") #about.set_website_label("LearnGTK Website") about.set_authors(credits['authors']) about.set_artists(credits['artists']) about.set_copyright('\n'.join(['© {} by {}'.format(i['years'], i['name']) for i in credits['copyright']])) about.set_license_type(Gtk.License.GPL_3_0) about.run() about.destroy()
def __init__(self): #a Gtk.AboutDialog self.aboutdialog = Gtk.AboutDialog() # lists of authors and documenters (will be used later) authors = ["Maksudur Rahman Maateen <http://maateen.me/>"] documenters = ["Maksudur Rahman Maateen <http://maateen.me/>"] # we fill in the aboutdialog self.aboutdialog.set_program_name("About Mama") self.aboutdialog.set_version("Version 0.1") self.aboutdialog.set_copyright("Maksudur Rahman Maateen \xa9 2016") self.aboutdialog.set_comments("The aim of this project is to let you " "use Microsoft powered Bing Speech " "Recognition API to control your Linux " "computer. The project is developed in " "Python3. For note, this is a fork of " "project google2ubuntu - <" "https://github.com/benoitfragit/google2ubuntu/>." " Thanks Franquet Benoit for your google2ubuntu.") self.aboutdialog.set_license_type (Gtk.License.GPL_3_0,) self.aboutdialog.set_website("https://maateen.github.io/mama/") self.aboutdialog.set_website_label("https://maateen.github.io/mama/") self.aboutdialog.set_authors(authors) self.aboutdialog.set_documenters(documenters) # Resetting the window title self.aboutdialog.set_title("About Mama") # to close the aboutdialog when "close" is clicked we connect the # "response" signal to on_close self.aboutdialog.connect("response", self.on_close) # show the aboutdialog self.aboutdialog.show() # destroy the aboutdialog
def get_about_dialog(self): """Create and populate the about dialog.""" about_dialog = Gtk.AboutDialog() about_dialog.set_name(comun.APPNAME) about_dialog.set_version(comun.VERSION) about_dialog.set_copyright( 'Copyrignt (c) 2014-2016\nLorenzo Carbonell Cerezo') about_dialog.set_comments(_('An indicator for Pomodoro Technique')) about_dialog.set_license(''' This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''') about_dialog.set_website('http://www.atareao.es') about_dialog.set_website_label('http://www.atareao.es') about_dialog.set_authors([ 'Lorenzo Carbonell <https://launchpad.net/~lorenzo-carbonell>']) about_dialog.set_documenters([ 'Lorenzo Carbonell <https://launchpad.net/~lorenzo-carbonell>']) about_dialog.set_translator_credits(''' Lorenzo Carbonell <https://launchpad.net/~lorenzo-carbonell>\n ''') about_dialog.set_icon(GdkPixbuf.Pixbuf.new_from_file(comun.ICON)) about_dialog.set_logo(GdkPixbuf.Pixbuf.new_from_file(comun.ICON)) about_dialog.set_program_name(comun.APPNAME) return about_dialog # ##################### callbacks for the menu #######################
def about_box(self, widget): about = Gtk.AboutDialog(parent=self.window) # # set_program_name method is available in PyGTK 2.12 and above # try: about.set_program_name(NAME) except AttributeError: pass about.set_version(VERSION) about.set_copyright("Copyright \u00A9 2010-2016 John Cheetham") about.set_comments( "jcchess is a program to play chess.") about.set_authors(["John Cheetham"]) about.set_website( "http://www.johncheetham.com/projects/jcchess/index.html") about.set_logo( GdkPixbuf.Pixbuf.new_from_file( os.path.join(gv.jcchess.prefix, "images/logo.png"))) license = """jcchess is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. jcchess is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with jcchess. If not, see <http://www.gnu.org/licenses/>.""" about.set_license(license) about.run() about.destroy()
def on_about(self, action, param): about_dialog = Gtk.AboutDialog(transient_for=self.window, modal=True) about_dialog.run() about_dialog.destroy() # noinspection PyUnusedLocal
def show_about_window(self, widget): pixbuf = self.render_icon('solfege-icon', Gtk.IconSize.DIALOG) a = self.g_about_window = Gtk.AboutDialog() a.set_program_name("GNU Solfege") a.set_logo(pixbuf) a.set_website("http://www.solfege.org") a.set_version(buildinfo.VERSION_STRING) a.set_copyright("Copyright (C) 2013 Tom Cato Amundsen and others") a.set_license("\n".join((solfege.application.solfege_copyright, solfege.application.warranty))) # Using set_license_type causes the app to print warnings. #a.set_license_type(Gtk.License.GPL_3_0) a.set_authors(["Tom Cato Amundsen", 'Giovanni Chierico %s' % _("(some lessonfiles)"), 'Michael Becker %s' % _("(some lessonfiles)"), 'Joe Lee %s' % _("(sound code for the MS Windows port)"), 'Steve Lee %s' % _("(ported winmidi.c to gcc)"), 'Thibaus Cousin %s' % _("(spec file for SuSE 8.2)"), 'David Coe %s' %_("(spec file cleanup)"), 'David Petrou %s' % _("(testing and portability fixes for FreeBSD)"), 'Han-Wen Nienhuys %s' % _("(the music font from Lilypond)"), 'Jan Nieuwenhuizen %s' % _("(the music font from Lilypond)"), 'Davide Bonetti %s' % _("(scale exercises)"), ]) a.set_documenters(["Tom Cato Amundsen", "Tom Eykens", ]) if _("SOLFEGETRANSLATORS") == 'SOLFEGETRANSLATORS': a.set_translator_credits(None) else: a.set_translator_credits(_("SOLFEGETRANSLATORS")) self.g_about_window.run() self.g_about_window.destroy()
def on_about_action_activated(self, action, params): dialog = Gtk.AboutDialog() dialog.set_modal(True) dialog.set_transient_for(self.window) dialog.set_program_name(Config.APPNAME) dialog.set_logo_icon_name(Config.NAME) dialog.set_version(Config.VERSION) dialog.set_comments(Config.DESCRIPTION) dialog.set_copyright(Config.COPYRIGHT) dialog.set_website(Config.HOMEPAGE) dialog.set_license_type(Gtk.License.GPL_3_0) dialog.set_authors(Config.AUTHORS) dialog.run() dialog.destroy()
def get_about_dialog(self): """Create and populate the about dialog.""" about_dialog = Gtk.AboutDialog() about_dialog.set_name(comun.APPNAME) about_dialog.set_version(comun.VERSION) about_dialog.set_copyright( 'Copyrignt (c) 2016\nLorenzo Carbonell Cerezo') about_dialog.set_comments(_('An indicator to set backlight')) about_dialog.set_license(''' This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''') about_dialog.set_website('http://www.atareao.es') about_dialog.set_website_label('http://www.atareao.es') about_dialog.set_authors([ 'Lorenzo Carbonell <https://launchpad.net/~lorenzo-carbonell>']) about_dialog.set_documenters([ 'Lorenzo Carbonell <https://launchpad.net/~lorenzo-carbonell>']) about_dialog.set_translator_credits(''' Lorenzo Carbonell <https://launchpad.net/~lorenzo-carbonell>\n ''') about_dialog.set_icon(GdkPixbuf.Pixbuf.new_from_file(comun.ICON)) about_dialog.set_logo(GdkPixbuf.Pixbuf.new_from_file(comun.ICON)) about_dialog.set_program_name(comun.APPNAME) return about_dialog # ##################### callbacks for the menu #######################
def about_window(self, source): dialog = gtk.AboutDialog() dialog.set_program_name('Cryptocoin Price Indicator') dialog.set_version('1.0.2') dialog.set_copyright('Copyright 2017 Michel Michels') dialog.set_license('MIT License\nCopyright (c) 2017 Michel Michels\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.') dialog.set_wrap_license(True) dialog.set_comments('This application is written in Python 3.5.3 and currently tested on systems using the Unity shell.') dialog.set_website('https://github.com/MichelMichels/cryptocoin-indicator') dialog.run() dialog.destroy()
def on_about(self, action=None, param=None): print("About button pressed") about_dialog = Gtk.AboutDialog(transient_for=self._window, modal=True) about_dialog.present()
def menu_item_clicked(self, widget): """Callback for help menu items""" if widget == self.tool_widgets.get_object('get_help_menu_item'): # run yelp proc = subprocess.Popen(["yelp", "ghelp:dell-recovery"]) # collect the exit status (otherwise we leave zombies) GLib.timeout_add_seconds(1, lambda proc: proc.poll() == None, proc) elif widget == self.tool_widgets.get_object('about_menu_item'): tool_selector = self.tool_widgets.get_object('tool_selector') if not self.about_box: self.about_box = Gtk.AboutDialog() self.about_box.set_version(check_version()) self.about_box.set_name(_("Dell Recovery")) self.about_box.set_copyright(_("Copyright 2008-2012 Dell Inc.")) self.about_box.set_website("http://www.dell.com/ubuntu") self.about_box.set_authors(["Mario Limonciello"]) self.about_box.set_destroy_with_transient_for(True) self.about_box.set_modal(True) self.about_box.set_transient_for(tool_selector) tool_selector.set_sensitive(False) self.about_box.run() self.about_box.hide() tool_selector.set_sensitive(True) #### GUI Functions ### # This application is functional via command line by using the above functions #
def on_about(self, action, param): about_dialog = Gtk.AboutDialog(transient_for=self.window, modal=True) about_dialog.present()
def show_about_dialog(self, widget): about_dialog = gtk.AboutDialog() about_dialog.set_destroy_with_parent(True) about_dialog.set_icon_name("SystrayIcon") about_dialog.set_name('SystrayIcon') about_dialog.run() about_dialog.destroy()
def __init__(self): Gtk.AboutDialog.__init__(self) self.connect('response', lambda w, r: self.destroy()) self.set_modal(True) self.set_title(_('About {app_name}').format( app_name=version.APP_NAME )) self.set_program_name(version.APP_NAME) self.set_copyright(_('Copyright \xa9 2015 {author}.').format( author=version.AUTHOR )) self.set_website(version.APP_URL) self.set_website_label(_('Homepage')) self.set_license_type(Gtk.License.GPL_3_0) authors = [ '{author} <{author_email}>'.format( author=version.AUTHOR, author_email=version.AUTHOR_EMAIL ) ] self.set_authors(authors) self.set_version(str(version.APP_VERSION)) logo_pixbuf = GdkPixbuf.Pixbuf.new_from_file(common.ICON_PATH) self.set_logo(logo_pixbuf)
def showAboutDialog( self, action, userdata = None ): about = Gtk.AboutDialog() about.set_name("Ukui Menu") about.set_version(__VERSION__) about.set_comments( _("Startup Menu") ) about.set_logo( GdkPixbuf.Pixbuf.new_from_file("/usr/share/ukui-menu/icons/ukui-logo.svg") ) about.connect( "response", lambda dialog, r: dialog.destroy() ) about.show()
def on_menuitem_help_about_activated(self, menuitem): dlg = Gtk.AboutDialog() dlg.set_program_name(_("PIA Manager")) dlg.set_icon_name("pia-manager") dlg.set_transient_for(self.window) dlg.set_logo_icon_name("pia-manager") dlg.set_website("http://www.github.com/linuxmint/pia-manager") try: for path in ["/usr/share/common-licenses/GPL-3"]: if os.path.exists(path): h = open(path, 'r') s = h.readlines() gpl = "" for line in s: gpl += line h.close() dlg.set_license(gpl) except Exception as e: print (e) print(sys.exc_info()[0]) if os.path.exists("/usr/lib/linuxmint/common/version.py"): version = subprocess.getoutput("/usr/lib/linuxmint/common/version.py pia-manager") dlg.set_version(version) def close(w, res): if res == Gtk.ResponseType.CANCEL or res == Gtk.ResponseType.DELETE_EVENT: w.hide() dlg.connect("response", close) dlg.show()
def __on_app_about(self, action, param): dialog = Gtk.AboutDialog(transient_for=self.window, program_name=u"Revolt", authors=APP_AUTHORS, logo_icon_name="revolt-about", license_type=Gtk.License.GPL_3_0, comments=APP_COMMENTS, website=APP_WEBSITE) dialog.connect("response", lambda d, r: d.destroy()) dialog.present()
def on_about(self, action, param): logo = load_image('sense_emu_gui.svg', format='svg') about_dialog = Gtk.AboutDialog( transient_for=self.window, authors=['%s <%s>' % (__author__, __author_email__)], license_type=Gtk.License.GPL_2_0, logo=logo, version=__version__, website=__url__) about_dialog.run() about_dialog.destroy()
def showAboutDialog( self, action, userdata = None ): about = Gtk.AboutDialog() about.set_name("MATE Menu") about.set_version(__VERSION__) about.set_comments( _("Advanced MATE Menu") ) about.set_logo( GdkPixbuf.Pixbuf.new_from_file("/usr/share/mate-menu/icons/mate-logo.svg") ) about.connect( "response", lambda dialog, r: dialog.destroy() ) about.show()
def show_dialog(self): """ Displays app about dialog """ # TODO: Migrate to custom About application dialog designed in line with elementary OS Human Interface Guidelines about_dialog = Gtk.AboutDialog() about_dialog.set_position(Gtk.WindowPosition.CENTER) software_license = _(''' This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''') authors = [_("Micha? Daniel (developer, maintainer)"), _("Nguy?n Ng?c Thanh Hà (contributor)"), _("Jens Persson (contributor)")] # Thank you for the beautiful icon. artists = [_("Christian da Silva (www.christianda.com)")] logo_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( '/usr/share/easy-ebook-viewer/misc/easy-ebook-viewer-scalable.svg', 128, 128) about_dialog.set_logo(logo_pixbuf) about_dialog.set_program_name(_("Easy eBook Viewer")) about_dialog.set_version("1.0") about_dialog.set_authors(authors) about_dialog.set_website("https://github.com/michaldaniel/Ebook-Viewer") about_dialog.set_website_label(_("Browse code at Github")) about_dialog.set_artists(artists) _("[DON'T TRANSLATE] Replace name in \"Anonymous Translator ([replace] translation)\" with YOUR name and translation language!\n\nPS. python gettext makes it impossible to leave comments, I hope this works.") translator = _("Anonymous Translator ([replace] translation)") if translator != "Anonymous Translator ([replace] translation)": about_dialog.set_translator_credits(translator) about_dialog.set_license(software_license) about_dialog.set_comments( _("Easy eBook Viewer is a simple and moder ePub files reader written in Python using GTK3 and WebKit.")) about_dialog.set_title(_("About Easy eBook Viewer")) about_dialog.show_all() about_dialog.run() about_dialog.destroy()