class AboutDialog(object): def __init__(self, parent, backend): self.backend = backend self.dialog = GtkAboutDialog() self.dialog.set_transient_for(parent) self.dialog.set_modal(True) self.dialog.set_name(_("Subscription Manager")) self.dialog.set_license(LICENSE) self.dialog.set_wrap_license(True) if not get_running_as_firstboot(): self.dialog.set_website("https://fedorahosted.org/subscription-manager/") self.dialog.set_copyright(_("Copyright (c) 2012 Red Hat, Inc.")) self.dialog.set_logo_icon_name("subscription-manager") self.dialog.set_icon_name("subscription-manager") next_update_label = Label() rhsm_version_label = Label() backend_version_label = Label() context_box = self.dialog.vbox.get_children()[0] context_box.pack_end(next_update_label) context_box.pack_end(rhsm_version_label) context_box.pack_end(backend_version_label) self._set_next_update(next_update_label) # Set the component versions. server_versions = get_server_versions(self.backend.cp_provider.get_consumer_auth_cp()) client_versions = get_client_versions() self.dialog.set_version(client_versions['subscription-manager']) rhsm_version_label.set_markup(_("<b>python-rhsm version:</b> %s") % client_versions['python-rhsm']) backend_version_label.set_markup(_("<b>subscription management service version:</b> %s") % server_versions['candlepin']) self.dialog.connect("response", self._handle_response) self.dialog.show_all() def show(self): self.dialog.show() def _handle_response(self, dialog, response): if response == RESPONSE_DELETE_EVENT or response == RESPONSE_CANCEL: self.dialog.destroy() def _set_next_update(self, next_update_label): try: next_update = long(file(UPDATE_FILE).read()) except Exception: next_update = None if next_update: update_time = datetime.datetime.fromtimestamp(next_update) next_update_label.set_markup(_('<b>Next System Check-in:</b> %s') % update_time.strftime("%c")) next_update_label.show() else: next_update_label.hide()
def on_about_activate(self, *args): """Displays the Help > About dialog.""" bo_keep_logo_path = get_bo_keep_logo() ab = AboutDialog() ab.set_transient_for(self.mainwindow) ab.set_modal(True) ab.set_name("Bo-Keep") ab.set_version("1.2.1") ab.set_copyright("ParIT Worker Co-operative, Ltd. 2006-2012") ab.set_comments( """Bo-Keep helps you keep your books so you don't get lost. Developed with grant funding from: - Assiniboine Credit Union <http://assiniboine.mb.ca> - Legal Aid Manitoba <http://www.legalaid.mb.ca> """) ab.set_license( """Bo-Keep 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/>. """) ab.set_authors(("Mark Jenkins <*****@*****.**>", "Jamie Campbell <*****@*****.**>", "Samuel Pauls <*****@*****.**>", "Andrew Orr <*****@*****.**>", "Sara Arenson <*****@*****.**>",)) ab.set_artists(("David Henry <*****@*****.**>",)) ab.set_program_name("Bo-Keep") ab.set_logo( pixbuf_new_from_file_at_size( bo_keep_logo_path, 300, 266) ) ab.run() ab.destroy()
def show_about_dialog(*ignored, **kwds): """ create an about dialog and show it """ # Use only one instance, stored in _about_dialog global _about_dialog if _about_dialog: ab = _about_dialog else: ab = AboutDialog() ab.set_program_name(version.package_name) ab.set_version(version.version) ab.set_copyright(version.copyright_info) ab.set_license(license_text) ab.set_authors(authors) ab.connect("response", _response_callback) # do not delete window on close ab.connect("delete-event", lambda *ign: True) _about_dialog = ab ab.present()
class AboutDialog(object): def __init__(self, parent, backend): self.backend = backend self.dialog = GtkAboutDialog() self.dialog.set_transient_for(parent) self.dialog.set_modal(True) self.dialog.set_name(_("Subscription Manager")) self.dialog.set_license(LICENSE) self.dialog.set_wrap_license(True) self.dialog.set_website("https://fedorahosted.org/subscription-manager/") self.dialog.set_copyright(_("Copyright (c) 2012 Red Hat, Inc.")) self.dialog.set_logo(gdk.pixbuf_new_from_file_at_size(LOGO_PATH, 100, 100)) rhsm_version_label = Label() backend_version_label = Label() context_box = self.dialog.vbox.get_children()[0] context_box.pack_end(rhsm_version_label) context_box.pack_end(backend_version_label) # Set the component versions. server_versions = get_server_versions(self.backend.uep) client_versions = get_client_versions() self.dialog.set_version(client_versions['subscription-manager']) rhsm_version_label.set_markup(_("<b>python-rhsm version:</b> %s" % \ client_versions['python-rhsm'])) backend_version_label.set_markup(_("<b>subscription management service version:</b> %s" % \ server_versions['candlepin'])) self.dialog.connect("response", self._handle_response) self.dialog.show_all() def show(self): self.dialog.show() def _handle_response(self, dialog, response): if response == RESPONSE_DELETE_EVENT or response == RESPONSE_CANCEL: self.dialog.destroy()
class AboutDialog(object): def __init__(self, parent, backend): self.backend = backend self.dialog = GtkAboutDialog() self.dialog.set_transient_for(parent) self.dialog.set_modal(True) self.dialog.set_name(_("Subscription Manager")) self.dialog.set_license(LICENSE) self.dialog.set_wrap_license(True) if not get_running_as_firstboot(): self.dialog.set_website( "https://fedorahosted.org/subscription-manager/") self.dialog.set_copyright(_("Copyright (c) 2012 Red Hat, Inc.")) self.dialog.set_logo_icon_name("subscription-manager") self.dialog.set_icon_name("subscription-manager") next_update_label = Label() rhsm_version_label = Label() backend_version_label = Label() context_box = self.dialog.vbox.get_children()[0] context_box.pack_end(next_update_label) context_box.pack_end(rhsm_version_label) context_box.pack_end(backend_version_label) self._set_next_update(next_update_label) # Set the component versions. server_versions = get_server_versions( self.backend.cp_provider.get_consumer_auth_cp()) client_versions = get_client_versions() self.dialog.set_version(client_versions['subscription-manager']) rhsm_version_label.set_markup( _("<b>%s version:</b> %s") % ("python-rhsm", client_versions['python-rhsm'])) backend_version_label.set_markup( _("<b>subscription management service version:</b> %s") % server_versions['candlepin']) self.dialog.connect("response", self._handle_response) self.dialog.show_all() def show(self): self.dialog.show() def _handle_response(self, dialog, response): if response == RESPONSE_DELETE_EVENT or response == RESPONSE_CANCEL: self.dialog.destroy() def _set_next_update(self, next_update_label): try: if self._rhsmcertd_on(): next_update = long(file(UPDATE_FILE).read()) else: next_update = None except Exception: next_update = None if next_update: update_time = datetime.datetime.fromtimestamp(next_update) next_update_label.set_markup( _('<b>Next System Check-in:</b> %s') % update_time.strftime("%c")) next_update_label.show() else: next_update_label.hide() def _rhsmcertd_on(self): try: # if exists [method call returns pid] then true return bool(subprocess.check_output(['pidof', 'rhsmcertd'])) except subprocess.CalledProcessError: # if does not exist, returns CalledProcessError return False