示例#1
0
 def create_status_icon(self):
         icon_theme = gtk.IconTheme()
         icon_theme.append_search_path(ICON_LOCATION)
         icon = gui_misc.get_icon(icon_theme, NOTIFY_ICON_NAME, 24)
         status_icon = gtk.status_icon_new_from_pixbuf(icon)
         status_icon.set_visible(False)
         status_icon.connect('activate', self.activate_status_icon)
         status_icon.connect('notify', self.notify_status_icon)
         return status_icon
示例#2
0
 def create_status_icon(self):
         icon_theme = gtk.IconTheme()
         icon_theme.append_search_path(ICON_LOCATION)
         icon = gui_misc.get_icon(icon_theme, NOTIFY_ICON_NAME, 24)
         status_icon = gtk.status_icon_new_from_pixbuf(icon)
         status_icon.set_visible(False)
         status_icon.connect('activate', self.activate_status_icon)
         status_icon.connect('notify', self.notify_status_icon)
         return status_icon
示例#3
0
 def __do_image_update(self):
         self.installupdate = installupdate.InstallUpdate([], self,
             self.image_dir_arg, action = enumerations.IMAGE_UPDATE,
             parent_name = _("Update Manager"),
             pkg_list = [gui_misc.package_name["SUNWipkg"],
                 gui_misc.package_name["SUNWipkg-gui"],
                 gui_misc.package_name["SUNWipkg-um"]],
             main_window = None,
             icon_confirm_dialog = gui_misc.get_icon(self.icon_theme,
             "updatemanager", 36),
             show_confirmation = self.gconf.show_image_update,
             api_lock = self.api_lock, gconf = self.gconf)
示例#4
0
 def __do_image_update(self):
     self.installupdate = installupdate.InstallUpdate(
         [],
         self,
         self.image_dir_arg,
         action=enumerations.IMAGE_UPDATE,
         parent_name=_("Update Manager"),
         pkg_list=[
             gui_misc.package_name["SUNWipkg"],
             gui_misc.package_name["SUNWipkg-gui"],
             gui_misc.package_name["SUNWipkg-um"],
         ],
         main_window=None,
         icon_confirm_dialog=gui_misc.get_icon(self.icon_theme, "updatemanager", 36),
         show_confirmation=self.gconf.show_image_update,
         api_lock=self.api_lock,
         gconf=self.gconf,
     )
示例#5
0
文件: beadmin.py 项目: aszeszo/test
        def __init__(self, parent):
                self.parent = parent

                if not bootenv.BootEnv.libbe_exists():
                        msg = _("The <b>libbe</b> library was not "
                            "found on your system."
                            "\nAll functions for managing Boot Environments are disabled")
                        msgbox = gtk.MessageDialog(
                            buttons = gtk.BUTTONS_CLOSE,
                            flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO,
                            message_format = None)
                        msgbox.set_markup(msg)
                        msgbox.set_title(_("BE management"))
                        msgbox.run()
                        msgbox.destroy()
                        return

                self.be_list = \
                    gtk.ListStore(
                        gobject.TYPE_INT,         # BE_ID
                        gobject.TYPE_BOOLEAN,     # BE_MARKED
                        gobject.TYPE_STRING,      # BE_NAME
                        gobject.TYPE_STRING,      # BE_ORIG_NAME
                        gobject.TYPE_STRING,      # BE_DATE_TIME
                        gtk.gdk.Pixbuf,           # BE_CURRENT_PIXBUF
                        gobject.TYPE_BOOLEAN,     # BE_ACTIVE_DEFAULT
                        gobject.TYPE_STRING,      # BE_SIZE
                        gobject.TYPE_BOOLEAN,     # BE_EDITABLE
                        )
                self.progress_stop_thread = False
                self.initial_active = 0
                self.initial_default = 0
                gladefile = os.path.join(self.parent.application_dir,
                    "usr/share/package-manager/packagemanager.ui")
                builder = gtk.Builder()
                builder.add_from_file(gladefile)
                self.w_beadmin_dialog = builder.get_object("beadmin")
                self.w_beadmin_dialog.set_icon(self.parent.window_icon)
                self.w_be_treeview = builder.get_object("betreeview")
                self.w_help_button = builder.get_object("help_bebutton")
                self.w_cancel_button = builder.get_object("cancelbebutton")
                self.w_ok_button = builder.get_object("okbebutton")
                w_active_gtkimage = builder.get_object("activebeimage")
                self.w_progress_dialog = builder.get_object("progressdialog")
                self.w_progress_dialog.connect('delete-event', lambda stub1, stub2: True)
                self.w_progress_dialog.set_icon(self.parent.window_icon)
                self.w_progressinfo_label = builder.get_object("progressinfo")
                progress_button = builder.get_object("progresscancel")
                self.w_progressbar = builder.get_object("progressbar")
                # Dialog reused in the repository.py
                self.w_beconfirmation_dialog =  \
                    builder.get_object("confirmationdialog")
                self.w_beconfirmation_dialog.set_icon(self.parent.window_icon)
                self.w_beconfirmation_textview = \
                    builder.get_object("confirmtext")
                self.w_okbe_button = builder.get_object("ok_conf")
                self.w_cancelbe_button = builder.get_object("cancel_conf")
                self.w_ok_button.set_sensitive(False)
                progress_button.hide()
                self.w_progressbar.set_pulse_step(0.1)
                self.list_filter = self.be_list.filter_new()
                self.w_be_treeview.set_model(self.list_filter)
                self.__init_tree_views()
                self.active_image = gui_misc.get_icon(
                    self.parent.icon_theme, "status_checkmark")
                w_active_gtkimage.set_from_pixbuf(self.active_image)

                bebuffer = self.w_beconfirmation_textview.get_buffer()
                bebuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)

                self.__setup_signals()
                sel = self.w_be_treeview.get_selection()
                self.w_cancel_button.grab_focus()
                sel.set_mode(gtk.SELECTION_SINGLE)
                self.w_beconfirmation_dialog.set_title(
                    _("Boot Environment Confirmation"))
                gui_misc.set_modal_and_transient(self.w_beadmin_dialog,
                    self.parent.w_main_window)
                self.parent.child = self
                self.w_beadmin_dialog.show_all()
                self.w_progress_dialog.set_title(
                    _("Loading Boot Environment Information"))
                self.w_progressinfo_label.set_text(
                    _("Fetching BE entries..."))
                self.w_progress_dialog.show()
                Thread(target = self.__progress_pulse).start()
                Thread(target = self.__prepare_beadmin_list).start()
