src/packagemanager.py
author Tim Foster <tim.s.foster@oracle.com>
Thu, 06 Dec 2012 11:37:29 -0800
branchs11-update
changeset 2835 da6a9b1e5489
parent 2493 5db1603f0c3f
child 2938 1d287dc7a674
permissions -rw-r--r--
15955841 change UPDATENUM for s11.2 15875724 pylint update broke the build
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1512
diff changeset
     1
#!/usr/bin/python2.6
424
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
#
2223
2da8c49e53dc 17735 build should use custom pkglintrc to locate proto version of opensolaris.org.sections
Tim Foster <tim.s.foster@oracle.com>
parents: 2162
diff changeset
    22
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    23
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    24
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    25
NOTEBOOK_PACKAGE_LIST_PAGE = 0            # Main Package List page index
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    26
NOTEBOOK_START_PAGE = 1                   # Main View Start page index
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
    27
INFO_NOTEBOOK_DEPENDENCIES_PAGE = 2       # Dependencies Tab index
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
    28
INFO_NOTEBOOK_LICENSE_PAGE = 3            # License Tab index
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
    29
INFO_NOTEBOOK_VERSIONS_PAGE = 4           # Versions Tab index
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
    30
PM_LAUNCH_OPEN_CMD = "pm-launch: OPEN:"   # Command to tell pm-launch to open link.
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
    31
PUBLISHER_ALL = 0                         # Index for "All Publishers" string
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
    32
PUBLISHER_INSTALLED = 1                   # Index for "All Installed Packages" string
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
    33
PUBLISHER_ALL_SEARCH = 2                  # Index for "All Publishers (Search)" string
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
    34
PUBLISHER_ADD = 3                         # Index for "Add..." string
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
    35
SHOW_INFO_DELAY = 100       # Delay before showing selected package information
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
    36
SHOW_DEPENDENCIES_DELAY = 100 # Delay before showing selected package dependencies
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
    37
SHOW_LICENSE_DELAY = 100    # Delay before showing license information
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
    38
SHOW_VERSIONS_DELAY = 100    # Delay before showing versions information
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
    39
RESIZE_DELAY = 600          # Delay before handling resize for startpage
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
    40
INC_RESULTS_DELAY = 800    # Delay before updating incremental search results
1074
f6b6a4290aa2 8335 Search All Repositories should match CLI default search behavior
John Rice <john.rice@sun.com>
parents: 1071
diff changeset
    41
SEARCH_STR_FORMAT = "<%s>"
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
    42
MIN_APP_WIDTH = 750                       # Minimum application width
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
    43
MIN_APP_HEIGHT = 500                      # Minimum application height
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
    44
SECTION_ID_OFFSET = 10000                 # Offset to allow Sections to be identified 
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
    45
                                          # in category tree
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    46
RECENT_SEARCH_ID_OFFSET = 10999           # Offset to allow Recent Search Sections
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    47
                                          # to be identified in category tree
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    48
RECENT_SEARCH_ID = RECENT_SEARCH_ID_OFFSET + 1 #  Recent Search Section ID
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    49
CATEGORY_TOGGLE_ICON_WIDTH = 16           # Width of category toggle icon
924
500d7c30cac7 7049 Accessible descriptions for images in "Status" column broken by rev 882
Padraig O'Briain <padraig.obriain@sun.com>
parents: 917
diff changeset
    50
STATUS_COLUMN_INDEX = 2   # Index of Status Column in Application TreeView
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
    51
GDK_2BUTTON_PRESS = 5     # gtk.gdk._2BUTTON_PRESS causes pylint warning
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
    52
GDK_RIGHT_BUTTON = 3      # normally button 3 = right click
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
    53
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
    54
VIEW_COMBOBOX_WIDTH_PADDING = 72   # Padding for View combobox, icon, spacing and dropdown
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
    55
VIEW_COMBOBOX_MIN_WIDTH = 143      # Min width for View combobox, 10pt default font
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
    56
VIEW_COMBOBOX_MAX_WIDTH = 312      # Max width for View combobox, 20pt default font
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
    57
PUBLISHER_VIEW_MIN_PADDING = 25    # Min space between Publisher and View comboboxes
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
    58
1164
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1160
diff changeset
    59
# Location for themable icons
1187
4ce20ffb5515 9680 PACKAGE_MANAGER_ROOT ignored for icon_theme search path
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1183
diff changeset
    60
ICON_LOCATION = "usr/share/package-manager/icons"
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    61
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    62
import getopt
1028
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
    63
import pwd
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    64
import os
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    65
import sys
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    66
import time
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    67
import locale
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
    68
import itertools
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
    69
import socket
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    70
import gettext
830
687f8a73665e 6019 ctrl-c hangs packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 827
diff changeset
    71
import signal
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    72
import re
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    73
from xml.sax import saxutils
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    74
from threading import Thread
1981
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
    75
from gettext import ngettext
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    76
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    77
try:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    78
        import gobject
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    79
        import gnome
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    80
        gobject.threads_init()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    81
        import gtk
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    82
        import gtk.glade
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
    83
        import pygtk
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
    84
        pygtk.require("2.0")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
    85
except ImportError:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    86
        sys.exit(1)
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
    87
import pkg.misc as misc
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    88
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
    89
import pkg.client.api_errors as api_errors
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    90
import pkg.client.api as api
2387
6a57682e2017 18436 PM making invalid assumptions about preferred pub
John Rice <john.rice@oracle.com>
parents: 2377
diff changeset
    91
import pkg.client.publisher as publisher
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
    92
import pkg.portable as portable
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
    93
import pkg.fmri as fmri
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
    94
import pkg.nrlock as nrlock
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
    95
import pkg.gui.beadmin as beadm
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
    96
import pkg.gui.cache as cache
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
    97
import pkg.gui.detailspanel as detailspanel
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
    98
import pkg.gui.entrystyle as entrystyle
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
    99
import pkg.gui.enumerations as enumerations
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   100
import pkg.gui.exportconfirm as exportconfirm
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   101
import pkg.gui.globalexceptionhandler as globalexceptionhandler
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   102
import pkg.gui.imageinfo as imageinfo
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   103
import pkg.gui.installupdate as installupdate
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   104
import pkg.gui.misc as gui_misc
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   105
import pkg.gui.pmgconf as gconf
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   106
import pkg.gui.pmlogging as logging
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   107
import pkg.gui.preferences as preferences
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   108
import pkg.gui.repository as repository
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   109
import pkg.gui.searcherror as searcherror
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   110
import pkg.gui.startpage as startpage
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
   111
import pkg.gui.webinstall as webinstall
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   112
import pkg.gui.versioninfo as versioninfo
576
6ee6de304041 3777 PKG_TIMEOUT_MAX is a placebo setting
Dan Price <dp@eng.sun.com>
parents: 565
diff changeset
   113
from pkg.client import global_settings
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   114
1650
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   115
logger = global_settings.logger
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   116
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   117
# Put _() in the global namespace
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   118
import __builtin__
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   119
__builtin__._ = gettext.gettext
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
   120
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   121
REGEX_STRIP_MARKUP = re.compile(r'<.*?>')
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   122
REGEX_STRIP_RESULT = re.compile(r'\(\d+\) ?')
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   123
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   124
class PackageManager:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   125
        def __init__(self, title):
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   126
                self.allow_links = False
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   127
                self.program_title = title
830
687f8a73665e 6019 ctrl-c hangs packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 827
diff changeset
   128
                signal.signal(signal.SIGINT, self.__main_application_quit)
1871
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
   129
                self.is_admin = portable.is_admin()
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
   130
                self.user_rights = True
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
   131
                self.api_lock = nrlock.NRLock()
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   132
                self.__reset_home_dir()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   133
                self.api_o = None
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
   134
                self.cache_o = None
1862
b69dc275eb38 14649 Package Manager does not terminate cleanly after unexpected error
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1860
diff changeset
   135
                self.child = None
1058
11da4bffbd61 8186 Mixing the pkg(1) and GUI commands causes wrong pkg states in the GUI.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1056
diff changeset
   136
                self.img_timestamp = None
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   137
                self.gconf = gconf.PMGConf()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   138
                self.set_section = 0
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
   139
                self.after_install_remove = False
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   140
                self.in_search_mode = False
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
   141
                self.search_results_id = 0
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
   142
                self.search_results = []
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   143
                self.in_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   144
                self.recent_searches = {}
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   145
                self.recent_searches_cat_iter = None
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   146
                self.adding_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   147
                self.recent_searches_list = []
1790
5733e097d823 14712 Search in all publishers causes traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1789
diff changeset
   148
                self.previous_search_text = None
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   149
                
1650
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   150
                global_settings.client_name = gui_misc.get_pm_name()
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1187
diff changeset
   151
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1187
diff changeset
   152
                # This call only affects sockets created by Python.  The
1218
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   153
                # transport framework uses the defaults in global_settings,
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   154
                # which may be overridden in the environment.  The default
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   155
                # socket module should only be used in rare cases by ancillary
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   156
                # code, making it safe to code the value here, at least for now.
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   157
                socket.setdefaulttimeout(30) # in secs
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   158
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   159
                try:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   160
                        self.application_dir = os.environ["PACKAGE_MANAGER_ROOT"]
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   161
                except KeyError:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   162
                        self.application_dir = "/"
791
123e9401e939 5778 Inability to set locale leads to stack trace
Danek Duvall <danek.duvall@sun.com>
parents: 781
diff changeset
   163
                misc.setlocale(locale.LC_ALL, "")
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   164
                for module in (gettext, gtk.glade):
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   165
                        module.bindtextdomain("pkg", os.path.join(
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   166
                            self.application_dir,
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   167
                            "usr/share/locale"))
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   168
                        module.textdomain("pkg")
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
   169
                gui_misc.init_for_help(self.application_dir)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   170
                self.startpage = startpage.StartPage(self, self.application_dir)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   171
                self.gdk_window = None
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   172
                self.cancelled = False                    # For background processes
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
   173
                self.image_directory = None
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   174
                gtk.rc_parse('~/.gtkrc-1.2-gnome2')       # Load gtk theme
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   175
                self.progress_stop_thread = True
2014
b9f69c3999d5 16738 Package Manager displays busy cursor indefinitely
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2013
diff changeset
   176
                self.progress_thread_stopped = True
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
   177
                self.update_all_proceed = False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   178
                self.application_path = None
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
   179
                self.default_publisher = None
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   180
                self.current_repos_with_search_errors = []
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
   181
                self.exiting = False
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   182
                self.first_run = True
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
   183
                self.info_pkgstem = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
   184
                self.dependencies_pkgstem = None
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
   185
                self.license_pkgstem = None
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
   186
                self.versions_pkgstem = None
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
   187
                self.selected_pkg_name = None
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
   188
                self.selected_pkg_pub = None
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   189
                self.selected_pkgstem = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   190
                self.selected_model = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   191
                self.selected_path = None
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   192
                self.all_selected = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   193
                self.selected_pkgs = {}
1744
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
   194
                self.package_names = {}
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
   195
                self.special_package_names = []
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   196
                self.to_install_update = {}
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   197
                self.to_remove = {}
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   198
                self.in_startpage_startup = self.gconf.show_startpage
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
   199
                self.visible_status_id = 0
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
   200
                self.same_publisher_on_setup = False
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
   201
                self.force_reload_packages = True
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   202
                self.icon_theme = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   203
                self.installed_icon = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   204
                self.not_installed_icon = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   205
                self.update_available_icon = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   206
                self.window_icon = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   207
                self.filter_options = []
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   208
                self.__setup_theme_icons()
1246
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
   209
                self.publisher_options = { 
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   210
                    PUBLISHER_ALL : _("All Publishers"),
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   211
                    PUBLISHER_INSTALLED : _("All Installed Packages"),
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   212
                    PUBLISHER_ALL_SEARCH : _("All Publishers (Search)"),
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   213
                    PUBLISHER_ADD : _("Add...")
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   214
                    }
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   215
                self.max_filter_length = 0
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
   216
                self.pubs_info = {}
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
   217
                self.pubs_display_name = {}
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   218
                self.last_visible_publisher = None
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   219
                self.publisher_changed = True
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   220
                self.search_start = 0
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   221
                self.search_time_sec = 0
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   222
                self.publisher_being_searched = None
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
   223
                self.section_list = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   224
                self.filter_list = self.__get_new_filter_liststore()
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   225
                self.length_visible_list = 0
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   226
                self.application_list = None
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
   227
                self.a11y_application_treeview = None
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
   228
                self.application_treeview_range = None
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
   229
                self.application_treeview_initialized = False
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   230
                self.application_select_column = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   231
                self.category_list = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   232
                self.repositories_list = None
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   233
                self.repo_combobox_all_pubs_index = 0
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   234
                self.repo_combobox_all_pubs_installed_index = 0
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   235
                self.repo_combobox_all_pubs_search_index = 0
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   236
                self.repo_combobox_add_index = 0
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   237
                self.pr = progress.NullProgressTracker()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
   238
                self.pylintstub = None
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   239
                self.category_expanded_paths = {}
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   240
                self.category_active_paths = {}
1650
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   241
                self.error_logged = False
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   242
                
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   243
                # Create Widgets and show gui
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   244
                self.builder = gtk.Builder()
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   245
                self.gladefile = os.path.join(self.application_dir,
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   246
                    "usr/share/package-manager/packagemanager.ui")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   247
                self.builder.add_from_file(self.gladefile)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   248
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   249
                self.w_main_window = self.builder.get_object("mainwindow")
1446
72569184fd0d 9868 Package Manager and Update Manager should not define icons in glade files
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1443
diff changeset
   250
                self.w_main_window.set_icon(self.window_icon)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   251
                self.w_main_hpaned = self.builder.get_object("main_hpaned")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   252
                self.w_main_vpaned = self.builder.get_object("main_vpaned")
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   253
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   254
                self.w_publisher_combobox_hbox = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   255
                    self.builder.get_object("publisher_combobox_hbox")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   256
                self.w_view_combobox_hbox =  self.builder.get_object("view_combobox_hbox")
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   257
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   258
                self.w_application_treeview = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   259
                    self.builder.get_object("applicationtreeview")
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   260
                self.w_application_treeview.set_enable_search(True)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   261
                self.w_application_treeview.set_search_equal_func(
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   262
                      self.__applicationtreeview_compare_func)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   263
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   264
                self.w_categories_treeview = self.builder.get_object("categoriestreeview")
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   265
                self.w_categories_treeview.set_search_equal_func(
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   266
                    self.__categoriestreeview_compare_func)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   267
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   268
                self.w_info_notebook = self.builder.get_object("details_notebook")
1657
f3c0aa5f3998 13478 Startup package is not shown completely
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1650
diff changeset
   269
                self.w_startpage_scrolled_window = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   270
                    self.builder.get_object("startpage_scrolled_window")
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   271
                self.w_startpage_eventbox = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   272
                    self.builder.get_object("startpage_eventbox")
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   273
                self.w_startpage_eventbox.modify_bg(gtk.STATE_NORMAL,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   274
                    gtk.gdk.color_parse("white"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   275
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   276
                self.w_main_statusbar = self.builder.get_object("statusbar")
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   277
                #Allow markup in StatusBar
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   278
                self.w_main_statusbar_label = \
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   279
                        gui_misc.get_statusbar_label(self.w_main_statusbar)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   280
                if self.w_main_statusbar_label:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   281
                        self.w_main_statusbar_label.set_use_markup(True) 
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   282
    
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   283
                self.w_statusbar_hbox = self.builder.get_object("statusbar_hbox")
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   284
                self.w_logalert_frame = self.builder.get_object("logalert_frame")
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   285
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   286
                self.w_progress_frame = self.builder.get_object("progress_frame")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   287
                self.w_status_progressbar = self.builder.get_object("status_progressbar")
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   288
                self.w_status_progressbar.set_pulse_step(0.1)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   289
                self.w_progress_frame.hide()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   290
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   291
                self.w_main_view_notebook = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   292
                    self.builder.get_object("main_view_notebook")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   293
                self.w_searchentry = self.builder.get_object("searchentry")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   294
                self.w_searchentry.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   295
                    _("Type text to search for the package."))
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   296
                self.entrystyle = entrystyle.EntryStyle(self.w_searchentry)
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   297
                self.search_completion = gtk.ListStore(str)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   298
                self.w_package_menu = self.builder.get_object("package_menu")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   299
                self.w_reload_button = self.builder.get_object("reload_button")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   300
                self.w_reload_button.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   301
                    _("Refresh list of packages and package status")) 
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   302
                self.w_installupdate_button = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   303
                    self.builder.get_object("install_update_button")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   304
                self.w_installupdate_button.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   305
                    _("Select packages by marking the checkbox and click "
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   306
                      "to Install/Update"))
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   307
                self.w_remove_button = self.builder.get_object("remove_button")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   308
                self.w_remove_button.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   309
                    _("Select packages by marking the checkbox and click "
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   310
                      "to Remove selected")) 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   311
                self.w_updateall_button = self.builder.get_object("update_all_button")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   312
                self.w_updateall_button.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   313
                    _("Checks if updates are available")) 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   314
                self.w_repository_combobox = self.builder.get_object("repositorycombobox")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   315
                self.w_filter_combobox = self.builder.get_object("filtercombobox")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   316
                self.w_packageicon_image = self.builder.get_object("packageimage")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   317
                self.w_reload_menuitem = self.builder.get_object("file_reload")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   318
                gui_misc.set_icon_for_button_and_menuitem('pm-refresh',
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   319
                    self.w_reload_button, self.w_reload_menuitem)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   320
                self.w_version_info_menuitem = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   321
                    self.builder.get_object("package_version_info")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   322
                self.__set_image_for_menuitem(self.w_version_info_menuitem,
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   323
                    gtk.STOCK_INFO)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   324
                self.w_version_info_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   325
                self.w_installupdate_menuitem = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   326
                    self.builder.get_object("package_install_update")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   327
                gui_misc.set_icon_for_button_and_menuitem('pm-install_update',
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   328
                    self.w_installupdate_button, self.w_installupdate_menuitem)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   329
                self.w_remove_menuitem = self.builder.get_object("package_remove")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   330
                gui_misc.set_icon_for_button_and_menuitem('pm-remove',
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   331
                    self.w_remove_button, self.w_remove_menuitem)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   332
                self.w_updateall_menuitem = self.builder.get_object("package_update_all")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   333
                gui_misc.set_icon_for_button_and_menuitem('pm-update_all',
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   334
                    self.w_updateall_button, self.w_updateall_menuitem)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   335
                self.w_quit_menuitem = self.builder.get_object("file_quit")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   336
                self.w_be_menuitem = self.builder.get_object("file_be")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   337
                self.w_export_selections_menuitem = self.builder.get_object(
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   338
                    "file_export_selections")
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   339
                self.w_manage_publishers_menuitem = self.builder.get_object(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   340
                    "file_manage_publishers")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   341
                self.w_add_publisher_menuitem = self.builder.get_object(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   342
                    "file_add_publisher")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   343
                self.w_cut_menuitem = self.builder.get_object("edit_cut")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   344
                self.w_copy_menuitem = self.builder.get_object("edit_copy")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   345
                self.w_paste_menuitem = self.builder.get_object("edit_paste")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   346
                self.w_delete_menuitem = self.builder.get_object("edit_delete")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   347
                self.w_selectall_menuitem = self.builder.get_object("edit_select_all")
2451
18f988696ff8 18668 packagemanager.ui could use gtk-help for menu bar rather than having local "_Help"
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2446
diff changeset
   348
                help_stock_item = gtk.stock_lookup("gtk-help")
18f988696ff8 18668 packagemanager.ui could use gtk-help for menu bar rather than having local "_Help"
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2446
diff changeset
   349
                if help_stock_item:
18f988696ff8 18668 packagemanager.ui could use gtk-help for menu bar rather than having local "_Help"
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2446
diff changeset
   350
                        help_menu_item =  self.builder.get_object("help")
18f988696ff8 18668 packagemanager.ui could use gtk-help for menu bar rather than having local "_Help"
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2446
diff changeset
   351
                        help_menu_item.set_label(help_stock_item[1])
18f988696ff8 18668 packagemanager.ui could use gtk-help for menu bar rather than having local "_Help"
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2446
diff changeset
   352
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   353
                self.w_selectupdates_menuitem = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   354
                    self.builder.get_object("edit_select_updates")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   355
                self.w_deselect_menuitem = self.builder.get_object("edit_deselect")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   356
                self.w_clear_search_menuitem = self.builder.get_object("clear")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   357
                self.__set_image_for_menuitem(self.w_clear_search_menuitem,
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   358
                    gtk.STOCK_CLEAR)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   359
                self.w_help_about_menuitem = self.builder.get_object("help_about")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   360
                self.w_online_help_menuitem = self.builder.get_object("online_help")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   361
                self.__set_image_for_menuitem(self.w_online_help_menuitem,
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   362
                    gtk.STOCK_HELP)
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   363
                self.w_main_clipboard =  gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   364
                self.saved_filter_combobox_active = self.gconf.initial_show_filter
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   365
                self.search_button = self.builder.get_object("do_search")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   366
                self.search_button.set_tooltip_text(_("Search"))
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   367
                self.w_search_menuitem = self.builder.get_object("search")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   368
                self.__set_image_for_menuitem(self.w_search_menuitem,
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   369
                    gtk.STOCK_FIND)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   370
                self.w_gotolist_menuitem = self.builder.get_object("gotolist")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   371
                self.w_edit_preferences_menuitem = self.builder.get_object(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   372
                    "edit_preferences")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   373
                self.w_log_menuitem = self.builder.get_object("log")
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   374
                self.w_logalert_eventbox = self.builder.get_object(
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   375
                    "logalert_eventbox")
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   376
                self.progress_cancel = self.builder.get_object("progress_cancel")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   377
                self.progress_cancel.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   378
                    _("Cancel current operation"))
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   379
                self.is_all_publishers = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   380
                self.is_all_publishers_installed = False
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   381
                self.is_all_publishers_search = False
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   382
                self.saved_repository_combobox_active = -1
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   383
                self.saved_section_active = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   384
                self.saved_application_list = None
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
   385
                self.saved_application_list_filter = None
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
   386
                self.saved_application_list_sort = None
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   387
                self.saved_category_list = None
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   388
                self.saved_section_list = None
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   389
                self.section_categories_list = {}
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   390
                self.statusbar_message_id = 0
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   391
                toolbar =  self.builder.get_object("toolbutton2")
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
   392
                toolbar.set_expand(True)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   393
                self.detailspanel = detailspanel.DetailsPanel(self, self.builder)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   394
                self.exportconfirm = exportconfirm.ExportConfirm(self.builder,
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   395
                    self.window_icon, self.gconf, self)
2377
8e97dd53f9e4 18351 Logging broken with local repository
John Rice <john.rice@oracle.com>
parents: 2354
diff changeset
   396
                is_normal_logging_setup = gui_misc.setup_logging()
8e97dd53f9e4 18351 Logging broken with local repository
John Rice <john.rice@oracle.com>
parents: 2354
diff changeset
   397
                self.logging = logging.PMLogging(self.builder, self.window_icon,
8e97dd53f9e4 18351 Logging broken with local repository
John Rice <john.rice@oracle.com>
parents: 2354
diff changeset
   398
                    is_normal_logging_setup)
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
   399
                self.preferences = preferences.Preferences(self, self.builder,
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   400
                    self.window_icon, self.gconf)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   401
                self.searcherror = searcherror.SearchError(self.builder,
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   402
                    self.gconf, self)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   403
                self.versioninfo = versioninfo.VersionInfo(self.builder, self)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   404
                self.__init_repository_tree_view()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   405
                self.w_main_window.set_title(self.program_title)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   406
2061
7ccedb519372 16938 Unnecessary loading of startpage html
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2052
diff changeset
   407
                if self.gconf.show_startpage:
7ccedb519372 16938 Unnecessary loading of startpage html
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2052
diff changeset
   408
                        self.__setup_startpage(self.gconf.show_startpage)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   409
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   410
                self.__setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   411
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   412
                self.installupdate = None
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   413
                self.package_selection = None
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
   414
                self.application_list_filter = None
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   415
                self.application_list_sort = None
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   416
                self.application_refilter_id = 0
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
   417
                self.last_status_id = 0
1014
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
   418
                self.last_show_info_id = 0
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   419
                self.show_info_id = 0
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
   420
                self.last_show_dependencies_id = 0
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
   421
                self.show_dependencies_id = 0
1014
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
   422
                self.last_show_licenses_id = 0
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   423
                self.show_licenses_id = 0
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
   424
                self.last_show_versions_id = 0
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
   425
                self.show_versions_id = 0
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
   426
                self.resize_id = 0
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
   427
                self.last_resize = (0, 0)
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
   428
                self.in_setup = True
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   429
                self.__set_initial_sizes()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   430
                self.w_main_window.show_all()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   431
                self.__setup_busy_cursor()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   432
                if self.gconf.show_startpage:
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
   433
                        self.__setup_notebook_page_view()
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   434
                else:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   435
                        self.w_main_view_notebook.set_current_page(
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   436
                            NOTEBOOK_PACKAGE_LIST_PAGE)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   437
                self.logging.set_modal_and_transient(self.w_main_window)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   438
                self.preferences.set_modal_and_transient(self.w_main_window)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   439
                self.searcherror.set_modal_and_transient(self.w_main_window)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   440
                self.versioninfo.set_modal_and_transient(self.w_main_window)
