src/packagemanager.py
author Padraig O'Briain <padraig.obriain@oracle.com>
Thu, 24 Mar 2011 09:01:53 +0000
changeset 2279 b43ae7845f05
parent 2248 ed0aeb87d2e3
child 2310 ce10607d5332
permissions -rw-r--r--
18058 Package Manager fails to display recent search results
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
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
    91
import pkg.portable as portable
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
    92
import pkg.fmri as fmri
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
    93
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
    94
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
    95
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
    96
import pkg.gui.detailspanel as detailspanel
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
    97
import pkg.gui.entrystyle as entrystyle
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
    98
import pkg.gui.enumerations as enumerations
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
    99
import pkg.gui.exportconfirm as exportconfirm
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   100
import pkg.gui.globalexceptionhandler as globalexceptionhandler
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   101
import pkg.gui.imageinfo as imageinfo
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   102
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
   103
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
   104
import pkg.gui.pmgconf as gconf
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   105
import pkg.gui.pmlogging as logging
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   106
import pkg.gui.preferences as preferences
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   107
import pkg.gui.repository as repository
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   108
import pkg.gui.searcherror as searcherror
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   109
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
   110
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
   111
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
   112
from pkg.client import global_settings
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   113
1650
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   114
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
   115
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   116
# 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
   117
import __builtin__
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   118
__builtin__._ = gettext.gettext
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
   119
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   120
REGEX_STRIP_MARKUP = re.compile(r'<.*?>')
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   121
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
   122
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   123
class PackageManager:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   124
        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
   125
                self.allow_links = False
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   126
                self.program_title = title
830
687f8a73665e 6019 ctrl-c hangs packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 827
diff changeset
   127
                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
   128
                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
   129
                self.user_rights = True
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
   130
                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
   131
                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
   132
                self.api_o = None
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
   133
                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
   134
                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
   135
                self.img_timestamp = None
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   136
                self.gconf = gconf.PMGConf()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   137
                self.set_section = 0
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
   138
                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
   139
                self.in_search_mode = False
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
   140
                self.search_results_id = 0
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
   141
                self.search_results = []
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   142
                self.in_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   143
                self.recent_searches = {}
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   144
                self.recent_searches_cat_iter = None
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   145
                self.adding_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   146
                self.recent_searches_list = []
1790
5733e097d823 14712 Search in all publishers causes traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1789
diff changeset
   147
                self.previous_search_text = None
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   148
                
1650
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   149
                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
   150
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1187
diff changeset
   151
                # 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
   152
                # transport framework uses the defaults in global_settings,
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   153
                # 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
   154
                # 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
   155
                # 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
   156
                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
   157
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   158
                try:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   159
                        self.application_dir = os.environ["PACKAGE_MANAGER_ROOT"]
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   160
                except KeyError:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   161
                        self.application_dir = "/"
791
123e9401e939 5778 Inability to set locale leads to stack trace
Danek Duvall <danek.duvall@sun.com>
parents: 781
diff changeset
   162
                misc.setlocale(locale.LC_ALL, "")
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   163
                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
   164
                        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
   165
                            self.application_dir,
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   166
                            "usr/share/locale"))
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   167
                        module.textdomain("pkg")
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
   168
                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
   169
                self.startpage = startpage.StartPage(self, self.application_dir)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   170
                self.gdk_window = None
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   171
                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
   172
                self.image_directory = None
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   173
                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
   174
                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
   175
                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
   176
                self.update_all_proceed = False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   177
                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
   178
                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
   179
                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
   180
                self.exiting = False
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   181
                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
   182
                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
   183
                self.dependencies_pkgstem = None
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
   184
                self.license_pkgstem = None
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
   185
                self.versions_pkgstem = None
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
   186
                self.selected_pkg_name = None
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
   187
                self.selected_pkg_pub = None
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   188
                self.selected_pkgstem = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   189
                self.selected_model = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   190
                self.selected_path = None
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   191
                self.all_selected = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   192
                self.selected_pkgs = {}
1744
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
   193
                self.package_names = {}
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
   194
                self.special_package_names = []
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   195
                self.to_install_update = {}
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   196
                self.to_remove = {}
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   197
                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
   198
                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
   199
                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
   200
                self.force_reload_packages = True
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   201
                self.icon_theme = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   202
                self.installed_icon = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   203
                self.not_installed_icon = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   204
                self.update_available_icon = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   205
                self.window_icon = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   206
                self.filter_options = []
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   207
                self.__setup_theme_icons()
1246
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
   208
                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
   209
                    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
   210
                    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
   211
                    PUBLISHER_ALL_SEARCH : _("All Publishers (Search)"),
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   212
                    PUBLISHER_ADD : _("Add...")
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   213
                    }
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   214
                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
   215
                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
   216
                self.pubs_display_name = {}
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   217
                self.last_visible_publisher = None
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   218
                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
   219
                self.search_start = 0
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   220
                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
   221
                self.publisher_being_searched = None
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
   222
                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
   223
                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
   224
                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
   225
                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
   226
                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
   227
                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
   228
                self.application_treeview_initialized = False
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   229
                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
   230
                self.category_list = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   231
                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
   232
                self.repo_combobox_all_pubs_index = 0
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   233
                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
   234
                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
   235
                self.repo_combobox_add_index = 0
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   236
                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
   237
                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
   238
                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
   239
                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
   240
                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
   241
                
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   242
                # Create Widgets and show gui
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   243
                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
   244
                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
   245
                    "usr/share/package-manager/packagemanager.ui")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   246
                self.builder.add_from_file(self.gladefile)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   247
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   248
                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
   249
                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
   250
                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
   251
                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
   252
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   253
                self.w_publisher_combobox_hbox = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   254
                    self.builder.get_object("publisher_combobox_hbox")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   255
                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
   256
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   257
                self.w_application_treeview = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   258
                    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
   259
                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
   260
                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
   261
                      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
   262
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   263
                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
   264
                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
   265
                    self.__categoriestreeview_compare_func)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   266
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   267
                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
   268
                self.w_startpage_scrolled_window = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   269
                    self.builder.get_object("startpage_scrolled_window")
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   270
                self.w_startpage_eventbox = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   271
                    self.builder.get_object("startpage_eventbox")
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   272
                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
   273
                    gtk.gdk.color_parse("white"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   274
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   275
                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
   276
                #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
   277
                self.w_main_statusbar_label = \
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   278
                        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
   279
                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
   280
                        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
   281
    
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   282
                self.w_statusbar_hbox = self.builder.get_object("statusbar_hbox")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   283
                self.w_infosearch_frame = self.builder.get_object("infosearch_frame")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   284
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   285
                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
   286
                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
   287
                self.w_status_progressbar.set_pulse_step(0.1)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   288
                self.w_progress_frame.hide()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   289
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   290
                self.w_main_view_notebook = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   291
                    self.builder.get_object("main_view_notebook")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   292
                self.w_searchentry = self.builder.get_object("searchentry")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   293
                self.w_searchentry.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   294
                    _("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
   295
                self.entrystyle = entrystyle.EntryStyle(self.w_searchentry)
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   296
                self.search_completion = gtk.ListStore(str)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   297
                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
   298
                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
   299
                self.w_reload_button.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   300
                    _("Refresh list of packages and package status")) 
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   301
                self.w_installupdate_button = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   302
                    self.builder.get_object("install_update_button")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   303
                self.w_installupdate_button.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   304
                    _("Select packages by marking the checkbox and click "
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   305
                      "to Install/Update"))
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   306
                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
   307
                self.w_remove_button.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   308
                    _("Select packages by marking the checkbox and click "
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   309
                      "to Remove selected")) 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   310
                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
   311
                self.w_updateall_button.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   312
                    _("Checks if updates are available")) 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   313
                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
   314
                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
   315
                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
   316
                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
   317
                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
   318
                    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
   319
                self.w_version_info_menuitem = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   320
                    self.builder.get_object("package_version_info")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   321
                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
   322
                    gtk.STOCK_INFO)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   323
                self.w_version_info_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   324
                self.w_installupdate_menuitem = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   325
                    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
   326
                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
   327
                    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
   328
                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
   329
                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
   330
                    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
   331
                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
   332
                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
   333
                    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
   334
                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
   335
                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
   336
                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
   337
                    "file_export_selections")
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   338
                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
   339
                    "file_manage_publishers")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   340
                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
   341
                    "file_add_publisher")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   342
                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
   343
                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
   344
                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
   345
                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
   346
                self.w_selectall_menuitem = self.builder.get_object("edit_select_all")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   347
                self.w_selectupdates_menuitem = \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   348
                    self.builder.get_object("edit_select_updates")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   349
                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
   350
                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
   351
                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
   352
                    gtk.STOCK_CLEAR)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   353
                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
   354
                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
   355
                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
   356
                    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
   357
                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
   358
                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
   359
                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
   360
                self.search_button.set_tooltip_text(_("Search"))
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   361
                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
   362
                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
   363
                    gtk.STOCK_FIND)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   364
                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
   365
                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
   366
                    "edit_preferences")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   367
                self.w_log_menuitem = self.builder.get_object("log")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   368
                self.w_infosearch_eventbox = self.builder.get_object(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   369
                    "infosearch_eventbox")
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   370
                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
   371
                self.progress_cancel.set_tooltip_text(
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   372
                    _("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
   373
                self.is_all_publishers = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   374
                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
   375
                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
   376
                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
   377
                self.saved_section_active = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   378
                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
   379
                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
   380
                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
   381
                self.saved_category_list = None
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   382
                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
   383
                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
   384
                self.statusbar_message_id = 0
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   385
                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
   386
                toolbar.set_expand(True)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   387
                self.detailspanel = detailspanel.DetailsPanel(self, self.builder)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   388
                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
   389
                    self.window_icon, self.gconf, self)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   390
                self.logging = logging.PMLogging(self.builder, self.window_icon)
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
   391
                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
   392
                    self.window_icon, self.gconf)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   393
                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
   394
                    self.gconf, self)
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   395
                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
   396
                self.__init_repository_tree_view()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   397
                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
   398
2061
7ccedb519372 16938 Unnecessary loading of startpage html
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2052
diff changeset
   399
                if self.gconf.show_startpage:
7ccedb519372 16938 Unnecessary loading of startpage html
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2052
diff changeset
   400
                        self.__setup_startpage(self.gconf.show_startpage)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   401
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   402
                self.__setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   403
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   404
                self.installupdate = None
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   405
                self.package_selection = None
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
   406
                self.application_list_filter = None
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   407
                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
   408
                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
   409
                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
   410
                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
   411
                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
   412
                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
   413
                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
   414
                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
   415
                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
   416
                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
   417
                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
   418
                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
   419
                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
   420
                self.in_setup = True
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   421
                self.__set_initial_sizes()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   422
                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
   423
                self.__setup_busy_cursor()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   424
                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
   425
                        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
   426
                else:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   427
                        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
   428
                            NOTEBOOK_PACKAGE_LIST_PAGE)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   429
                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
   430
                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
   431
                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
   432
                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
   433
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   434
                self.__setup_text_signals()