示例#6
0
        def __init__(self, image_dir):
                global_settings.client_name = gui_misc.get_wi_name()
                self.image_dir = image_dir
    
                try:
                        self.application_dir = os.environ["PACKAGE_MANAGER_ROOT"]
                except KeyError:
                        self.application_dir = "/"
                misc.setlocale(locale.LC_ALL, "")
                for module in (gettext, gtk.glade):
                        module.bindtextdomain("pkg", os.path.join(
                            self.application_dir,
                            "usr/share/locale"))
                        module.textdomain("pkg")
                gui_misc.init_for_help(self.application_dir)
                self.pub_pkg_list = None
                self.pr = progress.NullProgressTracker()
                self.pub_new_tasks = []
                self.pkg_install_tasks = []
                self.icon_theme = gtk.icon_theme_get_default()
                icon_location = os.path.join(self.application_dir, ICON_LOCATION)
                self.icon_theme.append_search_path(icon_location)
                self.param = None
                self.disabled_pubs = {}
                self.repo_gui = None
                self.first_run = True

                # Webinstall Dialog
                builder = gtk.Builder()
                self.gladefile = os.path.join(self.application_dir,
                        "usr/share/package-manager/packagemanager.ui")
                builder.add_from_file(self.gladefile)
                self.w_webinstall_dialog = \
                        builder.get_object("webinstalldialog")
                
                self.w_webinstall_proceed = \
                        builder.get_object("proceed_button")
                self.w_webinstall_cancel = \
                        builder.get_object("cancel_button")
                self.w_webinstall_help = \
                        builder.get_object("help_button")
                self.w_webinstall_close = \
                        builder.get_object("close_button")
                self.w_webinstall_proceed_label = \
                        builder.get_object("proceed_new_repo_label")
                self.w_webinstall_toplabel = \
                        builder.get_object("webinstall_toplabel")
                self.w_webinstall_frame = \
                        builder.get_object("webinstall_frame")
                self.w_webinstall_image = \
                        builder.get_object("pkgimage")
                self.window_icon = gui_misc.get_icon(self.icon_theme, 
                    'packagemanager', 48)
                self.w_webinstall_image.set_from_pixbuf(self.window_icon)
                self.w_webinstall_info_label = \
                        builder.get_object("label19")

                self.w_webinstall_textview = \
                        builder.get_object("webinstall_textview")  
                infobuffer = self.w_webinstall_textview.get_buffer()
                infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)
                infobuffer.create_tag("disabled", foreground="#757575") #Close to DimGrey

                self.__setup_signals()
 
                self.w_webinstall_dialog.set_icon(self.window_icon)
                self.api_o = gui_misc.get_api_object(self.image_dir, self.pr,
                    self.w_webinstall_dialog)
                gui_misc.setup_logging()
