src/packagemanager.py
author Padraig O'Briain <padraig.obriain@sun.com>
Tue, 10 Nov 2009 14:05:43 +0000
changeset 1479 36a1f409ebfa
parent 1478 1e51eaebc8ee
child 1480 05ad339c1b13
permissions -rw-r--r--
12356 Dependencies tab information is misleading
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     1
#!/usr/bin/python2.4
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     2
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     3
# CDDL HEADER START
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     4
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     8
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    12
# and limitations under the License.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    13
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    19
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    20
# CDDL HEADER END
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    21
#
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
    22
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    23
# Use is subject to license terms.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    24
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    25
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
    26
MAX_INFO_CACHE_LIMIT = 100                # Max number of package descriptions to cache
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    27
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
    28
NOTEBOOK_START_PAGE = 1                   # Main View Start page index
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
    29
INFO_NOTEBOOK_LICENSE_PAGE = 3            # License Tab index
1246
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
    30
PUBLISHER_ADD = 0                         # Index for "Add..." string
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
    31
PUBLISHER_ALL = 1                         # Index for "All Sources" string
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
    32
SHOW_INFO_DELAY = 600       # Delay before showing selected package information
1183
05f2a75fdcdf 9558 Support for typeahead search in Package Manager should be removed
John Rice <john.rice@sun.com>
parents: 1179
diff changeset
    33
SHOW_LICENSE_DELAY = 600    # Delay before showing license information
1074
f6b6a4290aa2 8335 Search All Repositories should match CLI default search behavior
John Rice <john.rice@sun.com>
parents: 1071
diff changeset
    34
SEARCH_STR_FORMAT = "<%s>"
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
    35
MIN_APP_WIDTH = 750                       # Minimum application width
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
    36
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
    37
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
    38
                                          # in category tree
1262
5e0b7212dba6 9520 Package Manager should not call image.get_root
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1261
diff changeset
    39
IMAGE_DIRECTORY_DEFAULT = "/"             # Image default directory
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
    40
PACKAGEMANAGER_PREFERENCES = "/apps/packagemanager/preferences"
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
    41
MAX_SEARCH_COMPLETION_PREFERENCES = \
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
    42
        "/apps/packagemanager/preferences/max_search_completion"
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
    43
INITIAL_APP_WIDTH_PREFERENCES = "/apps/packagemanager/preferences/initial_app_width"
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
    44
INITIAL_APP_HEIGHT_PREFERENCES = "/apps/packagemanager/preferences/initial_app_height"
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
    45
INITIAL_APP_HPOS_PREFERENCES = "/apps/packagemanager/preferences/initial_app_hposition"
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
    46
INITIAL_APP_VPOS_PREFERENCES = "/apps/packagemanager/preferences/initial_app_vposition"
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
    47
INITIAL_SHOW_FILTER_PREFERENCES = "/apps/packagemanager/preferences/initial_show_filter"
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
    48
INITIAL_SECTION_PREFERENCES = "/apps/packagemanager/preferences/initial_section"
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
    49
LAST_EXPORT_SELECTION_PATH = \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
    50
        "/apps/packagemanager/preferences/last_export_selections_path"
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    51
SHOW_STARTPAGE_PREFERENCES = "/apps/packagemanager/preferences/show_startpage"
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
    52
SAVE_STATE_PREFERENCES = "/apps/packagemanager/preferences/save_state"
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
    53
START_INSEARCH_PREFERENCES = "/apps/packagemanager/preferences/start_insearch"
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
    54
LASTSOURCE_PREFERENCES = "/apps/packagemanager/preferences/lastsource"
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
    55
API_SEARCH_ERROR_PREFERENCES = "/apps/packagemanager/preferences/api_search_error"
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
    56
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
    57
SEARCH_TXT_GREY_STYLE = "#757575" #Close to DimGrey
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
    58
SEARCH_TXT_BLACK_STYLE = "#000000"
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
    59
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
    60
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
    61
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    62
PKG_CLIENT_NAME = "packagemanager"
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
    63
CHECK_FOR_UPDATES = "usr/lib/pm-checkforupdates"
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    64
1164
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1160
diff changeset
    65
# 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
    66
ICON_LOCATION = "usr/share/package-manager/icons"
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    67
# Load Start Page from lang dir if available
955
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
    68
START_PAGE_CACHE_LANG_BASE = "var/pkg/gui_cache/startpagebase/%s/%s"
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
    69
START_PAGE_LANG_BASE = "usr/share/package-manager/data/startpagebase/%s/%s"
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    70
START_PAGE_HOME = "startpage.html" # Default page
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    71
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    72
# StartPage Action support for url's on StartPage pages
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    73
PM_ACTION = 'pm-action'          # Action field for StartPage url's
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    74
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    75
# Internal Example: <a href="pm?pm-action=internal&uri=top_picks.html">
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    76
ACTION_INTERNAL = 'internal'   # Internal Action value: pm-action=internal
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    77
INTERNAL_URI = 'uri'           # Internal field: uri to navigate to in StartPage
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    78
                               # without protocol scheme specified
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    79
INTERNAL_SEARCH = 'search'     # Internal field: search support page action
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    80
INTERNAL_SEARCH_VIEW_PUB ="view_pub_packages" # Internal field: view publishers packages
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    81
INTERNAL_SEARCH_VIEW_ALL = "view_all_packages_filter" # Internal field: change to View 
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    82
                                                      # All Packages
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    83
INTERNAL_SEARCH_ALL_PUBS = "search_all_publishers" #Internal field: search all publishers
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    84
INTERNAL_SEARCH_HELP = "search_help" # Internal field: display search help
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    85
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    86
# External Example: <a href="pm?pm-action=external&uri=www.opensolaris.com">
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    87
ACTION_EXTERNAL = 'external'   # External Action value: pm-action=external
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    88
EXTERNAL_URI = 'uri'           # External field: uri to navigate to in external
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    89
                               # default browser without protocol scheme specified
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    90
EXTERNAL_PROTOCOL = 'protocol' # External field: optional protocol scheme,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    91
                               # defaults to http
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    92
DEFAULT_PROTOCOL = 'http'
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    93
INFORMATION_PAGE_HEADER = (
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    94
            "<table border='0' cellpadding='3' style='table-layout:fixed' >"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    95
            "<TR><TD><IMG SRC = 'dialog-information.png' style='border-style: none' "
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    96
            )                  
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    97
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    98
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
    99
import pwd
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   100
import os
1228
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1226
diff changeset
   101
import subprocess
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   102
import sys
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   103
import time
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   104
import locale
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   105
import itertools
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   106
import urllib
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   107
import urlparse
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
   108
import socket
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   109
import gettext
830
687f8a73665e 6019 ctrl-c hangs packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 827
diff changeset
   110
import signal
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
   111
import threading
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   112
import re
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   113
import stat
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   114
import tempfile
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   115
from xml.sax import saxutils
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   116
from threading import Thread
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
   117
from threading import Lock
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
   118
from collections import deque
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
   119
from cPickle import UnpicklingError
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
   120
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
   121
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   122
try:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   123
        import gobject
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   124
        import gnome
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   125
        gobject.threads_init()
821
c86df5cfbe44 5738 Need mechanism to change initial value for TopLevel and category
Padraig O'Briain <padraig.obriain@sun.com>
parents: 816
diff changeset
   126
        import gconf
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   127
        import gtk
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   128
        import gtk.glade
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   129
        import pygtk
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   130
        pygtk.require("2.0")
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   131
        import gtkhtml2
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   132
        import pango
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   133
        from glib import GError
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   134
except ImportError:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   135
        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
   136
import pkg.misc as misc
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1348
diff changeset
   137
import pkg.client.image as image
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   138
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
   139
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
   140
import pkg.client.api as api
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   141
import pkg.client.publisher as publisher
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
   142
import pkg.portable as portable
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   143
import pkg.fmri as fmri
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   144
import pkg.gui.repository as repository
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
   145
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
   146
import pkg.gui.cache as cache
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 868
diff changeset
   147
import pkg.gui.misc as gui_misc
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   148
import pkg.gui.imageinfo as imageinfo
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   149
import pkg.gui.installupdate as installupdate
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   150
import pkg.gui.enumerations as enumerations
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   151
import pkg.gui.parseqs as parseqs
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
   152
import pkg.gui.webinstall as webinstall
576
6ee6de304041 3777 PKG_TIMEOUT_MAX is a placebo setting
Dan Price <dp@eng.sun.com>
parents: 565
diff changeset
   153
from pkg.client import global_settings
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   154
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   155
# 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
   156
import __builtin__
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   157
__builtin__._ = gettext.gettext
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
   158
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   159
(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   160
DISPLAY_LINK,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   161
CLICK_LINK,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   162
) = range(2)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   163
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   164
class PackageManager:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   165
        def __init__(self):
830
687f8a73665e 6019 ctrl-c hangs packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 827
diff changeset
   166
                signal.signal(signal.SIGINT, self.__main_application_quit)
1028
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
   167
                # We reset the HOME directory in case the user called us
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
   168
                # with gksu and had NFS mounted home directory in which
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
   169
                # case dbus called from gconf cannot write to the directory.
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
   170
                if os.getuid() == 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
   171
                        home_dir = self.__find_root_home_dir()
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
   172
                        os.putenv('HOME', home_dir)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   173
                self.api_o = None
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
   174
                self.cache_o = 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
   175
                self.img_timestamp = None
821
c86df5cfbe44 5738 Need mechanism to change initial value for TopLevel and category
Padraig O'Briain <padraig.obriain@sun.com>
parents: 816
diff changeset
   176
                self.client = gconf.client_get_default()
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   177
                try:
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   178
                        self.max_search_completion = \
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   179
                            self.client.get_int(MAX_SEARCH_COMPLETION_PREFERENCES)
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   180
                        self.initial_show_filter = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   181
                            self.client.get_int(INITIAL_SHOW_FILTER_PREFERENCES)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   182
                        self.initial_section = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   183
                            self.client.get_int(INITIAL_SECTION_PREFERENCES)
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   184
                        self.last_export_selection_path = \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   185
                            self.client.get_string(LAST_EXPORT_SELECTION_PATH)
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   186
                        self.show_startpage = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   187
                            self.client.get_bool(SHOW_STARTPAGE_PREFERENCES)
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   188
                        self.save_state = \
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   189
                            self.client.get_bool(SAVE_STATE_PREFERENCES)
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
   190
                        self.start_insearch = \
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
   191
                            self.client.get_bool(START_INSEARCH_PREFERENCES)
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   192
                        self.lastsource = \
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   193
                            self.client.get_string(LASTSOURCE_PREFERENCES)
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   194
                        self.gconf_not_show_repos = \
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   195
                            self.client.get_string(API_SEARCH_ERROR_PREFERENCES)
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   196
                        self.initial_app_width = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   197
                            self.client.get_int(INITIAL_APP_WIDTH_PREFERENCES)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   198
                        self.initial_app_height = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   199
                            self.client.get_int(INITIAL_APP_HEIGHT_PREFERENCES)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   200
                        self.initial_app_hpos = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   201
                            self.client.get_int(INITIAL_APP_HPOS_PREFERENCES)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   202
                        self.initial_app_vpos = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   203
                            self.client.get_int(INITIAL_APP_VPOS_PREFERENCES)
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   204
                        self.client.add_dir(PACKAGEMANAGER_PREFERENCES,
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   205
                            gconf.CLIENT_PRELOAD_NONE)
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   206
                        self.client.notify_add(SAVE_STATE_PREFERENCES,
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   207
                            self.__save_state_changed)
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   208
                except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   209
                        # Default values - the same as in the 
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   210
                        # packagemanager-preferences.schemas
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   211
                        self.max_search_completion = 20
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   212
                        self.initial_show_filter = 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
   213
                        self.initial_section = 2
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   214
                        self.last_export_selection_path = ""
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   215
                        self.show_startpage = True
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   216
                        self.save_state = True
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
   217
                        self.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
   218
                        self.lastsource = ""
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   219
                        self.gconf_not_show_repos = ""
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   220
                        self.initial_app_width = 800
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   221
                        self.initial_app_height = 600
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   222
                        self.initial_app_hpos = 200
1062
02749f19ab99 8218 Default position of bottom tabs in IPS makes the GUI look odd
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1059
diff changeset
   223
                        self.initial_app_vpos = 320
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   224
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   225
                if self.initial_app_width == -1:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   226
                        self.initial_app_width = 800
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   227
                if self.initial_app_height == -1:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   228
                        self.initial_app_height = 600
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   229
                if self.initial_app_hpos == -1:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   230
                        self.initial_app_hpos = 200
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   231
                if self.initial_app_vpos == -1:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   232
                        self.initial_app_vpos = 320
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   233
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   234
                if not self.gconf_not_show_repos:
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   235
                        self.gconf_not_show_repos = ""
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   236
                self.set_section = 0
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   237
                self.in_search_mode = False
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   238
1218
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   239
                global_settings.client_name = PKG_CLIENT_NAME
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1187
diff changeset
   240
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1187
diff changeset
   241
                # 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
   242
                # transport framework uses the defaults in global_settings,
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   243
                # 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
   244
                # 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
   245
                # 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
   246
                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
   247
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   248
                try:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   249
                        self.application_dir = os.environ["PACKAGE_MANAGER_ROOT"]
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   250
                except KeyError:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   251
                        self.application_dir = "/"
791
123e9401e939 5778 Inability to set locale leads to stack trace
Danek Duvall <danek.duvall@sun.com>
parents: 781
diff changeset
   252
                misc.setlocale(locale.LC_ALL, "")
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   253
                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
   254
                        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
   255
                            self.application_dir,
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   256
                            "usr/share/locale"))
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   257
                        module.textdomain("pkg")
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
   258
                gui_misc.init_for_help(self.application_dir)
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
   259
                self.main_window_title = _('Package Manager')
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   260
                self.gdk_window = None
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
   261
                self.user_rights = portable.is_admin()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   262
                self.cancelled = False                    # For background processes
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
   263
                self.description_queue = deque()
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
   264
                self.description_thread_running = False
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
   265
                self.image_directory = None
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   266
                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
   267
                self.progress_stop_thread = True
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   268
                self.catalog_loaded = False
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
   269
                self.update_all_proceed = False
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
   270
                self.ua_be_name = None
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   271
                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
   272
                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
   273
                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
   274
                self.exiting = False
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   275
                self.first_run = True
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
   276
                self.in_reload = False
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   277
                self.selected_pkgstem = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   278
                self.selected_model = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   279
                self.selected_path = None
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
   280
                self.info_cache = {}
816
5d4f7746a490 3978 Selecting package rows should check the package row as well
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 815
diff changeset
   281
                self.selected = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   282
                self.selected_pkgs = {}
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
   283
                self.start_page_url = None
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   284
                self.to_install_update = {}
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   285
                self.to_remove = {}
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   286
                self.in_startpage_startup = self.show_startpage
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   287
                self.lang = None
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   288
                self.lang_root = None
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
   289
                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
   290
                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
   291
                self.force_reload_packages = True
1368
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   292
                self.icon_theme = gtk.icon_theme_get_default()
1187
4ce20ffb5515 9680 PACKAGE_MANAGER_ROOT ignored for icon_theme search path
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1183
diff changeset
   293
                icon_location = os.path.join(self.application_dir, ICON_LOCATION)
4ce20ffb5515 9680 PACKAGE_MANAGER_ROOT ignored for icon_theme search path
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1183
diff changeset
   294
                self.icon_theme.append_search_path(icon_location)
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   295
                self.installed_icon = gui_misc.get_icon(self.icon_theme,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   296
                    'status_installed')
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   297
                self.not_installed_icon = gui_misc.get_icon(self.icon_theme,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   298
                    'status_notinstalled')
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   299
                self.update_available_icon = gui_misc.get_icon(self.icon_theme,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   300
                    'status_newupdate')
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
   301
                self.window_icon = gui_misc.get_icon(self.icon_theme,
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
   302
                    'packagemanager', 48)
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   303
                self.filter_options = [
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   304
                    (enumerations.FILTER_ALL,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   305
                    gui_misc.get_icon(self.icon_theme, 'filter_all'),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   306
                    _('All Packages')),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   307
                    (enumerations.FILTER_INSTALLED, self.installed_icon,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   308
                    _('Installed Packages')),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   309
                    (enumerations.FILTER_UPDATES, self.update_available_icon,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   310
                    _('Updates')),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   311
                    (enumerations.FILTER_NOT_INSTALLED, self.not_installed_icon,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   312
                    _('Not installed Packages')),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   313
                    (-1, None, ""),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   314
                    (enumerations.FILTER_SELECTED,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   315
                    gui_misc.get_icon(self.icon_theme, 'filter_selected'),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   316
                    _('Selected Packages'))
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   317
                    ]
1246
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
   318
                self.publisher_options = { 
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
   319
                    PUBLISHER_ADD : _("Add..."),
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   320
                    PUBLISHER_ALL : _("All Publishers (Search)")}
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   321
                self.last_visible_publisher = None
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   322
                self.last_visible_publisher_uptodate = False
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   323
                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
   324
                self.search_start = 0
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   325
                self.search_time_sec = 0
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   326
                self.search_all_pub_being_searched = None
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
   327
                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
   328
                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
   329
                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
   330
                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
   331
                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
   332
                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
   333
                self.application_treeview_initialized = False