1671
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   441
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   442
                self.__setup_text_signals()
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
   443
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   444
                # Theme: prevent cell background being set for Inverse themes
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   445
                self.is_inverse_theme = False
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   446
                self.theme_name = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   447
                self.__setup_theme_properties()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   448
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   449
        @staticmethod
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   450
        def __set_image_for_menuitem(widget, stock_id):
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   451
                image_widget = gtk.image_new_from_stock(stock_id,
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   452
                    gtk.ICON_SIZE_MENU)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   453
                widget.set_image(image_widget)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   454
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   455
        def __setup_signals(self):
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   456
                ''' Setup signals required for widgets in Package Manager main
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   457
                view which are got from GtkBuilder'''
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   458
                signals_table = [
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   459
                    (self.w_main_window, "delete_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   460
                     self.__on_mainwindow_delete_event),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   461
                     (self.w_main_window, "check_resize", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   462
                     self.__on_mainwindow_check_resize),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   463
                     (self.w_main_window, "key_press_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   464
                     self.__on_mainwindow_key_press_event),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   465
                     (self.w_main_window, "style_set", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   466
                     self.__on_mainwindow_style_set),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   467
                     (self.w_searchentry, "changed", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   468
                     self.__on_searchentry_changed),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   469
                     (self.w_searchentry, "focus_in_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   470
                     self.__on_searchentry_focus_in),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   471
                     (self.w_searchentry, "focus_out_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   472
                     self.__on_searchentry_focus_out),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   473
                     (self.w_searchentry, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   474
                     self.__do_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   475
                     (self.w_searchentry, "icon_press", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   476
                     self.__on_clear_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   477
                     (self.w_filter_combobox, "changed", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   478
                     self.__on_filtercombobox_changed),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   479
                     (self.w_repository_combobox, "changed", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   480
                     self.__on_repositorycombobox_changed),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   481
                     (self.w_export_selections_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   482
                     self.__on_file_export_selections),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   483
                     (self.w_quit_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   484
                     self.__on_file_quit_activate),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   485
                     (self.w_be_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   486
                     self.__on_file_be_activate),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   487
                     (self.w_version_info_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   488
                     self.__on_version_info),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   489
                     (self.w_installupdate_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   490
                     self.__on_install_update),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   491
                     (self.w_manage_publishers_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   492
                     self.__on_file_manage_publishers),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   493
                     (self.w_add_publisher_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   494
                     self.__on_file_add_publisher),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   495
                     (self.w_remove_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   496
                     self.__on_remove),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   497
                     (self.w_help_about_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   498
                     self.__on_help_about),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   499
                     (self.w_online_help_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   500
                     self.__on_help_help),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   501
                     (self.w_paste_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   502
                     self.__on_edit_paste),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   503
                     (self.w_delete_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   504
                     self.__on_delete),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   505
                     (self.w_copy_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   506
                     self.__on_copy),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   507
                     (self.w_cut_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   508
                     self.__on_cut),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   509
                     (self.w_search_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   510
                     self.__on_edit_search_clicked),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   511
                     (self.w_gotolist_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   512
                     self.__on_goto_list_clicked),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   513
                     (self.w_clear_search_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   514
                     self.__on_clear_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   515
                     (self.search_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   516
                     self.__do_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   517
                     (self.search_button, "button_press_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   518
                     self.__do_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   519
                     (self.progress_cancel, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   520
                     self.__on_progress_cancel_clicked),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   521
                     (self.w_selectall_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   522
                     self.__on_select_all),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   523
                     (self.w_selectupdates_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   524
                     self.__on_select_updates),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   525
                     (self.w_deselect_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   526
                     self.__on_deselect),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   527
                     (self.w_edit_preferences_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   528
                     self.__on_preferences),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   529
                     (self.w_log_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   530
                     self.__on_log_activate),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   531
                     (self.w_updateall_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   532
                     self.__on_update_all),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   533
                     (self.w_updateall_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   534
                     self.__on_update_all),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   535
                     (self.w_reload_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   536
                     self.__on_reload),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   537
                     (self.w_reload_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   538
                     self.__on_reload),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   539
                     (self.w_installupdate_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   540
                     self.__on_install_update),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   541
                     (self.w_remove_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   542
                     self.__on_remove),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   543
                     (self.w_info_notebook, "switch_page", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   544
                     self.__on_notebook_change),
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   545
                     (self.w_logalert_eventbox, "button_press_event",
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   546
                     self.__on_logalert_button_press_event),
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   547
                     (self.w_application_treeview, "button_press_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   548
                     self.__on_applicationtreeview_button_and_key_events),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   549
                     (self.w_application_treeview, "key_press_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   550
                     self.__on_applicationtreeview_button_and_key_events),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   551
                     (self.w_application_treeview, "query_tooltip", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   552
                     self.__on_applicationtreeview_query_tooltip),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   553
                    ]
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   554
                for widget, signal_name, callback in signals_table:
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   555
                        widget.connect(signal_name, callback)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   556
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   557
                self.exportconfirm.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   558
                self.logging.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   559
                self.preferences.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   560
                self.searcherror.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   561
                self.versioninfo.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   562
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   563
        def __setup_theme_properties(self):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   564
                s = gtk.settings_get_default()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   565
                self.theme_name = s.get_property("gtk-theme-name")
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   566
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   567
                # Theme: set correct Text fg colour for theme in the Search Entry Field
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   568
                style = self.w_application_treeview.get_style().copy()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   569
                self.entrystyle.set_theme_colour(style.fg[gtk.STATE_NORMAL])
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   570
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   571
                if self.theme_name == "HighContrastInverse" or \
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   572
                        self.theme_name == "HighContrastLargePrintInverse":
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   573
                        self.is_inverse_theme = True
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   574
                else:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   575
                        self.is_inverse_theme = False
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   576
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
   577
        def __setup_notebook_page_view(self):
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
   578
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
   579
                self.w_selectall_menuitem.set_sensitive(False)
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
   580
                self.w_deselect_menuitem.set_sensitive(False)
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
   581
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   582
        def __set_initial_sizes(self):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   583
                if self.gconf.initial_app_width >= MIN_APP_WIDTH and \
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   584
                        self.gconf.initial_app_height >= MIN_APP_HEIGHT:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   585
                        self.w_main_window.resize(self.gconf.initial_app_width,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   586
                            self.gconf.initial_app_height)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   587
                if self.gconf.initial_app_hpos > 0:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   588
                        self.w_main_hpaned.set_position(self.gconf.initial_app_hpos)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   589
                if self.gconf.initial_app_vpos > 0:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   590
                        self.w_main_vpaned.set_position(self.gconf.initial_app_vpos)
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   591
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   592
        def __setup_busy_cursor(self):
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   593
                gdk_win = self.w_main_window.get_window()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   594
                self.gdk_window = gtk.gdk.Window(gdk_win, gtk.gdk.screen_width(),
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   595
                    gtk.gdk.screen_height(), gtk.gdk.WINDOW_CHILD, 0, gtk.gdk.INPUT_ONLY)
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   596
                gdk_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   597
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   598
                self.gdk_window.set_cursor(gdk_cursor)
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   599
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   600
        def __on_file_export_selections(self, menuitem):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   601
                self.exportconfirm.activate(self.selected_pkgs)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   602
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   603
        def __on_mainwindow_style_set(self, widget, previous_style):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   604
                if self.first_run:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   605
                        return
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   606
                self.last_resize = -1
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   607
                # Theme: setup Theme properties
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   608
                self.__setup_theme_properties()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   609
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   610
                # Theme: setup icons for Theme
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   611
                self.__setup_theme_icons()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   612
                self.__reset_view_icons()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   613
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   614
                # Theme: setup Dialog Icons for Theme
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   615
                self.w_main_window.set_icon(self.window_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   616
                self.exportconfirm.set_window_icon(self.window_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   617
                self.logging.set_window_icon(self.window_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   618
                self.preferences.set_window_icon(self.window_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   619
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   620
                # Theme: setup Main list Selection icon for Theme
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   621
                if self.application_select_column:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   622
                        self.application_select_column.set_widget(
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
   623
                            self.get_theme_selection_coloumn_image())
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   624
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   625
                # Theme: setup Main list status icons
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   626
                self.__reset_application_list_status_icons(self.application_list)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   627
                # Theme: saved application list is cached with old theme icons
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   628
                self.__reset_application_list_status_icons(self.saved_application_list)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   629
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   630
                #Theme: refresh Details icons if package selected
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   631
                if self.selected_pkgstem != None:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   632
                        self.__process_package_selection()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   633
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
   634
        def get_theme_selection_coloumn_image(self):
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   635
                select_image = gtk.Image()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   636
                select_image.set_from_pixbuf(gui_misc.get_icon(
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   637
                    self.icon_theme, 'selection'))
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   638
                select_image.set_tooltip_text(_("Click to toggle selections"))
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   639
                select_image.show()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   640
                return select_image
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   641
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   642
        def __setup_theme_icons(self):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   643
                self.icon_theme = gtk.icon_theme_get_default()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   644
                icon_location = os.path.join(self.application_dir, ICON_LOCATION)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   645
                self.icon_theme.append_search_path(icon_location)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   646
                self.installed_icon = gui_misc.get_icon(self.icon_theme,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   647
                    'status_installed')
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   648
                self.not_installed_icon = gui_misc.get_icon(self.icon_theme,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   649
                    'status_notinstalled')
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   650
                self.update_available_icon = gui_misc.get_icon(self.icon_theme,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   651
                    'status_newupdate')
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   652
                self.window_icon = gui_misc.get_icon(self.icon_theme,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   653
                    'packagemanager', 48)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   654
                self.filter_options = [
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   655
                    (enumerations.FILTER_ALL,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   656
                    gui_misc.get_icon(self.icon_theme, 'filter_all'),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   657
                    _('All Packages')),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   658
                    (enumerations.FILTER_INSTALLED, self.installed_icon,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   659
                    _('Installed Packages')),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   660
                    (enumerations.FILTER_UPDATES, self.update_available_icon,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   661
                    _('Updates')),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   662
                    (enumerations.FILTER_NOT_INSTALLED, self.not_installed_icon,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   663
                    _('Not Installed Packages')),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   664
                    (-1, None, ""),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   665
                    (enumerations.FILTER_SELECTED,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   666
                    gui_misc.get_icon(self.icon_theme, 'filter_selected'),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   667
                    _('Selected Packages'))
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   668
                    ]
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   669
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   670
        def __reset_application_list_status_icons(self, app_list):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   671
                if app_list == None or len(app_list) == 0:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   672
                        return                
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   673
                app_itr = app_list.get_iter_first()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   674
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   675
                while app_itr:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   676
                        status = app_list.get_value(app_itr, enumerations.STATUS_COLUMN)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   677
                        if status == api.PackageInfo.INSTALLED:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   678
                                app_list.set(app_itr, enumerations.STATUS_ICON_COLUMN,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   679
                                    self.installed_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   680
                        elif status == api.PackageInfo.KNOWN:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   681
                                app_list.set(app_itr, enumerations.STATUS_ICON_COLUMN,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   682
                                    self.not_installed_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   683
                        elif status == api.PackageInfo.UPGRADABLE:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   684
                                app_list.set(app_itr, enumerations.STATUS_ICON_COLUMN,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   685
                                    self.update_available_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   686
                        app_itr = app_list.iter_next(app_itr)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   687
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   688
        def __reset_view_icons(self):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   689
                filter_itr = self.filter_list.get_iter_first()                
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   690
                if filter_itr == None or \
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   691
                        len(self.filter_list) != len(self.filter_options):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   692
                        return
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   693
                max_length = 0
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   694
                for filter_id, pixbuf, label in self.filter_options:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   695
                        self.filter_list.set(filter_itr, enumerations.FILTER_ICON, pixbuf)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   696
                        filter_itr = self.filter_list.iter_next(filter_itr)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   697
                        if filter_id == -1:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   698
                                continue
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   699
                        max_length = gui_misc.get_max_text_length(
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   700
                            max_length, label, self.w_filter_combobox)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   701
                self.__setup_max_filter_length(max_length)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   702
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   703
        def __setup_max_filter_length(self, max_length):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   704
                if max_length < VIEW_COMBOBOX_MIN_WIDTH:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   705
                        self.max_filter_length = VIEW_COMBOBOX_MIN_WIDTH
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   706
                elif max_length > VIEW_COMBOBOX_MAX_WIDTH:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   707
                        self.max_filter_length = VIEW_COMBOBOX_MAX_WIDTH
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   708
                else:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   709
                        self.max_filter_length = max_length
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   710
                self.w_filter_combobox.set_size_request(
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   711
                    self.max_filter_length + VIEW_COMBOBOX_WIDTH_PADDING, -1)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   712
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   713
        def __set_search_text_mode(self, style):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   714
                self.entrystyle.set_search_text_mode(style)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   715
        
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   716
        def __search_completion_cb(self, entry):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   717
                text = entry.get_text()
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   718
                if text:
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   719
                        if text not in [row[0] for row in self.search_completion]:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   720
                                len_search_completion = len(self.search_completion)
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   721
                                if len_search_completion > 0 and \
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   722
                                        len_search_completion >= \
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   723
                                                self.gconf.max_search_completion:
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   724
                                        itr = self.search_completion.get_iter_first()
1233
32a432cffc1e 10118 PM Search UI adjustments to align with usability feedback (followup)
John Rice <john.rice@sun.com>
parents: 1232
diff changeset
   725
                                        if itr:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   726
                                                self.search_completion.remove(itr)
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   727
                                self.search_completion.append([text])
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   728
                return
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   729
                
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   730
        def __setup_text_signals(self):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   731
                self.detailspanel.setup_text_signals(
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   732
                    self.__on_text_buffer_has_selection,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   733
                    self.__on_textview_focus_in,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   734
                    self.__on_textview_focus_out)
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   735
                self.w_searchentry.connect(
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   736
                    "notify::cursor-position", self.__on_searchentry_selection)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   737
                self.w_searchentry.connect(
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   738
                    "notify::selection-bound", self.__on_searchentry_selection)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   739
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   740
        def __on_textview_focus_in(self, widget, event):
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   741
                char_count = widget.get_buffer().get_char_count()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   742
                if char_count > 0:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   743
                        self.w_selectall_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   744
                else:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   745
                        self.w_selectall_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   746
                bounds = widget.get_buffer().get_selection_bounds()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   747
                if bounds:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   748
                        offset1 = bounds[0].get_offset() 
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   749
                        offset2 = bounds[1].get_offset() 
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   750
                        if abs(offset2 - offset1) == char_count:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   751
                                self.w_selectall_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   752
                        self.w_deselect_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   753
                        self.w_copy_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   754
                else:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   755
                        self.w_deselect_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   756
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   757
        def __on_textview_focus_out(self, widget, event):
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   758
                self.__enable_disable_select_all()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   759
                self.__enable_disable_deselect()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   760
                self.w_copy_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   761
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
   762
        def __on_text_buffer_has_selection(self, obj, pspec):
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
   763
                if obj.get_selection_bounds():
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   764
                        self.w_copy_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   765
                        self.w_deselect_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   766
                else:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   767
                        self.w_copy_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   768
                        self.w_deselect_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   769
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   770
        def __set_all_publishers_search_mode(self):
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   771
                if self.is_all_publishers_search:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   772
                        return
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   773
                self.__setup_before_all_publishers_search_mode()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   774
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   775
        def __setup_startpage(self, show_startpage):
2061
7ccedb519372 16938 Unnecessary loading of startpage html
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2052
diff changeset
   776
                self.startpage.setup_startpage(show_startpage)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   777
                if show_startpage or self.gconf.start_insearch:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   778
                        self.w_main_view_notebook.set_current_page(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   779
                                NOTEBOOK_START_PAGE)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   780
                        if self.gconf.start_insearch:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   781
                                self.startpage.document.clear()
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   782
                else:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   783
                        self.w_main_view_notebook.set_current_page(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   784
                                NOTEBOOK_PACKAGE_LIST_PAGE)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   785
                self.w_startpage_scrolled_window.add(self.startpage.view)
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   786
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   787
        def __process_api_search_error(self, error):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   788
                self.current_repos_with_search_errors = []
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   789
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   790
                for pub, err in error.failed_servers:
2424
5ed178163286 18592 Error while searching in package manager in nfs repo
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2423
diff changeset
   791
                        logger.error(_("Publisher: %(o)s failed to respond\n%(msg)s") % \
5ed178163286 18592 Error while searching in package manager in nfs repo
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2423
diff changeset
   792
                            {"o": pub, "msg": err})
1671
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   793
                        gui_misc.notify_log_error(self)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   794
                for pub in error.invalid_servers:
2424
5ed178163286 18592 Error while searching in package manager in nfs repo
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2423
diff changeset
   795
                        logger.error(_("Publisher: %s: invalid response\n" 
5ed178163286 18592 Error while searching in package manager in nfs repo
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2423
diff changeset
   796
                            "A valid response was not returned.") % pub)
1671
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   797
                        gui_misc.notify_log_error(self)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   798
                for pub, err in error.unsupported_servers:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   799
                        self.current_repos_with_search_errors.append(
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   800
                            (pub, _("unsupported search"), err))
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   801
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   802
        def __on_logalert_button_press_event(self, widget, event):
1650
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   803
                if len(self.current_repos_with_search_errors) > 0:
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   804
                        self.__handle_api_search_error(True)
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   805
                        return
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   806
                if self.error_logged:
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   807
                        self.__on_log_activate(None)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   808
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   809
        def __handle_api_search_error(self, show_all=False):
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
   810
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
   811
                        return
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   812
                if len(self.current_repos_with_search_errors) == 0:
1671
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   813
                        if not self.error_logged:
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   814
                                self.w_logalert_frame.hide()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   815
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   816
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   817
                repo_count = 0
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   818
                for item in self.current_repos_with_search_errors:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   819
                        if show_all or (item[0] not in self.gconf.not_show_repos):
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   820
                                repo_count += 1
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   821
                if repo_count == 0:
1671
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   822
                        if not self.error_logged:
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   823
                                self.w_logalert_frame.hide()
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   824
                        return
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   825
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   826
                self.w_logalert_frame.set_tooltip_text(
1650
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   827
                    _("Search Errors: click to view"))
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   828
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
   829
                self.w_logalert_frame.show()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   830
                self.searcherror.display_search_errors(show_all)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   831
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   832
        def __get_publisher_combobox_index(self, pub_name):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   833
                index = -1
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   834
                model = self.w_repository_combobox.get_model()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   835
                for entry in model:
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
   836
                        if entry[enumerations.REPOSITORY_PREFIX] == pub_name:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   837
                                index = entry[enumerations.REPOSITORY_ID]
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   838
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   839
                return index
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   840
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   841
        def __handle_browse_publisher(self, index):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   842
                if index == -1:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   843
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   844
                self.w_repository_combobox.grab_focus()
1684
f9b304e6d6d7 14036 No busy cursor when switching publisher from Search page
John Rice <john.rice@sun.com>
parents: 1683
diff changeset
   845
                self.w_repository_combobox.set_active(index)
f9b304e6d6d7 14036 No busy cursor when switching publisher from Search page
John Rice <john.rice@sun.com>
parents: 1683
diff changeset
   846
                
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   847
        def handle_search_all_publishers(self):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   848
                term = self.previous_search_text
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   849
                self.__set_search_start()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   850
                self.is_all_publishers_installed = False
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   851
                self.is_all_publishers = False
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   852
                self.w_repository_combobox.set_active(
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   853
                    self.repo_combobox_all_pubs_search_index)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   854
                self.__set_search_text_mode(enumerations.SEARCH_STYLE_NORMAL)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   855
                self.w_searchentry.set_text(term)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   856
                gobject.idle_add(self.__do_search)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   857
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   858
        def handle_view_all_publishers_installed(self):
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   859
                self.w_filter_combobox.set_active(enumerations.FILTER_ALL)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   860
                self.__set_main_view_package_list()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   861
                self.update_statusbar()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   862
                
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   863
        def get_start_end_strings(self):
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   864
                if self.w_main_statusbar_label:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   865
                        s1 = "<b>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   866
                        e1 = "</b>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   867
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   868
                        s1 = e1 = '"'
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   869
                return s1, e1
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   870
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   871
        def browse_publisher(self, pub):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   872
                index = self.__get_publisher_combobox_index(pub)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   873
                gobject.idle_add(self.__handle_browse_publisher, index)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   874
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   875
        def goto_recent_search(self, recent_search):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   876
                category_tree = self.w_categories_treeview.get_model()
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   877
                if category_tree == None:
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   878
                        return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   879
                rs_iter = category_tree.iter_children(
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   880
                    self.recent_searches_cat_iter)
2279
b43ae7845f05 18058 Package Manager fails to display recent search results
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2248
diff changeset
   881
                rs_path = category_tree.get_path(self.recent_searches_cat_iter)
b43ae7845f05 18058 Package Manager fails to display recent search results
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2248
diff changeset
   882
                if not self.w_categories_treeview.row_expanded(rs_path):
b43ae7845f05 18058 Package Manager fails to display recent search results
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2248
diff changeset
   883
                        self.w_categories_treeview.expand_row(rs_path, False)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   884
                while rs_iter:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   885
                        rs_value = category_tree.get_value(rs_iter,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   886
                            enumerations.CATEGORY_VISIBLE_NAME)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   887
                        if rs_value == recent_search:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   888
                                path = category_tree.get_path(rs_iter)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   889
                                self.w_categories_treeview.set_cursor(path)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   890
                                self.w_categories_treeview.scroll_to_cell(path)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   891
                                return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   892
                        rs_iter = category_tree.iter_next(rs_iter)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   893
                return
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   894
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   895
        def set_view_all_packages(self):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   896
                self.w_filter_combobox.set_active(enumerations.FILTER_ALL)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   897
                self.w_filter_combobox.grab_focus()
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   898
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   899
        def invoke_webinstall(self, link):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   900
                self.set_busy_cursor()
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   901
                try:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   902
                        gobject.spawn_async([self.application_path, "-i", link])
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   903
                except gobject.GError:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   904
                        self.startpage.link_load_error(link)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   905
                        self.unset_busy_cursor()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   906
                        return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   907
                gobject.timeout_add(1500, self.unset_busy_cursor)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   908
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   909
        def open_link(self, link):
1750
1e1d2661ec8b 14422 New Firefox instances is executed as root by packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1744
diff changeset
   910
                self.set_busy_cursor()
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   911
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   912
                if not self.allow_links:
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   913
                        # Links not allowed.
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   914
                        self.startpage.link_load_error(link)
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   915
                        self.unset_busy_cursor()
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   916
                        return
1871
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
   917
                elif not self.is_admin:
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   918
                        # Not a privileged user? Show links directly.
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   919
                        try:
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   920
                                gnome.url_show(link)
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   921
                                gobject.timeout_add(1000,
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   922
                                    self.unset_busy_cursor)
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   923
                        except gobject.GError:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   924
                                self.startpage.link_load_error(link)
1757
06b64b8f7849 14528 PM Start Page install links should launch Webinstall directly
John Rice <john.rice@sun.com>
parents: 1750
diff changeset
   925
                                self.unset_busy_cursor()
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   926
                        return
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   927
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   928
                # XXX PackageManager shouldn't run as a privileged user!
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   929
                # Opening links relies on the packagemanager having been
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   930
                # launched by the pm-launch process.  The pm-launch process
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   931
                # monitors the output of its child process for special commands
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   932
                # such as the one used to below to launch links.  This causes
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   933
                # the pm-launch program to open this link as the original user
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   934
                # that executed pm-launch instead of as the current, privileged
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   935
                # user the packagemanager is likely running as.
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   936
                try:
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   937
                        # XXX There's no way to know if opening the link failed
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   938
                        # using this method; the assumption is that the user
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   939
                        # will be informed somehow by the launcher or browser.
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   940
                        print "%s%s" % (PM_LAUNCH_OPEN_CMD, link)
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   941
                        sys.stdout.flush()
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   942
                        gobject.timeout_add(1000, self.unset_busy_cursor)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   943
                except IOError, ex:
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   944
                        # Any exception from the above likely means that the
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   945
                        # link wasn't loaded.  For example, an IOError or
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   946
                        # some other exception might be raised if the launch
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   947
                        # process was killed.
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   948
                        self.startpage.link_load_error(link)
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   949
                        self.unset_busy_cursor()
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   950
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   951
                        # Log the error for post-mortem evaluation.
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   952
                        logger.error(str(ex))
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   953
                except Exception, ex:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   954
                        self.startpage.link_load_error(link)
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   955
                        self.unset_busy_cursor()
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
   956
                        logger.error(str(ex))
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   957
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   958
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   959
        def __get_new_application_liststore():
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   960
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   961
                        gobject.TYPE_BOOLEAN,     # enumerations.MARK_COLUMN
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   962
                        gtk.gdk.Pixbuf,           # enumerations.STATUS_ICON_COLUMN
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   963
                        gobject.TYPE_STRING,      # enumerations.NAME_COLUMN
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   964
                        gobject.TYPE_STRING,      # enumerations.DESCRIPTION_COLUMN
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   965
                        gobject.TYPE_INT,         # enumerations.STATUS_COLUMN
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   966
                        gobject.TYPE_STRING,      # enumerations.STEM_COLUMN
1799
b31d77bedd8c 14887 Package Version Info dialog doesn't work for uninstalled packages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1791
diff changeset
   967
                        gobject.TYPE_STRING,      # enumerations.ACTUAL_NAME_COLUMN
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   968
                        gobject.TYPE_BOOLEAN,     # enumerations.IS_VISIBLE_COLUMN
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   969
                        gobject.TYPE_PYOBJECT,    # enumerations.CATEGORY_LIST_COLUMN
1701
af78ac44dcc2 14199 Export Selections does not work if publisher has alias
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1700
diff changeset
   970
                        gobject.TYPE_STRING,      # enumerations.PUBLISHER_COLUMN
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
   971
                        gobject.TYPE_STRING,      # enumerations.PUBLISHER_PREFIX_COLUMN
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
   972
                        gobject.TYPE_BOOLEAN      # enumerations.RENAMED_COLUMN
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   973
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   974
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   975
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   976
        def __get_new_category_liststore():
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   977
                return gtk.TreeStore(
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   978
                        gobject.TYPE_INT,         # enumerations.CATEGORY_ID
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   979
                        gobject.TYPE_STRING,      # enumerations.CATEGORY_NAME
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
   980
                        gobject.TYPE_STRING,      # enumerations.CATEGORY_VISIBLE_NAME
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   981
                        gobject.TYPE_STRING,      # enumerations.CATEGORY_DESCRIPTION
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   982
                        gobject.TYPE_PYOBJECT,    # enumerations.SECTION_LIST_OBJECT
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
   983
                        gobject.TYPE_BOOLEAN,     # enumerations.CATEGORY_IS_VISIBLE
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   984
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   985
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   986
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   987
        def __get_new_section_liststore():
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   988
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   989
                        gobject.TYPE_INT,         # enumerations.SECTION_ID
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   990
                        gobject.TYPE_STRING,      # enumerations.SECTION_NAME
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
   991
                        gobject.TYPE_BOOLEAN,     # enumerations.SECTION_ENABLED
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   992
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   993
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   994
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   995
        def __get_new_filter_liststore():
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   996
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   997
                        gobject.TYPE_INT,         # enumerations.FILTER_ID
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   998
                        gtk.gdk.Pixbuf,           # enumerations.FILTER_ICON
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   999
                        gobject.TYPE_STRING,      # enumerations.FILTER_NAME
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1000
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1001
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1002
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1003
        def __get_new_repositories_liststore():
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1004
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1005
                        gobject.TYPE_INT,         # enumerations.REPOSITORY_ID
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1006
                        gobject.TYPE_STRING,      # enumerations.REPOSITORY_DISPLAY_NAME
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1007
                        gobject.TYPE_STRING,      # enumerations.REPOSITORY_PREFIX
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1008
                        gobject.TYPE_STRING,      # enumerations.REPOSITORY_ALIAS
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1009
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1010
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1011
        def __init_application_tree_view(self, application_list,
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1012
            application_list_filter, application_list_sort,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1013
            application_sort_column):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1014
                ##APPLICATION MAIN TREEVIEW
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1015
                if application_list_filter == None:
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1016
                        application_list_filter = application_list.filter_new()
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1017
                if application_list_sort == None:
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1018
                        application_list_sort = \
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1019
                            gtk.TreeModelSort(application_list_filter)
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1020
                        application_list_sort.set_sort_column_id(
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1021
                            application_sort_column, gtk.SORT_ASCENDING)
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1022
                        application_list_sort.set_sort_func(
1382
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1023
                            enumerations.STATUS_ICON_COLUMN, 
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1024
                            self.__column_sort_func, 
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1025
                            enumerations.STATUS_ICON_COLUMN)
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1026
                        application_list_sort.set_sort_func(
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1027
                            enumerations.DESCRIPTION_COLUMN, 
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1028
                            self.__column_sort_func, 
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1029
                            enumerations.DESCRIPTION_COLUMN)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1030
                toggle_renderer = gtk.CellRendererToggle()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1031
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1032
                column = gtk.TreeViewColumn("", toggle_renderer,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1033
                    active = enumerations.MARK_COLUMN)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1034
                column.set_cell_data_func(toggle_renderer, self.cell_data_function, self)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1035
                column.set_clickable(True)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1036
                column.connect('clicked', self.__select_column_clicked)
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  1037
                select_image = self.get_theme_selection_coloumn_image()
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1038
                column.set_widget(select_image)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1039
                self.w_application_treeview.append_column(column)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1040
                self.application_select_column = column
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1041
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1042
                name_renderer = gtk.CellRendererText()
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  1043
                column = gtk.TreeViewColumn(_("Name"), name_renderer,
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1044
                    text = enumerations.NAME_COLUMN)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1045
                column.set_resizable(True)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1046
                column.set_min_width(150)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1047
                column.set_sort_column_id(enumerations.NAME_COLUMN)
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1048
                column.set_sort_indicator(True)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1049
                column.set_cell_data_func(name_renderer, self.cell_data_function, self)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1050
                column.connect_after('clicked',
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1051
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1052
                self.w_application_treeview.append_column(column)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1053
                column = self.__create_icon_column(_("Status"), True,
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1054
                    enumerations.STATUS_ICON_COLUMN, True)
863
6ddc7b63fce3 6346 Sorting packages by status is broken effective build 106
Padraig O'Briain <padraig.obriain@sun.com>
parents: 861
diff changeset
  1055
                column.set_sort_column_id(enumerations.STATUS_ICON_COLUMN)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1056
                column.set_sort_indicator(True)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1057
                column.connect_after('clicked',
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1058
                    self.__application_treeview_column_sorted, None)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1059
                self.w_application_treeview.append_column(column)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1060
                if self.is_all_publishers_search or self.is_all_publishers_installed or \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1061
                        self.is_all_publishers or self.in_recent_search:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1062
                        repository_renderer = gtk.CellRendererText()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1063
                        column = gtk.TreeViewColumn(_('Publisher'),
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1064
                            repository_renderer,
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1065
                            markup = enumerations.PUBLISHER_COLUMN)
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1066
                        column.set_sort_column_id(enumerations.PUBLISHER_COLUMN)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1067
                        column.set_resizable(True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1068
                        column.set_sort_indicator(True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1069
                        column.set_cell_data_func(repository_renderer,
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1070
                            self.cell_data_function, self)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1071
                        column.connect_after('clicked',
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1072
                            self.__application_treeview_column_sorted, None)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1073
                        self.w_application_treeview.append_column(column)
1382
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1074
                        application_list_sort.set_sort_func(
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1075
                            enumerations.PUBLISHER_COLUMN, 
1382
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1076
                            self.__column_sort_func, 
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1077
                            enumerations.PUBLISHER_COLUMN)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1078
                description_renderer = gtk.CellRendererText()
1876
c3cb39529a82 14400 packagemanager shows summary instead of description in info window
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1871
diff changeset
  1079
                column = gtk.TreeViewColumn(_('Summary'),
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1080
                    description_renderer,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1081
                    text = enumerations.DESCRIPTION_COLUMN)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1082
                column.set_sort_column_id(enumerations.DESCRIPTION_COLUMN)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1083
                column.set_resizable(True)
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  1084
                column.set_sort_indicator(True)
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  1085
                column.set_cell_data_func(description_renderer,
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1086
                    self.cell_data_function, self)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1087
                column.connect_after('clicked',
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1088
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1089
                self.w_application_treeview.append_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1090
                #Added selection listener
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1091
                self.package_selection = self.w_application_treeview.get_selection()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1092
                self.application_list = application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1093
                self.application_list_filter = application_list_filter
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1094
                self.application_list_sort = application_list_sort
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1095
                toggle_renderer.connect('toggled', self.__active_pane_toggle,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1096
                    application_list_sort)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1097
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1098
        def __init_tree_views(self, application_list, category_list, 
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1099
            section_list, application_list_filter = None, 
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1100
            application_list_sort = None, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1101
            application_sort_column = enumerations.NAME_COLUMN):
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1102
                '''This function connects treeviews with their models and also applies
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1103
                filters'''
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1104
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1105
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1106
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1107
                        self.w_application_treeview.set_model(None)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1108
                        self.__remove_treeview_columns(self.w_application_treeview)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1109
                elif application_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1110
                        self.w_categories_treeview.set_model(None)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1111
                        self.__remove_treeview_columns(self.w_categories_treeview)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1112
                else:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1113
                        self.__disconnect_models()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1114
                        self.__remove_treeview_columns(self.w_application_treeview)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1115
                        self.__remove_treeview_columns(self.w_categories_treeview)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1116
                # The logic for set section needs to be here as some sections
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1117
                # might be not enabled. In such situation we are setting the set
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1118
                # section to "All Categories" one.
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1119
                if section_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1120
                        row = section_list[self.set_section]
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1121
                        if row[enumerations.SECTION_ENABLED] and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1122
                            self.set_section >= 0 and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1123
                            self.set_section < len(section_list):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1124
                                if row[enumerations.SECTION_ID] != self.set_section:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1125
                                        self.set_section = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1126
                        else:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1127
                                self.set_section = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1128
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1129
                if application_list != None:
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1130
                        self.__init_application_tree_view(application_list,
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1131
                            application_list_filter, application_list_sort, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1132
                            application_sort_column)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1133
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1134
                if self.first_run:
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1135
                        # When vadj changes we need to set image descriptions
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1136
                        # on visible status icons. This catches moving the scroll bars
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1137
                        # and scrolling up and down using keyboard.
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1138
                        vadj = self.w_application_treeview.get_vadjustment()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1139
                        vadj.connect('value-changed',
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1140
                            self.__application_treeview_vadjustment_changed, None)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1141
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1142
                        # When the size of the application_treeview changes
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1143
                        # we need to set image descriptions on visible status icons.
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1144
                        self.w_application_treeview.connect('size-allocate',
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1145
                            self.__application_treeview_size_allocate, None)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1146
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  1147
                category_selection = self.w_categories_treeview.get_selection()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1148
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1149
                        ##CATEGORIES TREEVIEW
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  1150
                        enumerations.CATEGORY_VISIBLE_NAME_r = gtk.CellRendererText()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1151
                        column = gtk.TreeViewColumn(_('Name'),
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  1152
                            enumerations.CATEGORY_VISIBLE_NAME_r,
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  1153
                            markup = enumerations.CATEGORY_VISIBLE_NAME)
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  1154
                        enumerations.CATEGORY_VISIBLE_NAME_r.set_property("xalign", 0.0)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1155
                        self.w_categories_treeview.append_column(column)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1156
                        #Added selection listener
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1157
                        category_selection.set_mode(gtk.SELECTION_SINGLE)
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  1158
                        self.w_categories_treeview.set_search_column(
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  1159
                            enumerations.CATEGORY_VISIBLE_NAME)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1160
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1161
                if section_list != None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1162
                        self.section_list = section_list
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1163
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1164
                        self.category_list = category_list
1406
46c950f90950 11475 The PM category tree includes categories from other publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1405
diff changeset
  1165
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1166
                if application_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1167
                        self.w_application_treeview.set_model(
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1168
                            self.application_list_sort)
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1169
                        if application_list_filter == None:
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1170
                                self.application_list_filter.set_visible_func(
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1171
                                    self.__application_filter)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1172
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1173
                if self.first_run:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1174
                        category_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1175
                            self.__on_category_selection_changed, None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1176
                        self.w_categories_treeview.connect("row-activated",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1177
                            self.__on_category_row_activated, None)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1178
                        self.w_categories_treeview.connect("focus-in-event",
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1179
                            self.__on_category_focus_in, None)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1180
                        self.w_categories_treeview.connect("button_press_event",
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1181
                            self.__on_categoriestreeview_button_press_event, None)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1182
                        self.w_categories_treeview.connect("row-collapsed",
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1183
                            self.__on_categoriestreeview_row_collapsed, None)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1184
                        self.w_categories_treeview.connect("row-expanded",
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1185
                            self.__on_categoriestreeview_row_expanded, None)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1186
                        self.package_selection.set_mode(gtk.SELECTION_SINGLE)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1187
                        self.package_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1188
                            self.__on_package_selection_changed, None)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1189
                if category_list != None and section_list != None:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1190
                        self.__add_categories_to_tree(category_list, section_list)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1191
                self.a11y_application_treeview = \
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1192
                    self.w_application_treeview.get_accessible()
1357
1b57d9ca057a 11268 The selection/mark column header for PM's package list needs an accessible name
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
  1193
                obj = self.a11y_application_treeview.get_column_header(0)
1361
4501e2b0febd 11382 traceback on console when starting packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1357
diff changeset
  1194
                if obj != None:
4501e2b0febd 11382 traceback on console when starting packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1357
diff changeset
  1195
                        obj.set_name(_("all selection toggle"))
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1196
                self.process_package_list_end()
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1197
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1198
        def __setup_filter_combobox(self):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1199
                render_pixbuf = gtk.CellRendererPixbuf()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1200
                self.w_filter_combobox.pack_start(render_pixbuf, expand = True)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1201
                self.w_filter_combobox.add_attribute(render_pixbuf, "pixbuf", 
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1202
                    enumerations.FILTER_ICON)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1203
                self.w_filter_combobox.set_cell_data_func(render_pixbuf,
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1204
                    self.filter_cell_data_function,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1205
                    (self, enumerations.FILTER_ICON))
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1206
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1207
                cell = gtk.CellRendererText()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1208
                self.w_filter_combobox.pack_start(cell, True)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1209
                self.w_filter_combobox.add_attribute(cell, 'text',
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1210
                    enumerations.FILTER_NAME)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1211
                self.w_filter_combobox.set_cell_data_func(cell,
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1212
                    self.filter_cell_data_function,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1213
                    (self, enumerations.FILTER_NAME))
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1214
                self.w_filter_combobox.set_row_separator_func(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1215
                    self.combobox_filter_id_separator)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1216
                self.w_filter_combobox.set_model(self.filter_list)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1217
                self.w_filter_combobox.set_active(self.gconf.initial_show_filter)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1218
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1219
        def __select_column_clicked(self, data):
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1220
                self.set_busy_cursor()
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1221
                gobject.idle_add(self.__toggle_select_all,
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1222
                    self.w_selectall_menuitem.props.sensitive)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1223
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1224
        def __application_treeview_column_sorted(self, widget, user_data):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1225
                self.__set_visible_status(False)
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1226
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1227
        def __init_repository_tree_view(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1228
                cell = gtk.CellRendererText()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1229
                self.w_repository_combobox.pack_start(cell, True)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1230
                self.w_repository_combobox.add_attribute(cell, 'text',
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1231
                    enumerations.REPOSITORY_DISPLAY_NAME)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1232
                self.w_repository_combobox.set_row_separator_func(
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1233
                    self.combobox_id_separator)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1234
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1235
        def __application_treeview_size_allocate(self, widget, allocation, user_data):
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1236
                # We ignore any changes in the size during initialization.
924
500d7c30cac7 7049 Accessible descriptions for images in "Status" column broken by rev 882
Padraig O'Briain <padraig.obriain@sun.com>
parents: 917
diff changeset
  1237
                if self.visible_status_id == 0:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1238
                        self.visible_status_id = gobject.idle_add(
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1239
                            self.__set_visible_status)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1240
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1241
        def __application_treeview_vadjustment_changed(self, widget, user_data):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1242
                self.__set_visible_status()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1243
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1244
        def __set_accessible_status(self, model, itr):
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1245
                status = model.get_value(itr, enumerations.STATUS_COLUMN)
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  1246
                if status == api.PackageInfo.INSTALLED:
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1247
                        desc = _("Installed")
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  1248
                elif status == api.PackageInfo.KNOWN:
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1249
                        desc = _("Not Installed")
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  1250
                elif status == api.PackageInfo.UPGRADABLE:
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1251
                        desc = _("Updates Available")
864
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1252
                else:
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1253
                        desc = None
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1254
                if desc != None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1255
                        obj = self.a11y_application_treeview.ref_at(
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1256
                            int(model.get_string_from_iter(itr)),
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1257
                            STATUS_COLUMN_INDEX)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1258
                        obj.set_image_description(desc)
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1259
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1260
        def __set_visible_status(self, check_range = True):
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1261
                self.visible_status_id = 0
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1262
                if self.w_main_view_notebook.get_current_page() != \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1263
                    NOTEBOOK_PACKAGE_LIST_PAGE:
864
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1264
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1265
                if self.__doing_search():
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1266
                        return
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1267
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1268
                a11y_enabled = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1269
                if self.a11y_application_treeview.get_n_accessible_children() != 0:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1270
                        a11y_enabled = True
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1271
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1272
                if not a11y_enabled:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1273
                        return
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1274
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1275
                visible_range = self.w_application_treeview.get_visible_range()
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1276
                if visible_range == None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1277
                        return
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1278
                a11y_start = visible_range[0][0]
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1279
                a11y_end = visible_range[1][0]
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1280
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1281
                # We use check_range only for accessibility purposes to
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1282
                # reduce the amount of processing to be done in that case.
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1283
                # Switching Publishers need to use default range
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1284
                if self.publisher_changed:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1285
                        check_range = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1286
                        self.publisher_changed = False
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1287
                if self.in_search_mode:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1288
                        check_range = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1289
                
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1290
                if self.application_treeview_range != None:
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1291
                        if check_range and a11y_enabled:
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1292
                                old_start = self.application_treeview_range[0][0]
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1293
                                old_end = self.application_treeview_range[1][0]
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1294
                                 # Old range is the same or smaller than new range
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1295
                                 # so do nothing
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1296
                                if (a11y_start >= old_start and 
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1297
                                    a11y_end <= old_end):
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1298
                                        a11y_end =  a11y_start - 1
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1299
                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1300
                                        if a11y_start < old_end:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1301
                                                if a11y_end < old_end:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1302
                                                        if a11y_end >= old_start:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1303
                                                                a11y_end = old_start
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1304
                                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1305
                                                        a11y_start = old_end
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1306
                self.application_treeview_range = visible_range
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1307
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1308
                sort_filt_model = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1309
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1310
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1311
                if a11y_enabled:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1312
                        sf_itr = sort_filt_model.get_iter_from_string(
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1313
                            str(a11y_start))                
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1314
                        while a11y_start <= a11y_end:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1315
                                self.__set_accessible_status(sort_filt_model, sf_itr)
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1316
                                a11y_start += 1
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1317
                                sf_itr = sort_filt_model.iter_next(sf_itr)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1318
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1319
        def __doing_search(self):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1320
                return self.search_start > 0
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1321
                
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1322
        def __create_icon_column(self, name, expand_pixbuf, enum_value, set_data_func):
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1323
                column = gtk.TreeViewColumn()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1324
                column.set_title(name)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1325
                #Commented, since there was funny jumping of the icons
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1326
                #column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1327
                render_pixbuf = gtk.CellRendererPixbuf()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1328
                column.pack_start(render_pixbuf, expand = expand_pixbuf)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1329
                column.add_attribute(render_pixbuf, "pixbuf", enum_value)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1330
                column.set_fixed_width(32)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1331
                if set_data_func:
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1332
                        column.set_cell_data_func(render_pixbuf,
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1333
                            self.cell_data_function, self)
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1334
                return column
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1335
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1336
        def __disconnect_models(self):
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1337
                if self.w_application_treeview:
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1338
                        self.w_application_treeview.set_model(None)
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1339
                if self.w_categories_treeview:
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1340
                        self.w_categories_treeview.set_model(None)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1341
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1342
        def __disconnect_repository_model(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1343
                self.w_repository_combobox.set_model(None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1344
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1345
        @staticmethod
1382
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1346
        def __column_sort_func(treemodel, iter1, iter2, column):
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1347
                get_val = treemodel.get_value
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1348
                get_val = treemodel.get_value
1382
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1349
                status1 = get_val(iter1, column)
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1350
                status2 = get_val(iter2, column)
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1351
                ret = cmp(status1, status2)
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1352
                if ret != 0:
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1353
                        return ret
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1354
                name1 = get_val(iter1, enumerations.NAME_COLUMN)
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1355
                name2 = get_val(iter2, enumerations.NAME_COLUMN)
823f1431415f 11407 Marking/unmarking a package should not cause the package list to resort itself
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1380
diff changeset
  1356
                return cmp(name1, name2)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1357
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1358
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1359
        def __remove_treeview_columns(treeview):
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1360
                columns = treeview.get_columns()
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1361
                if columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1362
                        for column in columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1363
                                treeview.remove_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1364
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1365
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1366
        def __init_sections(section_list):
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1367
                '''This function is for initializing the sections list'''
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1368
                enabled = True
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1369
                # Only enable the first section. Later other sections are enabled
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1370
                # in __add_category_to_section() if the section contains any categories
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1371
                # which in turn contain some packages.
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1372
                section_list.append([0, _('All Categories'), enabled ])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1373
                enabled = False
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1374
                section_list.append([1, _('Meta Packages'), enabled ])
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1375
                section_list.append([2, _('Applications'), enabled ])
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1376
                section_list.append([3, _('Desktop (GNOME)'), enabled ])
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1377
                section_list.append([4, _('Development'), enabled ])
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1378
                section_list.append([5, _('Distributions'), enabled ])
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1379
                section_list.append([6, _('Drivers'), enabled ])
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1380
                section_list.append([7, _('System'), enabled ])
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1381
                section_list.append([8, _('Web Services'), enabled ])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1382
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1383
        def __init_show_filter(self):
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1384
                max_length = 0
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1385
                for filter_id, pixbuf, label in self.filter_options:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1386
                        self.filter_list.append([filter_id, pixbuf, label, ])
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1387
                        if filter_id == -1:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1388
                                continue
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1389
                        max_length = gui_misc.get_max_text_length(
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1390
                            max_length, label, self.w_filter_combobox)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1391
                self.__setup_max_filter_length(max_length)
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1392
                
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1393
                if self.gconf.initial_show_filter >= enumerations.FILTER_ALL and \
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1394
                    self.gconf.initial_show_filter < len(self.filter_list):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1395
                        row = self.filter_list[self.gconf.initial_show_filter]
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1396
                        if row[enumerations.SECTION_ID] != \
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1397
                            self.gconf.initial_show_filter:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1398
                                self.gconf.initial_show_filter = enumerations.FILTER_ALL
821
c86df5cfbe44 5738 Need mechanism to change initial value for TopLevel and category
Padraig O'Briain <padraig.obriain@sun.com>
parents: 816
diff changeset
  1399
                else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1400
                        self.gconf.initial_show_filter = enumerations.FILTER_ALL
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1401
1216
ff1b8f7a5530 9859 Focus in PM can still be changed via keyboard during a search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1214
diff changeset
  1402
        def __on_mainwindow_key_press_event(self, widget, event):
ff1b8f7a5530 9859 Focus in PM can still be changed via keyboard during a search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1214
diff changeset
  1403
                if self.is_busy_cursor_set():
1629
7f7aaecddf28 13315 Canceling a search in PM is not keyboard accessible
John Rice <john.rice@sun.com>
parents: 1625
diff changeset
  1404
                        if event.type == gtk.gdk.KEY_PRESS:
7f7aaecddf28 13315 Canceling a search in PM is not keyboard accessible
John Rice <john.rice@sun.com>
parents: 1625
diff changeset
  1405
                                keyname = gtk.gdk.keyval_name(event.keyval)
7f7aaecddf28 13315 Canceling a search in PM is not keyboard accessible
John Rice <john.rice@sun.com>
parents: 1625
diff changeset
  1406
                                if keyname == "Escape" and self.api_o.can_be_canceled():
7f7aaecddf28 13315 Canceling a search in PM is not keyboard accessible
John Rice <john.rice@sun.com>
parents: 1625
diff changeset
  1407
                                        Thread(target = self.api_o.cancel,
7f7aaecddf28 13315 Canceling a search in PM is not keyboard accessible
John Rice <john.rice@sun.com>
parents: 1625
diff changeset
  1408
                                            args = ()).start()
1216
ff1b8f7a5530 9859 Focus in PM can still be changed via keyboard during a search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1214
diff changeset
  1409
                        return True
ff1b8f7a5530 9859 Focus in PM can still be changed via keyboard during a search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1214
diff changeset
  1410
                else:
ff1b8f7a5530 9859 Focus in PM can still be changed via keyboard during a search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1214
diff changeset
  1411
                        return False
ff1b8f7a5530 9859 Focus in PM can still be changed via keyboard during a search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1214
diff changeset
  1412
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1413
        def __on_mainwindow_delete_event(self, widget, event):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1414
                ''' handler for delete event of the main window '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1415
                if self.__check_if_something_was_changed() == True:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1416
                        # XXX Change this to not quit and show dialog
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1417
                        # XXX if some changes were applied:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1418
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1419
                        return True
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1420
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1421
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1422
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1423
        def __handle_resize(self, widget):
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1424
                if self.last_resize == widget.get_size():
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1425
                        return
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1426
                last_resize = self.last_resize
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1427
                self.last_resize = widget.get_size()
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1428
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1429
                pub_rect = self.w_publisher_combobox_hbox.get_allocation()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1430
                view_rect = self.w_view_combobox_hbox.get_allocation()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1431
                min_width = pub_rect[2] + view_rect[2] + PUBLISHER_VIEW_MIN_PADDING
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1432
                main_win_width = self.w_main_window.get_size()[0]
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1433
                if main_win_width < min_width:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1434
                        self.w_main_window.set_size_request(min_width, -1)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1435
                        if self.w_main_view_notebook.get_current_page() == \
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1436
                                NOTEBOOK_START_PAGE  and not self.first_run:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1437
                                self.startpage.handle_resize()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1438
                        return
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1439
                elif last_resize == -1 and min_width < MIN_APP_WIDTH:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1440
                        self.w_main_window.set_size_request(MIN_APP_WIDTH, MIN_APP_HEIGHT)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1441
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1442
                if self.w_main_view_notebook.get_current_page() == \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1443
                        NOTEBOOK_START_PAGE  and not self.first_run:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1444
                        self.startpage.handle_resize()
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1445
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1446
        def __on_mainwindow_check_resize(self, widget):
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1447
                if not widget or not self.gdk_window:
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1448
                        return
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1449
                if self.resize_id != 0:
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1450
                        gobject.source_remove(self.resize_id)
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1451
                        self.resize_id = 0
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1452
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1453
                self.resize_id = \
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1454
                            gobject.timeout_add(RESIZE_DELAY,
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1455
                                self.__handle_resize, widget)
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1456
                                
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1457
                status_height = self.w_statusbar_hbox.get_allocation().height
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1458
                self.gdk_window.move_resize(0, 0, widget.get_size()[0],
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1459
                    widget.get_size()[1]-status_height)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1460
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1461
        def __on_file_quit_activate(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1462
                ''' handler for quit menu event '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1463
                self.__on_mainwindow_delete_event(None, None)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1464
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1465
        def __on_file_manage_publishers(self, widget):
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1466
                ''' handler for manage publishers menu event '''
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1467
                repository.Repository(self, self.image_directory,
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1468
                    action=enumerations.MANAGE_PUBLISHERS,
2354
0493939c253e 16993 packagemanger should provide a way to manipulate and see publisher certs
John Rice <john.rice@oracle.com>
parents: 2310
diff changeset
  1469
                    main_window = self.w_main_window, gconf = self.gconf)
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1470
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1471
        def __on_file_add_publisher(self, widget):
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1472
                ''' handler for add publisher menu event '''
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1473
                repository.Repository(self, self.image_directory,
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1474
                    action=enumerations.ADD_PUBLISHER,
2354
0493939c253e 16993 packagemanger should provide a way to manipulate and see publisher certs
John Rice <john.rice@oracle.com>
parents: 2310
diff changeset
  1475
                    main_window = self.w_main_window, gconf = self.gconf)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1476
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1477
        def __on_file_be_activate(self, widget):
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1478
                ''' handler for be menu event '''
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1479
                beadm.Beadmin(self)
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1480
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1481
        def __on_searchentry_changed(self, widget):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1482
                ret = self.entrystyle.on_entry_changed(widget)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1483
                self.w_clear_search_menuitem.set_sensitive(ret)
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  1484
                self.__enable_disable_entry_selection(widget)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1485
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1486
        def __update_statusbar_for_search(self):
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1487
                if self.is_all_publishers_search or self.is_all_publishers:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1488
                        self.update_statusbar_message(_("Search all publishers"))
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1489
                else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1490
                        self.update_statusbar_message(_("Search current publisher"))
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1491
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1492
        def __remove_statusbar_message(self):
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1493
                if self.statusbar_message_id > 0:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1494
                        try:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1495
                                self.w_main_statusbar.remove_message(0,
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1496
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1497
                        except AttributeError:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1498
                                self.w_main_statusbar.remove(0,
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1499
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1500
                        self.statusbar_message_id = 0
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1501
        
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1502
        def update_statusbar_message(self, message):
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1503
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1504
                        return
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1505
                self.__remove_statusbar_message()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1506
                self.statusbar_message_id = self.w_main_statusbar.push(0, message)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1507
                if self.w_main_statusbar_label:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1508
                        self.w_main_statusbar_label.set_markup(message)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1509
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1510
        def __setup_before_all_publishers_search_mode(self):
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1511
                self.is_all_publishers_installed = False
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1512
                self.is_all_publishers = False
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1513
                self.is_all_publishers_search = True
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
  1514
                if not self.first_run:
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
  1515
                    self.w_logalert_frame.hide()
1576
d6dc52c494c4 13314 Typing text in PM's Search entry after canceling a search of all publishers fails to clear the default text
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1574
diff changeset
  1516
                if not self.w_searchentry.is_focus():
d6dc52c494c4 13314 Typing text in PM's Search entry after canceling a search of all publishers fails to clear the default text
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1574
diff changeset
  1517
                        self.__set_searchentry_to_prompt()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1518
                
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1519
                self.__save_setup_before_search()
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  1520
                first_run = self.first_run
1609
480228ad3bb6 13009 PM expanding categories when starting in All Publishers broken
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1608
diff changeset
  1521
                self.first_run = False
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1522
                self.__clear_before_search(False)
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  1523
                show_search_all_page = not first_run or (first_run 
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1524
                    and not self.gconf.show_startpage) or (first_run
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1525
                    and self.gconf.start_insearch)
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1526
                if show_search_all_page: 
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1527
                        gobject.idle_add(self.pm_setup_search_all_page)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1528
                elif self.gconf.show_startpage:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1529
                        gobject.idle_add(self.w_main_view_notebook.set_current_page,
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1530
                            NOTEBOOK_START_PAGE)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1531
                self.__update_statusbar_for_search()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1532
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1533
        def __set_searchentry_to_prompt(self):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1534
                if not self.first_run:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1535
                        self.entrystyle.set_entry_to_prompt()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1536
  
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1537
        def pm_setup_search_all_page(self):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1538
                publisher_list = []
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1539
                model = self.w_repository_combobox.get_model()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1540
                for pub in model:
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1541
                        prefix = pub[enumerations.REPOSITORY_PREFIX]
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1542
                        if (prefix and prefix not in self.publisher_options.values()):
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1543
                                pub_alias = pub[enumerations.REPOSITORY_ALIAS]
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1544
                                publisher_list.append((prefix, pub_alias))
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1545
                self.startpage.setup_search_all_page(publisher_list,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1546
                    self.publisher_options[PUBLISHER_ALL])
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  1547
                self.__setup_notebook_page_view()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1548
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1549
        def __setup_search_installed_page(self, text):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1550
                self.startpage.setup_search_installed_page(text)
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  1551
                self.__setup_notebook_page_view()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1552
                self.__set_focus_on_searchentry()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1553
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1554
        def __setup_recent_search_page(self):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1555
                self.startpage.setup_recent_search_page(self.recent_searches_list)
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  1556
                self.__setup_notebook_page_view()
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1557
                    
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1558
        def __setup_zero_filtered_results_page(self):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1559
                active_filter = self.w_filter_combobox.get_active()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1560
                filter_desc = self.__get_filter_combobox_description(active_filter)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1561
                self.startpage.setup_zero_filtered_results_page(self.length_visible_list,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1562
                    filter_desc)
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  1563
                self.__setup_notebook_page_view()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1564
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1565
        def __setup_search_zero_filtered_results_page(self, text, num):
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1566
                active_filter = self.w_filter_combobox.get_active()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1567
                filter_desc = self.__get_filter_combobox_description(active_filter)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1568
                self.startpage.setup_search_zero_filtered_results_page(text,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1569
                    num, filter_desc)
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  1570
                self.__setup_notebook_page_view()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1571
                self.__set_focus_on_searchentry()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1572
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1573
        def __get_filter_combobox_description(self, index):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1574
                description = None
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1575
                model = self.w_filter_combobox.get_model()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1576
                for entry in model:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1577
                        if entry[enumerations.FILTER_ID] == index:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1578
                                description = entry[enumerations.FILTER_NAME]
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1579
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1580
                return description
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1581
                
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1582
        def __setup_search_zero_results_page(self, pub, text, search_all):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1583
                name =  self.get_publisher_name_from_prefix(pub)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1584
                self.startpage.setup_search_zero_results_page(name, text,
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1585
                    search_all)
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  1586
                self.__setup_notebook_page_view()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1587
                self.__set_focus_on_searchentry()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1588
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1589
        def __set_focus_on_searchentry(self):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1590
                self.w_searchentry.grab_focus()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1591
                if self.w_searchentry.get_text() > 0:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1592
                        start, end = self.w_searchentry.get_selection_bounds()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1593
                        self.w_searchentry.select_region(end, end)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1594
                        self.pylintstub = start
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1595
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1596
        def __setup_search_wildcard_page(self):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1597
                self.startpage.setup_search_wildcard_page()
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  1598
                self.__setup_notebook_page_view()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1599
                self.__set_focus_on_searchentry()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1600
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1601
        def __clear_before_search(self, show_list=True, in_setup=True, unselect_cat=True):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1602
                self.in_setup = in_setup
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1603
                application_list = self.__get_new_application_liststore()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1604
                self.__set_empty_details_panel()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1605
                self.__set_main_view_package_list(show_list)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1606
                self.__init_tree_views(application_list, None, None)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1607
                if unselect_cat:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1608
                        self.__unselect_category()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1609
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1610
        def __restore_setup_for_browse(self):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1611
                self.in_search_mode = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1612
                self.in_recent_search = False
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1613
                self.is_all_publishers_search = False
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
  1614
                self.w_logalert_frame.hide()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1615
                if self.last_visible_publisher == \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1616
                        self.publisher_options[PUBLISHER_INSTALLED]:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1617
                        self.is_all_publishers_installed = True
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1618
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1619
                        self.is_all_publishers_installed = False 
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1620
                if self.last_visible_publisher == \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1621
                        self.publisher_options[PUBLISHER_ALL]:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1622
                        self.is_all_publishers = True
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1623
                else:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1624
                        self.is_all_publishers = False 
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1625
                self.set_busy_cursor()
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1626
                if (self.w_repository_combobox.get_active() != 
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1627
                    self.saved_repository_combobox_active):
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1628
                        self.w_repository_combobox.set_active(
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1629
                            self.saved_repository_combobox_active)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1630
                self.set_section = self.saved_section_active
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1631
                # Reset MARK_COLUMN        
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1632
                for pkg in self.saved_application_list:
1701
af78ac44dcc2 14199 Export Selections does not work if publisher has alias
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1700
diff changeset
  1633
                        pub = pkg[enumerations.PUBLISHER_PREFIX_COLUMN]
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1634
                        stem = pkg[enumerations.STEM_COLUMN]
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1635
                        marked = False
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1636
                        pkgs = None
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1637
                        if self.selected_pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1638
                                pkgs = self.selected_pkgs.get(pub)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1639
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1640
                                if stem in pkgs:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1641
                                        marked = True
1571
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  1642
                        # When switching after Manage Publisher dialog
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1643
                        # this assignment can cause bogus refilter
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1644
                        if pkg[enumerations.MARK_COLUMN] != marked:
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  1645
                                pkg[enumerations.MARK_COLUMN] = marked
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1646
                if self.saved_category_list == self.category_list:
1621
7e2f0a9cfd9e 13211 Category state not restored properly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1612
diff changeset
  1647
                        self.__restore_category_state()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1648
                        self.__init_tree_views(self.saved_application_list,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1649
                            None, None,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1650
                            self.saved_application_list_filter,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1651
                            self.saved_application_list_sort)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1652
                else:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1653
                        self.__init_tree_views(self.saved_application_list,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1654
                            self.saved_category_list, self.saved_section_list,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1655
                            self.saved_application_list_filter,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1656
                            self.saved_application_list_sort)
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1657
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1658
                self.__set_main_view_package_list()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1659
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1660
        def __save_application_list(self, app_list):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1661
                self.saved_application_list = app_list
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1662
                                
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1663
        def __save_setup_before_search(self, single_search=False):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1664
                #Do not save search data models
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1665
                if self.in_search_mode:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1666
                        return
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1667
                self.__save_application_list(self.application_list)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1668
                self.saved_application_list_sort = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1669
                        self.application_list_sort
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1670
                self.saved_application_list_filter = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1671
                        self.application_list_filter
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1672
                self.saved_category_list = self.category_list
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1673
                self.saved_section_list = self.section_list
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1674
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1675
                pub_index = self.w_repository_combobox.get_active()
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1676
                if pub_index != self.repo_combobox_all_pubs_search_index and \
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1677
                        pub_index != self.repo_combobox_add_index:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1678
                        self.saved_repository_combobox_active = pub_index
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1679
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1680
        def __do_search(self, widget=None, ev=None):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1681
                self.in_recent_search = False
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1682
                self.__reset_search_start()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1683
                txt = self.entrystyle.get_text()
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1684
                if txt == None:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1685
                        return
1804
615d829ec26e 14942 Traceback when getting package info after search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1799
diff changeset
  1686
                self.previous_search_text = txt
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1687
                if self.is_all_publishers_installed:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1688
                        gobject.idle_add(self.__setup_search_installed_page, txt)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1689
                        return                
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1690
                contains_asterix = txt.count("*") > 0
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1691
                contains_asterix_only = False
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1692
                is_search_all = self.is_all_publishers_search or \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1693
                        self.__get_selected_publisher() == \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1694
                                self.publisher_options[PUBLISHER_ALL]
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1695
                if contains_asterix:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1696
                        contains_asterix_only = len(txt.replace("*", " ").strip()) == 0
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1697
                if contains_asterix_only:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1698
                        self.w_searchentry.set_text("*")
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1699
                        self.__set_focus_on_searchentry()
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1700
                        if is_search_all:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1701
                                gobject.idle_add(self.__setup_search_wildcard_page)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1702
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1703
                                if self.in_search_mode:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1704
                                        self.__unset_search(True)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1705
                                if self.w_categories_treeview.get_model() != None:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1706
                                        self.w_categories_treeview.set_cursor(0)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1707
                        return
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1708
                if not self.is_all_publishers_search:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1709
                        self.__save_setup_before_search(single_search=True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1710
                self.__clear_before_search()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1711
                self.__set_focus_on_searchentry()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1712
                self.set_busy_cursor()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1713
                self.in_search_mode = True
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1714
                        
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
  1715
                self.w_logalert_frame.hide()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1716
                gobject.idle_add(self.__set_main_view_package_list)
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1717
                Thread(target = self.__do_api_search,
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1718
                    args = (is_search_all, )).start()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1719
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1720
        def __get_selection_and_category_path(self):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1721
                selection = self.w_categories_treeview.get_selection()
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1722
                if not selection:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1723
                        return None, (0,)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1724
                model, itr = selection.get_selected()
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1725
                if not model or not itr:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1726
                        return None, (0,)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1727
                return selection, model.get_path(itr)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1728
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1729
        def __unselect_category(self):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1730
                selection, path = self.__get_selection_and_category_path()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1731
                if selection:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1732
                        self.__save_active_category(path)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1733
                        selection.unselect_all()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1734
1571
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  1735
        def __process_after_cancel(self):
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1736
                if self.is_all_publishers_search:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1737
                        self.__setup_before_all_publishers_search_mode()
1571
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  1738
                else:
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  1739
                        self.__unset_search(True)
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  1740
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1741
        def __process_after_search_failure(self):
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1742
                self.__reset_search_start()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1743
                self.search_time_sec = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1744
                self.application_list = []
1456
9eb0d782440f 12295 Package Manager does not deal properly with getting descriptions if no connection
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1455
diff changeset
  1745
                gobject.idle_add(self.update_statusbar)
1457
0f31831a57b4 12318 In Package Manager unsetting the busy cursor should be done in GUI thread
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1456
diff changeset
  1746
                gobject.idle_add(self.unset_busy_cursor)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1747
                self.in_setup = False
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1748
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1749
        def __handle_inc_search_results(self, sort_col):
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1750
                self.search_results_id = 0
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1751
                if debug:
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1752
                        print "handle_inc_search_results: ", \
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1753
                                time.time() - self.search_start, len(self.search_results)
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1754
                application_list = self.__get_min_list_from_search(self.search_results)
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1755
                self.in_setup = True
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1756
                self.__init_tree_views(application_list, None, None, None, None, sort_col)
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1757
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1758
        def __do_api_search(self, search_all = True):
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  1759
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  1760
                gobject.idle_add(self.set_busy_cursor)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  1761
                self.__do_api_search_without_lock(search_all)
1966
dd38788677ea 16380 Upgrade failed with error: cannot release un-aquired lock
John Rice <john.rice@oracle.com>
parents: 1931
diff changeset
  1762
                gui_misc.release_lock(self.api_lock)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  1763
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  1764
        def __do_api_search_without_lock(self, search_all = True):
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1765
                self.__set_search_start()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1766
                gobject.idle_add(self.update_statusbar)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1767
                self.search_time_sec = 0
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1768
                self.search_results = []
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1769
                self.__clear_inc_search_results_task()
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  1770
                text = self.w_searchentry.get_text()
2000
b74cab2a137c 16656 Unnecessary code in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1999
diff changeset
  1771
                pub_prefix = None
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1772
                # Here we call the search API to get the results
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1773
                searches = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1774
                servers = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1775
                pargs = []
1070
7c1f067af2d8 8289 PM search against all repos is x5 slower than the CLI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1062
diff changeset
  1776
                search_str = SEARCH_STR_FORMAT % text
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1777
                pargs.append(search_str)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1778
                if search_all:
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1779
                        self.publisher_being_searched = _("All Publishers")
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1780
                        servers = None
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1781
                else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1782
                        pub_prefix = self.__get_selected_publisher()
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1783
                        try:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1784
                                if pub_prefix != None:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1785
                                        pub = self.api_o.get_publisher(prefix=pub_prefix)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1786
                                else:
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2279
diff changeset
  1787
                                        pub = self.api_o.get_highest_ranked_publisher()
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1788
                        except api_errors.ApiException, ex:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1789
                                err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1790
                                gobject.idle_add(self.error_occurred, err,
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1791
                                    None, gtk.MESSAGE_INFO)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1792
                                gobject.idle_add(self.unset_busy_cursor)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1793
                                return
2310
ce10607d5332 11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents: 2279
diff changeset
  1794
                        origin_uri = gui_misc.get_origin_uri(pub.repository)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1795
                        servers.append({"origin": origin_uri})
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1796
                        self.publisher_being_searched = \
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1797
                                self.get_publisher_display_name_from_prefix(pub.prefix)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1798
                if debug:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1799
                        print "Search: pargs %s servers: %s" % (pargs, servers)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1800
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1801
                #TBD If we ever search just Installed pkgs should allow for a local search
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1802
                case_sensitive = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1803
                return_actions = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1804
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1805
                last_name = ""
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1806
                # Sorting results by Name gives best overall appearance and flow
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1807
                sort_col = enumerations.NAME_COLUMN
2835
da6a9b1e5489 15955841 change UPDATENUM for s11.2
Tim Foster <tim.s.foster@oracle.com>
parents: 2493
diff changeset
  1808
                # pylint: disable=C0321
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1809
                try:
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1810
                        searches.append(self.api_o.remote_search(
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1811
                            [api.Query(" ".join(pargs), case_sensitive, return_actions)],
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  1812
                                servers=servers))
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1813
                        if debug:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1814
                                print "Search Args: %s : cs: %s : retact: %s" % \
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1815
                                        ("".join(pargs), case_sensitive, return_actions)
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1816
                        for query_num, pub, (v, return_type, tmp) in \
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1817
                            itertools.chain(*searches):
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1818
                                if v < 1 or return_type != api.Query.RETURN_PACKAGES:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1819
                                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1820
                                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1821
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1822
                                active_pub = None
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1823
                                if pub is not None \
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1824
                                    and "prefix" in pub:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1825
                                        active_pub = pub["prefix"]
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1826
                                name = fmri.PkgFmri(str(tmp)).get_name()
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1827
                                if last_name != name:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1828
                                        if debug:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1829
                                                print "Result Name: %s (%s)" \
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1830
                                                    % (name, active_pub)
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1831
                                        a_res = name, active_pub
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1832
                                        self.search_results.append(a_res)
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1833
                                        if self.search_results_id == 0:
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1834
                                                self.search_results_id = (
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1835
                                                    gobject.timeout_add(
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1836
                                                        INC_RESULTS_DELAY,
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1837
                                                        self.__handle_inc_search_results,
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1838
                                                        sort_col))
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1839
                                last_name = name
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1840
                                self.pylintstub = query_num
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1841
                except api_errors.ProblematicSearchServers, ex:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1842
                        self.__process_api_search_error(ex)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1843
                        gobject.idle_add(self.__handle_api_search_error)
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1844
                        if len(self.search_results) == 0:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1845
                                if search_all:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1846
                                        self.__process_after_search_with_zero_results(
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1847
                                                _("All Publishers"), text,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1848
                                                search_all)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1849
                                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1850
                                        self.__process_after_search_with_zero_results(
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1851
                                                pub_prefix, text, search_all)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1852
                                return
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1853
                except api_errors.CanceledException:
1571
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  1854
                        self.__reset_search_start()
1457
0f31831a57b4 12318 In Package Manager unsetting the busy cursor should be done in GUI thread
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1456
diff changeset
  1855
                        gobject.idle_add(self.unset_busy_cursor)
1571
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  1856
                        gobject.idle_add(self.__process_after_cancel)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1857
                        return
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1858
                except api_errors.ImageLockedError, ex:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1859
                        err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1860
                        gobject.idle_add(self.error_occurred, err,
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1861
                                None, gtk.MESSAGE_INFO)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1862
                        self.__process_after_search_failure()
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1863
                        return
1704
192f1df8e20f 14230 PM should handle WrapSuccessfulIndexingException
John Rice <john.rice@sun.com>
parents: 1701
diff changeset
  1864
                except Exception, aex:
192f1df8e20f 14230 PM should handle WrapSuccessfulIndexingException
John Rice <john.rice@sun.com>
parents: 1701
diff changeset
  1865
                        err = str(aex)
192f1df8e20f 14230 PM should handle WrapSuccessfulIndexingException
John Rice <john.rice@sun.com>
parents: 1701
diff changeset
  1866
                        logger.error(err)
192f1df8e20f 14230 PM should handle WrapSuccessfulIndexingException
John Rice <john.rice@sun.com>
parents: 1701
diff changeset
  1867
                        gui_misc.notify_log_error(self)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1868
                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1869
                        return
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1870
                finally:
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1871
                        self.__clear_inc_search_results_task()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1872
                if debug:
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1873
                        print "Number of search results:", len(self.search_results)
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1874
                if len(self.search_results) == 0:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1875
                        if debug:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1876
                                print "No search results"
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1877
                        if search_all:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1878
                                self.__process_after_search_with_zero_results(
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1879
                                        _("All Publishers"), text, search_all)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1880
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1881
                                self.__process_after_search_with_zero_results(
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1882
                                        pub_prefix, text, search_all)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1883
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1884
                #Now fetch full result set with Status
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1885
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1886
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1887
                self.in_setup = True
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1888
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1889
                        print "Time for search:", time.time() - self.search_start
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1890
                application_list = self.__get_full_list_from_search(self.search_results)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1891
                gobject.idle_add(self.__add_recent_search, text, pub_prefix,
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1892
                    application_list, search_all)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1893
                if self.search_start > 0:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1894
                        self.search_time_sec = int(time.time() - self.search_start)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1895
                        if debug:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1896
                                print "Search time: %d (sec)" % self.search_time_sec
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1897
                self.__reset_search_start()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1898
                gobject.idle_add(self.__init_tree_views, application_list, None, None, \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1899
                    None, None, sort_col)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1900
                if self.w_filter_combobox.get_active() == enumerations.FILTER_ALL:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1901
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1902
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1903
                gobject.idle_add(self.__check_zero_results_afterfilter, text,
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1904
                    len(application_list))
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1905
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1906
        def __clear_inc_search_results_task(self):
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1907
                if self.search_results_id != 0:
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1908
                        gobject.source_remove(self.search_results_id)
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1909
                        self.search_results_id = 0
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1910
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1911
        def __check_zero_results_afterfilter(self, text, num):
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1912
                if self.length_visible_list != 0:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1913
                        return
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1914
                self.__setup_search_zero_filtered_results_page(text, num)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1915
                self.update_statusbar()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1916
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1917
        def __set_search_start(self):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1918
                self.search_start = time.time()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1919
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1920
        def __reset_search_start(self):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1921
                self.search_start = 0
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1922
                
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1923
        def __process_after_search_with_zero_results(self, pub, text,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1924
            search_all):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1925
                if self.search_start > 0:
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1926
                        self.search_time_sec = \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1927
                                int(time.time() - self.search_start)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1928
                self.__reset_search_start()
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1929
                gobject.idle_add(self.__setup_search_zero_results_page, pub, text,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1930
                    search_all)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1931
                self.in_setup = True
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1932
                application_list = self.__get_new_application_liststore()
947
181d3c7a54ee 6635 Need support Search across All Repositories (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 944
diff changeset
  1933
                gobject.idle_add(self.__set_empty_details_panel)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1934
                gobject.idle_add(self.__init_tree_views, application_list, None, None)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1935
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1936
        def get_publisher_display_name_from_prefix(self, prefix):
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1937
                if self.pubs_display_name.has_key(prefix):
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1938
                        return self.pubs_display_name[prefix]
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1939
                else:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1940
                        return prefix
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1941
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1942
        def get_publisher_name_from_prefix(self, prefix):
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1943
                if self.pubs_info.has_key(prefix):
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1944
                        item  = self.pubs_info[prefix]
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1945
                else:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1946
                        return prefix
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1947
                alias = item[1]
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1948
                if alias != None and len(alias) > 0:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1949
                        return alias
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1950
                else:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1951
                        return prefix 
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1952
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1953
        def __get_min_list_from_search(self, search_result):
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1954
                application_list = self.__get_new_application_liststore()
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1955
                for name, pub in search_result:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1956
                        pub_name = self.get_publisher_name_from_prefix(pub)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1957
                        #Add to application_list
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1958
                        application_list.append(
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1959
                            [False, None, name, '...', api.PackageInfo.KNOWN,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  1960
                            gui_misc.get_pkg_stem(name, pub), None, True, None,
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  1961
                            pub_name, pub, False])
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1962
                return application_list
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1963
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1964
        def __get_full_list_from_search(self, search_result):
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1965
                application_list = self.__get_new_application_liststore()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1966
                self.__add_pkgs_to_list_from_search(search_result,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1967
                    application_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1968
                return application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1969
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1970
        def __add_pkgs_to_list_from_search(self, search_result,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1971
            application_list):
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1972
                local_results = self.__get_info_for_search_results(search_result)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1973
                remote_results = self.__get_info_for_search_results(search_result,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1974
                    local_results)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1975
                self.__add_pkgs_to_lists_from_info(local_results, 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1976
                    remote_results, application_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1977
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1978
        def __get_info_for_search_results(self, search_result, local_results = None):
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1979
                pargs = []
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1980
                results = []
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1981
                local_info = local_results == None
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  1982
                for name, pub in search_result:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1983
                        found = False
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1984
                        if local_results:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1985
                                for result in local_results:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1986
                                        if (name == result.pkg_stem and
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1987
                                            pub == result.publisher):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1988
                                                found = True
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1989
                                                break
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1990
                                if not found: 
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1991
                                        pargs.append(gui_misc.get_pkg_stem(name, pub))
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1992
                        else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1993
                                pargs.append(gui_misc.get_pkg_stem(name, pub))
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1994
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1995
                try:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1996
                        try:
1981
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  1997
                                if len(pargs) > 0:
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  1998
                                        res = self.api_o.info(pargs, 
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  1999
                                                  local_info, frozenset(
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  2000
                                                  [api.PackageInfo.IDENTITY, 
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  2001
                                                  api.PackageInfo.STATE, 
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  2002
                                                  api.PackageInfo.SUMMARY]))
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  2003
                                        results = res.get(0)
1675
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2004
                        except api_errors.TransportError, tpex:
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2005
                                err = str(tpex)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2006
                                logger.error(err)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2007
                                gui_misc.notify_log_error(self)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2008
                        except api_errors.InvalidDepotResponseException, idex:
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2009
                                err = str(idex)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2010
                                logger.error(err)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2011
                                gui_misc.notify_log_error(self)
1722
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  2012
                        except api_errors.ImageLockedError, ex:
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  2013
                                err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  2014
                                logger.error(err)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  2015
                                gui_misc.notify_log_error(self)
1675
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2016
                        except Exception, ex:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2017
                                err = str(ex)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2018
                                gobject.idle_add(self.error_occurred, err)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2019
                finally:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2020
                        return results
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2021
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2022
        def __application_refilter(self):
793
0f219154d202 5526 Package Manager _very_ slow after UA "Screen R&M" turned on
Padraig O'Briain <padraig.obriain@sun.com>
parents: 791
diff changeset
  2023
                ''' Disconnecting the model from the treeview improves
0f219154d202 5526 Package Manager _very_ slow after UA "Screen R&M" turned on
Padraig O'Briain <padraig.obriain@sun.com>
parents: 791
diff changeset
  2024
                performance when assistive technologies are enabled'''
1914
cb789fa96e0f 15945 Changing the view in PM while the package list is being populated can result in a hang
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1912
diff changeset
  2025
                self.application_refilter_id = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2026
                if self.in_setup:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2027
                        return
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2028
                model = self.w_application_treeview.get_model()
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2029
                self.w_application_treeview.set_model(None)
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  2030
                app_id, order = self.application_list_sort.get_sort_column_id()
1468
4411d2a364a8 12348 Filtering on Not Installed packages takes about 40 seconds
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1462
diff changeset
  2031
                self.application_list_sort.reset_default_sort_func()
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2032
                self.application_list_filter.refilter()
1531
bcdaf5bdde1c 12910 Switching categories after sorting packages got traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1530
diff changeset
  2033
                if app_id != None:
bcdaf5bdde1c 12910 Switching categories after sorting packages got traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1530
diff changeset
  2034
                        self.application_list_sort.set_sort_column_id(app_id, order)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2035
                if model != None:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2036
                        self.w_application_treeview.set_model(model)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  2037
                self.application_treeview_initialized = True
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  2038
                self.application_treeview_range = None
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  2039
                if self.visible_status_id == 0:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  2040
                        self.visible_status_id = gobject.idle_add(
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2041
                            self.__set_visible_status)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2042
                len_filtered_list = len(self.application_list_filter)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2043
                if len_filtered_list > 0 and \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2044
                        self.length_visible_list != len_filtered_list:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2045
                        self.update_statusbar()
1413
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  2046
                self.__set_empty_details_panel()
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  2047
                self.__enable_disable_selection_menus()
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  2048
                self.__enable_disable_install_remove()
2017
8eb252bf9335 16767 After select several packages Select All/ Deselect All menus are in incorrect status
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2016
diff changeset
  2049
                self.__enable_disable_select_all()
8eb252bf9335 16767 After select several packages Select All/ Deselect All menus are in incorrect status
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2016
diff changeset
  2050
                self.__enable_disable_deselect()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2051
                if not self.in_search_mode and self.length_visible_list > 0 and \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2052
                        len_filtered_list == 0 and \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2053
                        self.w_filter_combobox.get_active() != \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2054
                        (enumerations.FILTER_SELECTED):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2055
                        self.__setup_zero_filtered_results_page()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2056
                        self.update_statusbar()
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2057
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2058
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2059
        def __on_edit_paste(self, widget):
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2060
                self.w_searchentry.paste_clipboard()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2061
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  2062
        def __on_delete(self, widget):
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2063
                bounds = self.w_searchentry.get_selection_bounds()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2064
                self.w_searchentry.delete_text(bounds[0], bounds[1])
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2065
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2066
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2067
        def __on_copy(self, widget):
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2068
                focus_widget = self.w_main_window.get_focus()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2069
                if focus_widget == self.w_searchentry:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2070
                        self.w_searchentry.copy_clipboard()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2071
                        self.w_paste_menuitem.set_sensitive(True)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2072
                elif gui_misc.is_a_textview(focus_widget):
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2073
                        focus_widget.get_buffer().copy_clipboard(
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2074
                            self.w_main_clipboard)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2075
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2076
        def __on_cut(self, widget):
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2077
                self.w_searchentry.cut_clipboard()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2078
                self.w_paste_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2079
1243
d1f303f7dd86 9858 Need to get focus in package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1236
diff changeset
  2080
        def __on_goto_list_clicked(self, widget):
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2081
                if self.w_main_view_notebook.get_current_page() == NOTEBOOK_START_PAGE:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2082
                        if self.startpage.view:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2083
                                self.startpage.view.grab_focus()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2084
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2085
                        self.__set_main_view_package_list()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2086
                        self.w_application_treeview.grab_focus()
1243
d1f303f7dd86 9858 Need to get focus in package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1236
diff changeset
  2087
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2088
        def __on_edit_search_clicked(self, widget):
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2089
                self.w_searchentry.grab_focus()
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2090
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2091
        def __on_clear_search(self, widget, icon_pos=0, event=None):
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2092
                self.w_searchentry.set_text("")
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2093
                self.__clear_search_results()
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2094
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2095
        def __clear_search_results(self):
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2096
                # Only clear out search results
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2097
                if self.in_search_mode or self.is_all_publishers_search:
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2098
                        self.__clear_before_search()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2099
                        self.update_statusbar_message(_("Search cleared"))
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2100
                if self.is_all_publishers_search:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2101
                        if self.w_main_view_notebook.get_current_page() \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2102
                                != NOTEBOOK_START_PAGE:
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  2103
                                gobject.idle_add(self.pm_setup_search_all_page)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2104
                else:
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  2105
                        self.__unset_search(self.in_search_mode)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2106
                return
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2107
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2108
        def __on_progress_cancel_clicked(self, widget):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2109
                Thread(target = self.api_o.cancel, args = ()).start()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2110
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2111
        def __on_startpage(self, widget):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2112
                self.startpage.load_startpage()
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2113
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2114
2001
e3455bc37d59 16637 Installed status not updated when package is installed or removed
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2000
diff changeset
  2115
        def __reset_info_tabs(self, pagenum = None, immediate = False):
e3455bc37d59 16637 Installed status not updated when package is installed or removed
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2000
diff changeset
  2116
                self.info_pkgstem = None
e3455bc37d59 16637 Installed status not updated when package is installed or removed
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2000
diff changeset
  2117
                self.dependencies_pkgstem = None
e3455bc37d59 16637 Installed status not updated when package is installed or removed
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2000
diff changeset
  2118
                self.license_pkgstem = None
e3455bc37d59 16637 Installed status not updated when package is installed or removed
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2000
diff changeset
  2119
                self.versions_pkgstem = None
e3455bc37d59 16637 Installed status not updated when package is installed or removed
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2000
diff changeset
  2120
                self.__process_package_selection(pagenum, immediate)
e3455bc37d59 16637 Installed status not updated when package is installed or removed
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2000
diff changeset
  2121
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2122
        def __process_package_selection(self, pagenum = None, immediate = False):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2123
                if pagenum == None:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2124
                        pagenum = self.w_info_notebook.get_current_page()
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2125
                model, itr = self.package_selection.get_selected()
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2126
                if itr:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2127
                        self.selected_pkgstem = \
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2128
                               model.get_value(itr, enumerations.STEM_COLUMN)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2129
                        self.selected_pkg_name = \
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2130
                               model.get_value(itr, enumerations.ACTUAL_NAME_COLUMN)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2131
                        self.selected_pkg_pub = \
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2132
                               model.get_value(itr, enumerations.PUBLISHER_PREFIX_COLUMN)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2133
                        self.__do_notebook_change(pagenum, model, model.get_path(itr),
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2134
                            immediate)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2135
                        self.w_version_info_menuitem.set_sensitive(True)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2136
                else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2137
                        self.selected_model = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2138
                        self.selected_path = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2139
                        self.selected_pkgstem = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2140
                        self.selected_pkg_name = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2141
                        self.selected_pkg_pub = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2142
                        self.w_version_info_menuitem.set_sensitive(False)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2143
                        self.__do_notebook_change(pagenum, None, None, immediate)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2144
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2145
        def __on_package_selection_changed(self, selection, widget):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2146
                '''This function is for handling package selection changes'''
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2147
                if self.in_setup:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2148
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2149
                self.__process_package_selection()
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2150
636
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  2151
        def __on_notebook_change(self, widget, event, pagenum):
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2152
                self.__process_package_selection(pagenum, True)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2153
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2154
        def __do_notebook_change(self, pagenum, model = None, path = None,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2155
            immediate = False):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2156
                self.detailspanel.clear_details(self.info_pkgstem,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2157
                    self.dependencies_pkgstem, self.license_pkgstem,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2158
                    self.versions_pkgstem, self.selected_pkgstem)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2159
                if (pagenum == INFO_NOTEBOOK_DEPENDENCIES_PAGE):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2160
                        if self.selected_pkgstem == self.dependencies_pkgstem:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2161
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2162
                        self.detailspanel.set_fetching_dependencies()
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2163
                        if self.show_dependencies_id != 0:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2164
                                gobject.source_remove(self.show_dependencies_id)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2165
                                self.show_dependencies_id = 0
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2166
                        if immediate:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2167
                                source_id = gobject.idle_add(self.__show_dependencies)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2168
                        else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2169
                                source_id = gobject.timeout_add(SHOW_DEPENDENCIES_DELAY,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2170
                                    self.__show_dependencies)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2171
                        self.last_show_dependencies_id = self.show_dependencies_id = \
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2172
                                source_id
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2173
                elif (pagenum == INFO_NOTEBOOK_LICENSE_PAGE):
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2174
                        if self.selected_pkgstem == self.license_pkgstem:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2175
                                return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2176
                        self.detailspanel.set_fetching_license()
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  2177
                        if self.show_licenses_id != 0:
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  2178
                                gobject.source_remove(self.show_licenses_id)
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  2179
                                self.show_licenses_id = 0
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2180
                        if immediate:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2181
                                source_id = gobject.idle_add(self.__show_licenses)
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2182
                        else:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2183
                                source_id = gobject.timeout_add(SHOW_LICENSE_DELAY,
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2184
                                    self.__show_licenses)
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2185
                        self.last_show_licenses_id = self.show_licenses_id = source_id
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  2186
                elif (pagenum == INFO_NOTEBOOK_VERSIONS_PAGE):
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2187
                        if self.selected_pkgstem == self.versions_pkgstem:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2188
                                return
1999
308392f1f21c 16711 Package Manager Versions tab not displayed correctly
John Rice <john.rice@oracle.com>
parents: 1995
diff changeset
  2189
                        gobject.idle_add(self.detailspanel.set_fetching_versions)
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  2190
                        if self.show_versions_id != 0:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  2191
                                gobject.source_remove(self.show_versions_id)
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  2192
                                self.show_versions_id = 0
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2193
                        if immediate:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2194
                                source_id = gobject.idle_add(self.__show_versions)
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2195
                        else:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2196
                                source_id = gobject.timeout_add(SHOW_VERSIONS_DELAY,
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2197
                                    self.__show_versions)
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2198
                        self.last_show_versions_id = self.show_versions_id = source_id
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2199
                else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2200
                        if self.selected_pkgstem == self.info_pkgstem:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2201
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2202
                        self.detailspanel.set_fetching_info()
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2203
                        if self.show_info_id != 0:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2204
                                gobject.source_remove(self.show_info_id)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2205
                                self.show_info_id = 0
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2206
                        if immediate:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2207
                                source_id = gobject.idle_add(self.__show_info,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2208
                                    model, path)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2209
                        else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2210
                                source_id = gobject.timeout_add(SHOW_INFO_DELAY,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2211
                                    self.__show_info, model, path)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2212
                        self.last_show_info_id = self.show_info_id = source_id
636
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  2213
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2214
        def __toggle_select_all(self, select_all=True):
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2215
                focus_widget = self.w_main_window.get_focus()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2216
                if gui_misc.is_a_textview(focus_widget):
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2217
                        focus_widget.emit('select-all', select_all)
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2218
                        self.w_selectall_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2219
                        self.w_deselect_menuitem.set_sensitive(True)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2220
                        self.unset_busy_cursor()
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2221
                        return
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2222
                elif focus_widget == self.w_searchentry:
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2223
                        if select_all:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2224
                                focus_widget.select_region(0, -1)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2225
                        else:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2226
                                focus_widget.select_region(0, 0)
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2227
                        self.w_selectall_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2228
                        self.w_deselect_menuitem.set_sensitive(True)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2229
                        self.unset_busy_cursor()
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2230
                        return
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2231
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2232
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2233
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2234
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2235
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2236
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2237
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2238
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2239
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2240
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2241
                            sort_filt_model.convert_path_to_child_path(sorted_path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2242
                        path = filt_model.convert_path_to_child_path(filtered_path)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2243
                        if select_all:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2244
                                list_of_paths.append(path)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2245
                        else:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2246
                                filtered_iter = \
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2247
                                        sort_filt_model.convert_iter_to_child_iter(None,
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2248
                                            iter_next)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2249
                                app_iter = filt_model.convert_iter_to_child_iter(
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2250
                                    filtered_iter)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2251
                                if model.get_value(app_iter, enumerations.MARK_COLUMN):
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2252
                                        list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2253
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2254
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2255
                        itr = model.get_iter(path)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2256
                        mark_value = model.get_value(itr, enumerations.MARK_COLUMN)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2257
                        if select_all and not mark_value:
929
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2258
                                model.set_value(itr, enumerations.MARK_COLUMN, True)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2259
                                pkg_stem = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2260
                                    enumerations.STEM_COLUMN)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2261
                                pkg_status = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2262
                                    enumerations.STATUS_COLUMN)
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2263
                                pkg_publisher = model.get_value(itr,
1701
af78ac44dcc2 14199 Export Selections does not work if publisher has alias
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1700
diff changeset
  2264
                                    enumerations.PUBLISHER_PREFIX_COLUMN)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2265
                                pkg_description = model.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2266
                                    enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2267
                                pkg_name = model.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2268
                                    enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2269
                                self.__add_pkg_stem_to_list(pkg_stem, pkg_name, 
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2270
                                    pkg_status, pkg_publisher, pkg_description)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2271
                        elif not select_all and mark_value:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2272
                                model.set_value(itr, enumerations.MARK_COLUMN, False)
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2273
                                pkg_stem = model.get_value(itr,
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2274
                                    enumerations.STEM_COLUMN)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2275
                                self.__remove_pkg_stem_from_list(pkg_stem)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2276
                
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2277
                self.w_selectall_menuitem.set_sensitive(not select_all)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2278
                self.w_deselect_menuitem.set_sensitive(select_all)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2279
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2280
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2281
                self.__enable_disable_install_remove()
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2282
                self.unset_busy_cursor()
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2283
                        
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2284
        def __on_select_all(self, widget):
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2285
                self.set_busy_cursor()
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2286
                gobject.idle_add(self.__toggle_select_all, True)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2287
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2288
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2289
        def __on_select_updates(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2290
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2291
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2292
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2293
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2294
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2295
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2296
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2297
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2298
                        filtered_iter = sort_filt_model.convert_iter_to_child_iter(None, \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2299
                            iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2300
                        app_iter = filt_model.convert_iter_to_child_iter(filtered_iter)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2301
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2302
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2303
                            sort_filt_model.convert_path_to_child_path(sorted_path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2304
                        path = filt_model.convert_path_to_child_path(filtered_path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2305
                        if model.get_value(app_iter, \
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  2306
                            enumerations.STATUS_COLUMN) == api.PackageInfo.UPGRADABLE:
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  2307
                                list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2308
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2309
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2310
                        itr = model.get_iter(path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2311
                        model.set_value(itr, enumerations.MARK_COLUMN, True)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2312
                        pkg_stem = model.get_value(itr, enumerations.STEM_COLUMN)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2313
                        pkg_status = model.get_value(itr, enumerations.STATUS_COLUMN)
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2314
                        pkg_publisher = model.get_value(itr,
1701
af78ac44dcc2 14199 Export Selections does not work if publisher has alias
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1700
diff changeset
  2315
                            enumerations.PUBLISHER_PREFIX_COLUMN)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2316
                        pkg_description = model.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2317
                            enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2318
                        pkg_name = model.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2319
                            enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2320
                        self.__add_pkg_stem_to_list(pkg_stem, pkg_name, pkg_status,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2321
                            pkg_publisher, pkg_description)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2322
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2323
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2324
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2325
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2326
        def __on_deselect(self, widget):
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2327
                self.set_busy_cursor()
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2328
                gobject.idle_add(self.__toggle_select_all, False)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2329
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2330
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2331
        def __on_preferences(self, widget):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2332
                self.preferences.activate()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2333
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2334
        def __on_searchentry_focus_in(self, widget, event):
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2335
                self.__set_search_text_mode(enumerations.SEARCH_STYLE_NORMAL)
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2336
                if self.w_main_clipboard.wait_is_text_available():
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2337
                        self.w_paste_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2338
                char_count = widget.get_text_length()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2339
                if char_count > 0:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2340
                        self.w_selectall_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2341
                else:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2342
                        self.w_selectall_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2343
                bounds = widget.get_selection_bounds()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2344
                if bounds:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2345
                        offset1 = bounds[0]
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2346
                        offset2 = bounds[1] 
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2347
                        if abs(offset2 - offset1) == char_count:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2348
                                self.w_selectall_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2349
                        self.w_deselect_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2350
                        self.w_copy_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2351
                else:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2352
                        self.w_deselect_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2353
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2354
        def __on_searchentry_focus_out(self, widget, event):
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2355
                if self.w_searchentry.get_text_length() == 0:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2356
                        self.__set_search_text_mode(enumerations.SEARCH_STYLE_PROMPT)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2357
                self.w_paste_menuitem.set_sensitive(False)
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2358
                self.__enable_disable_select_all()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2359
                self.__enable_disable_deselect()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2360
                self.w_cut_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2361
                self.w_copy_menuitem.set_sensitive(False)
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  2362
                self.w_delete_menuitem.set_sensitive(False)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2363
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2364
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2365
        def __on_searchentry_selection(self, widget, pspec):
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2366
                self.__enable_disable_entry_selection(widget)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2367
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2368
        def __enable_disable_entry_selection(self, widget):
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2369
                char_count = widget.get_text_length()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2370
                bounds = widget.get_selection_bounds()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2371
                if bounds:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2372
                        #enable selection functions
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2373
                        self.w_cut_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2374
                        self.w_copy_menuitem.set_sensitive(True)
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  2375
                        self.w_delete_menuitem.set_sensitive(True)
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2376
                        if char_count == abs(bounds[1] - bounds[0]):
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2377
                                self.w_selectall_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2378
                        else:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2379
                                self.w_selectall_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2380
                        self.w_deselect_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2381
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2382
                        self.w_cut_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2383
                        self.w_copy_menuitem.set_sensitive(False)
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  2384
                        self.w_delete_menuitem.set_sensitive(False)
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2385
                        self.w_deselect_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2386
                        if char_count == 0:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2387
                                self.w_selectall_menuitem.set_sensitive(False)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2388
                        else:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2389
                                self.w_selectall_menuitem.set_sensitive(True)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  2390
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2391
        def __refilter_on_idle(self):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2392
                if self.application_refilter_id != 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2393
                        gobject.source_remove(self.application_refilter_id)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2394
                        self.application_refilter_id = 0
1914
cb789fa96e0f 15945 Changing the view in PM while the package list is being populated can result in a hang
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1912
diff changeset
  2395
                if self.application_refilter_id == 0:
cb789fa96e0f 15945 Changing the view in PM while the package list is being populated can result in a hang
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1912
diff changeset
  2396
                        self.application_refilter_id = gobject.idle_add(
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2397
                            self.__application_refilter)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2398
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2399
        def __on_category_focus_in(self, widget, event, user):
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2400
                self.__on_category_row_activated(None, None, None, user)
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2401
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2402
        def __on_category_row_activated(self, view, path, col, user):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2403
                '''This function is for handling category double click activations'''
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2404
                # Activated sub node in Recent Searches category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2405
                if self.in_recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2406
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2407
                # User activated Recent Searches Top Level category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2408
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2409
                if model != None and self.recent_searches_cat_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2410
                        rs_path = model.get_path(self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2411
                        selection, curr_path = self.__get_selection_and_category_path()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2412
                        self.pylintstub = selection
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2413
                        if curr_path == rs_path:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2414
                                self.__setup_recent_search_page()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2415
                                return
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2416
                if self.category_list == None:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2417
                        self.__set_main_view_package_list()
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2418
                        return
1122
cf87b7d8fe39 8888 Gtk warning emitted on Reload
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1109
diff changeset
  2419
                if self.w_filter_combobox.get_model():
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2420
                        self.w_filter_combobox.set_active(
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2421
                            self.saved_filter_combobox_active)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2422
                if self.in_search_mode or self.is_all_publishers_search:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2423
                        self.__unset_search(True)
947
181d3c7a54ee 6635 Need support Search across All Repositories (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 944
diff changeset
  2424
                        return
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2425
                self.__set_main_view_package_list()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2426
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2427
                self.__refilter_on_idle()
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2428
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2429
        def __set_main_view_package_list(self, show_list=True):
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2430
                # Only switch from Start Page View to List view if we are not in startup
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2431
                if self.in_startpage_startup:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2432
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2433
                if show_list:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2434
                        self.w_main_view_notebook.set_current_page(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2435
                                NOTEBOOK_PACKAGE_LIST_PAGE)
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2436
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2437
                        self.w_main_view_notebook.set_current_page(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2438
                                NOTEBOOK_START_PAGE)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2439
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2440
        def __on_categoriestreeview_row_collapsed(self, treeview, itr, path, data):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2441
                self.w_categories_treeview.set_cursor(path)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2442
                self.__save_expanded_path(path, False)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2443
                self.__save_active_category(path)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2444
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2445
        def __on_categoriestreeview_row_expanded(self, treeview, itr, path, data):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2446
                if self.in_setup and not self.first_run:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2447
                        return
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2448
                self.w_categories_treeview.set_cursor(path)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2449
                self.__save_expanded_path(path, True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2450
                self.__save_active_category(path)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2451
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2452
        def __on_categoriestreeview_button_press_event(self, treeview, event, data):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2453
                if event.type != gtk.gdk.BUTTON_PRESS:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2454
                        return 1
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2455
                x = int(event.x)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2456
                y = int(event.y)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2457
                pthinfo = treeview.get_path_at_pos(x, y)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2458
                if pthinfo is not None:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2459
                        path = pthinfo[0]
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2460
                        cellx = pthinfo[2]
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2461
                        #Clicking on row toggle icon just select the path
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2462
                        if cellx <= CATEGORY_TOGGLE_ICON_WIDTH:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2463
                                self.w_categories_treeview.set_cursor(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2464
                                self.w_categories_treeview.scroll_to_cell(path)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2465
                                return
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2466
                        #Collapse expand Top level Sections only
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2467
                        tree_view = self.w_categories_treeview
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2468
                        if path != 0 and len(path) == 1:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2469
                                if tree_view.row_expanded(path) and \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2470
                                        self.w_main_view_notebook.get_current_page() == \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2471
                                        NOTEBOOK_START_PAGE:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2472
                                        self.__on_category_selection_changed(
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2473
                                            tree_view.get_selection(), None)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2474
                                elif tree_view.row_expanded(path):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2475
                                        selection, sel_path = \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2476
                                                self.__get_selection_and_category_path()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2477
                                        if selection and sel_path == path:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2478
                                                tree_view.collapse_row(path)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2479
                                else:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2480
                                        tree_view.expand_row(path, False)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2481
                                self.__save_active_category(path)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2482
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2483
        @staticmethod
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2484
        def __categoriestreeview_compare_func(model, column, key, itr):
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2485
                value = model.get_value(itr, column)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2486
                if not value:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2487
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2488
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2489
                try:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2490
                        value = re.sub(REGEX_STRIP_MARKUP, "", value)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2491
                        value = re.sub(REGEX_STRIP_RESULT, "", value)
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2492
                        match = re.match(re.escape(key), re.escape(value), re.IGNORECASE)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2493
                except (TypeError, re.error):
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2494
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2495
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2496
                return match is None
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2497
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2498
        def __in_recent_searches(self, path):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2499
                if not path or len(path) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2500
                        return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2501
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2502
                if model == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2503
                        return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2504
                rs_path = model.get_path(self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2505
                if rs_path and len(rs_path) > 0 and path[0] == rs_path[0]:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2506
                        return True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2507
                return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2508
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2509
        def __save_expanded_path(self, path, expanded):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2510
                if not path or len(path) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2511
                        return                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2512
                self.category_expanded_paths[(self.last_visible_publisher, path)] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2513
                        expanded
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2514
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2515
        def __save_active_category(self, path):
1686
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  2516
                if self.first_run or not path or len(path) == 0 or \
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  2517
                        self.__in_recent_searches(path):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2518
                        return                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2519
                self.category_active_paths[self.last_visible_publisher] = path
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2520
                self.saved_section_active = path[0]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2521
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2522
        def __on_category_selection_changed(self, selection, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2523
                '''This function is for handling category selection changes'''
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2524
                if self.in_setup:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2525
                        return
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  2526
                model, itr = selection.get_selected()
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2527
                if not itr:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2528
                        return
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2529
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2530
                path = model.get_path(itr)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2531
                sel_category = model[path]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2532
                if sel_category[enumerations.CATEGORY_ID] == RECENT_SEARCH_ID:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2533
                        if not self.adding_recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2534
                                self.__setup_recent_search_page()
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2535
                                if not self.is_all_publishers_search:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2536
                                        self.__save_setup_before_search(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2537
                                            single_search=True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2538
                                self.in_search_mode = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2539
                                self.in_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2540
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2541
                                self.__set_main_view_package_list()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2542
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2543
                elif sel_category[enumerations.CATEGORY_ID] > RECENT_SEARCH_ID:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2544
                        self.__restore_recent_search(sel_category)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2545
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2546
                self.__save_active_category(path)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2547
                if self.in_search_mode or self.is_all_publishers_search:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2548
                        #Required for A11Y support because focus event not triggered
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2549
                        #when A11Y enabled and user clicks on Category after Search
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2550
                        self.__unset_search(True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2551
                        self.__set_main_view_package_list()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2552
                        return
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2553
                if self.saved_filter_combobox_active != None:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2554
                        self.w_filter_combobox.set_active(
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2555
                            self.saved_filter_combobox_active)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2556
                self.__set_main_view_package_list()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2557
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  2558
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2559
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2560
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2561
        def __on_applicationtreeview_query_tooltip(self, treeview, x, y, 
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2562
            keyboard_mode, tooltip):
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2563
                treex, treey = treeview.convert_widget_to_bin_window_coords(x, y)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2564
                info = treeview.get_path_at_pos(treex, treey)
1348
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2565
                if not info:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2566
                        return False
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2567
                return self.__show_app_column_tooltip(treeview, _("Status"), 
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2568
                    info[0], info[1], tooltip)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2569
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2570
        @staticmethod
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2571
        def __show_app_column_tooltip(treeview, col_title, path, col, tooltip):
1348
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2572
                tip = ""
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2573
                if path and col:
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2574
                        title = col.get_title() 
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2575
                        if title != col_title:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2576
                                return False
1348
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2577
                        row = list(treeview.get_model()[path])
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2578
                        if row:
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2579
                                status = row[enumerations.STATUS_COLUMN]
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  2580
                                if status == api.PackageInfo.INSTALLED:
1348
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2581
                                        tip = _("Installed")
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  2582
                                elif status == api.PackageInfo.KNOWN:
1348
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2583
                                        tip = _("Not installed")
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  2584
                                elif status == api.PackageInfo.UPGRADABLE:
1348
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2585
                                        tip = _("Updates Available")
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2586
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2587
                if tip != "":
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2588
                        treeview.set_tooltip_cell(tooltip, path, col, None)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2589
                        tooltip.set_text(tip)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2590
                        return True
1348
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2591
                else:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2592
                        return False
1348
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2593
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2594
        def __on_applicationtreeview_button_and_key_events(self, treeview, event):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2595
                if event.type == gtk.gdk.KEY_PRESS:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2596
                        keyname = gtk.gdk.keyval_name(event.keyval)
1348
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2597
                        if event.state == gtk.gdk.CONTROL_MASK and keyname == "F1":
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2598
                                return True #Disable Tooltip popup using Ctrl-F1
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2599
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2600
                        if not(event.state == gtk.gdk.SHIFT_MASK and keyname == "F10"):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2601
                                return
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2602
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2603
                        selection = self.w_application_treeview.get_selection()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2604
                        if not selection:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2605
                                return
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2606
                        model, itr = selection.get_selected()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2607
                        if not model or not itr:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2608
                                return
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2609
                        curr_time = event.time
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2610
                        path = model.get_path(itr)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2611
                        col = treeview.get_column(1) # NAME_COLUMN
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2612
                        treeview.set_cursor(path, col, 0)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2613
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2614
                        #Calculate popup coordinates
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2615
                        treecell_rect = treeview.get_cell_area(path, col)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2616
                        rx, ry = treeview.tree_to_widget_coords(treecell_rect[0],
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2617
                            treecell_rect[1])
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2618
                        winx, winy  = treeview.get_bin_window().get_origin()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2619
                        winx += rx
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2620
                        winy += ry
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2621
                        popup_position = (winx, winy)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2622
                        self.w_package_menu.popup( None, None,
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2623
                            self.__position_package_popup, gtk.gdk.KEY_PRESS,
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2624
                            curr_time, popup_position)
1561
d32a0b4c043b 13138 Context menu is no longer keyboard accessible in PM's list of packages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1560
diff changeset
  2625
                        return True
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2626
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2627
                if event.type != gtk.gdk.BUTTON_PRESS and event.type != 5:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2628
                        return
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2629
                x = int(event.x)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2630
                y = int(event.y)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2631
                pthinfo = treeview.get_path_at_pos(x, y)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2632
                if pthinfo == None:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2633
                        return                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2634
                path = pthinfo[0]
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2635
                col = pthinfo[1]
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2636
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2637
                #Double click
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2638
                if event.type == GDK_2BUTTON_PRESS:
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2639
                        self.__active_pane_toggle(None, path, treeview.get_model())
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2640
                        return                          
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2641
                if event.button == GDK_RIGHT_BUTTON: #Right Click
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2642
                        curr_time = event.time
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2643
                        treeview.grab_focus()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2644
                        treeview.set_cursor( path, col, 0)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2645
                        self.w_package_menu.popup( None, None, None, event.button,
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2646
                            curr_time)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2647
                        return
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2648
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2649
        @staticmethod
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2650
        def __applicationtreeview_compare_func(model, column, key, itr):
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2651
                value = model.get_value(itr, enumerations.NAME_COLUMN)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2652
                if not value:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2653
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2654
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2655
                value = value.lower()
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2656
                return not value.startswith(key.lower())
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2657
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2658
        @staticmethod
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2659
        def __position_package_popup(menu, position):
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2660
                #Positions popup relative to the top left corner of the currently
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2661
                #selected row's Name cell
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2662
                x, y = position
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2663
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2664
                #Offset x by 10 and y by 15 so underlying name is visible
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2665
                return (x+10, y+15, True)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2666
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2667
        def __on_filtercombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2668
                '''On filter combobox changed'''
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2669
                if self.first_run or self.in_setup:
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2670
                        return
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2671
                active = self.w_filter_combobox.get_active()
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2672
                if active != enumerations.FILTER_SELECTED:
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2673
                        self.saved_filter_combobox_active = active
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2674
                self.__set_main_view_package_list()
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  2675
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2676
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2677
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2678
        def __unset_search(self, same_repo):
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
  2679
                self.w_logalert_frame.hide()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2680
                self.__update_tooltips()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2681
                self.in_search_mode = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2682
                self.in_recent_search = False
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2683
                self.is_all_publishers_search = False
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2684
                if same_repo:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2685
                        self.__restore_setup_for_browse()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2686
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2687
        def __on_repositorycombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2688
                '''On repository combobox changed'''
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2689
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2690
                        print "Start change publisher", time.time()
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2691
                if self.same_publisher_on_setup:
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2692
                        if self.is_all_publishers_search:
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2693
                                self.__clear_search_results()
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2694
                        self.same_publisher_on_setup = False
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2695
                        self.unset_busy_cursor()
1511
c6980ed4c49b 12710 Package Manager hangs after clicking on category
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1501
diff changeset
  2696
                        if self.in_setup:
c6980ed4c49b 12710 Package Manager hangs after clicking on category
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1501
diff changeset
  2697
                                self.in_setup = False
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2698
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2699
                selected_publisher = self.__get_selected_publisher()
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2700
                index =  self.w_repository_combobox.get_active()
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2701
                if self.is_all_publishers_search:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2702
                        if index == self.repo_combobox_all_pubs_search_index:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2703
                                return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2704
                        if index == self.repo_combobox_add_index:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2705
                                self.w_repository_combobox.set_active(
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2706
                                    self.repo_combobox_all_pubs_search_index)
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  2707
                                self.__on_file_add_publisher(None)
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2708
                                return
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2709
                        same_repo = self.saved_repository_combobox_active == index
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2710
                        self.__unset_search(same_repo)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2711
                        if same_repo:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2712
                                self.__set_searchentry_to_prompt()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2713
                                return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2714
                        self.w_repository_combobox.set_active(index)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2715
                        selected_publisher = self.__get_selected_publisher()
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2716
                if selected_publisher == self.last_visible_publisher:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2717
                        return
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2718
                if index == self.repo_combobox_all_pubs_search_index:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2719
                        self.__set_all_publishers_search_mode()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2720
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2721
                        
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2722
                if index == self.repo_combobox_add_index:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2723
                        index = self.__get_publisher_combobox_index(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2724
                            self.last_visible_publisher)
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  2725
                        self.w_repository_combobox.set_active(index)
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  2726
                        self.__on_file_add_publisher(None)
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  2727
                        return
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2728
                self.is_all_publishers = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2729
                if index == self.repo_combobox_all_pubs_installed_index:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2730
                        self.w_filter_combobox.set_active(enumerations.FILTER_ALL)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2731
                        self.is_all_publishers_installed = True
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2732
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2733
                        self.is_all_publishers_installed = False
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2734
                        if index == self.repo_combobox_all_pubs_index:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2735
                                self.is_all_publishers = True
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2736
1574
3bb7e6bc5ce4 13216 PM main list not being updated from All Publisher modes
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1573
diff changeset
  2737
                self.__do_set_publisher()
3bb7e6bc5ce4 13216 PM main list not being updated from All Publisher modes
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1573
diff changeset
  2738
3bb7e6bc5ce4 13216 PM main list not being updated from All Publisher modes
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1573
diff changeset
  2739
        def __do_set_publisher(self):
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2740
                self.cancelled = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2741
                self.in_setup = True
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  2742
                self.set_busy_cursor()
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  2743
                self.__set_empty_details_panel()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2744
                if self.in_search_mode:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2745
                        self.__unset_search(False)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2746
1574
3bb7e6bc5ce4 13216 PM main list not being updated from All Publisher modes
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1573
diff changeset
  2747
                pub = [self.__get_selected_publisher(), ]
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2748
                self.set_section = self.gconf.initial_section
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2749
                self.__set_searchentry_to_prompt()
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2750
                self.__disconnect_models()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  2751
                Thread(target = self.__setup_publisher, args = [pub]).start()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2752
                self.__set_main_view_package_list()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2753
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2754
        def __get_selected_publisher(self):
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  2755
                pub_iter = self.w_repository_combobox.get_active_iter()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2756
                if pub_iter == None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2757
                        return None
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  2758
                return self.repositories_list.get_value(pub_iter, \
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  2759
                            enumerations.REPOSITORY_PREFIX)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2760
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2761
        def __setup_publisher(self, publishers):
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2762
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  2763
                gobject.idle_add(self.set_busy_cursor)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2764
                self.__setup_publisher_without_lock(publishers)
1966
dd38788677ea 16380 Upgrade failed with error: cannot release un-aquired lock
John Rice <john.rice@oracle.com>
parents: 1931
diff changeset
  2765
                gui_misc.release_lock(self.api_lock)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2766
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2767
        def __setup_publisher_without_lock(self, publishers):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2768
                self.saved_filter_combobox_active = self.gconf.initial_show_filter
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  2769
                application_list, category_list , section_list = \
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  2770
                    self.__get_application_categories_lists(publishers)
1203
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  2771
                self.__unset_saved()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2772
                self.publisher_changed = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2773
                self.last_visible_publisher = self.__get_selected_publisher()
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2774
                self.saved_repository_combobox_active = \
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2775
                        self.w_repository_combobox.get_active()
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  2776
                gobject.idle_add(self.__init_tree_views, application_list,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  2777
                    category_list, section_list)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2778
1203
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  2779
        def __unset_saved(self):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2780
                self.__save_application_list(None)
1203
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  2781
                self.saved_application_list_filter = None
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  2782
                self.saved_application_list_sort = None
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  2783
                self.saved_category_list = None
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  2784
                self.saved_section_list = None
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  2785
1267
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2786
        def __refresh_for_publisher(self, pub):
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2787
                status_str = _("Refreshing package catalog information")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2788
                gobject.idle_add(self.update_statusbar_message,
1267
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2789
                    status_str)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  2790
                if self.is_all_publishers_installed or self.is_all_publishers: 
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2791
                        self.__do_refresh()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2792
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2793
                        self.__do_refresh(pubs=[pub])
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2794
1675
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2795
        def __do_refresh(self, pubs=None, immediate=False):
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2796
                success = False
1267
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2797
                try:
2425
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  2798
                        if debug_perf:
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  2799
                                print "Time before reset",time.time()
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  2800
                        if immediate:
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  2801
                                self.api_o.reset()
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  2802
                        if debug_perf:
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  2803
                                print "Time after reset", time.time()
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2804
                        self.api_o.refresh(pubs=pubs, immediate=immediate)
2425
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  2805
                        if debug_perf:
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  2806
                                print "after refresh", time.time()
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2807
                        success = True
1267
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2808
                except api_errors.CatalogRefreshException, cre:
2415
2df3e2e5922f 18428 Fail to add https repos by PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2387
diff changeset
  2809
                        res = gui_misc.get_catalogrefresh_exception_msg(cre)
2df3e2e5922f 18428 Fail to add https repos by PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2387
diff changeset
  2810
                        logger.error(res[0])
1675
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2811
                        gui_misc.notify_log_error(self)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2812
                except api_errors.TransportError, tpex:
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2813
                        err = str(tpex)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2814
                        logger.error(err)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2815
                        gui_misc.notify_log_error(self)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2816
                except api_errors.InvalidDepotResponseException, idex:
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2817
                        err = str(idex)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2818
                        logger.error(err)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2819
                        gui_misc.notify_log_error(self)
1871
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  2820
                except api_errors.PermissionsException, ex:
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  2821
                        if self.first_run:
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  2822
                                self.user_rights = False
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  2823
                        err = str(ex)
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  2824
                        gobject.idle_add(self.error_occurred, err,
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  2825
                            None, gtk.MESSAGE_INFO)
1267
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2826
                except api_errors.ApiException, ex:
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2827
                        err = str(ex)
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2828
                        gobject.idle_add(self.error_occurred, err,
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2829
                            None, gtk.MESSAGE_INFO)
1595
8cf1816d23c6 13414 Traceback on the __do_refresh, when general Exception occurs
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1593
diff changeset
  2830
                except Exception, ex:
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2831
                        err = str(ex)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2832
                        gobject.idle_add(self.error_occurred, err,
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2833
                            None, gtk.MESSAGE_INFO)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2834
                return success
1267
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  2835
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2836
        def __get_application_categories_lists(self, publishers):
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2837
                application_list = self.__get_new_application_liststore()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2838
                category_list = self.__get_new_category_liststore()
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  2839
                section_list = self.__get_new_section_liststore()
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2840
                for pub in publishers:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2841
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2842
                                a = time.time()
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2843
                        self.__refresh_for_publisher(pub)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2844
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2845
                                print "Time to refresh", time.time() - a
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2846
                                a = time.time()
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2847
                        self.__add_pkgs_to_lists_from_api(pub,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2848
                            application_list, category_list, section_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2849
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2850
                                b = time.time()
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2851
                                print "Time to add", b - a, b
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  2852
                        category_list.prepend(None, [0, _('All'), _('All'), None,
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  2853
                            None, True])
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2854
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  2855
                return application_list, category_list, section_list
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2856
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2857
        def __add_install_update_pkgs_for_publishers(self, install_update,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2858
            confirmation_list):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2859
                for pub_name in self.selected_pkgs:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2860
                        pub_display_name = self.get_publisher_display_name_from_prefix(
1701
af78ac44dcc2 14199 Export Selections does not work if publisher has alias
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1700
diff changeset
  2861
                            pub_name)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2862
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2863
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2864
                                break
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2865
                        for pkg_stem in pkgs:
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2866
                                status = pkgs.get(pkg_stem)[0]
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  2867
                                if status == api.PackageInfo.KNOWN or \
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  2868
                                    status == api.PackageInfo.UPGRADABLE:
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2869
                                        install_update.append(pkg_stem)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2870
                                        if self.gconf.show_install:
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2871
                                                desc = pkgs.get(pkg_stem)[1]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2872
                                                pkg_name = pkgs.get(pkg_stem)[2]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2873
                                                confirmation_list.append(
1701
af78ac44dcc2 14199 Export Selections does not work if publisher has alias
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1700
diff changeset
  2874
                                                    [pkg_name, pub_display_name,
1918
c797e8eac426 12606 packagemanager could give a "continue" option
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1914
diff changeset
  2875
                                                    desc, status, pkg_stem])
1650
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
  2876
                                                    
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
  2877
        def __on_log_activate(self, widget):                                
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
  2878
                if self.error_logged:
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
  2879
                        self.error_logged = False
2423
645d3c91056f 18420 Warning triangle not visible in All Publishers (Search).
John Rice <john.rice@oracle.com>
parents: 2417
diff changeset
  2880
                        self.w_logalert_frame.hide()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2881
                self.logging.log_activate()
1650
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
  2882
                
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2883
        def __on_version_info(self, widget):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2884
                model, itr = self.package_selection.get_selected()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2885
                if itr:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2886
                        pkg_stem = model.get_value(itr, enumerations.STEM_COLUMN)
1799
b31d77bedd8c 14887 Package Version Info dialog doesn't work for uninstalled packages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1791
diff changeset
  2887
                        name = model.get_value(itr, enumerations.ACTUAL_NAME_COLUMN)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2888
                        self.set_busy_cursor()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2889
                        Thread(target = self.__get_info, args = (pkg_stem, name)).start()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2890
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2891
        def check_exiting(self):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2892
                return self.exiting
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2893
          
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2894
        def __get_info(self, pkg_stem, name):
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2895
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  2896
                gobject.idle_add(self.set_busy_cursor)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2897
                self.__get_info_without_lock(pkg_stem, name)
1966
dd38788677ea 16380 Upgrade failed with error: cannot release un-aquired lock
John Rice <john.rice@oracle.com>
parents: 1931
diff changeset
  2898
                gui_misc.release_lock(self.api_lock)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2899
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2900
        def __get_info_without_lock(self, pkg_stem, name):
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  2901
                if not self.do_api_reset():
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2902
                        return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2903
                try:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2904
                        if self.versioninfo.get_info(pkg_stem, name):
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2905
                                gobject.idle_add(self.unset_busy_cursor)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2906
                except api_errors.ApiException, ex:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2907
                        err = str(ex)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2908
                        logger.error(err)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2909
                        gobject.idle_add(gui_misc.notify_log_error, self)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2910
                        gobject.idle_add(self.unset_busy_cursor)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2911
                return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2912
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  2913
        def do_api_reset(self):
1868
dc308aadd7d6 15484 unexpected package manger error on osol-134
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1866
diff changeset
  2914
                if self.api_o == None:
dc308aadd7d6 15484 unexpected package manger error on osol-134
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1866
diff changeset
  2915
                        return False
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2916
                try:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2917
                        self.api_o.reset()
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2918
                except api_errors.ApiException, ex:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2919
                        err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2920
                        gobject.idle_add(self.error_occurred, err,
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2921
                            None, gtk.MESSAGE_INFO)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2922
                        return False
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2923
                return True
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2924
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2925
        def __on_install_update(self, widget):
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  2926
                if not self.do_api_reset():
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2927
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2928
                install_update = []
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2929
                install_confirmation_list = []
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2930
                if self.all_selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2931
                        self.__add_install_update_pkgs_for_publishers(
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2932
                                    install_update, install_confirmation_list)
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2933
1058
11da4bffbd61 8186 Mixing the pkg(1) and GUI commands causes wrong pkg states in the GUI.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1056
diff changeset
  2934
                if self.img_timestamp != self.cache_o.get_index_timestamp():
11da4bffbd61 8186 Mixing the pkg(1) and GUI commands causes wrong pkg states in the GUI.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1056
diff changeset
  2935
                        self.img_timestamp = None
11da4bffbd61 8186 Mixing the pkg(1) and GUI commands causes wrong pkg states in the GUI.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1056
diff changeset
  2936
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  2937
                self.installupdate = installupdate.InstallUpdate(install_update, self, \
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  2938
                    self.image_directory, action = enumerations.INSTALL_UPDATE,
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2939
                    main_window = self.w_main_window,
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2940
                    confirmation_list = install_confirmation_list,
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2941
                    show_confirmation = self.gconf.show_install,
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2942
                    api_lock = self.api_lock,
1910
65490aa28cdb 15941 Traceback when toggling checkbox in PM's Remove Confirmation dialog
John Rice <john.rice@sun.com>
parents: 1905
diff changeset
  2943
                    gconf = self.gconf)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2944
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2945
        def __on_update_all(self, widget):
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  2946
                if not self.do_api_reset():
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2947
                        return
2076
e4ab75e15bb4 17003 Traceback when attempting update but no updates available
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2061
diff changeset
  2948
                self.installupdate = installupdate.InstallUpdate([], self,
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  2949
                    self.image_directory, action = enumerations.IMAGE_UPDATE,
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2950
                    parent_name = self.program_title,
1791
b2a37ff09e8c 13994 References to package names may need to change
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1790
diff changeset
  2951
                    pkg_list = [gui_misc.package_name["SUNWipkg"],
b2a37ff09e8c 13994 References to package names may need to change
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1790
diff changeset
  2952
                    gui_misc.package_name["SUNWipkg-gui"]],
1259
ee4f1901712e 9363 pm-updatemanager thoroughly broken when used with -R option
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1258
diff changeset
  2953
                    main_window = self.w_main_window,
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2954
                    icon_confirm_dialog = self.window_icon,
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2955
                    show_confirmation = self.gconf.show_image_update,
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2956
                    api_lock = self.api_lock,
1910
65490aa28cdb 15941 Traceback when toggling checkbox in PM's Remove Confirmation dialog
John Rice <john.rice@sun.com>
parents: 1905
diff changeset
  2957
                    gconf = self.gconf)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  2958
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2959
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2960
        def __on_help_about(self, widget):
2015
e88d9c13d760 16766 About dialog trace back
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2014
diff changeset
  2961
                aboutdialog = self.builder.get_object("aboutdialog")
1446
72569184fd0d 9868 Package Manager and Update Manager should not define icons in glade files
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1443
diff changeset
  2962
                aboutdialog.set_icon(self.window_icon)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2963
                aboutdialog.connect("response", lambda x = None, \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  2964
                    y = None: aboutdialog.hide())
2010
eeba083d1e4a 16134 About Package Manager dialog needs to be updated
John Rice <john.rice@oracle.com>
parents: 2009
diff changeset
  2965
                aboutdialog.set_version(gui_misc.get_os_version_and_build())
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2966
                aboutdialog.run()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2967
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2968
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2969
        def __on_help_help(widget):
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2970
                gui_misc.display_help()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2971
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2972
        def __add_remove_pkgs_for_publishers(self, remove_list, confirmation_list):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2973
                for pub_name in self.selected_pkgs:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2974
                        pub_display_name = self.get_publisher_display_name_from_prefix(
1701
af78ac44dcc2 14199 Export Selections does not work if publisher has alias
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1700
diff changeset
  2975
                            pub_name)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2976
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2977
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2978
                                break
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2979
                        for pkg_stem in pkgs:
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2980
                                status = pkgs.get(pkg_stem)[0]
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  2981
                                if status == api.PackageInfo.INSTALLED or \
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  2982
                                    status == api.PackageInfo.UPGRADABLE:
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2983
                                        remove_list.append(pkg_stem)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2984
                                        if self.gconf.show_remove:
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2985
                                                desc = pkgs.get(pkg_stem)[1]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2986
                                                pkg_name = pkgs.get(pkg_stem)[2]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2987
                                                confirmation_list.append(
1701
af78ac44dcc2 14199 Export Selections does not work if publisher has alias
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1700
diff changeset
  2988
                                                    [pkg_name, pub_display_name,
1918
c797e8eac426 12606 packagemanager could give a "continue" option
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1914
diff changeset
  2989
                                                    desc, status, pkg_stem])
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  2990
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2991
        def __on_remove(self, widget):
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  2992
                if not self.do_api_reset():
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2993
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2994
                remove_list = []
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2995
                remove_confirmation_list = []
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2996
                if self.all_selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2997
                        self.__add_remove_pkgs_for_publishers(remove_list, 
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2998
                            remove_confirmation_list)
1058
11da4bffbd61 8186 Mixing the pkg(1) and GUI commands causes wrong pkg states in the GUI.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1056
diff changeset
  2999
11da4bffbd61 8186 Mixing the pkg(1) and GUI commands causes wrong pkg states in the GUI.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1056
diff changeset
  3000
                if self.img_timestamp != self.cache_o.get_index_timestamp():
11da4bffbd61 8186 Mixing the pkg(1) and GUI commands causes wrong pkg states in the GUI.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1056
diff changeset
  3001
                        self.img_timestamp = None
11da4bffbd61 8186 Mixing the pkg(1) and GUI commands causes wrong pkg states in the GUI.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1056
diff changeset
  3002
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  3003
                self.installupdate = installupdate.InstallUpdate(remove_list, self,
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3004
                    self.image_directory, action = enumerations.REMOVE,
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3005
                    main_window = self.w_main_window,
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  3006
                    confirmation_list = remove_confirmation_list,
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  3007
                    show_confirmation = self.gconf.show_remove,
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  3008
                    api_lock = self.api_lock,
1910
65490aa28cdb 15941 Traceback when toggling checkbox in PM's Remove Confirmation dialog
John Rice <john.rice@sun.com>
parents: 1905
diff changeset
  3009
                    gconf = self.gconf)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3010
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3011
        def __on_reload(self, widget):
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3012
                self.force_reload_packages = True
2425
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  3013
                self.__do_reload(widget, True)
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  3014
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  3015
        def __do_reload(self, widget, immediate):
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3016
                self.w_repository_combobox.grab_focus()
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3017
                if self.force_reload_packages and (self.in_search_mode 
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3018
                    or self.is_all_publishers_search):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3019
                        self.__unset_search(False)
2417
211213b6d0ba 17108 Package Details not displayed after publisher action
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2415
diff changeset
  3020
                if self.force_reload_packages:
211213b6d0ba 17108 Package Details not displayed after publisher action
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2415
diff changeset
  3021
                        self.__set_empty_details_panel()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3022
                self.in_setup = True
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3023
                self.last_visible_publisher = None
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3024
                self.set_busy_cursor()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3025
                status_str = _("Refreshing package catalog information")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3026
                self.update_statusbar_message(status_str)
2425
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  3027
                Thread(target = self.__catalog_refresh, args = (immediate,)).start()
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  3028
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  3029
        def __catalog_refresh(self, immediate):
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3030
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  3031
                gobject.idle_add(self.set_busy_cursor)
2425
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  3032
                self.__catalog_refresh_without_lock(immediate)
1966
dd38788677ea 16380 Upgrade failed with error: cannot release un-aquired lock
John Rice <john.rice@oracle.com>
parents: 1931
diff changeset
  3033
                gui_misc.release_lock(self.api_lock)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3034
2425
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  3035
        def __catalog_refresh_without_lock(self, immediate):
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3036
                """Update image's catalogs."""
2425
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  3037
                success = self.__do_refresh(immediate=immediate)
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  3038
                if not success:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  3039
                        gobject.idle_add(self.unset_busy_cursor)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  3040
                        gobject.idle_add(self.update_statusbar)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  3041
                        return -1
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3042
                gobject.idle_add(self.__clear_recent_searches)
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3043
                self.__catalog_refresh_done()
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3044
                return 0
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3045
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3046
        def __catalog_refresh_done(self):
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3047
                if not self.exiting:
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  3048
                        gobject.idle_add(self.process_package_list_start)
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3049
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3050
        def __get_publisher_name_from_index(self, index):
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3051
                name = None
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3052
                if index != -1:
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3053
                        itr = self.repositories_list.iter_nth_child(None,
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3054
                            index)
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3055
                        name = self.repositories_list.get_value(itr,
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3056
                            enumerations.REPOSITORY_PREFIX)
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3057
                return name
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3058
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3059
        def __shutdown_part1(self):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3060
                self.cancelled = True
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3061
                self.exiting = True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3062
                self.__progress_pulse_stop()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3063
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3064
                self.w_main_window.hide()
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3065
                gui_misc.shutdown_logging()
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3066
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3067
        def __shutdown_part2(self):
1711
f22e9bf2c994 14249 packagemanager can get stuck in infinite error loop on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1704
diff changeset
  3068
                if self.api_o and self.api_o.can_be_canceled():
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3069
                        Thread(target = self.api_o.cancel, args = ()).start()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3070
                gui_misc.exit_if_no_threads()
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3071
                gobject.timeout_add(1000, gui_misc.exit_if_no_threads)
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3072
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3073
        def __main_application_quit(self, restart = False):
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3074
                '''quits the main gtk loop'''
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3075
                save_width, save_height = self.w_main_window.get_size()
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3076
                save_hpos = self.w_main_hpaned.get_position()
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3077
                save_vpos = self.w_main_vpaned.get_position()
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3078
                
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3079
                self.__shutdown_part1()
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3080
                pub = ""
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3081
                start_insearch = False
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3082
                width = height = hpos = vpos = -1
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3083
                if self.gconf.save_state:
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3084
                        if self.is_all_publishers_search:
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3085
                                start_insearch = True
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3086
                                sel_pub = self.publisher_options[PUBLISHER_INSTALLED]
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3087
                        elif (self.is_all_publishers_installed or
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3088
                            self.is_all_publishers):
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3089
                                sel_pub = self.__get_publisher_name_from_index(
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3090
                                    self.saved_repository_combobox_active)
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3091
                        else:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3092
                                sel_pub = self.__get_selected_publisher()
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3093
                        if sel_pub != None:
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3094
                                pub = sel_pub
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3095
                        width = save_width
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3096
                        height = save_height
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3097
                        hpos = save_hpos
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3098
                        vpos = save_vpos
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3099
                else:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3100
                        # Reset to start in search mode having loaded installed pkgs
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3101
                        pub = self.publisher_options[PUBLISHER_INSTALLED]
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3102
                        start_insearch = True
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3103
                self.gconf.save_values(pub, start_insearch, width, height,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3104
                    hpos, vpos)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3105
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3106
                if restart:
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  3107
                        gobject.spawn_async([self.application_path, "-R",
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3108
                            self.image_directory, "-U"])
1258
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3109
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3110
                if len(self.search_completion) > 0:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3111
                        self.cache_o.dump_search_completion_info(
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3112
                            self.search_completion)
1869
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3113
                if self.gconf.save_state:
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3114
                        if len(self.category_active_paths) > 0:
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3115
                                self.cache_o.dump_categories_active_dict(
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3116
                                    self.category_active_paths)
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3117
                        if len(self.category_expanded_paths) > 0:
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3118
                                self.cache_o.dump_categories_expanded_dict(
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3119
                                    self.category_expanded_paths)
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3120
                else:
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3121
                        self.cache_o.dump_categories_active_dict({})
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3122
                        self.cache_o.dump_categories_expanded_dict({})
1258
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3123
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3124
                self.__shutdown_part2()
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3125
                return True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3126
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3127
        def __check_if_something_was_changed(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3128
                ''' Returns True if any of the check boxes for package was changed, false
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3129
                if not'''
1139
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  3130
                if self.application_list:
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  3131
                        for pkg in self.application_list:
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  3132
                                if pkg[enumerations.MARK_COLUMN] == True:
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  3133
                                        return True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3134
                return False
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3135
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3136
        def __setup_repositories_combobox(self, api_o):
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3137
                previous_publisher = None
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3138
                previous_saved_name = None
1593
2ba501f9e3db 13212 Package Manager displays wrong publisher after installing a package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1592
diff changeset
  3139
                if not self.first_run:
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3140
                        previous_publisher = self.__get_selected_publisher()
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3141
                        if self.saved_repository_combobox_active != -1:
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3142
                                itr = self.repositories_list.iter_nth_child(None,
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3143
                                    self.saved_repository_combobox_active)
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3144
                                previous_saved_name = \
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3145
                                   self.repositories_list.get_value(itr, 
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3146
                                   enumerations.REPOSITORY_PREFIX)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3147
                self.__disconnect_repository_model()
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3148
                self.repositories_list = self.__get_new_repositories_liststore()
2387
6a57682e2017 18436 PM making invalid assumptions about preferred pub
John Rice <john.rice@oracle.com>
parents: 2377
diff changeset
  3149
                highest_ranked_pub = api_o.get_highest_ranked_publisher()
6a57682e2017 18436 PM making invalid assumptions about preferred pub
John Rice <john.rice@oracle.com>
parents: 2377
diff changeset
  3150
                default_pub = None
6a57682e2017 18436 PM making invalid assumptions about preferred pub
John Rice <john.rice@oracle.com>
parents: 2377
diff changeset
  3151
                if highest_ranked_pub != None and  \
6a57682e2017 18436 PM making invalid assumptions about preferred pub
John Rice <john.rice@oracle.com>
parents: 2377
diff changeset
  3152
                        isinstance(highest_ranked_pub, publisher.Publisher):
6a57682e2017 18436 PM making invalid assumptions about preferred pub
John Rice <john.rice@oracle.com>
parents: 2377
diff changeset
  3153
                        default_pub = highest_ranked_pub.prefix
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3154
                if self.default_publisher != default_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3155
                        self.__clear_pkg_selections()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3156
                        self.default_publisher = default_pub
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3157
                selected_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3158
                enabled_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3159
                for repo in self.selected_pkgs:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3160
                        selected_repos.append(repo)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3161
                i = 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3162
                active = 0
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3163
                self.pubs_info = {}
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3164
                self.pubs_display_name = {}
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3165
                pubs = api_o.get_publishers()
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3166
                for pub in pubs:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3167
                        self.pubs_info[pub.prefix] = (pub.disabled, pub.alias)
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3168
                        if pub.disabled:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3169
                                continue
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3170
                        alias = pub.alias
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3171
                        prefix = pub.prefix
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3172
                        if gui_misc.alias_clash(pubs, prefix, alias):
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3173
                                display_name = "%s (%s)" % (alias, prefix)
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3174
                        elif alias == None or len(alias) == 0:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3175
                                display_name = prefix
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3176
                        else:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3177
                                display_name = alias
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3178
                        self.pubs_display_name[pub.prefix] = display_name
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3179
                        if cmp(prefix, self.default_publisher) == 0:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3180
                                active = i
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3181
                        self.repositories_list.append([i, display_name, prefix, alias ])
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3182
                        enabled_repos.append(prefix)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3183
                        i = i + 1
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3184
                self.repo_combobox_all_pubs_index = i
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3185
                self.repositories_list.append([self.repo_combobox_all_pubs_index,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3186
                    self.publisher_options[PUBLISHER_ALL],
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3187
                    self.publisher_options[PUBLISHER_ALL], None, ])
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3188
                i = i + 1
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3189
                self.repositories_list.append([-1, "", None, None, ])
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3190
                i = i + 1
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3191
                self.repo_combobox_all_pubs_installed_index = i
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3192
                #Workaround to display Publisher All Search during startup
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3193
                #If stating in Search mode
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3194
                if self.first_run and self.gconf.start_insearch:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3195
                        self.repositories_list.append(
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3196
                            [self.repo_combobox_all_pubs_installed_index,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3197
                            self.publisher_options[PUBLISHER_ALL_SEARCH],
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3198
                            self.publisher_options[PUBLISHER_INSTALLED],
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3199
                            None, ])
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3200
                else:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3201
                        self.repositories_list.append(
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3202
                            [self.repo_combobox_all_pubs_installed_index,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3203
                            self.publisher_options[PUBLISHER_INSTALLED],
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3204
                            self.publisher_options[PUBLISHER_INSTALLED],
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3205
                            None, ])
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3206
                i = i + 1
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3207
                self.repositories_list.append([-1, "", None, None, ])
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3208
                i = i + 1
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3209
                self.repo_combobox_all_pubs_search_index = i
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3210
                self.repositories_list.append([self.repo_combobox_all_pubs_search_index,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3211
                    self.publisher_options[PUBLISHER_ALL_SEARCH],
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3212
                    self.publisher_options[PUBLISHER_ALL_SEARCH], None, ])
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3213
                i = i + 1
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3214
                self.repositories_list.append([-1, "", None, None, ])
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3215
                i = i + 1
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3216
                self.repo_combobox_add_index = i
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3217
                self.repositories_list.append([-1,
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3218
                    self.publisher_options[PUBLISHER_ADD],
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3219
                    self.publisher_options[PUBLISHER_ADD], None, ])
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3220
                pkgs_to_remove = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3221
                for repo_name in selected_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3222
                        if repo_name not in enabled_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3223
                                pkg_stems = self.selected_pkgs.get(repo_name)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3224
                                for pkg_stem in pkg_stems:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3225
                                        pkgs_to_remove.append(pkg_stem)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3226
                for pkg_stem in pkgs_to_remove:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3227
                        self.__remove_pkg_stem_from_list(pkg_stem)
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3228
                self.w_repository_combobox.set_model(self.repositories_list)
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3229
                selected_id = -1
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3230
                self.same_publisher_on_setup = False
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3231
                if self.gconf.lastsource == None or self.gconf.lastsource == "":
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3232
                        # Start in search mode having loaded installed pkgs
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3233
                        self.gconf.set_lastsource(
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3234
                            self.publisher_options[PUBLISHER_INSTALLED])
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3235
                        self.gconf.set_start_insearch(True)
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3236
                        
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3237
                if self.first_run:
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3238
                        for repo in self.repositories_list:
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3239
                                if (repo[enumerations.REPOSITORY_PREFIX] == \
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3240
                                    self.gconf.lastsource and
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3241
                                    repo[enumerations.REPOSITORY_ID] != -1):
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3242
                                        selected_id = \
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3243
                                           repo[enumerations.REPOSITORY_ID]
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3244
                                        break
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3245
                else:
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3246
                        for repo in self.repositories_list:
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3247
                                if (repo[enumerations.REPOSITORY_PREFIX] ==
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3248
                                    previous_publisher and
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3249
                                    repo[enumerations.REPOSITORY_ID] != -1):
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3250
                                        selected_id = \
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3251
                                           repo[enumerations.REPOSITORY_ID]
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3252
                                        if (previous_publisher != \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3253
                                            self.publisher_options[PUBLISHER_ALL] and
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3254
                                            not self.force_reload_packages):
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3255
                                                self.same_publisher_on_setup = True
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3256
                                        break
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3257
                        if self.saved_repository_combobox_active != -1:
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3258
                                self.saved_repository_combobox_active = -1
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3259
                                for repo in self.repositories_list:
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3260
                                        if (repo[enumerations.REPOSITORY_PREFIX] ==
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3261
                                            previous_saved_name):
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3262
                                                self.saved_repository_combobox_active = \
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3263
                                                   repo[enumerations.REPOSITORY_ID]
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3264
                                                break
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3265
                                # Previous publisher no longer enabled
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3266
                                if self.saved_repository_combobox_active == -1:
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3267
                                        selected_id = -1
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3268
                                        self.same_publisher_on_setup = False
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3269
                if selected_id != -1:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3270
                        self.w_repository_combobox.set_active(selected_id)
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3271
                elif self.default_publisher:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3272
                        self.w_repository_combobox.set_active(active)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3273
                else:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3274
                        self.w_repository_combobox.set_active(0)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3275
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3276
        def __active_pane_toggle(self, cell, path, model_sort):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3277
                '''Toggle function for column enumerations.MARK_COLUMN'''
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3278
                applicationModel = model_sort.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3279
                applicationPath = model_sort.convert_path_to_child_path(path)
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3280
                filterModel = applicationModel.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3281
                child_path = applicationModel.convert_path_to_child_path(applicationPath)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3282
                itr = filterModel.get_iter(child_path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3283
                if itr:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3284
                        modified = filterModel.get_value(itr, enumerations.MARK_COLUMN)
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3285
                        filterModel.set_value(itr, enumerations.MARK_COLUMN,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3286
                            not modified)
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3287
                        pkg_status = filterModel.get_value(itr,
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3288
                            enumerations.STATUS_COLUMN)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3289
                        pkg_stem = filterModel.get_value(itr, enumerations.STEM_COLUMN)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3290
                        if modified:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3291
                                self.__remove_pkg_stem_from_list(pkg_stem)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3292
                        else:
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3293
                                pkg_publisher = filterModel.get_value(itr, 
1701
af78ac44dcc2 14199 Export Selections does not work if publisher has alias
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1700
diff changeset
  3294
                                    enumerations.PUBLISHER_PREFIX_COLUMN)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3295
                                pkg_description = filterModel.get_value(itr, 
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3296
                                    enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3297
                                pkg_name = filterModel.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3298
                                    enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3299
                                self.__add_pkg_stem_to_list(pkg_stem, pkg_name,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3300
                                    pkg_status, pkg_publisher, pkg_description)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3301
                        self.update_statusbar()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3302
                        self.__enable_disable_selection_menus()
1365
901f56c16926 11142 (Un)installing a package which is focused but not selected should be prevented
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1361
diff changeset
  3303
                        self.__enable_disable_install_remove()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3304
1871
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  3305
        def __update_menu_items(self):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3306
                if self.user_rights:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3307
                        self.w_reload_menuitem.set_sensitive(True)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3308
                        self.w_reload_button.set_sensitive(True)
1871
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  3309
                        self.w_updateall_button.set_sensitive(True)
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  3310
                        self.w_updateall_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3311
                else:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3312
                        self.w_reload_menuitem.set_sensitive(False)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3313
                        self.w_reload_button.set_sensitive(False)
1871
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  3314
                        self.w_updateall_button.set_sensitive(False)
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  3315
                        self.w_updateall_menuitem.set_sensitive(False)
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  3316
                if self.is_admin:
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  3317
                        self.w_be_menuitem.set_sensitive(True)
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  3318
                else:
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  3319
                        self.w_be_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3320
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3321
        def __add_pkg_stem_to_list(self, stem, name, status, pub, description="test"):
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3322
                if self.selected_pkgs.get(pub) == None:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3323
                        self.selected_pkgs[pub] = {}
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3324
                self.selected_pkgs.get(pub)[stem] = [status, description, name]
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3325
                if status == api.PackageInfo.KNOWN or \
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3326
                    status == api.PackageInfo.UPGRADABLE:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3327
                        if self.to_install_update.get(pub) == None:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3328
                                self.to_install_update[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3329
                        else:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3330
                                self.to_install_update[pub] += 1
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3331
                if status == api.PackageInfo.UPGRADABLE or \
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3332
                    status == api.PackageInfo.INSTALLED:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3333
                        if self.to_remove.get(pub) == None:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3334
                                self.to_remove[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3335
                        else:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3336
                                self.to_remove[pub] += 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3337
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3338
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3339
        def __update_tooltips(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3340
                to_remove = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3341
                to_install = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3342
                no_iter = 0
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3343
                for pub in self.to_remove:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3344
                        packages = self.to_remove.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3345
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3346
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3347
                                        to_remove = _("Selected for Removal:")
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3348
                                to_remove += "\n   %s: %d" % (pub, packages)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3349
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3350
                no_iter = 0
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3351
                for pub in self.to_install_update:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3352
                        packages = self.to_install_update.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3353
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3354
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3355
                                        to_install = _("Selected for Install/Update:")
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3356
                                to_install += "\n   %s: %d" % (pub, packages)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3357
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3358
                if not to_install:
1109
007533ebbea5 8577 IPS Localization update at 2009.06 B4
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1103
diff changeset
  3359
                        to_install = _("Select packages by marking the checkbox "
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3360
                            "and click to Install/Update.")
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3361
                self.w_installupdate_button.set_tooltip_text(to_install)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3362
                if not to_remove:
1109
007533ebbea5 8577 IPS Localization update at 2009.06 B4
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1103
diff changeset
  3363
                        to_remove = _("Select packages by marking the checkbox "
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3364
                            "and click to Remove selected.")
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3365
                self.w_remove_button.set_tooltip_text(to_remove)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3366
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3367
        def __remove_pkg_stem_from_list(self, stem):
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3368
                remove_pub = []
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3369
                for pub in self.selected_pkgs:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3370
                        pkgs = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3371
                        status = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3372
                        if stem in pkgs:
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3373
                                status = pkgs.pop(stem)[0]
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3374
                        if status == api.PackageInfo.KNOWN or \
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3375
                            status == api.PackageInfo.UPGRADABLE:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3376
                                if self.to_install_update.get(pub) == None:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3377
                                        self.to_install_update[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3378
                                else:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3379
                                        self.to_install_update[pub] -= 1
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3380
                        if status == api.PackageInfo.UPGRADABLE or \
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3381
                            status == api.PackageInfo.INSTALLED:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3382
                                if self.to_remove.get(pub) == None:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3383
                                        self.to_remove[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3384
                                else:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3385
                                        self.to_remove[pub] -= 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3386
                        if len(pkgs) == 0:
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3387
                                remove_pub.append(pub)
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3388
                for pub in remove_pub:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3389
                        self.selected_pkgs.pop(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3390
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3391
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3392
        def __clear_pkg_selections(self):
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3393
                # We clear the selections as the preferred repository was changed
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3394
                # and pkg stems are not valid.
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3395
                remove_pub = []
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3396
                for pub in self.selected_pkgs:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3397
                        stems = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3398
                        for pkg_stem in stems:
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3399
                                remove_pub.append(pkg_stem)
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3400
                for pkg_stem in remove_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3401
                        self.__remove_pkg_stem_from_list(pkg_stem)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3402
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3403
        def __set_empty_details_panel(self):
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3404
                if self.show_info_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3405
                        gobject.source_remove(self.show_info_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3406
                        self.show_info_id = 0
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3407
                if self.show_dependencies_id != 0:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3408
                        gobject.source_remove(self.show_dependencies_id)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3409
                        self.show_dependencies_id = 0
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3410
                if self.show_licenses_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3411
                        gobject.source_remove(self.show_licenses_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3412
                        self.show_licenses_id = 0
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3413
                if self.show_versions_id != 0:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3414
                        gobject.source_remove(self.show_versions_id)
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3415
                        self.show_versions_id = 0
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3416
                self.info_pkgstem = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3417
                self.dependencies_pkgstem = None
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3418
                self.license_pkgstem = None
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3419
                self.versions_pkgstem = None
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3420
                self.detailspanel.set_empty_details()
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3421
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3422
        def __update_package_versions(self, versions, versions_id, pkgstem):
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3423
                if (versions_id != self.last_show_versions_id):
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3424
                        return
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3425
                self.versions_pkgstem = pkgstem
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3426
                self.detailspanel.update_package_versions(versions)
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3427
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3428
        def __show_versions(self):
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3429
                self.show_versions_id = 0
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3430
                if self.selected_pkg_name == None:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3431
                        return
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3432
                gobject.idle_add(self.set_busy_cursor)
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3433
                Thread(target = self.__show_package_versions,
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3434
                    args = (self.selected_pkg_name, self.selected_pkg_pub,
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3435
                    self.selected_pkgstem, self.last_show_versions_id,)).start()
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3436
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3437
        def __show_package_versions(self, selected_pkg_name, selected_pkg_pub,
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3438
            selected_pkgstem, versions_id):
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3439
                self.api_lock.acquire()
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3440
                gobject.idle_add(self.set_busy_cursor)
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3441
                self.__show_package_versions_without_lock(selected_pkg_name,
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3442
                    selected_pkg_pub, selected_pkgstem, versions_id)
1966
dd38788677ea 16380 Upgrade failed with error: cannot release un-aquired lock
John Rice <john.rice@oracle.com>
parents: 1931
diff changeset
  3443
                gui_misc.release_lock(self.api_lock)
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3444
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3445
        def __show_package_versions_without_lock(self, selected_pkg_name,
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3446
            selected_pkg_pub, selected_pkgstem, versions_id):
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3447
                if debug:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3448
                        a = time.time()
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3449
                # Get versions for package
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3450
                try:
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3451
                        if selected_pkg_name == None:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3452
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3453
                        try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3454
                                versions_list = self.api_o.get_pkg_list(
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3455
                                    pkg_list = api.ImageInterface.LIST_ALL,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3456
                                    pubs =  [selected_pkg_pub],
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3457
                                    patterns = [selected_pkg_name])
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3458
                        except api_errors.ApiException, apiex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3459
                                err = str(apiex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3460
                                gobject.idle_add(self.error_occurred, err,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3461
                                    _('Unexpected Error'))
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3462
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3463
                        try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3464
                                versions = []
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3465
                                for entry in versions_list:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3466
                                        states = entry[3]
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3467
                                        ver = entry[0][2]
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3468
                                        versions.append((ver, states))
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3469
                                if debug:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3470
                                        print "Time to get versions:", time.time() - a
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3471
                        except api_errors.TransportError, tpex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3472
                                err = str(tpex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3473
                                logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3474
                                gui_misc.notify_log_error(self)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3475
                        except api_errors.ApiException, apiex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3476
                                err = str(apiex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3477
                                gobject.idle_add(self.error_occurred, err,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3478
                                    _('Unexpected Error'))
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3479
                        gobject.idle_add(self.__update_package_versions, versions,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3480
                            versions_id, selected_pkgstem)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3481
                finally:
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3482
                        gobject.idle_add(self.unset_busy_cursor)
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3483
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3484
        def __update_package_license(self, licenses, license_id, pkgstem):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3485
                if (license_id != self.last_show_licenses_id):
1647
ac0345b3ef83 5732 packagemanager should have support for click-thru license
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1645
diff changeset
  3486
                        return
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3487
                self.license_pkgstem = pkgstem
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3488
                self.detailspanel.update_package_license(licenses)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3489
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3490
        def __show_licenses(self):
1014
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3491
                self.show_licenses_id = 0
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3492
                if self.selected_pkgstem == None:
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3493
                        gobject.idle_add(self.__update_package_license, None,
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3494
                            self.last_show_licenses_id, self.selected_pkgstem)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3495
                        return
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3496
                gobject.idle_add(self.set_busy_cursor)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3497
                Thread(target = self.__show_package_licenses,
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3498
                    args = (self.selected_pkgstem, self.last_show_licenses_id,)).start()
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3499
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3500
        def __show_package_licenses(self, selected_pkgstem, license_id):
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3501
                self.api_lock.acquire()
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3502
                gobject.idle_add(self.set_busy_cursor)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3503
                self.__show_package_licenses_without_lock(selected_pkgstem, license_id)
1966
dd38788677ea 16380 Upgrade failed with error: cannot release un-aquired lock
John Rice <john.rice@oracle.com>
parents: 1931
diff changeset
  3504
                gui_misc.release_lock(self.api_lock)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3505
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3506
        def __show_package_licenses_without_lock(self, selected_pkgstem, license_id):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3507
                try:
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3508
                        if selected_pkgstem == None:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3509
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3510
                        info = None
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3511
                        try:
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3512
                                info = self.api_o.info([selected_pkgstem],
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3513
                                    True, frozenset([api.PackageInfo.LICENSES]))
1675
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  3514
                        except api_errors.TransportError, tpex:
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  3515
                                err = str(tpex)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  3516
                                logger.error(err)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  3517
                                gui_misc.notify_log_error(self)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  3518
                        except api_errors.InvalidDepotResponseException, idex:
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  3519
                                err = str(idex)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  3520
                                logger.error(err)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  3521
                                gui_misc.notify_log_error(self)
1722
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3522
                        except api_errors.ImageLockedError, ex:
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3523
                                err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3524
                                logger.error(err)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3525
                                gui_misc.notify_log_error(self)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3526
                        except Exception, ex:
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3527
                                err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3528
                                gobject.idle_add(self.error_occurred, err)
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3529
                        if self.detailspanel.showing_empty_details or (license_id !=
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3530
                            self.last_show_licenses_id):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3531
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3532
                        if not info or (info and len(info.get(0)) == 0):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3533
                                try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3534
                                # Get license from remote
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3535
                                        info = self.api_o.info([selected_pkgstem],
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3536
                                            False, frozenset([api.PackageInfo.LICENSES]))
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3537
                                except api_errors.TransportError, tpex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3538
                                        err = str(tpex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3539
                                        logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3540
                                        gui_misc.notify_log_error(self)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3541
                                except api_errors.InvalidDepotResponseException, idex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3542
                                        err = str(idex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3543
                                        logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3544
                                        gui_misc.notify_log_error(self)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3545
                                except api_errors.ImageLockedError, ex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3546
                                        err = str(ex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3547
                                        logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3548
                                        gui_misc.notify_log_error(self)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3549
                                except Exception, ex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3550
                                        err = str(ex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3551
                                        gobject.idle_add(self.error_occurred, err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3552
                        if self.detailspanel.showing_empty_details or (license_id !=
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3553
                            self.last_show_licenses_id):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3554
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3555
                        pkgs_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3556
                        package_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3557
                        no_licenses = 0
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3558
                        if info:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3559
                                pkgs_info = info[0]
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3560
                        if pkgs_info:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3561
                                package_info = pkgs_info[0]
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3562
                        if package_info:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3563
                                no_licenses = len(package_info.licenses)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3564
                        if no_licenses == 0:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3565
                                gobject.idle_add(self.__update_package_license, None,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3566
                                    license_id, selected_pkgstem)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3567
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3568
                        else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3569
                                gobject.idle_add(self.__update_package_license,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3570
                                    package_info.licenses, license_id, selected_pkgstem)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3571
                finally:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3572
                        gobject.idle_add(self.unset_busy_cursor)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3573
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3574
        def __update_package_dependencies(self, info, dep_info,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3575
            installed_dep_info, dependencies_id, pkg_stem):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3576
                if self.detailspanel.showing_empty_details or (dependencies_id !=
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3577
                    self.last_show_dependencies_id):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3578
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3579
                self.dependencies_pkgstem = pkg_stem
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3580
                self.detailspanel.update_package_dependencies(info, dep_info,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3581
                    installed_dep_info, self.installed_icon, self.not_installed_icon)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3582
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3583
        def __show_dependencies(self):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3584
                self.show_dependencies_id = 0
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3585
                self.dependencies_pkgstem = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3586
                model, itr = self.package_selection.get_selected()
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3587
                if model == None or itr == None:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3588
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3589
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3590
                pkg_stem = model.get_value(itr, enumerations.STEM_COLUMN)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3591
                pkg_status = model.get_value(itr, enumerations.STATUS_COLUMN)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3592
                self.set_busy_cursor()
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3593
                Thread(target = self.__show_package_dependencies,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3594
                    args = (pkg_stem, pkg_status, self.last_show_dependencies_id)).start()
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3595
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3596
        def __show_package_dependencies(self, pkg_stem, pkg_status, dependencies_id):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3597
                self.api_lock.acquire()
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3598
                gobject.idle_add(self.set_busy_cursor)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3599
                self.__show_package_dependencies_without_lock(pkg_stem, pkg_status,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3600
                    dependencies_id)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3601
                gui_misc.release_lock(self.api_lock)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3602
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3603
        def __show_package_dependencies_without_lock(self, pkg_stem, pkg_status,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3604
            dependencies_id):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3605
                if self.detailspanel.showing_empty_details or (dependencies_id !=
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3606
                    self.last_show_dependencies_id):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3607
                        return
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3608
                local_info, remote_info = self.__fetch_info(dependencies_id,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3609
                    self.last_show_dependencies_id, pkg_stem, pkg_status)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3610
                if not local_info and not remote_info:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3611
                        gobject.idle_add(self.detailspanel.no_dependencies_available)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3612
                        gobject.idle_add(self.unset_busy_cursor)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3613
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3614
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3615
                if local_info:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3616
                        info = local_info
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3617
                else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3618
                        info = remote_info
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3619
                if info == None or info.dependencies == None:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3620
                        gobject.idle_add(self.detailspanel.no_dependencies_available)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3621
                        gobject.idle_add(self.unset_busy_cursor)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3622
                        return
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3623
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3624
                dep_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3625
                installed_dep_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3626
                try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3627
                        try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3628
                                dep_info = self.api_o.info(
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3629
                                    info.dependencies,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3630
                                    False,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3631
                                    frozenset([api.PackageInfo.STATE,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3632
                                    api.PackageInfo.IDENTITY]))
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3633
                                temp_info = []
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3634
                                for depend in info.dependencies:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3635
                                        name = fmri.extract_pkg_name(
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3636
                                            depend)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3637
                                        temp_info.append(name)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3638
                                installed_dep_info = self.api_o.info(
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3639
                                    temp_info,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3640
                                    True,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3641
                                    frozenset([api.PackageInfo.STATE,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3642
                                    api.PackageInfo.IDENTITY]))
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3643
                        except api_errors.TransportError, tpex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3644
                                err = str(tpex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3645
                                logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3646
                                gui_misc.notify_log_error(self)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3647
                        except api_errors.InvalidDepotResponseException, \
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3648
                                idex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3649
                                err = str(idex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3650
                                logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3651
                                gui_misc.notify_log_error(self)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3652
                        except api_errors.ImageLockedError, ex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3653
                                err = str(ex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3654
                                logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3655
                                gui_misc.notify_log_error(self)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3656
                        except Exception, ex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3657
                                err = str(ex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3658
                                gobject.idle_add(self.error_occurred, err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3659
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3660
                        gobject.idle_add(self.__update_package_dependencies,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3661
                            info, dep_info, installed_dep_info, dependencies_id, pkg_stem)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3662
                finally:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3663
                        gobject.idle_add(self.unset_busy_cursor)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3664
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3665
                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3666
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3667
        def __fetch_info(self, info_id, last_show_info_id, pkg_stem, pkg_status):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3668
                local_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3669
                remote_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3670
                if not self.detailspanel.showing_empty_details and (info_id ==
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3671
                    last_show_info_id) and (pkg_status ==
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3672
                    api.PackageInfo.INSTALLED or pkg_status ==
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3673
                    api.PackageInfo.UPGRADABLE):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3674
                        local_info = gui_misc.get_pkg_info(self, self.api_o, pkg_stem,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3675
                            True)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3676
                if not self.detailspanel.showing_empty_details and (info_id ==
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3677
                    last_show_info_id) and (pkg_status ==
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3678
                    api.PackageInfo.KNOWN or pkg_status ==
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3679
                    api.PackageInfo.UPGRADABLE):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3680
                        remote_info = gui_misc.get_pkg_info(self, self.api_o, pkg_stem,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3681
                            False)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3682
                return (local_info, remote_info)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3683
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3684
        def __update_package_info(self, pkg_name, pkg_stem, local_info, remote_info,
2009
bfd9d7ed1ff1 16650 Renamed package not displayed for x11/clients on build 143
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2001
diff changeset
  3685
            info_id, renamed_info = None, pkg_renamed = False):
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3686
                if self.detailspanel.showing_empty_details or (info_id !=
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3687
                    self.last_show_info_id):
2014
b9f69c3999d5 16738 Package Manager displays busy cursor indefinitely
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2013
diff changeset
  3688
                        self.unset_busy_cursor()
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3689
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3690
                self.info_pkgstem = pkg_stem
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3691
                self.detailspanel.update_package_info(pkg_name, local_info,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3692
                    remote_info, self.api_o.root,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3693
                    self.installed_icon, self.not_installed_icon,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3694
                    self.update_available_icon,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3695
                    self.is_all_publishers_installed, self.pubs_info,
2009
bfd9d7ed1ff1 16650 Renamed package not displayed for x11/clients on build 143
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2001
diff changeset
  3696
                    renamed_info, pkg_renamed)
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3697
                self.unset_busy_cursor()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3698
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3699
        def __show_info(self, model, path):
1014
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3700
                self.show_info_id = 0
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3701
                self.info_pkgstem = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3702
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3703
                if not (model and path):
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3704
                        return
1014
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3705
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3706
                itr = model.get_iter(path)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3707
                pkg_name = model.get_value(itr, enumerations.ACTUAL_NAME_COLUMN)
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3708
                pkg_stem = model.get_value(itr, enumerations.STEM_COLUMN)
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3709
                pkg_status = model.get_value(itr, enumerations.STATUS_COLUMN)
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  3710
                pkg_renamed = model.get_value(itr, enumerations.RENAMED_COLUMN)
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  3711
                self.set_busy_cursor()
1014
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3712
                Thread(target = self.__show_package_info,
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3713
                    args = (pkg_name, pkg_stem, pkg_status, self.last_show_info_id,
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  3714
                        pkg_renamed)).start()
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  3715
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3716
        def __show_package_info(self, pkg_name, pkg_stem, pkg_status, info_id,
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  3717
            pkg_renamed):
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3718
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  3719
                gobject.idle_add(self.set_busy_cursor)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3720
                self.__show_package_info_without_lock(pkg_name, pkg_stem, pkg_status,
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  3721
                    info_id, pkg_renamed)
1966
dd38788677ea 16380 Upgrade failed with error: cannot release un-aquired lock
John Rice <john.rice@oracle.com>
parents: 1931
diff changeset
  3722
                gui_misc.release_lock(self.api_lock)
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3723
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3724
        def __show_package_info_without_lock(self, pkg_name, pkg_stem, pkg_status,
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  3725
            info_id, pkg_renamed):
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3726
                if self.detailspanel.showing_empty_details or \
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3727
                        info_id != self.last_show_info_id:
2014
b9f69c3999d5 16738 Package Manager displays busy cursor indefinitely
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2013
diff changeset
  3728
                        self.unset_busy_cursor()
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3729
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3730
                local_info, remote_info = self.__fetch_info(info_id,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3731
                    self.last_show_info_id, pkg_stem, pkg_status)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3732
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3733
                renamed_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3734
                if pkg_renamed:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3735
                        if local_info != None and \
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3736
                                len(local_info.dependencies) > 0:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3737
                                renamed_info = local_info
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3738
                        elif remote_info != None and \
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3739
                                len(remote_info.dependencies) > 0:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3740
                                renamed_info = remote_info
2009
bfd9d7ed1ff1 16650 Renamed package not displayed for x11/clients on build 143
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2001
diff changeset
  3741
                else:
bfd9d7ed1ff1 16650 Renamed package not displayed for x11/clients on build 143
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2001
diff changeset
  3742
                        if remote_info != None and \
bfd9d7ed1ff1 16650 Renamed package not displayed for x11/clients on build 143
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2001
diff changeset
  3743
                                len(remote_info.dependencies) > 0:
bfd9d7ed1ff1 16650 Renamed package not displayed for x11/clients on build 143
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2001
diff changeset
  3744
                                if api.PackageInfo.RENAMED in remote_info.states:
bfd9d7ed1ff1 16650 Renamed package not displayed for x11/clients on build 143
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2001
diff changeset
  3745
                                        renamed_info = remote_info
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3746
                gobject.idle_add(self.__update_package_info, pkg_name, pkg_stem,
2009
bfd9d7ed1ff1 16650 Renamed package not displayed for x11/clients on build 143
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2001
diff changeset
  3747
                    local_info, remote_info, info_id, renamed_info, pkg_renamed)
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3748
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3749
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3750
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3751
        def __get_active_section_and_category(self):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3752
                selection = self.w_categories_treeview.get_selection()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3753
                selected_section = 0
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3754
                selected_category = 0
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3755
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3756
                if not selection:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3757
                        return 0, 0
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3758
                category_model, category_itr = selection.get_selected()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3759
                if not category_model or not category_itr:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3760
                        return 0, 0
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3761
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3762
                selected_category = category_model.get_value(category_itr,
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3763
                    enumerations.CATEGORY_ID)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3764
                cat_path = list(category_model.get_path(category_itr))
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3765
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3766
                # Top level Section has been selected
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3767
                if len(cat_path) == 1 and selected_category > RECENT_SEARCH_ID_OFFSET:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3768
                        selected_section = selected_category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3769
                        return selected_section, 0
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3770
                elif len(cat_path) == 1 and selected_category > SECTION_ID_OFFSET:
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3771
                        selected_section = selected_category - SECTION_ID_OFFSET
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3772
                        return selected_section, 0
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3773
                else:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3774
                        # Subcategory selected need to get categories parent Section
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3775
                        parent_iter = category_model.iter_parent(category_itr)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3776
                        if not parent_iter:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3777
                                return selected_section, selected_category
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3778
                        selected_section = category_model.get_value(
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3779
                            parent_iter, enumerations.CATEGORY_ID) - SECTION_ID_OFFSET
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3780
                        return selected_section, selected_category
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3781
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3782
        def __application_filter(self, model, itr):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3783
                '''This function is used to filter content in the main
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3784
                application view'''
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3785
                selected_category = 0
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3786
                selected_section = 0
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3787
                category = False
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3788
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  3789
                if self.in_setup or self.cancelled:
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3790
                        return category
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  3791
                filter_id = self.w_filter_combobox.get_active()
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3792
                if filter_id == enumerations.FILTER_SELECTED:
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  3793
                        return model.get_value(itr, enumerations.MARK_COLUMN)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3794
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3795
                category_list = model.get_value(itr, enumerations.CATEGORY_LIST_COLUMN)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3796
                selected_section, selected_category = \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3797
                        self.__get_active_section_and_category()
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3798
                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3799
                in_recent_search = False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3800
                if selected_section == 0 and selected_category == 0:
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3801
                        #Clicked on All Categories
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3802
                        category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3803
                elif selected_category != 0:
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3804
                        #Clicked on subcategory
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3805
                        if category_list and selected_category in category_list:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3806
                                category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3807
                elif category_list:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3808
                        #Clicked on Top Level section                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3809
                        if selected_section < RECENT_SEARCH_ID_OFFSET:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3810
                                categories_in_section = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3811
                                        self.section_categories_list[selected_section]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3812
                                for cat_id in category_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3813
                                        if cat_id in categories_in_section:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3814
                                                category = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3815
                                                break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3816
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3817
                                in_recent_search = True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3818
                if (model.get_value(itr, enumerations.IS_VISIBLE_COLUMN) == False):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3819
                        return False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3820
                if self.in_search_mode or in_recent_search:
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  3821
                        return self.__is_package_filtered(model, itr, filter_id)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3822
                return (category &
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3823
                    self.__is_package_filtered(model, itr, filter_id))
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3824
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3825
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3826
        def __is_package_filtered(model, itr, filter_id):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3827
                '''Function for filtercombobox'''
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3828
                if filter_id == enumerations.FILTER_ALL:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3829
                        return True
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3830
                status = model.get_value(itr, enumerations.STATUS_COLUMN)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3831
                if filter_id == enumerations.FILTER_INSTALLED:
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3832
                        return (status == api.PackageInfo.INSTALLED or status == \
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3833
                            api.PackageInfo.UPGRADABLE)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3834
                elif filter_id == enumerations.FILTER_UPDATES:
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3835
                        return status == api.PackageInfo.UPGRADABLE
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3836
                elif filter_id == enumerations.FILTER_NOT_INSTALLED:
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3837
                        return status == api.PackageInfo.KNOWN
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3838
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3839
        def __enable_disable_selection_menus(self):
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  3840
                if self.in_setup:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  3841
                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3842
                self.__enable_disable_select_updates()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3843
                if not self.__doing_search():
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3844
                        self.unset_busy_cursor()
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  3845
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3846
        def __enable_disable_select_all(self):
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  3847
                if self.in_setup:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  3848
                        return
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  3849
                if self.w_main_view_notebook.get_current_page() == NOTEBOOK_START_PAGE:
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  3850
                        self.w_selectall_menuitem.set_sensitive(False)
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  3851
                        self.w_deselect_menuitem.set_sensitive(False)
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  3852
                        return
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  3853
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3854
                model =  self.w_application_treeview.get_model()
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3855
                if model != None and len(model) > 0:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3856
                        for row in model:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3857
                                if not row[enumerations.MARK_COLUMN]:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3858
                                        self.w_selectall_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3859
                                        return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3860
                        self.w_selectall_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3861
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3862
                        self.w_selectall_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3863
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3864
        def __enable_disable_install_remove(self):
1869
74788cf19552 14254 Export Selections menu is in incorrect status for non-privileged users
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1868
diff changeset
  3865
                self.__enable_disable_export_selections()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3866
                if not self.user_rights:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3867
                        self.w_installupdate_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3868
                        self.w_installupdate_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3869
                        self.w_remove_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3870
                        self.w_remove_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3871
                        return
1413
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  3872
                self.__enable_if_selected_for_removal()
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  3873
                self.__enable_if_selected_for_install_update()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3874
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3875
        def __enable_if_selected_for_removal(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3876
                sensitive = False
1442
bc9221beb677 12110 Selections while performing search for "All publishers" doesn't enable install/update or remove buttons
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1441
diff changeset
  3877
                selected = 0
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3878
                for pub in self.to_remove:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3879
                        selected = self.to_remove.get(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3880
                        if selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3881
                                break
914
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  3882
                if selected > 0:
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  3883
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3884
                self.w_remove_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3885
                self.w_remove_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3886
                return sensitive
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3887
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3888
        def __enable_if_selected_for_install_update(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3889
                sensitive = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3890
                selected = 0
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3891
                for pub in self.to_install_update:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3892
                        selected = self.to_install_update.get(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3893
                        if selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3894
                                break
914
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  3895
                if selected > 0:
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  3896
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3897
                self.w_installupdate_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3898
                self.w_installupdate_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3899
                return sensitive
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3900
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3901
        def __enable_disable_select_updates(self):
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3902
                model = self.w_application_treeview.get_model()
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3903
                if model == None:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3904
                        return
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3905
                for row in model:
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  3906
                        if row[enumerations.STATUS_COLUMN] == api.PackageInfo.UPGRADABLE:
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3907
                                if not row[enumerations.MARK_COLUMN]:
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3908
                                        self.w_selectupdates_menuitem. \
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3909
                                            set_sensitive(True)
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3910
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3911
                self.w_selectupdates_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3912
                return
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3913
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3914
        def __enable_disable_export_selections(self):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3915
                if self.selected_pkgs == None or len(self.selected_pkgs) == 0:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3916
                        self.w_export_selections_menuitem.set_sensitive(False)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3917
                else:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3918
                        self.w_export_selections_menuitem.set_sensitive(True)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3919
                return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3920
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3921
        def __enable_disable_deselect(self):
1165
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  3922
                if self.w_application_treeview.get_model():
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  3923
                        for row in self.w_application_treeview.get_model():
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  3924
                                if row[enumerations.MARK_COLUMN]:
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  3925
                                        self.w_deselect_menuitem.set_sensitive(True)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  3926
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3927
                self.w_deselect_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3928
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3929
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3930
        def __add_pkgs_to_lists_from_api(self, pub, application_list,
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3931
            category_list, section_list):
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3932
                pubs = []
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3933
                pkgs_from_api = []
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3934
                status_str = _("Loading package list")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3935
                gobject.idle_add(self.update_statusbar_message, status_str)
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3936
                try:
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3937
                        if self.is_all_publishers_installed:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3938
                                pkgs_from_api = self.api_o.get_pkg_list(pubs = pubs,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3939
                                    pkg_list = api.ImageInterface.LIST_INSTALLED)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3940
                        elif self.is_all_publishers:
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3941
                                pkgs_from_api = self.api_o.get_pkg_list(pubs = pubs,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  3942
                                    pkg_list = api.ImageInterface.LIST_INSTALLED_NEWEST)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3943
                        else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3944
                                pubs.append(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3945
                                pkgs_from_api = self.api_o.get_pkg_list(pubs = pubs,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3946
                                    pkg_list = api.ImageInterface.LIST_INSTALLED_NEWEST)
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents: 562
diff changeset
  3947
                except api_errors.InventoryException:
1139
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  3948
                        # This can happen if the repository does not
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  3949
                        # contain any packages
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  3950
                        err = _("Selected publisher does not contain any packages.")
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  3951
                        gobject.idle_add(self.error_occurred, err, None,
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3952
                            gtk.MESSAGE_INFO)
1457
0f31831a57b4 12318 In Package Manager unsetting the busy cursor should be done in GUI thread
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1456
diff changeset
  3953
                        gobject.idle_add(self.unset_busy_cursor)
1669
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3954
                except api_errors.ApiException, apiex:
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3955
                        err = str(apiex)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3956
                        gobject.idle_add(self.error_occurred, err, _('Unexpected Error'))
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3957
                        gobject.idle_add(self.unset_busy_cursor)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3958
                try:    
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3959
                        self.__add_pkgs_to_lists(pkgs_from_api, pubs, application_list,
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3960
                            category_list, section_list)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3961
                except api_errors.TransportError, tpex:
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3962
                        err = str(tpex)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3963
                        logger.error(err)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3964
                        gui_misc.notify_log_error(self)
2485
a46611e3fdf3 18698 An empty error window is displayed when trying to stop refreshing a repository
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2451
diff changeset
  3965
                except api_errors.CanceledException:
a46611e3fdf3 18698 An empty error window is displayed when trying to stop refreshing a repository
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2451
diff changeset
  3966
                        gobject.idle_add(self.unset_busy_cursor)
1669
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3967
                except api_errors.ApiException, apiex:
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3968
                        err = str(apiex)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3969
                        gobject.idle_add(self.error_occurred, err, _('Unexpected Error'))
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3970
                        gobject.idle_add(self.unset_busy_cursor)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3971
                        
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3972
        def __get_categories_for_pubs(self, pubs):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3973
                sections = {}
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3974
                #ImageInfo for categories
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3975
                sectioninfo = imageinfo.ImageInfo()
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3976
                share_path = os.path.join(self.application_dir, 
2223
2da8c49e53dc 17735 build should use custom pkglintrc to locate proto version of opensolaris.org.sections
Tim Foster <tim.s.foster@oracle.com>
parents: 2162
diff changeset
  3977
                        "usr/share/lib/pkg")
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3978
                if len(pubs) == 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3979
                        section = sectioninfo.read(os.path.join(share_path,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3980
                                    "opensolaris.org.sections"))
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3981
                        sections["opensolaris.org"] = section
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3982
                        return sections
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3983
                        
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  3984
                for pub in pubs:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3985
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3986
                                a = time.time()
1245
86d476d3d53f 10131 check for updates can traceback if check for updates is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1243
diff changeset
  3987
                        section = sectioninfo.read(os.path.join(share_path,
86d476d3d53f 10131 check for updates can traceback if check for updates is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1243
diff changeset
  3988
                            pub + ".sections"))
701
ba35d1b02c04 4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 697
diff changeset
  3989
                        if len(section) == 0:
1245
86d476d3d53f 10131 check for updates can traceback if check for updates is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1243
diff changeset
  3990
                                section = sectioninfo.read(os.path.join(share_path,
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3991
                                    "opensolaris.org.sections"))
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  3992
                        sections[pub] = section
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3993
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3994
                                print "Time for get_pkg_categories", time.time() - a
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3995
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3996
                return sections
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3997
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3998
        def __add_pkgs_to_lists_from_info(self, local_results, remote_results, 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3999
            application_list):
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4000
                status_str = _("Loading package list")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4001
                gobject.idle_add(self.update_statusbar_message, status_str)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4002
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4003
                pkg_add = self.__add_pkgs_to_lists_from_results(local_results,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4004
                    0, application_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4005
                self.__add_pkgs_to_lists_from_results(remote_results,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4006
                    pkg_add, application_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4007
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4008
        def __get_icon_for_state(self, state):
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4009
                if state == api.PackageInfo.UPGRADABLE:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4010
                        status_icon = self.update_available_icon
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4011
                elif state == api.PackageInfo.INSTALLED:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4012
                        status_icon = self.installed_icon
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4013
                else:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4014
                        status_icon = self.not_installed_icon
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4015
                return status_icon
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4016
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4017
        def __add_pkgs_to_lists_from_results(self, results, pkg_add,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4018
            application_list):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4019
                for result in results:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4020
                        pkg_pub = result.publisher
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4021
                        pkg_name = result.pkg_stem
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4022
                        pkg_stem  = "pkg://" + pkg_pub + "/"  + pkg_name
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4023
                        summ = result.summary
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  4024
                        pkg_renamed = (api.PackageInfo.RENAMED in result.states)
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4025
                        pkg_state = gui_misc.get_state_from_states(result.states)
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4026
                        status_icon = self.__get_icon_for_state(pkg_state)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4027
                        if not self.is_all_publishers_search and \
1744
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4028
                            not self.is_all_publishers_installed:
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4029
                                pkg_name = gui_misc.get_minimal_unique_name(
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4030
                                    self.package_names, pkg_name,
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4031
                                    self.special_package_names)
1789
cdb0eb87151a 14660 Empty name displayed in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1772
diff changeset
  4032
                                if len(pkg_name) == 0:
cdb0eb87151a 14660 Empty name displayed in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1772
diff changeset
  4033
                                        pkg_name = result.pkg_stem
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4034
                        marked = False
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4035
                        pkgs = self.selected_pkgs.get(pkg_pub)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4036
                        if pkgs != None:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4037
                                if pkg_stem in pkgs:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4038
                                        marked = True
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4039
                        pub_name = self.get_publisher_name_from_prefix(pkg_pub)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4040
                        #Add to application_list
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4041
                        next_app = \
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4042
                            [
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4043
                                marked, status_icon, pkg_name, summ, pkg_state,
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4044
                                pkg_stem, result.pkg_stem, True, None, pub_name,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4045
                                pkg_pub, pkg_renamed
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4046
                            ]
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4047
                        application_list.insert(pkg_add, next_app)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4048
                        pkg_add += 1
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4049
                return pkg_add
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4050
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4051
        def __add_pkgs_to_lists(self, pkgs_from_api, pubs, application_list,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4052
            category_list, section_list):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4053
                if section_list != None:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4054
                        self.__init_sections(section_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4055
                sections = self.__get_categories_for_pubs(pubs)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4056
                pkg_add = 0
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4057
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4058
                        a = time.time()
1744
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4059
                self.package_names = {}
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4060
                self.special_package_names = []
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4061
                pub_names = {}
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4062
                for entry in pkgs_from_api:
2493
5db1603f0c3f 18609 support for a human-readable version string
Danek Duvall <danek.duvall@oracle.com>
parents: 2485
diff changeset
  4063
                        (pkg_pub, pkg_name, ver), summ, cats, states, attrs = entry
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4064
                        if debug:
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4065
                                print entry, ver
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4066
                        pkg_stem  = "pkg://" + pkg_pub + "/"  + pkg_name
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4067
                        gui_misc.add_pkgname_to_dic(self.package_names,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4068
                            pkg_name, self.special_package_names)
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  4069
                        pkg_renamed = (api.PackageInfo.RENAMED in states)
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4070
                        pkg_state = gui_misc.get_state_from_states(states)
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4071
                        status_icon = self.__get_icon_for_state(pkg_state)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4072
                        marked = False
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4073
                        pkgs = self.selected_pkgs.get(pkg_pub)
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4074
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4075
                                if pkg_stem in pkgs:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4076
                                        marked = True
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4077
                        if not pub_names.has_key(pkg_pub):
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4078
                                pub_names[pkg_pub] = \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4079
                                        self.get_publisher_name_from_prefix(
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4080
                                            pkg_pub)
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4081
                        pub_name = pub_names[pkg_pub]
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4082
                        #Add to application_list
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4083
                        next_app = \
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4084
                            [
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4085
                                marked, status_icon, pkg_name, summ, pkg_state,
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4086
                                pkg_stem, pkg_name, True, None, pub_name,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4087
                                pkg_pub, pkg_renamed
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4088
                            ]
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4089
                        self.__add_package_to_list(next_app,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4090
                            application_list,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4091
                            pkg_add, pkg_name,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4092
                            cats, category_list, pkg_pub)
1139
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  4093
                        pkg_add += 1
1744
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4094
                for pkg in application_list:
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4095
                        pkg_name = pkg[enumerations.NAME_COLUMN]
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4096
                        name = gui_misc.get_minimal_unique_name(self.package_names,
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4097
                            pkg_name, self.special_package_names)
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4098
                        if pkg_name != name:
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4099
                                pkg[enumerations.NAME_COLUMN] = name
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4100
                        
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4101
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4102
                        print "Time to add packages:", time.time() - a
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4103
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4104
                        self.__add_categories_to_sections(sections,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4105
                            category_list, section_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4106
                return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4107
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4108
        def __add_categories_to_sections(self, sections, category_list, section_list):
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  4109
                for pub in sections:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  4110
                        for section in sections[pub]:
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4111
                                self.__add_category_to_section(sections[pub][section],
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4112
                                    _(section), category_list, section_list)
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4113
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4114
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4115
        def __add_package_to_list(self, app, application_list, pkg_add,
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4116
            pkg_name, cats, category_list, pub):
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4117
                row_iter = application_list.insert(pkg_add, app)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4118
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4119
                        return
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4120
                for cat in cats:
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4121
                        if len(cat[1]) > 1:
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4122
                                self.__add_package_to_category(cat[1],
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4123
                                    row_iter, application_list,
2162
c6e46112c5d8 17496 package manager should deal with broken or missing info.classification values
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2155
diff changeset
  4124
                                    category_list, pkg_name)
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4125
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4126
        @staticmethod
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4127
        def __add_package_to_category(category_name, package, 
2162
c6e46112c5d8 17496 package manager should deal with broken or missing info.classification values
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2155
diff changeset
  4128
            application_list, category_list, pkg_name):
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4129
                category_names = category_name.split('/', 2)
2162
c6e46112c5d8 17496 package manager should deal with broken or missing info.classification values
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2155
diff changeset
  4130
                if len(category_names) != 2:
c6e46112c5d8 17496 package manager should deal with broken or missing info.classification values
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2155
diff changeset
  4131
                        print _("Invalid category name [%(cat)s] for package %(pack)s") \
c6e46112c5d8 17496 package manager should deal with broken or missing info.classification values
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2155
diff changeset
  4132
                            % {"cat": category_name,
c6e46112c5d8 17496 package manager should deal with broken or missing info.classification values
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2155
diff changeset
  4133
                            "pack": pkg_name}
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4134
                        return
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4135
                category_visible_name = category_names[1]
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4136
                if not package or category_visible_name == 'All':
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4137
                        return
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4138
                if not category_visible_name:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4139
                        return
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4140
                category_id = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4141
                for category in category_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4142
                        if category[enumerations.CATEGORY_NAME] == category_name:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4143
                                category_id = category[enumerations.CATEGORY_ID]
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  4144
                                break
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4145
                if not category_id:                       # Category not exists
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4146
                        category_id = len(category_list) + 1
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4147
                        category_list.append(None, [category_id, category_name,
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4148
                            category_visible_name, None, None, True])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4149
                if application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4150
                    enumerations.CATEGORY_LIST_COLUMN):
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4151
                        a = application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4152
                            enumerations.CATEGORY_LIST_COLUMN)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4153
                        a.append(category_id)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4154
                else:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4155
                        category_list = []
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4156
                        category_list.append(category_id)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4157
                        application_list.set(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4158
                            enumerations.CATEGORY_LIST_COLUMN, category_list)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4159
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4160
        def __add_categories_to_tree(self, category_list, section_list):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4161
                category_tree = self.__get_new_category_liststore()
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4162
                cat_iter = category_tree.append(None, [ 0, _("All Categories"),
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4163
                    _("All Categories"), None, None, True])
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4164
1406
46c950f90950 11475 The PM category tree includes categories from other publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1405
diff changeset
  4165
                self.section_categories_list = {}
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4166
                #Build dic of section ids and categories they contain
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4167
                #section_category_list[<sec_id>] -> cat_ids[cat_id] -> category
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4168
                #Each category row contains a list of sections it belongs to stored in
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4169
                #category[enumerations.SECTION_LIST_OBJECT]
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4170
                for category in category_list:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4171
                        category_section_ids = \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4172
                                category[enumerations.SECTION_LIST_OBJECT]
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4173
                        if category_section_ids == None:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4174
                                continue
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4175
                        for sec_id in category_section_ids:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4176
                                if sec_id in self.section_categories_list:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4177
                                        category_ids = \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4178
                                                self.section_categories_list[sec_id]
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4179
                                        category_ids[category[enumerations.CATEGORY_ID]] \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4180
                                                = category
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4181
                                else:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4182
                                        self.section_categories_list[sec_id] = \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4183
                                                {category[enumerations.CATEGORY_ID]:\
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4184
                                                    category}
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4185
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4186
                #Build up the Category Tree
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4187
                count = 1
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4188
                visible_default_section_path = None
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4189
                for section in section_list:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4190
                        sec_id = section[enumerations.SECTION_ID]
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4191
                        #Map self.set_section section_list index to visible section index
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4192
                        if sec_id <= 0 or not section[enumerations.SECTION_ENABLED]:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4193
                                continue
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4194
                        if self.set_section == sec_id:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4195
                                visible_default_section_path = (count,)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4196
                        count += count
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4197
                        section_name = "<b>" + section[enumerations.SECTION_NAME] + "</b>"
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4198
                        cat_iter = category_tree.append(None,
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4199
                            [ SECTION_ID_OFFSET + section[enumerations.SECTION_ID], 
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4200
                            section_name, section_name, None, None, True])
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4201
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4202
                        if not sec_id in self.section_categories_list:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4203
                                continue
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4204
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4205
                        category_ids = self.section_categories_list[sec_id]
1700
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4206
                        category_list = self.__get_new_category_liststore()
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4207
                        for cat_id in category_ids.keys():
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4208
                                if category_ids[cat_id][
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4209
                                    enumerations.CATEGORY_IS_VISIBLE]:
1700
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4210
                                        category_list.append(None, category_ids[cat_id])
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4211
                        # Sort the Categories into alphabetical order
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4212
                        if len(category_list) > 0:
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4213
                                rows = [tuple(r) + (i,) for i, 
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4214
                                    r in enumerate(category_list)]
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4215
                                rows.sort(self.__sort)
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4216
                                r = []
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4217
                                category_list.reorder(None, [r[-1] for r in rows])
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4218
                        for category in category_list:
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4219
                                category_tree.append(cat_iter, category)
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4220
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4221
                recent_search_name = "<span foreground='#757575'><b>" + \
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4222
                    _("Recent Searches") + "</b></span>"
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4223
                self.recent_searches_cat_iter = category_tree.append(None,
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4224
                    [RECENT_SEARCH_ID, recent_search_name, recent_search_name,
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4225
                    None, None, True])
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4226
                if self.recent_searches and len(self.recent_searches) > 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4227
                        for recent_search in self.recent_searches_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4228
                                category_tree.append(self.recent_searches_cat_iter, 
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4229
                                    self.recent_searches[recent_search])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4230
                
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4231
                self.w_categories_treeview.set_model(category_tree)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4232
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4233
                #Initial startup expand default Section if available
1686
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  4234
                if visible_default_section_path and self.first_run and \
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  4235
                        len(self.category_active_paths) == 0 and \
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  4236
                        len(self.category_expanded_paths) == 0:
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4237
                        self.w_categories_treeview.expand_row(
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4238
                            visible_default_section_path, False)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4239
                        return
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4240
                self.__restore_category_state()
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4241
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4242
        def __add_recent_search(self, text, pub_prefix, application_list,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4243
            search_all):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4244
                self.adding_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4245
                category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4246
                if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4247
                        return
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4248
                if search_all:
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  4249
                        pub_name = _("All Publishers")
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  4250
                else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4251
                        pub_name = self.get_publisher_display_name_from_prefix(
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  4252
                            pub_prefix)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4253
                recent_search = "(%d) <b>%s</b> %s" % \
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  4254
	        	(len(application_list), text, pub_name)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4255
                if not (recent_search in self.recent_searches):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4256
                        cat_iter = category_tree.append(self.recent_searches_cat_iter,
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4257
                            [RECENT_SEARCH_ID + 1, recent_search, recent_search, 
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4258
                            text, application_list, True])
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4259
                        self.recent_searches[recent_search] = \
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4260
                                [RECENT_SEARCH_ID + 1, recent_search, recent_search,
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4261
                                 text, application_list, True]
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4262
                        self.recent_searches_list.append(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4263
                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4264
                        rs_iter = category_tree.iter_children(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4265
                            self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4266
                        while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4267
                                rs_value = category_tree.get_value(rs_iter,
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4268
                                    enumerations.CATEGORY_VISIBLE_NAME)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4269
                                if rs_value == recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4270
                                        category_tree.remove(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4271
                                        break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4272
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4273
                        cat_iter = category_tree.append(self.recent_searches_cat_iter,
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4274
                            [RECENT_SEARCH_ID + 1, recent_search, recent_search, 
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4275
                            text, application_list, True])
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4276
                        self.recent_searches_list.remove(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4277
                        self.recent_searches_list.append(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4278
                path = category_tree.get_path(cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4279
                self.w_categories_treeview.expand_to_path(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4280
                self.__unselect_category()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4281
                self.w_categories_treeview.scroll_to_cell(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4282
                self.adding_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4283
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4284
        def __clear_recent_searches(self):
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4285
                self.after_install_remove = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4286
                category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4287
                if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4288
                        return                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4289
                if self.recent_searches == None or len(self.recent_searches) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4290
                        return                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4291
                self.__set_searchentry_to_prompt()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4292
                selection, sel_path = self.__get_selection_and_category_path()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4293
                rs_iter = category_tree.iter_children(self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4294
                while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4295
                        category_tree.remove(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4296
                        if category_tree.iter_is_valid(rs_iter):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4297
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4298
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4299
                                break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4300
                del(self.recent_searches_list[:])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4301
                self.recent_searches.clear()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4302
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4303
                rs_path = category_tree.get_path(self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4304
                if selection and sel_path and rs_path and len(sel_path) > 0 and \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4305
                        len(rs_path) > 0 and sel_path[0] == rs_path[0]:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4306
                        self.__restore_setup_for_browse()
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4307
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4308
        def __update_recent_search_states(self, application_list):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4309
                pkg_stems = []
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4310
                pkg_stem_states = {}
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4311
                for row in application_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4312
                        pkg_stems.append(row[enumerations.STEM_COLUMN])
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4313
                #Check for changes in package installation status
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4314
                try:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4315
                        info = self.api_o.info(pkg_stems, True, frozenset(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4316
                                    [api.PackageInfo.STATE, api.PackageInfo.IDENTITY]))
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4317
                        for info_s in info.get(0):
2446
ba222bc0b1ce 18625 new disk space information needs improved formatting, wording
Shawn Walker <shawn.walker@oracle.com>
parents: 2429
diff changeset
  4318
                                pkg_stem = info_s.fmri.get_pkg_stem()
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4319
                                if api.PackageInfo.INSTALLED in info_s.states:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4320
                                        pkg_stem_states[pkg_stem] = \
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  4321
                                                api.PackageInfo.INSTALLED
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4322
                                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4323
                                        pkg_stem_states[pkg_stem] = \
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  4324
                                                api.PackageInfo.KNOWN
1675
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  4325
                except api_errors.TransportError, tpex:
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  4326
                        err = str(tpex)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  4327
                        logger.error(err)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  4328
                        gui_misc.notify_log_error(self)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  4329
                except api_errors.InvalidDepotResponseException, idex:
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  4330
                        err = str(idex)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  4331
                        logger.error(err)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  4332
                        gui_misc.notify_log_error(self)
1722
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4333
                except api_errors.ImageLockedError, ex:
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4334
                        err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4335
                        logger.error(err)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4336
                        gui_misc.notify_log_error(self)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4337
                except Exception, ex:
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4338
                        err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4339
                        gobject.idle_add(self.error_occurred, err)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4340
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4341
                #Create a new result list updated with current installation status
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4342
                tmp_app_list = self.__get_new_application_liststore()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4343
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4344
                for row in application_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4345
                        pkg_stem = row[enumerations.STEM_COLUMN]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4346
                        pub = row[enumerations.PUBLISHER_COLUMN]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4347
                        marked = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4348
                        pkgs = None
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4349
                        if self.selected_pkgs != None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4350
                                pkgs = self.selected_pkgs.get(pub)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4351
                        if pkgs != None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4352
                                if pkg_stem in pkgs:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4353
                                        marked = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4354
                        if row[enumerations.MARK_COLUMN] != marked:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4355
                                row[enumerations.MARK_COLUMN] = marked
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4356
                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4357
                        if pkg_stem_states.has_key(pkg_stem):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4358
                                row[enumerations.STATUS_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4359
                                        pkg_stem_states[pkg_stem]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4360
                                if pkg_stem_states[pkg_stem] == \
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  4361
                                        api.PackageInfo.KNOWN:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4362
                                        row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4363
                                                self.not_installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4364
                                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4365
                                        row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4366
                                                self.installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4367
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4368
                                row[enumerations.STATUS_COLUMN] = \
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  4369
                                        api.PackageInfo.KNOWN
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4370
                                row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4371
                                        self.not_installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4372
                        tmp_app_list.append(row)
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4373
                return tmp_app_list
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4374
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4375
        def __restore_recent_search(self, sel_category):
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4376
                if not sel_category:
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4377
                        return
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4378
                if not self.is_all_publishers_search:
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4379
                        self.__save_setup_before_search(single_search=True)
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4380
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4381
                application_list = sel_category[enumerations.SECTION_LIST_OBJECT]
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4382
                text = sel_category[enumerations.CATEGORY_DESCRIPTION]
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4383
                if self.after_install_remove:
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4384
                        application_list = self.__update_recent_search_states(
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4385
                            application_list)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4386
                # Theme: saved search application list is cached with old theme icons
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4387
                self.__reset_application_list_status_icons(application_list)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4388
                self.__clear_before_search(show_list=True, in_setup=False,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4389
                    unselect_cat=False)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4390
                self.in_search_mode = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4391
                self.in_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4392
                self.__set_search_text_mode(enumerations.SEARCH_STYLE_NORMAL)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4393
                self.w_searchentry.set_text(text)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4394
                self.__set_main_view_package_list()
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4395
                self.__init_tree_views(application_list, None, None, None, None,
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4396
                    enumerations.NAME_COLUMN)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4397
1686
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  4398
        def __setup_category_state(self):
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  4399
                self.cache_o.load_categories_active_dict(self.category_active_paths)
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  4400
                self.cache_o.load_categories_expanded_dict(self.category_expanded_paths)
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  4401
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4402
        def __restore_category_state(self):
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4403
                #Restore expanded Category state
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4404
                if self.w_categories_treeview == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4405
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4406
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4407
                if model == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4408
                        return
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4409
                if len(self.category_expanded_paths) > 0:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4410
                        paths = self.category_expanded_paths.items()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4411
                        for key, val in paths:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4412
                                source, path = key
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4413
                                if self.last_visible_publisher == source and val:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4414
                                        self.w_categories_treeview.expand_row(path, False)
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4415
                #Restore selected category path
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4416
                if self.last_visible_publisher in self.category_active_paths and \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4417
                        self.category_active_paths[self.last_visible_publisher]:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4418
                        self.w_categories_treeview.set_cursor(
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4419
                            self.category_active_paths[self.last_visible_publisher])
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4420
                else:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4421
                        self.w_categories_treeview.set_cursor(0)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4422
                return
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4423
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4424
        @staticmethod
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4425
        def __add_category_to_section(categories_list, section_name, category_list,
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4426
            section_list):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4427
                '''Adds the section to section list in category. If there is no such
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4428
                section, than it is not added. If there was already section than it
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4429
                is skipped. Sections must be case sensitive'''
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4430
                if not categories_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4431
                        return
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4432
                for section in section_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4433
                        if section[enumerations.SECTION_NAME] == section_name:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4434
                                section_id = section[enumerations.SECTION_ID]
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4435
                                for category in category_list:
1691
2e90e87ac9ed 14152 Subcategory names not show up when localized
John Rice <john.rice@sun.com>
parents: 1686
diff changeset
  4436
                                        localized_top_cat = _(category[
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4437
                                            enumerations.CATEGORY_NAME].split("/")[0])
1691
2e90e87ac9ed 14152 Subcategory names not show up when localized
John Rice <john.rice@sun.com>
parents: 1686
diff changeset
  4438
                                        if localized_top_cat == \
2e90e87ac9ed 14152 Subcategory names not show up when localized
John Rice <john.rice@sun.com>
parents: 1686
diff changeset
  4439
                                                section[enumerations.SECTION_NAME]:
1700
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4440
                                                
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4441
                                                vis = \
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4442
                                                    enumerations.CATEGORY_VISIBLE_NAME
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4443
                                                category[vis] = _(category[
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4444
                                                    enumerations.CATEGORY_VISIBLE_NAME])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4445
                                                section_lst = category[ \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4446
                                                    enumerations.SECTION_LIST_OBJECT]
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4447
                                                section[enumerations.SECTION_ENABLED] = \
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4448
                                                    True
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4449
                                                if not section_lst:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4450
                                                        category[ \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4451
                                                    enumerations.SECTION_LIST_OBJECT] = \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4452
                                                            [section_id, ]
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4453
                                                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4454
                                                        if not section_name in \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4455
                                                            section_lst:
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4456
                                                                section_lst.append(
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4457
                                                                    section_id)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4458
                                break
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4459
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4460
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4461
        def __progress_pulse_start(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4462
                if self.progress_stop_thread == True:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4463
                        self.progress_stop_thread = False
2014
b9f69c3999d5 16738 Package Manager displays busy cursor indefinitely
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2013
diff changeset
  4464
                        if self.progress_thread_stopped:
b9f69c3999d5 16738 Package Manager displays busy cursor indefinitely
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2013
diff changeset
  4465
                                self.progress_thread_stopped = False
b9f69c3999d5 16738 Package Manager displays busy cursor indefinitely
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2013
diff changeset
  4466
                                Thread(target = self.__progress_pulse).start()
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4467
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4468
        def __progress_pulse_stop(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4469
                self.progress_stop_thread = True
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4470
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4471
        def __progress_pulse(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4472
                gobject.idle_add(self.w_progress_frame.show)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4473
                while not self.progress_stop_thread:
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4474
                        if self.api_o and self.api_o.can_be_canceled():
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  4475
                                gobject.idle_add(self.progress_cancel.set_sensitive, True)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4476
                        else:
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  4477
                                gobject.idle_add(self.progress_cancel.set_sensitive,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  4478
                                    False)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4479
                        gobject.idle_add(self.w_status_progressbar.pulse)
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4480
                        time.sleep(0.1)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4481
                gobject.idle_add(self.w_progress_frame.hide)
2014
b9f69c3999d5 16738 Package Manager displays busy cursor indefinitely
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2013
diff changeset
  4482
                self.progress_thread_stopped = True
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4483
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4484
        def error_occurred(self, error_msg, msg_title=None, msg_type=gtk.MESSAGE_ERROR):
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4485
                if msg_title:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4486
                        title = msg_title
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4487
                else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4488
                        title = self.program_title
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4489
                gui_misc.error_occurred(self.w_main_window, error_msg,
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4490
                    title, msg_type, use_markup=True)
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4491
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4492
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4493
# Static Methods
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4494
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4495
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4496
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4497
        def __sort(a, b):
1700
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4498
                return cmp(a[2], b[2])
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4499
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4500
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4501
        def filter_cell_data_function(column, renderer, model, itr, data):
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4502
                '''Function which sets icon size'''
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4503
                pm, entry = data
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4504
                if entry == enumerations.FILTER_NAME:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4505
                        renderer.set_property("xalign", 0)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4506
                        renderer.set_property("width", pm.max_filter_length + 10)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4507
                elif entry == enumerations.FILTER_ICON:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4508
                        renderer.set_property("xalign", 0)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4509
                        renderer.set_property("width", 24)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4510
                return
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4511
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4512
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4513
        def cell_data_function(column, renderer, model, itr, data):
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4514
                '''Function which sets the background colour if package is
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4515
                selected'''
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4516
                if itr:
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4517
                        # Theme: do not set background for Inverse Themes
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4518
                        if data and data.is_inverse_theme:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4519
                                renderer.set_property("cell-background-set", False)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4520
                        elif model.get_value(itr, enumerations.MARK_COLUMN):
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4521
                                renderer.set_property("cell-background", "#ffe5cc")
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4522
                                renderer.set_property("cell-background-set", True)
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4523
                        else:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4524
                                renderer.set_property("cell-background-set", False)
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4525
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4526
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4527
        def combobox_id_separator(model, itr):
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  4528
                return model.get_value(itr, 0) == -1 and \
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  4529
                    model.get_value(itr, 1) == ""
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4530
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4531
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4532
        def combobox_filter_id_separator(model, itr):
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4533
                return model.get_value(itr, 0) == -1 and \
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4534
                    model.get_value(itr, 2) == ""
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4535
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4536
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4537
        def get_datetime(version):
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4538
                dt = None
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4539
                try:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4540
                        dt = version.get_datetime()
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4541
                except AttributeError:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4542
                        dt = version.get_timestamp()
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4543
                return dt
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4544
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4545
        def __get_version(self, api_o, local, pkg):
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4546
                version = None
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4547
                try:
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4548
                        info = api_o.info([pkg], local, frozenset(
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4549
                            [api.PackageInfo.STATE, api.PackageInfo.IDENTITY]))
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4550
                        found = info[api.ImageInterface.INFO_FOUND]
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4551
                        version = found[0]
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4552
                except IndexError:
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4553
                        pass
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4554
                except api_errors.ApiException, ex:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4555
                        err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4556
                        logger.error(err)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4557
                        gobject.idle_add(gui_misc.notify_log_error, self)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4558
                except Exception, ex:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4559
                        pass
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4560
                return version
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4561
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4562
#-----------------------------------------------------------------------------#
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4563
# Public Methods
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4564
#-----------------------------------------------------------------------------#
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4565
        def init_show_filter(self):
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4566
                """ Sets up the Filter Combobox size."""
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4567
                self.__init_show_filter()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4568
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4569
        def reload_packages(self):
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4570
                self.api_o = gui_misc.get_api_object(self.image_directory, 
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4571
                    self.pr, self.w_main_window)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4572
                self.cache_o = self.__get_cache_obj(self.api_o)
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  4573
                self.force_reload_packages = False
2425
483df32444d8 18598 Unnecessary refreshing of publisher metadata in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2424
diff changeset
  4574
                self.__do_reload(None, False)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4575
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4576
        def update_facets(self, facets_to_set):
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4577
                if facets_to_set == None or \
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4578
                        len(facets_to_set.keys()) == 0:
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4579
                        return
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4580
                gobject.idle_add(self.__update_facets, facets_to_set)
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4581
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4582
        def __update_facets(self, facets_to_set):
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4583
                installupdate.InstallUpdate([], self,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4584
                    self.image_directory,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4585
                    action = enumerations.UPDATE_FACETS,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4586
                    main_window = self.w_main_window,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4587
                    api_lock = self.api_lock,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4588
                    facets = facets_to_set)
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4589
1216
ff1b8f7a5530 9859 Focus in PM can still be changed via keyboard during a search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1214
diff changeset
  4590
        def is_busy_cursor_set(self):
ff1b8f7a5530 9859 Focus in PM can still be changed via keyboard during a search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1214
diff changeset
  4591
                return self.gdk_window.is_visible()
ff1b8f7a5530 9859 Focus in PM can still be changed via keyboard during a search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1214
diff changeset
  4592
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4593
        def set_busy_cursor(self):
1289
b16975610477 10391 Unique accessibility event should be emitted when PM is "busy"
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1267
diff changeset
  4594
                if self.gdk_window.get_state() & gtk.gdk.WINDOW_STATE_WITHDRAWN:
b16975610477 10391 Unique accessibility event should be emitted when PM is "busy"
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1267
diff changeset
  4595
                        self.gdk_window.show()
b16975610477 10391 Unique accessibility event should be emitted when PM is "busy"
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1267
diff changeset
  4596
                        self.w_main_window.get_accessible().emit('state-change',
b16975610477 10391 Unique accessibility event should be emitted when PM is "busy"
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1267
diff changeset
  4597
                            'busy', True)
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  4598
                if not self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  4599
                        self.__progress_pulse_start()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4600
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4601
        def unset_busy_cursor(self):
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4602
                self.__progress_pulse_stop()
1289
b16975610477 10391 Unique accessibility event should be emitted when PM is "busy"
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1267
diff changeset
  4603
                if not (self.gdk_window.get_state() & gtk.gdk.WINDOW_STATE_WITHDRAWN):
b16975610477 10391 Unique accessibility event should be emitted when PM is "busy"
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1267
diff changeset
  4604
                        self.gdk_window.hide()
b16975610477 10391 Unique accessibility event should be emitted when PM is "busy"
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1267
diff changeset
  4605
                        self.w_main_window.get_accessible().emit('state-change',
b16975610477 10391 Unique accessibility event should be emitted when PM is "busy"
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1267
diff changeset
  4606
                            'busy', False)
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4607
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4608
        def process_package_list_start(self):
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4609
                if self.first_run:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4610
                        self.__setup_filter_combobox()
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  4611
                self.__setup_repositories_combobox(self.api_o)
1450
28b257c5f33e 12266 Wrong focus in package manager on startup
John Rice <john.rice@sun.com>
parents: 1446
diff changeset
  4612
                if self.first_run:
1871
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  4613
                        self.__update_menu_items()
1450
28b257c5f33e 12266 Wrong focus in package manager on startup
John Rice <john.rice@sun.com>
parents: 1446
diff changeset
  4614
                        self.w_repository_combobox.grab_focus()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4615
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4616
        @staticmethod
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4617
        def __get_cache_obj(api_o):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4618
                cache_o = cache.CacheListStores(api_o)
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  4619
                return cache_o
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  4620
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4621
        def __setup_search_completion(self):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4622
                completion = gtk.EntryCompletion()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4623
                self.cache_o.load_search_completion_info(self.search_completion)
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4624
                completion.set_model(self.search_completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4625
                self.w_searchentry.set_completion(completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4626
                completion.set_text_column(0)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4627
                self.w_searchentry.connect('activate', self.__search_completion_cb)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4628
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4629
        def process_package_list_end(self):
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  4630
                self.in_startpage_startup = False
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4631
                if self.update_all_proceed:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4632
                        self.__on_update_all(None)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4633
                        self.update_all_proceed = False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4634
                self.__enable_disable_install_remove()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4635
                self.update_statusbar()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4636
                self.in_setup = False
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4637
                self.cancelled = False
1441
45be39b77b70 12097 Selections switching issue
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1440
diff changeset
  4638
                active_filter = self.w_filter_combobox.get_active()
1865
38b88763703f 15160 Unnecessary refilter of package list
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1862
diff changeset
  4639
                ret = self.__get_selection_and_category_path()
38b88763703f 15160 Unnecessary refilter of package list
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1862
diff changeset
  4640
                need_refilter = True
38b88763703f 15160 Unnecessary refilter of package list
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1862
diff changeset
  4641
                if ret[0] and ret[1][0] == 0:
38b88763703f 15160 Unnecessary refilter of package list
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1862
diff changeset
  4642
                        need_refilter = False
38b88763703f 15160 Unnecessary refilter of package list
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1862
diff changeset
  4643
                if need_refilter or active_filter != enumerations.FILTER_ALL:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4644
                        self.__application_refilter()
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4645
                else:
2017
8eb252bf9335 16767 After select several packages Select All/ Deselect All menus are in incorrect status
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2016
diff changeset
  4646
                        self.__enable_disable_select_all()
8eb252bf9335 16767 After select several packages Select All/ Deselect All menus are in incorrect status
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2016
diff changeset
  4647
                        self.__enable_disable_deselect()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4648
                        if not self.__doing_search():
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4649
                                self.unset_busy_cursor()
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4650
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4651
                        print "End process_package_list_end", time.time()
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  4652
                if self.first_run:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4653
                        if self.gconf.start_insearch:
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  4654
                                self.w_repository_combobox.set_active(
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4655
                                    self.repo_combobox_all_pubs_search_index)
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4656
                                self.repositories_list[ \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4657
                                        self.repo_combobox_all_pubs_installed_index] = \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4658
                                    ([self.repo_combobox_all_pubs_installed_index,
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4659
                                    self.publisher_options[PUBLISHER_INSTALLED],
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4660
                                    self.publisher_options[PUBLISHER_INSTALLED],
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4661
                                    None, ])
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4662
                                   
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  4663
                        self.first_run = False
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  4664
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  4665
        def __count_selected_packages(self):
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4666
                self.all_selected = 0
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4667
                for pub_name in self.selected_pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4668
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4669
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4670
                                break
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4671
                        self.all_selected += len(pkgs)
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  4672
 
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4673
        def update_statusbar(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4674
                '''Function which updates statusbar'''
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  4675
                self.__remove_statusbar_message()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  4676
                search_text = self.w_searchentry.get_text()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4677
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  4678
                self.__count_selected_packages()
2018
2d45af1f935a 16739 Wrong result when searching
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2017
diff changeset
  4679
                if self.application_list == None:
2d45af1f935a 16739 Wrong result when searching
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2017
diff changeset
  4680
                        return
2d45af1f935a 16739 Wrong result when searching
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2017
diff changeset
  4681
                self.length_visible_list = len(self.application_list_filter)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4682
                if not self.in_search_mode:
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4683
                        selected_in_list = 0
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4684
                        for pkg_row in self.application_list_filter:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4685
                                if pkg_row[enumerations.MARK_COLUMN]:
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4686
                                        selected_in_list = selected_in_list + 1
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4687
                        status_str = _("Total: %(total)s  Selected: %(selected)s") % \
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4688
                                {"total": self.length_visible_list, 
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4689
                                "selected": selected_in_list}
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4690
                        self.update_statusbar_message(status_str)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4691
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4692
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4693
                # In Search Mode
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4694
                if self.w_main_statusbar_label:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4695
                        search_text = saxutils.escape(search_text)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4696
                s1, e1 = self.get_start_end_strings()
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4697
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4698
                if self.__doing_search():
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4699
                        active_pub = self.publisher_being_searched
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4700
                        status_str  = ""
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4701
                        if active_pub != None and active_pub != "":
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4702
                                status_str = \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4703
                                        _("Searching %(s1)s%(active_pub)s%(e1)s"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4704
                                        " for %(s1)s%(search_text)s%(e1)s ...") % \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4705
                                        {"s1": s1, "active_pub": active_pub, "e1": e1,
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4706
                                        "search_text": search_text}
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4707
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4708
                                status_str = \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4709
                                        _("Searching for %(s1)s%(search_text)s%(e1)s "
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4710
                                        "...") % \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4711
                                        {"s1": s1, "search_text": search_text, "e1": e1}
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4712
                else:
1981
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  4713
                        status_str = ngettext(
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  4714
                                "%(number)d package found matching %(s1)s"
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  4715
                                "%(search_text)s%(e1)s",
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  4716
                                "%(number)d packages found matching %(s1)s"
4c8d2471cc4a 16579 PackageManager gets different results for installed and non-installed package
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1966
diff changeset
  4717
                                "%(search_text)s%(e1)s", len(self.application_list)) % \
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4718
                                {"number": len(self.application_list),
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4719
                                    "s1": s1, "search_text": search_text, "e1": e1, }
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4720
                self.update_statusbar_message(status_str)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4721
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4722
        def __reset_row_status(self, row):
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4723
                pkg_stem = row[enumerations.STEM_COLUMN]
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4724
                self.__remove_pkg_stem_from_list(pkg_stem)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  4725
                package_info = self.__get_version(self.api_o,
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4726
                    local = True, pkg = pkg_stem)
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4727
                package_installed =  False
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4728
                if package_info:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4729
                        package_installed =  \
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  4730
                            (api.PackageInfo.INSTALLED in package_info.states)
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4731
                if package_installed:
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  4732
                        package_info = self.__get_version(self.api_o,
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4733
                            local = False, pkg = pkg_stem)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  4734
                        if (package_info and
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  4735
                            api.PackageInfo.INSTALLED in package_info.states):
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4736
                                row[enumerations.STATUS_COLUMN] = \
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  4737
                                    api.PackageInfo.INSTALLED
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4738
                                row[enumerations.STATUS_ICON_COLUMN] = \
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4739
                                    self.installed_icon
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4740
                        else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4741
                                row[enumerations.STATUS_COLUMN] = \
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  4742
                                    api.PackageInfo.UPGRADABLE
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4743
                                row[enumerations.STATUS_ICON_COLUMN] = \
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4744
                                    self.update_available_icon
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4745
                else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4746
                        row[enumerations.STATUS_COLUMN] = \
1664
19c85bdf5c1d 13104 Package Manager should use API states instead of defining its own
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1657
diff changeset
  4747
                            api.PackageInfo.KNOWN
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4748
                        row[enumerations.STATUS_ICON_COLUMN] = \
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4749
                            self.not_installed_icon
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4750
                row[enumerations.MARK_COLUMN] = False
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4751
1342
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4752
        def __update_publisher_list(self, pub, full_list, package_list):
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4753
                for row in full_list:
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4754
                        if row[enumerations.ACTUAL_NAME_COLUMN] in package_list:
1342
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4755
                                self.__reset_row_status(row)
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4756
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  4757
        def update_package_list(self, update_list):
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4758
                ''' update_package_list is called with update_list set to None
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4759
                when InstallUpdate object can be discarded when installing or
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4760
                removing packages.
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4761
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4762
                update_package_list is called with update_list set to not None
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4763
                to indicate what packages have been updated so Package Manager
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4764
                can update its data.'''
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4765
                if update_list == None:
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4766
                        self.installupdate = None
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4767
                        if self.img_timestamp:
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4768
                                return
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4769
                self.after_install_remove = True
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4770
                visible_publisher = self.__get_selected_publisher()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4771
                default_publisher = self.default_publisher
2429
e52bcf467f3d 18622 Package state not updated after install
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2425
diff changeset
  4772
                self.__do_refresh(immediate=True)
1772
91a1e0bebcd3 14609 Unexpected error in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1761
diff changeset
  4773
                if update_list == None and not self.img_timestamp:
91a1e0bebcd3 14609 Unexpected error in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1761
diff changeset
  4774
                        self.img_timestamp = self.cache_o.get_index_timestamp()
91a1e0bebcd3 14609 Unexpected error in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1761
diff changeset
  4775
                        self.__on_reload(None)
91a1e0bebcd3 14609 Unexpected error in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1761
diff changeset
  4776
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4777
                visible_list = update_list.get(visible_publisher)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4778
                if self.is_all_publishers_search or self.is_all_publishers_installed \
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4779
                    or self.is_all_publishers or self.in_recent_search:
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4780
                        try:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4781
                                pubs = self.api_o.get_publishers()
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4782
                        except api_errors.ApiException, ex:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4783
                                err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4784
                                gobject.idle_add(self.error_occurred, err,
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4785
                                    None, gtk.MESSAGE_INFO)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4786
                                return
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4787
                        for pub in pubs:
1342
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4788
                                if pub.disabled:
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4789
                                        continue
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4790
                                prefix = pub.prefix
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4791
                                package_list = update_list.get(prefix)
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4792
                                if package_list != None:
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4793
                                        self.__update_publisher_list(prefix,
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4794
                                            self.application_list,
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4795
                                            package_list)
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4796
                                        if self.last_visible_publisher == prefix:
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4797
                                                self.__update_publisher_list(prefix,
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4798
                                                        self.saved_application_list,
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4799
                                                        package_list)
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4800
                        if self.is_all_publishers_installed or self.is_all_publishers:
1574
3bb7e6bc5ce4 13216 PM main list not being updated from All Publisher modes
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1573
diff changeset
  4801
                                self.__do_set_publisher()
1342
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4802
                elif visible_list:
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4803
                        self.__update_publisher_list(visible_publisher, 
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4804
                                self.application_list, visible_list)
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4805
                        if self.in_search_mode:
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4806
                                self.__update_publisher_list(visible_publisher,
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4807
                                        self.saved_application_list,
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4808
                                        visible_list)
ea0f7aa0641c 11209 Status not updated when (un)installing a package after performing a search in all sources
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1341
diff changeset
  4809
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  4810
                for pub in update_list:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  4811
                        if pub != visible_publisher:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  4812
                                pkg_list = update_list.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4813
                                for pkg in pkg_list:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4814
                                        pkg_stem = None
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  4815
                                        if pub != default_publisher:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4816
                                                pkg_stem = gui_misc.get_pkg_stem(
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4817
                                                    pkg, pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4818
                                        else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4819
                                                pkg_stem = gui_misc.get_pkg_stem(
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4820
                                                    pkg)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4821
                                        if pkg_stem:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4822
                                                self.__remove_pkg_stem_from_list(pkg_stem)
1625
061a695c091d 13583 Package remains marked ("selected") after initial install from a newly re-enabled publisher
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1622
diff changeset
  4823
                if not self.img_timestamp:
061a695c091d 13583 Package remains marked ("selected") after initial install from a newly re-enabled publisher
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1622
diff changeset
  4824
                        self.img_timestamp = self.cache_o.get_index_timestamp()
061a695c091d 13583 Package remains marked ("selected") after initial install from a newly re-enabled publisher
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1622
diff changeset
  4825
                        self.__on_reload(None)
061a695c091d 13583 Package remains marked ("selected") after initial install from a newly re-enabled publisher
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1622
diff changeset
  4826
                        return
061a695c091d 13583 Package remains marked ("selected") after initial install from a newly re-enabled publisher
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1622
diff changeset
  4827
                self.img_timestamp = self.cache_o.get_index_timestamp()
1911
1029de64558c 13210 PM provide a way to see All Selected packages across All Publishers
John Rice <john.rice@sun.com>
parents: 1910
diff changeset
  4828
                if self.is_all_publishers_installed or self.is_all_publishers:
1574
3bb7e6bc5ce4 13216 PM main list not being updated from All Publisher modes
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1573
diff changeset
  4829
                        return
1343
ed33c7d18988 10904 pkg-manger GUI: inventory exception w/o further information
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1342
diff changeset
  4830
                # We need to reset status descriptions if a11y is enabled
ed33c7d18988 10904 pkg-manger GUI: inventory exception w/o further information
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1342
diff changeset
  4831
                self.__set_visible_status(False)
2001
e3455bc37d59 16637 Installed status not updated when package is installed or removed
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2000
diff changeset
  4832
                self.__reset_info_tabs()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4833
                self.__enable_disable_selection_menus()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4834
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4835
                self.update_statusbar()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4836
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4837
        def install_version(self, version):
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4838
                ''' Installed specified version of selected package'''
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4839
                if not self.do_api_reset():
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4840
                        return
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4841
                to_install = "%s@%s" % (self.selected_pkgstem, version)
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4842
                install_update = [to_install]
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4843
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4844
                if self.img_timestamp != self.cache_o.get_index_timestamp():
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4845
                        self.img_timestamp = None
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4846
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4847
                installupdate.InstallUpdate(install_update, self, \
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4848
                    self.image_directory, action = enumerations.INSTALL_UPDATE,
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  4849
                    main_window = self.w_main_window, api_lock = self.api_lock)
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4850
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4851
        def get_current_repos_with_search_errors(self):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4852
                return self.current_repos_with_search_errors
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4853
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  4854
        def __reset_home_dir(self):
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  4855
                # We reset the HOME directory in case the user called us
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  4856
                # with gksu and had NFS mounted home directory in which
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  4857
                # case dbus called from gconf cannot write to the directory.
1871
7a658eb01ce9 3139 PM when user has permissions to access the image allow install/removal of packages
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1870
diff changeset
  4858
                if self.is_admin:
1750
1e1d2661ec8b 14422 New Firefox instances is executed as root by packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1744
diff changeset
  4859
                        root_home_dir = self.__find_root_home_dir()
1e1d2661ec8b 14422 New Firefox instances is executed as root by packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1744
diff changeset
  4860
                        os.putenv('HOME', root_home_dir)
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  4861
1028
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4862
        @staticmethod
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4863
        def __find_root_home_dir():
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4864
                return_str = '/var/tmp'
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4865
                 
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4866
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4867
                        lines = pwd.getpwnam('root')
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4868
                except KeyError:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4869
                        if debug:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4870
                                print "Error getting passwd database entry for root"
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4871
                        return return_str
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4872
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4873
                        return_str = lines[5]
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4874
                except IndexError:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4875
                        if debug:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4876
                                print "Error getting home directory for root"
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4877
                return return_str
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4878
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4879
        def restart_after_ips_update(self):
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4880
                self.__main_application_quit(restart = True)
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4881
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4882
        def shutdown_after_image_update(self, exit_pm = False):
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4883
                if exit_pm == True:
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4884
                        self.__on_mainwindow_delete_event(None, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4885
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4886
        def __get_api_object(self):
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4887
                self.api_o = gui_misc.get_api_object(self.image_directory, 
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4888
                    self.pr, self.w_main_window)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4889
                self.cache_o = self.__get_cache_obj(self.api_o)
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4890
                self.img_timestamp = self.cache_o.get_index_timestamp()
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4891
                self.__setup_search_completion()
1686
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  4892
                self.__setup_category_state()
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4893
                gobject.idle_add(self.__got_api_object)
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4894
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4895
        def __got_api_object(self):
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4896
                self.process_package_list_start()
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4897
                
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4898
        def get_api_object(self):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4899
                return self.api_o
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4900
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4901
        def start(self):
2061
7ccedb519372 16938 Unnecessary loading of startpage html
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2052
diff changeset
  4902
                if not self.gconf.show_startpage:
7ccedb519372 16938 Unnecessary loading of startpage html
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2052
diff changeset
  4903
                        self.__setup_startpage(self.gconf.show_startpage)
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4904
                self.set_busy_cursor()
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4905
                Thread(target = self.__get_api_object).start() 
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  4906
        
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  4907
        def unhandled_exception_shutdown(self):
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  4908
                self.__shutdown_part1()
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  4909
                self.__shutdown_part2()
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4910
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4911
###############################################################################
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4912
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4913
# Main
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4914
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4915
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4916
def main():
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4917
        gtk.main()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4918
        return 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4919
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4920
if __name__ == '__main__':
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4921
        program_title = _("Package Manager")
1862
b69dc275eb38 14649 Package Manager does not terminate cleanly after unexpected error
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1860
diff changeset
  4922
        gblexcepthandler = globalexceptionhandler.GlobalExceptionHandler()
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4923
        allow_links = False
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  4924
        debug = False
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4925
        debug_perf = False
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4926
        update_all_proceed = False
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4927
        app_path = None
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4928
        image_dir = None
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  4929
        info_install_arg = None
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4930
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4931
        try:
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4932
                opts, args = getopt.getopt(sys.argv[1:], "hR:Ui:", \
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4933
                    ["help", "allow-links", "image-dir=", "update-all",
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4934
                    "info-install="])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4935
        except getopt.error, msg:
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4936
                print "%s, for help use --help" % msg
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4937
                sys.exit(2)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4938
781
06837558bc07 5798 GUI Packagemanger does not start if the user's home directory is not world readable
Padraig O'Briain <padraig.obriain@sun.com>
parents: 780
diff changeset
  4939
        if os.path.isabs(sys.argv[0]):
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4940
                app_path = sys.argv[0]
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4941
        else:
781
06837558bc07 5798 GUI Packagemanger does not start if the user's home directory is not world readable
Padraig O'Briain <padraig.obriain@sun.com>
parents: 780
diff changeset
  4942
                cmd = os.path.join(os.getcwd(), sys.argv[0])
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4943
                app_path = os.path.realpath(cmd)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4944
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4945
        for option, argument in opts:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4946
                if option in ("-h", "--help"):
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4947
                        print """\
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4948
Use -R (--image-dir) to specify image directory.
1556
9f92a327d343 12859 Strings containing Update All need to be updated
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1555
diff changeset
  4949
Use -U (--update-all) to proceed with Updates"""
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4950
                        sys.exit(0)
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4951
                elif option == "--allow-links":
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4952
                        allow_links = True
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4953
                elif option in ("-R", "--image-dir"):
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4954
                        image_dir = argument
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4955
                elif option in ("-U", "--update-all"):
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4956
                        update_all_proceed = True
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4957
                elif option in ("-i", "--info-install"):
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  4958
                        info_install_arg = argument
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  4959
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4960
        if image_dir == None:
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4961
                try:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4962
                        image_dir = os.environ["PKG_IMAGE"]
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4963
                except KeyError:
2155
de850eb48049 17468 Package Manager cannot start on 153
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2076
diff changeset
  4964
                        image_dir = "/"
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4965
1160
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4966
        try:
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4967
                gtk.init_check()
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4968
        except RuntimeError, e:
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4969
                print _("Unable to initialize gtk")
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4970
                print str(e)
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4971
                sys.exit(1)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4972
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4973
        # Setup webinstall
1826
7a539652fd11 15224 packagemanager launch fails if primary admin role not assigned to user
Shawn Walker <shawn.walker@oracle.com>
parents: 1815
diff changeset
  4974
        if info_install_arg or (args and not update_all_proceed):
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4975
                webinstall = webinstall.Webinstall(image_dir)
1826
7a539652fd11 15224 packagemanager launch fails if primary admin role not assigned to user
Shawn Walker <shawn.walker@oracle.com>
parents: 1815
diff changeset
  4976
                if args:
7a539652fd11 15224 packagemanager launch fails if primary admin role not assigned to user
Shawn Walker <shawn.walker@oracle.com>
parents: 1815
diff changeset
  4977
                        info_install_arg = args[0]
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  4978
                webinstall.process_param(info_install_arg)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4979
                main()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4980
                sys.exit(0)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4981
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4982
        # Setup packagemanager
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4983
        packagemanager = PackageManager(program_title)
1862
b69dc275eb38 14649 Package Manager does not terminate cleanly after unexpected error
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1860
diff changeset
  4984
        gblexcepthandler.set_parent(packagemanager)
2049
9997dbbc5f33 16749 Package Manager seems to start sluggishly
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2041
diff changeset
  4985
9997dbbc5f33 16749 Package Manager seems to start sluggishly
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2041
diff changeset
  4986
        while gtk.events_pending():
9997dbbc5f33 16749 Package Manager seems to start sluggishly
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2041
diff changeset
  4987
                gtk.main_iteration(False)
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4988
        packagemanager.application_path = app_path
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4989
        packagemanager.image_directory = image_dir
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4990
        packagemanager.allow_links = allow_links
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4991
        packagemanager.update_all_proceed = update_all_proceed
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4992
        packagemanager.init_show_filter()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4993
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4994
        gobject.idle_add(packagemanager.start)
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4995
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4996
        main()