示例#7
0
    def __init__(self, parent):
        self.parent = parent

        if not bootenv.BootEnv.libbe_exists():
            msg = _(
                "The <b>libbe</b> library was not "
                "found on your system."
                "\nAll functions for managing Boot Environments are disabled")
            msgbox = gtk.MessageDialog(buttons=gtk.BUTTONS_CLOSE,
                                       flags=gtk.DIALOG_MODAL,
                                       type=gtk.MESSAGE_INFO,
                                       message_format=None)
            msgbox.set_markup(msg)
            msgbox.set_title(_("BE management"))
            msgbox.run()
            msgbox.destroy()
            return

        self.be_list = \
            gtk.ListStore(
                gobject.TYPE_INT,         # BE_ID
                gobject.TYPE_BOOLEAN,     # BE_MARKED
                gobject.TYPE_STRING,      # BE_NAME
                gobject.TYPE_STRING,      # BE_ORIG_NAME
                gobject.TYPE_STRING,      # BE_DATE_TIME
                gtk.gdk.Pixbuf,           # BE_CURRENT_PIXBUF
                gobject.TYPE_BOOLEAN,     # BE_ACTIVE_DEFAULT
                gobject.TYPE_STRING,      # BE_SIZE
                gobject.TYPE_BOOLEAN,     # BE_EDITABLE
                )
        self.progress_stop_thread = False
        self.initial_active = 0
        self.initial_default = 0
        gladefile = os.path.join(
            self.parent.application_dir,
            "usr/share/package-manager/packagemanager.ui")
        builder = gtk.Builder()
        builder.add_from_file(gladefile)
        self.w_beadmin_dialog = builder.get_object("beadmin")
        self.w_beadmin_dialog.set_icon(self.parent.window_icon)
        self.w_be_treeview = builder.get_object("betreeview")
        self.w_help_button = builder.get_object("help_bebutton")
        self.w_cancel_button = builder.get_object("cancelbebutton")
        self.w_ok_button = builder.get_object("okbebutton")
        w_active_gtkimage = builder.get_object("activebeimage")
        self.w_progress_dialog = builder.get_object("progressdialog")
        self.w_progress_dialog.connect('delete-event',
                                       lambda stub1, stub2: True)
        self.w_progress_dialog.set_icon(self.parent.window_icon)
        self.w_progressinfo_label = builder.get_object("progressinfo")
        progress_button = builder.get_object("progresscancel")
        self.w_progressbar = builder.get_object("progressbar")
        # Dialog reused in the repository.py
        self.w_beconfirmation_dialog =  \
            builder.get_object("confirmationdialog")
        self.w_beconfirmation_dialog.set_icon(self.parent.window_icon)
        self.w_beconfirmation_textview = \
            builder.get_object("confirmtext")
        self.w_okbe_button = builder.get_object("ok_conf")
        self.w_cancelbe_button = builder.get_object("cancel_conf")
        self.w_ok_button.set_sensitive(False)
        progress_button.hide()
        self.w_progressbar.set_pulse_step(0.1)
        self.list_filter = self.be_list.filter_new()
        self.w_be_treeview.set_model(self.list_filter)
        self.__init_tree_views()
        self.active_image = gui_misc.get_icon(self.parent.icon_theme,
                                              "status_checkmark")
        w_active_gtkimage.set_from_pixbuf(self.active_image)

        bebuffer = self.w_beconfirmation_textview.get_buffer()
        bebuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)

        self.__setup_signals()
        sel = self.w_be_treeview.get_selection()
        self.w_cancel_button.grab_focus()
        sel.set_mode(gtk.SELECTION_SINGLE)
        self.w_beconfirmation_dialog.set_title(
            _("Boot Environment Confirmation"))
        gui_misc.set_modal_and_transient(self.w_beadmin_dialog,
                                         self.parent.w_main_window)
        self.parent.child = self
        self.w_beadmin_dialog.show_all()
        self.w_progress_dialog.set_title(
            _("Loading Boot Environment Information"))
        self.w_progressinfo_label.set_text(_("Fetching BE entries..."))
        self.w_progress_dialog.show()
        Thread(target=self.__progress_pulse).start()
        Thread(target=self.__prepare_beadmin_list).start()