1912
2c621de836c1 13978 Users should be able to clear logged errors from within PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1911
diff changeset
   435
                gui_misc.setup_logging()
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
   436
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   437
                # 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
   438
                self.is_inverse_theme = False
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   439
                self.theme_name = None
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   440
                self.__setup_theme_properties()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   441
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   442
        @staticmethod
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   443
        def __set_image_for_menuitem(widget, stock_id):
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   444
                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
   445
                    gtk.ICON_SIZE_MENU)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   446
                widget.set_image(image_widget)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   447
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   448
        def __setup_signals(self):
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   449
                ''' 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
   450
                view which are got from GtkBuilder'''
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   451
                signals_table = [
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   452
                    (self.w_main_window, "delete_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   453
                     self.__on_mainwindow_delete_event),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   454
                     (self.w_main_window, "check_resize", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   455
                     self.__on_mainwindow_check_resize),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   456
                     (self.w_main_window, "key_press_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   457
                     self.__on_mainwindow_key_press_event),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   458
                     (self.w_main_window, "style_set", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   459
                     self.__on_mainwindow_style_set),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   460
                     (self.w_searchentry, "changed", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   461
                     self.__on_searchentry_changed),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   462
                     (self.w_searchentry, "focus_in_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   463
                     self.__on_searchentry_focus_in),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   464
                     (self.w_searchentry, "focus_out_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   465
                     self.__on_searchentry_focus_out),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   466
                     (self.w_searchentry, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   467
                     self.__do_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   468
                     (self.w_searchentry, "icon_press", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   469
                     self.__on_clear_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   470
                     (self.w_filter_combobox, "changed", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   471
                     self.__on_filtercombobox_changed),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   472
                     (self.w_repository_combobox, "changed", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   473
                     self.__on_repositorycombobox_changed),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   474
                     (self.w_export_selections_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   475
                     self.__on_file_export_selections),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   476
                     (self.w_quit_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   477
                     self.__on_file_quit_activate),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   478
                     (self.w_be_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   479
                     self.__on_file_be_activate),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   480
                     (self.w_version_info_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   481
                     self.__on_version_info),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   482
                     (self.w_installupdate_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   483
                     self.__on_install_update),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   484
                     (self.w_manage_publishers_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   485
                     self.__on_file_manage_publishers),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   486
                     (self.w_add_publisher_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   487
                     self.__on_file_add_publisher),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   488
                     (self.w_remove_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   489
                     self.__on_remove),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   490
                     (self.w_help_about_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   491
                     self.__on_help_about),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   492
                     (self.w_online_help_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   493
                     self.__on_help_help),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   494
                     (self.w_paste_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   495
                     self.__on_edit_paste),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   496
                     (self.w_delete_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   497
                     self.__on_delete),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   498
                     (self.w_copy_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   499
                     self.__on_copy),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   500
                     (self.w_cut_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   501
                     self.__on_cut),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   502
                     (self.w_search_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   503
                     self.__on_edit_search_clicked),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   504
                     (self.w_gotolist_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   505
                     self.__on_goto_list_clicked),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   506
                     (self.w_clear_search_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   507
                     self.__on_clear_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   508
                     (self.search_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   509
                     self.__do_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   510
                     (self.search_button, "button_press_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   511
                     self.__do_search),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   512
                     (self.progress_cancel, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   513
                     self.__on_progress_cancel_clicked),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   514
                     (self.w_selectall_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   515
                     self.__on_select_all),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   516
                     (self.w_selectupdates_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   517
                     self.__on_select_updates),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   518
                     (self.w_deselect_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   519
                     self.__on_deselect),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   520
                     (self.w_edit_preferences_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   521
                     self.__on_preferences),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   522
                     (self.w_log_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   523
                     self.__on_log_activate),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   524
                     (self.w_updateall_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   525
                     self.__on_update_all),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   526
                     (self.w_updateall_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   527
                     self.__on_update_all),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   528
                     (self.w_reload_menuitem, "activate", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   529
                     self.__on_reload),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   530
                     (self.w_reload_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   531
                     self.__on_reload),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   532
                     (self.w_installupdate_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   533
                     self.__on_install_update),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   534
                     (self.w_remove_button, "clicked", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   535
                     self.__on_remove),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   536
                     (self.w_info_notebook, "switch_page", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   537
                     self.__on_notebook_change),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   538
                     (self.w_infosearch_eventbox, "button_press_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   539
                     self.__on_infosearch_button_press_event),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   540
                     (self.w_application_treeview, "button_press_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   541
                     self.__on_applicationtreeview_button_and_key_events),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   542
                     (self.w_application_treeview, "key_press_event", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   543
                     self.__on_applicationtreeview_button_and_key_events),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   544
                     (self.w_application_treeview, "query_tooltip", 
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   545
                     self.__on_applicationtreeview_query_tooltip),
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   546
                    ]
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   547
                for widget, signal_name, callback in signals_table:
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   548
                        widget.connect(signal_name, callback)
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   549
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   550
                self.exportconfirm.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   551
                self.logging.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   552
                self.preferences.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   553
                self.searcherror.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   554
                self.versioninfo.setup_signals()
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
   555
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   556
        def __setup_theme_properties(self):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   557
                s = gtk.settings_get_default()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   558
                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
   559
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   560
                # 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
   561
                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
   562
                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
   563
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   564
                if self.theme_name == "HighContrastInverse" or \
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   565
                        self.theme_name == "HighContrastLargePrintInverse":
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   566
                        self.is_inverse_theme = True
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   567
                else:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   568
                        self.is_inverse_theme = False
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   569
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
   570
        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
   571
                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
   572
                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
   573
                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
   574
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   575
        def __set_initial_sizes(self):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   576
                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
   577
                        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
   578
                        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
   579
                            self.gconf.initial_app_height)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   580
                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
   581
                        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
   582
                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
   583
                        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
   584
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   585
        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
   586
                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
   587
                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
   588
                    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
   589
                gdk_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   590
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   591
                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
   592
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   593
        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
   594
                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
   595
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   596
        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
   597
                if self.first_run:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   598
                        return
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   599
                self.last_resize = -1
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   600
                # Theme: setup Theme properties
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   601
                self.__setup_theme_properties()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   602
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   603
                # Theme: setup icons for Theme
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   604
                self.__setup_theme_icons()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   605
                self.__reset_view_icons()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   606
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   607
                # Theme: setup Dialog Icons for Theme
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   608
                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
   609
                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
   610
                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
   611
                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
   612
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   613
                # 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
   614
                if self.application_select_column:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   615
                        self.application_select_column.set_widget(
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
   616
                            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
   617
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   618
                # Theme: setup Main list status icons
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   619
                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
   620
                # 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
   621
                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
   622
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   623
                #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
   624
                if self.selected_pkgstem != None:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   625
                        self.__process_package_selection()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   626
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
   627
        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
   628
                select_image = gtk.Image()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   629
                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
   630
                    self.icon_theme, 'selection'))
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   631
                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
   632
                select_image.show()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   633
                return select_image
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   634
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   635
        def __setup_theme_icons(self):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   636
                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
   637
                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
   638
                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
   639
                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
   640
                    'status_installed')
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   641
                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
   642
                    'status_notinstalled')
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   643
                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
   644
                    'status_newupdate')
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   645
                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
   646
                    'packagemanager', 48)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   647
                self.filter_options = [
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   648
                    (enumerations.FILTER_ALL,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   649
                    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
   650
                    _('All Packages')),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   651
                    (enumerations.FILTER_INSTALLED, self.installed_icon,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   652
                    _('Installed Packages')),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   653
                    (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
   654
                    _('Updates')),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   655
                    (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
   656
                    _('Not Installed Packages')),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   657
                    (-1, None, ""),
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   658
                    (enumerations.FILTER_SELECTED,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   659
                    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
   660
                    _('Selected Packages'))
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   661
                    ]
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   662
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   663
        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
   664
                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
   665
                        return                
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   666
                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
   667
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   668
                while app_itr:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   669
                        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
   670
                        if status == api.PackageInfo.INSTALLED:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   671
                                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
   672
                                    self.installed_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   673
                        elif status == api.PackageInfo.KNOWN:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   674
                                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
   675
                                    self.not_installed_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   676
                        elif status == api.PackageInfo.UPGRADABLE:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   677
                                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
   678
                                    self.update_available_icon)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   679
                        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
   680
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   681
        def __reset_view_icons(self):
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   682
                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
   683
                if filter_itr == None or \
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   684
                        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
   685
                        return
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   686
                max_length = 0
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   687
                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
   688
                        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
   689
                        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
   690
                        if filter_id == -1:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   691
                                continue
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   692
                        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
   693
                            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
   694
                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
   695
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   696
        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
   697
                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
   698
                        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
   699
                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
   700
                        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
   701
                else:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   702
                        self.max_filter_length = max_length
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   703
                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
   704
                    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
   705
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
   706
        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
   707
                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
   708
        
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   709
        def __search_completion_cb(self, entry):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   710
                text = entry.get_text()
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   711
                if text:
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   712
                        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
   713
                                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
   714
                                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
   715
                                        len_search_completion >= \
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   716
                                                self.gconf.max_search_completion:
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   717
                                        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
   718
                                        if itr:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   719
                                                self.search_completion.remove(itr)
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   720
                                self.search_completion.append([text])
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   721
                return
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   722
                
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
   723
        def __setup_text_signals(self):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   724
                self.detailspanel.setup_text_signals(
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   725
                    self.__on_text_buffer_has_selection,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   726
                    self.__on_textview_focus_in,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   727
                    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
   728
                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
   729
                    "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
   730
                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
   731
                    "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
   732
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   733
        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
   734
                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
   735
                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
   736
                        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
   737
                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
   738
                        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
   739
                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
   740
                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
   741
                        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
   742
                        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
   743
                        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
   744
                                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
   745
                        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
   746
                        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
   747
                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
   748
                        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
   749
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
        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
   751
                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
   752
                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
   753
                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
   754
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
   755
        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
   756
                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
   757
                        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
   758
                        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
   759
                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
   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
                        self.w_deselect_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   762
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
   763
        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
   764
                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
   765
                        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
   766
                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
   767
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   768
        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
   769
                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
   770
                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
   771
                        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
   772
                                NOTEBOOK_START_PAGE)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   773
                        if self.gconf.start_insearch:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   774
                                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
   775
                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
   776
                        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
   777
                                NOTEBOOK_PACKAGE_LIST_PAGE)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   778
                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
   779
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   780
        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
   781
                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
   782
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   783
                for pub, err in error.failed_servers:
1671
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   784
                        logger.error(_("Publisher:") + " " + pub + ": " +
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   785
                            _("failed to respond") + "\n" + str(err))
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   786
                        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
   787
                for pub in error.invalid_servers:
1671
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   788
                        logger.error(_("Publisher:") + " " + pub + ": " +
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   789
                            _("invalid response") + "\n" +
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   790
                            _("A valid response was not returned."))
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   791
                        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
   792
                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
   793
                        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
   794
                            (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
   795
1667
88ac0910cb61 13918 PM notification icon truncated when error logged
John Rice <john.rice@sun.com>
parents: 1666
diff changeset
   796
        def __on_infosearch_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
   797
                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
   798
                        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
   799
                        return
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
   800
                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
   801
                        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
   802
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   803
        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
   804
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
   805
                        return
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   806
                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
   807
                        if not self.error_logged:
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   808
                                self.w_infosearch_frame.hide()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   809
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   810
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   811
                repo_count = 0
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   812
                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
   813
                        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
   814
                                repo_count += 1
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   815
                if repo_count == 0:
1671
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   816
                        if not self.error_logged:
13280d5e53d2 13756 Over reporting search transport failures
John Rice <john.rice@sun.com>
parents: 1669
diff changeset
   817
                                self.w_infosearch_frame.hide()
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   818
                        return
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   819
1667
88ac0910cb61 13918 PM notification icon truncated when error logged
John Rice <john.rice@sun.com>
parents: 1666
diff changeset
   820
                self.w_infosearch_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
   821
                    _("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
   822
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   823
                self.w_infosearch_frame.show()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   824
                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
   825
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   826
        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
   827
                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
   828
                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
   829
                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
   830
                        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
   831
                                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
   832
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   833
                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
   834
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   835
        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
   836
                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
   837
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   838
                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
   839
                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
   840
                
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   841
        def handle_search_all_publishers(self):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   842
                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
   843
                self.__set_search_start()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   844
                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
   845
                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
   846
                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
   847
                    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
   848
                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
   849
                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
   850
                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
   851
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   852
        def handle_view_all_publishers_installed(self):
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   853
                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
   854
                self.__set_main_view_package_list()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   855
                self.update_statusbar()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   856
                
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   857
        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
   858
                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
   859
                        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
   860
                        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
   861
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   862
                        s1 = e1 = '"'
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   863
                return s1, e1
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   864
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   865
        def browse_publisher(self, pub):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   866
                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
   867
                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
   868
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   869
        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
   870
                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
   871
                if category_tree == None:
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   872
                        return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   873
                rs_iter = category_tree.iter_children(
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   874
                    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
   875
                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
   876
                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
   877
                        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
   878
                while rs_iter:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   879
                        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
   880
                            enumerations.CATEGORY_VISIBLE_NAME)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   881
                        if rs_value == recent_search:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   882
                                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
   883
                                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
   884
                                self.w_categories_treeview.scroll_to_cell(path)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   885
                                return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   886
                        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
   887
                return
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   888
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   889
        def set_view_all_packages(self):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   890
                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
   891
                self.w_filter_combobox.grab_focus()
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   892
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   893
        def invoke_webinstall(self, link):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   894
                self.set_busy_cursor()
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   895
                try:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   896
                        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
   897
                except gobject.GError:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   898
                        self.startpage.link_load_error(link)
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   899
                        self.unset_busy_cursor()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
   900
                        return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   901
                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
   902
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   903
        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
   904
                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
   905
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   906
                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
   907
                        # Links not allowed.
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   908
                        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
   909
                        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
   910
                        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
   911
                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
   912
                        # 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
   913
                        try:
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   914
                                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
   915
                                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
   916
                                    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
   917
                        except gobject.GError:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   918
                                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
   919
                                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
   920
                        return
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   921
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   922
                # 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
   923
                # 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
   924
                # 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
   925
                # 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
   926
                # 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
   927
                # 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
   928
                # 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
   929
                # 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
   930
                try:
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   931
                        # 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
   932
                        # 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
   933
                        # 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
   934
                        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
   935
                        sys.stdout.flush()
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   936
                        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
   937
                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
   938
                        # 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
   939
                        # 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
   940
                        # 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
   941
                        # process was killed.
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
   942
                        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
   943
                        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
   944
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
   945
                        # 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
   946
                        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
   947
                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
   948
                        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
   949
                        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
   950
                        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
   951
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   952
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   953
        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
   954
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   955
                        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
   956
                        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
   957
                        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
   958
                        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
   959
                        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
   960
                        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
   961
                        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
   962
                        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
   963
                        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
   964
                        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
   965
                        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
   966
                        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
   967
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   968
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   969
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   970
        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
   971
                return gtk.TreeStore(
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   972
                        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
   973
                        gobject.TYPE_STRING,      # enumerations.CATEGORY_NAME
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
   974
                        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
   975
                        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
   976
                        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
   977
                        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
   978
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   979
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   980
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   981
        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
   982
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   983
                        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
   984
                        gobject.TYPE_STRING,      # enumerations.SECTION_NAME
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
   985
                        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
   986
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   987
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   988
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   989
        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
   990
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   991
                        gobject.TYPE_INT,         # enumerations.FILTER_ID
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   992
                        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
   993
                        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
   994
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   995
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   996
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   997
        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
   998
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   999
                        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
  1000
                        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
  1001
                        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
  1002
                        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
  1003
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1004
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1005
        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
  1006
            application_list_filter, application_list_sort,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1007
            application_sort_column):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1008
                ##APPLICATION MAIN TREEVIEW
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1009
                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
  1010
                        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
  1011
                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
  1012
                        application_list_sort = \
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1013
                            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
  1014
                        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
  1015
                            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
  1016
                        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
  1017
                            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
  1018
                            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
  1019
                            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
  1020
                        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
  1021
                            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
  1022
                            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
  1023
                            enumerations.DESCRIPTION_COLUMN)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1024
                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
  1025
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1026
                column = gtk.TreeViewColumn("", toggle_renderer,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1027
                    active = enumerations.MARK_COLUMN)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1028
                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
  1029
                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
  1030
                column.connect('clicked', self.__select_column_clicked)
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  1031
                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
  1032
                column.set_widget(select_image)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1033
                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
  1034
                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
  1035
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1036
                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
  1037
                column = gtk.TreeViewColumn(_("Name"), name_renderer,
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1038
                    text = enumerations.NAME_COLUMN)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1039
                column.set_resizable(True)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1040
                column.set_min_width(150)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1041
                column.set_sort_column_id(enumerations.NAME_COLUMN)
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1042
                column.set_sort_indicator(True)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1043
                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
  1044
                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
  1045
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1046
                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
  1047
                column = self.__create_icon_column(_("Status"), True,
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1048
                    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
  1049
                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
  1050
                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
  1051
                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
  1052
                    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
  1053
                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
  1054
                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
  1055
                        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
  1056
                        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
  1057
                        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
  1058
                            repository_renderer,
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1059
                            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
  1060
                        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
  1061
                        column.set_resizable(True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1062
                        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
  1063
                        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
  1064
                            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
  1065
                        column.connect_after('clicked',
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1066
                            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
  1067
                        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
  1068
                        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
  1069
                            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
  1070
                            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
  1071
                            enumerations.PUBLISHER_COLUMN)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1072
                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
  1073
                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
  1074
                    description_renderer,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1075
                    text = enumerations.DESCRIPTION_COLUMN)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1076
                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
  1077
                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
  1078
                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
  1079
                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
  1080
                    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
  1081
                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
  1082
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1083
                self.w_application_treeview.append_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1084
                #Added selection listener
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1085
                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
  1086
                self.application_list = application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1087
                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
  1088
                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
  1089
                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
  1090
                    application_list_sort)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1091
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1092
        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
  1093
            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
  1094
            application_list_sort = None, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1095
            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
  1096
                '''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
  1097
                filters'''
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1098
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1099
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1100
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1101
                        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
  1102
                        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
  1103
                elif application_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1104
                        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
  1105
                        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
  1106
                else:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1107
                        self.__disconnect_models()
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
                        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
  1110
                # 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
  1111
                # 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
  1112
                # section to "All Categories" one.
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1113
                if section_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1114
                        row = section_list[self.set_section]
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1115
                        if row[enumerations.SECTION_ENABLED] and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1116
                            self.set_section >= 0 and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1117
                            self.set_section < len(section_list):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1118
                                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
  1119
                                        self.set_section = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1120
                        else:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1121
                                self.set_section = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1122
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1123
                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
  1124
                        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
  1125
                            application_list_filter, application_list_sort, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1126
                            application_sort_column)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1127
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1128
                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
  1129
                        # 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
  1130
                        # 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
  1131
                        # and scrolling up and down using keyboard.
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1132
                        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
  1133
                        vadj.connect('value-changed',
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1134
                            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
  1135
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1136
                        # 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
  1137
                        # 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
  1138
                        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
  1139
                            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
  1140
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  1141
                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
  1142
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1143
                        ##CATEGORIES TREEVIEW
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  1144
                        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
  1145
                        column = gtk.TreeViewColumn(_('Name'),
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  1146
                            enumerations.CATEGORY_VISIBLE_NAME_r,
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  1147
                            markup = enumerations.CATEGORY_VISIBLE_NAME)
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  1148
                        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
  1149
                        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
  1150
                        #Added selection listener
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1151
                        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
  1152
                        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
  1153
                            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
  1154
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1155
                if section_list != None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1156
                        self.section_list = section_list
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1157
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1158
                        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
  1159
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1160
                if application_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1161
                        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
  1162
                            self.application_list_sort)
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1163
                        if application_list_filter == None:
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1164
                                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
  1165
                                    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
  1166
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1167
                if self.first_run:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1168
                        category_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1169
                            self.__on_category_selection_changed, None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1170
                        self.w_categories_treeview.connect("row-activated",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1171
                            self.__on_category_row_activated, None)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1172
                        self.w_categories_treeview.connect("focus-in-event",
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1173
                            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
  1174
                        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
  1175
                            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
  1176
                        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
  1177
                            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
  1178
                        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
  1179
                            self.__on_categoriestreeview_row_expanded, None)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1180
                        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
  1181
                        self.package_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1182
                            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
  1183
                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
  1184
                        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
  1185
                self.a11y_application_treeview = \
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1186
                    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
  1187
                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
  1188
                if obj != None:
4501e2b0febd 11382 traceback on console when starting packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1357
diff changeset
  1189
                        obj.set_name(_("all selection toggle"))
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1190
                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
  1191
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1192
        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
  1193
                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
  1194
                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
  1195
                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
  1196
                    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
  1197
                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
  1198
                    self.filter_cell_data_function,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1199
                    (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
  1200
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1201
                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
  1202
                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
  1203
                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
  1204
                    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
  1205
                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
  1206
                    self.filter_cell_data_function,
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1207
                    (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
  1208
                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
  1209
                    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
  1210
                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
  1211
                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
  1212
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1213
        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
  1214
                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
  1215
                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
  1216
                    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
  1217
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1218
        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
  1219
                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
  1220
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1221
        def __init_repository_tree_view(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1222
                cell = gtk.CellRendererText()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1223
                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
  1224
                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
  1225
                    enumerations.REPOSITORY_DISPLAY_NAME)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1226
                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
  1227
                    self.combobox_id_separator)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1228
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1229
        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
  1230
                # 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
  1231
                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
  1232
                        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
  1233
                            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
  1234
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1235
        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
  1236
                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
  1237
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1238
        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
  1239
                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
  1240
                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
  1241
                        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
  1242
                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
  1243
                        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
  1244
                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
  1245
                        desc = _("Updates Available")
864
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1246
                else:
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1247
                        desc = None
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1248
                if desc != None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1249
                        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
  1250
                            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
  1251
                            STATUS_COLUMN_INDEX)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1252
                        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
  1253
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1254
        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
  1255
                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
  1256
                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
  1257
                    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
  1258
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1259
                if self.__doing_search():
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1260
                        return
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1261
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1262
                a11y_enabled = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1263
                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
  1264
                        a11y_enabled = True
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1265
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
  1266
                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
  1267
                        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
  1268
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1269
                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
  1270
                if visible_range == None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1271
                        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
  1272
                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
  1273
                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
  1274
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1275
                # 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
  1276
                # 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
  1277
                # 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
  1278
                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
  1279
                        check_range = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1280
                        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
  1281
                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
  1282
                        check_range = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1283
                
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1284
                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
  1285
                        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
  1286
                                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
  1287
                                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
  1288
                                 # 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
  1289
                                 # 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
  1290
                                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
  1291
                                    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
  1292
                                        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
  1293
                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1294
                                        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
  1295
                                                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
  1296
                                                        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
  1297
                                                                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
  1298
                                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1299
                                                        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
  1300
                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
  1301
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1302
                sort_filt_model = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1303
                    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
  1304
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1305
                if a11y_enabled:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1306
                        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
  1307
                            str(a11y_start))                
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1308
                        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
  1309
                                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
  1310
                                a11y_start += 1
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1311
                                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
  1312
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1313
        def __doing_search(self):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1314
                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
  1315
                
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1316
        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
  1317
                column = gtk.TreeViewColumn()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1318
                column.set_title(name)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1319
                #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
  1320
                #column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1321
                render_pixbuf = gtk.CellRendererPixbuf()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1322
                column.pack_start(render_pixbuf, expand = expand_pixbuf)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1323
                column.add_attribute(render_pixbuf, "pixbuf", enum_value)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1324
                column.set_fixed_width(32)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1325
                if set_data_func:
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1326
                        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
  1327
                            self.cell_data_function, self)
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1328
                return column
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1329
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1330
        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
  1331
                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
  1332
                        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
  1333
                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
  1334
                        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
  1335
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1336
        def __disconnect_repository_model(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1337
                self.w_repository_combobox.set_model(None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1338
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1339
        @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
  1340
        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
  1341
                get_val = treemodel.get_value
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1342
                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
  1343
                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
  1344
                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
  1345
                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
  1346
                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
  1347
                        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
  1348
                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
  1349
                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
  1350
                return cmp(name1, name2)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1351
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1352
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1353
        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
  1354
                columns = treeview.get_columns()
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1355
                if columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1356
                        for column in columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1357
                                treeview.remove_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1358
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1359
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1360
        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
  1361
                '''This function is for initializing the sections list'''
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1362
                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
  1363
                # 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
  1364
                # 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
  1365
                # 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
  1366
                section_list.append([0, _('All Categories'), enabled ])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1367
                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
  1368
                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
  1369
                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
  1370
                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
  1371
                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
  1372
                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
  1373
                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
  1374
                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
  1375
                section_list.append([8, _('Web Services'), enabled ])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1376
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1377
        def __init_show_filter(self):
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1378
                max_length = 0
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1379
                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
  1380
                        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
  1381
                        if filter_id == -1:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1382
                                continue
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1383
                        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
  1384
                            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
  1385
                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
  1386
                
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1387
                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
  1388
                    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
  1389
                        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
  1390
                        if row[enumerations.SECTION_ID] != \
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1391
                            self.gconf.initial_show_filter:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1392
                                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
  1393
                else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1394
                        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
  1395
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
  1396
        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
  1397
                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
  1398
                        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
  1399
                                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
  1400
                                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
  1401
                                        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
  1402
                                            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
  1403
                        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
  1404
                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
  1405
                        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
  1406
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1407
        def __on_mainwindow_delete_event(self, widget, event):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1408
                ''' handler for delete event of the main window '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1409
                if self.__check_if_something_was_changed() == True:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1410
                        # XXX Change this to not quit and show dialog
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1411
                        # XXX if some changes were applied:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1412
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1413
                        return True
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1414
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1415
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1416
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
  1417
        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
  1418
                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
  1419
                        return
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1420
                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
  1421
                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
  1422
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1423
                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
  1424
                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
  1425
                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
  1426
                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
  1427
                if main_win_width < min_width:
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1428
                        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
  1429
                        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
  1430
                                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
  1431
                                self.startpage.handle_resize()
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1432
                        return
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1433
                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
  1434
                        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
  1435
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
  1436
                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
  1437
                        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
  1438
                        self.startpage.handle_resize()
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1439
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1440
        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
  1441
                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
  1442
                        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
  1443
                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
  1444
                        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
  1445
                        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
  1446
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
                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
  1448
                            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
  1449
                                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
  1450
                                
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
                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
  1452
                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
  1453
                    widget.get_size()[1]-status_height)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1454
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1455
        def __on_file_quit_activate(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1456
                ''' handler for quit menu event '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1457
                self.__on_mainwindow_delete_event(None, None)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1458
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1459
        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
  1460
                ''' 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
  1461
                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
  1462
                    action=enumerations.MANAGE_PUBLISHERS,
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1463
                    main_window = self.w_main_window)
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1464
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_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
  1466
                ''' 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
  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.ADD_PUBLISHER,
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1469
                    main_window = self.w_main_window)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1470
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1471
        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
  1472
                ''' 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
  1473
                beadm.Beadmin(self)
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1474
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1475
        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
  1476
                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
  1477
                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
  1478
                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
  1479
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1480
        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
  1481
                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
  1482
                        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
  1483
                else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1484
                        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
  1485
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1486
        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
  1487
                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
  1488
                        try:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1489
                                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
  1490
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1491
                        except AttributeError:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1492
                                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
  1493
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1494
                        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
  1495
        
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1496
        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
  1497
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1498
                        return
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1499
                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
  1500
                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
  1501
                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
  1502
                        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
  1503
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
  1504
        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
  1505
                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
  1506
                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
  1507
                self.is_all_publishers_search = True
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1508
                self.w_infosearch_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
  1509
                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
  1510
                        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
  1511
                
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1512
                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
  1513
                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
  1514
                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
  1515
                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
  1516
                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
  1517
                    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
  1518
                    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
  1519
                if show_search_all_page: 
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1520
                        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
  1521
                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
  1522
                        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
  1523
                            NOTEBOOK_START_PAGE)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1524
                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
  1525
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1526
        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
  1527
                if not self.first_run:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1528
                        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
  1529
  
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  1530
        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
  1531
                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
  1532
                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
  1533
                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
  1534
                        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
  1535
                        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
  1536
                                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
  1537
                                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
  1538
                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
  1539
                    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
  1540
                self.__setup_notebook_page_view()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1541
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1542
        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
  1543
                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
  1544
                self.__setup_notebook_page_view()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1545
                self.__set_focus_on_searchentry()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1546
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1547
        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
  1548
                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
  1549
                self.__setup_notebook_page_view()
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1550
                    
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1551
        def __setup_zero_filtered_results_page(self):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1552
                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
  1553
                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
  1554
                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
  1555
                    filter_desc)
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()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1557
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1558
        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
  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_search_zero_filtered_results_page(text,
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1562
                    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
  1563
                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
  1564
                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
  1565
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1566
        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
  1567
                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
  1568
                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
  1569
                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
  1570
                        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
  1571
                                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
  1572
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1573
                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
  1574
                
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
  1575
        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
  1576
                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
  1577
                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
  1578
                    search_all)
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  1579
                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
  1580
                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
  1581
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1582
        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
  1583
                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
  1584
                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
  1585
                        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
  1586
                        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
  1587
                        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
  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 __setup_search_wildcard_page(self):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1590
                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
  1591
                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
  1592
                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
  1593
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1594
        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
  1595
                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
  1596
                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
  1597
                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
  1598
                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
  1599
                self.__init_tree_views(application_list, None, None)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1600
                if unselect_cat:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1601
                        self.__unselect_category()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1602
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1603
        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
  1604
                self.in_search_mode = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1605
                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
  1606
                self.is_all_publishers_search = False
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1607
                self.w_infosearch_frame.hide()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1608
                if self.last_visible_publisher == \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1609
                        self.publisher_options[PUBLISHER_INSTALLED]:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1610
                        self.is_all_publishers_installed = True
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1611
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1612
                        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
  1613
                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
  1614
                        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
  1615
                        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
  1616
                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
  1617
                        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
  1618
                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
  1619
                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
  1620
                    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
  1621
                        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
  1622
                            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
  1623
                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
  1624
                # Reset MARK_COLUMN        
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1625
                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
  1626
                        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
  1627
                        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
  1628
                        marked = False
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1629
                        pkgs = None
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1630
                        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
  1631
                                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
  1632
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1633
                                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
  1634
                                        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
  1635
                        # 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
  1636
                        # 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
  1637
                        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
  1638
                                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
  1639
                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
  1640
                        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
  1641
                        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
  1642
                            None, None,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1643
                            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
  1644
                            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
  1645
                else:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1646
                        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
  1647
                            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
  1648
                            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
  1649
                            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
  1650
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1651
                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
  1652
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1653
        def __save_application_list(self, app_list):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1654
                self.saved_application_list = app_list
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1655
                                
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1656
        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
  1657
                #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
  1658
                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
  1659
                        return
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1660
                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
  1661
                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
  1662
                        self.application_list_sort
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1663
                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
  1664
                        self.application_list_filter
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1665
                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
  1666
                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
  1667
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1668
                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
  1669
                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
  1670
                        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
  1671
                        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
  1672
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1673
        def __do_search(self, widget=None, ev=None):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1674
                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
  1675
                self.__reset_search_start()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1676
                txt = self.entrystyle.get_text()
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1677
                if txt == None:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1678
                        return
1804
615d829ec26e 14942 Traceback when getting package info after search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1799
diff changeset
  1679
                self.previous_search_text = txt
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1680
                if self.is_all_publishers_installed:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1681
                        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
  1682
                        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
  1683
                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
  1684
                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
  1685
                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
  1686
                        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
  1687
                                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
  1688
                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
  1689
                        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
  1690
                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
  1691
                        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
  1692
                        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
  1693
                        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
  1694
                                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
  1695
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1696
                                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
  1697
                                        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
  1698
                                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
  1699
                                        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
  1700
                        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
  1701
                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
  1702
                        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
  1703
                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
  1704
                self.__set_focus_on_searchentry()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1705
                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
  1706
                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
  1707
                        
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1708
                self.w_infosearch_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
  1709
                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
  1710
                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
  1711
                    args = (is_search_all, )).start()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1712
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
  1713
        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
  1714
                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
  1715
                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
  1716
                        return None, (0,)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1717
                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
  1718
                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
  1719
                        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
  1720
                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
  1721
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
        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
  1723
                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
  1724
                if selection:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1725
                        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
  1726
                        selection.unselect_all()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1727
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
  1728
        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
  1729
                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
  1730
                        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
  1731
                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
  1732
                        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
  1733
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1734
        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
  1735
                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
  1736
                self.search_time_sec = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1737
                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
  1738
                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
  1739
                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
  1740
                self.in_setup = False
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1741
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1742
        def __handle_inc_search_results(self, sort_col):
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1743
                self.search_results_id = 0
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1744
                if debug:
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1745
                        print "handle_inc_search_results: ", \
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1746
                                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
  1747
                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
  1748
                self.in_setup = True
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1749
                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
  1750
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1751
        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
  1752
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  1753
                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
  1754
                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
  1755
                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
  1756
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  1757
        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
  1758
                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
  1759
                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
  1760
                self.search_time_sec = 0
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1761
                self.search_results = []
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1762
                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
  1763
                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
  1764
                pub_prefix = None
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1765
                # 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
  1766
                searches = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1767
                servers = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1768
                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
  1769
                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
  1770
                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
  1771
                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
  1772
                        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
  1773
                        servers = None
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1774
                else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1775
                        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
  1776
                        try:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1777
                                if pub_prefix != None:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1778
                                        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
  1779
                                else:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1780
                                        pub = self.api_o.get_preferred_publisher()
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1781
                        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
  1782
                                err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1783
                                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
  1784
                                    None, gtk.MESSAGE_INFO)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1785
                                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
  1786
                                return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1787
                        origin_uri = gui_misc.get_origin_uri(pub.selected_repository)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1788
                        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
  1789
                        self.publisher_being_searched = \
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1790
                                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
  1791
                if debug:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1792
                        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
  1793
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1794
                #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
  1795
                case_sensitive = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1796
                return_actions = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1797
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1798
                last_name = ""
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1799
                # 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
  1800
                sort_col = enumerations.NAME_COLUMN
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  1801
                # pylint: disable-msg=C0321
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1802
                try:
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1803
                        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
  1804
                            [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
  1805
                                servers=servers))
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1806
                        if debug:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1807
                                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
  1808
                                        ("".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
  1809
                        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
  1810
                            itertools.chain(*searches):
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1811
                                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
  1812
                                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1813
                                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1814
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
  1815
                                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
  1816
                                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
  1817
                                    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
  1818
                                        active_pub = pub["prefix"]
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1819
                                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
  1820
                                if last_name != name:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1821
                                        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
  1822
                                                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
  1823
                                                    % (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
  1824
                                        a_res = name, active_pub
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1825
                                        self.search_results.append(a_res)
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1826
                                        if self.search_results_id == 0:
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1827
                                                self.search_results_id = (
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1828
                                                    gobject.timeout_add(
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1829
                                                        INC_RESULTS_DELAY,
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1830
                                                        self.__handle_inc_search_results,
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1831
                                                        sort_col))
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1832
                                last_name = name
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1833
                                self.pylintstub = query_num
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1834
                except api_errors.ProblematicSearchServers, ex:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1835
                        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
  1836
                        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
  1837
                        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
  1838
                                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
  1839
                                        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
  1840
                                                _("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
  1841
                                                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
  1842
                                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1843
                                        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
  1844
                                                pub_prefix, text, search_all)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1845
                                return
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1846
                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
  1847
                        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
  1848
                        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
  1849
                        gobject.idle_add(self.__process_after_cancel)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1850
                        return
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1851
                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
  1852
                        err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1853
                        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
  1854
                                None, gtk.MESSAGE_INFO)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  1855
                        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
  1856
                        return
1704
192f1df8e20f 14230 PM should handle WrapSuccessfulIndexingException
John Rice <john.rice@sun.com>
parents: 1701
diff changeset
  1857
                except Exception, aex:
192f1df8e20f 14230 PM should handle WrapSuccessfulIndexingException
John Rice <john.rice@sun.com>
parents: 1701
diff changeset
  1858
                        err = str(aex)
192f1df8e20f 14230 PM should handle WrapSuccessfulIndexingException
John Rice <john.rice@sun.com>
parents: 1701
diff changeset
  1859
                        logger.error(err)
192f1df8e20f 14230 PM should handle WrapSuccessfulIndexingException
John Rice <john.rice@sun.com>
parents: 1701
diff changeset
  1860
                        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
  1861
                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1862
                        return
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1863
                finally:
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1864
                        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
  1865
                if debug:
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1866
                        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
  1867
                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
  1868
                        if debug:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1869
                                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
  1870
                        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
  1871
                                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
  1872
                                        _("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
  1873
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1874
                                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
  1875
                                        pub_prefix, text, search_all)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1876
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1877
                #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
  1878
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1879
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1880
                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
  1881
                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
  1882
                        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
  1883
                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
  1884
                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
  1885
                    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
  1886
                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
  1887
                        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
  1888
                        if debug:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1889
                                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
  1890
                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
  1891
                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
  1892
                    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
  1893
                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
  1894
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1895
1696
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1896
                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
  1897
                    len(application_list))
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1898
1917
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1899
        def __clear_inc_search_results_task(self):
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1900
                if self.search_results_id != 0:
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1901
                        gobject.source_remove(self.search_results_id)
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1902
                        self.search_results_id = 0
773e4a1e9a52 16040 Optimize search return results
John Rice <john.rice@sun.com>
parents: 1914
diff changeset
  1903
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1904
        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
  1905
                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
  1906
                        return
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1907
                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
  1908
                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
  1909
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1910
        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
  1911
                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
  1912
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1913
        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
  1914
                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
  1915
                
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
  1916
        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
  1917
            search_all):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1918
                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
  1919
                        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
  1920
                                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
  1921
                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
  1922
                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
  1923
                    search_all)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1924
                self.in_setup = True
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1925
                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
  1926
                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
  1927
                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
  1928
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1929
        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
  1930
                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
  1931
                        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
  1932
                else:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1933
                        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
  1934
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1935
        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
  1936
                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
  1937
                        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
  1938
                else:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1939
                        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
  1940
                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
  1941
                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
  1942
                        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
  1943
                else:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  1944
                        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
  1945
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1946
        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
  1947
                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
  1948
                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
  1949
                        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
  1950
                        #Add to application_list
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1951
                        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
  1952
                            [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
  1953
                            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
  1954
                            pub_name, pub, False])
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1955
                return application_list
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1956
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1957
        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
  1958
                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
  1959
                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
  1960
                    application_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1961
                return application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1962
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1963
        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
  1964
            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
  1965
                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
  1966
                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
  1967
                    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
  1968
                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
  1969
                    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
  1970
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
  1971
        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
  1972
                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
  1973
                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
  1974
                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
  1975
                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
  1976
                        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
  1977
                        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
  1978
                                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
  1979
                                        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
  1980
                                            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
  1981
                                                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
  1982
                                                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
  1983
                                if not found: 
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1984
                                        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
  1985
                        else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  1986
                                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
  1987
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1988
                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
  1989
                        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
  1990
                                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
  1991
                                        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
  1992
                                                  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
  1993
                                                  [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
  1994
                                                  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
  1995
                                                  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
  1996
                                        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
  1997
                        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
  1998
                                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
  1999
                                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
  2000
                                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
  2001
                        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
  2002
                                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
  2003
                                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
  2004
                                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
  2005
                        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
  2006
                                err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  2007
                                logger.error(err)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  2008
                                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
  2009
                        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
  2010
                                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
  2011
                                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
  2012
                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
  2013
                        return results
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2014
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2015
        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
  2016
                ''' 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
  2017
                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
  2018
                self.application_refilter_id = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2019
                if self.in_setup:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2020
                        return
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2021
                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
  2022
                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
  2023
                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
  2024
                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
  2025
                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
  2026
                if app_id != None:
bcdaf5bdde1c 12910 Switching categories after sorting packages got traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1530
diff changeset
  2027
                        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
  2028
                if model != None:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2029
                        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
  2030
                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
  2031
                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
  2032
                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
  2033
                        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
  2034
                            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
  2035
                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
  2036
                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
  2037
                        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
  2038
                        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
  2039
                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
  2040
                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
  2041
                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
  2042
                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
  2043
                self.__enable_disable_deselect()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2044
                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
  2045
                        len_filtered_list == 0 and \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2046
                        self.w_filter_combobox.get_active() != \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2047
                        (enumerations.FILTER_SELECTED):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2048
                        self.__setup_zero_filtered_results_page()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2049
                        self.update_statusbar()
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2050
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2051
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2052
        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
  2053
                self.w_searchentry.paste_clipboard()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2054
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  2055
        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
  2056
                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
  2057
                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
  2058
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2059
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2060
        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
  2061
                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
  2062
                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
  2063
                        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
  2064
                        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
  2065
                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
  2066
                        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
  2067
                            self.w_main_clipboard)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2068
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2069
        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
  2070
                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
  2071
                self.w_paste_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2072