864
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
   334
                self.categories_treeview_range = None
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
   335
                self.categories_treeview_initialized = False
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   336
                self.category_list = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   337
                self.repositories_list = None
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   338
                self.repo_combobox_all_pubs_index = 0
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   339
                self.repo_combobox_add_index = 0
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   340
                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
   341
                self.pylintstub = None
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   342
                self.release_notes_url = "http://www.opensolaris.org"
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
   343
                self.__image_activity_lock = Lock()
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
   344
                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
   345
                self.category_active_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
   346
                
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   347
                # Create Widgets and show gui
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   348
                self.gladefile = os.path.join(self.application_dir,
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   349
                    "usr/share/package-manager/packagemanager.glade")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   350
                w_tree_main = gtk.glade.XML(self.gladefile, "mainwindow")
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   351
                w_tree_preferences = gtk.glade.XML(self.gladefile, "preferencesdialog")
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   352
                w_tree_api_search_error = gtk.glade.XML(self.gladefile,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   353
                    "api_search_error")
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   354
                self.w_preferencesdialog = \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   355
                    w_tree_preferences.get_widget("preferencesdialog")
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
   356
                self.w_preferencesdialog.set_icon(self.window_icon)
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   357
                self.w_startpage_checkbutton = \
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   358
                    w_tree_preferences.get_widget("startpage_checkbutton")
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   359
                self.w_exit_checkbutton = \
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   360
                    w_tree_preferences.get_widget("exit_checkbutton")
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   361
                self.api_search_error_dialog = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   362
                    w_tree_api_search_error.get_widget("api_search_error")
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   363
                self.api_search_error_textview = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   364
                    w_tree_api_search_error.get_widget("api_search_error_text")
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   365
                self.api_search_checkbox = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   366
                    w_tree_api_search_error.get_widget("api_search_checkbox")
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   367
                self.api_search_button = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   368
                    w_tree_api_search_error.get_widget("api_search_button")
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   369
                infobuffer = self.api_search_error_textview.get_buffer()
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   370
                infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   371
                w_tree_confirm = gtk.glade.XML(self.gladefile, "confirmationdialog")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   372
                self.w_exportconfirm_dialog = \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   373
                    w_tree_confirm.get_widget("confirmationdialog")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   374
                self.w_exportconfirm_dialog.set_icon(self.window_icon)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   375
                self.w_confirmok_button = w_tree_confirm.get_widget("ok_conf")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   376
                self.w_confirm_textview = w_tree_confirm.get_widget("confirmtext")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   377
                infobuffer = self.w_confirm_textview.get_buffer()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   378
                infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)                
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   379
                self.w_confirm_label = w_tree_confirm.get_widget("confirm_label")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   380
                w_confirm_image = w_tree_confirm.get_widget("confirm_image")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   381
                w_confirm_image.set_from_stock(gtk.STOCK_DIALOG_INFO,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   382
                    gtk.ICON_SIZE_DND)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   383
                self.w_exportconfirm_dialog.set_title(_("Export Selections Confirmation"))
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   384
                self.w_confirm_label.set_markup(
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   385
                    _("<b>Export the following to a Web Install .p5i file:</b>"))
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   386
                
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   387
                self.w_main_window = w_tree_main.get_widget("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
   388
                self.w_main_window.set_icon(self.window_icon)
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   389
                self.w_main_hpaned = \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   390
                    w_tree_main.get_widget("main_hpaned")
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   391
                self.w_main_vpaned = \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   392
                    w_tree_main.get_widget("main_vpaned")
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   393
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   394
                self.w_application_treeview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   395
                    w_tree_main.get_widget("applicationtreeview")
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
   396
                self.w_application_treeview.connect('key_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
   397
                    self.__on_applicationtreeview_button_and_key_events)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   398
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   399
                self.w_categories_treeview = w_tree_main.get_widget("categoriestreeview")
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   400
                self.w_info_notebook = w_tree_main.get_widget("details_notebook")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   401
                self.w_generalinfo_textview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   402
                    w_tree_main.get_widget("generalinfotextview")
1344
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
   403
                self.w_generalinfo_textview.get_buffer().create_tag(
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
   404
                    "bold", weight=pango.WEIGHT_BOLD)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   405
                self.w_installedfiles_textview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   406
                    w_tree_main.get_widget("installedfilestextview")
1344
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
   407
                self.w_installedfiles_textview.get_buffer().create_tag(
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
   408
                    "bold", weight=pango.WEIGHT_BOLD)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   409
                self.w_license_textview = \
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   410
                    w_tree_main.get_widget("licensetextview")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   411
                self.w_dependencies_textview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   412
                    w_tree_main.get_widget("dependenciestextview")
1344
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
   413
                self.w_dependencies_textview.get_buffer().create_tag(
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
   414
                    "bold", weight=pango.WEIGHT_BOLD)
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   415
                self.w_general_info_label = \
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
   416
                    w_tree_main.get_widget("general_info_label")
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   417
                self.w_startpage_frame = \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   418
                    w_tree_main.get_widget("startpage_frame")
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   419
                self.w_startpage_eventbox = \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   420
                    w_tree_main.get_widget("startpage_eventbox")
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   421
                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
   422
                    gtk.gdk.color_parse("white"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   423
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   424
                self.w_main_statusbar = w_tree_main.get_widget("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
   425
                #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
   426
                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
   427
                        self.__get_statusbar_label(self.w_main_statusbar)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   428
                if self.w_main_statusbar_label != None:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   429
                        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
   430
    
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   431
                self.w_statusbar_hbox = w_tree_main.get_widget("statusbar_hbox")
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   432
                self.w_infosearch_frame = w_tree_main.get_widget("infosearch_frame")
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   433
                self.w_infosearch_button = w_tree_main.get_widget("infosearch_button")
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   434
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   435
                self.w_progress_frame = w_tree_main.get_widget("progress_frame")
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   436
                self.w_status_progressbar = w_tree_main.get_widget("status_progressbar")
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   437
                self.w_status_progressbar.set_pulse_step(0.1)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   438
                self.w_progress_frame.hide()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   439
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   440
                self.w_main_view_notebook = \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   441
                    w_tree_main.get_widget("main_view_notebook")
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
   442
                self.w_searchentry = w_tree_main.get_widget("searchentry")
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   443
                self.entry_embedded_icons_supported = True
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   444
                try:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   445
                        self.w_searchentry.set_property("secondary-icon-stock", None)
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   446
                except TypeError:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   447
                        self.entry_embedded_icons_supported = 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
   448
                self.search_text_style = -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
   449
                self.__set_search_text_mode(enumerations.SEARCH_STYLE_PROMPT)
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   450
                self.search_completion = gtk.ListStore(str)
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
   451
                self.w_package_menu = w_tree_main.get_widget("package_menu")
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   452
                self.w_reload_button = w_tree_main.get_widget("reload_button")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   453
                self.w_installupdate_button = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   454
                    w_tree_main.get_widget("install_update_button")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   455
                self.w_remove_button = w_tree_main.get_widget("remove_button")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   456
                self.w_updateall_button = w_tree_main.get_widget("update_all_button")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   457
                self.w_repository_combobox = w_tree_main.get_widget("repositorycombobox")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   458
                self.w_filter_combobox = w_tree_main.get_widget("filtercombobox")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   459
                self.w_packageicon_image = w_tree_main.get_widget("packageimage")
1368
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   460
                self.w_reload_menuitem = w_tree_main.get_widget("file_reload")
1462
d0b08a7bb65e 12426 Select a package got traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1461
diff changeset
   461
                self.__set_icon(self.w_reload_button, self.w_reload_menuitem,
d0b08a7bb65e 12426 Select a package got traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1461
diff changeset
   462
                    'pm-refresh')
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   463
                self.w_installupdate_menuitem = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   464
                    w_tree_main.get_widget("package_install_update")
1368
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   465
                self.__set_icon(self.w_installupdate_button, 
1458
a6f813dbcc3e 12100 Update icons for next release of OpenSolaris
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1457
diff changeset
   466
                    self.w_installupdate_menuitem, 'pm-install_update')
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   467
                self.w_remove_menuitem = w_tree_main.get_widget("package_remove")
1368
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   468
                self.__set_icon(self.w_remove_button, self.w_remove_menuitem, 
1458
a6f813dbcc3e 12100 Update icons for next release of OpenSolaris
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1457
diff changeset
   469
                    'pm-remove')
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   470
                self.w_updateall_menuitem = w_tree_main.get_widget("package_update_all")
1368
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   471
                self.__set_icon(self.w_updateall_button,
1458
a6f813dbcc3e 12100 Update icons for next release of OpenSolaris
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1457
diff changeset
   472
                    self.w_updateall_menuitem, 'pm-update_all')
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   473
                self.w_export_selections_menuitem = w_tree_main.get_widget(
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   474
                    "file_export_selections")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   475
                self.w_cut_menuitem = w_tree_main.get_widget("edit_cut")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   476
                self.w_copy_menuitem = w_tree_main.get_widget("edit_copy")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   477
                self.w_paste_menuitem = w_tree_main.get_widget("edit_paste")
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   478
                self.w_delete_menuitem = w_tree_main.get_widget("edit_delete")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   479
                self.w_selectall_menuitem = w_tree_main.get_widget("edit_select_all")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   480
                self.w_selectupdates_menuitem = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   481
                    w_tree_main.get_widget("edit_select_updates")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   482
                self.w_deselect_menuitem = w_tree_main.get_widget("edit_deselect")
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   483
                self.w_clear_search_menuitem = w_tree_main.get_widget("clear")
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
   484
                self.w_main_clipboard =  gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD)
947
181d3c7a54ee 6635 Need support Search across All Repositories (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 944
diff changeset
   485
                self.saved_filter_combobox_active = self.initial_show_filter
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   486
                self.search_image = w_tree_main.get_widget("search_image")
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   487
                self.search_button = w_tree_main.get_widget("do_search")
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   488
                self.progress_cancel = w_tree_main.get_widget("progress_cancel")
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   489
                self.is_all_publishers = False
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   490
                self.search_image.set_from_pixbuf(gui_misc.get_icon(self.icon_theme,
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   491
                    'search', 20))
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   492
                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
   493
                self.saved_section_active = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   494
                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
   495
                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
   496
                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
   497
                self.saved_category_list = None
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   498
                self.saved_section_list = None
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   499
                self.saved_selected_application_path = 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
   500
                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
   501
                self.statusbar_message_id = 0
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
   502
                toolbar =  w_tree_main.get_widget("toolbutton2")
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
   503
                toolbar.set_expand(True)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   504
                self.__init_repository_tree_view()
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
   505
                self.w_main_window.set_title(self.main_window_title)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
   506
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   507
                # Update All Completed Dialog
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   508
                w_xmltree_ua_completed = gtk.glade.XML(self.gladefile,
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   509
                    "ua_completed_dialog")
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   510
                self.w_ua_completed_dialog = w_xmltree_ua_completed.get_widget(
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   511
                    "ua_completed_dialog")
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   512
                self.w_ua_completed_dialog .connect("destroy",
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   513
                    self.__on_ua_completed_close)
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   514
                self.w_ua_completed_release_label = w_xmltree_ua_completed.get_widget(
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   515
                    "ua_completed_release_label")
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   516
                self.w_ua_completed_linkbutton = w_xmltree_ua_completed.get_widget(
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   517
                    "ua_completed_linkbutton")
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   518
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   519
                # Setup Start Page
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   520
                self.document = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   521
                self.view = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   522
                self.current_url = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   523
                self.opener = None
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   524
                self.__setup_startpage(self.show_startpage)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   525
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   526
                try:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   527
                        dic_mainwindow = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   528
                            {
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   529
                                "on_mainwindow_delete_event": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   530
                                    self.__on_mainwindow_delete_event,
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   531
                                "on_mainwindow_check_resize": \
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   532
                                    self.__on_mainwindow_check_resize,
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
   533
                                "on_mainwindow_key_press_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
   534
                                    self.__on_mainwindow_key_press_event,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   535
                                "on_searchentry_changed":self.__on_searchentry_changed,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   536
                                "on_searchentry_focus_in_event": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   537
                                    self.__on_searchentry_focus_in,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   538
                                "on_searchentry_focus_out_event": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   539
                                    self.__on_searchentry_focus_out,
1135
ecf0a27789e3 8824 Package Manager search doesn't behave properly with IIIM
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1123
diff changeset
   540
                                "on_searchentry_activate": \
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   541
                                    self.__do_search,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   542
                                "on_filtercombobox_changed": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   543
                                    self.__on_filtercombobox_changed,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   544
                                "on_repositorycombobox_changed": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   545
                                    self.__on_repositorycombobox_changed,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   546
                                #menu signals
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   547
                                "on_file_export_selections": \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   548
                                        self.__on_file_export_selections,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   549
                                "on_file_quit_activate":self.__on_file_quit_activate,
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
   550
                                "on_file_be_activate":self.__on_file_be_activate,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   551
                                "on_package_install_update_activate": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   552
                                    self.__on_install_update,
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
   553
                                "on_file_manage_publishers_activate": \
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
   554
                                    self.__on_file_manage_publishers,
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
   555
                                "on_file_add_publisher_activate": \
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
   556
                                    self.__on_file_add_publisher,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   557
                                "on_package_remove_activate":self.__on_remove,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   558
                                "on_help_about_activate":self.__on_help_about,
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   559
                                "on_help_help_activate":self.__on_help_help,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   560
                                "on_edit_paste_activate":self.__on_edit_paste,
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   561
                                "on_edit_delete_activate":self.__on_delete,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   562
                                "on_edit_copy_activate":self.__on_copy,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   563
                                "on_edit_cut_activate":self.__on_cut,
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
   564
                                "on_edit_search_activate":self.__on_edit_search_clicked,
1243
d1f303f7dd86 9858 Need to get focus in package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1236
diff changeset
   565
                                "on_goto_list_activate":self.__on_goto_list_clicked,
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
   566
                                "on_clear_search_activate":self.__on_clear_search,
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   567
                                "on_clear_search_clicked":self.__on_clear_search,
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   568
                                "on_do_search_clicked":self.__do_search,
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   569
                                "on_do_search_button_press_event":self.__do_search,
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   570
                                "on_progress_cancel_clicked": \
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   571
                                    self.__on_progress_cancel_clicked,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   572
                                "on_edit_select_all_activate":self.__on_select_all,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   573
                                "on_edit_select_updates_activate": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   574
                                    self.__on_select_updates,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   575
                                "on_edit_deselect_activate":self.__on_deselect,
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   576
                                "on_edit_preferences_activate":self.__on_preferences,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   577
                                # XXX disabled until new API
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   578
                                "on_package_update_all_activate":self.__on_update_all,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   579
                                #toolbar signals
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   580
                                # XXX disabled until new API
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   581
                                "on_update_all_button_clicked":self.__on_update_all,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   582
                                "on_reload_button_clicked":self.__on_reload,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   583
                                "on_install_update_button_clicked": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   584
                                    self.__on_install_update,
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
   585
                                "on_remove_button_clicked":self.__on_remove,
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   586
                                "on_help_start_page_activate":self.__on_startpage,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   587
                                "on_details_notebook_switch_page": \
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
   588
                                    self.__on_notebook_change,
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   589
                                "on_infosearch_button_clicked": \
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   590
                                    self.__on_infosearch_button_clicked,
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
   591
                                "on_applicationtreeview_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
   592
                                    self.__on_applicationtreeview_button_and_key_events,
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
   593
                                "on_applicationtreeview_query_tooltip": \
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
   594
                                    self.__on_applicationtreeview_query_tooltip,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   595
                            }
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   596
                        dic_preferences = \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   597
                            {
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   598
                                "on_startpage_checkbutton_toggled": \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   599
                                    self.__on_startpage_checkbutton_toggled,
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   600
                                "on_exit_checkbutton_toggled": \
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   601
                                    self.__on_exit_checkbutton_toggled,
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   602
                                "on_preferenceshelp_clicked": \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   603
                                    self.__on_preferenceshelp_clicked,
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   604
                                "on_preferencesclose_clicked": \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   605
                                    self.__on_preferencesclose_clicked,
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   606
                            }
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   607
                        dic_api_search_error = \
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   608
                            {
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   609
                                "on_api_search_checkbox_toggled": \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   610
                                    self.__on_api_search_checkbox_toggled,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   611
                                "on_api_search_button_clicked": \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   612
                                    self.__on_api_search_button_clicked,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   613
                                "on_api_search_error_delete_event": \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   614
                                    self.__on_api_search_error_delete_event,
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   615
                            }
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   616
                        dic_completed = \
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   617
                            {
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   618
                                "on_ua_complete_close_button_clicked": \
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   619
                                     self.__on_ua_completed_close,
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   620
                                "on_ua_completed_linkbutton_clicked": \
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
   621
                                     self.__on_ua_completed_linkbutton_clicked,
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   622
                            }
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   623
                        dic_confirm = \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   624
                            {
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   625
                                "on_ok_conf_clicked": \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   626
                                    self.__on_confirm_proceed_button_clicked,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   627
                                "on_cancel_conf_clicked": \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   628
                                    self.__on_confirm_cancel_button_clicked,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   629
                            }        
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   630
                            
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
   631
                        w_xmltree_ua_completed.signal_autoconnect(dic_completed)
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   632
                        w_tree_confirm.signal_autoconnect(dic_confirm)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   633
                        w_tree_main.signal_autoconnect(dic_mainwindow)
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   634
                        w_tree_preferences.signal_autoconnect(dic_preferences)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   635
                        w_tree_api_search_error.signal_autoconnect(
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   636
                            dic_api_search_error)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   637
                except AttributeError, error:
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   638
                        print _(
1418
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
   639
                            "GUI will not respond to any event! %s. "
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   640
                            "Check declare_signals()") \
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   641
                            % error
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   642
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   643
                self.package_selection = None
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
   644
                self.application_list_filter = None
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   645
                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
   646
                self.application_refilter_id = 0
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   647
                self.application_refilter_idle_id = 0
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
   648
                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
   649
                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
   650
                self.show_info_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
   651
                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
   652
                self.show_licenses_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
   653
                self.showing_empty_details = False
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
   654
                self.in_setup = 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
   655
                self.catalog_refresh_done = False
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   656
                if self.initial_app_width >= MIN_APP_WIDTH and \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   657
                        self.initial_app_height >= MIN_APP_HEIGHT:
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   658
                        self.w_main_window.resize(self.initial_app_width,
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   659
                            self.initial_app_height)
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   660
                if self.initial_app_hpos > 0:
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   661
                        self.w_main_hpaned.set_position(self.initial_app_hpos)
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   662
                if self.initial_app_vpos > 0:
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   663
                        self.w_main_vpaned.set_position(self.initial_app_vpos)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   664
                self.w_main_window.show_all()
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   665
                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
   666
                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
   667
                    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
   668
                gdk_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   669
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   670
                self.gdk_window.set_cursor(gdk_cursor)
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   671
                if self.show_startpage:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   672
                        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
   673
                else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   674
                        self.w_main_view_notebook.set_current_page(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   675
                            NOTEBOOK_PACKAGE_LIST_PAGE)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   676
                self.api_search_error_dialog.set_transient_for(self.w_main_window)
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
   677
                self.__setup_text_signals()
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   678
1368
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   679
        @staticmethod
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   680
        def __set_icon(button, menuitem, icon_name):
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   681
                icon_source = gtk.IconSource()
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   682
                icon_source.set_icon_name(icon_name)
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   683
                icon_set = gtk.IconSet()
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   684
                icon_set.add_source(icon_source)
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   685
                image_widget = gtk.image_new_from_icon_set(icon_set,
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   686
                    gtk.ICON_SIZE_SMALL_TOOLBAR)
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   687
                button.set_icon_widget(image_widget)
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   688
                image_widget = gtk.image_new_from_icon_set(icon_set,
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   689
                    gtk.ICON_SIZE_MENU)
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   690
                menuitem.set_image(image_widget)
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   691
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   692
        @staticmethod
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   693
        def __get_statusbar_label(statusbar):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   694
                sb_frame = None
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   695
                sb_label = None
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   696
                children = statusbar.get_children()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   697
                if len(children) > 0:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   698
                        sb_frame = children[0]
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   699
                if sb_frame and isinstance(sb_frame, gtk.Frame):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   700
                        children = sb_frame.get_children()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   701
                        if len(children) > 0:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   702
                                sb_label = children[0]
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   703
                        if sb_label and isinstance(sb_label, gtk.Label):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   704
                                return sb_label
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   705
                return None
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   706
                
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   707
        def __on_confirm_cancel_button_clicked(self, widget):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   708
                self.w_exportconfirm_dialog.hide()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   709
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   710
        def __on_confirm_proceed_button_clicked(self, widget):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   711
                self.w_exportconfirm_dialog.hide()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   712
                self.__export_selections()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   713
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   714
        def __on_file_export_selections(self, menuitem):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   715
                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
   716
                        return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   717
                        
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   718
                infobuffer = self.w_confirm_textview.get_buffer()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   719
                infobuffer.set_text("")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   720
                textiter = infobuffer.get_end_iter()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   721
                
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   722
                infobuffer.insert(textiter, "\n")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   723
                for pub_name, pkgs in self.selected_pkgs.items():
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   724
                        infobuffer.insert_with_tags_by_name(textiter,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   725
                            "%s\n" % pub_name, "bold")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   726
                        for pkg in pkgs.keys():
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   727
                                infobuffer.insert(textiter,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   728
                                    "\t%s\n" % fmri.extract_pkg_name(pkg))
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   729
                self.w_exportconfirm_dialog.show()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   730
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   731
        def __export_selections(self):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   732
                filename = self.__get_export_p5i_filename()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   733
                if not filename:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   734
                        return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   735
                try:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   736
                        fobj = open(filename, 'w')
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   737
                except IOError, ex_sel:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   738
                        self.error_occurred(ex_sel, _("Export Selections Error"))
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   739
                        return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   740
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   741
                self.api_o.write_p5i(fobj, pkg_names=self.selected_pkgs,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   742
                    pubs=self.selected_pkgs.keys())
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   743
                fobj.close()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   744
                os.chmod(filename, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP |
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   745
                    stat.S_IWGRP | stat.S_IROTH | stat.S_IWOTH )
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   746
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   747
        def __get_export_p5i_filename(self):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   748
                filename = None
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   749
                chooser = gtk.FileChooserDialog(_("Export Selections"), 
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   750
                    self.w_main_window,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   751
                    gtk.FILE_CHOOSER_ACTION_SAVE,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   752
                    (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   753
                    gtk.STOCK_SAVE, gtk.RESPONSE_OK))
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   754
        
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   755
                file_filter = gtk.FileFilter()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   756
                file_filter.set_name(_("p5i Files"))
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   757
                file_filter.add_pattern("*.p5i")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   758
                chooser.add_filter(file_filter)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   759
                file_filter = gtk.FileFilter()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   760
                file_filter.set_name(_("All Files"))
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   761
                file_filter.add_pattern("*")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   762
                chooser.add_filter(file_filter)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   763
                
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   764
                path = tempfile.gettempdir()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   765
                name = _("my_packages")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   766
                if self.last_export_selection_path and \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   767
                        self.last_export_selection_path != "":
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   768
                        path, name_plus_ext = os.path.split(
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   769
                            self.last_export_selection_path)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   770
                        name, ext = os.path.splitext(name_plus_ext)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   771
                        self.pylintstub = ext
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   772
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   773
                #Check name
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   774
                base_name = None
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   775
                m = re.match("(.*)(-\d+)$", name)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   776
                if m == None and os.path.exists(path + os.sep + name + '.p5i'):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   777
                        base_name = name
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   778
                if m and len(m.groups()) == 2:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   779
                        base_name = m.group(1)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   780
                name = name + '.p5i'
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   781
                if base_name:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   782
                        for i in range(1, 99):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   783
                                full_path = path + os.sep + base_name + '-' + \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   784
                                        str(i) + '.p5i'
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   785
                                if not os.path.exists(full_path):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   786
                                        name = base_name + '-' + str(i) + '.p5i'
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   787
                                        break
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   788
                chooser.set_current_folder(path)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   789
                chooser.set_current_name(name)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   790
                chooser.set_do_overwrite_confirmation(True)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   791
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   792
                response = chooser.run()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   793
                if response == gtk.RESPONSE_OK:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   794
                        filename = chooser.get_filename()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   795
                        self.last_export_selection_path = filename
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   796
                chooser.destroy()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   797
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   798
                return filename
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   799
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
   800
        def __set_search_text_mode(self, style):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   801
                if style == enumerations.SEARCH_STYLE_NORMAL:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   802
                        self.w_searchentry.modify_text(gtk.STATE_NORMAL,
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   803
                                gtk.gdk.color_parse(SEARCH_TXT_BLACK_STYLE))
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   804
                        if self.search_text_style == enumerations.SEARCH_STYLE_PROMPT or\
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   805
                                self.w_searchentry.get_text() == _("Search (Ctrl-F)"):
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   806
                                self.w_searchentry.set_text("")
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   807
                        self.search_text_style = enumerations.SEARCH_STYLE_NORMAL
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   808
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   809
                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
   810
                        self.w_searchentry.modify_text(gtk.STATE_NORMAL,
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   811
                                gtk.gdk.color_parse(SEARCH_TXT_GREY_STYLE))
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   812
                        self.search_text_style = enumerations.SEARCH_STYLE_PROMPT
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   813
                        self.w_searchentry.set_text(_("Search (Ctrl-F)"))
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   814
        
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   815
        def __search_completion_cb(self, entry):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   816
                text = entry.get_text()
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   817
                if text:
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   818
                        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
   819
                                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
   820
                                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
   821
                                        len_search_completion >= \
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   822
                                                self.max_search_completion:
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   823
                                        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
   824
                                        if itr:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   825
                                                self.search_completion.remove(itr)
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   826
                                self.search_completion.append([text])
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   827
                return
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   828
                
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
   829
        def __setup_text_signals(self):
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   830
                self.w_generalinfo_textview.get_buffer().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
   831
                    "notify::has-selection", self.__on_text_buffer_has_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
   832
                self.w_installedfiles_textview.get_buffer().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
   833
                    "notify::has-selection", self.__on_text_buffer_has_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
   834
                self.w_dependencies_textview.get_buffer().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
   835
                    "notify::has-selection", self.__on_text_buffer_has_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
   836
                self.w_license_textview.get_buffer().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
   837
                    "notify::has-selection", self.__on_text_buffer_has_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
   838
                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
   839
                    "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
   840
                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
   841
                    "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
   842
                self.w_generalinfo_textview.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
   843
                    "focus-in-event", self.__on_textview_focus_in)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   844
                self.w_installedfiles_textview.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
   845
                    "focus-in-event", self.__on_textview_focus_in)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   846
                self.w_dependencies_textview.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
   847
                    "focus-in-event", self.__on_textview_focus_in)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   848
                self.w_license_textview.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
   849
                    "focus-in-event", self.__on_textview_focus_in)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   850
                self.w_generalinfo_textview.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
   851
                    "focus-out-event", self.__on_textview_focus_out)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   852
                self.w_installedfiles_textview.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
   853
                    "focus-out-event", self.__on_textview_focus_out)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   854
                self.w_dependencies_textview.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
   855
                    "focus-out-event", self.__on_textview_focus_out)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   856
                self.w_license_textview.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
   857
                    "focus-out-event", self.__on_textview_focus_out)
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   858
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   859
        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
   860
                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
   861
                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
   862
                        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
   863
                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
   864
                        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
   865
                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
   866
                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
   867
                        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
   868
                        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
   869
                        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
   870
                                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
   871
                        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
   872
                        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
   873
                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
   874
                        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
   875
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   876
        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
   877
                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
   878
                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
   879
                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
   880
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
   881
        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
   882
                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
   883
                        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
   884
                        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
   885
                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
   886
                        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
   887
                        self.w_deselect_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   888
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   889
        def __set_all_publishers_mode(self):
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   890
                if self.is_all_publishers:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   891
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   892
                self.__setup_before_all_publishers_mode()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   893
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   894
        def __setup_startpage(self, show_startpage):
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   895
                self.opener = urllib.FancyURLopener()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   896
                self.document = gtkhtml2.Document()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   897
                self.document.connect('request_url', self.__request_url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   898
                self.document.connect('link_clicked', self.__handle_link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   899
                self.document.clear()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   900
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   901
                self.view = gtkhtml2.View()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   902
                self.view.set_document(self.document)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   903
                self.view.connect('request_object', self.__request_object)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   904
                self.view.connect('on_url', self.__on_url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   905
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   906
                try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   907
                        self.lang, encode = locale.getlocale(locale.LC_CTYPE)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   908
                        if debug:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   909
                                print "Lang: %s: Encode: %s" % (self.lang, encode)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   910
                except locale.Error:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   911
                        self.lang = "C"
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   912
                if self.lang == None or self.lang == "":
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   913
                        self.lang = "C"
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   914
                self.lang_root = self.lang.split('_')[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
   915
                # Load Start Page to setup base URL to allow loading images in other pages
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   916
                self.__load_startpage()
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   917
                if 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
   918
                        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
   919
                                NOTEBOOK_START_PAGE)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   920
                else:
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
   921
                        if self.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
   922
                                self.document.clear()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   923
                        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
   924
                                NOTEBOOK_PACKAGE_LIST_PAGE)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   925
                self.w_startpage_frame.add(self.view)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   926
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   927
        # Stub handler required by GtkHtml widget
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   928
        def __request_object(self, *vargs):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   929
                pass
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   930
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   931
        def __load_startpage(self):
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   932
                if self.__load_startpage_locale(START_PAGE_CACHE_LANG_BASE):
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   933
                        return
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   934
                if self.__load_startpage_locale(START_PAGE_LANG_BASE):
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   935
                        return                        
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
   936
                self.__handle_startpage_load_error(self.start_page_url)
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   937
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   938
        def __load_startpage_locale(self, start_page_lang_base):
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
   939
                self.start_page_url = os.path.join(self.application_dir,
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   940
                        start_page_lang_base % (self.lang, START_PAGE_HOME))
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
   941
                if self.__load_uri(self.document, self.start_page_url):
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   942
                        return True
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   943
                        
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   944
                if self.lang_root != None and self.lang_root != self.lang:
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   945
                        start_page_url = os.path.join(self.application_dir,
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   946
                                start_page_lang_base % (self.lang_root, START_PAGE_HOME))
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   947
                        if self.__load_uri(self.document, start_page_url):
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   948
                                return True
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   949
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   950
                start_page_url = os.path.join(self.application_dir,
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   951
                        start_page_lang_base % ("C", START_PAGE_HOME))
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   952
                if self.__load_uri(self.document, start_page_url):
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   953
                        return True
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   954
                return False
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   955
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   956
        def __handle_startpage_load_error(self, start_page_url):
955
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
   957
                self.document.open_stream('text/html')
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
   958
                self.document.write_stream(_(
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
   959
                    "<html><head></head><body><H2>Welcome to"
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
   960
                    "PackageManager!</H2><br>"
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
   961
                    "<font color='#0000FF'>Warning: Unable to "
1418
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
   962
                    "load Start Page:<br>%s</font></body></html>")
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
   963
                    % (start_page_url))
955
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
   964
                self.document.close_stream()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   965
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   966
        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
   967
                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
   968
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   969
                for pub, err in error.failed_servers:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   970
                        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
   971
                            (pub, _("failed to respond"), err))
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   972
                for pub in error.invalid_servers:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   973
                        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
   974
                            (pub, _("invalid response"),
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   975
                                _("A valid response was not returned.")))
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   976
                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
   977
                        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
   978
                            (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
   979
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   980
        def __on_infosearch_button_clicked(self, widget):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   981
                self.__handle_api_search_error(True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   982
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   983
        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
   984
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
   985
                        return
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   986
                if len(self.current_repos_with_search_errors) == 0:
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   987
                        self.w_infosearch_frame.hide()
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   988
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   989
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   990
                repo_count = 0
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   991
                for pub, err_type, err_str in self.current_repos_with_search_errors:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   992
                        if show_all or (pub 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
   993
                                repo_count += 1
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   994
                if repo_count == 0:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   995
                        self.w_infosearch_frame.hide()
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   996
                        return
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   997
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   998
                self.w_infosearch_button.set_size_request(26, 22)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   999
                self.w_infosearch_frame.show()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1000
                infobuffer = self.api_search_error_textview.get_buffer()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1001
                infobuffer.set_text("")
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1002
                textiter = infobuffer.get_end_iter()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1003
                for pub, err_type, err_str in self.current_repos_with_search_errors:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1004
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1005
                        if show_all or (pub 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
  1006
                                infobuffer.insert_with_tags_by_name(textiter,
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1007
                                    "%(pub)s (%(err_type)s)\n" % {"pub": pub,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1008
                                    "err_type": err_type}, "bold")
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1009
                                infobuffer.insert(textiter, "%s\n" % (err_str))
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1010
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1011
                self.api_search_checkbox.set_active(False)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1012
                self.api_search_error_dialog.show()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1013
                self.api_search_button.grab_focus()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1014
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1015
        def __on_url(self, view, link):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1016
                # Handle mouse over events on links and reset when not on link
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1017
                if link == None or link == "":
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1018
                        self.update_statusbar()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1019
                else:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1020
                        display_link = self.__handle_link(None, link, DISPLAY_LINK)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1021
                        if display_link != None:
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1022
                                self.__update_statusbar_message(display_link)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1023
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1024
                                self.update_statusbar()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1025
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1026
        @staticmethod
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1027
        def __is_relative_to_server(url):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1028
                parts = urlparse.urlparse(url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1029
                if parts[0] or parts[1]:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1030
                        return 0
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1031
                return 1
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1032
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1033
        def __open_url(self, url):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1034
                uri = self.__resolve_uri(url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1035
                return self.opener.open(uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1036
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1037
        def __resolve_uri(self, uri):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1038
                if self.__is_relative_to_server(uri) and self.current_url != uri:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1039
                        return urlparse.urljoin(self.current_url, uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1040
                return uri
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1041
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1042
        def __request_url(self, document, url, stream):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1043
                f = self.__open_url(url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1044
                stream.set_cancel_func(self.__stream_cancel)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1045
                stream.write(f.read())
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1046
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1047
        # Stub handler required by GtkHtml widget or widget will assert
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1048
        def __stream_cancel(self, *vargs):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1049
                pass
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1050
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1051
        def __load_uri(self, document, link):
1418
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
  1052
                self.__update_statusbar_message(_("Loading... %s") % link)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1053
                try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1054
                        f = self.__open_url(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1055
                except  (IOError, OSError), err:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1056
                        if debug:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1057
                                print "err: %s" % (err)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1058
                        self.__update_statusbar_message(_("Stopped"))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1059
                        return False
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1060
                self.current_url = self.__resolve_uri(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1061
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1062
                self.document.clear()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1063
                headers = f.info()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1064
                mime = headers.getheader('Content-type').split(';')[0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1065
                if mime:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1066
                        self.document.open_stream(mime)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1067
                else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1068
                        self.document.open_stream('text/plain')
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1069
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1070
                self.document.write_stream(f.read())
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1071
                self.document.close_stream()
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1072
                self.__update_statusbar_message(_("Done"))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1073
                return True
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1074
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1075
        def __link_load_error(self, link):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1076
                self.document.clear()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1077
                self.document.open_stream('text/html')
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1078
                self.document.write_stream(_(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1079
                    "<html><head></head><body><font color='#000000'>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1080
                    <a href='stub'></a></font>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1081
                    <a href='pm?%s=internal&uri=%s'>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1082
                    <IMG SRC = 'startpage_star.png' \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1083
                    style='border-style: none'></a> <br><br>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1084
                    <h2><font color='#0000FF'>Warning: Unable to \
1418
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
  1085
                    load URL</font></h2><br>%s</body></html>")
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
  1086
                    % (PM_ACTION, START_PAGE_HOME, link))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1087
                self.document.close_stream()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1088
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1089
        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
  1090
                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
  1091
                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
  1092
                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
  1093
                        if entry[enumerations.REPOSITORY_NAME] == 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
  1094
                                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
  1095
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1096
                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
  1097
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1098
        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
  1099
                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
  1100
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1101
                self.saved_repository_combobox_active = index
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1102
                self.__set_searchentry_to_prompt()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1103
                self.__restore_setup_for_browse()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1104
                self.w_repository_combobox.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
  1105
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1106
        def __handle_search_all_publishers(self, term):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1107
                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
  1108
                self.w_repository_combobox.set_active(self.repo_combobox_all_pubs_index)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1109
                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
  1110
                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
  1111
                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
  1112
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1113
        def __handle_link(self, document, link, handle_what = CLICK_LINK):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1114
                query_dict = self.__urlparse_qs(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1115
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1116
                action = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1117
                if query_dict.has_key(PM_ACTION):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1118
                        action = query_dict[PM_ACTION][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1119
                elif handle_what == DISPLAY_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1120
                        return link
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1121
                ext_uri = ""
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1122
                protocol = None
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1123
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1124
                search_action = None
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1125
                if action == ACTION_INTERNAL:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1126
                        if query_dict.has_key(INTERNAL_SEARCH):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1127
                                search_action = query_dict[INTERNAL_SEARCH][0]
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1128
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1129
                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
  1130
                        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
  1131
                        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
  1132
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1133
                        s1 = e1 = '"'
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1134
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1135
                # Browse a Publisher
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1136
                if search_action and search_action.find(INTERNAL_SEARCH_VIEW_PUB) > -1:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1137
                        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
  1138
                                return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1139
                        pub = re.findall(r'<b>(.*)<\/b>', search_action)[0]
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1140
                        if handle_what == DISPLAY_LINK:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1141
                                return _("View packages in %(s1)s%(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
  1142
                                        {"s1": s1, "pub": 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
  1143
                        index = self.__get_publisher_combobox_index(pub)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1144
                        gobject.idle_add(self.__handle_browse_publisher, index)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1145
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1146
                # Search in All Publishers
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1147
                if search_action and search_action == INTERNAL_SEARCH_ALL_PUBS:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1148
                        if handle_what == DISPLAY_LINK:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1149
                                return _("Search within %(s1)sAll Publishers%(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
  1150
                                        {"s1": s1, "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
  1151
                        self.__handle_search_all_publishers(self.w_searchentry.get_text())
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1152
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1153
                # Change View to All Packages
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1154
                if search_action and search_action == INTERNAL_SEARCH_VIEW_ALL:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1155
                        if handle_what == DISPLAY_LINK:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1156
                                return _("Change View to %(s1)sAll Packages%(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
  1157
                                        {"s1": s1, "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
  1158
                        self.w_filter_combobox.set_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
  1159
                        self.w_filter_combobox.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
  1160
                        return                        
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1161
                # Launch Search Help
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1162
                if search_action and search_action == INTERNAL_SEARCH_HELP:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1163
                        if handle_what == DISPLAY_LINK:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1164
                                return _("Display %(s1)sSearch Help%(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
  1165
                                        {"s1": s1, "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
  1166
                        #TBD: Launch search help, need Search Help target
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1167
                        self.__update_statusbar_message(
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1168
                            _("Loading %(s1)sSearch Help%(e1)s ...") %
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1169
                            {"s1": s1, "e1": e1})
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1170
                        gui_misc.display_help()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1171
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1172
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1173
                # Internal Browse
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1174
                if action == ACTION_INTERNAL:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1175
                        if query_dict.has_key(INTERNAL_URI):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1176
                                int_uri = query_dict[INTERNAL_URI][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1177
                                if handle_what == DISPLAY_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1178
                                        return int_uri
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1179
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1180
                                if handle_what == CLICK_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1181
                                        self.__link_load_error(_("No URI specified"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1182
                                return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1183
                        if handle_what == CLICK_LINK and \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1184
                            not self.__load_uri(document, int_uri):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1185
                                self.__link_load_error(int_uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1186
                        return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1187
                # External browse
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1188
                elif action == ACTION_EXTERNAL:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1189
                        if query_dict.has_key(EXTERNAL_URI):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1190
                                ext_uri = query_dict[EXTERNAL_URI][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1191
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1192
                                if handle_what == CLICK_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1193
                                        self.__link_load_error(_("No URI specified"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1194
                                return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1195
                        if query_dict.has_key(EXTERNAL_PROTOCOL):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1196
                                protocol = query_dict[EXTERNAL_PROTOCOL][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1197
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1198
                                protocol = DEFAULT_PROTOCOL
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1199
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1200
                        if handle_what == DISPLAY_LINK:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1201
                                return protocol + "://" + ext_uri
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1202
                        try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1203
                                gnome.url_show(protocol + "://" + ext_uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1204
                        except gobject.GError:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1205
                                self.__link_load_error(protocol + "://" + ext_uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1206
                elif handle_what == DISPLAY_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1207
                        return None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1208
                elif action == None:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1209
                        try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1210
                                gnome.url_show(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1211
                        except gobject.GError:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1212
                                self.__link_load_error(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1213
                # Handle empty and unsupported actions
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1214
                elif action == "":
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1215
                        self.__link_load_error(_("Empty Action not supported"))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1216
                        return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1217
                elif action != None:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1218
                        self.__link_load_error(_("Action not supported: %s") % action)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1219
                        return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1220
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1221
        def __link_load_page(self, text =""):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1222
                self.document.clear()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1223
                self.document.open_stream('text/html')
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1224
                display = "<html><head></head><body>%s</body></html>" % text
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1225
                self.document.write_stream(display)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1226
                self.document.close_stream()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1227
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1228
        @staticmethod
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1229
        def __urlparse_qs(url, keep_blank_values=0, strict_parsing=0):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1230
                scheme, netloc, url, params, querystring, fragment = urlparse.urlparse(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1231
                    url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1232
                if debug:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1233
                        print ("Query: scheme %s, netloc %s, url %s, params %s,"
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1234
                            "querystring %s, fragment %s"
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1235
                            % (scheme, netloc, url, params, querystring, fragment))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1236
                return parseqs.parse_qs(querystring)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1237
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1238
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1239
        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
  1240
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1241
                        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
  1242
                        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
  1243
                        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
  1244
                        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
  1245
                        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
  1246
                        gobject.TYPE_PYOBJECT,    # enumerations.FMRI_COLUMN
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  1247
                        gobject.TYPE_STRING,      # enumerations.STEM_COLUMN
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  1248
                        gobject.TYPE_STRING,      # enumerations.DISPLAY_NAME_COLUMN
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1249
                        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
  1250
                        gobject.TYPE_PYOBJECT,    # enumerations.CATEGORY_LIST_COLUMN
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1251
                        gobject.TYPE_STRING       # enumerations.PUBLISHER_COLUMN
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1252
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1253
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1254
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1255
        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
  1256
                return gtk.TreeStore(
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1257
                        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
  1258
                        gobject.TYPE_STRING,      # enumerations.CATEGORY_NAME
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1259
                        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
  1260
                        gobject.TYPE_PYOBJECT,    # enumerations.SECTION_LIST_OBJECT
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1261
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1262
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1263
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1264
        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
  1265
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1266
                        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
  1267
                        gobject.TYPE_STRING,      # enumerations.SECTION_NAME
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1268
                        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
  1269
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1270
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1271
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1272
        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
  1273
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1274
                        gobject.TYPE_INT,         # enumerations.FILTER_ID
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1275
                        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
  1276
                        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
  1277
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1278
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1279
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1280
        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
  1281
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1282
                        gobject.TYPE_INT,         # enumerations.REPOSITORY_ID
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1283
                        gobject.TYPE_STRING,      # enumerations.REPOSITORY_NAME
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1284
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1285
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1286
        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
  1287
            application_list_filter, application_list_sort,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1288
            application_sort_column):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1289
                ##APPLICATION MAIN TREEVIEW
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1290
                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
  1291
                        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
  1292
                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
  1293
                        application_list_sort = \
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1294
                            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
  1295
                        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
  1296
                            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
  1297
                        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
  1298
                            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
  1299
                            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
  1300
                            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
  1301
                        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
  1302
                            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
  1303
                            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
  1304
                            enumerations.DESCRIPTION_COLUMN)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1305
                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
  1306
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1307
                column = gtk.TreeViewColumn("", toggle_renderer,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1308
                    active = enumerations.MARK_COLUMN)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1309
                column.set_cell_data_func(toggle_renderer, self.cell_data_function, None)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1310
                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
  1311
                column.connect('clicked', self.__select_column_clicked)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1312
                self.w_application_treeview.append_column(column)
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
  1313
                select_image = gtk.Image()
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
  1314
                select_image.set_from_pixbuf(gui_misc.get_icon(
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
  1315
                    self.icon_theme, 'selection'))
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1316
                select_image.set_tooltip_text(_("Click to toggle selections"))
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
  1317
                select_image.show()
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
  1318
                column.set_widget(select_image)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1319
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1320
                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
  1321
                column = gtk.TreeViewColumn(_("Name"), name_renderer,
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1322
                    text = enumerations.NAME_COLUMN)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1323
                column.set_resizable(True)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1324
                column.set_min_width(150)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1325
                column.set_sort_column_id(enumerations.NAME_COLUMN)
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1326
                column.set_sort_indicator(True)
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1327
                column.set_cell_data_func(name_renderer, self.cell_data_function, None)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1328
                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
  1329
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1330
                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
  1331
                column = self.__create_icon_column(_("Status"), True,
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1332
                    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
  1333
                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
  1334
                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
  1335
                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
  1336
                    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
  1337
                self.w_application_treeview.append_column(column)
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1338
                if self.is_all_publishers:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1339
                        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
  1340
                        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
  1341
                            repository_renderer,
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1342
                            text = enumerations.PUBLISHER_COLUMN)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1343
                        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
  1344
                        column.set_resizable(True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1345
                        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
  1346
                        column.set_cell_data_func(repository_renderer,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1347
                            self.cell_data_function, None)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1348
                        column.connect_after('clicked',
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1349
                            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
  1350
                        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
  1351
                        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
  1352
                            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
  1353
                            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
  1354
                            enumerations.PUBLISHER_COLUMN)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1355
                description_renderer = gtk.CellRendererText()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1356
                column = gtk.TreeViewColumn(_('Description'),
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1357
                    description_renderer,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1358
                    text = enumerations.DESCRIPTION_COLUMN)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1359
                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
  1360
                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
  1361
                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
  1362
                column.set_cell_data_func(description_renderer,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1363
                    self.cell_data_function, None)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1364
                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
  1365
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1366
                self.w_application_treeview.append_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1367
                #Added selection listener
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1368
                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
  1369
                self.application_list = application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1370
                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
  1371
                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
  1372
                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
  1373
                    application_list_sort)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1374
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1375
        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
  1376
            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
  1377
            application_list_sort = None, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1378
            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
  1379
                '''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
  1380
                filters'''
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1381
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1382
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1383
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1384
                        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
  1385
                        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
  1386
                elif application_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1387
                        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
  1388
                        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
  1389
                else:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1390
                        self.__disconnect_models()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1391
                        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
  1392
                        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
  1393
                # 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
  1394
                # 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
  1395
                # section to "All Categories" one.
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1396
                if section_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1397
                        row = section_list[self.set_section]
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1398
                        if row[enumerations.SECTION_ENABLED] and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1399
                            self.set_section >= 0 and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1400
                            self.set_section < len(section_list):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1401
                                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
  1402
                                        self.set_section = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1403
                        else:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1404
                                self.set_section = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1405
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1406
                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
  1407
                        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
  1408
                            application_list_filter, application_list_sort, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1409
                            application_sort_column)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1410
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1411
                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
  1412
                        # 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
  1413
                        # 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
  1414
                        # and scrolling up and down using keyboard.
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1415
                        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
  1416
                        vadj.connect('value-changed',
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1417
                            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
  1418
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1419
                        # 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
  1420
                        # 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
  1421
                        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
  1422
                            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
  1423
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  1424
                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
  1425
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1426
                        ##CATEGORIES TREEVIEW
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1427
                        enumerations.CATEGORY_NAME_renderer = gtk.CellRendererText()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1428
                        column = gtk.TreeViewColumn(_('Name'),
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1429
                            enumerations.CATEGORY_NAME_renderer,
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
  1430
                            markup = enumerations.CATEGORY_NAME)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1431
                        enumerations.CATEGORY_NAME_renderer.set_property("xalign", 0.0)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1432
                        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
  1433
                        #Added selection listener
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1434
                        category_selection.set_mode(gtk.SELECTION_SINGLE)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1435
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1436
                if section_list != None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1437
                        self.section_list = section_list
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1438
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1439
                        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
  1440
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1441
                if application_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1442
                        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
  1443
                            self.application_list_sort)
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1444
                        if application_list_filter == None:
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1445
                                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
  1446
                                    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
  1447
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1448
                if self.first_run:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1449
                        category_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1450
                            self.__on_category_selection_changed, None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1451
                        self.w_categories_treeview.connect("row-activated",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1452
                            self.__on_category_row_activated, None)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1453
                        self.w_categories_treeview.connect("focus-in-event",
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1454
                            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
  1455
                        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
  1456
                            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
  1457
                        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
  1458
                            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
  1459
                        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
  1460
                            self.__on_categoriestreeview_row_expanded, None)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1461
                        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
  1462
                        self.package_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1463
                            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
  1464
                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
  1465
                        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
  1466
                self.a11y_application_treeview = \
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1467
                    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
  1468
                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
  1469
                if obj != None:
4501e2b0febd 11382 traceback on console when starting packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1357
diff changeset
  1470
                        obj.set_name(_("all selection toggle"))
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1471
                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
  1472
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1473
        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
  1474
                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
  1475
                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
  1476
                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
  1477
                    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
  1478
                self.w_filter_combobox.set_cell_data_func(render_pixbuf,
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1479
                    self.filter_cell_data_function, 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
  1480
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1481
                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
  1482
                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
  1483
                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
  1484
                    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
  1485
                self.w_filter_combobox.set_cell_data_func(cell,
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1486
                    self.filter_cell_data_function, 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
  1487
                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
  1488
                    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
  1489
                self.w_filter_combobox.set_model(self.filter_list)
1441
45be39b77b70 12097 Selections switching issue
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1440
diff changeset
  1490
                self.w_filter_combobox.set_active(self.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
  1491
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1492
        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
  1493
                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
  1494
                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
  1495
                    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
  1496
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1497
        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
  1498
                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
  1499
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1500
        def __init_repository_tree_view(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1501
                cell = gtk.CellRendererText()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1502
                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
  1503
                self.w_repository_combobox.add_attribute(cell, 'text',
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1504
                    enumerations.REPOSITORY_NAME)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1505
                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
  1506
                    self.combobox_id_separator)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1507
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1508
        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
  1509
                # 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
  1510
                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
  1511
                        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
  1512
                            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
  1513
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1514
        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
  1515
                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
  1516
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1517
        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
  1518
                status = model.get_value(itr, enumerations.STATUS_COLUMN)
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1519
                if status == enumerations.INSTALLED:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1520
                        desc = _("Installed")
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1521
                elif status == enumerations.NOT_INSTALLED:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1522
                        desc = _("Not Installed")
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1523
                elif status == enumerations.UPDATABLE:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1524
                        desc = _("Updates Available")
864
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1525
                else:
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1526
                        desc = None
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1527
                if desc != None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1528
                        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
  1529
                            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
  1530
                            STATUS_COLUMN_INDEX)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1531
                        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
  1532
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1533
        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
  1534
                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
  1535
                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
  1536
                    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
  1537
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1538
                if self.__doing_search():
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1539
                        return
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1540
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1541
                a11y_enabled = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1542
                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
  1543
                        a11y_enabled = True
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1544
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1545
                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
  1546
                if visible_range == None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1547
                        return
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1548
                a11y_start = start = visible_range[0][0]
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1549
                a11y_end = 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
  1550
                if debug_descriptions:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1551
                        print "Range Start: %d End: %d" % (start, end)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1552
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1553
                # 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
  1554
                # reduce the amount of processing to be done in that case.
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1555
                # We do not use it when getting descriptions as we may discard
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1556
                # description requests so we need a description request to
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1557
                # be for everything that is currently visible.
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1558
                # 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
  1559
                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
  1560
                        check_range = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1561
                        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
  1562
                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
  1563
                        check_range = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1564
                
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1565
                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
  1566
                        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
  1567
                                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
  1568
                                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
  1569
                                 # 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
  1570
                                 # 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
  1571
                                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
  1572
                                    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
  1573
                                        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
  1574
                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1575
                                        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
  1576
                                                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
  1577
                                                        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
  1578
                                                                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
  1579
                                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1580
                                                        a11y_start = old_end
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1581
                if debug_descriptions:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1582
                        print "Adjusted Range Start: %d End: %d" % (start, end)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1583
                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
  1584
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1585
                sort_filt_model = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1586
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1587
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1588
                model = filt_model.get_model() #gtk.ListStore
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1589
                sf_itr = sort_filt_model.get_iter_from_string(str(start))                
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1590
                pkg_stems_and_itr_to_fetch = {}
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1591
                while start <= end:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1592
                        filtered_itr = sort_filt_model.convert_iter_to_child_iter(None,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1593
                            sf_itr)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1594
                        app_itr = filt_model.convert_iter_to_child_iter(filtered_itr)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1595
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1596
                        desc = sort_filt_model.get_value(sf_itr,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1597
                            enumerations.DESCRIPTION_COLUMN)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1598
                        # Only Fetch description for packages without a
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1599
                        # description
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1600
                        if desc == '...':
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
  1601
                                pkg_fmri = sort_filt_model.get_value(sf_itr,
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1602
                                    enumerations.FMRI_COLUMN)
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
  1603
                                if pkg_fmri != 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
  1604
                                        pkg_stem = pkg_fmri.get_pkg_stem(
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1605
                                            include_scheme = True)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1606
                                        pkg_stems_and_itr_to_fetch[pkg_stem] = \
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1607
                                            model.get_string_from_iter(app_itr)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1608
                        start += 1
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1609
                        sf_itr = sort_filt_model.iter_next(sf_itr)
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1610
                if a11y_enabled:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1611
                        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
  1612
                            str(a11y_start))                
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1613
                        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
  1614
                                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
  1615
                                a11y_start += 1
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1616
                                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
  1617
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1618
                if debug_descriptions:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1619
                        print "PKGS to FETCH: \n%s" % pkg_stems_and_itr_to_fetch
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1620
                if len(pkg_stems_and_itr_to_fetch) > 0:
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1621
                        self.last_status_id += 1
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1622
                        self.description_queue.append((pkg_stems_and_itr_to_fetch,
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1623
                             model, self.last_status_id))
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1624
                        self.__start_description_thread()
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1625
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1626
        def __start_description_thread(self):
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1627
                if not self.description_thread_running:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1628
                        status_id = -1
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1629
                        model = None
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1630
                        stems = None
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1631
                        # Discard description requests except for the last two
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1632
                        while status_id + 1 < self.last_status_id:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1633
                                try:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1634
                                        stems, model, status_id = \
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1635
                                                self.description_queue.pop()
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1636
                                except IndexError:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1637
                                        return
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1638
                        Thread(target = self.__get_pkg_descriptions,
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1639
                            args = [stems, model, status_id]).start() 
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1640
                        self.description_thread_running = True
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1641
                    
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1642
        def __doing_search(self):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1643
                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
  1644
                
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1645
        def __get_pkg_descriptions(self, pkg_stems_and_itr_to_fetch, 
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1646
            orig_model, last_status_id):
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1647
                # Note: no need to aquire lock even though this is called
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1648
                # from a thread, it just creates an update job and dispatches it
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1649
                # to the idle handler; it does not modify any global state.
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1650
                info = None
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1651
                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
  1652
                        gobject.idle_add(self.__update_statusbar_message,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1653
                            _("Fetching descriptions..."))
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1654
                try:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1655
                        info = self.api_o.info(pkg_stems_and_itr_to_fetch.keys(), False,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1656
                                frozenset([api.PackageInfo.IDENTITY,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1657
                                    api.PackageInfo.SUMMARY]))
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
  1658
                except api_errors.TransportError, ex:
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
  1659
                        gobject.idle_add(self.update_statusbar)
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
  1660
                        err = str(ex)
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
  1661
                        gobject.idle_add(self.error_occurred, err,
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
  1662
                            None, gtk.MESSAGE_INFO)
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
  1663
                        gobject.idle_add(self.__restart_description_thread)
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
  1664
                        return
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
  1665
                except api_errors.InvalidDepotResponseException, ex:
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
  1666
                        gobject.idle_add(self.update_statusbar)
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
  1667
                        err = str(ex)
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
  1668
                        gobject.idle_add(self.error_occurred, err,
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
  1669
                            None, gtk.MESSAGE_INFO)
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
  1670
                        gobject.idle_add(self.__restart_description_thread)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1671
                        return
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1672
                if info and len(info.get(0)) == 0:
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
  1673
                        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
  1674
                        return
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1675
                pkg_infos = info.get(0)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1676
                pkg_descriptions_for_update = []
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1677
                for pkg_info in pkg_infos:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1678
                        short_fmri = fmri.PkgFmri(pkg_info.fmri).get_pkg_stem(
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1679
                            include_scheme = True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1680
                        pkg_descriptions_for_update.append((short_fmri,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1681
                            pkg_stems_and_itr_to_fetch[short_fmri],
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1682
                            pkg_info.summary))
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1683
                if debug_descriptions:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1684
                        print "FETCHED PKGS: \n%s" % pkg_descriptions_for_update
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1685
                gobject.idle_add(self.__update_description_from_iter,
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1686
                    pkg_descriptions_for_update, orig_model, last_status_id)
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1687
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
  1688
        def __restart_description_thread(self):
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
  1689
                self.description_thread_running = False
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
  1690
                self.__start_description_thread()
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
  1691
                return
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
  1692
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1693
        def __update_description_from_iter(self, pkg_descriptions_for_update, 
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1694
            orig_model, last_status_id):
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1695
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1696
                        return
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
  1697
                self.__restart_description_thread()
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1698
                if self.last_status_id > last_status_id + 1:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1699
                        return
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1700
                sort_filt_model = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1701
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1702
                if not sort_filt_model:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1703
                        return
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1704
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1705
                model = filt_model.get_model() #gtk.ListStore
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1706
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1707
                #If model has changed abandon description updates
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1708
                if orig_model != model:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1709
                        return
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1710
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
  1711
                #If doing a search or switching sources abandon description updates
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  1712
                if self.__doing_search() or self.in_setup:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1713
                        return
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1714
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1715
                if debug_descriptions:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1716
                        print "UPDATE DESCRIPTIONS: \n%s" % pkg_descriptions_for_update
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1717
                for pkg_stem, path, summary in pkg_descriptions_for_update:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1718
                        itr = model.get_iter_from_string(path)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1719
                        stored_pkg_fmri = model.get_value(itr, enumerations.FMRI_COLUMN)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1720
                        stored_pkg_stem = stored_pkg_fmri.get_pkg_stem(
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1721
                            include_scheme = True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1722
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1723
                        if pkg_stem != stored_pkg_stem:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1724
                                if debug:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1725
                                        print ("__update_description_from_iter(): "
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1726
                                            "model not consistent so abandoning "
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1727
                                            "these description updates.")
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1728
                                self.update_statusbar()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1729
                                return
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1730
                        model.set_value(itr, enumerations.DESCRIPTION_COLUMN, summary)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1731
                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
  1732
                        self.update_statusbar()
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1733
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1734
        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
  1735
                column = gtk.TreeViewColumn()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1736
                column.set_title(name)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1737
                #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
  1738
                #column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1739
                render_pixbuf = gtk.CellRendererPixbuf()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1740
                column.pack_start(render_pixbuf, expand = expand_pixbuf)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1741
                column.add_attribute(render_pixbuf, "pixbuf", enum_value)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1742
                column.set_fixed_width(32)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1743
                if set_data_func:
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1744
                        column.set_cell_data_func(render_pixbuf,
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1745
                            self.cell_data_function, None)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1746
                return column
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1747
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1748
        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
  1749
                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
  1750
                        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
  1751
                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
  1752
                        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
  1753
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1754
        def __disconnect_repository_model(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1755
                self.w_repository_combobox.set_model(None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1756
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1757
        @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
  1758
        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
  1759
                get_val = treemodel.get_value
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1760
                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
  1761
                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
  1762
                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
  1763
                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
  1764
                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
  1765
                        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
  1766
                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
  1767
                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
  1768
                return cmp(name1, name2)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1769
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1770
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1771
        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
  1772
                columns = treeview.get_columns()
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1773
                if columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1774
                        for column in columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1775
                                treeview.remove_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1776
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1777
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1778
        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
  1779
                '''This function is for initializing the sections list'''
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1780
                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
  1781
                # 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
  1782
                # 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
  1783
                # 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
  1784
                section_list.append([0, _('All Categories'), enabled ])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1785
                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
  1786
                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
  1787
                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
  1788
                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
  1789
                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
  1790
                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
  1791
                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
  1792
                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
  1793
                section_list.append([8, _('Web Services'), enabled ])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1794
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1795
        def __init_show_filter(self):
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1796
                max_length = 0
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1797
                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
  1798
                        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
  1799
                        if filter_id == -1:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1800
                                continue
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1801
                        max_length = self.__get_max_text_length(
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1802
                            max_length, label, self.w_filter_combobox)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1803
                
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1804
                if self.initial_show_filter >= enumerations.FILTER_ALL and \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1805
                    self.initial_show_filter < len(self.filter_list):
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1806
                        row = self.filter_list[self.initial_show_filter]
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1807
                        if row[enumerations.SECTION_ID] != self.initial_show_filter:
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1808
                                self.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
  1809
                else:
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1810
                        self.initial_show_filter = enumerations.FILTER_ALL
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1811
                return max_length
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1812
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1813
        @staticmethod
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1814
        def __get_max_text_length(length_to_check, text, widget):
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1815
                if widget == 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
  1816
                        return 0
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1817
                context = widget.get_pango_context()
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1818
                metrics = context.get_metrics(context.get_font_description())
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1819
                current_length = pango.PIXELS(
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1820
                    metrics.get_approximate_char_width() * len(text))
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1821
                if current_length > length_to_check:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1822
                        return current_length
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1823
                else:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1824
                        return length_to_check
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1825
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
  1826
        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
  1827
                if self.is_busy_cursor_set():
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
  1828
                        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
  1829
                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
  1830
                        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
  1831
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1832
        def __on_mainwindow_delete_event(self, widget, event):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1833
                ''' handler for delete event of the main window '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1834
                if self.__check_if_something_was_changed() == True:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1835
                        # XXX Change this to not quit and show dialog
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1836
                        # XXX if some changes were applied:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1837
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1838
                        return True
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1839
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1840
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1841
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1842
        def __on_mainwindow_check_resize(self, widget):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1843
                if widget and self.gdk_window:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1844
                        status_height = self.w_statusbar_hbox.get_allocation().height
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1845
                        self.gdk_window.move_resize(0, 0, widget.get_size()[0],
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1846
                            widget.get_size()[1]-status_height)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1847
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1848
        def __on_api_search_error_delete_event(self, widget, event):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1849
                self.__on_api_search_button_clicked(None)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1850
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1851
        def __on_api_search_button_clicked(self, widget):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1852
                self.api_search_error_dialog.hide()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  1853
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1854
        def __on_file_quit_activate(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1855
                ''' handler for quit menu event '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1856
                self.__on_mainwindow_delete_event(None, None)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1857
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  1858
        def __on_ua_completed_close(self, widget):
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  1859
                self.w_ua_completed_dialog.hide()
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  1860
                self.__on_mainwindow_delete_event(None, None)
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  1861
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1862
        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
  1863
                ''' 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
  1864
                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
  1865
                    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
  1866
                    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
  1867
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1868
        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
  1869
                ''' 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
  1870
                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
  1871
                    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
  1872
                    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
  1873
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1874
        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
  1875
                ''' 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
  1876
                beadm.Beadmin(self)
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1877
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1878
        def __on_searchentry_changed(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
  1879
                if widget.get_text_length() > 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
  1880
                        self.search_text_style != enumerations.SEARCH_STYLE_PROMPT:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1881
                        if self.entry_embedded_icons_supported:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1882
                                self.w_searchentry.set_property("secondary-icon-stock", 
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1883
                                    gtk.STOCK_CANCEL)
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1884
                                self.w_searchentry.set_property(
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1885
                                   "secondary-icon-sensitive", True)
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  1886
                        self.w_clear_search_menuitem.set_sensitive(True)
894
16698758b366 6974 Behavior of Clear Search (Brush Icon)
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 893
diff changeset
  1887
                else:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1888
                        if self.entry_embedded_icons_supported:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1889
                                self.w_searchentry.set_property("secondary-icon-stock", 
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1890
                                    None)
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  1891
                        self.w_clear_search_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
  1892
                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
  1893
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1894
        def __update_statusbar_for_search(self):
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1895
                if self.is_all_publishers:
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1896
                        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
  1897
                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
  1898
                        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
  1899
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1900
        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
  1901
                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
  1902
                        try:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1903
                                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
  1904
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1905
                        except AttributeError:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1906
                                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
  1907
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1908
                        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
  1909
        
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1910
        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
  1911
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1912
                        return
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1913
                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
  1914
                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
  1915
                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
  1916
                        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
  1917
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1918
        def __setup_before_all_publishers_mode(self):
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1919
                self.is_all_publishers = True
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1920
                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
  1921
                self.__set_searchentry_to_prompt()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1922
                
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1923
                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
  1924
                first_run = self.first_run
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1925
                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
  1926
                # Show the Search all page if not showing the Start Page on startup
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  1927
                show_search_all_page = not first_run or (first_run 
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  1928
                    and not self.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
  1929
                if show_search_all_page:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1930
                        gobject.idle_add(self.__setup_search_all_page)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1931
                elif self.show_startpage:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1932
                        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
  1933
                            NOTEBOOK_START_PAGE)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1934
                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
  1935
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1936
        def __set_searchentry_to_prompt(self):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1937
                if not self.first_run and self.search_text_style != \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1938
                        enumerations.SEARCH_STYLE_PROMPT:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1939
                        self.__set_search_text_mode(enumerations.SEARCH_STYLE_PROMPT)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1940
  
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1941
        def __setup_search_all_page(self):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1942
                header = INFORMATION_PAGE_HEADER
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1943
                header += _("alt='[Information]' title='Information' ALIGN='bottom'></TD>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1944
                    "<TD><h3><b>Search All Publishers</b></h3><TD></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1945
                    "<TR><TD></TD><TD> Use the Search field to search for packages "
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1946
                    "within the following Publishers:</TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1947
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1948
                body = "<TR><TD></TD><TD>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1949
                pub_browse_list = ""
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1950
                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
  1951
                for pub 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
  1952
                        pub_name = pub[enumerations.REPOSITORY_NAME]
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1953
                        if (pub_name and pub_name not in self.publisher_options.values()):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1954
                                body += "<li style='padding-left:7px'>%s</li>" % 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
  1955
                                pub_browse_list += "<li style='padding-left:7px'><a href="
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1956
                                pub_browse_list += "'pm?pm-action=internal&search=%s" % \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1957
                                        INTERNAL_SEARCH_VIEW_PUB
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1958
                                pub_browse_list += " <b>%s</b>'>%s</a></li>" % \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1959
                                        (pub_name, 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
  1960
                body += "<TD></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1961
                body += _("<TR><TD></TD><TD></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1962
                    "<TR><TD></TD><TD>Click on the Publishers below to view their list "
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1963
                    "of packages:</TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1964
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1965
                body += "<TR><TD></TD><TD>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1966
                body += pub_browse_list
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1967
                body += "<TD></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1968
                footer = "</table>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1969
                self.__link_load_page(header + body + footer)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1970
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1971
                    
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1972
        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
  1973
                header = INFORMATION_PAGE_HEADER
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1974
                active_filter = self.w_filter_combobox.get_active()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1975
                header += _("alt='[Information]' title='Information' ALIGN='bottom'></TD>"
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1976
                    "<TD><h3><b>Search Results</b></h3><TD></TD></TR><TR><TD></TD><TD>")
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1977
                header += ngettext(
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1978
                    "Found <b>%(num)s</b> package matching <b>%(text)s</b> "
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1979
                    "in All Packages, however it is not listed in the "
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1980
                    "<b>%(filter)s</b> View.",
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1981
                    "Found <b>%(num)s</b> packages matching <b>%(text)s</b> "
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1982
                    "in All Packages, however they are not listed in the "
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1983
                    "<b>%(filter)s</b> View.", num) % {"num": num, "text": text,
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1984
                    "filter": self.__get_filter_combobox_description(active_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
  1985
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1986
                body = _("<TR><TD></TD><TD<TD></TD></TR><TR><TD></TD><TD<TD></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1987
                    "<TR><TD></TD><TD<TD><b>Suggestions:</b><br></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1988
                    "<TR><TD></TD><TD<TD>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1989
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1990
                body += _("<li style='padding-left:7px'>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1991
                    "Click to change View to <a href='pm?pm-action=internal&"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1992
                    "search=%s'>All Packages</a></li>") % INTERNAL_SEARCH_VIEW_ALL
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1993
                footer = "</TD></TR></table>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1994
                self.__link_load_page(header + body + footer)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1995
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1996
                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
  1997
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1998
        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
  1999
                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
  2000
                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
  2001
                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
  2002
                        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
  2003
                                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
  2004
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2005
                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
  2006
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2007
        def __setup_search_zero_results_page(self, pub, text):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2008
                header = INFORMATION_PAGE_HEADER
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2009
                header += _("alt='[Information]' title='Information' ALIGN='bottom'></TD>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2010
                    "<TD><h3><b>Search Results</b></h3><TD></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2011
                    "<TR><TD></TD><TD>No packages found in <b>%(pub)s</b> "
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2012
                    "matching <b>%(text)s</b></TD></TR>") % {"pub": pub, "text": text}
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2013
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2014
                body = _("<TR><TD></TD><TD<TD></TD></TR><TR><TD></TD><TD<TD></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2015
                    "<TR><TD></TD><TD<TD><b>Suggestions:</b><br></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2016
                    "<TR><TD></TD><TD<TD>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2017
                    "<li style='padding-left:7px'>Check your spelling</li>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2018
                    "<li style='padding-left:7px'>Try new search terms</li>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2019
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2020
                if not self.is_all_publishers:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2021
                        body += _("<li style='padding-left:7px'>Search for <b>%(text)s"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2022
                            "</b> within <a href='pm?pm-action=internal&search="
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2023
                            "%(all_pubs)s'>All Publishers</a></li>")  % \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2024
                            {"text": text, "all_pubs": INTERNAL_SEARCH_ALL_PUBS}
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2025
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2026
                body += _("<li style='padding-left:7px'>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2027
                    "See <a href='pm?pm-action=internal&search="
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2028
                    "%s'>Search Help</a></li></TD></TR>") % INTERNAL_SEARCH_HELP
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2029
                footer = "</table>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2030
                self.__link_load_page(header + body + footer)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2031
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2032
                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
  2033
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2034
        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
  2035
                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
  2036
                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
  2037
                        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
  2038
                        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
  2039
                        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
  2040
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2041
        def __setup_search_wildcard_page(self):
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2042
                header = _(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2043
                    "<table border='0' cellpadding='3' style='table-layout:fixed' >"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2044
                    "<TR><TD><IMG SRC = 'dialog-warning.png' style='border-style: "
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2045
                    "none' alt='[Warning]' title='Warning' ALIGN='bottom'></TD>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2046
                    "<TD><h3><b>Search Warning</b></h3><TD></TD></TR>"
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2047
                    "<TR><TD></TD><TD>Search using only the wildcard character, "
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2048
                    "<b>*</b>, is not supported in All Publishers</TD></TR>"
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2049
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2050
                body = _("<TR><TD></TD><TD<TD></TD></TR><TR><TD></TD><TD<TD></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2051
                    "<TR><TD></TD><TD<TD><b>Suggestions:</b><br></TD></TR>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2052
                    "<TR><TD></TD><TD<TD>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2053
                    "<li style='padding-left:7px'>Try new search terms</li>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2054
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2055
                body += _("<li style='padding-left:7px'>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2056
                    "See <a href='pm?pm-action=internal&search="
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2057
                    "%s'>Search Help</a></li></TD></TR>") % INTERNAL_SEARCH_HELP
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2058
                footer = "</table>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2059
                self.__link_load_page(header + body + footer)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2060
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2061
                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
  2062
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2063
        def __clear_before_search(self, show_list=True):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2064
                self.in_setup = True
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2065
                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
  2066
                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
  2067
                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
  2068
                self.__init_tree_views(application_list, None, None)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2069
                self.__unselect_category()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2070
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2071
        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
  2072
                self.in_search_mode = False
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2073
                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
  2074
                self.w_infosearch_frame.hide()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2075
                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
  2076
                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
  2077
                    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
  2078
                        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
  2079
                            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
  2080
                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
  2081
                # Reset MARK_COLUMN        
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2082
                for pkg in self.saved_application_list:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2083
                        pub = pkg[enumerations.PUBLISHER_COLUMN]
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2084
                        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
  2085
                        marked = False
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2086
                        pkgs = None
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2087
                        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
  2088
                                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
  2089
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2090
                                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
  2091
                                        marked = True
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
  2092
                        # When switching after Manage Repository dialog
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2093
                        # 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
  2094
                        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
  2095
                                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
  2096
                if 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
  2097
                        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
  2098
                            None, None,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2099
                            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
  2100
                            self.saved_application_list_sort)
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  2101
                        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
  2102
                else:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2103
                        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
  2104
                            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
  2105
                            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
  2106
                            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
  2107
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2108
                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
  2109
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2110
        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
  2111
                #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
  2112
                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
  2113
                        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
  2114
                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
  2115
                        self.__get_active_section_and_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
  2116
                self.pylintstub = 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
  2117
                self.saved_section_active = selected_section
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2118
                self.saved_application_list = self.application_list
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2119
                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
  2120
                        self.application_list_sort
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2121
                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
  2122
                        self.application_list_filter
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2123
                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
  2124
                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
  2125
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2126
                pub_index = self.w_repository_combobox.get_active()
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2127
                if pub_index != self.repo_combobox_all_pubs_index and \
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2128
                        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
  2129
                        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
  2130
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2131
        def __do_search(self, widget=None, ev=None):
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2132
                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
  2133
                if self.search_text_style == enumerations.SEARCH_STYLE_PROMPT or \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2134
                        self.w_searchentry.get_text_length() == 0:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2135
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2136
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2137
                txt = self.w_searchentry.get_text()
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2138
                if len(txt.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
  2139
                        self.w_searchentry.set_text("")
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2140
                        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
  2141
                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
  2142
                contains_asterix_only = False
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2143
                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
  2144
                        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
  2145
                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
  2146
                        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
  2147
                        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
  2148
                        if self.is_all_publishers:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2149
                                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
  2150
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2151
                                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
  2152
                                        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
  2153
                                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
  2154
                                        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
  2155
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2156
                if not self.is_all_publishers:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2157
                        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
  2158
                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
  2159
                self.__set_focus_on_searchentry()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2160
                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
  2161
                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
  2162
                        
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2163
                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
  2164
                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
  2165
                Thread(target = self.__do_api_search,
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2166
                    args = (self.is_all_publishers, )).start()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2167
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
  2168
        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
  2169
                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
  2170
                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
  2171
                        return None, (0,)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2172
                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
  2173
                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
  2174
                        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
  2175
                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
  2176
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2177
        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
  2178
                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
  2179
                if 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
  2180
                        self.category_active_paths[self.last_visible_publisher] = path
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2181
                        selection.unselect_all()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2182
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2183
        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
  2184
                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
  2185
                self.search_time_sec = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2186
                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
  2187
                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
  2188
                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
  2189
                self.in_setup = False
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2190
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
  2191
        @staticmethod
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2192
        def __get_origin_uri(repo):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2193
                if repo == None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2194
                        return None
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2195
                origin_uri = repo.origins[0]
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2196
                ret_uri = None
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2197
                if isinstance(origin_uri, str):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2198
                        if len(origin_uri) > 0:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2199
                                ret_uri = origin_uri.strip("/")
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2200
                elif isinstance(origin_uri, publisher.RepositoryURI):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2201
                        uri = origin_uri.uri
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2202
                        if uri != None and len(uri) > 0:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2203
                                ret_uri = uri.strip("/")
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2204
                return ret_uri
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2205
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2206
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2207
        def __do_api_search(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
  2208
                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
  2209
                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
  2210
                self.search_time_sec = 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
  2211
                text = self.w_searchentry.get_text()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2212
                # 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
  2213
                searches = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2214
                servers = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2215
                result = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2216
                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
  2217
                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
  2218
                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
  2219
                if search_all:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2220
                        servers = None
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2221
                        pub_prefix = self.api_o.get_preferred_publisher()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2222
                else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2223
                        pub_prefix = self.__get_selected_publisher()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2224
                        if pub_prefix != None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2225
                                pub = self.api_o.get_publisher(prefix=pub_prefix)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2226
                        else:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2227
                                pub = self.api_o.get_preferred_publisher()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2228
                        origin_uri = self.__get_origin_uri(pub.selected_repository)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2229
                        servers.append({"origin": origin_uri})
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2230
                if debug:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2231
                        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
  2232
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2233
                #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
  2234
                case_sensitive = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2235
                return_actions = True
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2236
                searches.append(self.api_o.remote_search(
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2237
                    [api.Query(" ".join(pargs), case_sensitive, return_actions)],
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2238
                    servers=servers))
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2239
                if debug:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2240
                        print "Search Args: %s : cs: %s : retact: %s" % \
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2241
                                ("".join(pargs), case_sensitive, return_actions)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2242
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2243
                last_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
  2244
                self.search_all_pub_being_searched = pub_prefix
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2245
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2246
                # 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
  2247
                sort_col = enumerations.NAME_COLUMN
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2248
                try:
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
  2249
                        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
  2250
                            itertools.chain(*searches):
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2251
                                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
  2252
                                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2253
                                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2254
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
  2255
                                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
  2256
                                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
  2257
                                    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
  2258
                                        active_pub = pub["prefix"]
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2259
                                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
  2260
                                if last_name != name:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2261
                                        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
  2262
                                                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
  2263
                                                    % (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
  2264
                                        a_res = name, active_pub
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2265
                                        result.append(a_res)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2266
                                        #Ignore Status when fetching
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2267
                                        application_list = \
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2268
                                                self.__get_min_list_from_search(result)
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
  2269
                                        self.search_all_pub_being_searched = active_pub
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2270
                                        self.in_setup = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2271
                                        gobject.idle_add(self.__init_tree_views, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2272
                                            application_list, None, None, None, None,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2273
                                            sort_col)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2274
                                last_name = name
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2275
                                self.pylintstub = query_num
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2276
                except api_errors.ProblematicSearchServers, ex:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2277
                        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
  2278
                        gobject.idle_add(self.__handle_api_search_error)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2279
                        if len(result) == 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
  2280
                                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
  2281
                                        self.__process_after_search_with_zero_results(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2282
                                                _("All Publishers"), text)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2283
                                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2284
                                        self.__process_after_search_with_zero_results(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2285
                                                pub_prefix, text)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2286
                                return
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2287
                except api_errors.CanceledException:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2288
                        # TBD. Currently search is not cancelable
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2289
                        # so this should not happen, but the logic is in place
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2290
                        # to support cancelable search.
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
  2291
                        gobject.idle_add(self.unset_busy_cursor)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2292
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2293
                except Exception, ex:
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2294
                        # We are not interested in this error
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2295
                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2296
                        return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2297
                if debug:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2298
                        print "Number of search results:", len(result)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2299
                if len(result) == 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2300
                        if debug:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2301
                                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
  2302
                        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
  2303
                                self.__process_after_search_with_zero_results(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2304
                                        _("All Publishers"), text)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2305
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2306
                                self.__process_after_search_with_zero_results(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2307
                                        pub_prefix, text)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2308
                        return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2309
                # We cannot get status of the packages if catalogs have not
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2310
                # been loaded so we pause for up to 5 seconds here to
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2311
                # allow catalogs to be loaded
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2312
                times = 5
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2313
                while self.catalog_loaded == False:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2314
                        if times == 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2315
                                break
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2316
                        time.sleep(1)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2317
                        times -= 1
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2318
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2319
                #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
  2320
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  2321
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2322
                self.in_setup = True
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2323
                application_list = self.__get_full_list_from_search(result)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2324
                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
  2325
                        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
  2326
                        if debug:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2327
                                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
  2328
                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
  2329
                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
  2330
                    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
  2331
                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
  2332
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2333
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2334
                if search_all:
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2335
                        gobject.idle_add(self.__check_zero_results_afterfilter, text,
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2336
                            len(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
  2337
                else:
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2338
                        gobject.idle_add(self.__check_zero_results_afterfilter, text,
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2339
                            len(application_list))
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2340
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2341
        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
  2342
                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
  2343
                        return
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2344
                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
  2345
                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
  2346
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2347
        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
  2348
                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
  2349
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2350
        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
  2351
                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
  2352
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2353
        def __process_after_search_with_zero_results(self, pub, text):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2354
                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
  2355
                        self.search_time_sec = 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
  2356
                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
  2357
                gobject.idle_add(self.__setup_search_zero_results_page, pub, text)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2358
                self.in_setup = True
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2359
                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
  2360
                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
  2361
                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
  2362
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2363
        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
  2364
                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
  2365
                for name, pub in search_result:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2366
                        application_list.append(
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2367
                            [False, None, name, '...', enumerations.NOT_INSTALLED, 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
  2368
                            "pkg://" + pub + "/" + name, None, True, 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
  2369
                            pub])
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2370
                return application_list
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2371
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2372
        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
  2373
                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
  2374
                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
  2375
                    application_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2376
                return application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2377
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2378
        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
  2379
            application_list):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2380
                pargs = []
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
  2381
                for name, pub in search_result:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2382
                        pargs.append("pkg://" + pub + "/" + name)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2383
                # We now need to get the status for each package
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2384
                if debug_descriptions:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2385
                        print "pargs:", pargs
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2386
                try:
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  2387
                        pkgs_known = self.__get_inventory_list(pargs,
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2388
                            True, True)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2389
                except api_errors.InventoryException:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2390
                        # This can happen if load_catalogs has not been run
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2391
                        err = _("Unable to get status for search results.\n"
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2392
                            "The catalogs have not been loaded.\n"
1380
c647827de695 10657 Problem with error message after package search from Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1373
diff changeset
  2393
                            "Please try again after a few seconds.\n")
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  2394
                        gobject.idle_add(self.error_occurred, err)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2395
                        return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2396
                return self.__add_pkgs_to_lists(pkgs_known, application_list,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2397
                    None, None)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2398
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2399
        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
  2400
                ''' 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
  2401
                performance when assistive technologies are enabled'''
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2402
                if self.in_setup:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2403
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2404
                self.application_refilter_id = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2405
                self.application_refilter_idle_id = 0
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2406
                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
  2407
                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
  2408
                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
  2409
                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
  2410
                self.application_list_filter.refilter()
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  2411
                self.application_list_sort.set_sort_column_id(app_id, order)
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2412
                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
  2413
                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
  2414
                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
  2415
                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
  2416
                        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
  2417
                            self.__set_visible_status)
864
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  2418
                self.categories_treeview_initialized = True
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  2419
                self.categories_treeview_range = 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
  2420
                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
  2421
                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
  2422
                        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
  2423
                        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
  2424
                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
  2425
                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
  2426
                self.__enable_disable_install_remove()
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2427
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2428
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2429
        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
  2430
                self.w_searchentry.paste_clipboard()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2431
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  2432
        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
  2433
                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
  2434
                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
  2435
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2436
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2437
        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
  2438
                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
  2439
                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
  2440
                        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
  2441
                        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
  2442
                elif self.__is_a_textview(focus_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
  2443
                        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
  2444
                            self.w_main_clipboard)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2445
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2446
        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
  2447
                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
  2448
                self.w_paste_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2449
1243
d1f303f7dd86 9858 Need to get focus in package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1236
diff changeset
  2450
        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
  2451
                if self.w_main_view_notebook.get_current_page() == NOTEBOOK_START_PAGE:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2452
                        if self.view:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2453
                                self.view.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
  2454
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2455
                        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
  2456
                        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
  2457
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2458
        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
  2459
                self.w_searchentry.grab_focus()
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2460
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2461
        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
  2462
                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
  2463
                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
  2464
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
  2465
        def __clear_search_results(self):
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2466
                # Only clear out search results
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2467
                if self.in_search_mode or self.is_all_publishers:
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2468
                        self.__clear_before_search()
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2469
                        self.__update_statusbar_message(_("Search cleared"))
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2470
                if self.is_all_publishers:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2471
                        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
  2472
                                != NOTEBOOK_START_PAGE:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2473
                                gobject.idle_add(self.__setup_search_all_page)
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2474
                else:
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  2475
                        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
  2476
                return
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2477
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2478
        def __on_progress_cancel_clicked(self, widget):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2479
                Thread(target = self.api_o.cancel, args = ()).start()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2480
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2481
        def __on_startpage(self, widget):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2482
                self.__load_startpage()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2483
                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
  2484
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
  2485
        def __on_notebook_change(self, widget, event, pagenum):
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  2486
                if (pagenum == INFO_NOTEBOOK_LICENSE_PAGE and 
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  2487
                    not self.showing_empty_details):
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
  2488
                        licbuffer = self.w_license_textview.get_buffer()
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  2489
                        leg_txt = _("Fetching legal information...")
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
  2490
                        licbuffer.set_text(leg_txt)
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  2491
                        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
  2492
                                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
  2493
                                self.show_licenses_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
  2494
                        self.last_show_licenses_id = self.show_licenses_id = \
1183
05f2a75fdcdf 9558 Support for typeahead search in Package Manager should be removed
John Rice <john.rice@sun.com>
parents: 1179
diff changeset
  2495
                            gobject.timeout_add(SHOW_LICENSE_DELAY,
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  2496
                                self.__show_licenses)
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
  2497
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
  2498
        def __is_a_textview(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
  2499
                if (widget == self.w_generalinfo_textview or
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2500
                    widget == self.w_installedfiles_textview or
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2501
                    widget == self.w_dependencies_textview or
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2502
                    widget == self.w_license_textview):
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2503
                        return 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
  2504
                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
  2505
                        return False
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2506
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2507
        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
  2508
                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
  2509
                if self.__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
  2510
                        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
  2511
                        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
  2512
                        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
  2513
                        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
  2514
                        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
  2515
                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
  2516
                        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
  2517
                                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
  2518
                        else:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2519
                                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
  2520
                        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
  2521
                        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
  2522
                        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
  2523
                        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
  2524
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2525
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2526
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2527
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2528
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2529
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2530
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2531
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2532
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2533
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2534
                            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
  2535
                        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
  2536
                        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
  2537
                                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
  2538
                        else:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2539
                                filtered_iter = \
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2540
                                        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
  2541
                                            iter_next)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2542
                                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
  2543
                                    filtered_iter)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2544
                                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
  2545
                                        list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2546
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2547
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2548
                        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
  2549
                        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
  2550
                        if select_all and not mark_value:
929
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2551
                                model.set_value(itr, enumerations.MARK_COLUMN, True)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2552
                                pkg_stem = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2553
                                    enumerations.STEM_COLUMN)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2554
                                pkg_status = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2555
                                    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
  2556
                                pkg_publisher = 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
  2557
                                    enumerations.PUBLISHER_COLUMN)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2558
                                self.__add_pkg_stem_to_list(pkg_stem, 
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2559
                                    pkg_status, pkg_publisher)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2560
                        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
  2561
                                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
  2562
                                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
  2563
                                    enumerations.STEM_COLUMN)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2564
                                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
  2565
                
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2566
                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
  2567
                self.w_deselect_menuitem.set_sensitive(select_all)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2568
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2569
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2570
                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
  2571
                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
  2572
                        
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2573
        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
  2574
                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
  2575
                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
  2576
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2577
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2578
        def __on_select_updates(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2579
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2580
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2581
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2582
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2583
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2584
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2585
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2586
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2587
                        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
  2588
                            iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2589
                        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
  2590
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2591
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2592
                            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
  2593
                        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
  2594
                        if model.get_value(app_iter, \
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  2595
                            enumerations.STATUS_COLUMN) == enumerations.UPDATABLE:
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  2596
                                list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2597
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2598
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2599
                        itr = model.get_iter(path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2600
                        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
  2601
                        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
  2602
                        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
  2603
                        pkg_publisher = 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
  2604
                            enumerations.PUBLISHER_COLUMN)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2605
                        self.__add_pkg_stem_to_list(pkg_stem, pkg_status, pkg_publisher)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2606
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2607
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2608
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2609
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2610
        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
  2611
                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
  2612
                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
  2613
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2614
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2615
        def __save_state_changed(self, client, connection_id, entry, arguments):
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2616
                self.save_state = entry.get_value().get_bool()
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2617
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2618
        def __on_preferences(self, widget):
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2619
                self.w_startpage_checkbutton.set_active(self.show_startpage)
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2620
                self.w_exit_checkbutton.set_active(self.save_state)
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2621
                self.w_preferencesdialog.show()
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2622
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2623
        def __on_preferencesclose_clicked(self, widget):
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2624
                self.w_preferencesdialog.hide()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  2625
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2626
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2627
        def __on_preferenceshelp_clicked(widget):
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2628
                gui_misc.display_help("pm_win")
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  2629
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2630
        def __on_startpage_checkbutton_toggled(self, widget):
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2631
                self.show_startpage = self.w_startpage_checkbutton.get_active()
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2632
                try:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2633
                        self.client.set_bool(SHOW_STARTPAGE_PREFERENCES,
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2634
                            self.show_startpage)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2635
                except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2636
                        pass
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2637
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2638
        def __on_exit_checkbutton_toggled(self, widget):
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2639
                self.save_state = self.w_exit_checkbutton.get_active()
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2640
                try:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2641
                        self.client.set_bool(SAVE_STATE_PREFERENCES,
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2642
                            self.save_state)
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2643
                except GError:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2644
                        pass
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2645
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2646
        def __on_api_search_checkbox_toggled(self, widget):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2647
                active = self.api_search_checkbox.get_active()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2648
                if len(self.current_repos_with_search_errors) > 0:
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2649
                        if active:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2650
                                for pub, err_type, err_str in \
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2651
                                        self.current_repos_with_search_errors:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2652
                                        if pub not in self.gconf_not_show_repos:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2653
                                                self.gconf_not_show_repos += 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
  2654
                                        self.pylintstub = err_type
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2655
                                        self.pylintstub = err_str
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2656
                        else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2657
                                for pub, err_type, err_str in \
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2658
                                        self.current_repos_with_search_errors:
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2659
                                        self.gconf_not_show_repos = \
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2660
                                            self.gconf_not_show_repos.replace(
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2661
                                            pub + ",", "")
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2662
                        try:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2663
                                self.client.set_string(API_SEARCH_ERROR_PREFERENCES,
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2664
                                    self.gconf_not_show_repos)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2665
                        except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2666
                                pass
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2667
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2668
        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
  2669
                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
  2670
                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
  2671
                        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
  2672
                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
  2673
                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
  2674
                        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
  2675
                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
  2676
                        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
  2677
                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
  2678
                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
  2679
                        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
  2680
                        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
  2681
                        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
  2682
                                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
  2683
                        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
  2684
                        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
  2685
                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
  2686
                        self.w_deselect_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2687
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2688
        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
  2689
                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
  2690
                        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
  2691
                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
  2692
                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
  2693
                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
  2694
                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
  2695
                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
  2696
                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
  2697
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2698
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
  2699
        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
  2700
                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
  2701
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2702
        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
  2703
                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
  2704
                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
  2705
                if bounds:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2706
                        #enable selection functions
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2707
                        self.w_cut_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2708
                        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
  2709
                        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
  2710
                        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
  2711
                                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
  2712
                        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
  2713
                                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
  2714
                        self.w_deselect_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2715
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2716
                        self.w_cut_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2717
                        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
  2718
                        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
  2719
                        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
  2720
                        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
  2721
                                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
  2722
                        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
  2723
                                self.w_selectall_menuitem.set_sensitive(True)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  2724
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2725
        def __refilter_on_idle(self):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2726
                if self.application_refilter_id != 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2727
                        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
  2728
                        self.application_refilter_id = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2729
                if self.application_refilter_idle_id == 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2730
                        self.application_refilter_idle_id = gobject.idle_add(
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2731
                            self.__application_refilter)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2732
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2733
        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
  2734
                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
  2735
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2736
        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
  2737
                '''This function is for handling category double click activations'''
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2738
                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
  2739
                        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
  2740
                        return
1122
cf87b7d8fe39 8888 Gtk warning emitted on Reload
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1109
diff changeset
  2741
                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
  2742
                        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
  2743
                            self.saved_filter_combobox_active)
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2744
                if self.in_search_mode or self.is_all_publishers:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2745
                        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
  2746
                        return
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2747
                self.__set_main_view_package_list()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2748
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2749
                self.__refilter_on_idle()
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2750
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2751
        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
  2752
                # 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
  2753
                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
  2754
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2755
                if show_list:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2756
                        self.w_main_view_notebook.set_current_page(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2757
                                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
  2758
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2759
                        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
  2760
                                NOTEBOOK_START_PAGE)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2761
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
  2762
        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
  2763
                self.w_categories_treeview.set_cursor(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
  2764
                self.category_expanded_paths[(self.last_visible_publisher, path)] = 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
  2765
                self.category_active_paths[self.last_visible_publisher] = 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
  2766
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2767
        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
  2768
                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
  2769
                        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
  2770
                self.w_categories_treeview.set_cursor(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
  2771
                self.category_expanded_paths[(self.last_visible_publisher, 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
  2772
                self.category_active_paths[self.last_visible_publisher] = 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
  2773
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2774
        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
  2775
                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
  2776
                        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
  2777
                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
  2778
                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
  2779
                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
  2780
                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
  2781
                        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
  2782
                        cellx = pthinfo[2]
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2783
                        #Ignore clicks on row toggle icon which is 16 pixels wide
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2784
                        if cellx <= 16:
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2785
                                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
  2786
                        #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
  2787
                        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
  2788
                        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
  2789
                                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
  2790
                                        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
  2791
                                        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
  2792
                                        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
  2793
                                            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
  2794
                                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
  2795
                                        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
  2796
                                                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
  2797
                                        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
  2798
                                                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
  2799
                                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
  2800
                                        tree_view.expand_row(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
  2801
                                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
  2802
                                        = 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
  2803
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2804
        def __on_category_selection_changed(self, selection, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2805
                '''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
  2806
                if self.in_setup:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2807
                        return
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  2808
                model, itr = selection.get_selected()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  2809
                if itr:
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
  2810
                        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
  2811
                                model.get_path(itr)
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2812
                if self.in_search_mode or self.is_all_publishers:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2813
                        return
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2814
                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
  2815
                        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
  2816
                            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
  2817
                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
  2818
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  2819
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2820
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2821
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2822
        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
  2823
            keyboard_mode, tooltip):
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2824
                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
  2825
                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
  2826
                if not info:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2827
                        return False
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2828
                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
  2829
                    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
  2830
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2831
        @staticmethod
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2832
        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
  2833
                tip = ""
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2834
                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
  2835
                        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
  2836
                        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
  2837
                                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
  2838
                        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
  2839
                        if row:
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2840
                                status = row[enumerations.STATUS_COLUMN]
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2841
                                if status == enumerations.INSTALLED:
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2842
                                        tip = _("Installed")
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2843
                                elif status == enumerations.NOT_INSTALLED:
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2844
                                        tip = _("Not installed")
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2845
                                elif status == enumerations.UPDATABLE:
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2846
                                        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
  2847
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  2848
                if tip != "":
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2849
                        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
  2850
                        tooltip.set_text(tip)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2851
                        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
  2852
                else:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  2853
                        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
  2854
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
  2855
        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
  2856
                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
  2857
                        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
  2858
                        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
  2859
                                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
  2860
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
  2861
                        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
  2862
                                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
  2863
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2864
                        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
  2865
                        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
  2866
                                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
  2867
                        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
  2868
                        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
  2869
                                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
  2870
                        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
  2871
                        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
  2872
                        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
  2873
                        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
  2874
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2875
                        #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
  2876
                        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
  2877
                        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
  2878
                            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
  2879
                        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
  2880
                        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
  2881
                        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
  2882
                        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
  2883
                        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
  2884
                            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
  2885
                            curr_time, popup_position)
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2886
                        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
  2887
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2888
                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
  2889
                        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
  2890
                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
  2891
                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
  2892
                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
  2893
                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
  2894
                        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
  2895
                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
  2896
                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
  2897
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2898
                #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
  2899
                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
  2900
                        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
  2901
                        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
  2902
                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
  2903
                        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
  2904
                        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
  2905
                        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
  2906
                        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
  2907
                            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
  2908
                        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
  2909
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2910
        @staticmethod
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2911
        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
  2912
                #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
  2913
                #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
  2914
                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
  2915
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
  2916
                #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
  2917
                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
  2918
861
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  2919
        def __process_package_selection(self):
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  2920
                model, itr = self.package_selection.get_selected()
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
  2921
                if self.show_info_id != 0:
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  2922
                        gobject.source_remove(self.show_info_id)
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  2923
                        self.show_info_id = 0
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2924
                if itr:
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  2925
                        self.selected_pkgstem = \
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  2926
                               model.get_value(itr, enumerations.STEM_COLUMN)
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  2927
                        pkg = model.get_value(itr, enumerations.FMRI_COLUMN)
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  2928
                        gobject.idle_add(self.__show_fetching_package_info, pkg)
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
  2929
                        self.showing_empty_details = False
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  2930
                        self.last_show_info_id = self.show_info_id = \
1183
05f2a75fdcdf 9558 Support for typeahead search in Package Manager should be removed
John Rice <john.rice@sun.com>
parents: 1179
diff changeset
  2931
                            gobject.timeout_add(SHOW_INFO_DELAY,
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  2932
                                self.__show_info, model, model.get_path(itr))
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  2933
                        if (self.w_info_notebook.get_current_page() == 
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  2934
                            INFO_NOTEBOOK_LICENSE_PAGE):
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  2935
                                self.__on_notebook_change(None, None, 
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  2936
                                    INFO_NOTEBOOK_LICENSE_PAGE)
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
  2937
                else:
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  2938
                        self.selected_model = None
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  2939
                        self.selected_path = None
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  2940
                        self.selected_pkgstem = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2941
861
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  2942
        def __on_package_selection_changed(self, selection, widget):
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  2943
                '''This function is for handling package selection changes'''
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2944
                if self.in_setup:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2945
                        return
861
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  2946
                self.__process_package_selection()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2947
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2948
        def __on_filtercombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2949
                '''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
  2950
                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
  2951
                        return
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2952
                active = self.w_filter_combobox.get_active()
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2953
                if active != enumerations.FILTER_SELECTED:
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2954
                        self.saved_filter_combobox_active = active
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2955
                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
  2956
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2957
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2958
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2959
        def __unset_search(self, same_repo):
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2960
                self.w_infosearch_frame.hide()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2961
                self.__update_tooltips()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2962
                self.in_search_mode = False
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2963
                self.is_all_publishers = False
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2964
                if same_repo:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2965
                        self.__restore_setup_for_browse()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2966
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2967
        def __on_repositorycombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2968
                '''On repository combobox changed'''
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
  2969
                if self.same_publisher_on_setup:
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
  2970
                        if self.is_all_publishers:
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
  2971
                                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
  2972
                        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
  2973
                        self.unset_busy_cursor()
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
  2974
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2975
                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
  2976
                index =  self.w_repository_combobox.get_active()
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2977
                if self.is_all_publishers:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2978
                        if index == self.repo_combobox_all_pubs_index:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2979
                                return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2980
                        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
  2981
                                self.w_repository_combobox.set_active(
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2982
                                    self.repo_combobox_all_pubs_index)
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  2983
                                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
  2984
                                return
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2985
                        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
  2986
                        self.__unset_search(same_repo)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2987
                        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
  2988
                                self.__set_searchentry_to_prompt()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2989
                                return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2990
                        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
  2991
                        selected_publisher = self.__get_selected_publisher()
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2992
                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
  2993
                        return
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2994
                if index == self.repo_combobox_all_pubs_index:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2995
                        self.__set_all_publishers_mode()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2996
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2997
                        
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2998
                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
  2999
                        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
  3000
                            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
  3001
                        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
  3002
                        self.__on_file_add_publisher(None)
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  3003
                        return
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3004
                self.cancelled = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3005
                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
  3006
                self.set_busy_cursor()
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3007
                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
  3008
                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
  3009
                        self.__unset_search(False)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3010
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3011
                pub = [selected_publisher, ]
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3012
                self.set_section = self.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
  3013
                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
  3014
                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
  3015
                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
  3016
                self.__set_main_view_package_list()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3017
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3018
        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
  3019
                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
  3020
                if pub_iter == None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3021
                        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
  3022
                return self.repositories_list.get_value(pub_iter, \
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3023
                            enumerations.REPOSITORY_NAME)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3024
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
  3025
        def __setup_publisher(self, publishers):
947
181d3c7a54ee 6635 Need support Search across All Repositories (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 944
diff changeset
  3026
                self.saved_filter_combobox_active = self.initial_show_filter
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3027
                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
  3028
                    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
  3029
                self.__unset_saved()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3030
                self.publisher_changed = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3031
                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
  3032
                self.saved_repository_combobox_active = \
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3033
                        self.w_repository_combobox.get_active()   
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3034
                gobject.idle_add(self.__init_tree_views, application_list,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3035
                    category_list, section_list)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3036
1203
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3037
        def __unset_saved(self):
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3038
                self.saved_application_list = None
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3039
                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
  3040
                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
  3041
                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
  3042
                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
  3043
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
  3044
        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
  3045
                status_str = _("Refreshing package catalog information")
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
  3046
                gobject.idle_add(self.__update_statusbar_message,
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
  3047
                    status_str)
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
  3048
                try:
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
  3049
                        self.api_o.refresh(pubs=[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
  3050
                except api_errors.CatalogRefreshException, cre:
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
  3051
                        self.__catalog_refresh_message(cre)
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
  3052
                except api_errors.InvalidDepotResponseException, idrex:
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
  3053
                        err = str(idrex)
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
  3054
                        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
  3055
                            None, gtk.MESSAGE_INFO)
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
  3056
                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
  3057
                        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
  3058
                        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
  3059
                            None, gtk.MESSAGE_INFO)
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
  3060
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
  3061
        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
  3062
                application_list = self.__get_new_application_liststore()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3063
                category_list = self.__get_new_category_liststore()
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3064
                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
  3065
                for pub in publishers:
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3066
                        uptodate = False
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3067
                        try:
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
  3068
                                uptodate = self.__check_if_cache_uptodate(pub)
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3069
                                if uptodate:
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
  3070
                                        self.__add_pkgs_to_lists_from_cache(pub,
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3071
                                            application_list, category_list,
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3072
                                            section_list)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3073
                        except (UnpicklingError, EOFError, IOError):
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3074
                                #Most likely cache is corrupted, silently load list
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3075
                                #from api.
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3076
                                application_list = self.__get_new_application_liststore()
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3077
                                category_list = self.__get_new_category_liststore()
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3078
                                uptodate = False
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3079
                        if not uptodate:
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
  3080
                                self.__refresh_for_publisher(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
  3081
                                self.__add_pkgs_to_lists_from_api(pub,
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3082
                                    application_list, category_list, 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
  3083
                                category_list.prepend(None, [0, _('All'), None, None])
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3084
                        if self.application_list and self.category_list and \
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3085
                            not self.last_visible_publisher_uptodate:
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3086
                                status_str = _("Loading package list")
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3087
                                gobject.idle_add(self.__update_statusbar_message,
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3088
                                    status_str)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3089
                                if self.last_visible_publisher:
1203
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3090
                                        dump_list = self.application_list
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3091
                                        if self.saved_application_list != None:
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3092
                                                dump_list = \
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3093
                                                    self.saved_application_list
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3094
                                        self.__dump_datamodels(
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3095
                                            self.last_visible_publisher, dump_list,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3096
                                            self.category_list, self.section_list)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3097
                        self.last_visible_publisher_uptodate = uptodate
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3098
                return application_list, category_list, section_list
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3099
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
  3100
        def __check_if_cache_uptodate(self, pub):
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3101
                if self.cache_o:
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3102
                        uptodate = self.cache_o.check_if_cache_uptodate(pub)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3103
                        # We need to reset the state of the api, otherwise
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3104
                        # method api.can_be_canceled() will return True
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3105
                        self.api_o.reset()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3106
                        return uptodate
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3107
                return False
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3108
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
  3109
        def __dump_datamodels(self, pub, application_list, category_list,
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3110
            section_list):
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3111
                #Consistency check - only dump models if publisher passed in matches 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3112
                #publisher in application list
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3113
                if application_list == None:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3114
                        return
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3115
                try:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3116
                        app_pub = self.application_list[0]\
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3117
                                [enumerations.PUBLISHER_COLUMN]
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
  3118
                except (IndexError, ValueError):
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3119
                        #Empty application list nothing to dump
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3120
                        return
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3121
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
  3122
                if pub != app_pub:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3123
                        if debug:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3124
                                print "ERROR: __dump_data_models(): INCONSISTENT " \
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3125
                                        "pub %s != app_list_pub %s" % \
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
  3126
                                        (pub,  app_pub)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3127
                        return
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3128
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3129
                if self.cache_o:
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
  3130
                        if self.img_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
  3131
                            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
  3132
                                Thread(target = self.cache_o.dump_datamodels,
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
  3133
                                    args = (pub, application_list, category_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
  3134
                                    section_list)).start()
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
  3135
                        else:
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
  3136
                                self.__remove_cache()
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
  3137
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
  3138
        def __remove_cache(self):
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
  3139
                model = self.w_repository_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
  3140
                for pub in model:
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3141
                        pub_name = pub[1]
1246
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
  3142
                        if (pub_name and 
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
  3143
                            pub_name not in self.publisher_options.values()):
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
  3144
                                Thread(target = self.cache_o.remove_datamodel,
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
  3145
                                    args = [pub[1]]).start()
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  3146
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3147
        def __on_install_update(self, widget):
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
  3148
                self.api_o.reset()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3149
                install_update = []
1413
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  3150
                if self.selected > 0:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3151
                        visible_publisher = self.__get_selected_publisher()
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3152
                        pkgs = self.selected_pkgs.get(visible_publisher)
914
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  3153
                        if pkgs:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3154
                                for pkg_stem in pkgs:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3155
                                        status = pkgs.get(pkg_stem)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3156
                                        if status == enumerations.NOT_INSTALLED or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3157
                                            status == enumerations.UPDATABLE:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3158
                                                install_update.append(pkg_stem)
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
  3159
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
  3160
                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
  3161
                        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
  3162
                        self.__remove_cache()
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
  3163
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3164
                installupdate.InstallUpdate(install_update, self, \
1332
976aef7a657c 10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1310
diff changeset
  3165
                    self.image_directory, ips_update = False, \
976aef7a657c 10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1310
diff changeset
  3166
                    action = enumerations.INSTALL_UPDATE,
976aef7a657c 10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1310
diff changeset
  3167
                    main_window = self.w_main_window)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3168
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3169
        def __on_update_all(self, widget):
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3170
                self.api_o.reset()
1262
5e0b7212dba6 9520 Package Manager should not call image.get_root
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1261
diff changeset
  3171
                skip_be_dlg = False
5e0b7212dba6 9520 Package Manager should not call image.get_root
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1261
diff changeset
  3172
                if self.api_o.root != IMAGE_DIRECTORY_DEFAULT:
5e0b7212dba6 9520 Package Manager should not call image.get_root
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1261
diff changeset
  3173
                        skip_be_dlg = True
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3174
                installupdate.InstallUpdate([], self,
1332
976aef7a657c 10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1310
diff changeset
  3175
                    self.image_directory, ips_update = False,
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 868
diff changeset
  3176
                    action = enumerations.IMAGE_UPDATE, be_name = self.ua_be_name,
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 868
diff changeset
  3177
                    parent_name = _("Package Manager"),
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 868
diff changeset
  3178
                    pkg_list = ["SUNWipkg", "SUNWipkg-gui"],
1259
ee4f1901712e 9363 pm-updatemanager thoroughly broken when used with -R option
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1258
diff changeset
  3179
                    main_window = self.w_main_window,
1262
5e0b7212dba6 9520 Package Manager should not call image.get_root
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1261
diff changeset
  3180
                    skip_be_dialog = skip_be_dlg)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3181
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3182
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  3183
        def __on_ua_completed_linkbutton_clicked(self, widget):
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  3184
                try:
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  3185
                        gnome.url_show(self.release_notes_url)
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  3186
                except gobject.GError:
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  3187
                        self.error_occurred(_("Unable to navigate to:\n\t%s") % 
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  3188
                            self.release_notes_url)
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  3189
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3190
        def __on_help_about(self, widget):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3191
                wTreePlan = gtk.glade.XML(self.gladefile, "aboutdialog")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3192
                aboutdialog = wTreePlan.get_widget("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
  3193
                aboutdialog.set_icon(self.window_icon)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3194
                aboutdialog.connect("response", lambda x = None, \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3195
                    y = None: aboutdialog.destroy())
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3196
                aboutdialog.run()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3197
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  3198
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  3199
        def __on_help_help(widget):
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  3200
                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
  3201
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3202
        def __on_remove(self, widget):
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
  3203
                self.api_o.reset()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3204
                remove_list = []
1413
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  3205
                if self.selected > 0:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3206
                        visible_publisher = self.__get_selected_publisher()
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3207
                        pkgs = self.selected_pkgs.get(visible_publisher)
914
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  3208
                        if pkgs:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3209
                                for pkg_stem in pkgs:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3210
                                        status = pkgs.get(pkg_stem)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3211
                                        if status == enumerations.INSTALLED or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3212
                                            status == enumerations.UPDATABLE:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3213
                                                remove_list.append(pkg_stem)
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
  3214
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
  3215
                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
  3216
                        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
  3217
                        self.__remove_cache()
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
  3218
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3219
                installupdate.InstallUpdate(remove_list, self,
1332
976aef7a657c 10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1310
diff changeset
  3220
                    self.image_directory, ips_update = False,
976aef7a657c 10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1310
diff changeset
  3221
                    action = enumerations.REMOVE,
976aef7a657c 10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1310
diff changeset
  3222
                    main_window = self.w_main_window)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3223
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3224
        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
  3225
                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
  3226
                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
  3227
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3228
        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
  3229
                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
  3230
                if self.force_reload_packages and (self.in_search_mode 
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
                    or self.is_all_publishers):
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3232
                        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
  3233
                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
  3234
                self.in_setup = True
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3235
                self.last_visible_publisher = 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
  3236
                if widget != 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
  3237
                        self.__remove_cache()
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3238
                self.set_busy_cursor()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3239
                status_str = _("Refreshing package catalog information")
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3240
                self.__update_statusbar_message(status_str)
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  3241
                self.in_reload = True
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3242
                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
  3243
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3244
        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
  3245
                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
  3246
                        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
  3247
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3248
        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
  3249
                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
  3250
                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
  3251
                        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
  3252
                            index)
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3253
                        name = self.repositories_list.get_value(itr,
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3254
                            enumerations.REPOSITORY_NAME)
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3255
                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
  3256
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3257
        def __main_application_quit(self, be_name = None):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3258
                '''quits the main gtk loop'''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3259
                self.cancelled = True
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3260
                self.exiting = True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3261
                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
  3262
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3263
                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
  3264
                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
  3265
                save_vpos = self.w_main_vpaned.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
  3266
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3267
                self.w_main_window.hide()
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3268
                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
  3269
                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
  3270
                width = height = hpos = vpos = -1
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3271
                if self.save_state:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3272
                        if 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
  3273
                                start_insearch = True
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3274
                                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
  3275
                                    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
  3276
                        else:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3277
                                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
  3278
                        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
  3279
                                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
  3280
                        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
  3281
                        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
  3282
                        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
  3283
                        vpos = save_vpos
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3284
                try:
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3285
                        if self.last_export_selection_path:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3286
                                self.client.set_string(LAST_EXPORT_SELECTION_PATH,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3287
                                    self.last_export_selection_path)
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3288
                        self.client.set_string(LASTSOURCE_PREFERENCES, 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
  3289
                        self.client.set_bool(START_INSEARCH_PREFERENCES,
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3290
                            start_insearch)
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3291
                        self.client.set_int(INITIAL_APP_WIDTH_PREFERENCES, width)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3292
                        self.client.set_int(INITIAL_APP_HEIGHT_PREFERENCES, height)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3293
                        self.client.set_int(INITIAL_APP_HPOS_PREFERENCES, hpos)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3294
                        self.client.set_int(INITIAL_APP_VPOS_PREFERENCES, vpos)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3295
                except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3296
                        pass
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3297
1258
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3298
                if be_name:
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  3299
                        gobject.spawn_async([self.application_path, "-R",
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  3300
                            self.image_directory, "-U", be_name])
1258
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3301
                else:
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3302
                        if 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
  3303
                                pub = self.__get_publisher_name_from_index(
1258
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3304
                                    self.saved_repository_combobox_active)
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3305
                        else:
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3306
                                pub = self.__get_selected_publisher()
1258
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3307
                        if self.in_search_mode:
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3308
                                self.__dump_datamodels(pub,
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3309
                                    self.saved_application_list, self.category_list,
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3310
                                    self.section_list)
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3311
                        else:
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3312
                                self.__dump_datamodels(pub,
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3313
                                    self.application_list, self.category_list,
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3314
                                    self.section_list)
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3315
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3316
                if len(self.search_completion) > 0 and self.cache_o != None:
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3317
                        self.cache_o.dump_search_completion_info(self.search_completion)
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3318
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3319
                self.__do_exit()
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3320
                gobject.timeout_add(1000, self.__do_exit)
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3321
                return True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3322
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3323
        @staticmethod
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3324
        def __do_exit():
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3325
                if threading.activeCount() == 1:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3326
                        gtk.main_quit()
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3327
                        sys.exit(0)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3328
                return True
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3329
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3330
        def __check_if_something_was_changed(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3331
                ''' 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
  3332
                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
  3333
                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
  3334
                        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
  3335
                                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
  3336
                                        return True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3337
                return False
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3338
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
  3339
        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
  3340
                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
  3341
                previous_saved_name = 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
  3342
                if not self.first_run and not self.force_reload_packages:
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
  3343
                        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
  3344
                        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
  3345
                                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
  3346
                                    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
  3347
                                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
  3348
                                   self.repositories_list.get_value(itr, 
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
  3349
                                   enumerations.REPOSITORY_NAME)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3350
                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
  3351
                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
  3352
                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
  3353
                if self.default_publisher != default_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3354
                        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
  3355
                        self.default_publisher = default_pub
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3356
                selected_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3357
                enabled_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3358
                for repo in self.selected_pkgs:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3359
                        selected_repos.append(repo)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3360
                i = 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3361
                active = 0
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3362
                for pub in api_o.get_publishers():
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3363
                        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
  3364
                                continue
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3365
                        prefix = pub.prefix
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3366
                        if cmp(prefix, self.default_publisher) == 0:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3367
                                active = 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
  3368
                        self.repositories_list.append([i, prefix, ])
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3369
                        enabled_repos.append(prefix)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3370
                        i = i + 1
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3371
                self.repo_combobox_all_pubs_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
  3372
                self.repositories_list.append([self.repo_combobox_all_pubs_index, 
1246
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
  3373
                    self.publisher_options[PUBLISHER_ALL], ])
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3374
                i = i + 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
  3375
                self.repositories_list.append([-1, "", ])
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3376
                i = i + 1
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3377
                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
  3378
                self.repositories_list.append([-1,
1246
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
  3379
                    self.publisher_options[PUBLISHER_ADD], ])
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3380
                pkgs_to_remove = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3381
                for repo_name in selected_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3382
                        if repo_name not in enabled_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3383
                                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
  3384
                                for pkg_stem in pkg_stems:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3385
                                        pkgs_to_remove.append(pkg_stem)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3386
                for pkg_stem in pkgs_to_remove:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3387
                        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
  3388
                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
  3389
                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
  3390
                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
  3391
                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
  3392
                        for repo in self.repositories_list:
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3393
                                if (repo[enumerations.REPOSITORY_NAME] == \
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3394
                                    self.lastsource and
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3395
                                    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
  3396
                                        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
  3397
                                           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
  3398
                                        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
  3399
                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
  3400
                        for repo in self.repositories_list:
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
  3401
                                if (repo[enumerations.REPOSITORY_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
  3402
                                    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
  3403
                                    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
  3404
                                        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
  3405
                                           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
  3406
                                        if not self.force_reload_packages:
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
  3407
                                                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
  3408
                                        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
  3409
                        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
  3410
                                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
  3411
                                for repo in self.repositories_list:
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
  3412
                                        if (repo[enumerations.REPOSITORY_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
  3413
                                            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
  3414
                                                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
  3415
                                                   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
  3416
                                                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
  3417
                                # 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
  3418
                                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
  3419
                                        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
  3420
                                        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
  3421
                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
  3422
                        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
  3423
                elif self.default_publisher:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3424
                        self.w_repository_combobox.set_active(active)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3425
                else:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3426
                        self.w_repository_combobox.set_active(0)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3427
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3428
        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
  3429
                '''Toggle function for column enumerations.MARK_COLUMN'''
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3430
                applicationModel = model_sort.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3431
                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
  3432
                filterModel = applicationModel.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3433
                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
  3434
                itr = filterModel.get_iter(child_path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3435
                if itr:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3436
                        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
  3437
                        filterModel.set_value(itr, enumerations.MARK_COLUMN,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3438
                            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
  3439
                        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
  3440
                            enumerations.STATUS_COLUMN)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3441
                        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
  3442
                        if modified:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3443
                                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
  3444
                        else:
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3445
                                pkg_publisher = filterModel.get_value(itr, 
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3446
                                    enumerations.PUBLISHER_COLUMN)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3447
                                self.__add_pkg_stem_to_list(pkg_stem, pkg_status,
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3448
                                    pkg_publisher)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3449
                        self.update_statusbar()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3450
                        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
  3451
                        self.__enable_disable_install_remove()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3452
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3453
        def __update_reload_button(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3454
                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
  3455
                        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
  3456
                        self.w_reload_button.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3457
                else:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3458
                        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
  3459
                        self.w_reload_button.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3460
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3461
        def __add_pkg_stem_to_list(self, stem, status, 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
  3462
                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
  3463
                        self.selected_pkgs[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
  3464
                self.selected_pkgs.get(pub)[stem] = status
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3465
                if status == enumerations.NOT_INSTALLED or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3466
                    status == enumerations.UPDATABLE:
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
  3467
                        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
  3468
                                self.to_install_update[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3469
                        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
  3470
                                self.to_install_update[pub] += 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3471
                if status == enumerations.UPDATABLE or status == enumerations.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
  3472
                        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
  3473
                                self.to_remove[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3474
                        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
  3475
                                self.to_remove[pub] += 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3476
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3477
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3478
        def __update_tooltips(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3479
                to_remove = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3480
                to_install = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3481
                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
  3482
                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
  3483
                        packages = self.to_remove.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3484
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3485
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3486
                                        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
  3487
                                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
  3488
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3489
                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
  3490
                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
  3491
                        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
  3492
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3493
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3494
                                        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
  3495
                                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
  3496
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3497
                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
  3498
                        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
  3499
                            "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
  3500
                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
  3501
                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
  3502
                        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
  3503
                            "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
  3504
                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
  3505
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3506
        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
  3507
                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
  3508
                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
  3509
                        pkgs = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3510
                        status = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3511
                        if stem in pkgs:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3512
                                status = pkgs.pop(stem)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3513
                        if status == enumerations.NOT_INSTALLED or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3514
                            status == enumerations.UPDATABLE:
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
  3515
                                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
  3516
                                        self.to_install_update[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3517
                                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
  3518
                                        self.to_install_update[pub] -= 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3519
                        if status == enumerations.UPDATABLE or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3520
                            status == enumerations.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
  3521
                                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
  3522
                                        self.to_remove[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3523
                                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
  3524
                                        self.to_remove[pub] -= 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3525
                        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
  3526
                                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
  3527
                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
  3528
                        self.selected_pkgs.pop(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3529
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3530
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3531
        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
  3532
                # 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
  3533
                # 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
  3534
                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
  3535
                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
  3536
                        stems = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3537
                        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
  3538
                                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
  3539
                for pkg_stem in remove_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3540
                        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
  3541
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3542
        def __set_empty_details_panel(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
  3543
                self.showing_empty_details = True
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3544
                if self.show_info_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3545
                        gobject.source_remove(self.show_info_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3546
                        self.show_info_id = 0
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3547
                if self.show_licenses_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3548
                        gobject.source_remove(self.show_licenses_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3549
                        self.show_licenses_id = 0
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3550
                self.w_installedfiles_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3551
                self.w_dependencies_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3552
                self.w_generalinfo_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3553
                self.w_license_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3554
                return
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3555
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3556
        def __show_fetching_package_info(self, pkg):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3557
                pkg_stem = pkg.get_pkg_stem()
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3558
                if self.__setting_from_cache(pkg_stem):
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
  3559
                        return
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3560
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3561
                instbuffer = self.w_installedfiles_textview.get_buffer()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3562
                depbuffer = self.w_dependencies_textview.get_buffer()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3563
                infobuffer = self.w_generalinfo_textview.get_buffer()
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3564
                fetching_text = _("Fetching information...")
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3565
                instbuffer.set_text(fetching_text)
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3566
                depbuffer.set_text(fetching_text)
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3567
                infobuffer.set_text(fetching_text)
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
  3568
                return
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3569
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3570
        def __setting_from_cache(self, pkg_stem):
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
  3571
                if len(self.info_cache) > MAX_INFO_CACHE_LIMIT:
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3572
                        self.info_cache = {}
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3573
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3574
                if self.info_cache.has_key(pkg_stem):
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3575
                        labs = self.info_cache[pkg_stem][
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3576
                            enumerations.INFO_GENERAL_LABELS]
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3577
                        text = self.info_cache[pkg_stem][
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3578
                            enumerations.INFO_GENERAL_TEXT]
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3579
                        gui_misc.set_package_details_text(labs, text,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3580
                            self.w_generalinfo_textview,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3581
                            self.installed_icon, self.not_installed_icon,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3582
                            self.update_available_icon)
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3583
                        text = self.info_cache[pkg_stem][
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3584
                            enumerations.INFO_INSTALLED_TEXT]
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3585
                        self.__set_installedfiles_text(text)
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3586
                        local_info = self.info_cache[pkg_stem][
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3587
                            enumerations.INFO_DEPEND_INFO]
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3588
                        dep_info = self.info_cache[pkg_stem][
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3589
                            enumerations.INFO_DEPEND_DEPEND_INFO]
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3590
                        installed_dep_info = self.info_cache[pkg_stem][
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3591
                            enumerations.INFO_DEPEND_DEPEND_INSTALLED_INFO]
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3592
                        self.__set_dependencies_text(local_info, dep_info,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3593
                            installed_dep_info)
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
  3594
                        return True
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3595
                else:
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3596
                        return False
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3597
1344
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
  3598
        def __set_installedfiles_text(self, text):
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
  3599
                instbuffer = self.w_installedfiles_textview.get_buffer()
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
  3600
                instbuffer.set_text("")
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
  3601
                itr = instbuffer.get_start_iter()
1443
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3602
                instbuffer.insert(itr, text)
1344
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
  3603
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3604
        def __set_dependencies_text(self, info, dep_info, installed_dep_info):
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3605
                names = []
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3606
                states = None
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3607
                installed_states = []
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3608
                if dep_info != None and len(dep_info.get(0)) >= 0:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3609
                        states = dep_info[0]
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3610
                if installed_dep_info != None and len(installed_dep_info.get(0)) >= 0:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3611
                        installed_states = installed_dep_info[0]
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3612
                version_fmt = _("%(version)s (Build %(build)s-%(branch)s)")
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3613
                i = 0
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3614
                for x in info.dependencies:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3615
                        if states != None:
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3616
                                name = fmri.extract_pkg_name(x)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3617
                                version = version_fmt % \
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3618
                                    {"version": states[i].version,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3619
                                    "build": states[i].build_release,
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3620
                                    "branch": states[i].branch}
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3621
                                found = False
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3622
                                for state in installed_states:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3623
                                        if name ==  fmri.extract_pkg_name(state.fmri):
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3624
                                                installed_version = version_fmt % \
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3625
                                                    {"version": state.version,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3626
                                                    "build": state.build_release,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3627
                                                    "branch": state.branch}
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3628
                                                found = True
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3629
                                                break
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3630
                                if not found:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3631
                                        installed_version = (_("(not installed)"))
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3632
                                names.append((name, version, installed_version,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3633
                                    found))
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3634
                                i += 1
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3635
                        else:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3636
                                names.append(x)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3637
1344
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
  3638
                depbuffer = self.w_dependencies_textview.get_buffer()
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
  3639
                depbuffer.set_text("")
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3640
                if states == None:
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3641
                        if len(names) == 0:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3642
                                itr = depbuffer.get_iter_at_line(0)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3643
                                depbuffer.insert_with_tags_by_name(itr, 
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3644
                                    _("None"), "bold")
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3645
                        else:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3646
                                for i in  range(0, len(names)):
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3647
                                        itr = depbuffer.get_iter_at_line(i)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3648
                                        dep_str = "%s\n" % (names[i]) 
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3649
                                        depbuffer.insert(itr, dep_str)
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3650
                        return
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3651
                max_name_len = 0
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3652
                max_version_len = 0
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3653
                for (name, version, installed_version, is_installed) in names:
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3654
                        if len(name) > max_name_len:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3655
                                max_name_len = len(name)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3656
                        if len(version) > max_version_len:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3657
                                max_version_len = len(version)
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3658
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3659
                style = self.w_dependencies_textview.get_style()
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3660
                font_size_in_pango_unit = style.font_desc.get_size()
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3661
                font_size_in_pixel = font_size_in_pango_unit / pango.SCALE
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3662
                tab_array = pango.TabArray(3, True)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3663
                i = 1
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3664
                tab_array.set_tab(i, pango.TAB_LEFT,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3665
                    max_name_len * font_size_in_pixel + 1)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3666
                i += 1
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3667
                tab_array.set_tab(i, pango.TAB_LEFT,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3668
                    (max_name_len + max_version_len) * 
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3669
                    font_size_in_pixel + 2)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3670
                self.w_dependencies_textview.set_tabs(tab_array)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3671
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3672
                itr = depbuffer.get_iter_at_line(0)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3673
                depbuffer.insert_with_tags_by_name(itr, 
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3674
                    _("Name\tDependency\tInstalled Version\n"), "bold")
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3675
                installed_icon = None
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3676
                not_installed_icon = None
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3677
                i += 0
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3678
                for (name, version, installed_version, is_installed) in names:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3679
                        if is_installed:
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3680
                                if installed_icon == None:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3681
                                        installed_icon = gui_misc.resize_icon(
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3682
                                            self.installed_icon,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3683
                                            font_size_in_pixel)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3684
                                icon = installed_icon
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3685
                        else:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3686
                                if not_installed_icon == None:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3687
                                        not_installed_icon = gui_misc.resize_icon(
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3688
                                            self.not_installed_icon,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3689
                                            font_size_in_pixel)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3690
                                icon = not_installed_icon
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3691
                        itr = depbuffer.get_iter_at_line(i + 1)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3692
                        dep_str = "%s\t%s\t" % (name, version)
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3693
                        depbuffer.insert(itr, dep_str)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3694
                        end_itr = depbuffer.get_end_iter()
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3695
                        depbuffer.insert_pixbuf(end_itr, icon)
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3696
                        depbuffer.insert(end_itr, " %s\n" % installed_version)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3697
                        i += 1
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3698
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3699
        def __update_package_info(self, pkg, local_info, remote_info, dep_info,
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3700
            installed_dep_info, info_id):
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
  3701
                if self.showing_empty_details or (info_id != 
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3702
                    self.last_show_info_id):
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3703
                        return
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3704
                pkg_stem = pkg.get_pkg_stem()
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3705
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3706
                if self.__setting_from_cache(pkg_stem):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3707
                        return
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3708
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
  3709
                instbuffer = self.w_installedfiles_textview.get_buffer()
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3710
                depbuffer = self.w_dependencies_textview.get_buffer()
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3711
                infobuffer = self.w_generalinfo_textview.get_buffer()
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3712
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3713
                if not local_info and not remote_info:
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3714
                        network_str = \
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3715
                            _("\nThis might be caused by network problem "
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3716
                            "while accessing the repository.")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3717
                        instbuffer.set_text( \
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3718
                            _("Files Details not available for this package...") +
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3719
                            network_str)
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3720
                        depbuffer.set_text(_(
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3721
                            "Dependencies info not available for this package...") +
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3722
                            network_str)
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3723
                        infobuffer.set_text(
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3724
                            _("Information not available for this package...") +
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3725
                            network_str)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3726
                        return
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3727
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3728
                labs, text = gui_misc.set_package_details(pkg.get_name(), local_info,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3729
                    remote_info, self.w_generalinfo_textview,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3730
                    self.installed_icon, self.not_installed_icon,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3731
                    self.update_available_icon)
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3732
                if not local_info:
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3733
                        # Package is not installed
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3734
                        local_info = remote_info
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3735
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3736
                if not remote_info:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3737
                        remote_info = local_info
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3738
1443
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3739
                inst_str = ""
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3740
                if local_info.dirs:
1443
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3741
                        for x in local_info.dirs:
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3742
                                inst_str += ''.join("%s%s\n" % (
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3743
                                    self.api_o.root, x))
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3744
                if local_info.files:
1443
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3745
                        for x in local_info.files:
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3746
                                inst_str += ''.join("%s%s\n" % (
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3747
                                    self.api_o.root, x))
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3748
                if local_info.hardlinks:
1443
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3749
                        for x in local_info.hardlinks:
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3750
                                inst_str += ''.join("%s%s\n" % (
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3751
                                    self.api_o.root, x))
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3752
                if local_info.links:
1443
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3753
                        for x in local_info.links:
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3754
                                inst_str += ''.join("%s%s\n" % (
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  3755
                                    self.api_o.root, x))
1344
96b65a9b033b 8224 PM Format poor on multiline Summary in Description and some locales
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1343
diff changeset
  3756
                self.__set_installedfiles_text(inst_str)
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3757
                self.__set_dependencies_text(local_info, dep_info, 
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3758
                    installed_dep_info)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3759
                self.info_cache[pkg_stem] = (labs, text, inst_str, local_info,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3760
                    dep_info, installed_dep_info)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3761
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
  3762
        def __update_package_license(self, licenses, license_id):
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3763
                if self.showing_empty_details or (license_id !=
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3764
                    self.last_show_licenses_id):
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3765
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3766
                lic = ""
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3767
                lic_u = ""
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
  3768
                if licenses == None:
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3769
                        lic_u = _("Not available")
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
  3770
                else:
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3771
                        for licens in licenses:
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3772
                                lic += licens.get_text()
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3773
                                lic += "\n"
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3774
                        try:
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3775
                                lic_u = unicode(lic, "utf-8")
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 608
diff changeset
  3776
                        except UnicodeDecodeError:
1226
7dc1fa06611c 9180 Empty license textview due to conversion problem
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1220
diff changeset
  3777
                                lic_u = _("License could not be shown "
7dc1fa06611c 9180 Empty license textview due to conversion problem
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1220
diff changeset
  3778
                                    "due to conversion problem.")
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3779
                licbuffer = self.w_license_textview.get_buffer()
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3780
                licbuffer.set_text(lic_u)
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3781
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3782
        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
  3783
                self.show_licenses_id = 0
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3784
                if self.catalog_loaded == False:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3785
                        return
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3786
                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
  3787
                    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
  3788
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3789
        def __show_package_licenses(self, selected_pkgstem, license_id):
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3790
                if selected_pkgstem == None:
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
  3791
                        gobject.idle_add(self.__update_package_license, None,
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3792
                            self.last_show_licenses_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
  3793
                        return
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3794
                info = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3795
                try:
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3796
                        info = self.api_o.info([selected_pkgstem],
925
089ed400edf4 6902 api.info needs a fast flag or a way to pass a set of the information required (followup2)
John Rice <john.rice@sun.com>
parents: 924
diff changeset
  3797
                            True, frozenset([api.PackageInfo.LICENSES]))
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1187
diff changeset
  3798
                except (api_errors.TransportError):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3799
                        pass
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
  3800
                except (api_errors.InvalidDepotResponseException):
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
  3801
                        pass
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
  3802
                if self.showing_empty_details or (license_id != 
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3803
                    self.last_show_licenses_id):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3804
                        return
925
089ed400edf4 6902 api.info needs a fast flag or a way to pass a set of the information required (followup2)
John Rice <john.rice@sun.com>
parents: 924
diff changeset
  3805
                if not info or (info and len(info.get(0)) == 0):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3806
                        try:
925
089ed400edf4 6902 api.info needs a fast flag or a way to pass a set of the information required (followup2)
John Rice <john.rice@sun.com>
parents: 924
diff changeset
  3807
                        # Get license from remote
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3808
                                info = self.api_o.info([selected_pkgstem],
925
089ed400edf4 6902 api.info needs a fast flag or a way to pass a set of the information required (followup2)
John Rice <john.rice@sun.com>
parents: 924
diff changeset
  3809
                                    False, frozenset([api.PackageInfo.LICENSES]))
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1187
diff changeset
  3810
                        except (api_errors.TransportError):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3811
                                pass
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
  3812
                        except (api_errors.InvalidDepotResponseException):
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
  3813
                                pass
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
  3814
                if self.showing_empty_details or (license_id != 
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3815
                    self.last_show_licenses_id):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3816
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3817
                pkgs_info = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3818
                package_info = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3819
                no_licenses = 0
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3820
                if info:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3821
                        pkgs_info = info[0]
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3822
                if pkgs_info:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3823
                        package_info = pkgs_info[0]
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3824
                if package_info:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3825
                        no_licenses = len(package_info.licenses)
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3826
                if no_licenses == 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
  3827
                        gobject.idle_add(self.__update_package_license, None, 
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3828
                            license_id)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3829
                        return
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3830
                else:
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3831
                        gobject.idle_add(self.__update_package_license,
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
  3832
                            package_info.licenses, license_id)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3833
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3834
        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
  3835
                self.show_info_id = 0
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3836
                if self.catalog_loaded == False:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3837
                        self.selected_model = model
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3838
                        self.selected_path = path
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3839
                        return
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3840
                if not (model and path):
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3841
                        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
  3842
                if self.selected_model != None:
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3843
                        if (self.selected_model != model or
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3844
                            self.selected_path != path):
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3845
                        # This can happen after catalogs are loaded in
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3846
                        # enable_disable_update_all and a different
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3847
                        # package is selected before enable_disable_update_all
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3848
                        # calls __show_info. We set these variable to None
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3849
                        # so that when __show_info is called it does nothing.
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3850
                                self.selected_model = None
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3851
                                self.selected_path = None
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3852
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  3853
                itr = model.get_iter(path)
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3854
                pkg = model.get_value(itr, enumerations.FMRI_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
  3855
                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
  3856
                pkg_status = model.get_value(itr, enumerations.STATUS_COLUMN)
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3857
                if self.info_cache.has_key(pkg_stem):
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
  3858
                        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
  3859
                Thread(target = self.__show_package_info,
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3860
                    args = (pkg, pkg_stem, pkg_status, self.last_show_info_id)).start()
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3861
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3862
        def __show_package_info(self, pkg, pkg_stem, pkg_status, info_id):
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3863
                self.api_o.log_operation_start("info")
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3864
                local_info = None
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3865
                remote_info = None
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
  3866
                if not self.showing_empty_details and (info_id ==
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3867
                    self.last_show_info_id) and (pkg_status ==
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3868
                    enumerations.INSTALLED or pkg_status ==
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3869
                    enumerations.UPDATABLE):
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3870
                        local_info = gui_misc.get_pkg_info(self.api_o, pkg_stem,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3871
                            True)
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
  3872
                if not self.showing_empty_details and (info_id ==
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3873
                    self.last_show_info_id) and (pkg_status ==
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3874
                    enumerations.NOT_INSTALLED or pkg_status ==
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3875
                    enumerations.UPDATABLE):
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3876
                        remote_info = gui_misc.get_pkg_info(self.api_o, pkg_stem,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  3877
                            False)
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
  3878
                if not self.showing_empty_details and (info_id ==
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  3879
                    self.last_show_info_id):
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3880
                        if local_info:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3881
                                info = local_info
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3882
                        else:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3883
                                info = remote_info
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3884
                        dep_info = None
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3885
                        installed_dep_info = None
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3886
                        if info and info.dependencies:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3887
                                try:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3888
                                        temp_info = info.dependencies[:]
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3889
                                        dep_info = self.api_o.info(
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3890
                                            temp_info,
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3891
                                            False,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3892
                                            frozenset([api.PackageInfo.STATE,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3893
                                            api.PackageInfo.IDENTITY]))
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3894
                                        temp_info = []
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3895
                                        for depend in info.dependencies:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3896
                                                name = fmri.extract_pkg_name(depend)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3897
                                                temp_info.append(name)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3898
                                        installed_dep_info = self.api_o.info(
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3899
                                            temp_info,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3900
                                            True,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3901
                                            frozenset([api.PackageInfo.STATE,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3902
                                            api.PackageInfo.IDENTITY]))
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3903
                                except (api_errors.TransportError):
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  3904
                                        pass
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
  3905
                                except (api_errors.InvalidDepotResponseException):
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
  3906
                                        pass
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3907
                        gobject.idle_add(self.__update_package_info, pkg,
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3908
                            local_info, remote_info, dep_info, installed_dep_info,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  3909
                            info_id)
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3910
                self.api_o.log_operation_end()
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3911
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3912
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3913
        # This function is ported from pkg.actions.generic.distinguished_name()
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3914
        @staticmethod
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3915
        def __locale_distinguished_name(action):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3916
                if action.key_attr == None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3917
                        return str(action)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3918
                return "%s: %s" % \
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3919
                    (_(action.name), action.attrs.get(action.key_attr, "???"))
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3920
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
  3921
        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
  3922
                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
  3923
                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
  3924
                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
  3925
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3926
                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
  3927
                        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
  3928
                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
  3929
                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
  3930
                        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
  3931
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3932
                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
  3933
                    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
  3934
                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
  3935
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3936
                # Top level Section has been 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
  3937
                if len(cat_path) == 1 and 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
  3938
                        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
  3939
                        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
  3940
                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
  3941
                        # 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
  3942
                        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
  3943
                        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
  3944
                                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
  3945
                        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
  3946
                            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
  3947
                        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
  3948
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3949
        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
  3950
                '''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
  3951
                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
  3952
                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
  3953
                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
  3954
                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
  3955
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  3956
                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
  3957
                        return category
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  3958
                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
  3959
                if filter_id == enumerations.FILTER_SELECTED:
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  3960
                        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
  3961
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3962
                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
  3963
                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
  3964
                        self.__get_active_section_and_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
  3965
                
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3966
                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
  3967
                        #Clicked on All Categories
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3968
                        category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3969
                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
  3970
                        #Clicked on subcategory
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3971
                        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
  3972
                                category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3973
                elif category_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
  3974
                        #Clicked on Top Level 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
  3975
                        categories_in_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
  3976
                                self.section_categories_list[selected_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
  3977
                        for cat_id 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
  3978
                                if cat_id in categories_in_section:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3979
                                        category = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3980
                                        break
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3981
                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
  3982
                        return False
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  3983
                if self.in_search_mode:
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  3984
                        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
  3985
                return (category &
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3986
                    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
  3987
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3988
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3989
        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
  3990
                '''Function for filtercombobox'''
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3991
                if filter_id == enumerations.FILTER_ALL:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3992
                        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
  3993
                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
  3994
                if filter_id == enumerations.FILTER_INSTALLED:
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3995
                        return (status == enumerations.INSTALLED or status == \
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3996
                            enumerations.UPDATABLE)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3997
                elif filter_id == enumerations.FILTER_UPDATES:
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3998
                        return status == enumerations.UPDATABLE
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3999
                elif filter_id == enumerations.FILTER_NOT_INSTALLED:
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4000
                        return status == enumerations.NOT_INSTALLED
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4001
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4002
        def __is_pkg_repository_visible(self, model, itr):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4003
                if len(self.repositories_list) <= 1:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4004
                        return True
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4005
                else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4006
                        visible_publisher = self.__get_selected_publisher()
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4007
                        pkg = model.get_value(itr, enumerations.FMRI_COLUMN)
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4008
                        if not pkg:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4009
                                return False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4010
                        if cmp(pkg.get_publisher(), visible_publisher) == 0:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4011
                                return True
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4012
                        else:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4013
                                return False
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4014
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4015
        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
  4016
                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
  4017
                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4018
                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
  4019
                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
  4020
                        self.unset_busy_cursor()
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4021
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4022
        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
  4023
                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
  4024
                        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
  4025
                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
  4026
                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
  4027
                        for row in model:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4028
                                if not row[enumerations.MARK_COLUMN]:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4029
                                        self.w_selectall_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4030
                                        return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4031
                        self.w_selectall_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4032
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4033
                        self.w_selectall_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4034
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4035
        def __enable_disable_install_remove(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4036
                if not self.user_rights:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4037
                        self.w_installupdate_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4038
                        self.w_installupdate_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4039
                        self.w_remove_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4040
                        self.w_remove_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4041
                        return
1413
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  4042
                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
  4043
                self.__enable_if_selected_for_install_update()
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4044
                self.__enable_disable_export_selections()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4045
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4046
        def __enable_if_selected_for_removal(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4047
                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
  4048
                selected = 0
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
  4049
                if self.is_all_publishers:
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
  4050
                        for repo in self.repositories_list:
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
  4051
                                pub = repo[enumerations.REPOSITORY_NAME]
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
  4052
                                selected = self.to_remove.get(pub)
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
  4053
                                if selected > 0:
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
  4054
                                        break
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
  4055
                else:
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
  4056
                        visible_publisher = self.__get_selected_publisher()
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
  4057
                        selected = self.to_remove.get(visible_publisher)
914
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  4058
                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
  4059
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4060
                self.w_remove_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4061
                self.w_remove_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4062
                return sensitive
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4063
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4064
        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
  4065
                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
  4066
                if self.is_all_publishers:
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
  4067
                        for repo in self.repositories_list:
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
  4068
                                pub = repo[enumerations.REPOSITORY_NAME]
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
  4069
                                selected = self.to_install_update.get(pub)
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
  4070
                                if selected > 0:
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
  4071
                                        break
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
  4072
                else:
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
  4073
                        visible_publisher = self.__get_selected_publisher()
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
  4074
                        selected = self.to_install_update.get(visible_publisher)
914
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  4075
                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
  4076
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4077
                self.w_installupdate_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4078
                self.w_installupdate_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4079
                return sensitive
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4080
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4081
        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
  4082
                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
  4083
                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
  4084
                        return
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  4085
                for row in model:
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4086
                        if row[enumerations.STATUS_COLUMN] == enumerations.UPDATABLE:
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4087
                                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
  4088
                                        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
  4089
                                            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
  4090
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4091
                self.w_selectupdates_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4092
                return
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4093
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4094
        def __get_inventory_list(self, pargs, all_known, all_versions):
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4095
                self.__image_activity_lock.acquire()
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4096
                try:
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4097
                        res = misc.get_inventory_list(self.api_o.img, 
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4098
                            pargs, all_known, all_versions)
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4099
                finally:
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4100
                        self.__image_activity_lock.release()
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4101
                return res
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4102
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
  4103
        def __enable_disable_update_all(self, refresh_done):
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4104
                #XXX Api to provide fast information if there are some updates
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4105
                #available within image
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4106
                gobject.idle_add(self.w_updateall_button.set_sensitive, False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4107
                gobject.idle_add(self.w_updateall_menuitem.set_sensitive, 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
  4108
                update_available = self.__check_if_updates_available(refresh_done)
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  4109
                if not self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  4110
                        gobject.idle_add(self.__g_enable_disable_update_all, 
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  4111
                            update_available)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4112
                return False
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4113
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
  4114
        def __show_info_after_catalog_load(self):
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  4115
                self.__show_info(self.selected_model, self.selected_path)
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  4116
                self.selected_model = None
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  4117
                self.selected_path = None
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4118
                if (self.w_info_notebook.get_current_page() == 
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4119
                    INFO_NOTEBOOK_LICENSE_PAGE and
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4120
                    not self.showing_empty_details):
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4121
                        self.__show_licenses()
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
  4122
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
  4123
        def __check_if_updates_available(self, refresh_done):
1228
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1226
diff changeset
  4124
                # First we load the catalogs so package info can work
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4125
                try:
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
  4126
                        if not refresh_done:
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
  4127
                                self.catalog_loaded = False
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
  4128
                                self.api_o.refresh()
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
  4129
                                self.catalog_loaded = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4130
                except api_errors.InventoryException:
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
  4131
                        gobject.idle_add(self.__set_empty_details_panel)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4132
                        return 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
  4133
                except api_errors.InvalidDepotResponseException, idrex:
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
  4134
                        err = str(idrex)
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
  4135
                        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
  4136
                            None, gtk.MESSAGE_INFO)
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
  4137
                        gobject.idle_add(self.__set_empty_details_panel)
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
  4138
                        return False
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
  4139
                except api_errors.CatalogRefreshException, cre:
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
  4140
                        self.__catalog_refresh_message(cre)
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
  4141
                        gobject.idle_add(self.__set_empty_details_panel)
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
  4142
                        return False
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
  4143
                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
  4144
                        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
  4145
                        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
  4146
                            None, gtk.MESSAGE_INFO)
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
  4147
                        gobject.idle_add(self.__set_empty_details_panel)
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
  4148
                        return False
1228
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1226
diff changeset
  4149
                gobject.idle_add(self.__show_info_after_catalog_load)
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1226
diff changeset
  4150
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
  4151
                return_code = subprocess.call([os.path.join(self.application_dir, 
86d476d3d53f 10131 check for updates can traceback if check for updates is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1243
diff changeset
  4152
                    CHECK_FOR_UPDATES),
1228
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1226
diff changeset
  4153
                    self.image_directory])
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1226
diff changeset
  4154
                if return_code == enumerations.UPDATES_AVAILABLE:
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1226
diff changeset
  4155
                        return True
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1226
diff changeset
  4156
                else:
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1226
diff changeset
  4157
                        return False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4158
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4159
        def __g_enable_disable_update_all(self, update_available):
773
68018dae1ed4 5645 Package Manager should have busy cursor for certain actions (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 770
diff changeset
  4160
                self.w_updateall_button.set_sensitive(update_available)
68018dae1ed4 5645 Package Manager should have busy cursor for certain actions (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 770
diff changeset
  4161
                self.w_updateall_menuitem.set_sensitive(update_available)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4162
                self.__enable_disable_install_remove()
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4163
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4164
        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
  4165
                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
  4166
                        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
  4167
                else:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4168
                        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
  4169
                return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4170
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4171
        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
  4172
                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
  4173
                        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
  4174
                                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
  4175
                                        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
  4176
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4177
                self.w_deselect_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4178
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4179
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4180
        def __catalog_refresh(self, reload_gui=True):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4181
                """Update image's catalogs."""
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4182
                try:
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4183
                        # Since the user requested the refresh, perform it
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4184
                        # immediately for all publishers.
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4185
                        self.api_o.refresh(immediate=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
  4186
                        self.catalog_refresh_done = True
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4187
                        # Refresh will load the catalogs.
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4188
                        self.catalog_loaded = True
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4189
                except api_errors.PublisherError:
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4190
                        # In current implementation, this will never happen
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4191
                        # We are not refreshing specific publisher
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
  4192
                        self.__catalog_refresh_done()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4193
                        raise
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4194
                except api_errors.PermissionsException:
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4195
                        #Error will already have been reported in
714
cd9870c8faae 4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 701
diff changeset
  4196
                        #Manage Repository dialog
cd9870c8faae 4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 701
diff changeset
  4197
                        self.__catalog_refresh_done()
cd9870c8faae 4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 701
diff changeset
  4198
                        return -1
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4199
                except api_errors.CatalogRefreshException, cre:
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
  4200
                        self.__catalog_refresh_message(cre)
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
  4201
                        self.__catalog_refresh_done()
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  4202
                        return -1
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4203
                except api_errors.InvalidDepotResponseException, idrex:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4204
                        err = str(idrex)
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4205
                        gobject.idle_add(self.error_occurred, err,
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4206
                            None, gtk.MESSAGE_INFO)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4207
                        self.__catalog_refresh_done()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4208
                        return -1
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4209
                except api_errors.PublisherError:
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
  4210
                        self.__catalog_refresh_done()
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
  4211
                        raise
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
  4212
                except Exception:
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
  4213
                        self.__catalog_refresh_done()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4214
                        raise
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4215
                if reload_gui:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4216
                        self.__catalog_refresh_done()
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  4217
                return 0
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4218
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
  4219
        def __add_pkgs_to_lists_from_cache(self, pub, application_list,
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4220
            category_list, section_list):
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  4221
                if self.cache_o:
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
  4222
                        self.cache_o.load_application_list(pub, application_list,
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  4223
                            self.selected_pkgs)
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
  4224
                        self.cache_o.load_category_list(pub, category_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
  4225
                        self.cache_o.load_section_list(pub, section_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
  4226
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  4227
        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
  4228
            category_list, section_list):
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4229
                """ This method set up image from the given directory and
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4230
                returns the image object or None"""
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4231
                pargs = []
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
  4232
                pargs.append("pkg://" + pub + "/*")
526
8c243883ae41 822 Depot traceback on "pkgsend -s <server> open foo"
Dan Price <dp@eng.sun.com>
parents: 510
diff changeset
  4233
                try:
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4234
                        pkgs_known = self.__get_inventory_list(pargs,
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4235
                            True, True)
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents: 562
diff changeset
  4236
                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
  4237
                        # 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
  4238
                        # 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
  4239
                        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
  4240
                        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
  4241
                            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
  4242
                        gobject.idle_add(self.unset_busy_cursor)
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
  4243
                        pkgs_known = []
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4244
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4245
                return self.__add_pkgs_to_lists(pkgs_known, application_list,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4246
                    category_list, section_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4247
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4248
        def __add_pkgs_to_lists(self, pkgs_known, application_list,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4249
            category_list, section_list):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4250
                if section_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4251
                        self.__init_sections(section_list)
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4252
                #Imageinfo for categories
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4253
                imginfo = imageinfo.ImageInfo()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4254
                sectioninfo = imageinfo.ImageInfo()
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  4255
                pubs = [p.prefix for p in self.api_o.get_publishers()]
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4256
                categories = {}
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4257
                sections = {}
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
  4258
                share_path = os.path.join(self.application_dir,
86d476d3d53f 10131 check for updates can traceback if check for updates is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1243
diff changeset
  4259
                    "usr/share/package-manager/data")
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  4260
                for pub in pubs:
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
  4261
                        category = imginfo.read(os.path.join(share_path, pub))
701
ba35d1b02c04 4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 697
diff changeset
  4262
                        if len(category) == 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
  4263
                                category = imginfo.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
  4264
                                    "opensolaris.org"))
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  4265
                        categories[pub] = category
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
  4266
                        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
  4267
                            pub + ".sections"))
701
ba35d1b02c04 4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 697
diff changeset
  4268
                        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
  4269
                                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
  4270
                                "opensolaris.org.sections"))
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  4271
                        sections[pub] = section
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4272
                pkg_count = 0
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4273
                pkg_add = 0
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4274
                total_pkg_count = len(pkgs_known)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4275
                status_str = _("Loading package list")
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4276
                gobject.idle_add(self.__update_statusbar_message, status_str)
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4277
                prev_stem = ""
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4278
                prev_pfmri_str = ""
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4279
                next_app = None
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4280
                pkg_name = None
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4281
                pkg_publisher = None
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4282
                prev_state = None
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4283
                for pkg, state in pkgs_known:
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4284
                        if prev_pfmri_str and \
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4285
                            prev_pfmri_str == pkg.get_short_fmri() and \
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4286
                            prev_state == state:
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4287
                                pkg_count += 1
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4288
                                continue
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1348
diff changeset
  4289
                        # XXX These image constants have to be used for now
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1348
diff changeset
  4290
                        # until there is a list api to replace inventory, etc.
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4291
                        if prev_stem and \
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4292
                            prev_stem == pkg.get_pkg_stem() and \
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1348
diff changeset
  4293
                            prev_state["state"] == image.Image.PKG_STATE_KNOWN and \
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1348
diff changeset
  4294
                            state["state"] == image.Image.PKG_STATE_INSTALLED:
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4295
                                pass
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4296
                        elif next_app != None:
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4297
                                self.__add_package_to_list(next_app,
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4298
                                    application_list,
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4299
                                    pkg_add, pkg_name,
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4300
                                    categories, category_list, pkg_publisher)
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4301
                                pkg_add += 1
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4302
                        prev_stem = pkg.get_pkg_stem()
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4303
                        prev_pfmri_str = pkg.get_short_fmri()
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4304
                        prev_state = state
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4305
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4306
                        gobject.idle_add(self.__progress_set_fraction,
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4307
                            pkg_count, total_pkg_count)
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4308
                        status_icon = None
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4309
                        pkg_name = pkg.get_name()
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1028
diff changeset
  4310
                        pkg_name = gui_misc.get_pkg_name(pkg_name)
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4311
                        pkg_stem = pkg.get_pkg_stem()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4312
                        pkg_publisher = pkg.get_publisher()
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4313
                        pkg_state = enumerations.NOT_INSTALLED
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1348
diff changeset
  4314
                        if state["state"] == image.Image.PKG_STATE_INSTALLED:
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4315
                                pkg_state = enumerations.INSTALLED
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4316
                                if state["upgradable"] == True:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4317
                                        status_icon = self.update_available_icon
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4318
                                        pkg_state = enumerations.UPDATABLE
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4319
                                else:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4320
                                        status_icon = self.installed_icon
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4321
                        else:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4322
                                status_icon = self.not_installed_icon
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4323
                        marked = False
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4324
                        pkgs = self.selected_pkgs.get(pkg_publisher)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4325
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4326
                                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
  4327
                                        marked = True
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4328
                        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
  4329
                            [
893
43894973bcdc 7010 Remove Blank Column together with data model.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 892
diff changeset
  4330
                                marked, status_icon, pkg_name, '...', pkg_state,
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4331
                                pkg, pkg_stem, None, True, None, pkg_publisher
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4332
                            ]
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4333
                        pkg_count += 1
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4334
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
  4335
                if next_app:
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  4336
                        self.__add_package_to_list(next_app, application_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
  4337
                            pkg_add, pkg_name, categories, 
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
  4338
                            category_list, pkg_publisher)
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  4339
                        pkg_add += 1
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4340
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4341
                        self.__add_categories_to_sections(sections,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4342
                            category_list, section_list)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4343
                gobject.idle_add(self.__progress_set_fraction,
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4344
                    pkg_count, total_pkg_count)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4345
                return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4346
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4347
        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
  4348
                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
  4349
                        for section in sections[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
  4350
                                for category in sections[pub][section].split(","):
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4351
                                        self.__add_category_to_section(_(category),
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4352
                                            _(section), category_list, section_list)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4353
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4354
                #1915 Sort the Categories into alphabetical order and prepend All Category
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4355
                if len(category_list) > 0:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4356
                        rows = [tuple(r) + (i,) for i, r in enumerate(category_list)]
510
35ac691b5187 3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 500
diff changeset
  4357
                        rows.sort(self.__sort)
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  4358
                        r = []
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
  4359
                        category_list.reorder(None, [r[-1] for r in rows])
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4360
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4361
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4362
        def __add_package_to_list(self, app, application_list, pkg_add,
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
  4363
            pkg_name, categories, 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
  4364
                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
  4365
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4366
                        return
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
  4367
                cat_pub = categories.get(pub)
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4368
                pkg_fmri = app[enumerations.FMRI_COLUMN]
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4369
                if pkg_fmri:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4370
                        pkg_name = pkg_fmri.get_name()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4371
                if pkg_name in cat_pub:
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4372
                        pkg_categories = cat_pub.get(pkg_name)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4373
                        for pcat in pkg_categories.split(","):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4374
                                self.__add_package_to_category(_(pcat), 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
  4375
                                    row_iter, application_list,
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4376
                                    category_list)
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4377
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4378
        @staticmethod
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4379
        def __add_package_to_category(category_name, category_description,
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
  4380
            package, application_list, category_list):
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4381
                if not package or category_name == _('All'):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4382
                        return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4383
                if not category_name:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4384
                        return
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4385
                category_id = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4386
                for category in category_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4387
                        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
  4388
                                category_id = category[enumerations.CATEGORY_ID]
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  4389
                                break
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4390
                if not category_id:                       # Category not exists
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4391
                        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
  4392
                        category_list.append(None, [category_id, category_name,
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
                            category_description, None])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4394
                if application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4395
                    enumerations.CATEGORY_LIST_COLUMN):
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4396
                        a = application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4397
                            enumerations.CATEGORY_LIST_COLUMN)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4398
                        a.append(category_id)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4399
                else:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4400
                        category_list = []
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4401
                        category_list.append(category_id)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4402
                        application_list.set(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4403
                            enumerations.CATEGORY_LIST_COLUMN, category_list)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4404
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
  4405
        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
  4406
                category_tree = self.__get_new_category_liststore()
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4407
                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
  4408
                            [ 0, _("All Categories"), 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
  4409
1406
46c950f90950 11475 The PM category tree includes categories from other publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1405
diff changeset
  4410
                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
  4411
                #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
  4412
                #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
  4413
                #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
  4414
                #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
  4415
                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
  4416
                        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
  4417
                                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
  4418
                        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
  4419
                                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
  4420
                        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
  4421
                                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
  4422
                                        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
  4423
                                                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
  4424
                                        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
  4425
                                                = 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
  4426
                                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
  4427
                                        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
  4428
                                                {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
  4429
                                                    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
  4430
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4431
                #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
  4432
                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
  4433
                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
  4434
                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
  4435
                        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
  4436
                        #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
  4437
                        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
  4438
                                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
  4439
                        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
  4440
                                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
  4441
                        count += 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
  4442
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4443
                        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
  4444
                            [ SECTION_ID_OFFSET + 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
  4445
                            "<b>" + section[enumerations.SECTION_NAME] + "</b>",
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4446
                            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
  4447
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4448
                        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
  4449
                                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
  4450
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4451
                        category_ids = 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
  4452
                        for cat_id in category_ids.keys():
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4453
                                category_tree.append(cat_iter, category_ids[cat_id])
1406
46c950f90950 11475 The PM category tree includes categories from other publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1405
diff changeset
  4454
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
  4455
                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
  4456
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4457
                #Initial startup expand default Section if available
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4458
                if visible_default_section_path and 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
  4459
                        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
  4460
                            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
  4461
                        return
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4462
                self.__restore_category_state()
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4463
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4464
        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
  4465
                #Restore expanded Category state
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4466
                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
  4467
                        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
  4468
                        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
  4469
                                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
  4470
                                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
  4471
                                        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
  4472
                #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
  4473
                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
  4474
                        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
  4475
                        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
  4476
                            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
  4477
                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
  4478
                        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
  4479
                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
  4480
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4481
        @staticmethod
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4482
        def __add_category_to_section(category_name, section_name, category_list,
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4483
            section_list):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4484
                '''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
  4485
                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
  4486
                is skipped. Sections must be case sensitive'''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4487
                if not category_name:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4488
                        return
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4489
                for section in section_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4490
                        if section[enumerations.SECTION_NAME] == section_name:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4491
                                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
  4492
                                for category in category_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4493
                                        if category[enumerations.CATEGORY_NAME] == \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4494
                                            category_name:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4495
                                                section_lst = category[ \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4496
                                                    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
  4497
                                                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
  4498
                                                    True
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4499
                                                if not section_lst:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4500
                                                        category[ \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4501
                                                    enumerations.SECTION_LIST_OBJECT] = \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4502
                                                            [section_id, ]
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4503
                                                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4504
                                                        if not section_name in \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4505
                                                            section_lst:
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4506
                                                                section_lst.append(
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4507
                                                                    section_id)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4508
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4509
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4510
        def __progress_set_fraction(self, count, total):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4511
                self.__progress_pulse_stop()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4512
                if count == total:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4513
                        self.w_progress_frame.hide()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4514
                        return False
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4515
                if self.api_o.can_be_canceled():
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4516
                        self.progress_cancel.show()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4517
                else:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4518
                        self.progress_cancel.hide()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4519
                self.w_progress_frame.show()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4520
                result = (count + 0.0)/total
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4521
                if result > 1.0:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4522
                        result = 1.0
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4523
                elif result < 0.0:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4524
                        result = 0.0
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4525
                self.w_status_progressbar.set_fraction(result)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4526
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4527
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4528
        def __progress_pulse_start(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4529
                if self.progress_stop_thread == True:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4530
                        self.progress_stop_thread = False
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4531
                        Thread(target = self.__progress_pulse).start()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4532
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4533
        def __progress_pulse_stop(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4534
                self.progress_stop_thread = True
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4535
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4536
        def __progress_pulse(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4537
                gobject.idle_add(self.w_progress_frame.show)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4538
                while not self.progress_stop_thread:
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4539
                        if self.api_o != None and self.api_o.can_be_canceled():
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4540
                                gobject.idle_add(self.progress_cancel.show)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4541
                        else:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4542
                                gobject.idle_add(self.progress_cancel.hide)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4543
                        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
  4544
                        time.sleep(0.1)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4545
                gobject.idle_add(self.w_progress_frame.hide)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4546
                self.progress_stop_thread = True
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4547
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4548
        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
  4549
                if msg_title:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4550
                        title = msg_title
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4551
                else:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4552
                        title = _("Package Manager")
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4553
                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
  4554
                    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
  4555
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4556
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4557
# Static Methods
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4558
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4559
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4560
        #@staticmethod
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4561
        #def N_(message):
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4562
        #        return message
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4563
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4564
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4565
        def __sort(a, b):
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4566
                return cmp(a[1], b[1])
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4567
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4568
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4569
        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
  4570
                '''Function which sets icon size'''
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4571
                if data == enumerations.FILTER_NAME:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4572
                        renderer.set_property("xalign", 0)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4573
                        renderer.set_property("width", max_filter_length + 10)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4574
                elif data == enumerations.FILTER_ICON:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4575
                        renderer.set_property("xalign", 0)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4576
                        renderer.set_property("width", 24)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4577
                return
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4578
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4579
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4580
        def cell_data_function(column, renderer, model, itr, data):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4581
                '''Function which sets the background colour to black 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
  4582
                selected'''
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4583
                if itr:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4584
                        if model.get_value(itr, enumerations.MARK_COLUMN):
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4585
                                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
  4586
                                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
  4587
                        else:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4588
                                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
  4589
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4590
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4591
        def combobox_separator(model, itr):
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4592
                return model.get_value(itr, enumerations.FILTER_NAME) == ""
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4593
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4594
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4595
        def combobox_id_separator(model, itr):
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  4596
                return model.get_value(itr, 0) == -1 and \
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  4597
                    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
  4598
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4599
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4600
        def combobox_filter_id_separator(model, itr):
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4601
                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
  4602
                    model.get_value(itr, 2) == ""
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4603
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4604
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4605
        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
  4606
                dt = None
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4607
                try:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4608
                        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
  4609
                except AttributeError:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4610
                        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
  4611
                return dt
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4612
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4613
        @staticmethod
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4614
        def __get_version(api_o, local, pkg):
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4615
                info = api_o.info([pkg], local, frozenset(
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4616
                    [api.PackageInfo.STATE, api.PackageInfo.IDENTITY]))
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4617
                found = info[api.ImageInterface.INFO_FOUND]
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4618
                try:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4619
                        version = found[0]
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4620
                except IndexError:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4621
                        version = None
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4622
                return version
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4623
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4624
#-----------------------------------------------------------------------------#
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4625
# Public Methods
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4626
#-----------------------------------------------------------------------------#
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4627
        def init_show_filter(self):
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4628
                """ Sets up the Filter Combobox and returns the maximum length of text
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4629
                    labels it is displaying."""
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4630
                return self.__init_show_filter()                #Initiates filter
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4631
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4632
        def reload_packages(self):
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4633
                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
  4634
                    self.pr, self.w_main_window)
1164
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1160
diff changeset
  4635
                self.cache_o = self.__get_cache_obj(self.icon_theme, 
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1160
diff changeset
  4636
                    self.application_dir, 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
  4637
                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
  4638
                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
  4639
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
  4640
        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
  4641
                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
  4642
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4643
        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
  4644
                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
  4645
                        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
  4646
                        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
  4647
                            'busy', True)
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  4648
                if not self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  4649
                        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
  4650
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4651
        def unset_busy_cursor(self):
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4652
                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
  4653
                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
  4654
                        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
  4655
                        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
  4656
                            '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
  4657
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4658
        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
  4659
                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
  4660
                        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
  4661
                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
  4662
                if self.first_run:
28b257c5f33e 12266 Wrong focus in package manager on startup
John Rice <john.rice@sun.com>
parents: 1446
diff changeset
  4663
                        self.__update_reload_button()
28b257c5f33e 12266 Wrong focus in package manager on startup
John Rice <john.rice@sun.com>
parents: 1446
diff changeset
  4664
                        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
  4665
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4666
        def __get_cache_obj(self, icon_theme, application_dir, api_o):
1164
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1160
diff changeset
  4667
                cache_o = cache.CacheListStores(icon_theme, application_dir,
1260
f41c7080c71f 8246 packagemanager doesn't change locale for category names.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
  4668
                    api_o, self.lang, self.update_available_icon, self.installed_icon,
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4669
                    self.not_installed_icon)
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  4670
                return cache_o
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  4671
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4672
        def __setup_search_completion(self):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4673
                completion = gtk.EntryCompletion()
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4674
                if self.cache_o != None:
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4675
                        self.cache_o.load_search_completion_info(self.search_completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4676
                completion.set_model(self.search_completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4677
                self.w_searchentry.set_completion(completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4678
                completion.set_text_column(0)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4679
                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
  4680
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  4681
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4682
        def process_package_list_end(self):
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  4683
                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
  4684
                if self.update_all_proceed:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  4685
                # TODO: Handle situation where only SUNWipkg/SUNWipg-gui have been updated
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  4686
                # in update all: bug 6357
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4687
                        self.__on_update_all(None)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4688
                        self.update_all_proceed = False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4689
                self.__enable_disable_install_remove()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4690
                self.update_statusbar()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4691
                self.in_setup = False
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4692
                self.cancelled = False
1441
45be39b77b70 12097 Selections switching issue
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1440
diff changeset
  4693
                active_filter = self.w_filter_combobox.get_active()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4694
                if self.set_section != 0 or \
1441
45be39b77b70 12097 Selections switching issue
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1440
diff changeset
  4695
                    active_filter != enumerations.FILTER_ALL:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4696
                        self.__application_refilter()
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4697
                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
  4698
                        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
  4699
                                self.unset_busy_cursor()
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4700
                
1261
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1260
diff changeset
  4701
                if self.user_rights and (self.first_run or self.in_reload):
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
  4702
                        Thread(target = self.__enable_disable_update_all,
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
  4703
                            args = (self.catalog_refresh_done,)).start()
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
  4704
                self.catalog_refresh_done = False
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4705
                self.in_reload = 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
  4706
                if self.first_run:
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  4707
                        if self.start_insearch:
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  4708
                                self.w_repository_combobox.set_active(
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  4709
                                    self.repo_combobox_all_pubs_index)
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  4710
                        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
  4711
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  4712
        def get_icon_pixbuf_from_glade_dir(self, icon_name):
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
  4713
                return gui_misc.get_pixbuf_from_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
  4714
                    os.path.join(self.application_dir, 
86d476d3d53f 10131 check for updates can traceback if check for updates is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1243
diff changeset
  4715
                    "usr/share/package-manager/"),
86d476d3d53f 10131 check for updates can traceback if check for updates is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1243
diff changeset
  4716
                    icon_name)
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  4717
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4718
        def update_statusbar(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4719
                '''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
  4720
                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
  4721
                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
  4722
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
  4723
                self.selected = 0
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
  4724
                visible_publisher = self.__get_selected_publisher()
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
  4725
                pkgs = self.selected_pkgs.get(visible_publisher)
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
  4726
                if pkgs:
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
  4727
                        self.selected = len(pkgs)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4728
                if not self.in_search_mode:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4729
                        if self.application_list == None:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4730
                                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
  4731
                        self.length_visible_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
  4732
                        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
  4733
                        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
  4734
                                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
  4735
                                        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
  4736
                        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
  4737
                                {"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
  4738
                                "selected": selected_in_list}
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4739
                        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
  4740
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4741
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4742
                # 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
  4743
                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
  4744
                        search_text = saxutils.escape(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
  4745
                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
  4746
                        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
  4747
                        e1 = "</b>"
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4748
                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
  4749
                        s1 = e1 = '"'
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4750
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4751
                if 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
  4752
                        active_pub = self.search_all_pub_being_searched
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4753
                        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
  4754
                        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
  4755
                                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
  4756
                                        _("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
  4757
                                        " 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
  4758
                                        {"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
  4759
                                        "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
  4760
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4761
                                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
  4762
                                        _("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
  4763
                                        "...") % \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4764
                                        {"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
  4765
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4766
                        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
  4767
                                _("%(number)d packages found matching %(s1)s"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  4768
                                "%(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
  4769
                                {"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
  4770
                                    "s1": s1, "search_text": search_text, "e1": e1, }
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4771
                self.__update_statusbar_message(status_str)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4772
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4773
        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
  4774
                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
  4775
                self.__remove_pkg_stem_from_list(pkg_stem)
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4776
                if self.info_cache.has_key(pkg_stem):
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4777
                        del self.info_cache[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
  4778
                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
  4779
                    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
  4780
                package_installed =  False
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4781
                if package_info:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4782
                        package_installed =  \
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  4783
                            (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
  4784
                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
  4785
                        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
  4786
                            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
  4787
                        if (package_info and
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  4788
                            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
  4789
                                row[enumerations.STATUS_COLUMN] = \
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4790
                                    enumerations.INSTALLED
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4791
                                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
  4792
                                    self.installed_icon
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4793
                        else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4794
                                row[enumerations.STATUS_COLUMN] = \
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4795
                                    enumerations.UPDATABLE
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4796
                                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
  4797
                                    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
  4798
                else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4799
                        row[enumerations.STATUS_COLUMN] = \
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4800
                            enumerations.NOT_INSTALLED
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  4801
                        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
  4802
                            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
  4803
                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
  4804
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
  4805
        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
  4806
                for row in full_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
  4807
                        if row[enumerations.NAME_COLUMN] in 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
  4808
                                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
  4809
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
  4810
        @staticmethod
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
  4811
        def __update_package_list_names(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
  4812
                i = 0
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
  4813
                while i < len(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
  4814
                        package_list[i] = gui_misc.get_pkg_name(package_list[i])
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
  4815
                        i +=  1
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
  4816
                return 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
  4817
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  4818
        def update_package_list(self, update_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
  4819
                if update_list == None and self.img_timestamp:
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4820
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4821
                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
  4822
                default_publisher = self.default_publisher
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  4823
                self.api_o.refresh()
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
  4824
                if not self.img_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
  4825
                        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
  4826
                        self.__on_reload(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
  4827
                        return
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
  4828
                self.img_timestamp = self.cache_o.get_index_timestamp()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4829
                visible_list = update_list.get(visible_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
  4830
                if self.is_all_publishers:
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
  4831
                        for pub in self.api_o.get_publishers():
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
  4832
                                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
  4833
                                        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
  4834
                                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
  4835
                                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
  4836
                                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
  4837
                                        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
  4838
                                            self.__update_package_list_names(
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
  4839
                                            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
  4840
                                        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
  4841
                                            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
  4842
                                            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
  4843
                                        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
  4844
                                                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
  4845
                                                        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
  4846
                                                        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
  4847
                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
  4848
                        visible_list = self.__update_package_list_names(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
  4849
                        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
  4850
                                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
  4851
                        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
  4852
                                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
  4853
                                        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
  4854
                                        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
  4855
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
  4856
                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
  4857
                        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
  4858
                                pkg_list = update_list.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4859
                                for pkg in pkg_list:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4860
                                        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
  4861
                                        if pub != default_publisher:
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4862
                                                pkg_stem = "pkg://%s/%s" % \
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
  4863
                                                        (pub, pkg)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4864
                                        else:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4865
                                                pkg_stem = "pkg:/%s" % pkg
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4866
                                        if pkg_stem:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4867
                                                if self.info_cache.has_key(pkg_stem):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4868
                                                        del self.info_cache[pkg_stem]
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4869
                                                self.__remove_pkg_stem_from_list(pkg_stem)
1343
ed33c7d18988 10904 pkg-manger GUI: inventory exception w/o further information
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1342
diff changeset
  4870
                # 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
  4871
                self.__set_visible_status(False)
861
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  4872
                self.__process_package_selection()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4873
                self.__enable_disable_selection_menus()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4874
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4875
                self.update_statusbar()
1310
f3e695af29ab 10466 some error messages when installing or removing a package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1289
diff changeset
  4876
                Thread(target = self.__enable_disable_update_all,
f3e695af29ab 10466 some error messages when installing or removing a package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1289
diff changeset
  4877
                    args = (False,)).start()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4878
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
  4879
        def __catalog_refresh_message(self, cre):
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
  4880
                total = cre.total
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
  4881
                succeeded = cre.succeeded
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
  4882
                ermsg = _("Network problem.\n\n")
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
  4883
                ermsg += _("Details:\n")
1418
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
  4884
                ermsg += _("%s/%s catalogs successfully updated:\n") % (
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
  4885
                    succeeded, total)
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
  4886
                for pub, err in cre.failed:
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
  4887
                        ermsg += "%s: %s\n" % (pub["origin"], str(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
  4888
                gobject.idle_add(self.error_occurred, ermsg,
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
  4889
                    None, gtk.MESSAGE_INFO)
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
  4890
1028
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4891
        @staticmethod
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4892
        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
  4893
                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
  4894
                 
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4895
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4896
                        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
  4897
                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
  4898
                        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
  4899
                                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
  4900
                        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
  4901
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  4902
                        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
  4903
                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
  4904
                        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
  4905
                                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
  4906
                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
  4907
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4908
        def restart_after_ips_update(self, be_name):
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4909
                self.__main_application_quit(be_name)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4910
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4911
        def shutdown_after_image_update(self):
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4912
                info_str = _("The Update All action is now complete and "
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
  4913
                    "Package Manager will close.\n\nReview the posted release notes "
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
  4914
                    "before rebooting your system:\n\n"
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4915
                    )
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4916
                self.w_ua_completed_release_label.set_text(info_str.strip('\n'))
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4917
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4918
                info_str = misc.get_release_notes_url()
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4919
                self.w_ua_completed_linkbutton.set_uri(info_str)
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4920
                self.w_ua_completed_linkbutton.set_label(info_str)
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4921
                self.release_notes_url = info_str
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4922
                
1123
22aa471c4112 9024 Typos in pkgmgr error popup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1122
diff changeset
  4923
                self.w_ua_completed_dialog.set_title(_("Update All Complete"))
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 1014
diff changeset
  4924
                self.w_ua_completed_dialog.show()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4925
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4926
        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
  4927
                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
  4928
                    self.pr, self.w_main_window)
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4929
                self.cache_o = self.__get_cache_obj(self.icon_theme,
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4930
                    self.application_dir, self.api_o)
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4931
                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
  4932
                self.__setup_search_completion()
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4933
                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
  4934
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4935
        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
  4936
                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
  4937
                
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4938
        def start(self):
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4939
                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
  4940
                Thread(target = self.__get_api_object).start() 
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  4941
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4942
###############################################################################
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4943
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4944
# Main
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4945
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4946
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4947
def main():
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4948
        gtk.main()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4949
        return 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4950
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4951
if __name__ == '__main__':
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  4952
        debug = False
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  4953
        debug_descriptions = False
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4954
        max_filter_length = 0
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4955
        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
  4956
        ua_be_name = None
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4957
        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
  4958
        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
  4959
        info_install_arg = None
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  4960
        save_selected = _("Save selected...")
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  4961
        save_selected_pkgs = _("Save selected packages...")
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  4962
        reboot_needed = _("The installed package(s) require a reboot before "
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  4963
            "installation can be completed.")
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4964
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4965
        try:
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  4966
                opts, args = getopt.getopt(sys.argv[1:], "hR:U:i:", \
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  4967
                    ["help", "image-dir=", "update-all=", "info-install="])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4968
        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
  4969
                print "%s, for help use --help" % msg
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4970
                sys.exit(2)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4971
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
  4972
        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
  4973
                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
  4974
        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
  4975
                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
  4976
                app_path = os.path.realpath(cmd)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4977
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4978
        for option, argument in opts:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4979
                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
  4980
                        print """\
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4981
Use -R (--image-dir) to specify image directory.
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4982
Use -U (--update-all) to proceed with Update All"""
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4983
                        sys.exit(0)
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4984
                if option in ("-R", "--image-dir"):
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  4985
                        image_dir = argument
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4986
                if 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
  4987
                        update_all_proceed = True
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4988
                        ua_be_name = argument
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4989
                if 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
  4990
                        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
  4991
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4992
        if image_dir == None:
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4993
                try:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4994
                        image_dir = os.environ["PKG_IMAGE"]
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4995
                except KeyError:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4996
                        image_dir = os.getcwd()
1160
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4997
        try:
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  4998
                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
  4999
        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
  5000
                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
  5001
                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
  5002
                sys.exit(1)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5003
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5004
        # Setup webinstall
1138
b45431845444 8966 PM should be able to handle p5i data from a webserver without a .p5i extension
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1137
diff changeset
  5005
        if info_install_arg or len(sys.argv) == 2:
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5006
                webinstall = webinstall.Webinstall(image_dir)
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  5007
                if len(sys.argv) == 2:
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  5008
                        info_install_arg = sys.argv[1]
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
  5009
                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
  5010
                main()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5011
                sys.exit(0)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5012
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5013
        # Setup packagemanager
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5014
        packagemanager = PackageManager()
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5015
        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
  5016
        packagemanager.image_directory = image_dir
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5017
        packagemanager.update_all_proceed = update_all_proceed
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5018
        packagemanager.ua_be_name = ua_be_name
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5019
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5020
        while gtk.events_pending():
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5021
                gtk.main_iteration(False)
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5022
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5023
        max_filter_length = 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
  5024
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5025
        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
  5026
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5027
        main()