示例#8
0
    def __init__(self, image_dir):
        global_settings.client_name = gui_misc.get_wi_name()
        self.image_dir = image_dir

        try:
            self.application_dir = os.environ["PACKAGE_MANAGER_ROOT"]
        except KeyError:
            self.application_dir = "/"
        misc.setlocale(locale.LC_ALL, "")
        for module in (gettext, gtk.glade):
            module.bindtextdomain(
                "pkg", os.path.join(self.application_dir, "usr/share/locale"))
            module.textdomain("pkg")
        gui_misc.init_for_help(self.application_dir)
        self.pub_pkg_list = None
        self.pr = progress.NullProgressTracker()
        self.pub_new_tasks = []
        self.pkg_install_tasks = []
        self.icon_theme = gtk.icon_theme_get_default()
        icon_location = os.path.join(self.application_dir, ICON_LOCATION)
        self.icon_theme.append_search_path(icon_location)
        self.param = None
        self.disabled_pubs = {}
        self.repo_gui = None
        self.first_run = True

        # Webinstall Dialog
        builder = gtk.Builder()
        self.gladefile = os.path.join(
            self.application_dir,
            "usr/share/package-manager/packagemanager.ui")
        builder.add_from_file(self.gladefile)
        self.w_webinstall_dialog = \
                builder.get_object("webinstalldialog")

        self.w_webinstall_proceed = \
                builder.get_object("proceed_button")
        self.w_webinstall_cancel = \
                builder.get_object("cancel_button")
        self.w_webinstall_help = \
                builder.get_object("help_button")
        self.w_webinstall_close = \
                builder.get_object("close_button")
        self.w_webinstall_proceed_label = \
                builder.get_object("proceed_new_repo_label")
        self.w_webinstall_toplabel = \
                builder.get_object("webinstall_toplabel")
        self.w_webinstall_frame = \
                builder.get_object("webinstall_frame")
        self.w_webinstall_image = \
                builder.get_object("pkgimage")
        self.window_icon = gui_misc.get_icon(self.icon_theme, 'packagemanager',
                                             48)
        self.w_webinstall_image.set_from_pixbuf(self.window_icon)
        self.w_webinstall_info_label = \
                builder.get_object("label19")

        self.w_webinstall_textview = \
                builder.get_object("webinstall_textview")
        infobuffer = self.w_webinstall_textview.get_buffer()
        infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)
        infobuffer.create_tag("disabled",
                              foreground="#757575")  #Close to DimGrey

        self.__setup_signals()

        self.w_webinstall_dialog.set_icon(self.window_icon)
        self.api_o = gui_misc.get_api_object(self.image_dir, self.pr,
                                             self.w_webinstall_dialog)
        gui_misc.setup_logging()
示例#9
0
        def __init__(self, parent, dialog_icon, parent_window):
                if not bootenv.BootEnv.libbe_exists():
                        msg = _("The <b>libbe</b> library was not "
                            "found on your system.")
                        msgbox = gtk.MessageDialog(
                            buttons = gtk.BUTTONS_CLOSE,
                            flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO,
                            message_format = None)
                        msgbox.set_markup(msg)
                        msgbox.set_title(_("Rename BE"))
                        msgbox.run()
                        msgbox.destroy()
                        return

                # Before performing update all (image-update) task, we are storing
                # the active on reboot be name. If the be name after update is different
                # it means that new BE was created and we can show BE rename dialog
                # otherwise we can show update completed dialog.
                # Also we need to store original BE name to work-around the bug: 6472202
                self.active_be_before_update_all = self.__get_activated_be_name()

                self.parent = parent
                self.stop_progress_bouncing = False
                self.stopped_bouncing_progress = True
                builder = gtk.Builder()
                gladefile = os.path.join(self.parent.application_dir,
                    "usr/share/package-manager/packagemanager.ui")
                builder.add_from_file(gladefile)

                self.w_ua_completed_dialog = \
                    builder.get_object("ua_completed_dialog")
                self.w_ua_be_entry = \
                    builder.get_object("ua_be_entry")
                self.w_ua_release_notes_button = \
                    builder.get_object("release_notes_button")
                self.w_be_error_label = \
                    builder.get_object("be_error_label")
                self.w_ua_help_button = \
                    builder.get_object("ua_help_button")
                self.w_ua_restart_later_button = \
                    builder.get_object("ua_restart_later_button")
                self.w_ua_restart_now_button = \
                    builder.get_object("ua_restart_now_button")
                self.w_ua_ok_image = \
                    builder.get_object("ua_ok_image")
                self.w_ua_whats_this_button = \
                    builder.get_object("ua_whats_this_button")
                self.w_ua_whats_this_button.set_tooltip_text(_(
                    "A boot environment (BE) contains the operating\n"
                    "system image and updated packages. The\n"
                    "system will boot into the new BE on restart."))

                self.w_progress_dialog = builder.get_object("progressdialog")
                self.w_progressinfo_label = builder.get_object("progressinfo")
                self.w_progress_cancel = builder.get_object("progresscancel")
                self.w_progressbar = builder.get_object("progressbar")
                self.w_progress_dialog.connect('delete-event', lambda stub1, stub2: True)
                self.w_progress_cancel.set_sensitive(False)

                self.w_progress_dialog.set_title(_("Rename BE"))
                self.w_progressinfo_label.set_text(_("Renaming BE, please wait..."))

                self.w_progress_dialog.set_icon(dialog_icon)
                self.w_ua_completed_dialog.set_icon(dialog_icon)

                checkmark_icon = gui_misc.get_icon(
                    self.parent.icon_theme, "pm-check", 24)

                self.w_ua_ok_image.set_from_pixbuf(checkmark_icon)

                gui_misc.set_modal_and_transient(self.w_progress_dialog, parent_window)
                gui_misc.set_modal_and_transient(self.w_ua_completed_dialog,
                    parent_window)

                self.__setup_signals()
