src/gui/modules/installupdate.py
author Padraig O'Briain <padraig.obriain@sun.com>
Fri, 03 Jul 2009 19:46:45 +0100
changeset 1200 5721206a1878
parent 1191 a48bee2a4b2e
child 1205 13d391387a98
permissions -rw-r--r--
9501 packagemanager traceback on memoryerror
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     1
#!/usr/bin/python2.4
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     2
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     3
# CDDL HEADER START
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     4
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     8
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    12
# and limitations under the License.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    13
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    19
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    20
# CDDL HEADER END
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    21
#
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    22
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    23
# Use is subject to license terms.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    24
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    25
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    26
MIN_IND_ELEMENTS_BOUNCE = 5      # During indexing the progress will be progressive if 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    27
                                 # the number of indexing elements is greater then this, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    28
                                 # otherwise it will bounce
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    29
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
    30
import errno
1186
c793e5d17602 9556 Failure in UpdateManager when there is no space
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
    31
import os
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
    32
import sys
510
35ac691b5187 3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 483
diff changeset
    33
import time
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    34
import pango
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    35
import datetime
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    36
import traceback
991
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
    37
import string
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    38
from threading import Thread
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    39
try:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
    40
        import gobject
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    41
        import gtk
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    42
        import gtk.glade
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
    43
        import pygtk
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
    44
        pygtk.require("2.0")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
    45
except ImportError:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    46
        sys.exit(1)
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    47
nobe = False
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    48
try:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    49
        import libbe as be
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    50
except ImportError:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    51
        nobe = True
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    52
import pkg.client.progress as progress
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    53
import pkg.misc
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents: 562
diff changeset
    54
import pkg.client.api_errors as api_errors
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
    55
import pkg.gui.beadmin as beadm
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
    56
import pkg.gui.misc as gui_misc
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    57
import pkg.gui.enumerations as enumerations
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    58
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    59
ERROR_FORMAT = "<span color = \"red\">%s</span>"
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    60
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    61
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    62
class InstallUpdate(progress.ProgressTracker):
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
    63
        def __init__(self, list_of_packages, parent, api_o,
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
    64
            ips_update = False, action = -1, be_name = None, 
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
    65
            parent_name = "", pkg_list = None, main_window = None,
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
    66
            icon_confirm_dialog = None, title = None, web_install = False):
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    67
                if action == -1:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    68
                        return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    69
                progress.ProgressTracker.__init__(self)
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
    70
                self.web_install = web_install
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
    71
                self.web_updates_list = None
636
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 602
diff changeset
    72
                api_o.progresstracker = self
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    73
                self.api_o = api_o
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    74
                self.parent = parent
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    75
                self.be_list = None
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    76
                self.be_name = be_name
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
    77
                self.parent_name = parent_name
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
    78
                self.ipkg_ipkgui_list = pkg_list
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
    79
                self.icon_confirm_dialog = icon_confirm_dialog
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
    80
                self.title = title
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
    81
                self.w_main_window = main_window
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
    82
                self.ips_update = ips_update
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    83
                self.list_of_packages = list_of_packages
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    84
                self.act_phase_last = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    85
                self.action = action
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    86
                self.canceling = False
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    87
                self.current_stage_name = None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    88
                self.ind_started = None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    89
                self.ip = None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    90
                self.operations_done = False
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    91
                self.prev_ind_phase = None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    92
                self.prev_pkg = None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    93
                self.progress_stop_timer_running = False
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
    94
                self.proposed_be_name = None
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    95
                self.stages = {
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    96
                          1:[_("Preparing..."), _("Preparation")],
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    97
                          2:[_("Downloading..."), _("Download")],
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    98
                          3:[_("Installing..."), _("Install")],
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    99
                         }
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   100
                self.stop_bouncing_progress = False
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   101
                self.stopped_bouncing_progress = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   102
                self.update_list = {}
1186
c793e5d17602 9556 Failure in UpdateManager when there is no space
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   103
                gladefile = os.path.join(self.parent.application_dir,
c793e5d17602 9556 Failure in UpdateManager when there is no space
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   104
                    "usr/share/package-manager/packagemanager.glade")
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   105
                w_tree_dialog = gtk.glade.XML(gladefile, "createplandialog")
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   106
                w_tree_uaconfirm = gtk.glade.XML(gladefile, "ua_confirm_dialog")
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   107
                w_tree_removeconfirm = \
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   108
                    gtk.glade.XML(gladefile, "removeconfirmation")
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   109
                self.w_dialog = w_tree_dialog.get_widget("createplandialog")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   110
                self.w_expander = w_tree_dialog.get_widget("expander3")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   111
                self.w_cancel_button = w_tree_dialog.get_widget("cancelcreateplan")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   112
                self.w_progressbar = w_tree_dialog.get_widget("createplanprogress")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   113
                self.w_details_textview = w_tree_dialog.get_widget("createplantextview")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   114
                self.w_removeconfirm_dialog = \
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   115
                    w_tree_removeconfirm.get_widget("removeconfirmation")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   116
                w_removeproceed_button = w_tree_removeconfirm.get_widget("remove_proceed")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   117
                w_remove_treeview = w_tree_removeconfirm.get_widget("removetreeview")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   118
                w_stage2 = w_tree_dialog.get_widget("stage2")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   119
                self.w_stages_box = w_tree_dialog.get_widget("stages_box")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   120
                self.w_stage1_label = w_tree_dialog.get_widget("label_stage1")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   121
                self.w_stage1_icon = w_tree_dialog.get_widget("icon_stage1")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   122
                self.w_stage2_label = w_tree_dialog.get_widget("label_stage2")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   123
                self.w_stage2_icon = w_tree_dialog.get_widget("icon_stage2")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   124
                self.w_stage3_label = w_tree_dialog.get_widget("label_stage3")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   125
                self.w_stage3_icon = w_tree_dialog.get_widget("icon_stage3")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   126
                self.w_stages_label = w_tree_dialog.get_widget("label_stages")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   127
                self.w_stages_icon = w_tree_dialog.get_widget("icon_stages")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   128
                self.current_stage_label = self.w_stage1_label
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   129
                self.current_stage_icon = self.w_stage1_icon
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   130
                self.current_stage_label_done = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   131