1243
d1f303f7dd86 9858 Need to get focus in package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1236
diff changeset
  2073
        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
  2074
                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
  2075
                        if self.startpage.view:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2076
                                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
  2077
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2078
                        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
  2079
                        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
  2080
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2081
        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
  2082
                self.w_searchentry.grab_focus()
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2083
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2084
        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
  2085
                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
  2086
                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
  2087
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
  2088
        def __clear_search_results(self):
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2089
                # 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
  2090
                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
  2091
                        self.__clear_before_search()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2092
                        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
  2093
                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
  2094
                        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
  2095
                                != NOTEBOOK_START_PAGE:
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  2096
                                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
  2097
                else:
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  2098
                        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
  2099
                return
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2100
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2101
        def __on_progress_cancel_clicked(self, widget):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2102
                Thread(target = self.api_o.cancel, args = ()).start()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2103
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2104
        def __on_startpage(self, widget):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2105
                self.startpage.load_startpage()
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2106
                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
  2107
2001
e3455bc37d59 16637 Installed status not updated when package is installed or removed
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2000
diff changeset
  2108
        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
  2109
                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
  2110
                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
  2111
                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
  2112
                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
  2113
                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
  2114
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2115
        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
  2116
                if pagenum == None:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2117
                        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
  2118
                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
  2119
                if itr:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2120
                        self.selected_pkgstem = \
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2121
                               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
  2122
                        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
  2123
                               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
  2124
                        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
  2125
                               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
  2126
                        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
  2127
                            immediate)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2128
                        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
  2129
                else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2130
                        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
  2131
                        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
  2132
                        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
  2133
                        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
  2134
                        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
  2135
                        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
  2136
                        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
  2137
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2138
        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
  2139
                '''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
  2140
                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
  2141
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2142
                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
  2143
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
  2144
        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
  2145
                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
  2146
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2147
        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
  2148
            immediate = False):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2149
                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
  2150
                    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
  2151
                    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
  2152
                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
  2153
                        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
  2154
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2155
                        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
  2156
                        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
  2157
                                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
  2158
                                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
  2159
                        if immediate:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2160
                                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
  2161
                        else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2162
                                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
  2163
                                    self.__show_dependencies)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2164
                        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
  2165
                                source_id
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2166
                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
  2167
                        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
  2168
                                return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2169
                        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
  2170
                        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
  2171
                                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
  2172
                                self.show_licenses_id = 0
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2173
                        if immediate:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2174
                                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
  2175
                        else:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2176
                                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
  2177
                                    self.__show_licenses)
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2178
                        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
  2179
                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
  2180
                        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
  2181
                                return
1999
308392f1f21c 16711 Package Manager Versions tab not displayed correctly
John Rice <john.rice@oracle.com>
parents: 1995
diff changeset
  2182
                        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
  2183
                        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
  2184
                                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
  2185
                                self.show_versions_id = 0
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2186
                        if immediate:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2187
                                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
  2188
                        else:
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2189
                                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
  2190
                                    self.__show_versions)
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  2191
                        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
  2192
                else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2193
                        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
  2194
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2195
                        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
  2196
                        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
  2197
                                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
  2198
                                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
  2199
                        if immediate:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2200
                                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
  2201
                                    model, path)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2202
                        else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  2203
                                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
  2204
                                    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
  2205
                        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
  2206
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2207
        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
  2208
                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
  2209
                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
  2210
                        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
  2211
                        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
  2212
                        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
  2213
                        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
  2214
                        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
  2215
                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
  2216
                        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
  2217
                                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
  2218
                        else:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2219
                                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
  2220
                        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
  2221
                        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
  2222
                        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
  2223
                        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
  2224
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2225
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2226
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2227
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2228
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2229
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2230
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2231
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2232
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2233
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2234
                            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
  2235
                        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
  2236
                        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
  2237
                                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
  2238
                        else:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2239
                                filtered_iter = \
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2240
                                        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
  2241
                                            iter_next)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2242
                                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
  2243
                                    filtered_iter)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2244
                                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
  2245
                                        list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2246
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2247
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2248
                        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
  2249
                        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
  2250
                        if select_all and not mark_value:
929
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2251
                                model.set_value(itr, enumerations.MARK_COLUMN, True)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2252
                                pkg_stem = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2253
                                    enumerations.STEM_COLUMN)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2254
                                pkg_status = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2255
                                    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
  2256
                                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
  2257
                                    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
  2258
                                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
  2259
                                    enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2260
                                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
  2261
                                    enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2262
                                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
  2263
                                    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
  2264
                        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
  2265
                                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
  2266
                                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
  2267
                                    enumerations.STEM_COLUMN)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2268
                                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
  2269
                
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2270
                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
  2271
                self.w_deselect_menuitem.set_sensitive(select_all)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2272
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2273
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2274
                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
  2275
                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
  2276
                        
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2277
        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
  2278
                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
  2279
                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
  2280
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2281
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2282
        def __on_select_updates(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2283
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2284
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2285
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2286
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2287
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2288
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2289
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2290
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2291
                        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
  2292
                            iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2293
                        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
  2294
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2295
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2296
                            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
  2297
                        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
  2298
                        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
  2299
                            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
  2300
                                list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2301
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2302
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2303
                        itr = model.get_iter(path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2304
                        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
  2305
                        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
  2306
                        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
  2307
                        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
  2308
                            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
  2309
                        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
  2310
                            enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2311
                        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
  2312
                            enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2313
                        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
  2314
                            pkg_publisher, pkg_description)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2315
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2316
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2317
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2318
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2319
        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
  2320
                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
  2321
                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
  2322
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2323
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2324
        def __on_preferences(self, widget):
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2325
                self.preferences.activate()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2326
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2327
        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
  2328
                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
  2329
                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
  2330
                        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
  2331
                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
  2332
                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
  2333
                        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
  2334
                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
  2335
                        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
  2336
                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
  2337
                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
  2338
                        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
  2339
                        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
  2340
                        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
  2341
                                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
  2342
                        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
  2343
                        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
  2344
                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
  2345
                        self.w_deselect_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2346
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2347
        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
  2348
                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
  2349
                        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
  2350
                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
  2351
                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
  2352
                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
  2353
                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
  2354
                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
  2355
                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
  2356
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2357
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
        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
  2359
                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
  2360
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
        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
  2362
                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
  2363
                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
  2364
                if bounds:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2365
                        #enable selection functions
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2366
                        self.w_cut_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2367
                        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
  2368
                        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
  2369
                        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
  2370
                                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
  2371
                        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
  2372
                                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
  2373
                        self.w_deselect_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2374
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2375
                        self.w_cut_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2376
                        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
  2377
                        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
  2378
                        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
  2379
                        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
  2380
                                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
  2381
                        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
  2382
                                self.w_selectall_menuitem.set_sensitive(True)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  2383
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2384
        def __refilter_on_idle(self):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2385
                if self.application_refilter_id != 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2386
                        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
  2387
                        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
  2388
                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
  2389
                        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
  2390
                            self.__application_refilter)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2391
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2392
        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
  2393
                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
  2394
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2395
        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
  2396
                '''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
  2397
                # Activated sub node in Recent Searches category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2398
                if self.in_recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2399
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2400
                # User activated Recent Searches Top Level category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2401
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2402
                if model != None and self.recent_searches_cat_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2403
                        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
  2404
                        selection, curr_path = self.__get_selection_and_category_path()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2405
                        self.pylintstub = selection
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2406
                        if curr_path == rs_path:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2407
                                self.__setup_recent_search_page()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2408
                                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
  2409
                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
  2410
                        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
  2411
                        return