示例#10
0
    def __init__(self, parent, dialog_icon, parent_window):
        if not bootenv.BootEnv.libbe_exists():
            msg = _("The <b>libbe</b> library was not "
                    "found on your system.")
            msgbox = gtk.MessageDialog(buttons=gtk.BUTTONS_CLOSE,
                                       flags=gtk.DIALOG_MODAL,
                                       type=gtk.MESSAGE_INFO,
                                       message_format=None)
            msgbox.set_markup(msg)
            msgbox.set_title(_("Rename BE"))
            msgbox.run()
            msgbox.destroy()
            return

        # Before performing update all (image-update) task, we are storing
        # the active on reboot be name. If the be name after update is different
        # it means that new BE was created and we can show BE rename dialog
        # otherwise we can show update completed dialog.
        # Also we need to store original BE name to work-around the bug: 6472202
        self.active_be_before_update_all = self.__get_activated_be_name()

        self.parent = parent
        self.stop_progress_bouncing = False
        self.stopped_bouncing_progress = True
        builder = gtk.Builder()
        gladefile = os.path.join(
            self.parent.application_dir,
            "usr/share/package-manager/packagemanager.ui")
        builder.add_from_file(gladefile)

        self.w_ua_completed_dialog = \
            builder.get_object("ua_completed_dialog")
        self.w_ua_be_entry = \
            builder.get_object("ua_be_entry")
        self.w_ua_release_notes_button = \
            builder.get_object("release_notes_button")
        self.w_be_error_label = \
            builder.get_object("be_error_label")
        self.w_ua_help_button = \
            builder.get_object("ua_help_button")
        self.w_ua_restart_later_button = \
            builder.get_object("ua_restart_later_button")
        self.w_ua_restart_now_button = \
            builder.get_object("ua_restart_now_button")
        self.w_ua_ok_image = \
            builder.get_object("ua_ok_image")
        self.w_ua_whats_this_button = \
            builder.get_object("ua_whats_this_button")
        self.w_ua_whats_this_button.set_tooltip_text(
            _("A boot environment (BE) contains the operating\n"
              "system image and updated packages. The\n"
              "system will boot into the new BE on restart."))

        self.w_progress_dialog = builder.get_object("progressdialog")
        self.w_progressinfo_label = builder.get_object("progressinfo")
        self.w_progress_cancel = builder.get_object("progresscancel")
        self.w_progressbar = builder.get_object("progressbar")
        self.w_progress_dialog.connect('delete-event',
                                       lambda stub1, stub2: True)
        self.w_progress_cancel.set_sensitive(False)

        self.w_progress_dialog.set_title(_("Rename BE"))
        self.w_progressinfo_label.set_text(_("Renaming BE, please wait..."))

        self.w_progress_dialog.set_icon(dialog_icon)
        self.w_ua_completed_dialog.set_icon(dialog_icon)

        checkmark_icon = gui_misc.get_icon(self.parent.icon_theme, "pm-check",
                                           24)

        self.w_ua_ok_image.set_from_pixbuf(checkmark_icon)

        gui_misc.set_modal_and_transient(self.w_progress_dialog, parent_window)
        gui_misc.set_modal_and_transient(self.w_ua_completed_dialog,
                                         parent_window)

        self.__setup_signals()