1164
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1149
diff changeset
   132
                self.done_icon = gui_misc.get_icon(
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1149
diff changeset
   133
                    self.parent.icon_theme, "progress_checkmark")
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1149
diff changeset
   134
                blank_icon = gui_misc.get_icon(
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1149
diff changeset
   135
                    self.parent.icon_theme, "progress_blank")
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   136
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   137
                self.w_stage1_icon.set_from_pixbuf(blank_icon)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   138
                self.w_stage2_icon.set_from_pixbuf(blank_icon)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   139
                self.w_stage3_icon.set_from_pixbuf(blank_icon)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   140
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   141
                infobuffer = self.w_details_textview.get_buffer()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   142
                infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   143
                infobuffer.create_tag("level1", left_margin=30, right_margin=10)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   144
                infobuffer.create_tag("level2", left_margin=50, right_margin=10)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   145
                self.w_ua_dialog = w_tree_uaconfirm.get_widget("ua_confirm_dialog")
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   146
                self.w_ua_error_label = w_tree_uaconfirm.get_widget(
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   147
                    "ua_confirm_error_label")
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   148
                self.w_ua_proceed_button = w_tree_uaconfirm.get_widget(
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   149
                    "ua_proceed_button")
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   150
                self.w_ua_be_name_entry = w_tree_uaconfirm.get_widget(
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   151
                    "ua_be_name_entry")
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   152
                self.w_ua_be_name_box = w_tree_uaconfirm.get_widget(
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   153
                    "ua_be_name_box")
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   154
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   155
                w_ua_proceed_button = w_tree_uaconfirm.get_widget("ua_proceed_button")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   156
                self.w_progressbar.set_pulse_step(0.02)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   157
                try:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   158
                        dic_createplan = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   159
                            {
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   160
                                "on_cancelcreateplan_clicked": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   161
                                    self.__on_cancelcreateplan_clicked,
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   162
                                "on_createplandialog_delete_event": \
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   163
                                    self.__on_createplandialog_delete,
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
   164
                            }
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   165
                        dic_uaconfirm = \
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   166
                            {
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   167
                                "on_ua_cancel_button_clicked": \
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   168
                                    self.__on_ua_cancel_button_clicked,
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   169
                                "on_ua_proceed_button_clicked": \
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   170
                                self.__on_ua_proceed_button_clicked,
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   171
                                "on_ua_be_name_entry_changed": \
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   172
                                self.__on_ua_be_name_entry_changed,
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 927
diff changeset
   173
                                "on_ua_help_button_clicked": \
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 927
diff changeset
   174
                                self.__on_ua_help_button_clicked,                                
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   175
                            }
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   176
                        dic_removeconfirm = \
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   177
                            {
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   178
                                "on_proceed_button_clicked": \
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   179
                                    self.__on_remove_proceed_button_clicked,
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   180
                                "on_cancel_button_clicked": \
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   181
                                self.__on_remove_cancel_button_clicked,
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   182
                            }
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   183
                        w_tree_dialog.signal_autoconnect(dic_createplan)
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   184
                        w_tree_uaconfirm.signal_autoconnect(dic_uaconfirm)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   185
                        w_tree_removeconfirm.signal_autoconnect(dic_removeconfirm)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   186
                except AttributeError, error:
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 795
diff changeset
   187
                        print _("GUI will not respond to any event! %s. "
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 795
diff changeset
   188
                            "Check installupdate.py signals") \
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   189
                            % error
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   190
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   191
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   192
                self.w_dialog.set_transient_for(self.w_main_window)
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   193
                self.w_ua_dialog.set_transient_for(self.w_main_window)
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   194
                if self.icon_confirm_dialog != None:  
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   195
                        self.w_ua_dialog.set_icon(self.icon_confirm_dialog)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   196
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   197
                if self.action == enumerations.REMOVE:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   198
                        #We are not showing the download stage in the main stage list
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   199
                        self.stages[3] = [_("Removing..."), _("Remove")]
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   200
                        self.w_stage3_label.set_text(self.stages[3][1])
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   201
                        w_stage2.hide()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   202
                        self.w_dialog.set_title(_("Remove"))
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   203
                        w_removeproceed_button.grab_focus()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   204
                        cell = gtk.CellRendererText()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   205
                        remove_column = gtk.TreeViewColumn('Removed')
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   206
                        remove_column.pack_start(cell, True)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   207
                        remove_column.add_attribute(cell, 'text', 0)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   208
                        w_remove_treeview.append_column(remove_column)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   209
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 927
diff changeset
   210
                        liststore = gtk.ListStore(str)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   211
                        for sel_pkg in list_of_packages:
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 927
diff changeset
   212
                                liststore.append([sel_pkg])
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 927
diff changeset
   213
                        w_remove_treeview.set_model(liststore)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   214
                        w_remove_treeview.expand_all()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   215
                        self.w_removeconfirm_dialog.show()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   216
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   217
                elif self.action == enumerations.IMAGE_UPDATE:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   218
                        self.w_dialog.set_title(_("Update All"))
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   219
                        w_ua_proceed_button.grab_focus()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   220
                        if not self.be_name:
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   221
                                if nobe or not "beVerifyBEName" in be.__dict__:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   222
                                        self.w_ua_be_name_box.set_property(
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   223
                                            "visible", False)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   224
                                else:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   225
                                        self.__setup_be_list()
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   226
                                self.w_ua_dialog.show()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   227
                        else:
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   228
                                self.proposed_be_name = self.be_name
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   229
                                self.__proceed_with_stages()
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   230
                else:
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   231
                        if self.title != None:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   232
                                self.w_dialog.set_title(self.title)
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   233
                        else:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   234
                                self.w_dialog.set_title(_("Install/Update"))
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   235
                        self.__proceed_with_stages()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   236
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   237
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   238
        def __on_createplandialog_delete(self, widget, event):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   239
                self.__on_cancelcreateplan_clicked(None)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   240
                return True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   241
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   242
        def __on_cancelcreateplan_clicked(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   243
                '''Handler for signal send by cancel button, which user might press during
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   244
                evaluation stage - while the dialog is creating plan'''
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   245
                if self.api_o.can_be_canceled():
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   246
                        self.canceling = True
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   247
                        Thread(target = self.api_o.cancel, args = ()).start()
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   248
                        cancel_txt = _("Canceling...")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   249
                        txt = "<b>" + self.current_stage_label_done + " - " \
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   250
                            + cancel_txt + "</b>"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   251
                        gobject.idle_add(self.current_stage_label.set_markup, txt)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   252
                        gobject.idle_add(self.current_stage_icon.set_from_stock, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   253
                            gtk.STOCK_CANCEL, gtk.ICON_SIZE_MENU)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   254
                        gobject.idle_add(self.w_stages_label.set_markup, cancel_txt)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   255
                        self.w_cancel_button.set_sensitive(False)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   256
                if self.operations_done:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   257
                        self.w_dialog.hide()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   258
                        if self.web_install:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   259
                                gobject.idle_add(self.parent.update_package_list, 
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   260
                                    self.web_updates_list)
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   261
                                return
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   262
                        gobject.idle_add(self.parent.update_package_list, None)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
   263
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 927
diff changeset
   264
        def __on_ua_help_button_clicked(self, widget):
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 984
diff changeset
   265
                gui_misc.display_help(self.parent.application_dir, "update_all")
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 927
diff changeset
   266
                
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   267
        def __on_ua_cancel_button_clicked(self, widget):
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   268
                self.w_ua_dialog.hide()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   269
                if self.web_install:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   270
                        gobject.idle_add(self.parent.update_package_list, 
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   271
                            self.web_updates_list)
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   272
                        return
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   273
                gobject.idle_add(self.parent.update_package_list, None)
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   274
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   275
        def __on_ua_proceed_button_clicked(self, widget):
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   276
                proposed_be_name = self.w_ua_be_name_entry.get_text()
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   277
                if proposed_be_name != "":
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   278
                        self.proposed_be_name = proposed_be_name
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   279
                self.w_ua_dialog.hide()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   280
                self.__proceed_with_stages()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   281
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   282
        def __setup_be_list(self):
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   283
                be_list = be.beList()
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   284
                error_code = None
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   285
                if len(be_list) > 1 and type(be_list[0]) == type(-1):
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   286
                        error_code = be_list[0]
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   287
                if error_code != None and error_code == 0:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   288
                        self.be_list = be_list[1]
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   289
                elif error_code == None:
910
9b201f847460 4503 Modify New Boot Environment dialog to allow BE name to be specified (followup)
Padraig O'Briain <padraig.obriain@sun.com>
parents: 906
diff changeset
   290
                        self.be_list = be_list
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   291
991
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   292
                # Now set proposed name in entry field.
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   293
                active_name = None
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   294
                for bee in self.be_list:
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   295
                        name = bee.get("orig_be_name")
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   296
                        if name:
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   297
                                if bee.get("active"):
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   298
                                        active_name = name
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   299
                                        break
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   300
                if active_name != None:
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   301
                        proposed_name = None
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   302
                        list = string.rsplit(active_name, '-', 1)
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   303
                        if len(list) == 1:
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   304
                                proposed_name = self.__construct_be_name(
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   305
                                    active_name, 0)
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   306
                        else:
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   307
                                try:
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   308
                                        i = int(list[1])
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   309
                                        proposed_name = self.__construct_be_name(
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   310
                                            list[0], i)
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   311
                                except ValueError:
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   312
                                        proposed_name = self.__construct_be_name(
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   313
                                            active_name, 0)
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   314
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   315
                        if proposed_name != None:
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   316
                                self.w_ua_be_name_entry.set_text(proposed_name)
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   317
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   318
                        
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   319
        def __construct_be_name(self, name, i):
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   320
                in_use = True
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   321
                proposed_name = None
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   322
                while in_use:
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   323
                        i += 1
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   324
                        proposed_name = name + '-'  + str(i)
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   325
                        in_use = self.__is_be_name_in_use(proposed_name)
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   326
                return proposed_name
2fe431bd9ffd 6986 Update Confirm Boot Env Dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   327
            
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   328
        def __is_be_name_in_use(self, name):
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   329
                in_use = False
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   330
                if name == "":
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   331
                        return in_use
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   332
                for bee in self.be_list:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   333
                        be_name = bee.get("orig_be_name")
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   334
                        if be_name == name:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   335
                                in_use = True
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   336
                                break
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   337
                return in_use
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   338
 
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   339
        def __is_be_name_valid(self, name):
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   340
                if name == "":
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   341
                        return True
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   342
                return be.beVerifyBEName(name) == 0
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   343
   
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   344
        def __validate_be_name(self, widget):
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   345
                name = widget.get_text()
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   346
                is_name_valid = self.__is_be_name_valid(name)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   347
                self.w_ua_error_label.hide()
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   348
                error_str = None
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   349
                if is_name_valid:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   350
                        is_name_in_use = self.__is_be_name_in_use(name)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   351
                        if is_name_in_use:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   352
                                error_str = ERROR_FORMAT % _("BE name is in use")
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   353
                else:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   354
                        error_str = ERROR_FORMAT % _("BE name is invalid")
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   355
                if error_str != None:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   356
                        self.w_ua_error_label.set_markup(error_str)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   357
                        self.w_ua_error_label.show()
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   358
                  
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   359
                self.w_ua_proceed_button.set_sensitive(error_str == None)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   360
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   361
        def __on_ua_be_name_entry_changed(self, widget):
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   362
                self.__validate_be_name(widget)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   363
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   364
        def __on_remove_cancel_button_clicked(self, widget):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   365
                self.w_removeconfirm_dialog.hide()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   366
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   367
        def __on_remove_proceed_button_clicked(self, widget):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   368
                self.w_removeconfirm_dialog.hide()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   369
                self.__proceed_with_stages()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   370
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   371
        def __ipkg_ipkgui_uptodate(self):
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   372
                if self.ipkg_ipkgui_list == None:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   373
                        return True
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   374
                upgrade_needed, cre = self.api_o.plan_install(
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   375
                    self.ipkg_ipkgui_list, filters = [])
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   376
                return not upgrade_needed
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   377
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   378
        def __proceed_with_stages(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   379
                self.__start_stage_one()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   380
                self.w_dialog.show()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   381
                Thread(target = self.__proceed_with_stages_thread_ex, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   382
                    args = ()).start()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   383
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   384
        def __proceed_with_stages_thread_ex(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   385
                try:
1200
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   386
                        try:
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   387
                                if self.action == enumerations.IMAGE_UPDATE:
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   388
                                        self.__start_substage(
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   389
                                            _("Ensuring %s is up to date...") % 
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   390
                                            self.parent_name, 
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   391
                                            bounce_progress=True)
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   392
                                        opensolaris_image = True
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   393
                                        ips_uptodate = True
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   394
                                        notfound = self.__installed_fmris_from_args(
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   395
                                            ["SUNWipkg", "SUNWcs"])
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   396
                                        if notfound:
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   397
                                                opensolaris_image = False
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   398
                                        if opensolaris_image:
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   399
                                                ips_uptodate = \
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   400
                                                    self.__ipkg_ipkgui_uptodate()
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   401
                                        if not ips_uptodate:
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   402
                                        #Do the stuff with installing pkg pkg-gui
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   403
                                        #and restart in the special mode
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   404
                                                self.ips_update = True
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   405
                                                self.__proceed_with_ipkg_thread()
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   406
                                                return
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   407
                                        else:
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   408
                                                self.api_o.reset()
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   409
                                self.__proceed_with_stages_thread()
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   410
                        except (MemoryError, EnvironmentError), __e:
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   411
                                if isinstance(__e, EnvironmentError) and \
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   412
                                    __e.errno != errno.ENOMEM:
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   413
                                        raise
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   414
                                msg = pkg.misc.out_of_memory()
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   415
                                self.__g_error_stage(msg)
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   416
                                return
5721206a1878 9501 packagemanager traceback on memoryerror
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   417
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   418
                except api_errors.CertificateError:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   419
                        self.stop_bouncing_progress = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   420
                        msg = _("Accessing this restricted repository failed."
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   421
                            "\nYou either need to register to access this repository,"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   422
                            "\nthe certificate expired, or you need to accept the"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   423
                            " repository\ncertificate.")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   424
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   425
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   426
                except api_errors.PlanCreationException, e:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   427
                        self.__g_error_stage(str(e))
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   428
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   429
                except api_errors.InventoryException, e:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   430
                        msg = _("Inventory exception:\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   431
                        if e.illegal:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   432
                                for i in e.illegal:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   433
                                        msg += "\tpkg:\t" + i +"\n"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   434
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   435
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   436
                except api_errors.CatalogRefreshException, e:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   437
                        msg = _("Please check the network "
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   438
                            "connection.\nIs the repository accessible?")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   439
                        if e.message and len(e.message) > 0:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   440
                                msg = e.message
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   441
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   442
                        return
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1186
diff changeset
   443
                except api_errors.TransportError, ex:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   444
                        msg = _("Please check the network "
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   445
                            "connection.\nIs the repository accessible?\n\n"
1149
b07c918e32cd 9327 Package-Manager fails to update from dev/b111a to 2009.06
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   446
                            "%s") % str(ex)
b07c918e32cd 9327 Package-Manager fails to update from dev/b111a to 2009.06
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   447
                        self.__g_error_stage(msg)
b07c918e32cd 9327 Package-Manager fails to update from dev/b111a to 2009.06
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   448
                        return
b07c918e32cd 9327 Package-Manager fails to update from dev/b111a to 2009.06
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   449
                except api_errors.InvalidDepotResponseException, e:
b07c918e32cd 9327 Package-Manager fails to update from dev/b111a to 2009.06
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   450
                        msg = _("\nUnable to contact a valid package depot. "
b07c918e32cd 9327 Package-Manager fails to update from dev/b111a to 2009.06
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   451
                            "Please check your network\nsettings and "
b07c918e32cd 9327 Package-Manager fails to update from dev/b111a to 2009.06
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   452
                            "attempt to contact the server using a web "
b07c918e32cd 9327 Package-Manager fails to update from dev/b111a to 2009.06
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   453
                            "browser.\n\n%s") % str(e)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   454
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   455
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   456
                except api_errors.IpkgOutOfDateException:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   457
                        msg = _("pkg(5) appears to be out of "
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   458
                            "date and should be\nupdated before running "
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   459
                            "Update All.\nPlease update SUNWipkg package")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   460
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   461
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   462
                except api_errors.NonLeafPackageException, nlpe:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   463
                        msg = _("Cannot remove:\n\t%s\n"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   464
                                "Due to the following packages that "
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   465
                                "depend on it:\n") % nlpe[0].get_name()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   466
                        for pkg_a in nlpe[1]:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   467
                                msg += "\t" + pkg_a.get_name() + "\n"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   468
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   469
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   470
                except api_errors.ProblematicPermissionsIndexException, err:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   471
                        msg = str(err)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   472
                        msg += _("\nFailure of consistent use of pfexec or gksu when "
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   473
                            "running\n%s is often a source of this problem.") % \
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   474
                            self.parent_name
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   475
                        msg += _("\nTo rebuild index, please use the terminal command:")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   476
                        msg += _("\n\tpfexec pkg rebuild-index")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   477
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   478
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   479
                except api_errors.CorruptedIndexException:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   480
                        msg = _("There was an error during installation. The search\n"
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   481
                            "index is corrupted. You might want try to fix this\n"
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   482
                            "problem by running command:\n"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   483
                            "\tpfexec pkg rebuild-index")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   484
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   485
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   486
                except api_errors.ImageUpdateOnLiveImageException:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   487
                        msg = _("This is an Live Image. The install"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   488
                            "\noperation can't be performed.")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   489
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   490
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   491
                except api_errors.PlanMissingException:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   492
                        msg = _("There was an error during installation.\n"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   493
                            "The Plan of the operation is missing and the operation\n"
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   494
                            "can't be finished. You might want try to fix this\n"
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   495
                            "problem by restarting %s\n") % self.parent_name
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   496
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   497
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   498
                except api_errors.ImageplanStateException:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   499
                        msg = _("There was an error during installation.\n"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   500
                            "The State of the image is incorrect and the operation\n"
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   501
                            "can't be finished. You might want try to fix this\n"
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   502
                            "problem by restarting %s\n") % self.parent_name
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   503
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   504
                        return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   505
                except api_errors.CanceledException:
1104
be627b90a52f 8645 PM becomes unresponsive when canceling a installation
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1087
diff changeset
   506
                        gobject.idle_add(self.w_dialog.hide)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 823
diff changeset
   507
                        self.stop_bouncing_progress = True
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   508
                        return
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   509
                except api_errors.BENamingNotSupported:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   510
                        msg = _("Specifying BE Name not supported.\n")
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   511
                        self.__g_error_stage(msg)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   512
                        return
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   513
                except api_errors.InvalidBENameException:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   514
                        msg = _("Invalid BE Name: %s.\n") % self.proposed_be_name
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   515
                        self.__g_error_stage(msg)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   516
                        return
998
05b9dffc51b0 7439 install error mplayer through blastwave
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 991
diff changeset
   517
                except api_errors.PermissionsException, pex:
05b9dffc51b0 7439 install error mplayer through blastwave
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 991
diff changeset
   518
                        msg = str(pex)
05b9dffc51b0 7439 install error mplayer through blastwave
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 991
diff changeset
   519
                        self.__g_error_stage(msg)
05b9dffc51b0 7439 install error mplayer through blastwave
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 991
diff changeset
   520
                        return
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   521
                except (api_errors.UnableToCopyBE, 
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   522
                    api_errors.UnableToMountBE,
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   523
                    api_errors.BENameGivenOnDeadBE,
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   524
                    api_errors.UnableToRenameBE), ex:
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   525
                        msg = str(ex)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   526
                        self.__g_error_stage(msg)
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   527
                        return
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   528
                except Exception, uex:
984
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   529
                        # We do want to prompt user to load BE admin if there is
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   530
                        # not enough disk space. This error can either come as an
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   531
                        # error within API exception, see bug #7642 or as a standalone
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   532
                        # error, that is why we need to check for both situations.
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   533
                        if ("error" in uex.__dict__ and isinstance(uex.error, OSError)
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   534
                            and ("args" in uex.error.__dict__ and uex.error.args and \
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   535
                            (uex.error.args[0] == errno.EDQUOT or 
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   536
                            uex.error.args[0] == errno.ENOSPC))) \
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   537
                            or ("args" in uex.__dict__ and uex.args and (uex.args[0] ==
2a97f55cee8b 7642 Unexpected error when doing image update to build 110
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   538
                            errno.EDQUOT or uex.args[0] == errno.ENOSPC)):
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   539
                                gobject.idle_add(self.__prompt_to_load_beadm)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   540
                                gobject.idle_add(self.w_dialog.hide)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   541
                                self.stop_bouncing_progress = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   542
                        else:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   543
                                traceback_lines = traceback.format_exc().splitlines()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   544
                                traceback_str = ""
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   545
                                for line in traceback_lines: 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   546
                                        traceback_str += line + "\n"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   547
                                self.__g_exception_stage(traceback_str)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   548
                                sys.exc_clear()
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   549
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   550
        def __proceed_with_ipkg_thread(self):
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   551
                self.__start_substage(_("Updating %s") % self.parent_name, 
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   552
                    bounce_progress=True)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   553
                self.__afterplan_information()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   554
                self.prev_pkg = None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   555
                self.__start_substage(_("Downloading..."), bounce_progress=False)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   556
                self.api_o.prepare()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   557
                self.__start_substage(_("Executing..."), bounce_progress=False)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   558
                self.api_o.execute_plan()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   559
                gobject.idle_add(self.__operations_done)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   560
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   561
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   562
        def __proceed_with_stages_thread(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   563
                self.__start_substage(
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1123
diff changeset
   564
                    _("Gathering package information, please wait..."))
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   565
                stuff_todo = self.__plan_stage()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   566
                if stuff_todo:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   567
                        self.__afterplan_information()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   568
                        self.prev_pkg = None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   569
                        # The api.prepare() mostly is downloading the files so we are
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   570
                        # Not showing this stage in the main stage dialog. If download 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   571
                        # is necessary, then we are showing it in the details view
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   572
                        if not self.action == enumerations.REMOVE:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   573
                                self.__start_stage_two()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   574
                                self.__start_substage(None, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   575
                                    bounce_progress=False)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   576
                        self.api_o.prepare()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   577
                        self.__start_stage_three()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   578
                        self.__start_substage(None, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   579
                            bounce_progress=False)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   580
                        self.api_o.execute_plan()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   581
                        gobject.idle_add(self.__operations_done)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   582
                else:
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   583
                        if self.web_install:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   584
                                gobject.idle_add(self.w_expander.hide)
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   585
                                gobject.idle_add(self.__operations_done, 
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   586
                                    _("All packages already installed."))
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   587
                                return
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   588
                                
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   589
                        msg = None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   590
                        if self.action == enumerations.INSTALL_UPDATE:
899
f5a8f304718a 6988 Fix Error Message after Install/Update of incorporated package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 871
diff changeset
   591
                                msg = _("Selected package(s) cannot be updated on "
f5a8f304718a 6988 Fix Error Message after Install/Update of incorporated package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 871
diff changeset
   592
                                "their own.\nClick Update All to update all packages.")
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   593
                        elif self.action == enumerations.IMAGE_UPDATE:
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 984
diff changeset
   594
                                msg = _("Your system has already been updated.")
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   595
                        self.__g_error_stage(msg)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   596
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   597
        def __start_stage_one(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   598
                self.current_stage_label = self.w_stage1_label
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   599
                self.current_stage_icon = self.w_stage1_icon
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   600
                self.__start_stage(self.stages.get(1))
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   601
                self.__g_update_details_text(self.stages.get(1)[0]+"\n", "bold")
510
35ac691b5187 3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 483
diff changeset
   602
                
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   603
        def __start_stage_two(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   604
                # End previous stage
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   605
                self.__end_stage()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   606
                self.current_stage_label = self.w_stage2_label
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   607
                self.current_stage_icon = self.w_stage2_icon
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   608
                self.__start_stage(self.stages.get(2))
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   609
                self.__g_update_details_text(self.stages.get(2)[0]+"\n", "bold")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   610
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   611
        def __start_stage_three(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   612
                self.__end_stage()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   613
                self.current_stage_label = self.w_stage3_label
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   614
                self.current_stage_icon = self.w_stage3_icon
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   615
                self.__start_stage(self.stages.get(3))
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   616
                self.__g_update_details_text(self.stages.get(3)[0]+"\n", "bold")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   617
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   618
        def __start_stage(self, stage_text):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   619
                self.current_stage_label_done = stage_text[1]
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   620
                gobject.idle_add(self.current_stage_label.set_markup, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   621
                    "<b>"+stage_text[0]+"</b>")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   622
                gobject.idle_add(self.current_stage_icon.set_from_stock, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   623
                    gtk.STOCK_GO_FORWARD, gtk.ICON_SIZE_MENU)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   624
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   625
        def __end_stage(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   626
                gobject.idle_add(self.current_stage_label.set_text, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   627
                    self.current_stage_label_done)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   628
                gobject.idle_add(self.current_stage_icon.set_from_pixbuf, self.done_icon)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   629
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   630
        def __g_error_stage(self, msg):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   631
                if msg == None or len(msg) == 0:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   632
                        msg = _("No futher information available") 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   633
                self.operations_done = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   634
                self.stop_bouncing_progress = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   635
                self.__g_update_details_text(_("\nError:\n"), "bold")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   636
                self.__g_update_details_text("%s" % msg, "level1")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   637
                self.__g_update_details_text("\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   638
                txt = "<b>" + self.current_stage_label_done + _(" - Failed </b>")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   639
                gobject.idle_add(self.current_stage_label.set_markup, txt)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   640
                gobject.idle_add(self.current_stage_icon.set_from_stock, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   641
                    gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_MENU)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   642
                gobject.idle_add(self.w_expander.set_expanded, True)
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   643
                gobject.idle_add(self.w_cancel_button.set_sensitive, True)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   644
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   645
        def __g_exception_stage(self, tracebk):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   646
                self.operations_done = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   647
                self.stop_bouncing_progress = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   648
                txt = "<b>" + self.current_stage_label_done + _(" - Failed </b>")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   649
                gobject.idle_add(self.current_stage_label.set_markup, txt)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   650
                gobject.idle_add(self.current_stage_icon.set_from_stock, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   651
                    gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_MENU)
1123
22aa471c4112 9024 Typos in pkgmgr error popup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1104
diff changeset
   652
                msg_1 = _("An unknown error occurred in the %s stage.\n"
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   653
                    "Please let the developers know about this problem\n"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   654
                    "by filing a bug together with exception value at:\n"
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   655
                    ) % self.current_stage_name
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   656
                msg_2 = _("http://defect.opensolaris.org\n\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   657
                msg_3 = _("Exception value:\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   658
                self.__g_update_details_text(_("\nError:\n"), "bold")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   659
                self.__g_update_details_text("%s" % msg_1, "level1")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   660
                self.__g_update_details_text("%s" % msg_2, "bold", "level2")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   661
                if tracebk:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   662
                        msg = _("Exception traceback:\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   663
                        self.__g_update_details_text("%s" % msg, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   664
                            "bold","level1")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   665
                        self.__g_update_details_text("%s\n" % tracebk, "level2")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   666
                else:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   667
                        msg = _("No futher information available")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   668
                        self.__g_update_details_text("%s\n" % msg, "level2")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   669
                gobject.idle_add(self.w_expander.set_expanded, True)
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   670
                gobject.idle_add(self.w_cancel_button.set_sensitive, True)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   671
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   672
        def __start_substage(self, text, bounce_progress=True):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   673
                if text:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   674
                        gobject.idle_add(self.__stages_label_set_markup, text)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   675
                        self.__g_update_details_text(text + "\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   676
                if bounce_progress:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   677
                        if self.stopped_bouncing_progress:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   678
                                self.__start_bouncing_progress()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   679
                else:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   680
                        self.stop_bouncing_progress = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   681
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   682
        def __stages_label_set_markup(self, markup_text):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   683
                if not self.canceling == True:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   684
                        self.w_stages_label.set_markup(markup_text)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   685
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   686
        def __start_bouncing_progress(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   687
                self.stop_bouncing_progress = False
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   688
                self.stopped_bouncing_progress = False
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   689
                Thread(target = 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   690
                    self.__g_progressdialog_progress_pulse).start()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   691
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   692
        def __g_progressdialog_progress_pulse(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   693
                while not self.stop_bouncing_progress:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   694
                        gobject.idle_add(self.w_progressbar.pulse)
510
35ac691b5187 3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 483
diff changeset
   695
                        time.sleep(0.1)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   696
                self.stopped_bouncing_progress = True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   697
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   698
        def __g_update_details_text(self, text, *tags):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   699
                gobject.idle_add(self.__update_details_text, text, *tags)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   700
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   701
        def __update_details_text(self, text, *tags):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   702
                buf = self.w_details_textview.get_buffer()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   703
                textiter = buf.get_end_iter()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   704
                if tags:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   705
                        buf.insert_with_tags_by_name(textiter, text, *tags)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   706
                else:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   707
                        buf.insert(textiter, text)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   708
                self.w_details_textview.scroll_to_iter(textiter, 0.0)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   709
                
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   710
        def __update_download_progress(self, cur_bytes, total_bytes):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   711
                prog = float(cur_bytes)/total_bytes
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   712
                self.w_progressbar.set_fraction(prog)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   713
                size_a_str = ""
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   714
                size_b_str = ""
795
fbb9b3da7188 5230 UI improvements - to many "All" possibilities
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 783
diff changeset
   715
                if cur_bytes >= 0:
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   716
                        size_a_str = pkg.misc.bytes_to_str(cur_bytes)
795
fbb9b3da7188 5230 UI improvements - to many "All" possibilities
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 783
diff changeset
   717
                if total_bytes >= 0:
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   718
                        size_b_str = pkg.misc.bytes_to_str(total_bytes)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   719
                c = _("Downloaded %(current)s of %(total)s") % \
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   720
                    {"current" : size_a_str,
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   721
                    "total" : size_b_str}
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   722
                self.__stages_label_set_markup(c)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   723
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   724
        def __update_install_progress(self, current, total):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   725
                prog = float(current)/total
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   726
                self.w_progressbar.set_fraction(prog)
510
35ac691b5187 3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 483
diff changeset
   727
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   728
        def __plan_stage(self):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   729
                '''Function which plans the image'''
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   730
                stuff_to_do = False
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   731
                if self.action == enumerations.INSTALL_UPDATE:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   732
                        stuff_to_do, cre = self.api_o.plan_install(
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   733
                            self.list_of_packages, refresh_catalogs = False, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   734
                            filters = [])
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   735
                        if cre and not cre.succeeded:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   736
                                # cre is either None or a catalog refresh exception 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   737
                                # which was caught while planning.
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   738
                                raise api_errors.CatalogRefreshException(None, None, None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   739
                                    ,_("Catalog refresh failed during install."))
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   740
                elif self.action == enumerations.REMOVE:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   741
                        plan_uninstall = self.api_o.plan_uninstall
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   742
                        stuff_to_do = \
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   743
                            plan_uninstall(self.list_of_packages, False, False)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   744
                elif self.action == enumerations.IMAGE_UPDATE:  
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   745
                        # we are passing force, since we already checked if the
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   746
                        # SUNWipkg and SUNWipkg-gui are up to date.
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   747
                        stuff_to_do, opensolaris_image, cre = \
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   748
                            self.api_o.plan_update_all(sys.argv[0],
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   749
                            refresh_catalogs = False,
906
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   750
                            noexecute = False, force = True,
3d0200073211 4503 Modify New Boot Environment dialog to allow BE name to be specified
Padraig O'Briain <padraig.obriain@sun.com>
parents: 899
diff changeset
   751
                            be_name = self.proposed_be_name)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   752
                        if cre and not cre.succeeded:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   753
                                raise api_errors.CatalogRefreshException(None, None, None
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   754
                                    ,_("Catalog refresh failed during Update All."))
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   755
                return stuff_to_do
510
35ac691b5187 3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 483
diff changeset
   756
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   757
        def __operations_done(self, alternate_done_txt = None):
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   758
                done_txt = _("Installation completed successfully.")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   759
                if self.action == enumerations.REMOVE:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   760
                        done_txt = _("Packages removed successfully.")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   761
                elif self.action == enumerations.IMAGE_UPDATE:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   762
                        done_txt = _("Packages updated successfully.")
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   763
                if alternate_done_txt != None:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   764
                        done_txt = alternate_done_txt
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   765
                self.w_stages_box.hide()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   766
                self.w_stages_icon.set_from_stock(
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   767
                    gtk.STOCK_OK, gtk.ICON_SIZE_DND)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   768
                self.w_stages_icon.show()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   769
                self.__stages_label_set_markup(done_txt)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   770
                self.__update_details_text("\n"+ done_txt, "bold")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   771
                self.w_cancel_button.set_label("gtk-close")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   772
                self.w_progressbar.hide()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   773
                self.stop_bouncing_progress = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   774
                self.operations_done = True
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   775
                if self.parent != None:
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   776
                        if not self.web_install and not self.ips_update \
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   777
                            and not self.action == enumerations.IMAGE_UPDATE:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   778
                                self.parent.update_package_list(self.update_list)
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   779
                        if self.web_install:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   780
                                self.web_updates_list = self.update_list
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
   781
                if self.ips_update:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   782
                        self.w_dialog.hide()
1083
2df530130ab7 8359 Rename BE failed upgrade from 111 to 111a
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1055
diff changeset
   783
                        self.parent.restart_after_ips_update(self.proposed_be_name)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   784
                elif self.action == enumerations.IMAGE_UPDATE:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   785
                        self.w_dialog.hide()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   786
                        self.parent.shutdown_after_image_update()
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
   787
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   788
        def __prompt_to_load_beadm(self):
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
   789
                msgbox = gtk.MessageDialog(parent = self.w_main_window,
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 795
diff changeset
   790
                    buttons = gtk.BUTTONS_OK_CANCEL, flags = gtk.DIALOG_MODAL,
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 795
diff changeset
   791
                    type = gtk.MESSAGE_ERROR, 
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 795
diff changeset
   792
                    message_format = _(
1021
89478afc5a47 7985 "Not enough space..." message truncated during extracted into pkg.pot
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 998
diff changeset
   793
                        "Not enough disk space, the selected action cannot "
89478afc5a47 7985 "Not enough space..." message truncated during extracted into pkg.pot
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 998
diff changeset
   794
                        "be performed.\n\n"
89478afc5a47 7985 "Not enough space..." message truncated during extracted into pkg.pot
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 998
diff changeset
   795
                        "Click OK to manage your existing BEs and free up disk space or "
89478afc5a47 7985 "Not enough space..." message truncated during extracted into pkg.pot
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 998
diff changeset
   796
                        "Cancel to cancel the action."))
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   797
                msgbox.set_title(_("Not Enough Disk Space"))
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   798
                result = msgbox.run()
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   799
                msgbox.destroy()
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   800
                if result == gtk.RESPONSE_OK:
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   801
                        beadm.Beadmin(self.parent)
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   802
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   803
        def __afterplan_information(self):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   804
                install_iter = None 
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   805
                update_iter = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   806
                remove_iter = None
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   807
                plan = self.api_o.describe().get_changes()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   808
                self.__g_update_details_text("\n")
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   809
                for pkg_plan in plan:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   810
                        origin_fmri = pkg_plan[0]
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   811
                        destination_fmri = pkg_plan[1]
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   812
                        if origin_fmri and destination_fmri:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   813
                                if not update_iter:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   814
                                        update_iter = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   815
                                        txt = _("Packages To Be Updated:\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   816
                                        self.__g_update_details_text(txt, "bold")
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   817
                                pkg_a = self.__get_pkgstr_from_pkginfo(destination_fmri)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   818
                                self.__g_update_details_text(pkg_a+"\n", "level1")
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   819
                        elif not origin_fmri and destination_fmri:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   820
                                if not install_iter:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   821
                                        install_iter = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   822
                                        txt = _("Packages To Be Installed:\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   823
                                        self.__g_update_details_text(txt, "bold")
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   824
                                pkg_a = self.__get_pkgstr_from_pkginfo(destination_fmri)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   825
                                self.__g_update_details_text(pkg_a+"\n", "level1")
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   826
                        elif origin_fmri and not destination_fmri:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   827
                                if not remove_iter:
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   828
                                        remove_iter = True
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   829
                                        txt = _("Packages To Be Removed:\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   830
                                        self.__g_update_details_text(txt, "bold")
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   831
                                pkg_a = self.__get_pkgstr_from_pkginfo(origin_fmri)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   832
                                self.__g_update_details_text(pkg_a+"\n", "level1")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   833
                self.__g_update_details_text("\n")
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   834
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   835
        def __get_pkgstr_from_pkginfo(self, pkginfo):
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   836
                dt_str = self.get_datetime(pkginfo.packaging_date)
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   837
                if not dt_str:
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   838
                        dt_str = ""
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   839
                s_ver = pkginfo.version
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   840
                s_bran = pkginfo.branch
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   841
                pkg_name = pkginfo.pkg_stem
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   842
                pkg_publisher = pkginfo.publisher
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   843
                if not pkg_publisher in self.update_list:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   844
                        self.update_list[pkg_publisher] = []
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   845
                pub_list = self.update_list.get(pkg_publisher)
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   846
                if not pkg_name in pub_list:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 913
diff changeset
   847
                        pub_list.append(pkg_name)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   848
                l_ver = 0
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   849
                version_pref = ""
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   850
                while l_ver < len(s_ver) -1:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   851
                        version_pref += "%d%s" % (s_ver[l_ver],".")
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   852
                        l_ver += 1
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   853
                version_pref += "%d%s" % (s_ver[l_ver],"-")
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   854
                l_ver = 0
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   855
                version_suf = ""
1055
87169eb64bce 7866 packagemanager install failure with pre-released adobe reader package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1021
diff changeset
   856
                if s_bran != None:
87169eb64bce 7866 packagemanager install failure with pre-released adobe reader package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1021
diff changeset
   857
                        while l_ver < len(s_bran) -1:
87169eb64bce 7866 packagemanager install failure with pre-released adobe reader package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1021
diff changeset
   858
                                version_suf += "%d%s" % (s_bran[l_ver],".")
87169eb64bce 7866 packagemanager install failure with pre-released adobe reader package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1021
diff changeset
   859
                                l_ver += 1
87169eb64bce 7866 packagemanager install failure with pre-released adobe reader package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1021
diff changeset
   860
                        version_suf += "%d" % s_bran[l_ver]
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   861
                pkg_version = version_pref + version_suf + dt_str
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   862
                return pkg_name + "@" + pkg_version  
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   863
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   864
        def act_output(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   865
                if self.act_phase != self.act_phase_last:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   866
                        self.act_phase_last = self.act_phase
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   867
                        gobject.idle_add(self.__stages_label_set_markup, self.act_phase)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   868
                        self.__g_update_details_text(_("%s\n") % self.act_phase, "level1")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   869
                gobject.idle_add(self.__update_install_progress,
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   870
                    self.act_cur_nactions, self.act_goal_nactions)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   871
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   872
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   873
        def act_output_done(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   874
                return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   875
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   876
        def cat_output_start(self): 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   877
                return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   878
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   879
        def cat_output_done(self): 
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   880
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   881
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   882
        def cache_cats_output_start(self):
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   883
                return
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   884
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   885
        def cache_cats_output_done(self):
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   886
                return
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   887
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   888
        def load_cat_cache_output_start(self):
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   889
                return
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   890
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   891
        def load_cat_cache_output_done(self):
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   892
                return
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1083
diff changeset
   893
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   894
        def dl_output(self):
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   895
                gobject.idle_add(self.__update_download_progress, \
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   896
                    self.dl_cur_nbytes, self.dl_goal_nbytes)
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   897
                if self.prev_pkg != self.dl_cur_pkg:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   898
                        self.prev_pkg = self.dl_cur_pkg
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   899
                        self.__g_update_details_text(
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   900
                            _("Package %d of %d: %s\n") % (self.dl_cur_npkgs+1, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   901
                            self.dl_goal_npkgs, self.dl_cur_pkg), "level1")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   902
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   903
        def dl_output_done(self):
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   904
                self.__g_update_details_text("\n")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   905
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   906
        def eval_output_start(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   907
                '''Called by progress tracker when the evaluation of the packages just 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   908
                started.'''
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   909
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   910
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   911
        def eval_output_progress(self):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   912
                '''Called by progress tracker each time some package was evaluated. The
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   913
                call is being done by calling progress tracker evaluate_progress() 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   914
                function'''
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   915
                if self.prev_pkg != self.eval_cur_fmri:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   916
                        self.prev_pkg = self.eval_cur_fmri
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   917
                        self.__g_update_details_text("%s\n" % self.eval_cur_fmri,
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   918
                            "level1")
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   919
                        text = _("Evaluating: %s") % self.eval_cur_fmri.get_name()
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   920
                        gobject.idle_add(self.__stages_label_set_markup, text)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   921
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   922
        def eval_output_done(self):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   923
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   924
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   925
        def ind_output(self):
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   926
                if self.ind_started != self.ind_phase:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   927
                        self.ind_started = self.ind_phase
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   928
                        gobject.idle_add(self.__stages_label_set_markup, self.ind_phase)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   929
                        self.__g_update_details_text(
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   930
                            _("%s\n") % (self.ind_phase), "level1")
510
35ac691b5187 3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 483
diff changeset
   931
                gobject.idle_add(self.__indexing_progress)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   932
510
35ac691b5187 3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 483
diff changeset
   933
        def __indexing_progress(self):
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   934
                #It doesn't look nice if the progressive is just for few elements
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   935
                if self.ind_goal_nitems > MIN_IND_ELEMENTS_BOUNCE:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   936
                        gobject.idle_add(self.__update_install_progress, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   937
                            self.ind_cur_nitems-1, self.ind_goal_nitems)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   938
                else:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   939
                        if self.stopped_bouncing_progress:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   940
                                self.__start_bouncing_progress()
510
35ac691b5187 3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 483
diff changeset
   941
                        
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   942
        def ind_output_done(self):
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   943
                gobject.idle_add(self.__update_install_progress, self.ind_cur_nitems, 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   944
                    self.ind_goal_nitems)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   945
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   946
        def ver_output(self): 
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   947
                return
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   948
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   949
        def ver_output_error(self, actname, errors): 
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   950
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   951
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 460
diff changeset
   952
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   953
        def get_datetime(date_time):
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   954
                '''Support function for getting date from the API.'''
647
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   955
                date_tmp = None
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   956
                try:
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   957
                        date_tmp = time.strptime(date_time, "%a %b %d %H:%M:%S %Y")
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   958
                except ValueError:
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   959
                        return None
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   960
                if date_tmp:
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   961
                        date_tmp2 = datetime.datetime(*date_tmp[0:5])        
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   962
                        return date_tmp2.strftime(":%m%d")
be0aec1c0910 4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 641
diff changeset
   963
                return None
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   964
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   965
        def __installed_fmris_from_args(self, args_f):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   966
                found = []
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   967
                notfound = []
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   968
                try:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   969
                        for m in self.api_o.img.inventory(args_f):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   970
                                found.append(m[0])
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   971
                except api_errors.InventoryException, e:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   972
                        notfound = e.notfound
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   973
                return notfound
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   974