1122
cf87b7d8fe39 8888 Gtk warning emitted on Reload
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1109
diff changeset
  2412
                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
  2413
                        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
  2414
                            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
  2415
                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
  2416
                        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
  2417
                        return
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2418
                self.__set_main_view_package_list()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2419
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2420
                self.__refilter_on_idle()
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2421
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2422
        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
  2423
                # 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
  2424
                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
  2425
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2426
                if show_list:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2427
                        self.w_main_view_notebook.set_current_page(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2428
                                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
  2429
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2430
                        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
  2431
                                NOTEBOOK_START_PAGE)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2432
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
  2433
        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
  2434
                self.w_categories_treeview.set_cursor(path)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2435
                self.__save_expanded_path(path, False)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2436
                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
  2437
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2438
        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
  2439
                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
  2440
                        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
  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, True)
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_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
  2446
                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
  2447
                        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
  2448
                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
  2449
                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
  2450
                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
  2451
                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
  2452
                        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
  2453
                        cellx = pthinfo[2]
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2454
                        #Clicking on row toggle icon just select the path
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2455
                        if cellx <= CATEGORY_TOGGLE_ICON_WIDTH:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2456
                                self.w_categories_treeview.set_cursor(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2457
                                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
  2458
                                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
  2459
                        #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
  2460
                        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
  2461
                        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
  2462
                                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
  2463
                                        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
  2464
                                        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
  2465
                                        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
  2466
                                            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
  2467
                                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
  2468
                                        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
  2469
                                                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
  2470
                                        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
  2471
                                                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
  2472
                                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
  2473
                                        tree_view.expand_row(path, False)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2474
                                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
  2475
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2476
        @staticmethod
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2477
        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
  2478
                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
  2479
                if not value:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2480
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2481
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2482
                try:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2483
                        value = re.sub(REGEX_STRIP_MARKUP, "", value)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2484
                        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
  2485
                        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
  2486
                except (TypeError, re.error):
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
                return match is None
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2490
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2491
        def __in_recent_searches(self, path):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2492
                if not path or len(path) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2493
                        return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2494
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2495
                if model == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2496
                        return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2497
                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
  2498
                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
  2499
                        return True
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
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2502
        def __save_expanded_path(self, path, expanded):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2503
                if not path or len(path) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2504
                        return                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2505
                self.category_expanded_paths[(self.last_visible_publisher, path)] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2506
                        expanded
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2507
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2508
        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
  2509
                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
  2510
                        self.__in_recent_searches(path):
1539
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_active_paths[self.last_visible_publisher] = path
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2513
                self.saved_section_active = path[0]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2514
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2515
        def __on_category_selection_changed(self, selection, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2516
                '''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
  2517
                if self.in_setup:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2518
                        return
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  2519
                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
  2520
                if not itr:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2521
                        return
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2522
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2523
                path = model.get_path(itr)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2524
                sel_category = model[path]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2525
                if sel_category[enumerations.CATEGORY_ID] == RECENT_SEARCH_ID:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2526
                        if not self.adding_recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2527
                                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
  2528
                                if not self.is_all_publishers_search:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2529
                                        self.__save_setup_before_search(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2530
                                            single_search=True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2531
                                self.in_search_mode = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2532
                                self.in_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2533
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2534
                                self.__set_main_view_package_list()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2535
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2536
                elif sel_category[enumerations.CATEGORY_ID] > RECENT_SEARCH_ID:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2537
                        self.__restore_recent_search(sel_category)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2538
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2539
                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
  2540
                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
  2541
                        #Required for A11Y support because focus event not triggered
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2542
                        #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
  2543
                        self.__unset_search(True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2544
                        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
  2545
                        return
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2546
                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
  2547
                        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
  2548
                            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
  2549
                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
  2550
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  2551
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2552
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2553
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2554
        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
  2555
            keyboard_mode, tooltip):
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2556
                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
  2557
                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
  2558
                if not info:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2559
                        return False
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2560
                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
  2561
                    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
  2562
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2563
        @staticmethod
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2564
        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
  2565
                tip = ""
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2566
                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
  2567
                        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
  2568
                        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
  2569
                                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
  2570
                        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
  2571
                        if row:
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2572
                                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
  2573
                                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
  2574
                                        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
  2575
                                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
  2576
                                        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
  2577
                                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
  2578
                                        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
  2579
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2580
                if tip != "":
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2581
                        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
  2582
                        tooltip.set_text(tip)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2583
                        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
  2584
                else:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2585
                        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
  2586
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
  2587
        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
  2588
                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
  2589
                        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
  2590
                        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
  2591
                                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
  2592
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
  2593
                        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
  2594
                                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
  2595
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
                        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
  2597
                        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
  2598
                                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
  2599
                        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
  2600
                        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
  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
                        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
  2603
                        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
  2604
                        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
  2605
                        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
  2606
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
                        #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
  2608
                        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
  2609
                        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
  2610
                            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
  2611
                        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
  2612
                        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
  2613
                        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
  2614
                        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
  2615
                        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
  2616
                            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
  2617
                            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
  2618
                        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
  2619
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
                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
  2621
                        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
  2622
                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
  2623
                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
  2624
                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
  2625
                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
  2626
                        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
  2627
                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
  2628
                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
  2629
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
                #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
  2631
                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
  2632
                        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
  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
                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
  2635
                        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
  2636
                        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
  2637
                        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
  2638
                        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
  2639
                            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
  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
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
        @staticmethod
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2643
        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
  2644
                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
  2645
                if not value:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2646
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2647
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2648
                value = value.lower()
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2649
                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
  2650
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  2651
        @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
  2652
        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
  2653
                #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
  2654
                #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
  2655
                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
  2656
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
  2657
                #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
  2658
                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
  2659
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2660
        def __on_filtercombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2661
                '''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
  2662
                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
  2663
                        return
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2664
                active = self.w_filter_combobox.get_active()
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2665
                if active != enumerations.FILTER_SELECTED:
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2666
                        self.saved_filter_combobox_active = active
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2667
                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
  2668
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2669
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2670
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2671
        def __unset_search(self, same_repo):
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2672
                self.w_infosearch_frame.hide()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2673
                self.__update_tooltips()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2674
                self.in_search_mode = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2675
                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
  2676
                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
  2677
                if same_repo:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2678
                        self.__restore_setup_for_browse()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2679
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2680
        def __on_repositorycombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2681
                '''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
  2682
                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
  2683
                        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
  2684
                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
  2685
                        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
  2686
                                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
  2687
                        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
  2688
                        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
  2689
                        if self.in_setup:
c6980ed4c49b 12710 Package Manager hangs after clicking on category
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1501
diff changeset
  2690
                                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
  2691
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2692
                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
  2693
                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
  2694
                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
  2695
                        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
  2696
                                return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2697
                        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
  2698
                                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
  2699
                                    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
  2700
                                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
  2701
                                return
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2702
                        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
  2703
                        self.__unset_search(same_repo)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2704
                        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
  2705
                                self.__set_searchentry_to_prompt()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2706
                                return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2707
                        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
  2708
                        selected_publisher = self.__get_selected_publisher()
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2709
                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
  2710
                        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
  2711
                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
  2712
                        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
  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
                        
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2715
                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
  2716
                        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
  2717
                            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
  2718
                        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
  2719
                        self.__on_file_add_publisher(None)
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  2720
                        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
  2721
                self.is_all_publishers = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2722
                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
  2723
                        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
  2724
                        self.is_all_publishers_installed = True
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2725
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2726
                        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
  2727
                        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
  2728
                                self.is_all_publishers = True
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2729
1574
3bb7e6bc5ce4 13216 PM main list not being updated from All Publisher modes
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1573
diff changeset
  2730
                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
  2731
3bb7e6bc5ce4 13216 PM main list not being updated from All Publisher modes
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1573
diff changeset
  2732
        def __do_set_publisher(self):
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2733
                self.cancelled = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2734
                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
  2735
                self.set_busy_cursor()
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  2736
                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
  2737
                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
  2738
                        self.__unset_search(False)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2739
1574
3bb7e6bc5ce4 13216 PM main list not being updated from All Publisher modes
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1573
diff changeset
  2740
                pub = [self.__get_selected_publisher(), ]
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2741
                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
  2742
                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
  2743
                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
  2744
                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
  2745
                self.__set_main_view_package_list()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2746
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2747
        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
  2748
                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
  2749
                if pub_iter == None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2750
                        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
  2751
                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
  2752
                            enumerations.REPOSITORY_PREFIX)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2753
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
  2754
        def __setup_publisher(self, publishers):
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2755
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  2756
                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
  2757
                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
  2758
                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
  2759
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2760
        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
  2761
                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
  2762
                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
  2763
                    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
  2764
                self.__unset_saved()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2765
                self.publisher_changed = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2766
                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
  2767
                self.saved_repository_combobox_active = \
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2768
                        self.w_repository_combobox.get_active()
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  2769
                gobject.idle_add(self.__init_tree_views, application_list,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  2770
                    category_list, section_list)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2771
1203
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  2772
        def __unset_saved(self):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2773
                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
  2774
                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
  2775
                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
  2776
                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
  2777
                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
  2778
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
  2779
        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
  2780
                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
  2781
                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
  2782
                    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
  2783
                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
  2784
                        self.__do_refresh()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2785
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2786
                        self.__do_refresh(pubs=[pub])
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2787
1675
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2788
        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
  2789
                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
  2790
                try:
1612
5494c7899186 13408 Refresh not updating status after in PM after separate p5i webinstall
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1610
diff changeset
  2791
                        self.api_o.reset()
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2792
                        self.api_o.refresh(pubs=pubs, immediate=immediate)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2793
                        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
  2794
                except api_errors.CatalogRefreshException, cre:
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
                        crerr = gui_misc.get_catalogrefresh_exception_msg(cre)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2796
                        logger.error(crerr)
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  2797
                        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
  2798
                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
  2799
                        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
  2800
                        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
  2801
                        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
  2802
                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
  2803
                        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
  2804
                        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
  2805
                        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
  2806
                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
  2807
                        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
  2808
                                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
  2809
                        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
  2810
                        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
  2811
                            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
  2812
                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
  2813
                        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
  2814
                        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
  2815
                            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
  2816
                except Exception, ex:
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2817
                        err = str(ex)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2818
                        gobject.idle_add(self.error_occurred, err,
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2819
                            None, gtk.MESSAGE_INFO)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  2820
                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
  2821
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
  2822
        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
  2823
                application_list = self.__get_new_application_liststore()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2824
                category_list = self.__get_new_category_liststore()
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  2825
                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
  2826
                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
  2827
                        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
  2828
                                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
  2829
                        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
  2830
                        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
  2831
                                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
  2832
                                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
  2833
                        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
  2834
                            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
  2835
                        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
  2836
                                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
  2837
                                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
  2838
                        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
  2839
                            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
  2840
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  2841
                return application_list, category_list, section_list
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2842
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2843
        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
  2844
            confirmation_list):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2845
                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
  2846
                        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
  2847
                            pub_name)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2848
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2849
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2850
                                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
  2851
                        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
  2852
                                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
  2853
                                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
  2854
                                    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
  2855
                                        install_update.append(pkg_stem)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2856
                                        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
  2857
                                                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
  2858
                                                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
  2859
                                                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
  2860
                                                    [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
  2861
                                                    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
  2862
                                                    
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
  2863
        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
  2864
                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
  2865
                        self.error_logged = False
4538ffc7c034 13333 PM Provide user notification when errors written to log in GUI.
John Rice <john.rice@sun.com>
parents: 1649
diff changeset
  2866
                        self.w_infosearch_frame.hide()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2867
                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
  2868
                
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2869
        def __on_version_info(self, widget):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2870
                model, itr = self.package_selection.get_selected()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2871
                if itr:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2872
                        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
  2873
                        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
  2874
                        self.set_busy_cursor()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2875
                        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
  2876
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2877
        def check_exiting(self):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2878
                return self.exiting
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2879
          
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2880
        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
  2881
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  2882
                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
  2883
                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
  2884
                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
  2885
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  2886
        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
  2887
                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
  2888
                        return
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2889
                try:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2890
                        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
  2891
                                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
  2892
                except api_errors.ApiException, ex:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2893
                        err = str(ex)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2894
                        logger.error(err)
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2895
                        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
  2896
                        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
  2897
                return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  2898
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  2899
        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
  2900
                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
  2901
                        return False
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2902
                try:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2903
                        self.api_o.reset()
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2904
                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
  2905
                        err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2906
                        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
  2907
                            None, gtk.MESSAGE_INFO)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2908
                        return False
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2909
                return True
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  2910
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2911
        def __on_install_update(self, widget):
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  2912
                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
  2913
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2914
                install_update = []
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2915
                install_confirmation_list = []
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2916
                if self.all_selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2917
                        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
  2918
                                    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
  2919
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
  2920
                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
  2921
                        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
  2922
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  2923
                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
  2924
                    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
  2925
                    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
  2926
                    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
  2927
                    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
  2928
                    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
  2929
                    gconf = self.gconf)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2930
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2931
        def __on_update_all(self, widget):
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  2932
                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
  2933
                        return
2076
e4ab75e15bb4 17003 Traceback when attempting update but no updates available
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2061
diff changeset
  2934
                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
  2935
                    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
  2936
                    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
  2937
                    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
  2938
                    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
  2939
                    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
  2940
                    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
  2941
                    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
  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)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  2944
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2945
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2946
        def __on_help_about(self, widget):
2015
e88d9c13d760 16766 About dialog trace back
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2014
diff changeset
  2947
                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
  2948
                aboutdialog.set_icon(self.window_icon)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2949
                aboutdialog.connect("response", lambda x = None, \
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  2950
                    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
  2951
                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
  2952
                aboutdialog.run()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2953
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2954
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2955
        def __on_help_help(widget):
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2956
                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
  2957
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2958
        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
  2959
                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
  2960
                        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
  2961
                            pub_name)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2962
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2963
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2964
                                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
  2965
                        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
  2966
                                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
  2967
                                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
  2968
                                    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
  2969
                                        remove_list.append(pkg_stem)
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  2970
                                        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
  2971
                                                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
  2972
                                                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
  2973
                                                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
  2974
                                                    [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
  2975
                                                    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
  2976
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2977
        def __on_remove(self, widget):
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  2978
                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
  2979
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2980
                remove_list = []
2041
ee746d3c19be 6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents: 2018
diff changeset
  2981
                remove_confirmation_list = []
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2982
                if self.all_selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2983
                        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
  2984
                            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
  2985
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
  2986
                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
  2987
                        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
  2988
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  2989
                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
  2990
                    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
  2991
                    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
  2992
                    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
  2993
                    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
  2994
                    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
  2995
                    gconf = self.gconf)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2996
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2997
        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
  2998
                self.force_reload_packages = 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
  2999
                self.__do_reload(widget)
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
  3000
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
  3001
        def __do_reload(self, widget):
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
  3002
                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
  3003
                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
  3004
                    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
  3005
                        self.__unset_search(False)
947
181d3c7a54ee 6635 Need support Search across All Repositories (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 944
diff changeset
  3006
                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
  3007
                self.in_setup = True
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3008
                self.last_visible_publisher = None
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3009
                self.set_busy_cursor()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3010
                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
  3011
                self.update_statusbar_message(status_str)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3012
                Thread(target = self.__catalog_refresh).start()
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3013
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3014
        def __catalog_refresh(self):
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3015
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  3016
                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
  3017
                self.__catalog_refresh_without_lock()
1966
dd38788677ea 16380 Upgrade failed with error: cannot release un-aquired lock
John Rice <john.rice@oracle.com>
parents: 1931
diff changeset
  3018
                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
  3019
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3020
        def __catalog_refresh_without_lock(self):
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3021
                """Update image's catalogs."""
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3022
                success = self.__do_refresh(immediate=True)
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  3023
                if not success:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  3024
                        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
  3025
                        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
  3026
                        return -1
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3027
                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
  3028
                self.__catalog_refresh_done()
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3029
                return 0
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3030
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3031
        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
  3032
                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
  3033
                        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
  3034
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3035
        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
  3036
                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
  3037
                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
  3038
                        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
  3039
                            index)
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3040
                        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
  3041
                            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
  3042
                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
  3043
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3044
        def __shutdown_part1(self):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3045
                self.cancelled = True
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3046
                self.exiting = True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3047
                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
  3048
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3049
                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
  3050
                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
  3051
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3052
        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
  3053
                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
  3054
                        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
  3055
                gui_misc.exit_if_no_threads()
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3056
                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
  3057
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3058
        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
  3059
                '''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
  3060
                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
  3061
                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
  3062
                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
  3063
                
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3064
                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
  3065
                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
  3066
                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
  3067
                width = height = hpos = vpos = -1
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3068
                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
  3069
                        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
  3070
                                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
  3071
                                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
  3072
                        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
  3073
                            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
  3074
                                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
  3075
                                    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
  3076
                        else:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3077
                                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
  3078
                        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
  3079
                                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
  3080
                        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
  3081
                        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
  3082
                        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
  3083
                        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
  3084
                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
  3085
                        # 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
  3086
                        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
                        start_insearch = True
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3088
                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
  3089
                    hpos, vpos)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3090
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3091
                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
  3092
                        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
  3093
                            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
  3094
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3095
                if len(self.search_completion) > 0:
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3096
                        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
  3097
                            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
  3098
                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
  3099
                        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
  3100
                                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
  3101
                                    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
  3102
                        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
  3103
                                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
  3104
                                    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
  3105
                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
  3106
                        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
  3107
                        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
  3108
1649
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  3109
                self.__shutdown_part2()
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3110
                return True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3111
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3112
        def __check_if_something_was_changed(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3113
                ''' 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
  3114
                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
  3115
                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
  3116
                        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
  3117
                                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
  3118
                                        return True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3119
                return False
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3120
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
  3121
        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
  3122
                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
  3123
                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
  3124
                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
  3125
                        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
  3126
                        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
  3127
                                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
  3128
                                    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
  3129
                                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
  3130
                                   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
  3131
                                   enumerations.REPOSITORY_PREFIX)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3132
                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
  3133
                self.repositories_list = self.__get_new_repositories_liststore()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3134
                default_pub = api_o.get_preferred_publisher().prefix
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3135
                if self.default_publisher != default_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3136
                        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
  3137
                        self.default_publisher = default_pub
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3138
                selected_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3139
                enabled_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3140
                for repo in self.selected_pkgs:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3141
                        selected_repos.append(repo)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3142
                i = 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3143
                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
  3144
                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
  3145
                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
  3146
                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
  3147
                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
  3148
                        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
  3149
                        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
  3150
                                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
  3151
                        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
  3152
                        prefix = pub.prefix
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3153
                        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
  3154
                                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
  3155
                        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
  3156
                                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
  3157
                        else:
36542108f3a7 14003 PM Publisher alias is not visible in the Publisher dropdown
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1692
diff changeset
  3158
                                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
  3159
                        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
  3160
                        if cmp(prefix, self.default_publisher) == 0:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3161
                                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
  3162
                        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
  3163
                        enabled_repos.append(prefix)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3164
                        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
  3165
                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
  3166
                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
  3167
                    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
  3168
                    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
  3169
                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
  3170
                self.repositories_list.append([-1, "", None, None, ])
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3171
                i = i + 1
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3172
                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
  3173
                #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
  3174
                #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
  3175
                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
  3176
                        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
  3177
                            [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
  3178
                            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
  3179
                            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
  3180
                            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
  3181
                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
  3182
                        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
  3183
                            [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
  3184
                            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
  3185
                            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
  3186
                            None, ])
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3187
                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
  3188
                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
  3189
                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
  3190
                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
  3191
                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
  3192
                    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
  3193
                    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
  3194
                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
  3195
                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
  3196
                i = i + 1
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3197
                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
  3198
                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
  3199
                    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
  3200
                    self.publisher_options[PUBLISHER_ADD], None, ])
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3201
                pkgs_to_remove = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3202
                for repo_name in selected_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3203
                        if repo_name not in enabled_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3204
                                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
  3205
                                for pkg_stem in pkg_stems:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3206
                                        pkgs_to_remove.append(pkg_stem)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3207
                for pkg_stem in pkgs_to_remove:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3208
                        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
  3209
                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
  3210
                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
  3211
                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
  3212
                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
  3213
                        # 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
  3214
                        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
  3215
                            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
  3216
                        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
  3217
                        
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3218
                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
  3219
                        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
  3220
                                if (repo[enumerations.REPOSITORY_PREFIX] == \
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3221
                                    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
  3222
                                    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
  3223
                                        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
  3224
                                           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
  3225
                                        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
  3226
                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
  3227
                        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
  3228
                                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
  3229
                                    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
  3230
                                    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
  3231
                                        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
  3232
                                           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
  3233
                                        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
  3234
                                            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
  3235
                                            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
  3236
                                                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
  3237
                                        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
  3238
                        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
  3239
                                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
  3240
                                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
  3241
                                        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
  3242
                                            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
  3243
                                                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
  3244
                                                   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
  3245
                                                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
  3246
                                # 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
  3247
                                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
  3248
                                        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
  3249
                                        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
  3250
                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
  3251
                        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
  3252
                elif self.default_publisher:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3253
                        self.w_repository_combobox.set_active(active)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3254
                else:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3255
                        self.w_repository_combobox.set_active(0)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3256
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3257
        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
  3258
                '''Toggle function for column enumerations.MARK_COLUMN'''
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3259
                applicationModel = model_sort.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3260
                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
  3261
                filterModel = applicationModel.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3262
                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
  3263
                itr = filterModel.get_iter(child_path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3264
                if itr:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3265
                        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
  3266
                        filterModel.set_value(itr, enumerations.MARK_COLUMN,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3267
                            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
  3268
                        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
  3269
                            enumerations.STATUS_COLUMN)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3270
                        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
  3271
                        if modified:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3272
                                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
  3273
                        else:
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3274
                                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
  3275
                                    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
  3276
                                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
  3277
                                    enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3278
                                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
  3279
                                    enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3280
                                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
  3281
                                    pkg_status, pkg_publisher, pkg_description)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3282
                        self.update_statusbar()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3283
                        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
  3284
                        self.__enable_disable_install_remove()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3285
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
  3286
        def __update_menu_items(self):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3287
                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
  3288
                        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
  3289
                        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
  3290
                        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
  3291
                        self.w_updateall_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3292
                else:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3293
                        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
  3294
                        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
  3295
                        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
  3296
                        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
  3297
                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
  3298
                        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
  3299
                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
  3300
                        self.w_be_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3301
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3302
        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
  3303
                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
  3304
                        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
  3305
                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
  3306
                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
  3307
                    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
  3308
                        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
  3309
                                self.to_install_update[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3310
                        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
  3311
                                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
  3312
                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
  3313
                    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
  3314
                        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
  3315
                                self.to_remove[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3316
                        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
  3317
                                self.to_remove[pub] += 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3318
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3319
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3320
        def __update_tooltips(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3321
                to_remove = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3322
                to_install = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3323
                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
  3324
                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
  3325
                        packages = self.to_remove.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3326
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3327
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3328
                                        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
  3329
                                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
  3330
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3331
                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
  3332
                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
  3333
                        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
  3334
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3335
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3336
                                        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
  3337
                                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
  3338
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3339
                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
  3340
                        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
  3341
                            "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
  3342
                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
  3343
                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
  3344
                        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
  3345
                            "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
  3346
                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
  3347
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3348
        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
  3349
                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
  3350
                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
  3351
                        pkgs = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3352
                        status = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3353
                        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
  3354
                                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
  3355
                        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
  3356
                            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
  3357
                                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
  3358
                                        self.to_install_update[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3359
                                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
  3360
                                        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
  3361
                        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
  3362
                            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
  3363
                                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
  3364
                                        self.to_remove[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3365
                                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
  3366
                                        self.to_remove[pub] -= 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3367
                        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
  3368
                                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
  3369
                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
  3370
                        self.selected_pkgs.pop(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3371
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3372
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3373
        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
  3374
                # 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
  3375
                # 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
  3376
                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
  3377
                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
  3378
                        stems = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3379
                        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
  3380
                                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
  3381
                for pkg_stem in remove_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3382
                        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
  3383
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3384
        def __set_empty_details_panel(self):
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3385
                if self.show_info_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3386
                        gobject.source_remove(self.show_info_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3387
                        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
  3388
                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
  3389
                        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
  3390
                        self.show_dependencies_id = 0
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3391
                if self.show_licenses_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3392
                        gobject.source_remove(self.show_licenses_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3393
                        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
  3394
                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
  3395
                        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
  3396
                        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
  3397
                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
  3398
                self.dependencies_pkgstem = None
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3399
                self.license_pkgstem = None
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3400
                self.versions_pkgstem = None
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3401
                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
  3402
1931
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3403
        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
  3404
                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
  3405
                        return
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3406
                self.versions_pkgstem = pkgstem
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3407
                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
  3408
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3409
        def __show_versions(self):
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3410
                self.show_versions_id = 0
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3411
                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
  3412
                        return
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3413
                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
  3414
                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
  3415
                    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
  3416
                    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
  3417
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3418
        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
  3419
            selected_pkgstem, versions_id):
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3420
                self.api_lock.acquire()
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3421
                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
  3422
                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
  3423
                    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
  3424
                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
  3425
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3426
        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
  3427
            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
  3428
                if debug:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3429
                        a = time.time()
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3430
                # Get versions for package
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3431
                try:
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3432
                        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
  3433
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3434
                        try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3435
                                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
  3436
                                    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
  3437
                                    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
  3438
                                    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
  3439
                        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
  3440
                                err = str(apiex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3441
                                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
  3442
                                    _('Unexpected Error'))
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3443
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3444
                        try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3445
                                versions = []
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3446
                                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
  3447
                                        states = entry[3]
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3448
                                        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
  3449
                                        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
  3450
                                if debug:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3451
                                        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
  3452
                        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
  3453
                                err = str(tpex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3454
                                logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3455
                                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
  3456
                        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
  3457
                                err = str(apiex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3458
                                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
  3459
                                    _('Unexpected Error'))
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.__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
  3461
                            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
  3462
                finally:
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3463
                        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
  3464
d8b01ffa3ce1 16122 Speed up getting license info
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1930
diff changeset
  3465
        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
  3466
                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
  3467
                        return
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3468
                self.license_pkgstem = pkgstem
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3469
                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
  3470
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3471
        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
  3472
                self.show_licenses_id = 0
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3473
                if self.selected_pkgstem == None:
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3474
                        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
  3475
                            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
  3476
                        return
1982
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.set_busy_cursor)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3478
                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
  3479
                    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
  3480
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3481
        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
  3482
                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
  3483
                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
  3484
                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
  3485
                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
  3486
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3487
        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
  3488
                try:
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3489
                        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
  3490
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3491
                        info = None
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3492
                        try:
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3493
                                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
  3494
                                    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
  3495
                        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
  3496
                                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
  3497
                                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
  3498
                                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
  3499
                        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
  3500
                                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
  3501
                                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
  3502
                                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
  3503
                        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
  3504
                                err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3505
                                logger.error(err)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3506
                                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
  3507
                        except Exception, ex:
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3508
                                err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  3509
                                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
  3510
                        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
  3511
                            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
  3512
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3513
                        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
  3514
                                try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3515
                                # 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
  3516
                                        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
  3517
                                            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
  3518
                                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
  3519
                                        err = str(tpex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3520
                                        logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3521
                                        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
  3522
                                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
  3523
                                        err = str(idex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3524
                                        logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3525
                                        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
  3526
                                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
  3527
                                        err = str(ex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3528
                                        logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3529
                                        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
  3530
                                except Exception, ex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3531
                                        err = str(ex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3532
                                        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
  3533
                        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
  3534
                            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
  3535
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3536
                        pkgs_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3537
                        package_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3538
                        no_licenses = 0
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3539
                        if info:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3540
                                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
  3541
                        if pkgs_info:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3542
                                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
  3543
                        if package_info:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3544
                                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
  3545
                        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
  3546
                                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
  3547
                                    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
  3548
                                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3549
                        else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3550
                                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
  3551
                                    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
  3552
                finally:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3553
                        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
  3554
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3555
        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
  3556
            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
  3557
                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
  3558
                    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
  3559
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3560
                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
  3561
                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
  3562
                    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
  3563
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3564
        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
  3565
                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
  3566
                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
  3567
                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
  3568
                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
  3569
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3570
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3571
                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
  3572
                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
  3573
                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
  3574
                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
  3575
                    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
  3576
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3577
        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
  3578
                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
  3579
                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
  3580
                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
  3581
                    dependencies_id)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3582
                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
  3583
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3584
        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
  3585
            dependencies_id):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3586
                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
  3587
                    self.last_show_dependencies_id):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3588
                        return
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3589
                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
  3590
                    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
  3591
                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
  3592
                        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
  3593
                        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
  3594
                        return
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
                if local_info:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3597
                        info = local_info
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3598
                else:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3599
                        info = remote_info
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3600
                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
  3601
                        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
  3602
                        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
  3603
                        return
1982
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3604
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3605
                dep_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3606
                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
  3607
                try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3608
                        try:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3609
                                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
  3610
                                    info.dependencies,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3611
                                    False,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3612
                                    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
  3613
                                    api.PackageInfo.IDENTITY]))
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3614
                                temp_info = []
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3615
                                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
  3616
                                        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
  3617
                                            depend)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3618
                                        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
  3619
                                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
  3620
                                    temp_info,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3621
                                    True,
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3622
                                    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
  3623
                                    api.PackageInfo.IDENTITY]))
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3624
                        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
  3625
                                err = str(tpex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3626
                                logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3627
                                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
  3628
                        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
  3629
                                idex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3630
                                err = str(idex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3631
                                logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3632
                                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
  3633
                        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
  3634
                                err = str(ex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3635
                                logger.error(err)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3636
                                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
  3637
                        except Exception, ex:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3638
                                err = str(ex)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3639
                                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
  3640
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3641
                        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
  3642
                            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
  3643
                finally:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3644
                        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
  3645
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3646
                return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3647
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3648
        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
  3649
                local_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3650
                remote_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3651
                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
  3652
                    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
  3653
                    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
  3654
                    api.PackageInfo.UPGRADABLE):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3655
                        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
  3656
                            True)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3657
                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
  3658
                    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
  3659
                    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
  3660
                    api.PackageInfo.UPGRADABLE):
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3661
                        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
  3662
                            False)
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3663
                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
  3664
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3665
        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
  3666
            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
  3667
                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
  3668
                    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
  3669
                        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
  3670
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3671
                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
  3672
                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
  3673
                    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
  3674
                    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
  3675
                    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
  3676
                    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
  3677
                    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
  3678
                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
  3679
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3680
        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
  3681
                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
  3682
                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
  3683
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3684
                if not (model and path):
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3685
                        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
  3686
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3687
                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
  3688
                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
  3689
                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
  3690
                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
  3691
                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
  3692
                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
  3693
                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
  3694
                    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
  3695
                        pkg_renamed)).start()
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  3696
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
  3697
        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
  3698
            pkg_renamed):
1866
4caf926dc8e0 14944 Threading Issue in Package Manager
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1865
diff changeset
  3699
                self.api_lock.acquire()
1870
738ed9a4893b 15713 Thread Lock and set_busy_cursor
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1869
diff changeset
  3700
                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
  3701
                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
  3702
                    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
  3703
                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
  3704
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
  3705
        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
  3706
            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
  3707
                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
  3708
                        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
  3709
                        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
  3710
                        return
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3711
                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
  3712
                    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
  3713
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3714
                renamed_info = None
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3715
                if pkg_renamed:
2f10a07d7fad 16487 Package/Update Manager really likes to fetch details
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1981
diff changeset
  3716
                        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
  3717
                                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
  3718
                                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
  3719
                        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
  3720
                                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
  3721
                                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
  3722
                else:
bfd9d7ed1ff1 16650 Renamed package not displayed for x11/clients on build 143
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2001
diff changeset
  3723
                        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
  3724
                                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
  3725
                                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
  3726
                                        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
  3727
                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
  3728
                    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
  3729
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3730
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3731
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
  3732
        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
  3733
                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
  3734
                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
  3735
                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
  3736
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3737
                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
  3738
                        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
  3739
                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
  3740
                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
  3741
                        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
  3742
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3743
                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
  3744
                    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
  3745
                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
  3746
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3747
                # Top level Section has been selected
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3748
                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
  3749
                        selected_section = selected_category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3750
                        return selected_section, 0
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3751
                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
  3752
                        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
  3753
                        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
  3754
                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
  3755
                        # 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
  3756
                        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
  3757
                        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
  3758
                                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
  3759
                        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
  3760
                            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
  3761
                        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
  3762
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3763
        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
  3764
                '''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
  3765
                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
  3766
                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
  3767
                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
  3768
                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
  3769
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  3770
                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
  3771
                        return category
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  3772
                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
  3773
                if filter_id == enumerations.FILTER_SELECTED:
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  3774
                        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
  3775
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3776
                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
  3777
                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
                        self.__get_active_section_and_category()
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3779
                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3780
                in_recent_search = False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3781
                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
  3782
                        #Clicked on All Categories
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3783
                        category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3784
                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
  3785
                        #Clicked on subcategory
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3786
                        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
  3787
                                category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3788
                elif category_list:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3789
                        #Clicked on Top Level section                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3790
                        if selected_section < RECENT_SEARCH_ID_OFFSET:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3791
                                categories_in_section = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3792
                                        self.section_categories_list[selected_section]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3793
                                for cat_id in category_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3794
                                        if cat_id in categories_in_section:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3795
                                                category = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3796
                                                break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3797
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3798
                                in_recent_search = True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3799
                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
  3800
                        return False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3801
                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
  3802
                        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
  3803
                return (category &
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3804
                    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
  3805
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3806
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3807
        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
  3808
                '''Function for filtercombobox'''
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3809
                if filter_id == enumerations.FILTER_ALL:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3810
                        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
  3811
                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
  3812
                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
  3813
                        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
  3814
                            api.PackageInfo.UPGRADABLE)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3815
                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
  3816
                        return status == api.PackageInfo.UPGRADABLE
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3817
                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
  3818
                        return status == api.PackageInfo.KNOWN
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3819
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3820
        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
  3821
                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
  3822
                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3823
                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
  3824
                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
  3825
                        self.unset_busy_cursor()
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  3826
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3827
        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
  3828
                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
  3829
                        return
1988
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  3830
                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
  3831
                        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
  3832
                        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
  3833
                        return
a2a05bab8723 16462 Select All/Deselect All menus are in incorrect status
John Rice <john.rice@oracle.com>
parents: 1982
diff changeset
  3834
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3835
                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
  3836
                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
  3837
                        for row in model:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3838
                                if not row[enumerations.MARK_COLUMN]:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3839
                                        self.w_selectall_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3840
                                        return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3841
                        self.w_selectall_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3842
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3843
                        self.w_selectall_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3844
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3845
        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
  3846
                self.__enable_disable_export_selections()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3847
                if not self.user_rights:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3848
                        self.w_installupdate_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3849
                        self.w_installupdate_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3850
                        self.w_remove_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3851
                        self.w_remove_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3852
                        return
1413
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  3853
                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
  3854
                self.__enable_if_selected_for_install_update()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3855
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3856
        def __enable_if_selected_for_removal(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3857
                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
  3858
                selected = 0
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3859
                for pub in self.to_remove:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3860
                        selected = self.to_remove.get(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3861
                        if selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3862
                                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
  3863
                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
  3864
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3865
                self.w_remove_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3866
                self.w_remove_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3867
                return sensitive
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3868
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3869
        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
  3870
                sensitive = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3871
                selected = 0
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3872
                for pub in self.to_install_update:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3873
                        selected = self.to_install_update.get(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3874
                        if selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3875
                                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
  3876
                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
  3877
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3878
                self.w_installupdate_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3879
                self.w_installupdate_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3880
                return sensitive
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3881
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3882
        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
  3883
                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
  3884
                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
  3885
                        return
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3886
                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
  3887
                        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
  3888
                                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
  3889
                                        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
  3890
                                            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
  3891
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3892
                self.w_selectupdates_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3893
                return
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3894
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3895
        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
  3896
                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
  3897
                        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
  3898
                else:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3899
                        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
  3900
                return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3901
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3902
        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
  3903
                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
  3904
                        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
  3905
                                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
  3906
                                        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
  3907
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3908
                self.w_deselect_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3909
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3910
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
  3911
        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
  3912
            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
  3913
                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
  3914
                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
  3915
                status_str = _("Loading package list")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3916
                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
  3917
                try:
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3918
                        if self.is_all_publishers_installed:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3919
                                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
  3920
                                    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
  3921
                        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
  3922
                                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
  3923
                                    pkg_list = api.ImageInterface.LIST_INSTALLED_NEWEST)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3924
                        else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3925
                                pubs.append(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3926
                                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
  3927
                                    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
  3928
                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
  3929
                        # 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
  3930
                        # 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
  3931
                        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
  3932
                        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
  3933
                            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
  3934
                        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
  3935
                except api_errors.ApiException, apiex:
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3936
                        err = str(apiex)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3937
                        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
  3938
                        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
  3939
                try:    
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3940
                        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
  3941
                            category_list, section_list)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3942
                except api_errors.TransportError, tpex:
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3943
                        err = str(tpex)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3944
                        logger.error(err)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3945
                        gui_misc.notify_log_error(self)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3946
                except api_errors.ApiException, apiex:
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3947
                        err = str(apiex)
0de33e1c6f5c 13736 package manager hangs indefinitely with python exception
John Rice <john.rice@sun.com>
parents: 1668
diff changeset
  3948
                        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
  3949
                        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
  3950
                        
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
  3951
        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
  3952
                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
  3953
                #ImageInfo for categories
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3954
                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
  3955
                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
  3956
                        "usr/share/lib/pkg")
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3957
                if len(pubs) == 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3958
                        section = sectioninfo.read(os.path.join(share_path,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3959
                                    "opensolaris.org.sections"))
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3960
                        sections["opensolaris.org"] = section
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3961
                        return sections
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3962
                        
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  3963
                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
  3964
                        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
  3965
                                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
  3966
                        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
  3967
                            pub + ".sections"))
701
ba35d1b02c04 4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 697
diff changeset
  3968
                        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
  3969
                                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
  3970
                                    "opensolaris.org.sections"))
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  3971
                        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
  3972
                        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
  3973
                                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
  3974
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
  3975
                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
  3976
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
  3977
        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
  3978
            application_list):
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3979
                status_str = _("Loading package list")
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  3980
                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
  3981
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
  3982
                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
  3983
                    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
  3984
                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
  3985
                    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
  3986
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3987
        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
  3988
                if state == api.PackageInfo.UPGRADABLE:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3989
                        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
  3990
                elif state == api.PackageInfo.INSTALLED:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3991
                        status_icon = self.installed_icon
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3992
                else:
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3993
                        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
  3994
                return status_icon
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  3995
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
  3996
        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
  3997
            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
  3998
                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
  3999
                        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
  4000
                        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
  4001
                        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
  4002
                        summ = result.summary
1905
c3231bb8d424 15931 PM can not display all selected packages
John Rice <john.rice@sun.com>
parents: 1876
diff changeset
  4003
                        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
  4004
                        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
  4005
                        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
  4006
                        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
  4007
                            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
  4008
                                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
  4009
                                    self.package_names, pkg_name,
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4010
                                    self.special_package_names)
1789
cdb0eb87151a 14660 Empty name displayed in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1772
diff changeset
  4011
                                if len(pkg_name) == 0:
cdb0eb87151a 14660 Empty name displayed in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1772
diff changeset
  4012
                                        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
  4013
                        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
  4014
                        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
  4015
                        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
  4016
                                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
  4017
                                        marked = True
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4018
                        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
  4019
                        #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
  4020
                        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
  4021
                            [
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
  4022
                                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
  4023
                                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
  4024
                                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
  4025
                            ]
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
  4026
                        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
  4027
                        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
  4028
                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
  4029
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
  4030
        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
  4031
            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
  4032
                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
  4033
                        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
  4034
                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
  4035
                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
  4036
                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
  4037
                        a = time.time()
1744
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4038
                self.package_names = {}
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4039
                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
  4040
                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
  4041
                for entry in 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
  4042
                        (pkg_pub, pkg_name, ver), summ, cats, states = entry
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
                        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
  4044
                                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
  4045
                        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
  4046
                        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
  4047
                            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
  4048
                        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
  4049
                        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
  4050
                        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
  4051
                        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
  4052
                        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
  4053
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4054
                                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
  4055
                                        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
  4056
                        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
  4057
                                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
  4058
                                        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
  4059
                                            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
  4060
                        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
  4061
                        #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
  4062
                        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
  4063
                            [
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
                                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
  4065
                                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
  4066
                                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
  4067
                            ]
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
  4068
                        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
  4069
                            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
  4070
                            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
  4071
                            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
  4072
                        pkg_add += 1
1744
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4073
                for pkg in application_list:
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4074
                        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
  4075
                        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
  4076
                            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
  4077
                        if pkg_name != name:
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4078
                                pkg[enumerations.NAME_COLUMN] = name
04532a16c1ac 9437 current multi-part name algorithm is goofy
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1722
diff changeset
  4079
                        
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
  4080
                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
  4081
                        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
  4082
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4083
                        self.__add_categories_to_sections(sections,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4084
                            category_list, section_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4085
                return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4086
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4087
        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
  4088
                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
  4089
                        for section in sections[pub]:
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4090
                                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
  4091
                                    _(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
  4092
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4093
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4094
        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
  4095
            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
  4096
                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
  4097
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4098
                        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
  4099
                for cat in cats:
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4100
                        if len(cat[1]) > 1:
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4101
                                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
  4102
                                    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
  4103
                                    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
  4104
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4105
        @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
  4106
        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
  4107
            application_list, category_list, pkg_name):
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4108
                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
  4109
                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
  4110
                        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
  4111
                            % {"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
  4112
                            "pack": pkg_name}
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4113
                        return
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4114
                category_visible_name = category_names[1]
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4115
                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
  4116
                        return
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4117
                if not category_visible_name:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4118
                        return
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4119
                category_id = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4120
                for category in category_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4121
                        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
  4122
                                category_id = category[enumerations.CATEGORY_ID]
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  4123
                                break
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4124
                if not category_id:                       # Category not exists
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4125
                        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
  4126
                        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
  4127
                            category_visible_name, None, None, True])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4128
                if application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4129
                    enumerations.CATEGORY_LIST_COLUMN):
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4130
                        a = application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4131
                            enumerations.CATEGORY_LIST_COLUMN)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4132
                        a.append(category_id)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4133
                else:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4134
                        category_list = []
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4135
                        category_list.append(category_id)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4136
                        application_list.set(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4137
                            enumerations.CATEGORY_LIST_COLUMN, category_list)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4138
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
  4139
        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
  4140
                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
  4141
                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
  4142
                    _("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
  4143
1406
46c950f90950 11475 The PM category tree includes categories from other publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1405
diff changeset
  4144
                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
  4145
                #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
  4146
                #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
  4147
                #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
  4148
                #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
  4149
                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
  4150
                        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
  4151
                                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
  4152
                        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
  4153
                                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
  4154
                        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
  4155
                                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
  4156
                                        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
  4157
                                                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
  4158
                                        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
  4159
                                                = 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
  4160
                                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
  4161
                                        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
  4162
                                                {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
  4163
                                                    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
  4164
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4165
                #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
  4166
                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
  4167
                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
  4168
                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
  4169
                        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
  4170
                        #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
  4171
                        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
  4172
                                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
  4173
                        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
  4174
                                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
  4175
                        count += count
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4176
                        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
  4177
                        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
  4178
                            [ 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
  4179
                            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
  4180
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
                        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
  4182
                                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
  4183
                        
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_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
  4185
                        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
  4186
                        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
  4187
                                if category_ids[cat_id][
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4188
                                    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
  4189
                                        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
  4190
                        # 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
  4191
                        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
  4192
                                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
  4193
                                    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
  4194
                                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
  4195
                                r = []
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4196
                                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
  4197
                        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
  4198
                                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
  4199
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4200
                recent_search_name = "<span foreground='#757575'><b>" + \
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4201
                    _("Recent Searches") + "</b></span>"
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4202
                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
  4203
                    [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
  4204
                    None, None, True])
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4205
                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
  4206
                        for recent_search in self.recent_searches_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4207
                                category_tree.append(self.recent_searches_cat_iter, 
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4208
                                    self.recent_searches[recent_search])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4209
                
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
  4210
                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
  4211
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4212
                #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
  4213
                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
  4214
                        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
  4215
                        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
  4216
                        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
  4217
                            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
  4218
                        return
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4219
                self.__restore_category_state()
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4220
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
  4221
        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
  4222
            search_all):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4223
                self.adding_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4224
                category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4225
                if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4226
                        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
  4227
                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
  4228
                        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
  4229
                else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4230
                        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
  4231
                            pub_prefix)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4232
                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
  4233
	        	(len(application_list), text, pub_name)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4234
                if not (recent_search in self.recent_searches):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4235
                        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
  4236
                            [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
  4237
                            text, application_list, True])
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4238
                        self.recent_searches[recent_search] = \
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4239
                                [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
  4240
                                 text, application_list, True]
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4241
                        self.recent_searches_list.append(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4242
                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4243
                        rs_iter = category_tree.iter_children(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4244
                            self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4245
                        while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4246
                                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
  4247
                                    enumerations.CATEGORY_VISIBLE_NAME)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4248
                                if rs_value == recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4249
                                        category_tree.remove(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4250
                                        break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4251
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4252
                        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
  4253
                            [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
  4254
                            text, application_list, True])
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4255
                        self.recent_searches_list.remove(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4256
                        self.recent_searches_list.append(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4257
                path = category_tree.get_path(cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4258
                self.w_categories_treeview.expand_to_path(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4259
                self.__unselect_category()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4260
                self.w_categories_treeview.scroll_to_cell(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4261
                self.adding_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4262
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4263
        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
  4264
                self.after_install_remove = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4265
                category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4266
                if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4267
                        return                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4268
                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
  4269
                        return                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4270
                self.__set_searchentry_to_prompt()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4271
                selection, sel_path = self.__get_selection_and_category_path()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4272
                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
  4273
                while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4274
                        category_tree.remove(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4275
                        if category_tree.iter_is_valid(rs_iter):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4276
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4277
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4278
                                break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4279
                del(self.recent_searches_list[:])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4280
                self.recent_searches.clear()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4281
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4282
                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
  4283
                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
  4284
                        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
  4285
                        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
  4286
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4287
        def __update_recent_search_states(self, application_list):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4288
                pkg_stems = []
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4289
                pkg_stem_states = {}
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4290
                for row in application_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4291
                        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
  4292
                #Check for changes in package installation status
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4293
                try:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4294
                        info = self.api_o.info(pkg_stems, True, frozenset(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4295
                                    [api.PackageInfo.STATE, api.PackageInfo.IDENTITY]))
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4296
                        for info_s in info.get(0):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4297
                                pkg_stem = fmri.PkgFmri(info_s.fmri).get_pkg_stem(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4298
                                    include_scheme = True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4299
                                if api.PackageInfo.INSTALLED in info_s.states:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4300
                                        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
  4301
                                                api.PackageInfo.INSTALLED
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4302
                                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4303
                                        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
  4304
                                                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
  4305
                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
  4306
                        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
  4307
                        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
  4308
                        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
  4309
                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
  4310
                        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
  4311
                        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
  4312
                        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
  4313
                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
  4314
                        err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4315
                        logger.error(err)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4316
                        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
  4317
                except Exception, ex:
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4318
                        err = str(ex)
e6721cb76674 14281 packagemanager doesn't catch ApiException when showing info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1721
diff changeset
  4319
                        gobject.idle_add(self.error_occurred, err)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4320
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4321
                #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
  4322
                tmp_app_list = self.__get_new_application_liststore()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4323
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4324
                for row in application_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4325
                        pkg_stem = row[enumerations.STEM_COLUMN]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4326
                        pub = row[enumerations.PUBLISHER_COLUMN]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4327
                        marked = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4328
                        pkgs = None
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4329
                        if self.selected_pkgs != None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4330
                                pkgs = self.selected_pkgs.get(pub)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4331
                        if pkgs != None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4332
                                if pkg_stem in pkgs:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4333
                                        marked = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4334
                        if row[enumerations.MARK_COLUMN] != marked:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4335
                                row[enumerations.MARK_COLUMN] = marked
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4336
                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4337
                        if pkg_stem_states.has_key(pkg_stem):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4338
                                row[enumerations.STATUS_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4339
                                        pkg_stem_states[pkg_stem]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4340
                                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
  4341
                                        api.PackageInfo.KNOWN:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4342
                                        row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4343
                                                self.not_installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4344
                                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4345
                                        row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4346
                                                self.installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4347
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4348
                                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
  4349
                                        api.PackageInfo.KNOWN
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4350
                                row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4351
                                        self.not_installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4352
                        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
  4353
                return tmp_app_list
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4354
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4355
        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
  4356
                if not sel_category:
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4357
                        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
  4358
                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
  4359
                        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
  4360
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4361
                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
  4362
                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
  4363
                if self.after_install_remove:
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4364
                        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
  4365
                            application_list)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4366
                # 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
  4367
                self.__reset_application_list_status_icons(application_list)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4368
                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
  4369
                    unselect_cat=False)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4370
                self.in_search_mode = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4371
                self.in_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4372
                self.__set_search_text_mode(enumerations.SEARCH_STYLE_NORMAL)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4373
                self.w_searchentry.set_text(text)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4374
                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
  4375
                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
  4376
                    enumerations.NAME_COLUMN)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4377
1686
c3ce86de2702 13036 PM Persist expanded and selected Category state for each Publisher
John Rice <john.rice@sun.com>
parents: 1684
diff changeset
  4378
        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
  4379
                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
  4380
                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
  4381
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4382
        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
  4383
                #Restore expanded Category state
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4384
                if self.w_categories_treeview == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4385
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4386
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4387
                if model == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4388
                        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
  4389
                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
  4390
                        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
  4391
                        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
  4392
                                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
  4393
                                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
  4394
                                        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
  4395
                #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
  4396
                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
  4397
                        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
  4398
                        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
  4399
                            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
  4400
                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
  4401
                        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
  4402
                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
  4403
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4404
        @staticmethod
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4405
        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
  4406
            section_list):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4407
                '''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
  4408
                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
  4409
                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
  4410
                if not categories_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4411
                        return
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4412
                for section in section_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4413
                        if section[enumerations.SECTION_NAME] == section_name:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4414
                                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
  4415
                                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
  4416
                                        localized_top_cat = _(category[
1645
12ab28cc9555 13153 Improve Package Manager category support
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1642
diff changeset
  4417
                                            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
  4418
                                        if localized_top_cat == \
2e90e87ac9ed 14152 Subcategory names not show up when localized
John Rice <john.rice@sun.com>
parents: 1686
diff changeset
  4419
                                                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
  4420
                                                
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4421
                                                vis = \
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4422
                                                    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
  4423
                                                category[vis] = _(category[
71499ad14a12 14186 Order of subcategories in Package Manager seems random
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1696
diff changeset
  4424
                                                    enumerations.CATEGORY_VISIBLE_NAME])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4425
                                                section_lst = category[ \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4426
                                                    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
  4427
                                                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
  4428
                                                    True
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4429
                                                if not section_lst:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4430
                                                        category[ \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4431
                                                    enumerations.SECTION_LIST_OBJECT] = \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4432
                                                            [section_id, ]
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4433
                                                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4434
                                                        if not section_name in \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4435
                                                            section_lst:
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4436
                                                                section_lst.append(
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4437
                                                                    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
  4438
                                break
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4439
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4440
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4441
        def __progress_pulse_start(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4442
                if self.progress_stop_thread == True:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4443
                        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
  4444
                        if self.progress_thread_stopped:
b9f69c3999d5 16738 Package Manager displays busy cursor indefinitely
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2013
diff changeset
  4445
                                self.progress_thread_stopped = False
b9f69c3999d5 16738 Package Manager displays busy cursor indefinitely
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2013
diff changeset
  4446
                                Thread(target = self.__progress_pulse).start()
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4447
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4448
        def __progress_pulse_stop(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4449
                self.progress_stop_thread = True
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4450
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4451
        def __progress_pulse(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4452
                gobject.idle_add(self.w_progress_frame.show)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4453
                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
  4454
                        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
  4455
                                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
  4456
                        else:
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  4457
                                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
  4458
                                    False)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4459
                        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
  4460
                        time.sleep(0.1)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4461
                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
  4462
                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
  4463
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4464
        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
  4465
                if msg_title:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4466
                        title = msg_title
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4467
                else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4468
                        title = self.program_title
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4469
                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
  4470
                    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
  4471
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4472
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4473
# Static Methods
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4474
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4475
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4476
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4477
        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
  4478
                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
  4479
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4480
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4481
        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
  4482
                '''Function which sets icon size'''
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4483
                pm, entry = data
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4484
                if entry == enumerations.FILTER_NAME:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4485
                        renderer.set_property("xalign", 0)
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4486
                        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
  4487
                elif entry == enumerations.FILTER_ICON:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4488
                        renderer.set_property("xalign", 0)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4489
                        renderer.set_property("width", 24)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4490
                return
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4491
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4492
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4493
        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
  4494
                '''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
  4495
                selected'''
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4496
                if itr:
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4497
                        # 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
  4498
                        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
  4499
                                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
  4500
                        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
  4501
                                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
  4502
                                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
  4503
                        else:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4504
                                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
  4505
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4506
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4507
        def combobox_id_separator(model, itr):
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  4508
                return model.get_value(itr, 0) == -1 and \
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  4509
                    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
  4510
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4511
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4512
        def combobox_filter_id_separator(model, itr):
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4513
                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
  4514
                    model.get_value(itr, 2) == ""
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4515
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4516
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4517
        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
  4518
                dt = None
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4519
                try:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4520
                        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
  4521
                except AttributeError:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4522
                        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
  4523
                return dt
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4524
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4525
        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
  4526
                version = None
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4527
                try:
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4528
                        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
  4529
                            [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
  4530
                        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
  4531
                        version = found[0]
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4532
                except IndexError:
1761
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4533
                        pass
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4534
                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
  4535
                        err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4536
                        logger.error(err)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4537
                        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
  4538
                except Exception, ex:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4539
                        pass
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4540
                return version
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4541
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4542
#-----------------------------------------------------------------------------#
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4543
# Public Methods
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4544
#-----------------------------------------------------------------------------#
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4545
        def init_show_filter(self):
1995
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4546
                """ Sets up the Filter Combobox size."""
ad651d34933d 14791 Start page colours not accessible
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1988
diff changeset
  4547
                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
  4548
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4549
        def reload_packages(self):
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4550
                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
  4551
                    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
  4552
                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
  4553
                self.force_reload_packages = 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
  4554
                self.__do_reload(None)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4555
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4556
        def update_facets(self, facets_to_set):
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4557
                if facets_to_set == None or \
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4558
                        len(facets_to_set.keys()) == 0:
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4559
                        return
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4560
                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
  4561
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4562
        def __update_facets(self, facets_to_set):
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4563
                installupdate.InstallUpdate([], self,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4564
                    self.image_directory,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4565
                    action = enumerations.UPDATE_FACETS,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4566
                    main_window = self.w_main_window,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4567
                    api_lock = self.api_lock,
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4568
                    facets = facets_to_set)
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4569
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
  4570
        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
  4571
                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
  4572
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4573
        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
  4574
                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
  4575
                        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
  4576
                        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
  4577
                            'busy', True)
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  4578
                if not self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  4579
                        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
  4580
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4581
        def unset_busy_cursor(self):
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4582
                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
  4583
                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
  4584
                        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
  4585
                        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
  4586
                            '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
  4587
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4588
        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
  4589
                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
  4590
                        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
  4591
                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
  4592
                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
  4593
                        self.__update_menu_items()
1450
28b257c5f33e 12266 Wrong focus in package manager on startup
John Rice <john.rice@sun.com>
parents: 1446
diff changeset
  4594
                        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
  4595
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
  4596
        @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
  4597
        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
  4598
                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
  4599
                return cache_o
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  4600
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4601
        def __setup_search_completion(self):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4602
                completion = gtk.EntryCompletion()
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4603
                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
  4604
                completion.set_model(self.search_completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4605
                self.w_searchentry.set_completion(completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4606
                completion.set_text_column(0)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4607
                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
  4608
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4609
        def process_package_list_end(self):
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  4610
                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
  4611
                if self.update_all_proceed:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4612
                        self.__on_update_all(None)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4613
                        self.update_all_proceed = False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4614
                self.__enable_disable_install_remove()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4615
                self.update_statusbar()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4616
                self.in_setup = False
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4617
                self.cancelled = False
1441
45be39b77b70 12097 Selections switching issue
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1440
diff changeset
  4618
                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
  4619
                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
  4620
                need_refilter = True
38b88763703f 15160 Unnecessary refilter of package list
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1862
diff changeset
  4621
                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
  4622
                        need_refilter = False
38b88763703f 15160 Unnecessary refilter of package list
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 1862
diff changeset
  4623
                if need_refilter or active_filter != enumerations.FILTER_ALL:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4624
                        self.__application_refilter()
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4625
                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
  4626
                        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
  4627
                        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
  4628
                        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
  4629
                                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
  4630
                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
  4631
                        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
  4632
                if self.first_run:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4633
                        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
  4634
                                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
  4635
                                    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
  4636
                                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
  4637
                                        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
  4638
                                    ([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
  4639
                                    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
  4640
                                    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
  4641
                                    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
  4642
                                   
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  4643
                        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
  4644
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
  4645
        def __count_selected_packages(self):
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4646
                self.all_selected = 0
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4647
                for pub_name in self.selected_pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4648
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4649
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4650
                                break
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4651
                        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
  4652
 
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4653
        def update_statusbar(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4654
                '''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
  4655
                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
  4656
                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
  4657
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
  4658
                self.__count_selected_packages()
2018
2d45af1f935a 16739 Wrong result when searching
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2017
diff changeset
  4659
                if self.application_list == None:
2d45af1f935a 16739 Wrong result when searching
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2017
diff changeset
  4660
                        return
2d45af1f935a 16739 Wrong result when searching
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2017
diff changeset
  4661
                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
  4662
                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
  4663
                        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
  4664
                        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
  4665
                                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
  4666
                                        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
  4667
                        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
  4668
                                {"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
  4669
                                "selected": selected_in_list}
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4670
                        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
  4671
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4672
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4673
                # 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
  4674
                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
  4675
                        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
  4676
                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
  4677
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4678
                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
  4679
                        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
  4680
                        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
  4681
                        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
  4682
                                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
  4683
                                        _("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
  4684
                                        " 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
  4685
                                        {"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
  4686
                                        "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
  4687
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4688
                                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
  4689
                                        _("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
  4690
                                        "...") % \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4691
                                        {"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
  4692
                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
  4693
                        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
  4694
                                "%(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
  4695
                                "%(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
  4696
                                "%(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
  4697
                                "%(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
  4698
                                {"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
  4699
                                    "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
  4700
                self.update_statusbar_message(status_str)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4701
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4702
        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
  4703
                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
  4704
                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
  4705
                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
  4706
                    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
  4707
                package_installed =  False
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4708
                if package_info:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4709
                        package_installed =  \
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  4710
                            (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
  4711
                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
  4712
                        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
  4713
                            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
  4714
                        if (package_info and
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  4715
                            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
  4716
                                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
  4717
                                    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
  4718
                                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
  4719
                                    self.installed_icon
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4720
                        else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4721
                                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
  4722
                                    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
  4723
                                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
  4724
                                    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
  4725
                else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4726
                        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
  4727
                            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
  4728
                        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
  4729
                            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
  4730
                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
  4731
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
  4732
        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
  4733
                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
  4734
                        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
  4735
                                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
  4736
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  4737
        def update_package_list(self, update_list):
2013
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4738
                ''' 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
  4739
                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
  4740
                removing packages.
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4741
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4742
                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
  4743
                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
  4744
                can update its data.'''
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4745
                if update_list == None:
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4746
                        self.installupdate = None
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4747
                        if self.img_timestamp:
7e157252546e 16657 libglade to GtkBuilder
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2010
diff changeset
  4748
                                return
1622
f14d7c665971 13115 Status changes in recent search results
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1621
diff changeset
  4749
                self.after_install_remove = True
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4750
                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
  4751
                default_publisher = self.default_publisher
1675
8caa149137be 13975 Transport errors should be logged rather than displayed in a dialog
John Rice <john.rice@sun.com>
parents: 1673
diff changeset
  4752
                self.__do_refresh()
1772
91a1e0bebcd3 14609 Unexpected error in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1761
diff changeset
  4753
                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
  4754
                        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
  4755
                        self.__on_reload(None)
91a1e0bebcd3 14609 Unexpected error in Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1761
diff changeset
  4756
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4757
                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
  4758
                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
  4759
                    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
  4760
                        try:
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4761
                                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
  4762
                        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
  4763
                                err = str(ex)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4764
                                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
  4765
                                    None, gtk.MESSAGE_INFO)
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4766
                                return
b2d8237ac690 14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents: 1760
diff changeset
  4767
                        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
  4768
                                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
  4769
                                        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
  4770
                                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
  4771
                                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
  4772
                                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
  4773
                                        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
  4774
                                            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
  4775
                                            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
  4776
                                        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
  4777
                                                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
  4778
                                                        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
  4779
                                                        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
  4780
                        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
  4781
                                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
  4782
                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
  4783
                        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
  4784
                                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
  4785
                        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
  4786
                                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
  4787
                                        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
  4788
                                        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
  4789
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
  4790
                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
  4791
                        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
  4792
                                pkg_list = update_list.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4793
                                for pkg in pkg_list:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4794
                                        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
  4795
                                        if pub != default_publisher:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4796
                                                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
  4797
                                                    pkg, pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4798
                                        else:
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4799
                                                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
  4800
                                                    pkg)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4801
                                        if pkg_stem:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4802
                                                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
  4803
                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
  4804
                        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
  4805
                        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
  4806
                        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
  4807
                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
  4808
                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
  4809
                        return
1343
ed33c7d18988 10904 pkg-manger GUI: inventory exception w/o further information
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1342
diff changeset
  4810
                # 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
  4811
                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
  4812
                self.__reset_info_tabs()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4813
                self.__enable_disable_selection_menus()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4814
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4815
                self.update_statusbar()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4816
1930
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4817
        def install_version(self, version):
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4818
                ''' Installed specified version of selected package'''
2248
ed0aeb87d2e3 16881 Support facets in PM
John Rice <john.rice@oracle.com>
parents: 2223
diff changeset
  4819
                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
  4820
                        return
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4821
                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
  4822
                install_update = [to_install]
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4823
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4824
                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
  4825
                        self.img_timestamp = None
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4826
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4827
                installupdate.InstallUpdate(install_update, self, \
e0ce765651d8 14321 packagemanager should allow version-specific install / update
John Rice <john.rice@sun.com>
parents: 1921
diff changeset
  4828
                    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
  4829
                    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
  4830
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4831
        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
  4832
                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
  4833
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  4834
        def __reset_home_dir(self):
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  4835
                # 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
  4836
                # 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
  4837
                # 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
  4838
                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
  4839
                        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
  4840
                        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
  4841
1028
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4842
        @staticmethod
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4843
        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
  4844
                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
  4845
                 
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4846
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4847
                        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
  4848
                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
  4849
                        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
  4850
                                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
  4851
                        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
  4852
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4853
                        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
  4854
                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
  4855
                        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
  4856
                                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
  4857
                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
  4858
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4859
        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
  4860
                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
  4861
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4862
        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
  4863
                if exit_pm == True:
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4864
                        self.__on_mainwindow_delete_event(None, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4865
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4866
        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
  4867
                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
  4868
                    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
  4869
                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
  4870
                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
  4871
                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
  4872
                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
  4873
                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
  4874
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4875
        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
  4876
                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
  4877
                
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4878
        def get_api_object(self):
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4879
                return self.api_o
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4880
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4881
        def start(self):
2061
7ccedb519372 16938 Unnecessary loading of startpage html
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2052
diff changeset
  4882
                if not self.gconf.show_startpage:
7ccedb519372 16938 Unnecessary loading of startpage html
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2052
diff changeset
  4883
                        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
  4884
                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
  4885
                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
  4886
        
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  4887
        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
  4888
                self.__shutdown_part1()
aab234a49e34 13852 PM needs a global error handler for uncaught exceptions
John Rice <john.rice@sun.com>
parents: 1647
diff changeset
  4889
                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
  4890
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4891
###############################################################################
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4892
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4893
# Main
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4894
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4895
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4896
def main():
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4897
        gtk.main()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4898
        return 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4899
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4900
if __name__ == '__main__':
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4901
        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
  4902
        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
  4903
        allow_links = False
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  4904
        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
  4905
        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
  4906
        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
  4907
        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
  4908
        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
  4909
        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
  4910
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4911
        try:
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  4912
                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
  4913
                    ["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
  4914
                    "info-install="])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4915
        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
  4916
                print "%s, for help use --help" % msg
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4917
                sys.exit(2)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4918
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
  4919
        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
  4920
                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
  4921
        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
  4922
                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
  4923
                app_path = os.path.realpath(cmd)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4924
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4925
        for option, argument in opts:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4926
                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
  4927
                        print """\
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4928
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
  4929
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
  4930
                        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
  4931
                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
  4932
                        allow_links = True
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4933
                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
  4934
                        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
  4935
                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
  4936
                        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
  4937
                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
  4938
                        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
  4939
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4940
        if image_dir == None:
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4941
                try:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4942
                        image_dir = os.environ["PKG_IMAGE"]
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4943
                except KeyError:
2155
de850eb48049 17468 Package Manager cannot start on 153
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2076
diff changeset
  4944
                        image_dir = "/"
1815
02d4bf8c0005 14974 portable.get_userid lulls callers into false sense of security
Shawn Walker <srw@sun.com>
parents: 1804
diff changeset
  4945
1160
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4946
        try:
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4947
                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
  4948
        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
  4949
                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
  4950
                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
  4951
                sys.exit(1)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4952
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4953
        # 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
  4954
        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
  4955
                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
  4956
                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
  4957
                        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
  4958
                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
  4959
                main()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4960
                sys.exit(0)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4961
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4962
        # Setup packagemanager
1860
8281a5185648 14945 packagemanager.py is too big
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1826
diff changeset
  4963
        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
  4964
        gblexcepthandler.set_parent(packagemanager)
2049
9997dbbc5f33 16749 Package Manager seems to start sluggishly
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2041
diff changeset
  4965
9997dbbc5f33 16749 Package Manager seems to start sluggishly
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2041
diff changeset
  4966
        while gtk.events_pending():
9997dbbc5f33 16749 Package Manager seems to start sluggishly
Padraig O'Briain <padraig.obriain@oracle.com>
parents: 2041
diff changeset
  4967
                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
  4968
        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
  4969
        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
  4970
        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
  4971
        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
  4972
        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
  4973
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4974
        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
  4975
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4976
        main()