src/packagemanager.py
author John Rice <john.rice@sun.com>
Mon, 14 Dec 2009 11:48:36 +0000
changeset 1572 b1bcb39eb27c
parent 1571 d66522ea16be
child 1573 ae7488fbff6a
permissions -rw-r--r--
13234 PM Package Version Info failing in certain instances
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1512
diff changeset
     1
#!/usr/bin/python2.6
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     2
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     3
# CDDL HEADER START
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     4
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     8
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    12
# and limitations under the License.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    13
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    19
#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    20
# CDDL HEADER END
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
    21
#
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
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
    30
PUBLISHER_INSTALLED = 0                   # Index for "All Publishers (Installed)" string
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
    31
PUBLISHER_ALL = 1                         # Index for "All Publishers (Search)" string
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
    32
PUBLISHER_ADD = 2                         # Index for "Add..." string
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
    33
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
    34
SHOW_LICENSE_DELAY = 600    # Delay before showing license information
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
    35
RESIZE_DELAY = 600          # Delay before handling resize for startpage
1074
f6b6a4290aa2 8335 Search All Repositories should match CLI default search behavior
John Rice <john.rice@sun.com>
parents: 1071
diff changeset
    36
SEARCH_STR_FORMAT = "<%s>"
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
    37
MIN_APP_WIDTH = 750                       # Minimum application width
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
    38
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
    39
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
    40
                                          # in category tree
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    41
RECENT_SEARCH_ID_OFFSET = 10999           # Offset to allow Recent Search Sections
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    42
                                          # to be identified in category tree
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    43
RECENT_SEARCH_ID = RECENT_SEARCH_ID_OFFSET + 1 #  Recent Search Section ID
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    44
CATEGORY_TOGGLE_ICON_WIDTH = 16           # Width of category toggle icon
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
    45
PACKAGEMANAGER_PREFERENCES = "/apps/packagemanager/preferences"
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
    46
MAX_SEARCH_COMPLETION_PREFERENCES = \
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
    47
        "/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
    48
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
    49
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
    50
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
    51
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
    52
INITIAL_SHOW_FILTER_PREFERENCES = "/apps/packagemanager/preferences/initial_show_filter"
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
    53
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
    54
LAST_EXPORT_SELECTION_PATH = \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
    55
        "/apps/packagemanager/preferences/last_export_selections_path"
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    56
SHOW_STARTPAGE_PREFERENCES = "/apps/packagemanager/preferences/show_startpage"
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
    57
SHOW_IMAGE_UPDATE_CONFIRMATION = "/apps/packagemanager/preferences/imageupdate_confirm"
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
    58
SHOW_INSTALL_CONFIRMATION = "/apps/packagemanager/preferences/install_confirm"
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
    59
SHOW_REMOVE_CONFIRMATION = "/apps/packagemanager/preferences/remove_confirm"
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
    60
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
    61
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
    62
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
    63
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
    64
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
    65
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
    66
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
    67
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
    68
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
    69
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    70
PKG_CLIENT_NAME = "packagemanager"
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
    71
1164
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1160
diff changeset
    72
# 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
    73
ICON_LOCATION = "usr/share/package-manager/icons"
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    74
# 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
    75
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
    76
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
    77
START_PAGE_HOME = "startpage.html" # Default page
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    78
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    79
# 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
    80
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
    81
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    82
# 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
    83
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
    84
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
    85
                               # 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
    86
INTERNAL_SEARCH = 'search'     # Internal field: search support page action
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    87
INTERNAL_SEARCH_VIEW_RESULTS = "view_recent_search"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
    88
                               # Internal field: view recent 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
    89
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
    90
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
    91
                                                      # 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
    92
INTERNAL_SEARCH_ALL_PUBS = "search_all_publishers" #Internal field: search all publishers
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
    93
INTERNAL_SEARCH_ALL_PUBS_INSTALLED = "search_all_publishers_installed"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
    94
                               #Internal field: search all publishers installed
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
    95
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
    96
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
    97
# 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
    98
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
    99
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
   100
                               # default browser without protocol scheme specified
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   101
EXTERNAL_PROTOCOL = 'protocol' # External field: optional protocol scheme,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   102
                               # defaults to http
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   103
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
   104
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
   105
            "<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
   106
            "<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
   107
            )                  
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   108
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   109
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
   110
import pwd
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   111
import os
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   112
import sys
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   113
import time
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   114
import locale
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   115
import itertools
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   116
import urllib
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   117
import urlparse
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
   118
import socket
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   119
import gettext
830
687f8a73665e 6019 ctrl-c hangs packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 827
diff changeset
   120
import signal
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
   121
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
   122
import re
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   123
import stat
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   124
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
   125
from xml.sax import saxutils
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   126
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
   127
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
   128
from collections import deque
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
   129
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
   130
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   131
try:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   132
        import gobject
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   133
        import gnome
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   134
        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
   135
        import gconf
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   136
        import gtk
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   137
        import gtk.glade
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   138
        import pygtk
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   139
        pygtk.require("2.0")
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   140
        import gtkhtml2
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
   141
        import pango
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   142
        from glib import GError
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   143
except ImportError:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   144
        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
   145
import pkg.misc as misc
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   146
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
   147
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
   148
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
   149
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
   150
import pkg.portable as portable
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   151
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
   152
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
   153
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
   154
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
   155
import pkg.gui.misc as gui_misc
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   156
import pkg.gui.imageinfo as imageinfo
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   157
import pkg.gui.installupdate as installupdate
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   158
import pkg.gui.enumerations as enumerations
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   159
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
   160
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
   161
from pkg.client import global_settings
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   162
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   163
# 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
   164
import __builtin__
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   165
__builtin__._ = gettext.gettext
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
   166
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   167
(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   168
DISPLAY_LINK,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   169
CLICK_LINK,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   170
) = range(2)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   171
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   172
REGEX_STRIP_MARKUP = re.compile(r'<.*?>')
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   173
REGEX_STRIP_RESULT = re.compile(r'\(\d+\) ?')
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   174
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   175
class PackageManager:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   176
        def __init__(self):
830
687f8a73665e 6019 ctrl-c hangs packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 827
diff changeset
   177
                signal.signal(signal.SIGINT, self.__main_application_quit)
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   178
                self.__reset_home_dir()
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   179
                self.api_o = None
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
   180
                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
   181
                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
   182
                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
   183
                try:
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   184
                        self.max_search_completion = \
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   185
                            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
   186
                        self.initial_show_filter = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   187
                            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
   188
                        self.initial_section = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   189
                            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
   190
                        self.last_export_selection_path = \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   191
                            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
   192
                        self.show_startpage = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   193
                            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
   194
                        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
   195
                            self.client.get_bool(SAVE_STATE_PREFERENCES)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   196
                        self.show_image_update = \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   197
                            self.client.get_bool(SHOW_IMAGE_UPDATE_CONFIRMATION)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   198
                        self.show_install = \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   199
                            self.client.get_bool(SHOW_INSTALL_CONFIRMATION)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   200
                        self.show_remove = \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   201
                            self.client.get_bool(SHOW_REMOVE_CONFIRMATION)
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
   202
                        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
   203
                            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
   204
                        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
   205
                            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
   206
                        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
   207
                            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
   208
                        self.initial_app_width = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   209
                            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
   210
                        self.initial_app_height = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   211
                            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
   212
                        self.initial_app_hpos = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   213
                            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
   214
                        self.initial_app_vpos = \
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   215
                            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
   216
                        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
   217
                            gconf.CLIENT_PRELOAD_NONE)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   218
                        self.client.notify_add(SHOW_IMAGE_UPDATE_CONFIRMATION,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   219
                            self.__show_image_update_changed)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   220
                        self.client.notify_add(SHOW_INSTALL_CONFIRMATION,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   221
                            self.__show_install_changed)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   222
                        self.client.notify_add(SHOW_REMOVE_CONFIRMATION,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   223
                            self.__show_remove_changed)
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
   224
                        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
   225
                            self.__save_state_changed)
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   226
                except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   227
                        # 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
   228
                        # packagemanager-preferences.schemas
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   229
                        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
   230
                        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
   231
                        self.initial_section = 2
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   232
                        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
   233
                        self.show_startpage = True
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   234
                        self.show_image_update = True
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   235
                        self.show_install = True
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   236
                        self.show_remove = 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
   237
                        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
   238
                        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
   239
                        self.lastsource = ""
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   240
                        self.gconf_not_show_repos = ""
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   241
                        self.initial_app_width = 800
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   242
                        self.initial_app_height = 600
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
   243
                        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
   244
                        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
   245
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   246
                self.__fix_initial_values()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   247
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   248
                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
   249
                self.in_search_mode = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   250
                self.in_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   251
                self.recent_searches = {}
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   252
                self.recent_searches_cat_iter = None
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   253
                self.adding_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   254
                self.recent_searches_list = []
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
   255
                
1218
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   256
                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
   257
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1187
diff changeset
   258
                # 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
   259
                # transport framework uses the defaults in global_settings,
49cd5492effc 9996 Exception thrown after cancel of install
johansen <johansen@sun.com>
parents: 1217
diff changeset
   260
                # 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
   261
                # 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
   262
                # 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
   263
                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
   264
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   265
                try:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   266
                        self.application_dir = os.environ["PACKAGE_MANAGER_ROOT"]
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   267
                except KeyError:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   268
                        self.application_dir = "/"
791
123e9401e939 5778 Inability to set locale leads to stack trace
Danek Duvall <danek.duvall@sun.com>
parents: 781
diff changeset
   269
                misc.setlocale(locale.LC_ALL, "")
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   270
                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
   271
                        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
   272
                            self.application_dir,
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
   273
                            "usr/share/locale"))
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   274
                        module.textdomain("pkg")
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
   275
                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
   276
                self.main_window_title = _('Package Manager')
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   277
                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
   278
                self.user_rights = portable.is_admin()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   279
                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
   280
                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
   281
                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
   282
                self.image_directory = None
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   283
                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
   284
                self.progress_stop_thread = True
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
   285
                self.update_all_proceed = False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   286
                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
   287
                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
   288
                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
   289
                self.exiting = False
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   290
                self.first_run = True
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   291
                self.selected_pkgstem = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   292
                self.selected_model = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
   293
                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
   294
                self.info_cache = {}
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   295
                self.all_selected = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   296
                self.selected_pkgs = {}
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
   297
                self.link_load_page = ""
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
   298
                self.start_page_url = None
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   299
                self.to_install_update = {}
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   300
                self.to_remove = {}
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   301
                self.in_startpage_startup = self.show_startpage
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   302
                self.lang = None
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   303
                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
   304
                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
   305
                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
   306
                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
   307
                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
   308
                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
   309
                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
   310
                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
   311
                    'status_installed')
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   312
                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
   313
                    'status_notinstalled')
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   314
                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
   315
                    '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
   316
                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
   317
                    'packagemanager', 48)
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   318
                self.filter_options = [
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   319
                    (enumerations.FILTER_ALL,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   320
                    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
   321
                    _('All Packages')),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   322
                    (enumerations.FILTER_INSTALLED, self.installed_icon,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   323
                    _('Installed Packages')),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   324
                    (enumerations.FILTER_UPDATES, self.update_available_icon,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   325
                    _('Updates')),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   326
                    (enumerations.FILTER_NOT_INSTALLED, self.not_installed_icon,
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   327
                    _('Not Installed Packages')),
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   328
                    (-1, None, ""),
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   329
                    (enumerations.FILTER_SELECTED,
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   330
                    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
   331
                    _('Selected Packages'))
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
   332
                    ]
1246
01cf34c415f4 10141 Wrong file saved in GUI cache
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1245
diff changeset
   333
                self.publisher_options = { 
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   334
                    PUBLISHER_INSTALLED : _("All Publishers (Installed)"),
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   335
                    PUBLISHER_ALL : _("All Publishers (Search)"),
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   336
                    PUBLISHER_ADD : _("Add...")
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   337
                    }
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   338
                self.pubs_disabled_status = {}
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   339
                self.last_visible_publisher = None
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   340
                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
   341
                self.search_start = 0
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   342
                self.search_time_sec = 0
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
   343
                self.search_all_pub_being_searched = None
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
   344
                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
   345
                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
   346
                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
   347
                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
   348
                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
   349
                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
   350
                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
   351
                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
   352
                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
   353
                self.category_list = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   354
                self.repositories_list = None
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   355
                self.repo_combobox_all_pubs_installed_index = 0
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   356
                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
   357
                self.repo_combobox_add_index = 0
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   358
                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
   359
                self.pylintstub = None
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
   360
                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
   361
                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
   362
                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
   363
                
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
   364
                self.use_cache = False # Turns off Details Description cache
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
   365
                                       # Search history cache is always on
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
   366
                                       # Caching package list is removed
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
   367
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   368
                # 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
   369
                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
   370
                    "usr/share/package-manager/packagemanager.glade")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   371
                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
   372
                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
   373
                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
   374
                    "api_search_error")
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   375
                self.w_preferencesdialog = \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   376
                    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
   377
                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
   378
                self.w_startpage_checkbutton = \
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   379
                    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
   380
                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
   381
                    w_tree_preferences.get_widget("exit_checkbutton")
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   382
                self.w_confirm_updateall_checkbutton = \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   383
                    w_tree_preferences.get_widget("confirm_updateall_checkbutton")
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   384
                self.w_confirm_install_checkbutton = \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   385
                    w_tree_preferences.get_widget("confirm_install_checkbutton")
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   386
                self.w_confirm_remove_checkbutton = \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   387
                    w_tree_preferences.get_widget("confirm_remove_checkbutton")
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   388
                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
   389
                    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
   390
                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
   391
                    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
   392
                self.api_search_checkbox = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   393
                    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
   394
                self.api_search_button = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   395
                    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
   396
                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
   397
                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
   398
                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
   399
                self.w_exportconfirm_dialog = \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   400
                    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
   401
                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
   402
                self.w_confirmok_button = w_tree_confirm.get_widget("ok_conf")
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   403
                self.w_confirmhelp_button = w_tree_confirm.get_widget("help_conf")
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   404
                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
   405
                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
   406
                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
   407
                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
   408
                    gtk.ICON_SIZE_DND)
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   409
                self.__setup_export_selection_dialog()
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   410
                
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   411
                w_version_info = gtk.glade.XML(self.gladefile,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   412
                    "version_info_dialog")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   413
                self.w_version_info_dialog = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   414
                    w_version_info.get_widget("version_info_dialog")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   415
                self.w_info_name_label = w_version_info.get_widget("info_name")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   416
                self.w_info_installed_label = w_version_info.get_widget("info_installed")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   417
                self.w_info_installable_label = w_version_info.get_widget(
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   418
                    "info_installable")
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
   419
                self.w_info_installable_prefix_label = w_version_info.get_widget(
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
   420
                    "info_installable_label")
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   421
                self.w_info_ok_button = w_version_info.get_widget("info_ok_button")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   422
                self.w_info_expander = w_version_info.get_widget("version_info_expander")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   423
                self.w_info_textview = w_version_info.get_widget("infotextview")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   424
                infobuffer = self.w_info_textview.get_buffer()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   425
                infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)                
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   426
                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
   427
                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
   428
                self.w_main_hpaned = \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   429
                    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
   430
                self.w_main_vpaned = \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   431
                    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
   432
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   433
                self.w_application_treeview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   434
                    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
   435
                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
   436
                    self.__on_applicationtreeview_button_and_key_events)
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   437
                self.w_application_treeview.set_enable_search(True)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   438
                self.w_application_treeview.set_search_equal_func(
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   439
                      self.__applicationtreeview_compare_func)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   440
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   441
                self.w_categories_treeview = w_tree_main.get_widget("categoriestreeview")
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   442
                self.w_categories_treeview.set_search_equal_func(
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   443
                    self.__categoriestreeview_compare_func)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   444
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   445
                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
   446
                self.w_generalinfo_textview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   447
                    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
   448
                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
   449
                    "bold", weight=pango.WEIGHT_BOLD)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   450
                self.w_installedfiles_textview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   451
                    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
   452
                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
   453
                    "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
   454
                self.w_license_textview = \
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   455
                    w_tree_main.get_widget("licensetextview")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   456
                self.w_dependencies_textview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   457
                    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
   458
                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
   459
                    "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
   460
                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
   461
                    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
   462
                self.w_startpage_frame = \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   463
                    w_tree_main.get_widget("startpage_frame")
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   464
                self.w_startpage_eventbox = \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   465
                    w_tree_main.get_widget("startpage_eventbox")
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   466
                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
   467
                    gtk.gdk.color_parse("white"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   468
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   469
                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
   470
                #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
   471
                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
   472
                        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
   473
                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
   474
                        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
   475
    
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   476
                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
   477
                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
   478
                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
   479
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   480
                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
   481
                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
   482
                self.w_status_progressbar.set_pulse_step(0.1)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   483
                self.w_progress_frame.hide()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   484
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   485
                self.w_main_view_notebook = \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   486
                    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
   487
                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
   488
                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
   489
                try:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   490
                        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
   491
                except TypeError:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   492
                        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
   493
                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
   494
                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
   495
                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
   496
                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
   497
                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
   498
                self.w_installupdate_button = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   499
                    w_tree_main.get_widget("install_update_button")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   500
                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
   501
                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
   502
                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
   503
                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
   504
                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
   505
                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
   506
                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
   507
                    'pm-refresh')
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   508
                self.w_version_info_menuitem = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   509
                    w_tree_main.get_widget("package_version_info")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   510
                self.w_version_info_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   511
                self.w_installupdate_menuitem = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   512
                    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
   513
                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
   514
                    self.w_installupdate_menuitem, 'pm-install_update')
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   515
                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
   516
                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
   517
                    'pm-remove')
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   518
                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
   519
                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
   520
                    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
   521
                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
   522
                    "file_export_selections")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   523
                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
   524
                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
   525
                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
   526
                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
   527
                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
   528
                self.w_selectupdates_menuitem = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   529
                    w_tree_main.get_widget("edit_select_updates")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   530
                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
   531
                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
   532
                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
   533
                self.saved_filter_combobox_active = self.initial_show_filter
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   534
                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
   535
                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
   536
                self.is_all_publishers = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   537
                self.is_all_publishers_installed = 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
   538
                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
   539
                self.saved_section_active = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   540
                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
   541
                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
   542
                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
   543
                self.saved_category_list = None
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   544
                self.saved_section_list = None
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   545
                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
   546
                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
   547
                self.statusbar_message_id = 0
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
   548
                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
   549
                toolbar.set_expand(True)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   550
                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
   551
                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
   552
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   553
                # Setup Start Page
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   554
                self.document = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   555
                self.view = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   556
                self.current_url = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   557
                self.opener = None
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   558
                self.__setup_startpage(self.show_startpage)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   559
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   560
                try:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   561
                        dic_mainwindow = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   562
                            {
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   563
                                "on_mainwindow_delete_event": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   564
                                    self.__on_mainwindow_delete_event,
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   565
                                "on_mainwindow_check_resize": \
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   566
                                    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
   567
                                "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
   568
                                    self.__on_mainwindow_key_press_event,
1480
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   569
                                "on_mainwindow_style_set": \
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   570
                                    self.__on_mainwindow_style_set,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   571
                                "on_searchentry_changed":self.__on_searchentry_changed,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   572
                                "on_searchentry_focus_in_event": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   573
                                    self.__on_searchentry_focus_in,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   574
                                "on_searchentry_focus_out_event": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   575
                                    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
   576
                                "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
   577
                                    self.__do_search,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   578
                                "on_filtercombobox_changed": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   579
                                    self.__on_filtercombobox_changed,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   580
                                "on_repositorycombobox_changed": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   581
                                    self.__on_repositorycombobox_changed,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   582
                                #menu signals
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   583
                                "on_file_export_selections": \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   584
                                        self.__on_file_export_selections,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   585
                                "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
   586
                                "on_file_be_activate":self.__on_file_be_activate,
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   587
                                "on_package_version_info_activate": \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   588
                                    self.__on_version_info,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   589
                                "on_package_install_update_activate": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   590
                                    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
   591
                                "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
   592
                                    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
   593
                                "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
   594
                                    self.__on_file_add_publisher,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   595
                                "on_package_remove_activate":self.__on_remove,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   596
                                "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
   597
                                "on_help_help_activate":self.__on_help_help,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   598
                                "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
   599
                                "on_edit_delete_activate":self.__on_delete,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   600
                                "on_edit_copy_activate":self.__on_copy,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   601
                                "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
   602
                                "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
   603
                                "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
   604
                                "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
   605
                                "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
   606
                                "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
   607
                                "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
   608
                                "on_progress_cancel_clicked": \
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   609
                                    self.__on_progress_cancel_clicked,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   610
                                "on_edit_select_all_activate":self.__on_select_all,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   611
                                "on_edit_select_updates_activate": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   612
                                    self.__on_select_updates,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   613
                                "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
   614
                                "on_edit_preferences_activate":self.__on_preferences,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   615
                                # XXX disabled until new API
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   616
                                "on_package_update_all_activate":self.__on_update_all,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   617
                                #toolbar signals
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   618
                                # XXX disabled until new API
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   619
                                "on_update_all_button_clicked":self.__on_update_all,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   620
                                "on_reload_button_clicked":self.__on_reload,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   621
                                "on_install_update_button_clicked": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   622
                                    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
   623
                                "on_remove_button_clicked":self.__on_remove,
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   624
                                "on_help_start_page_activate":self.__on_startpage,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   625
                                "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
   626
                                    self.__on_notebook_change,
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   627
                                "on_infosearch_button_clicked": \
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   628
                                    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
   629
                                "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
   630
                                    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
   631
                                "on_applicationtreeview_query_tooltip": \
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
   632
                                    self.__on_applicationtreeview_query_tooltip,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   633
                            }
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   634
                        dic_preferences = \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   635
                            {
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   636
                                "on_preferencesdialog_delete_event": \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   637
                                    self.__on_preferencesdialog_delete_event,
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   638
                                "on_startpage_checkbutton_toggled": \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   639
                                    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
   640
                                "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
   641
                                    self.__on_exit_checkbutton_toggled,
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   642
                                "on_confirm_updateall_checkbutton_toggled": \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   643
                                    self.on_confirm_updateall_checkbutton_toggled,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   644
                                "on_confirm_install_checkbutton_toggled": \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   645
                                    self.on_confirm_install_checkbutton_toggled,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   646
                                "on_confirm_remove_checkbutton_toggled": \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   647
                                    self.on_confirm_remove_checkbutton_toggled,
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   648
                                "on_preferenceshelp_clicked": \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   649
                                    self.__on_preferenceshelp_clicked,
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   650
                                "on_preferencesclose_clicked": \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   651
                                    self.__on_preferencesclose_clicked,
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   652
                            }
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   653
                        dic_api_search_error = \
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   654
                            {
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   655
                                "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
   656
                                    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
   657
                                "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
   658
                                    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
   659
                                "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
   660
                                    self.__on_api_search_error_delete_event,
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   661
                            }
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
   662
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   663
                        dic_confirm = \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   664
                            {
1533
c0e5725362e6 12857 Export Selection confirmation dialog does not handle delete event
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1531
diff changeset
   665
                                "on_confirmationdialog_delete_event": \
c0e5725362e6 12857 Export Selection confirmation dialog does not handle delete event
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1531
diff changeset
   666
                                    self.__on_confirmation_dialog_delete_event,
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   667
                                "on_help_conf_clicked": \
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   668
                                    self.__on_confirm_help_button_clicked,
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   669
                                "on_ok_conf_clicked": \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   670
                                    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
   671
                                "on_cancel_conf_clicked": \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   672
                                    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
   673
                            }        
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   674
                            
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   675
                        dic_version_info = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   676
                            {
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   677
                                "on_info_ok_clicked": \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   678
                                    self.__on_info_ok_button_clicked,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   679
                                "on_info_help_clicked": \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   680
                                    self.__on_info_help_button_clicked,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   681
                                "on_version_info_dialog_delete_event": \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   682
                                    self.__on_version_info_dialog_delete_event,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   683
                            }        
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   684
                        w_tree_confirm.signal_autoconnect(dic_confirm)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   685
                        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
   686
                        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
   687
                        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
   688
                            dic_api_search_error)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   689
                        w_version_info.signal_autoconnect(dic_version_info)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   690
                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
   691
                        print _(
1418
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
   692
                            "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
   693
                            "Check declare_signals()") \
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   694
                            % error
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   695
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   696
                self.package_selection = None
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
   697
                self.application_list_filter = None
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   698
                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
   699
                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
   700
                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
   701
                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
   702
                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
   703
                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
   704
                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
   705
                self.show_licenses_id = 0
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
   706
                self.resize_id = 0
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
   707
                self.last_resize = (0, 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
   708
                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
   709
                self.in_setup = True
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   710
                self.__set_initial_sizes()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   711
                self.w_main_window.show_all()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   712
                self.__setup_busy_cursor()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   713
                if self.show_startpage:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   714
                        self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   715
                else:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   716
                        self.w_main_view_notebook.set_current_page(
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   717
                            NOTEBOOK_PACKAGE_LIST_PAGE)
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   718
                self.api_search_error_dialog.set_transient_for(self.w_main_window)
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   719
                self.w_version_info_dialog.set_transient_for(self.w_main_window)
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   720
                self.__setup_text_signals()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   721
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   722
        def __set_initial_sizes(self):
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   723
                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
   724
                        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
   725
                        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
   726
                            self.initial_app_height)
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   727
                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
   728
                        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
   729
                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
   730
                        self.w_main_vpaned.set_position(self.initial_app_vpos)
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   731
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   732
        def __setup_busy_cursor(self):
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   733
                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
   734
                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
   735
                    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
   736
                gdk_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   737
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   738
                self.gdk_window.set_cursor(gdk_cursor)
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   739
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   740
        def __fix_initial_values(self):
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   741
                if self.initial_app_width == -1:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   742
                        self.initial_app_width = 800
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   743
                if self.initial_app_height == -1:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   744
                        self.initial_app_height = 600
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   745
                if self.initial_app_hpos == -1:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   746
                        self.initial_app_hpos = 200
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   747
                if self.initial_app_vpos == -1:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   748
                        self.initial_app_vpos = 320
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   749
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   750
                if not self.gconf_not_show_repos:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   751
                        self.gconf_not_show_repos = ""
1368
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   752
        @staticmethod
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   753
        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
   754
                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
   755
                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
   756
                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
   757
                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
   758
                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
   759
                    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
   760
                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
   761
                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
   762
                    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
   763
                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
   764
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   765
        @staticmethod
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   766
        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
   767
                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
   768
                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
   769
                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
   770
                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
   771
                        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
   772
                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
   773
                        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
   774
                        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
   775
                                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
   776
                        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
   777
                                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
   778
                return None
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   779
                
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   780
        def __setup_export_selection_dialog(self):
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   781
                infobuffer = self.w_confirm_textview.get_buffer()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   782
                infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   783
                self.w_exportconfirm_dialog.set_title(_("Export Selections Confirmation"))
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   784
                self.w_confirm_label.set_markup(
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   785
                    _("<b>Export the following to a Web Install .p5i file:</b>"))
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   786
                self.w_confirmhelp_button.set_property('visible', True)
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   787
1533
c0e5725362e6 12857 Export Selection confirmation dialog does not handle delete event
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1531
diff changeset
   788
        def __on_confirmation_dialog_delete_event(self, widget, event):
c0e5725362e6 12857 Export Selection confirmation dialog does not handle delete event
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1531
diff changeset
   789
                self.__on_confirm_cancel_button_clicked(None)
c0e5725362e6 12857 Export Selection confirmation dialog does not handle delete event
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1531
diff changeset
   790
                return True
c0e5725362e6 12857 Export Selection confirmation dialog does not handle delete event
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1531
diff changeset
   791
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   792
        @staticmethod
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   793
        def __on_confirm_help_button_clicked(widget):
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   794
                gui_misc.display_help("webinstall")
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   795
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   796
        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
   797
                self.w_exportconfirm_dialog.hide()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   798
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   799
        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
   800
                self.w_exportconfirm_dialog.hide()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   801
                self.__export_selections()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   802
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   803
        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
   804
                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
   805
                        return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   806
                        
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   807
                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
   808
                infobuffer.set_text("")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   809
                textiter = infobuffer.get_end_iter()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   810
                
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   811
                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
   812
                        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
   813
                            "%s\n" % pub_name, "bold")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   814
                        for pkg in pkgs.keys():
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   815
                                infobuffer.insert(textiter,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   816
                                    "\t%s\n" % fmri.extract_pkg_name(pkg))
1481
2db11049f8b1 12109 Manage Publishers UI feedback
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1480
diff changeset
   817
                self.w_confirmok_button.grab_focus()                
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   818
                self.w_exportconfirm_dialog.show()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   819
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   820
        def __export_selections(self):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   821
                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
   822
                if not filename:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   823
                        return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   824
                try:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   825
                        fobj = open(filename, 'w')
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   826
                except IOError, ex_sel:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   827
                        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
   828
                        return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   829
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   830
                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
   831
                    pubs=self.selected_pkgs.keys())
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   832
                fobj.close()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   833
                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
   834
                    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
   835
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   836
        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
   837
                filename = None
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   838
                chooser = gtk.FileChooserDialog(_("Export Selections"), 
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   839
                    self.w_main_window,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   840
                    gtk.FILE_CHOOSER_ACTION_SAVE,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   841
                    (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
   842
                    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
   843
        
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   844
                file_filter = gtk.FileFilter()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   845
                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
   846
                file_filter.add_pattern("*.p5i")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   847
                chooser.add_filter(file_filter)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   848
                file_filter = gtk.FileFilter()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   849
                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
   850
                file_filter.add_pattern("*")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   851
                chooser.add_filter(file_filter)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   852
                
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   853
                path = tempfile.gettempdir()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   854
                name = _("my_packages")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   855
                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
   856
                        self.last_export_selection_path != "":
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   857
                        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
   858
                            self.last_export_selection_path)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   859
                        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
   860
                        self.pylintstub = ext
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   861
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   862
                #Check name
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   863
                base_name = None
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   864
                m = re.match("(.*)(-\d+)$", name)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   865
                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
   866
                        base_name = name
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   867
                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
   868
                        base_name = m.group(1)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   869
                name = name + '.p5i'
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   870
                if base_name:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   871
                        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
   872
                                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
   873
                                        str(i) + '.p5i'
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   874
                                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
   875
                                        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
   876
                                        break
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   877
                chooser.set_current_folder(path)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   878
                chooser.set_current_name(name)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   879
                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
   880
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   881
                response = chooser.run()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   882
                if response == gtk.RESPONSE_OK:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   883
                        filename = chooser.get_filename()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   884
                        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
   885
                chooser.destroy()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   886
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   887
                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
   888
1480
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   889
        @staticmethod
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   890
        def __on_mainwindow_style_set(widget, previous_style):
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   891
                ''' This is called when theme is changed.
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   892
                We need to change the status icons in the Package List,
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   893
                the search icon and the icons in the filter list'''
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   894
                return
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   895
                
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
   896
        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
   897
                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
   898
                        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
   899
                                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
   900
                        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
   901
                                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
   902
                                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
   903
                        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
   904
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   905
                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
   906
                        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
   907
                                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
   908
                        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
   909
                        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
   910
        
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   911
        def __search_completion_cb(self, entry):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   912
                text = entry.get_text()
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   913
                if text:
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   914
                        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
   915
                                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
   916
                                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
   917
                                        len_search_completion >= \
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   918
                                                self.max_search_completion:
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   919
                                        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
   920
                                        if itr:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   921
                                                self.search_completion.remove(itr)
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   922
                                self.search_completion.append([text])
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   923
                return
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   924
                
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
   925
        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
   926
                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
   927
                    "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
   928
                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
   929
                    "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
   930
                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
   931
                    "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
   932
                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
   933
                    "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
   934
                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
   935
                    "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
   936
                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
   937
                    "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
   938
                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
   939
                    "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
   940
                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
   941
                    "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
   942
                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
   943
                    "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
   944
                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
   945
                    "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
   946
                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
   947
                    "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
   948
                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
   949
                    "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
   950
                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
   951
                    "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
   952
                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
   953
                    "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
   954
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   955
        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
   956
                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
   957
                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
   958
                        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
   959
                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
   960
                        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
   961
                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
   962
                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
   963
                        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
   964
                        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
   965
                        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
   966
                                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
   967
                        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
   968
                        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
   969
                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
   970
                        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
   971
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   972
        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
   973
                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
   974
                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
   975
                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
   976
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
   977
        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
   978
                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
   979
                        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
   980
                        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
   981
                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
   982
                        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
   983
                        self.w_deselect_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   984
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   985
        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
   986
                if self.is_all_publishers:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   987
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   988
                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
   989
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   990
        def __setup_startpage(self, show_startpage):
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   991
                self.opener = urllib.FancyURLopener()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   992
                self.document = gtkhtml2.Document()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   993
                self.document.connect('request_url', self.__request_url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   994
                self.document.connect('link_clicked', self.__handle_link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   995
                self.document.clear()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   996
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   997
                self.view = gtkhtml2.View()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   998
                self.view.set_document(self.document)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   999
                self.view.connect('request_object', self.__request_object)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1000
                self.view.connect('on_url', self.__on_url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1001
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1002
                try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1003
                        self.lang, encode = locale.getlocale(locale.LC_CTYPE)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1004
                        if debug:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1005
                                print "Lang: %s: Encode: %s" % (self.lang, encode)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1006
                except locale.Error:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1007
                        self.lang = "C"
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1008
                if self.lang == None or self.lang == "":
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1009
                        self.lang = "C"
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1010
                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
  1011
                # 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
  1012
                self.__load_startpage()
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1013
                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
  1014
                        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
  1015
                                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
  1016
                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
  1017
                        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
  1018
                                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
  1019
                        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
  1020
                                NOTEBOOK_PACKAGE_LIST_PAGE)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1021
                self.w_startpage_frame.add(self.view)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1022
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1023
        # Stub handler required by GtkHtml widget
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1024
        def __request_object(self, *vargs):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1025
                pass
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1026
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1027
        def __load_startpage(self):
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1028
                self.link_load_page = ""
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1029
                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
  1030
                        return
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1031
                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
  1032
                        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
  1033
                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
  1034
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1035
        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
  1036
                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
  1037
                        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
  1038
                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
  1039
                        return True
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1040
                        
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1041
                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
  1042
                        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
  1043
                                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
  1044
                        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
  1045
                                return True
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1046
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
  1047
                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
  1048
                        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
  1049
                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
  1050
                        return True
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1051
                return False
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1052
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1053
        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
  1054
                self.document.open_stream('text/html')
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
  1055
                self.document.write_stream(_(
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
  1056
                    "<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
  1057
                    "PackageManager!</H2><br>"
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
  1058
                    "<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
  1059
                    "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
  1060
                    % (start_page_url))
955
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
  1061
                self.document.close_stream()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  1062
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1063
        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
  1064
                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
  1065
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1066
                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
  1067
                        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
  1068
                            (pub, _("failed to respond"), err))
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1069
                for pub in error.invalid_servers:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1070
                        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
  1071
                            (pub, _("invalid response"),
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1072
                                _("A valid response was not returned.")))
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1073
                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
  1074
                        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
  1075
                            (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
  1076
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  1077
        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
  1078
                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
  1079
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1080
        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
  1081
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1082
                        return
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1083
                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
  1084
                        self.w_infosearch_frame.hide()
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  1085
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1086
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1087
                repo_count = 0
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1088
                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
  1089
                        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
  1090
                                repo_count += 1
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1091
                if repo_count == 0:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1092
                        self.w_infosearch_frame.hide()
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1093
                        return
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1094
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1095
                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
  1096
                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
  1097
                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
  1098
                infobuffer.set_text("")
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1099
                textiter = infobuffer.get_end_iter()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1100
                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
  1101
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1102
                        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
  1103
                                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
  1104
                                    "%(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
  1105
                                    "err_type": err_type}, "bold")
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1106
                                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
  1107
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1108
                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
  1109
                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
  1110
                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
  1111
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1112
        def __on_url(self, view, link):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1113
                # 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
  1114
                if link == None or link == "":
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1115
                        self.update_statusbar()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1116
                else:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1117
                        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
  1118
                        if display_link != None:
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1119
                                self.__update_statusbar_message(display_link)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1120
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1121
                                self.update_statusbar()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1122
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1123
        @staticmethod
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1124
        def __is_relative_to_server(url):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1125
                parts = urlparse.urlparse(url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1126
                if parts[0] or parts[1]:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1127
                        return 0
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1128
                return 1
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1129
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1130
        def __open_url(self, url):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1131
                uri = self.__resolve_uri(url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1132
                return self.opener.open(uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1133
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1134
        def __resolve_uri(self, uri):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1135
                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
  1136
                        return urlparse.urljoin(self.current_url, uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1137
                return uri
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1138
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1139
        def __request_url(self, document, url, stream):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1140
                f = self.__open_url(url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1141
                stream.set_cancel_func(self.__stream_cancel)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1142
                stream.write(f.read())
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1143
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1144
        # 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
  1145
        def __stream_cancel(self, *vargs):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1146
                pass
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1147
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1148
        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
  1149
                self.__update_statusbar_message(_("Loading... %s") % link)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1150
                try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1151
                        f = self.__open_url(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1152
                except  (IOError, OSError), err:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1153
                        if debug:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1154
                                print "err: %s" % (err)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1155
                        self.__update_statusbar_message(_("Stopped"))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1156
                        return False
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1157
                self.current_url = self.__resolve_uri(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1158
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1159
                self.document.clear()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1160
                headers = f.info()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1161
                mime = headers.getheader('Content-type').split(';')[0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1162
                if mime:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1163
                        self.document.open_stream(mime)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1164
                else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1165
                        self.document.open_stream('text/plain')
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1166
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1167
                self.document.write_stream(f.read())
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1168
                self.document.close_stream()
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1169
                self.__update_statusbar_message(_("Done"))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1170
                return True
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1171
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1172
        def __link_load_error(self, link):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1173
                self.document.clear()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1174
                self.document.open_stream('text/html')
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1175
                self.document.write_stream(_(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1176
                    "<html><head></head><body><font color='#000000'>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1177
                    <a href='stub'></a></font>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1178
                    <a href='pm?%s=internal&uri=%s'>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1179
                    <IMG SRC = 'startpage_star.png' \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1180
                    style='border-style: none'></a> <br><br>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1181
                    <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
  1182
                    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
  1183
                    % (PM_ACTION, START_PAGE_HOME, link))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1184
                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
  1185
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1186
        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
  1187
                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
  1188
                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
  1189
                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
  1190
                        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
  1191
                                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
  1192
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1193
                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
  1194
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1195
        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
  1196
                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
  1197
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1198
                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
  1199
                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
  1200
                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
  1201
                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
  1202
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1203
        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
  1204
                self.__set_search_start()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1205
                self.is_all_publishers_installed = False
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1206
                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
  1207
                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
  1208
                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
  1209
                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
  1210
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1211
        def __handle_view_all_publishers_installed(self):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1212
                self.w_filter_combobox.set_active(enumerations.FILTER_ALL)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1213
                self.__set_main_view_package_list()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1214
                self.update_statusbar()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1215
                
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1216
        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
  1217
                query_dict = self.__urlparse_qs(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1218
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1219
                action = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1220
                if query_dict.has_key(PM_ACTION):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1221
                        action = query_dict[PM_ACTION][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1222
                elif handle_what == DISPLAY_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1223
                        return link
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1224
                ext_uri = ""
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1225
                protocol = None
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1226
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1227
                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
  1228
                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
  1229
                        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
  1230
                                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
  1231
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1232
                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
  1233
                        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
  1234
                        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
  1235
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1236
                        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
  1237
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1238
                # 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
  1239
                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
  1240
                        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
  1241
                        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
  1242
                                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
  1243
                                        {"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
  1244
                        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
  1245
                        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
  1246
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1247
                # 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
  1248
                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
  1249
                        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
  1250
                                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
  1251
                                        {"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
  1252
                        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
  1253
                        return
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1254
                # Change view to All Publishers (Installed)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1255
                if search_action and search_action == INTERNAL_SEARCH_ALL_PUBS_INSTALLED:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1256
                        if handle_what == DISPLAY_LINK:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1257
                                return _("View installed packages for %(s1)sAll "
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1258
                                    "Publishers%(e1)s") % {"s1": s1, "e1": e1}
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1259
                        self.__handle_view_all_publishers_installed()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1260
                        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
  1261
                # 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
  1262
                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
  1263
                        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
  1264
                                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
  1265
                                        {"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
  1266
                        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
  1267
                        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
  1268
                        return                        
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1269
                # 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
  1270
                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
  1271
                        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
  1272
                                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
  1273
                                        {"s1": s1, "e1": e1}
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1274
                        self.__update_statusbar_message(
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1275
                            _("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
  1276
                            {"s1": s1, "e1": e1})
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  1277
                        gui_misc.display_help("search-pkg")
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1278
                        return
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1279
                # View Recent Search Results
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1280
                if search_action and \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1281
                        search_action.find(INTERNAL_SEARCH_VIEW_RESULTS) > -1:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1282
                        recent_search = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1283
                                re.findall(r'<span>(.*)<\/span>', search_action)[0]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1284
                        if handle_what == DISPLAY_LINK:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1285
                                return _("View results for %s") % recent_search
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1286
                        category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1287
                        if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1288
                                return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1289
                        rs_iter = category_tree.iter_children(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1290
                            self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1291
                        while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1292
                                rs_value = category_tree.get_value(rs_iter,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1293
                                    enumerations.CATEGORY_NAME)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1294
                                if rs_value == recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1295
                                        path = category_tree.get_path(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1296
                                        self.w_categories_treeview.set_cursor(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1297
                                        self.w_categories_treeview.scroll_to_cell(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1298
                                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1299
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1300
                        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
  1301
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1302
                # Internal Browse
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1303
                if action == ACTION_INTERNAL:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1304
                        if query_dict.has_key(INTERNAL_URI):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1305
                                int_uri = query_dict[INTERNAL_URI][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1306
                                if handle_what == DISPLAY_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1307
                                        return int_uri
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1308
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1309
                                if handle_what == CLICK_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1310
                                        self.__link_load_error(_("No URI specified"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1311
                                return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1312
                        if handle_what == CLICK_LINK and \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1313
                            not self.__load_uri(document, int_uri):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1314
                                self.__link_load_error(int_uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1315
                        return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1316
                # External browse
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1317
                elif action == ACTION_EXTERNAL:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1318
                        if query_dict.has_key(EXTERNAL_URI):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1319
                                ext_uri = query_dict[EXTERNAL_URI][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1320
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1321
                                if handle_what == CLICK_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1322
                                        self.__link_load_error(_("No URI specified"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1323
                                return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1324
                        if query_dict.has_key(EXTERNAL_PROTOCOL):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1325
                                protocol = query_dict[EXTERNAL_PROTOCOL][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1326
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1327
                                protocol = DEFAULT_PROTOCOL
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1328
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1329
                        if handle_what == DISPLAY_LINK:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1330
                                return protocol + "://" + ext_uri
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1331
                        try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1332
                                gnome.url_show(protocol + "://" + ext_uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1333
                        except gobject.GError:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1334
                                self.__link_load_error(protocol + "://" + ext_uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1335
                elif handle_what == DISPLAY_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1336
                        return None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1337
                elif action == None:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1338
                        try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1339
                                gnome.url_show(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1340
                        except gobject.GError:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1341
                                self.__link_load_error(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1342
                # Handle empty and unsupported actions
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1343
                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
  1344
                        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
  1345
                        return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1346
                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
  1347
                        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
  1348
                        return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1349
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1350
        def __link_load_page(self, text =""):
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1351
                self.link_load_page = text
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1352
                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
  1353
                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
  1354
                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
  1355
                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
  1356
                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
  1357
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1358
        @staticmethod
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1359
        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
  1360
                scheme, netloc, url, params, querystring, fragment = urlparse.urlparse(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1361
                    url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1362
                if debug:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1363
                        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
  1364
                            "querystring %s, fragment %s"
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1365
                            % (scheme, netloc, url, params, querystring, fragment))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1366
                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
  1367
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1368
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1369
        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
  1370
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1371
                        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
  1372
                        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
  1373
                        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
  1374
                        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
  1375
                        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
  1376
                        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
  1377
                        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
  1378
                        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
  1379
                        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
  1380
                        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
  1381
                        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
  1382
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1383
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1384
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1385
        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
  1386
                return gtk.TreeStore(
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1387
                        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
  1388
                        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
  1389
                        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
  1390
                        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
  1391
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1392
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1393
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1394
        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
  1395
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1396
                        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
  1397
                        gobject.TYPE_STRING,      # enumerations.SECTION_NAME
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1398
                        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
  1399
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1400
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1401
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1402
        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
  1403
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1404
                        gobject.TYPE_INT,         # enumerations.FILTER_ID
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1405
                        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
  1406
                        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
  1407
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1408
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1409
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1410
        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
  1411
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1412
                        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
  1413
                        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
  1414
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1415
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1416
        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
  1417
            application_list_filter, application_list_sort,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1418
            application_sort_column):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1419
                ##APPLICATION MAIN TREEVIEW
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1420
                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
  1421
                        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
  1422
                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
  1423
                        application_list_sort = \
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1424
                            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
  1425
                        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
  1426
                            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
  1427
                        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
  1428
                            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
  1429
                            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
  1430
                            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
  1431
                        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
  1432
                            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
  1433
                            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
  1434
                            enumerations.DESCRIPTION_COLUMN)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1435
                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
  1436
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1437
                column = gtk.TreeViewColumn("", toggle_renderer,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1438
                    active = enumerations.MARK_COLUMN)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1439
                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
  1440
                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
  1441
                column.connect('clicked', self.__select_column_clicked)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1442
                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
  1443
                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
  1444
                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
  1445
                    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
  1446
                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
  1447
                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
  1448
                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
  1449
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1450
                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
  1451
                column = gtk.TreeViewColumn(_("Name"), name_renderer,
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1452
                    text = enumerations.NAME_COLUMN)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1453
                column.set_resizable(True)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1454
                column.set_min_width(150)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1455
                column.set_sort_column_id(enumerations.NAME_COLUMN)
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1456
                column.set_sort_indicator(True)
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1457
                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
  1458
                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
  1459
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1460
                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
  1461
                column = self.__create_icon_column(_("Status"), True,
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1462
                    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
  1463
                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
  1464
                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
  1465
                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
  1466
                    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
  1467
                self.w_application_treeview.append_column(column)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1468
                if self.is_all_publishers or self.is_all_publishers_installed or \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1469
                        self.in_recent_search:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1470
                        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
  1471
                        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
  1472
                            repository_renderer,
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1473
                            markup = enumerations.PUBLISHER_COLUMN)
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  1474
                        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
  1475
                        column.set_resizable(True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1476
                        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
  1477
                        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
  1478
                            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
  1479
                        column.connect_after('clicked',
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1480
                            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
  1481
                        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
  1482
                        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
  1483
                            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
  1484
                            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
  1485
                            enumerations.PUBLISHER_COLUMN)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1486
                description_renderer = gtk.CellRendererText()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1487
                column = gtk.TreeViewColumn(_('Description'),
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1488
                    description_renderer,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1489
                    text = enumerations.DESCRIPTION_COLUMN)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1490
                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
  1491
                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
  1492
                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
  1493
                column.set_cell_data_func(description_renderer,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1494
                    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
  1495
                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
  1496
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1497
                self.w_application_treeview.append_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1498
                #Added selection listener
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1499
                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
  1500
                self.application_list = application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1501
                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
  1502
                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
  1503
                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
  1504
                    application_list_sort)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1505
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1506
        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
  1507
            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
  1508
            application_list_sort = None, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1509
            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
  1510
                '''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
  1511
                filters'''
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1512
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1513
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1514
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1515
                        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
  1516
                        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
  1517
                elif application_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1518
                        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
  1519
                        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
  1520
                else:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1521
                        self.__disconnect_models()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1522
                        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
  1523
                        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
  1524
                # 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
  1525
                # 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
  1526
                # section to "All Categories" one.
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1527
                if section_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1528
                        row = section_list[self.set_section]
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1529
                        if row[enumerations.SECTION_ENABLED] and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1530
                            self.set_section >= 0 and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1531
                            self.set_section < len(section_list):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1532
                                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
  1533
                                        self.set_section = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1534
                        else:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1535
                                self.set_section = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1536
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1537
                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
  1538
                        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
  1539
                            application_list_filter, application_list_sort, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1540
                            application_sort_column)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1541
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1542
                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
  1543
                        # 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
  1544
                        # 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
  1545
                        # and scrolling up and down using keyboard.
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1546
                        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
  1547
                        vadj.connect('value-changed',
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1548
                            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
  1549
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1550
                        # 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
  1551
                        # 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
  1552
                        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
  1553
                            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
  1554
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  1555
                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
  1556
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1557
                        ##CATEGORIES TREEVIEW
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1558
                        enumerations.CATEGORY_NAME_renderer = gtk.CellRendererText()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1559
                        column = gtk.TreeViewColumn(_('Name'),
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1560
                            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
  1561
                            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
  1562
                        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
  1563
                        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
  1564
                        #Added selection listener
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1565
                        category_selection.set_mode(gtk.SELECTION_SINGLE)
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  1566
                        self.w_categories_treeview.set_search_column(
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  1567
                            enumerations.CATEGORY_NAME)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1568
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1569
                if section_list != None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1570
                        self.section_list = section_list
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1571
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1572
                        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
  1573
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1574
                if application_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1575
                        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
  1576
                            self.application_list_sort)
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1577
                        if application_list_filter == None:
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1578
                                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
  1579
                                    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
  1580
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1581
                if self.first_run:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1582
                        category_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1583
                            self.__on_category_selection_changed, None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1584
                        self.w_categories_treeview.connect("row-activated",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1585
                            self.__on_category_row_activated, None)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1586
                        self.w_categories_treeview.connect("focus-in-event",
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1587
                            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
  1588
                        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
  1589
                            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
  1590
                        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
  1591
                            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
  1592
                        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
  1593
                            self.__on_categoriestreeview_row_expanded, None)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1594
                        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
  1595
                        self.package_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1596
                            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
  1597
                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
  1598
                        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
  1599
                self.a11y_application_treeview = \
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1600
                    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
  1601
                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
  1602
                if obj != None:
4501e2b0febd 11382 traceback on console when starting packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1357
diff changeset
  1603
                        obj.set_name(_("all selection toggle"))
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1604
                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
  1605
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1606
        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
  1607
                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
  1608
                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
  1609
                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
  1610
                    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
  1611
                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
  1612
                    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
  1613
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1614
                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
  1615
                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
  1616
                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
  1617
                    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
  1618
                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
  1619
                    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
  1620
                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
  1621
                    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
  1622
                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
  1623
                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
  1624
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1625
        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
  1626
                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
  1627
                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
  1628
                    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
  1629
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1630
        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
  1631
                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
  1632
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1633
        def __init_repository_tree_view(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1634
                cell = gtk.CellRendererText()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1635
                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
  1636
                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
  1637
                    enumerations.REPOSITORY_NAME)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1638
                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
  1639
                    self.combobox_id_separator)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1640
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1641
        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
  1642
                # 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
  1643
                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
  1644
                        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
  1645
                            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
  1646
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1647
        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
  1648
                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
  1649
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1650
        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
  1651
                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
  1652
                if status == enumerations.INSTALLED:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1653
                        desc = _("Installed")
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1654
                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
  1655
                        desc = _("Not Installed")
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1656
                elif status == enumerations.UPDATABLE:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1657
                        desc = _("Updates Available")
864
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1658
                else:
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1659
                        desc = None
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1660
                if desc != None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1661
                        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
  1662
                            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
  1663
                            STATUS_COLUMN_INDEX)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1664
                        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
  1665
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1666
        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
  1667
                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
  1668
                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
  1669
                    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
  1670
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1671
                if self.__doing_search():
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1672
                        return
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1673
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1674
                a11y_enabled = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1675
                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
  1676
                        a11y_enabled = True
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1677
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1678
                if not a11y_enabled:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1679
                        return
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1680
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1681
                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
  1682
                if visible_range == None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1683
                        return
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1684
                a11y_start = visible_range[0][0]
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1685
                a11y_end = visible_range[1][0]
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1686
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1687
                # 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
  1688
                # reduce the amount of processing to be done in that case.
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1689
                # 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
  1690
                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
  1691
                        check_range = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1692
                        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
  1693
                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
  1694
                        check_range = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1695
                
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1696
                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
  1697
                        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
  1698
                                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
  1699
                                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
  1700
                                 # 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
  1701
                                 # 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
  1702
                                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
  1703
                                    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
  1704
                                        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
  1705
                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1706
                                        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
  1707
                                                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
  1708
                                                        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
  1709
                                                                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
  1710
                                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1711
                                                        a11y_start = old_end
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1712
                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
  1713
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1714
                sort_filt_model = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1715
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  1716
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1717
                if a11y_enabled:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1718
                        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
  1719
                            str(a11y_start))                
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1720
                        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
  1721
                                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
  1722
                                a11y_start += 1
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1723
                                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
  1724
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1725
        def __doing_search(self):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1726
                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
  1727
                
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1728
        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
  1729
                column = gtk.TreeViewColumn()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1730
                column.set_title(name)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1731
                #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
  1732
                #column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1733
                render_pixbuf = gtk.CellRendererPixbuf()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1734
                column.pack_start(render_pixbuf, expand = expand_pixbuf)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1735
                column.add_attribute(render_pixbuf, "pixbuf", enum_value)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1736
                column.set_fixed_width(32)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1737
                if set_data_func:
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1738
                        column.set_cell_data_func(render_pixbuf,
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1739
                            self.cell_data_function, None)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1740
                return column
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1741
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1742
        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
  1743
                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
  1744
                        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
  1745
                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
  1746
                        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
  1747
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1748
        def __disconnect_repository_model(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1749
                self.w_repository_combobox.set_model(None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1750
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1751
        @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
  1752
        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
  1753
                get_val = treemodel.get_value
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1754
                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
  1755
                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
  1756
                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
  1757
                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
  1758
                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
  1759
                        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
  1760
                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
  1761
                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
  1762
                return cmp(name1, name2)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1763
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1764
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1765
        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
  1766
                columns = treeview.get_columns()
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1767
                if columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1768
                        for column in columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1769
                                treeview.remove_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1770
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1771
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1772
        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
  1773
                '''This function is for initializing the sections list'''
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1774
                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
  1775
                # 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
  1776
                # 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
  1777
                # 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
  1778
                section_list.append([0, _('All Categories'), enabled ])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1779
                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
  1780
                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
  1781
                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
  1782
                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
  1783
                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
  1784
                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
  1785
                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
  1786
                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
  1787
                section_list.append([8, _('Web Services'), enabled ])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1788
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1789
        def __init_show_filter(self):
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1790
                max_length = 0
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1791
                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
  1792
                        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
  1793
                        if filter_id == -1:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1794
                                continue
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1795
                        max_length = self.__get_max_text_length(
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1796
                            max_length, label, self.w_filter_combobox)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1797
                
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1798
                if self.initial_show_filter >= enumerations.FILTER_ALL and \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1799
                    self.initial_show_filter < len(self.filter_list):
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1800
                        row = self.filter_list[self.initial_show_filter]
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1801
                        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
  1802
                                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
  1803
                else:
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1804
                        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
  1805
                return max_length
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1806
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1807
        @staticmethod
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1808
        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
  1809
                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
  1810
                        return 0
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1811
                context = widget.get_pango_context()
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1812
                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
  1813
                current_length = pango.PIXELS(
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1814
                    metrics.get_approximate_char_width() * len(text))
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1815
                if current_length > length_to_check:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1816
                        return current_length
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1817
                else:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1818
                        return length_to_check
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1819
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
  1820
        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
  1821
                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
  1822
                        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
  1823
                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
  1824
                        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
  1825
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1826
        def __on_mainwindow_delete_event(self, widget, event):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1827
                ''' handler for delete event of the main window '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1828
                if self.__check_if_something_was_changed() == True:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1829
                        # XXX Change this to not quit and show dialog
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1830
                        # XXX if some changes were applied:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1831
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1832
                        return True
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1833
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1834
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1835
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1836
        def __handle_resize(self, widget):
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1837
                if self.last_resize == widget.get_size():
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1838
                        return
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1839
                self.last_resize = widget.get_size()
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1840
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1841
                if self.w_main_view_notebook.get_current_page() == NOTEBOOK_START_PAGE:
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1842
                        if self.link_load_page == "":
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1843
                                self.__load_startpage()
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1844
                        else:
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1845
                                self.__link_load_page(self.link_load_page)
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1846
                
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1847
        def __on_mainwindow_check_resize(self, widget):
1495
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1848
                if not widget or not self.gdk_window:
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1849
                        return
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1850
                if self.resize_id != 0:
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1851
                        gobject.source_remove(self.resize_id)
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1852
                        self.resize_id = 0
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1853
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1854
                self.resize_id = \
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1855
                            gobject.timeout_add(RESIZE_DELAY,
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1856
                                self.__handle_resize, widget)
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1857
                                
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1858
                status_height = self.w_statusbar_hbox.get_allocation().height
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1859
                self.gdk_window.move_resize(0, 0, widget.get_size()[0],
337bdfbe58d8 12520 Accessible layout of HTML content does not get fully updated when PM window is resized
John Rice <john.rice@sun.com>
parents: 1488
diff changeset
  1860
                    widget.get_size()[1]-status_height)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1861
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1862
        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
  1863
                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
  1864
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  1865
        def __on_preferencesdialog_delete_event(self, widget, event):
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  1866
                self.__on_preferencesclose_clicked(None)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  1867
                return True
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  1868
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1869
        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
  1870
                self.api_search_error_dialog.hide()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  1871
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1872
        def __on_file_quit_activate(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1873
                ''' handler for quit menu event '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1874
                self.__on_mainwindow_delete_event(None, None)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1875
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1876
        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
  1877
                ''' 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
  1878
                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
  1879
                    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
  1880
                    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
  1881
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1882
        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
  1883
                ''' 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
  1884
                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
  1885
                    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
  1886
                    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
  1887
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1888
        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
  1889
                ''' 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
  1890
                beadm.Beadmin(self)
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1891
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1892
        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
  1893
                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
  1894
                        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
  1895
                        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
  1896
                                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
  1897
                                    gtk.STOCK_CANCEL)
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1898
                                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
  1899
                                   "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
  1900
                        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
  1901
                else:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1902
                        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
  1903
                                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
  1904
                                    None)
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  1905
                        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
  1906
                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
  1907
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1908
        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
  1909
                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
  1910
                        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
  1911
                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
  1912
                        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
  1913
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1914
        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
  1915
                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
  1916
                        try:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1917
                                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
  1918
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1919
                        except AttributeError:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1920
                                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
  1921
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1922
                        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
  1923
        
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1924
        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
  1925
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1926
                        return
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1927
                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
  1928
                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
  1929
                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
  1930
                        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
  1931
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1932
        def __setup_before_all_publishers_mode(self):
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1933
                self.is_all_publishers_installed = False
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1934
                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
  1935
                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
  1936
                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
  1937
                
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1938
                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
  1939
                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
  1940
                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
  1941
                # 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
  1942
                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
  1943
                    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
  1944
                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
  1945
                        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
  1946
                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
  1947
                        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
  1948
                            NOTEBOOK_START_PAGE)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1949
                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
  1950
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1951
        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
  1952
                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
  1953
                        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
  1954
                        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
  1955
  
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1956
        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
  1957
                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
  1958
                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
  1959
                    "<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
  1960
                    "<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
  1961
                    "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
  1962
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1963
                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
  1964
                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
  1965
                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
  1966
                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
  1967
                        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
  1968
                        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
  1969
                                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
  1970
                                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
  1971
                                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
  1972
                                        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
  1973
                                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
  1974
                                        (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
  1975
                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
  1976
                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
  1977
                    "<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
  1978
                    "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
  1979
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1980
                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
  1981
                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
  1982
                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
  1983
                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
  1984
                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
  1985
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1986
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1987
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1988
        def __setup_search_installed_page(self, text):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1989
                header = INFORMATION_PAGE_HEADER
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1990
                header += _("alt='[Information]' title='Information' ALIGN='bottom'></TD>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1991
                    "<TD><h3><b>Search in All Publishers (Installed)</b></h3><TD></TD>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1992
                    "</TR><TR><TD></TD><TD> Search is <b>not</b> supported in "
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1993
                    "All Publishers (Installed).</TD></TR>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1994
                    )
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1995
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1996
                body = _("<TR><TD></TD><TD<TD></TD></TR><TR><TD></TD><TD<TD></TD></TR>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1997
                    "<TR><TD></TD><TD<TD><b>Suggestions:</b><br></TD></TR>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1998
                    "<TR><TD></TD><TD<TD>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1999
                    )
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2000
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2001
                body += _("<li style='padding-left:7px'>Return to view packages for "
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2002
                    "All Publishers <a href='pm?pm-action=internal&search="
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2003
                    "%s'>(Installed)</a></li>")  % INTERNAL_SEARCH_ALL_PUBS_INSTALLED
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2004
                body += _("<li style='padding-left:7px'>Search for <b>%(text)s"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2005
                    "</b> using All Publishers <a href='pm?pm-action=internal&search="
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2006
                    "%(all_pubs)s'>(Search)</a></li>")  % \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2007
                    {"text": text, "all_pubs": INTERNAL_SEARCH_ALL_PUBS}
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2008
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2009
                body += _("<li style='padding-left:7px'>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2010
                    "See <a href='pm?pm-action=internal&search="
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2011
                    "%s'>Search Help</a></li></TD></TR>") % INTERNAL_SEARCH_HELP
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2012
                footer = "</table>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2013
                self.__link_load_page(header + body + footer)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2014
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2015
                self.__set_focus_on_searchentry()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2016
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2017
        def __setup_recent_search_page(self):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2018
                header = INFORMATION_PAGE_HEADER
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2019
                header += _("alt='[Information]' title='Information' ALIGN='bottom'></TD>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2020
                    "<TD><h3><b>Recent Searches</b></h3><TD></TD></TR>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2021
                    "<TR><TD></TD><TD> Access stored results from recent searches "
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2022
                    "in this session.</TD></TR>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2023
                    )
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2024
                body = "<TR><TD></TD><TD>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2025
                search_list = ""
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2026
                for search in self.recent_searches_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2027
                        search_list += "<li style='padding-left:7px'>%s: <a href=" % \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2028
                                search
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2029
                        search_list += "'pm?pm-action=internal&search=%s" % \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2030
                                INTERNAL_SEARCH_VIEW_RESULTS
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2031
                        search_list += " <span>%s</span>'>" % search
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2032
                        search_list += _("results")
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2033
                        search_list += "</a></li>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2034
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2035
                if len(self.recent_searches_list) > 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2036
                        body += "<TR><TD></TD><TD></TD></TR><TR><TD></TD><TD>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2037
                        body += ngettext(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2038
                            "Click on the search results link below to view the stored "
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2039
                            "results:", "Click on one of the search results links below "
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2040
                            "to view the stored results:",
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2041
                            len(self.recent_searches_list)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2042
                            )
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2043
                        body += "</TD></TR><TR><TD></TD><TD>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2044
                        body += search_list
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2045
                body += "<TD></TD></TR>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2046
                footer = "</table>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2047
                self.__link_load_page(header + body + footer)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2048
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2049
                    
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2050
        def __setup_zero_filtered_results_page(self):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2051
                header = INFORMATION_PAGE_HEADER
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2052
                active_filter = self.w_filter_combobox.get_active()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2053
                header += _("alt='[Information]' title='Information' ALIGN='bottom'></TD>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2054
                    "<TD><h3><b>View Packages</b></h3><TD></TD></TR><TR><TD></TD><TD>")
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2055
                header += ngettext(
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2056
                    "There is one package in this category, "
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2057
                    "however it is not visible in the selected View:\n"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2058
                    "<li style='padding-left:7px'><b>%(filter)s</b></li>",
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2059
                    "There are a number of packages in this category, "
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2060
                    "however they are not visible in the selected View:\n"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2061
                    "<li style='padding-left:7px'><b>%s</b></li>",
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2062
                    self.length_visible_list) % \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2063
                        self.__get_filter_combobox_description(active_filter)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2064
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2065
                body = _("<TR><TD></TD><TD<TD></TD></TR><TR><TD></TD><TD<TD></TD></TR>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2066
                    "<TR><TD></TD><TD<TD><b>Suggestions:</b><br></TD></TR>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2067
                    "<TR><TD></TD><TD<TD>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2068
                    )
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2069
                body += _("<li style='padding-left:7px'>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2070
                    "<a href='pm?pm-action=internal&"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2071
                    "search=%s'>Change View to All Packages</a></li>") % \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2072
                    INTERNAL_SEARCH_VIEW_ALL
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2073
                footer = "</TD></TR></table>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2074
                self.__link_load_page(header + body + footer)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2075
                self.w_main_view_notebook.set_current_page(NOTEBOOK_START_PAGE)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2076
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2077
        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
  2078
                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
  2079
                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
  2080
                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
  2081
                    "<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
  2082
                header += ngettext(
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2083
                    "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
  2084
                    "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
  2085
                    "<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
  2086
                    "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
  2087
                    "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
  2088
                    "<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
  2089
                    "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
  2090
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2091
                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
  2092
                    "<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
  2093
                    "<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
  2094
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2095
                body += _("<li style='padding-left:7px'>"
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2096
                    "<a href='pm?pm-action=internal&"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2097
                    "search=%s'>Change View to All Packages</a></li>") % \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2098
                    INTERNAL_SEARCH_VIEW_ALL
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2099
                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
  2100
                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
  2101
                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
  2102
                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
  2103
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2104
        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
  2105
                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
  2106
                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
  2107
                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
  2108
                        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
  2109
                                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
  2110
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2111
                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
  2112
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2113
        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
  2114
                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
  2115
                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
  2116
                    "<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
  2117
                    "<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
  2118
                    "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
  2119
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2120
                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
  2121
                    "<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
  2122
                    "<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
  2123
                    "<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
  2124
                    "<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
  2125
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2126
                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
  2127
                        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
  2128
                            "</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
  2129
                            "%(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
  2130
                            {"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
  2131
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2132
                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
  2133
                    "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
  2134
                    "%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
  2135
                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
  2136
                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
  2137
                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
  2138
                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
  2139
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2140
        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
  2141
                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
  2142
                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
  2143
                        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
  2144
                        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
  2145
                        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
  2146
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2147
        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
  2148
                header = _(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2149
                    "<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
  2150
                    "<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
  2151
                    "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
  2152
                    "<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
  2153
                    "<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
  2154
                    "<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
  2155
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2156
                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
  2157
                    "<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
  2158
                    "<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
  2159
                    "<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
  2160
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2161
                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
  2162
                    "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
  2163
                    "%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
  2164
                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
  2165
                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
  2166
                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
  2167
                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
  2168
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2169
        def __clear_before_search(self, show_list=True, in_setup=True, unselect_cat=True):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2170
                self.in_setup = in_setup
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2171
                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
  2172
                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
  2173
                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
  2174
                self.__init_tree_views(application_list, None, None)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2175
                if unselect_cat:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2176
                        self.__unselect_category()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2177
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2178
        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
  2179
                self.in_search_mode = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2180
                self.in_recent_search = False
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2181
                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
  2182
                self.w_infosearch_frame.hide()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2183
                if self.last_visible_publisher == \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2184
                        self.publisher_options[PUBLISHER_INSTALLED]:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2185
                        self.is_all_publishers_installed = True
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2186
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2187
                        self.is_all_publishers_installed = False 
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2188
                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
  2189
                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
  2190
                    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
  2191
                        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
  2192
                            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
  2193
                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
  2194
                # Reset MARK_COLUMN        
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2195
                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
  2196
                        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
  2197
                        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
  2198
                        marked = False
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2199
                        pkgs = None
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2200
                        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
  2201
                                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
  2202
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2203
                                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
  2204
                                        marked = True
1571
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  2205
                        # When switching after Manage Publisher dialog
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  2206
                        # 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
  2207
                        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
  2208
                                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
  2209
                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
  2210
                        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
  2211
                            None, None,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2212
                            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
  2213
                            self.saved_application_list_sort)
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  2214
                        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
  2215
                else:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2216
                        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
  2217
                            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
  2218
                            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
  2219
                            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
  2220
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2221
                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
  2222
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2223
        def __save_application_list(self, app_list):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2224
                self.saved_application_list = app_list
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2225
                                
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2226
        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
  2227
                #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
  2228
                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
  2229
                        return
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2230
                self.__save_application_list(self.application_list)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2231
                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
  2232
                        self.application_list_sort
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2233
                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
  2234
                        self.application_list_filter
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2235
                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
  2236
                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
  2237
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2238
                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
  2239
                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
  2240
                        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
  2241
                        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
  2242
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2243
        def __do_search(self, widget=None, ev=None):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2244
                self.in_recent_search = False
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2245
                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
  2246
                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
  2247
                        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
  2248
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2249
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2250
                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
  2251
                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
  2252
                        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
  2253
                        return
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2254
                if self.is_all_publishers_installed:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2255
                        gobject.idle_add(self.__setup_search_installed_page, txt)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2256
                        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
  2257
                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
  2258
                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
  2259
                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
  2260
                        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
  2261
                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
  2262
                        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
  2263
                        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
  2264
                        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
  2265
                                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
  2266
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2267
                                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
  2268
                                        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
  2269
                                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
  2270
                                        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
  2271
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2272
                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
  2273
                        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
  2274
                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
  2275
                self.__set_focus_on_searchentry()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2276
                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
  2277
                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
  2278
                        
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2279
                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
  2280
                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
  2281
                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
  2282
                    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
  2283
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
  2284
        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
  2285
                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
  2286
                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
  2287
                        return None, (0,)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2288
                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
  2289
                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
  2290
                        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
  2291
                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
  2292
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2293
        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
  2294
                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
  2295
                if selection:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2296
                        self.__save_active_category(path)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2297
                        selection.unselect_all()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2298
1571
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  2299
        def __process_after_cancel(self):
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  2300
                if self.is_all_publishers:
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  2301
                        self.__setup_before_all_publishers_mode()
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  2302
                else:
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  2303
                        self.__unset_search(True)
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  2304
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2305
        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
  2306
                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
  2307
                self.search_time_sec = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2308
                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
  2309
                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
  2310
                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
  2311
                self.in_setup = False
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2312
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
  2313
        @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
  2314
        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
  2315
                if repo == None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2316
                        return None
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2317
                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
  2318
                ret_uri = None
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2319
                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
  2320
                        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
  2321
                                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
  2322
                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
  2323
                        uri = origin_uri.uri
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2324
                        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
  2325
                                ret_uri = uri.strip("/")
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2326
                return ret_uri
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2327
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2328
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2329
        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
  2330
                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
  2331
                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
  2332
                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
  2333
                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
  2334
                # 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
  2335
                searches = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2336
                servers = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2337
                result = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2338
                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
  2339
                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
  2340
                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
  2341
                if search_all:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2342
                        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
  2343
                        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
  2344
                else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2345
                        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
  2346
                        if pub_prefix != None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2347
                                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
  2348
                        else:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2349
                                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
  2350
                        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
  2351
                        servers.append({"origin": origin_uri})
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2352
                if debug:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2353
                        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
  2354
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2355
                #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
  2356
                case_sensitive = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2357
                return_actions = True
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2358
                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
  2359
                    [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
  2360
                    servers=servers))
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2361
                if debug:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2362
                        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
  2363
                                ("".join(pargs), case_sensitive, return_actions)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2364
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2365
                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
  2366
                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
  2367
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2368
                # 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
  2369
                sort_col = enumerations.NAME_COLUMN
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2370
                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
  2371
                        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
  2372
                            itertools.chain(*searches):
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2373
                                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
  2374
                                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2375
                                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2376
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
  2377
                                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
  2378
                                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
  2379
                                    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
  2380
                                        active_pub = pub["prefix"]
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2381
                                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
  2382
                                if last_name != name:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2383
                                        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
  2384
                                                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
  2385
                                                    % (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
  2386
                                        a_res = name, active_pub
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2387
                                        result.append(a_res)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2388
                                        #Ignore Status when fetching
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2389
                                        application_list = \
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2390
                                                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
  2391
                                        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
  2392
                                        self.in_setup = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2393
                                        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
  2394
                                            application_list, None, None, None, None,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2395
                                            sort_col)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2396
                                last_name = name
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2397
                                self.pylintstub = query_num
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2398
                except api_errors.ProblematicSearchServers, ex:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2399
                        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
  2400
                        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
  2401
                        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
  2402
                                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
  2403
                                        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
  2404
                                                _("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
  2405
                                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2406
                                        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
  2407
                                                pub_prefix, text)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2408
                                return
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2409
                except api_errors.CanceledException:
1571
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  2410
                        self.__reset_search_start()
1457
0f31831a57b4 12318 In Package Manager unsetting the busy cursor should be done in GUI thread
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1456
diff changeset
  2411
                        gobject.idle_add(self.unset_busy_cursor)
1571
d66522ea16be 8531 Allow a user to cancel a search in Package Manager GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1566
diff changeset
  2412
                        gobject.idle_add(self.__process_after_cancel)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2413
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2414
                except Exception, ex:
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2415
                        # 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
  2416
                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2417
                        return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2418
                if debug:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2419
                        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
  2420
                if len(result) == 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2421
                        if debug:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2422
                                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
  2423
                        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
  2424
                                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
  2425
                                        _("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
  2426
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2427
                                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
  2428
                                        pub_prefix, text)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2429
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2430
                #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
  2431
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  2432
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2433
                self.in_setup = True
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2434
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2435
                        print "Time for search:", time.time() - self.search_start
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2436
                application_list = self.__get_full_list_from_search(result)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2437
                gobject.idle_add(self.__add_recent_search, text, pub_prefix,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2438
                    application_list)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2439
                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
  2440
                        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
  2441
                        if debug:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2442
                                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
  2443
                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
  2444
                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
  2445
                    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
  2446
                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
  2447
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2448
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2449
                if search_all:
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2450
                        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
  2451
                            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
  2452
                else:
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2453
                        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
  2454
                            len(application_list))
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2455
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2456
        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
  2457
                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
  2458
                        return
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2459
                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
  2460
                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
  2461
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2462
        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
  2463
                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
  2464
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2465
        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
  2466
                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
  2467
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2468
        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
  2469
                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
  2470
                        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
  2471
                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
  2472
                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
  2473
                self.in_setup = True
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2474
                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
  2475
                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
  2476
                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
  2477
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2478
        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
  2479
                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
  2480
                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
  2481
                        application_list.append(
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2482
                            [False, None, name, '...', enumerations.NOT_INSTALLED, None, 
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2483
                            self.__get_pkg_stem(name, pub), None, True, 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
  2484
                            pub])
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2485
                return application_list
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2486
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2487
        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
  2488
                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
  2489
                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
  2490
                    application_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2491
                return application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2492
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2493
        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
  2494
            application_list):
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2495
                local_results = self.__get_info_for_search_results(search_result)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2496
                remote_results = self.__get_info_for_search_results(search_result,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2497
                    local_results)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2498
                self.__add_pkgs_to_lists_from_info(local_results, 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2499
                    remote_results, application_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2500
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2501
        def __get_info_for_search_results(self, search_result, local_results = None):
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2502
                pargs = []
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2503
                results = []
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2504
                local_info = local_results == None
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  2505
                for name, pub in search_result:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2506
                        found = False
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2507
                        if local_results:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2508
                                for result in local_results:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2509
                                        if (name == result.pkg_stem and
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2510
                                            pub == result.publisher):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2511
                                                found = True
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2512
                                                break
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2513
                                if not found: 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2514
                                        pargs.append(self.__get_pkg_stem(name, pub))
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2515
                        else:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2516
                                pargs.append(self.__get_pkg_stem(name, pub))
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2517
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2518
                try:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2519
                        try:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2520
                                res = self.api_o.info(pargs, 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2521
                                          local_info, frozenset(
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2522
                                          [api.PackageInfo.IDENTITY, 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2523
                                          api.PackageInfo.STATE, 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2524
                                          api.PackageInfo.SUMMARY]))
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2525
                                results = res.get(0)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2526
                        except api_errors.TransportError, ex:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2527
                                err = str(ex)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2528
                                gobject.idle_add(self.error_occurred, err)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2529
                        except api_errors.InvalidDepotResponseException, ex:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2530
                                err = str(ex)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2531
                                gobject.idle_add(self.error_occurred, err)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2532
                        except Exception:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2533
                                err = str(ex)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2534
                                gobject.idle_add(self.error_occurred, err)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2535
                finally:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  2536
                        return results
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2537
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2538
        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
  2539
                ''' 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
  2540
                performance when assistive technologies are enabled'''
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2541
                if self.in_setup:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2542
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2543
                self.application_refilter_id = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2544
                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
  2545
                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
  2546
                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
  2547
                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
  2548
                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
  2549
                self.application_list_filter.refilter()
1531
bcdaf5bdde1c 12910 Switching categories after sorting packages got traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1530
diff changeset
  2550
                if app_id != None:
bcdaf5bdde1c 12910 Switching categories after sorting packages got traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1530
diff changeset
  2551
                        self.application_list_sort.set_sort_column_id(app_id, order)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2552
                if model != None:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2553
                        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
  2554
                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
  2555
                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
  2556
                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
  2557
                        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
  2558
                            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
  2559
                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
  2560
                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
  2561
                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
  2562
                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
  2563
                        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
  2564
                        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
  2565
                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
  2566
                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
  2567
                self.__enable_disable_install_remove()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2568
                if not self.in_search_mode and self.length_visible_list > 0 and \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2569
                        len_filtered_list == 0 and \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2570
                        self.w_filter_combobox.get_active() != \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2571
                        (enumerations.FILTER_SELECTED):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2572
                        self.__setup_zero_filtered_results_page()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2573
                        self.update_statusbar()
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2574
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2575
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2576
        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
  2577
                self.w_searchentry.paste_clipboard()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2578
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  2579
        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
  2580
                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
  2581
                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
  2582
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2583
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2584
        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
  2585
                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
  2586
                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
  2587
                        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
  2588
                        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
  2589
                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
  2590
                        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
  2591
                            self.w_main_clipboard)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2592
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2593
        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
  2594
                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
  2595
                self.w_paste_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2596
1243
d1f303f7dd86 9858 Need to get focus in package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1236
diff changeset
  2597
        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
  2598
                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
  2599
                        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
  2600
                                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
  2601
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2602
                        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
  2603
                        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
  2604
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2605
        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
  2606
                self.w_searchentry.grab_focus()
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2607
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2608
        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
  2609
                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
  2610
                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
  2611
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
  2612
        def __clear_search_results(self):
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2613
                # 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
  2614
                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
  2615
                        self.__clear_before_search()
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2616
                        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
  2617
                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
  2618
                        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
  2619
                                != 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
  2620
                                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
  2621
                else:
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  2622
                        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
  2623
                return
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2624
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2625
        def __on_progress_cancel_clicked(self, widget):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2626
                Thread(target = self.api_o.cancel, args = ()).start()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2627
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2628
        def __on_startpage(self, widget):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2629
                self.__load_startpage()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2630
                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
  2631
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
  2632
        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
  2633
                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
  2634
                    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
  2635
                        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
  2636
                        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
  2637
                        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
  2638
                        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
  2639
                                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
  2640
                                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
  2641
                        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
  2642
                            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
  2643
                                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
  2644
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
  2645
        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
  2646
                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
  2647
                    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
  2648
                    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
  2649
                    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
  2650
                        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
  2651
                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
  2652
                        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
  2653
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2654
        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
  2655
                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
  2656
                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
  2657
                        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
  2658
                        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
  2659
                        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
  2660
                        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
  2661
                        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
  2662
                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
  2663
                        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
  2664
                                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
  2665
                        else:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2666
                                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
  2667
                        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
  2668
                        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
  2669
                        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
  2670
                        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
  2671
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2672
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2673
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2674
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2675
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2676
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2677
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2678
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2679
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2680
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2681
                            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
  2682
                        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
  2683
                        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
  2684
                                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
  2685
                        else:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2686
                                filtered_iter = \
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2687
                                        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
  2688
                                            iter_next)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2689
                                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
  2690
                                    filtered_iter)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2691
                                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
  2692
                                        list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2693
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2694
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2695
                        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
  2696
                        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
  2697
                        if select_all and not mark_value:
929
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2698
                                model.set_value(itr, enumerations.MARK_COLUMN, True)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2699
                                pkg_stem = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2700
                                    enumerations.STEM_COLUMN)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2701
                                pkg_status = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2702
                                    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
  2703
                                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
  2704
                                    enumerations.PUBLISHER_COLUMN)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2705
                                pkg_description = model.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2706
                                    enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2707
                                pkg_name = model.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2708
                                    enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2709
                                self.__add_pkg_stem_to_list(pkg_stem, pkg_name, 
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2710
                                    pkg_status, pkg_publisher, pkg_description)
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2711
                        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
  2712
                                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
  2713
                                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
  2714
                                    enumerations.STEM_COLUMN)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2715
                                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
  2716
                
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2717
                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
  2718
                self.w_deselect_menuitem.set_sensitive(select_all)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2719
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2720
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2721
                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
  2722
                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
  2723
                        
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2724
        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
  2725
                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
  2726
                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
  2727
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2728
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2729
        def __on_select_updates(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2730
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2731
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2732
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2733
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2734
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2735
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2736
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2737
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2738
                        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
  2739
                            iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2740
                        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
  2741
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2742
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2743
                            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
  2744
                        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
  2745
                        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
  2746
                            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
  2747
                                list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2748
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2749
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2750
                        itr = model.get_iter(path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2751
                        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
  2752
                        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
  2753
                        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
  2754
                        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
  2755
                            enumerations.PUBLISHER_COLUMN)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2756
                        pkg_description = model.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2757
                            enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2758
                        pkg_name = model.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2759
                            enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2760
                        self.__add_pkg_stem_to_list(pkg_stem, pkg_name, pkg_status,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2761
                            pkg_publisher, pkg_description)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2762
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2763
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2764
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2765
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2766
        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
  2767
                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
  2768
                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
  2769
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2770
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2771
        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
  2772
                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
  2773
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2774
        def __show_image_update_changed(self, client, connection_id, entry, arguments):
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2775
                self.show_image_update = entry.get_value().get_bool()
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2776
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2777
        def __show_install_changed(self, client, connection_id, entry, arguments):
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2778
                self.show_install = entry.get_value().get_bool()
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2779
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2780
        def __show_remove_changed(self, client, connection_id, entry, arguments):
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2781
                self.show_remove = entry.get_value().get_bool()
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2782
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2783
        def __on_preferences(self, widget):
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2784
                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
  2785
                self.w_exit_checkbutton.set_active(self.save_state)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2786
                self.w_confirm_updateall_checkbutton.set_active(self.show_image_update)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2787
                self.w_confirm_install_checkbutton.set_active(self.show_install)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2788
                self.w_confirm_remove_checkbutton.set_active(self.show_remove)
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2789
                self.w_preferencesdialog.show()
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2790
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2791
        def __on_preferencesclose_clicked(self, widget):
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2792
                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
  2793
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2794
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2795
        def __on_preferenceshelp_clicked(widget):
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2796
                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
  2797
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2798
        def __on_startpage_checkbutton_toggled(self, widget):
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2799
                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
  2800
                try:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2801
                        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
  2802
                            self.show_startpage)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2803
                except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2804
                        pass
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2805
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2806
        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
  2807
                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
  2808
                try:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2809
                        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
  2810
                            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
  2811
                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
  2812
                        pass
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2813
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2814
        def on_confirm_updateall_checkbutton_toggled(self, widget, reverse = False):
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2815
                active = widget.get_active()
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2816
                if reverse:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2817
                        active = not active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2818
                self.show_image_update = active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2819
                try:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2820
                        self.client.set_bool(SHOW_IMAGE_UPDATE_CONFIRMATION,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2821
                            self.show_image_update)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2822
                except GError:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2823
                        pass
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2824
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2825
        def on_confirm_install_checkbutton_toggled(self, widget, reverse = False):
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2826
                active = widget.get_active()
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2827
                if reverse:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2828
                        active = not active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2829
                self.show_install = active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2830
                try:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2831
                        self.client.set_bool(SHOW_INSTALL_CONFIRMATION,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2832
                            self.show_install)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2833
                except GError:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2834
                        pass
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2835
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2836
        def on_confirm_remove_checkbutton_toggled(self, widget, reverse = False):
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2837
                active = widget.get_active()
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2838
                if reverse:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2839
                        active = not active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2840
                self.show_remove = active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2841
                try:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2842
                        self.client.set_bool(SHOW_REMOVE_CONFIRMATION,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2843
                            self.show_remove)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2844
                except GError:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2845
                        pass
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2846
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2847
        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
  2848
                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
  2849
                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
  2850
                        if active:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2851
                                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
  2852
                                        self.current_repos_with_search_errors:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2853
                                        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
  2854
                                                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
  2855
                                        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
  2856
                                        self.pylintstub = err_str
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2857
                        else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2858
                                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
  2859
                                        self.current_repos_with_search_errors:
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2860
                                        self.gconf_not_show_repos = \
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2861
                                            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
  2862
                                            pub + ",", "")
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2863
                        try:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2864
                                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
  2865
                                    self.gconf_not_show_repos)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2866
                        except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2867
                                pass
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2868
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2869
        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
  2870
                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
  2871
                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
  2872
                        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
  2873
                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
  2874
                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
  2875
                        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
  2876
                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
  2877
                        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
  2878
                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
  2879
                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
  2880
                        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
  2881
                        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
  2882
                        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
  2883
                                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
  2884
                        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
  2885
                        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
  2886
                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
  2887
                        self.w_deselect_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2888
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2889
        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
  2890
                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
  2891
                        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
  2892
                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
  2893
                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
  2894
                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
  2895
                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
  2896
                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
  2897
                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
  2898
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2899
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
  2900
        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
  2901
                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
  2902
788e24dc3b06 8594 Edit menu items should be more consistent with traditional Gtk+ equivalents
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
  2903
        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
  2904
                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
  2905
                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
  2906
                if bounds:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2907
                        #enable selection functions
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2908
                        self.w_cut_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2909
                        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
  2910
                        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
  2911
                        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
  2912
                                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
  2913
                        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
  2914
                                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
  2915
                        self.w_deselect_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2916
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2917
                        self.w_cut_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2918
                        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
  2919
                        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
  2920
                        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
  2921
                        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
  2922
                                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
  2923
                        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
  2924
                                self.w_selectall_menuitem.set_sensitive(True)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  2925
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2926
        def __refilter_on_idle(self):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2927
                if self.application_refilter_id != 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2928
                        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
  2929
                        self.application_refilter_id = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2930
                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
  2931
                        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
  2932
                            self.__application_refilter)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2933
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2934
        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
  2935
                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
  2936
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2937
        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
  2938
                '''This function is for handling category double click activations'''
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2939
                # Activated sub node in Recent Searches category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2940
                if self.in_recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2941
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2942
                # User activated Recent Searches Top Level category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2943
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2944
                if model != None and self.recent_searches_cat_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2945
                        rs_path = model.get_path(self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2946
                        selection, curr_path = self.__get_selection_and_category_path()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2947
                        self.pylintstub = selection
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2948
                        if curr_path == rs_path:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2949
                                self.__setup_recent_search_page()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2950
                                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
  2951
                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
  2952
                        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
  2953
                        return
1122
cf87b7d8fe39 8888 Gtk warning emitted on Reload
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1109
diff changeset
  2954
                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
  2955
                        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
  2956
                            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
  2957
                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
  2958
                        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
  2959
                        return
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2960
                self.__set_main_view_package_list()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2961
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2962
                self.__refilter_on_idle()
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2963
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2964
        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
  2965
                # 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
  2966
                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
  2967
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2968
                if show_list:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2969
                        self.w_main_view_notebook.set_current_page(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2970
                                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
  2971
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2972
                        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
  2973
                                NOTEBOOK_START_PAGE)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2974
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
  2975
        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
  2976
                self.w_categories_treeview.set_cursor(path)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2977
                self.__save_expanded_path(path, False)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2978
                self.__save_active_category(path)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2979
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2980
        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
  2981
                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
  2982
                        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
  2983
                self.w_categories_treeview.set_cursor(path)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2984
                self.__save_expanded_path(path, True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2985
                self.__save_active_category(path)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2986
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2987
        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
  2988
                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
  2989
                        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
  2990
                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
  2991
                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
  2992
                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
  2993
                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
  2994
                        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
  2995
                        cellx = pthinfo[2]
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2996
                        #Clicking on row toggle icon just select the path
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2997
                        if cellx <= CATEGORY_TOGGLE_ICON_WIDTH:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2998
                                self.w_categories_treeview.set_cursor(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2999
                                self.w_categories_treeview.scroll_to_cell(path)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3000
                                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
  3001
                        #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
  3002
                        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
  3003
                        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
  3004
                                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
  3005
                                        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
  3006
                                        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
  3007
                                        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
  3008
                                            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
  3009
                                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
  3010
                                        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
  3011
                                                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
  3012
                                        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
  3013
                                                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
  3014
                                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
  3015
                                        tree_view.expand_row(path, False)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3016
                                self.__save_active_category(path)
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3017
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3018
        @staticmethod
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3019
        def __categoriestreeview_compare_func(model, column, key, itr):
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3020
                value = model.get_value(itr, column)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3021
                if not value:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3022
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3023
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3024
                try:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3025
                        value = re.sub(REGEX_STRIP_MARKUP, "", value)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3026
                        value = re.sub(REGEX_STRIP_RESULT, "", value)
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3027
                        match = re.match(re.escape(key), re.escape(value), re.IGNORECASE)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3028
                except (TypeError, re.error):
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3029
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3030
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3031
                return match is None
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3032
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3033
        def __in_recent_searches(self, path):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3034
                if not path or len(path) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3035
                        return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3036
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3037
                if model == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3038
                        return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3039
                rs_path = model.get_path(self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3040
                if rs_path and len(rs_path) > 0 and path[0] == rs_path[0]:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3041
                        return True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3042
                return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3043
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3044
        def __save_expanded_path(self, path, expanded):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3045
                if not path or len(path) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3046
                        return                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3047
                self.category_expanded_paths[(self.last_visible_publisher, path)] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3048
                        expanded
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3049
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3050
        def __save_active_category(self, path):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3051
                if not path or len(path) == 0 or self.__in_recent_searches(path):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3052
                        return                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3053
                self.category_active_paths[self.last_visible_publisher] = path
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3054
                self.saved_section_active = path[0]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3055
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3056
        def __on_category_selection_changed(self, selection, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3057
                '''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
  3058
                if self.in_setup:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3059
                        return
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  3060
                model, itr = selection.get_selected()
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3061
                if not itr:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3062
                        return
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3063
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3064
                path = model.get_path(itr)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3065
                sel_category = model[path]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3066
                if sel_category[enumerations.CATEGORY_ID] == RECENT_SEARCH_ID:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3067
                        if not self.adding_recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3068
                                self.__setup_recent_search_page()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3069
                                if not self.is_all_publishers:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3070
                                        self.__save_setup_before_search(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3071
                                            single_search=True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3072
                                self.in_search_mode = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3073
                                self.in_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3074
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3075
                                self.__set_main_view_package_list()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3076
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3077
                elif sel_category[enumerations.CATEGORY_ID] > RECENT_SEARCH_ID:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3078
                        self.__restore_recent_search(sel_category)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3079
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3080
                self.__save_active_category(path)
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3081
                if self.in_search_mode or self.is_all_publishers:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3082
                        #Required for A11Y support because focus event not triggered
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3083
                        #when A11Y enabled and user clicks on Category after Search
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3084
                        self.__unset_search(True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3085
                        self.__set_main_view_package_list()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3086
                        return
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3087
                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
  3088
                        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
  3089
                            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
  3090
                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
  3091
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3092
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3093
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3094
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3095
        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
  3096
            keyboard_mode, tooltip):
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3097
                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
  3098
                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
  3099
                if not info:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3100
                        return False
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3101
                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
  3102
                    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
  3103
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3104
        @staticmethod
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3105
        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
  3106
                tip = ""
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  3107
                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
  3108
                        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
  3109
                        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
  3110
                                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
  3111
                        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
  3112
                        if row:
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  3113
                                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
  3114
                                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
  3115
                                        tip = _("Installed")
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  3116
                                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
  3117
                                        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
  3118
                                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
  3119
                                        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
  3120
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  3121
                if tip != "":
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3122
                        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
  3123
                        tooltip.set_text(tip)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3124
                        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
  3125
                else:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3126
                        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
  3127
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
  3128
        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
  3129
                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
  3130
                        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
  3131
                        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
  3132
                                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
  3133
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
  3134
                        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
  3135
                                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
  3136
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3137
                        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
  3138
                        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
  3139
                                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
  3140
                        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
  3141
                        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
  3142
                                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
  3143
                        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
  3144
                        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
  3145
                        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
  3146
                        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
  3147
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3148
                        #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
  3149
                        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
  3150
                        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
  3151
                            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
  3152
                        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
  3153
                        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
  3154
                        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
  3155
                        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
  3156
                        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
  3157
                            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
  3158
                            curr_time, popup_position)
1561
d32a0b4c043b 13138 Context menu is no longer keyboard accessible in PM's list of packages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1560
diff changeset
  3159
                        return True
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3160
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3161
                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
  3162
                        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
  3163
                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
  3164
                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
  3165
                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
  3166
                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
  3167
                        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
  3168
                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
  3169
                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
  3170
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3171
                #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
  3172
                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
  3173
                        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
  3174
                        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
  3175
                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
  3176
                        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
  3177
                        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
  3178
                        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
  3179
                        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
  3180
                            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
  3181
                        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
  3182
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3183
        @staticmethod
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3184
        def __applicationtreeview_compare_func(model, column, key, itr):
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3185
                value = model.get_value(itr, enumerations.NAME_COLUMN)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3186
                if not value:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3187
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3188
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3189
                value = value.lower()
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3190
                return not value.startswith(key.lower())
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3191
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3192
        @staticmethod
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3193
        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
  3194
                #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
  3195
                #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
  3196
                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
  3197
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
  3198
                #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
  3199
                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
  3200
861
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  3201
        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
  3202
                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
  3203
                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
  3204
                        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
  3205
                        self.show_info_id = 0
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3206
                if itr:
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3207
                        self.selected_pkgstem = \
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3208
                               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
  3209
                        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
  3210
                        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
  3211
                        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
  3212
                        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
  3213
                            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
  3214
                                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
  3215
                        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
  3216
                            INFO_NOTEBOOK_LICENSE_PAGE):
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3217
                                self.__on_notebook_change(None, None, 
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3218
                                    INFO_NOTEBOOK_LICENSE_PAGE)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3219
                        self.w_version_info_menuitem.set_sensitive(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
  3220
                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
  3221
                        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
  3222
                        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
  3223
                        self.selected_pkgstem = None
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3224
                        self.w_version_info_menuitem.set_sensitive(False)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3225
861
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  3226
        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
  3227
                '''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
  3228
                if self.in_setup:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3229
                        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
  3230
                self.__process_package_selection()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3231
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3232
        def __on_filtercombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3233
                '''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
  3234
                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
  3235
                        return
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3236
                active = self.w_filter_combobox.get_active()
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3237
                if active != enumerations.FILTER_SELECTED:
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3238
                        self.saved_filter_combobox_active = active
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  3239
                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
  3240
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3241
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3242
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3243
        def __unset_search(self, same_repo):
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  3244
                self.w_infosearch_frame.hide()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3245
                self.__update_tooltips()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3246
                self.in_search_mode = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3247
                self.in_recent_search = False
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3248
                self.is_all_publishers = False
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3249
                if same_repo:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3250
                        self.__restore_setup_for_browse()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3251
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3252
        def __on_repositorycombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3253
                '''On repository combobox changed'''
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3254
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3255
                        print "Start change publisher", time.time()
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3256
                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
  3257
                        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
  3258
                                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
  3259
                        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
  3260
                        self.unset_busy_cursor()
1511
c6980ed4c49b 12710 Package Manager hangs after clicking on category
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1501
diff changeset
  3261
                        if self.in_setup:
c6980ed4c49b 12710 Package Manager hangs after clicking on category
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1501
diff changeset
  3262
                                self.in_setup = False
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3263
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3264
                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
  3265
                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
  3266
                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
  3267
                        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
  3268
                                return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3269
                        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
  3270
                                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
  3271
                                    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
  3272
                                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
  3273
                                return
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3274
                        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
  3275
                        self.__unset_search(same_repo)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3276
                        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
  3277
                                self.__set_searchentry_to_prompt()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3278
                                return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3279
                        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
  3280
                        selected_publisher = self.__get_selected_publisher()
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3281
                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
  3282
                        return
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3283
                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
  3284
                        self.__set_all_publishers_mode()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3285
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3286
                        
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3287
                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
  3288
                        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
  3289
                            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
  3290
                        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
  3291
                        self.__on_file_add_publisher(None)
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  3292
                        return
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3293
                if index == self.repo_combobox_all_pubs_installed_index:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3294
                        self.w_filter_combobox.set_active(enumerations.FILTER_ALL)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3295
                        self.is_all_publishers_installed = True
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3296
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3297
                        self.is_all_publishers_installed = False
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3298
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3299
                self.cancelled = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3300
                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
  3301
                self.set_busy_cursor()
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3302
                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
  3303
                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
  3304
                        self.__unset_search(False)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3305
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3306
                pub = [selected_publisher, ]
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3307
                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
  3308
                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
  3309
                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
  3310
                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
  3311
                self.__set_main_view_package_list()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3312
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3313
        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
  3314
                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
  3315
                if pub_iter == None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3316
                        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
  3317
                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
  3318
                            enumerations.REPOSITORY_NAME)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3319
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
  3320
        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
  3321
                self.saved_filter_combobox_active = self.initial_show_filter
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3322
                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
  3323
                    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
  3324
                self.__unset_saved()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3325
                self.publisher_changed = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3326
                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
  3327
                self.saved_repository_combobox_active = \
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3328
                        self.w_repository_combobox.get_active()
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3329
                gobject.idle_add(self.__init_tree_views, application_list,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3330
                    category_list, section_list)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3331
1203
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3332
        def __unset_saved(self):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3333
                self.__save_application_list(None)
1203
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3334
                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
  3335
                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
  3336
                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
  3337
                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
  3338
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
  3339
        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
  3340
                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
  3341
                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
  3342
                    status_str)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3343
                if self.is_all_publishers_installed: 
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3344
                        self.__do_refresh()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3345
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3346
                        self.__do_refresh(pubs=[pub])
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3347
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3348
        def __do_refresh(self, pubs=None, immediate=False, ignore_transport_ex=False):
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3349
                success = False
1267
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  3350
                try:
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3351
                        self.api_o.refresh(pubs=pubs, immediate=immediate)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3352
                        success = True
1267
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  3353
                except api_errors.CatalogRefreshException, cre:
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3354
                        if ignore_transport_ex == False:
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3355
                                self.__catalog_refresh_message(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
  3356
                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
  3357
                        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
  3358
                        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
  3359
                            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
  3360
                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
  3361
                        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
  3362
                        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
  3363
                            None, gtk.MESSAGE_INFO)
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3364
                except Exception:
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3365
                        err = str(ex)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3366
                        gobject.idle_add(self.error_occurred, err,
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3367
                            None, gtk.MESSAGE_INFO)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3368
                return success
1267
4c8d03835183 9555 api.Refresh calls throw exceptions when there is network problem/some publishers not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1263
diff changeset
  3369
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
  3370
        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
  3371
                application_list = self.__get_new_application_liststore()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3372
                category_list = self.__get_new_category_liststore()
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3373
                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
  3374
                for pub in publishers:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3375
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3376
                                a = time.time()
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3377
                        self.__refresh_for_publisher(pub)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3378
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3379
                                print "Time to refresh", time.time() - a
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3380
                                a = time.time()
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3381
                        self.__add_pkgs_to_lists_from_api(pub,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3382
                            application_list, category_list, section_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3383
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3384
                                b = time.time()
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3385
                                print "Time to add", b - a, b
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3386
                        category_list.prepend(None, [0, _('All'), None, None])
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  3387
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3388
                return application_list, category_list, section_list
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3389
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3390
        def __add_install_update_pkgs_for_publishers(self, install_update,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3391
            confirmation_list):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3392
                for pub_name in self.selected_pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3393
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3394
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3395
                                break
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3396
                        for pkg_stem in pkgs:
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3397
                                status = pkgs.get(pkg_stem)[0]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3398
                                if status == enumerations.NOT_INSTALLED or \
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3399
                                    status == enumerations.UPDATABLE:
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3400
                                        install_update.append(pkg_stem)
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3401
                                        if self.show_install:
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3402
                                                desc = pkgs.get(pkg_stem)[1]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3403
                                                pkg_name = pkgs.get(pkg_stem)[2]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3404
                                                confirmation_list.append(
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3405
                                                    [pkg_name, pub_name,
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3406
                                                    desc, status])
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3407
        def __on_version_info(self, widget):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3408
                model, itr = self.package_selection.get_selected()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3409
                if itr:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3410
                        pkg_stem = model.get_value(itr, enumerations.STEM_COLUMN)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3411
                        name = model.get_value(itr, enumerations.NAME_COLUMN)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3412
                        self.set_busy_cursor()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3413
                        Thread(target = self.__get_info, args = (pkg_stem, name)).start()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3414
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3415
        def __get_info(self, pkg_stem, name):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3416
                self.api_o.reset()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3417
                local_info = gui_misc.get_pkg_info(self.api_o, pkg_stem, True)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3418
                remote_info = gui_misc.get_pkg_info(self.api_o, pkg_stem, False)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3419
                if self.exiting:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3420
                        return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3421
                plan_pkg = None
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3422
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3423
                installed_only = False
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3424
                if local_info:
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3425
                        if self.__same_pkg_versions(local_info, remote_info):
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3426
                                installed_only = True
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3427
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3428
                if not installed_only:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3429
                        install_update_list = []
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3430
                        stuff_to_do = False
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3431
                        install_update_list.append(pkg_stem)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3432
                        try:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3433
                                stuff_to_do = self.api_o.plan_install(
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3434
                                    install_update_list,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3435
                                    refresh_catalogs = False) 
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3436
                        except api_errors.ApiException:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3437
                                gobject.idle_add(self.unset_busy_cursor)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3438
                                return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3439
                        if stuff_to_do:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3440
                                plan = self.api_o.describe().get_changes()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3441
                                plan_pkg = None
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3442
                                for pkg_plan in plan:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3443
                                        if name == pkg_plan[1].pkg_stem:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3444
                                                plan_pkg = pkg_plan[1]
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3445
                                                break
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3446
                                if plan_pkg == None:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3447
                                        gobject.idle_add(self.unset_busy_cursor)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3448
                                        return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3449
                gobject.idle_add(self.__after_get_info, local_info, remote_info,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3450
                    plan_pkg, name)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3451
                return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3452
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3453
        @staticmethod
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3454
        def __same_pkg_versions(info1, info2):
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3455
                if info1 == None or info2 == None:
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3456
                        return False
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3457
                        
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3458
                return info1.version == info2.version and \
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3459
                        info1.build_release == info2.build_release and \
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3460
                        info1.branch == info2.branch
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3461
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3462
        def __hide_pkg_version_details(self):
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3463
                self.w_info_expander.hide()
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3464
                self.w_version_info_dialog.set_size_request(-1, -1)
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3465
                
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3466
        def __after_get_info(self, local_info, remote_info, plan_pkg, name):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3467
                if self.exiting:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3468
                        return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3469
                self.w_info_name_label.set_text(name)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3470
                installable_fmt = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3471
                    _("%(version)s (Build %(build)s-%(branch)s)")
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3472
                installed_label = ""
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3473
                installable_label = ""
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3474
                installable_prefix_label = _("<b>Installable Version:</b>")
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3475
                
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3476
                if local_info:
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3477
                        # Installed
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3478
                        installable_prefix_label = _("<b>Upgradeable Version:</b>")
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3479
                        yes_text = _("Yes, %(version)s (Build %(build)s-%(branch)s)")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3480
                        installed_label = yes_text % \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3481
                            {"version": local_info.version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3482
                            "build": local_info.build_release,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3483
                            "branch": local_info.branch}
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3484
                        if self.__same_pkg_versions(local_info, remote_info):
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3485
                                # Installed and up to date
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3486
                                installable_label = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3487
                                    _("Installed package is up-to-date")
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3488
                                self.__hide_pkg_version_details()
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3489
                        else:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3490
                                if plan_pkg == None:
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3491
                                        # Installed with later version but can't upgrade
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3492
                                        # Upgradeable Version: None
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3493
                                        installable_label = _("None")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3494
                                        self.__setup_version_info_details(name,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3495
                                            remote_info.version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3496
                                            remote_info.build_release,
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3497
                                            remote_info.branch, False)
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3498
                                else:
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3499
                                        # Installed with later version and can upgrade to
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3500
                                        # Upgradeable Version: <version>
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3501
                                        # Upgradeable == Latest Version
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3502
                                        if self.__same_pkg_versions(plan_pkg, 
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3503
                                            remote_info):
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3504
                                                installable_label = installable_fmt % \
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3505
                                                    {"version": plan_pkg.version,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3506
                                                    "build": plan_pkg.build_release,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3507
                                                    "branch": plan_pkg.branch}
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3508
                                                self.__hide_pkg_version_details()
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3509
                                        else:
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3510
                                        # Installed with later version and can upgrade
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3511
                                        # Upgradeable Version: <version>
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3512
                                        # but NOT to the Latest Version
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3513
                                                installable_label = installable_fmt % \
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3514
                                                    {"version": plan_pkg.version,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3515
                                                    "build": plan_pkg.build_release,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3516
                                                    "branch": plan_pkg.branch}
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3517
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3518
                                                self.__setup_version_info_details(name,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3519
                                                    remote_info.version,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3520
                                                    remote_info.build_release,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3521
                                                    remote_info.branch, False)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3522
                else:
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3523
                        # Not Installed
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3524
                        installed_label = _("No")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3525
                        if plan_pkg:
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3526
                                # Not installed with later version available to install
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3527
                                # Installable: <version>
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3528
                                # Installable == Latest Version
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3529
                                if self.__same_pkg_versions(plan_pkg, remote_info):
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3530
                                        installable_label = installable_fmt % \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3531
                                            {"version": plan_pkg.version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3532
                                            "build": plan_pkg.build_release,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3533
                                            "branch": plan_pkg.branch}
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3534
                                        self.__hide_pkg_version_details()
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3535
                                else:
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3536
                                        # Not installed with later version available
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3537
                                        # Installable: <version>
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3538
                                        # but NOT to the Latest Version
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3539
                                        installable_label = installable_fmt % \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3540
                                            {"version": plan_pkg.version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3541
                                            "build": plan_pkg.build_release,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3542
                                            "branch": plan_pkg.branch}
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3543
                                            
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3544
                                        self.__setup_version_info_details(name,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3545
                                            remote_info.version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3546
                                            remote_info.build_release,
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3547
                                            remote_info.branch, True)
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3548
                        else:
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3549
                                # Not Installed with later version and can't install
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3550
                                # Installable Version: None
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3551
                                installable_label = _("None")
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3552
                                self.__setup_version_info_details(name,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3553
                                    remote_info.version,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3554
                                    remote_info.build_release,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3555
                                    remote_info.branch, True)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3556
                        
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3557
                self.w_info_installed_label.set_text(installed_label)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3558
                self.w_info_installable_label.set_text(installable_label)
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3559
                self.w_info_installable_prefix_label.set_markup(installable_prefix_label)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3560
                self.w_info_ok_button.grab_focus()                
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3561
                self.w_version_info_dialog.show()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3562
                self.unset_busy_cursor()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3563
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3564
        def __setup_version_info_details(self, name, version, build_release, branch,
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3565
            to_be_installed):
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3566
                installable_fmt = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3567
                    _("%(version)s (Build %(build)s-%(branch)s)")
1572
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3568
                if to_be_installed:
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3569
                        expander_fmt = _(
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3570
                            "The latest version of %s cannot be installed. "
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3571
                            "It may be possible to do so after updating your system. "
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3572
                            "Run \"Updates\" to get your system up-to-date.")
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3573
                else:
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3574
                        expander_fmt = _(
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3575
                            "Cannot upgrade to the latest version of %s. "
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3576
                            "It may be possible to do so after updating your system. "
b1bcb39eb27c 13234 PM Package Version Info failing in certain instances
John Rice <john.rice@sun.com>
parents: 1571
diff changeset
  3577
                            "Run \"Updates\" to get your system up-to-date.")
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3578
                installable_exp = installable_fmt % \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3579
                    {"version": version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3580
                    "build": build_release,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3581
                    "branch": branch}
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3582
                expander_text = installable_exp + "\n\n"
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3583
                expander_text += expander_fmt % name   
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3584
                
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3585
                # Ensure we have enough room for the Details message
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3586
                # without requiring a scrollbar  
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3587
                self.w_info_textview.set_size_request(484, 95)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3588
                self.w_info_expander.set_expanded(True)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3589
                self.w_info_expander.show()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3590
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3591
                details_buff = self.w_info_textview.get_buffer()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3592
                details_buff.set_text("")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3593
                itr = details_buff.get_iter_at_line(0)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3594
                details_buff.insert_with_tags_by_name(itr,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3595
                    _("Latest Version: "), "bold")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3596
                details_buff.insert(itr, expander_text)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3597
                         
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3598
        def __on_info_ok_button_clicked(self, widget):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3599
                self.w_version_info_dialog.hide()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3600
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3601
        @staticmethod
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3602
        def __on_info_help_button_clicked(widget):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3603
                gui_misc.display_help("package-version")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3604
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3605
        def __on_version_info_dialog_delete_event(self, widget, event):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3606
                self.__on_info_ok_button_clicked(None)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3607
                return True
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3608
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3609
        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
  3610
                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
  3611
                install_update = []
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3612
                confirmation_list = None
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3613
                if self.show_install:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3614
                        confirmation_list = []
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3615
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3616
                if self.all_selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3617
                        self.__add_install_update_pkgs_for_publishers(
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3618
                                    install_update, confirmation_list)
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3619
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
  3620
                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
  3621
                        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
  3622
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3623
                installupdate.InstallUpdate(install_update, self, \
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3624
                    self.image_directory, action = enumerations.INSTALL_UPDATE,
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3625
                    main_window = self.w_main_window,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3626
                    confirmation_list = confirmation_list)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3627
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3628
        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
  3629
                self.api_o.reset()
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3630
                confirmation = None
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3631
                if self.show_image_update:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3632
                        confirmation = []
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3633
                installupdate.InstallUpdate([], self,
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3634
                    self.image_directory, action = enumerations.IMAGE_UPDATE,
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 868
diff changeset
  3635
                    parent_name = _("Package Manager"),
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 868
diff changeset
  3636
                    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
  3637
                    main_window = self.w_main_window,
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3638
                    icon_confirm_dialog = self.window_icon,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3639
                    confirmation_list = confirmation)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3640
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3641
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3642
        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
  3643
                wTreePlan = gtk.glade.XML(self.gladefile, "aboutdialog")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3644
                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
  3645
                aboutdialog.set_icon(self.window_icon)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3646
                aboutdialog.connect("response", lambda x = None, \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3647
                    y = None: aboutdialog.destroy())
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3648
                aboutdialog.run()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3649
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  3650
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  3651
        def __on_help_help(widget):
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  3652
                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
  3653
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3654
        def __add_remove_pkgs_for_publishers(self, remove_list, confirmation_list):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3655
                for pub_name in self.selected_pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3656
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3657
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3658
                                break
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3659
                        for pkg_stem in pkgs:
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3660
                                status = pkgs.get(pkg_stem)[0]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3661
                                if status == enumerations.INSTALLED or \
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3662
                                    status == enumerations.UPDATABLE:
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3663
                                        remove_list.append(pkg_stem)
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3664
                                        if self.show_remove:
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3665
                                                desc = pkgs.get(pkg_stem)[1]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3666
                                                pkg_name = pkgs.get(pkg_stem)[2]
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3667
                                                confirmation_list.append(
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3668
                                                    [pkg_name, pub_name,
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3669
                                                    desc, status])
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  3670
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3671
        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
  3672
                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
  3673
                remove_list = []
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3674
                confirmation_list = None
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3675
                if self.show_remove:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3676
                        confirmation_list = []
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3677
                if self.all_selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3678
                        self.__add_remove_pkgs_for_publishers(remove_list, 
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3679
                            confirmation_list)
1058
11da4bffbd61 8186 Mixing the pkg(1) and GUI commands causes wrong pkg states in the GUI.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1056
diff changeset
  3680
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
  3681
                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
  3682
                        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
  3683
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3684
                installupdate.InstallUpdate(remove_list, self,
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3685
                    self.image_directory, action = enumerations.REMOVE,
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3686
                    main_window = self.w_main_window,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3687
                    confirmation_list = confirmation_list)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3688
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3689
        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
  3690
                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
  3691
                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
  3692
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
  3693
        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
  3694
                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
  3695
                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
  3696
                    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
  3697
                        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
  3698
                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
  3699
                self.in_setup = True
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3700
                self.last_visible_publisher = None
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3701
                self.set_busy_cursor()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3702
                status_str = _("Refreshing package catalog information")
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3703
                self.__update_statusbar_message(status_str)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3704
                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
  3705
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3706
        def __catalog_refresh(self):
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3707
                """Update image's catalogs."""
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3708
                success = self.__do_refresh(immediate=True)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3709
                gobject.idle_add(self.__clear_recent_searches)
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3710
                self.__catalog_refresh_done()
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3711
                if not success:
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3712
                        return -1
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3713
                return 0
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3714
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3715
        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
  3716
                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
  3717
                        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
  3718
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3719
        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
  3720
                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
  3721
                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
  3722
                        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
  3723
                            index)
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3724
                        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
  3725
                            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
  3726
                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
  3727
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3728
        def __main_application_quit(self, restart = False):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3729
                '''quits the main gtk loop'''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3730
                self.cancelled = True
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3731
                self.exiting = True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3732
                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
  3733
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3734
                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
  3735
                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
  3736
                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
  3737
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3738
                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
  3739
                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
  3740
                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
  3741
                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
  3742
                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
  3743
                        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
  3744
                                start_insearch = True
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3745
                        if self.is_all_publishers or self.is_all_publishers_installed:
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3746
                                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
  3747
                                    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
  3748
                        else:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3749
                                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
  3750
                        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
  3751
                                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
  3752
                        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
  3753
                        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
  3754
                        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
  3755
                        vpos = save_vpos
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3756
                try:
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3757
                        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
  3758
                                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
  3759
                                    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
  3760
                        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
  3761
                        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
  3762
                            start_insearch)
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3763
                        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
  3764
                        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
  3765
                        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
  3766
                        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
  3767
                except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3768
                        pass
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3769
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3770
                if restart:
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  3771
                        gobject.spawn_async([self.application_path, "-R",
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3772
                            self.image_directory, "-U"])
1258
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3773
                else:
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3774
                        if self.is_all_publishers or self.is_all_publishers_installed:
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3775
                                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
  3776
                                    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
  3777
                        else:
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3778
                                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
  3779
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3780
                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
  3781
                        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
  3782
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3783
                if self.api_o.can_be_canceled():
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3784
                        Thread(target = self.api_o.cancel, args = ()).start()
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3785
                self.__do_exit()
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3786
                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
  3787
                return True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3788
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3789
        @staticmethod
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3790
        def __do_exit():
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3791
                if threading.activeCount() == 1:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3792
                        gtk.main_quit()
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3793
                        sys.exit(0)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3794
                return True
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3795
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3796
        def __check_if_something_was_changed(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3797
                ''' 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
  3798
                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
  3799
                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
  3800
                        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
  3801
                                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
  3802
                                        return True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3803
                return False
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3804
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
  3805
        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
  3806
                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
  3807
                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
  3808
                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
  3809
                        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
  3810
                        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
  3811
                                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
  3812
                                    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
  3813
                                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
  3814
                                   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
  3815
                                   enumerations.REPOSITORY_NAME)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3816
                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
  3817
                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
  3818
                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
  3819
                if self.default_publisher != default_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3820
                        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
  3821
                        self.default_publisher = default_pub
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3822
                selected_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3823
                enabled_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3824
                for repo in self.selected_pkgs:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3825
                        selected_repos.append(repo)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3826
                i = 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3827
                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
  3828
                for pub in api_o.get_publishers():
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3829
                        self.pubs_disabled_status[pub.prefix] = pub.disabled
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3830
                        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
  3831
                                continue
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3832
                        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
  3833
                        if cmp(prefix, self.default_publisher) == 0:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3834
                                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
  3835
                        self.repositories_list.append([i, prefix, ])
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3836
                        enabled_repos.append(prefix)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3837
                        i = i + 1
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3838
                self.repositories_list.append([-1, "", ])
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3839
                i = i + 1
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3840
                self.repo_combobox_all_pubs_installed_index = i
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3841
                self.repositories_list.append(
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3842
                    [self.repo_combobox_all_pubs_installed_index, 
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3843
                    self.publisher_options[PUBLISHER_INSTALLED], ])
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3844
                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
  3845
                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
  3846
                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
  3847
                    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
  3848
                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
  3849
                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
  3850
                i = i + 1
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3851
                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
  3852
                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
  3853
                    self.publisher_options[PUBLISHER_ADD], ])
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3854
                pkgs_to_remove = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3855
                for repo_name in selected_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3856
                        if repo_name not in enabled_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3857
                                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
  3858
                                for pkg_stem in pkg_stems:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3859
                                        pkgs_to_remove.append(pkg_stem)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3860
                for pkg_stem in pkgs_to_remove:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3861
                        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
  3862
                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
  3863
                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
  3864
                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
  3865
                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
  3866
                        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
  3867
                                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
  3868
                                    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
  3869
                                    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
  3870
                                        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
  3871
                                           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
  3872
                                        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
  3873
                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
  3874
                        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
  3875
                                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
  3876
                                    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
  3877
                                    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
  3878
                                        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
  3879
                                           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
  3880
                                        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
  3881
                                                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
  3882
                                        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
  3883
                        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
  3884
                                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
  3885
                                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
  3886
                                        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
  3887
                                            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
  3888
                                                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
  3889
                                                   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
  3890
                                                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
  3891
                                # 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
  3892
                                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
  3893
                                        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
  3894
                                        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
  3895
                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
  3896
                        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
  3897
                elif self.default_publisher:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3898
                        self.w_repository_combobox.set_active(active)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3899
                else:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3900
                        self.w_repository_combobox.set_active(0)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3901
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3902
        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
  3903
                '''Toggle function for column enumerations.MARK_COLUMN'''
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3904
                applicationModel = model_sort.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3905
                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
  3906
                filterModel = applicationModel.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3907
                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
  3908
                itr = filterModel.get_iter(child_path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3909
                if itr:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3910
                        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
  3911
                        filterModel.set_value(itr, enumerations.MARK_COLUMN,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3912
                            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
  3913
                        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
  3914
                            enumerations.STATUS_COLUMN)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3915
                        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
  3916
                        if modified:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3917
                                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
  3918
                        else:
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3919
                                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
  3920
                                    enumerations.PUBLISHER_COLUMN)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3921
                                pkg_description = filterModel.get_value(itr, 
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3922
                                    enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3923
                                pkg_name = filterModel.get_value(itr,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3924
                                    enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3925
                                self.__add_pkg_stem_to_list(pkg_stem, pkg_name,
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3926
                                    pkg_status, pkg_publisher, pkg_description)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3927
                        self.update_statusbar()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3928
                        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
  3929
                        self.__enable_disable_install_remove()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3930
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3931
        def __update_reload_button(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3932
                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
  3933
                        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
  3934
                        self.w_reload_button.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3935
                else:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3936
                        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
  3937
                        self.w_reload_button.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3938
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3939
        def __add_pkg_stem_to_list(self, stem, name, status, pub, description="test"):
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3940
                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
  3941
                        self.selected_pkgs[pub] = {}
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3942
                self.selected_pkgs.get(pub)[stem] = [status, description, name]
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3943
                if status == enumerations.NOT_INSTALLED or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3944
                    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
  3945
                        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
  3946
                                self.to_install_update[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3947
                        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
  3948
                                self.to_install_update[pub] += 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3949
                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
  3950
                        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
  3951
                                self.to_remove[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3952
                        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
  3953
                                self.to_remove[pub] += 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3954
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3955
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3956
        def __update_tooltips(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3957
                to_remove = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3958
                to_install = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3959
                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
  3960
                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
  3961
                        packages = self.to_remove.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3962
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3963
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3964
                                        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
  3965
                                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
  3966
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3967
                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
  3968
                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
  3969
                        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
  3970
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3971
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3972
                                        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
  3973
                                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
  3974
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3975
                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
  3976
                        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
  3977
                            "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
  3978
                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
  3979
                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
  3980
                        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
  3981
                            "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
  3982
                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
  3983
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3984
        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
  3985
                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
  3986
                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
  3987
                        pkgs = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3988
                        status = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3989
                        if stem in pkgs:
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3990
                                status = pkgs.pop(stem)[0]
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3991
                        if status == enumerations.NOT_INSTALLED or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3992
                            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
  3993
                                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
  3994
                                        self.to_install_update[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3995
                                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
  3996
                                        self.to_install_update[pub] -= 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3997
                        if status == enumerations.UPDATABLE or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3998
                            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
  3999
                                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
  4000
                                        self.to_remove[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4001
                                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
  4002
                                        self.to_remove[pub] -= 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4003
                        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
  4004
                                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
  4005
                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
  4006
                        self.selected_pkgs.pop(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4007
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4008
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4009
        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
  4010
                # 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
  4011
                # 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
  4012
                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
  4013
                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
  4014
                        stems = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4015
                        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
  4016
                                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
  4017
                for pkg_stem in remove_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4018
                        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
  4019
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4020
        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
  4021
                self.showing_empty_details = True
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4022
                if self.show_info_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4023
                        gobject.source_remove(self.show_info_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4024
                        self.show_info_id = 0
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4025
                if self.show_licenses_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4026
                        gobject.source_remove(self.show_licenses_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4027
                        self.show_licenses_id = 0
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4028
                self.w_installedfiles_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4029
                self.w_dependencies_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4030
                self.w_generalinfo_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4031
                self.w_license_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4032
                return
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4033
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  4034
        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
  4035
                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
  4036
                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
  4037
                        return
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4038
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4039
                instbuffer = self.w_installedfiles_textview.get_buffer()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4040
                depbuffer = self.w_dependencies_textview.get_buffer()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4041
                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
  4042
                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
  4043
                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
  4044
                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
  4045
                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
  4046
                return
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4047
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4048
        def __setting_from_cache(self, pkg_stem):
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4049
                if not self.use_cache:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4050
                        if debug:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4051
                                print "DEBUG: __setting_from_cache: not using cache"
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4052
                        return False
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
  4053
                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
  4054
                        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
  4055
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4056
                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
  4057
                        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
  4058
                            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
  4059
                        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
  4060
                            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
  4061
                        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
  4062
                            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
  4063
                            self.installed_icon, self.not_installed_icon,
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4064
                            self.update_available_icon, 
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4065
                            self.is_all_publishers_installed, self.pubs_disabled_status)
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4066
                        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
  4067
                            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
  4068
                        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
  4069
                        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
  4070
                            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
  4071
                        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
  4072
                            enumerations.INFO_DEPEND_DEPEND_INFO]
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4073
                        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
  4074
                            enumerations.INFO_DEPEND_DEPEND_INSTALLED_INFO]
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4075
                        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
  4076
                            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
  4077
                        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
  4078
                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
  4079
                        return False
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4080
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
  4081
        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
  4082
                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
  4083
                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
  4084
                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
  4085
                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
  4086
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4087
        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
  4088
                names = []
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4089
                states = None
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4090
                installed_states = []
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4091
                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
  4092
                        states = dep_info[0]
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4093
                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
  4094
                        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
  4095
                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
  4096
                i = 0
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4097
                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
  4098
                        if states != None:
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4099
                                name = fmri.extract_pkg_name(x)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4100
                                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
  4101
                                    {"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
  4102
                                    "build": states[i].build_release,
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4103
                                    "branch": states[i].branch}
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4104
                                found = False
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4105
                                for state in installed_states:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4106
                                        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
  4107
                                                installed_version = version_fmt % \
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4108
                                                    {"version": state.version,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4109
                                                    "build": state.build_release,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4110
                                                    "branch": state.branch}
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4111
                                                found = True
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4112
                                                break
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4113
                                if not found:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4114
                                        installed_version = (_("(not installed)"))
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4115
                                names.append((name, version, installed_version,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4116
                                    found))
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4117
                                i += 1
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4118
                        else:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4119
                                names.append(x)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4120
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
  4121
                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
  4122
                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
  4123
                if states == None:
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4124
                        if len(names) == 0:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4125
                                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
  4126
                                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
  4127
                                    _("None"), "bold")
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4128
                        else:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4129
                                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
  4130
                                        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
  4131
                                        dep_str = "%s\n" % (names[i]) 
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4132
                                        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
  4133
                        return
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4134
                max_name_len = 0
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4135
                max_version_len = 0
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4136
                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
  4137
                        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
  4138
                                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
  4139
                        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
  4140
                                max_version_len = len(version)
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4141
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4142
                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
  4143
                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
  4144
                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
  4145
                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
  4146
                i = 1
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4147
                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
  4148
                    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
  4149
                i += 1
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4150
                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
  4151
                    (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
  4152
                    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
  4153
                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
  4154
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4155
                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
  4156
                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
  4157
                    _("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
  4158
                installed_icon = None
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4159
                not_installed_icon = None
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4160
                i += 0
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4161
                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
  4162
                        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
  4163
                                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
  4164
                                        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
  4165
                                            self.installed_icon,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4166
                                            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
  4167
                                icon = installed_icon
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4168
                        else:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4169
                                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
  4170
                                        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
  4171
                                            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
  4172
                                            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
  4173
                                icon = not_installed_icon
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4174
                        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
  4175
                        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
  4176
                        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
  4177
                        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
  4178
                        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
  4179
                        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
  4180
                        i += 1
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4181
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4182
        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
  4183
            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
  4184
                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
  4185
                    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
  4186
                        return
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4187
                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
  4188
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4189
                if self.__setting_from_cache(pkg_stem):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4190
                        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
  4191
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
  4192
                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
  4193
                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
  4194
                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
  4195
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  4196
                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
  4197
                        network_str = \
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4198
                            _("\nThis might be caused by network problem "
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4199
                            "while accessing the repository.")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4200
                        instbuffer.set_text( \
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4201
                            _("Files Details not available for this package...") +
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4202
                            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
  4203
                        depbuffer.set_text(_(
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4204
                            "Dependencies info not available for this package...") +
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4205
                            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
  4206
                        infobuffer.set_text(
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4207
                            _("Information not available for this package...") +
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4208
                            network_str)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4209
                        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
  4210
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  4211
                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
  4212
                    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
  4213
                    self.installed_icon, self.not_installed_icon,
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4214
                    self.update_available_icon,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4215
                    self.is_all_publishers_installed, self.pubs_disabled_status)
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  4216
                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
  4217
                        # 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
  4218
                        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
  4219
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4220
                if not remote_info:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4221
                        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
  4222
1443
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  4223
                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
  4224
                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
  4225
                        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
  4226
                                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
  4227
                                    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
  4228
                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
  4229
                        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
  4230
                                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
  4231
                                    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
  4232
                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
  4233
                        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
  4234
                                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
  4235
                                    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
  4236
                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
  4237
                        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
  4238
                                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
  4239
                                    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
  4240
                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
  4241
                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
  4242
                    installed_dep_info)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4243
                if self.use_cache:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4244
                        self.info_cache[pkg_stem] = (labs, text, inst_str,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4245
                            local_info, 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
  4246
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
  4247
        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
  4248
                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
  4249
                    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
  4250
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4251
                lic = ""
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4252
                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
  4253
                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
  4254
                        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
  4255
                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
  4256
                        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
  4257
                                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
  4258
                                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
  4259
                        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
  4260
                                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
  4261
                        except UnicodeDecodeError:
1226
7dc1fa06611c 9180 Empty license textview due to conversion problem
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1220
diff changeset
  4262
                                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
  4263
                                    "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
  4264
                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
  4265
                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
  4266
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  4267
        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
  4268
                self.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
  4269
                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
  4270
                    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
  4271
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4272
        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
  4273
                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
  4274
                        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
  4275
                            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
  4276
                        return
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4277
                info = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4278
                try:
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4279
                        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
  4280
                            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
  4281
                except (api_errors.TransportError):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4282
                        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
  4283
                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
  4284
                        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
  4285
                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
  4286
                    self.last_show_licenses_id):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4287
                        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
  4288
                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
  4289
                        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
  4290
                        # Get license from remote
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4291
                                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
  4292
                                    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
  4293
                        except (api_errors.TransportError):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4294
                                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
  4295
                        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
  4296
                                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
  4297
                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
  4298
                    self.last_show_licenses_id):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4299
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4300
                pkgs_info = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4301
                package_info = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4302
                no_licenses = 0
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4303
                if info:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4304
                        pkgs_info = info[0]
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4305
                if pkgs_info:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4306
                        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
  4307
                if package_info:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4308
                        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
  4309
                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
  4310
                        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
  4311
                            license_id)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4312
                        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
  4313
                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
  4314
                        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
  4315
                            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
  4316
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  4317
        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
  4318
                self.show_info_id = 0
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4319
                if not (model and path):
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4320
                        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
  4321
                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
  4322
                        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
  4323
                            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
  4324
                        # 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
  4325
                        # 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
  4326
                        # 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
  4327
                        # 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
  4328
                        # 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
  4329
                                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
  4330
                                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
  4331
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  4332
                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
  4333
                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
  4334
                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
  4335
                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
  4336
                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
  4337
                        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
  4338
                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
  4339
                    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
  4340
dbf8576e058a 7792 Moving focus after a search sometimes clears the search results unexpectedly
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1006
diff changeset
  4341
        def __show_package_info(self, pkg, pkg_stem, pkg_status, info_id):
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  4342
                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
  4343
                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
  4344
                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
  4345
                    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
  4346
                    enumerations.INSTALLED or pkg_status ==
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4347
                    enumerations.UPDATABLE):
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  4348
                        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
  4349
                            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
  4350
                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
  4351
                    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
  4352
                    enumerations.NOT_INSTALLED or pkg_status ==
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4353
                    enumerations.UPDATABLE):
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  4354
                        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
  4355
                            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
  4356
                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
  4357
                    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
  4358
                        if local_info:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4359
                                info = local_info
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4360
                        else:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4361
                                info = remote_info
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4362
                        dep_info = None
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4363
                        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
  4364
                        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
  4365
                                try:
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4366
                                        dep_info = self.api_o.info(
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4367
                                            info.dependencies,
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4368
                                            False,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4369
                                            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
  4370
                                            api.PackageInfo.IDENTITY]))
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4371
                                        temp_info = []
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4372
                                        for depend in info.dependencies:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4373
                                                name = fmri.extract_pkg_name(depend)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4374
                                                temp_info.append(name)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4375
                                        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
  4376
                                            temp_info,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4377
                                            True,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4378
                                            frozenset([api.PackageInfo.STATE,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4379
                                            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
  4380
                                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
  4381
                                        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
  4382
                                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
  4383
                                        pass
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4384
                        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
  4385
                            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
  4386
                            info_id)
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  4387
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4388
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4389
        # 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
  4390
        @staticmethod
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4391
        def __locale_distinguished_name(action):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4392
                if action.key_attr == None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4393
                        return str(action)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4394
                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
  4395
                    (_(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
  4396
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
  4397
        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
  4398
                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
  4399
                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
  4400
                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
  4401
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4402
                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
  4403
                        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
  4404
                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
  4405
                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
  4406
                        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
  4407
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
                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
  4409
                    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
  4410
                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
  4411
                        
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
                # Top level Section has been selected
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4413
                if len(cat_path) == 1 and selected_category > RECENT_SEARCH_ID_OFFSET:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4414
                        selected_section = selected_category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4415
                        return selected_section, 0
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4416
                elif len(cat_path) == 1 and selected_category > SECTION_ID_OFFSET:
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4417
                        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
  4418
                        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
  4419
                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
  4420
                        # 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
  4421
                        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
  4422
                        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
  4423
                                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
  4424
                        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
  4425
                            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
  4426
                        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
  4427
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4428
        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
  4429
                '''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
  4430
                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
  4431
                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
  4432
                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
  4433
                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
  4434
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4435
                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
  4436
                        return category
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  4437
                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
  4438
                if filter_id == enumerations.FILTER_SELECTED:
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  4439
                        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
  4440
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4441
                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
  4442
                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
  4443
                        self.__get_active_section_and_category()
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4444
                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4445
                in_recent_search = False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4446
                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
  4447
                        #Clicked on All Categories
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4448
                        category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4449
                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
  4450
                        #Clicked on subcategory
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4451
                        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
  4452
                                category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4453
                elif category_list:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4454
                        #Clicked on Top Level section                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4455
                        if selected_section < RECENT_SEARCH_ID_OFFSET:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4456
                                categories_in_section = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4457
                                        self.section_categories_list[selected_section]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4458
                                for cat_id in category_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4459
                                        if cat_id in categories_in_section:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4460
                                                category = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4461
                                                break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4462
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4463
                                in_recent_search = True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4464
                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
  4465
                        return False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4466
                if self.in_search_mode or in_recent_search:
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  4467
                        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
  4468
                return (category &
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  4469
                    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
  4470
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4471
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4472
        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
  4473
                '''Function for filtercombobox'''
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  4474
                if filter_id == enumerations.FILTER_ALL:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4475
                        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
  4476
                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
  4477
                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
  4478
                        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
  4479
                            enumerations.UPDATABLE)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  4480
                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
  4481
                        return status == enumerations.UPDATABLE
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  4482
                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
  4483
                        return status == enumerations.NOT_INSTALLED
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4484
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4485
        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
  4486
                if len(self.repositories_list) <= 1:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4487
                        return True
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4488
                else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4489
                        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
  4490
                        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
  4491
                        if not pkg:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4492
                                return False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4493
                        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
  4494
                                return True
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4495
                        else:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4496
                                return False
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4497
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4498
        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
  4499
                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
  4500
                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4501
                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
  4502
                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
  4503
                        self.unset_busy_cursor()
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4504
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4505
        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
  4506
                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
  4507
                        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
  4508
                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
  4509
                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
  4510
                        for row in model:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4511
                                if not row[enumerations.MARK_COLUMN]:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4512
                                        self.w_selectall_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4513
                                        return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4514
                        self.w_selectall_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4515
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4516
                        self.w_selectall_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4517
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4518
        def __enable_disable_install_remove(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4519
                if not self.user_rights:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4520
                        self.w_installupdate_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4521
                        self.w_installupdate_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4522
                        self.w_remove_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4523
                        self.w_remove_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4524
                        return
1413
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  4525
                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
  4526
                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
  4527
                self.__enable_disable_export_selections()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4528
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4529
        def __enable_if_selected_for_removal(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4530
                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
  4531
                selected = 0
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4532
                for pub in self.to_remove:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4533
                        selected = self.to_remove.get(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4534
                        if selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4535
                                break
914
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  4536
                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
  4537
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4538
                self.w_remove_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4539
                self.w_remove_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4540
                return sensitive
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4541
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4542
        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
  4543
                sensitive = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4544
                selected = 0
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4545
                for pub in self.to_install_update:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4546
                        selected = self.to_install_update.get(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4547
                        if selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4548
                                break
914
6eb7fdf5b986 7031 Install/Update and Remove buttons should act only on visible repository.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 912
diff changeset
  4549
                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
  4550
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4551
                self.w_installupdate_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4552
                self.w_installupdate_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4553
                return sensitive
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4554
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4555
        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
  4556
                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
  4557
                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
  4558
                        return
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  4559
                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
  4560
                        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
  4561
                                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
  4562
                                        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
  4563
                                            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
  4564
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4565
                self.w_selectupdates_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4566
                return
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4567
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4568
        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
  4569
                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
  4570
                try:
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4571
                        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
  4572
                            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
  4573
                finally:
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4574
                        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
  4575
                return res
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4576
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4577
        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
  4578
                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
  4579
                        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
  4580
                else:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4581
                        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
  4582
                return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4583
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4584
        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
  4585
                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
  4586
                        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
  4587
                                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
  4588
                                        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
  4589
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4590
                self.w_deselect_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4591
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4592
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
  4593
        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
  4594
            category_list, section_list):
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  4595
                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
  4596
                        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
  4597
                            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
  4598
                        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
  4599
                        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
  4600
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  4601
        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
  4602
            category_list, section_list):
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4603
                pubs = []
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4604
                pkgs_from_api = []
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4605
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4606
                status_str = _("Loading package list")
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4607
                gobject.idle_add(self.__update_statusbar_message, status_str)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4608
                try:                
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4609
                        if self.is_all_publishers_installed:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4610
                                pkgs_from_api = self.api_o.get_pkg_list(pubs = pubs,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4611
                                    pkg_list = api.ImageInterface.LIST_INSTALLED)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4612
                        else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4613
                                pubs.append(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4614
                                pkgs_from_api = self.api_o.get_pkg_list(pubs = pubs,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4615
                                    pkg_list = api.ImageInterface.LIST_INSTALLED_NEWEST)
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents: 562
diff changeset
  4616
                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
  4617
                        # 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
  4618
                        # 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
  4619
                        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
  4620
                        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
  4621
                            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
  4622
                        gobject.idle_add(self.unset_busy_cursor)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4623
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4624
                return self.__add_pkgs_to_lists(pkgs_from_api, pubs, application_list,
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4625
                    category_list, section_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4626
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4627
        def __get_categories_for_pubs(self, pubs):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4628
                sections = {}
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4629
                #ImageInfo for categories
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4630
                sectioninfo = imageinfo.ImageInfo()
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4631
                share_path = os.path.join(self.application_dir, 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4632
                        "usr/share/package-manager/data")
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4633
                if len(pubs) == 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4634
                        section = sectioninfo.read(os.path.join(share_path,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4635
                                    "opensolaris.org.sections"))
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4636
                        sections["opensolaris.org"] = section
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4637
                        return sections
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4638
                        
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  4639
                for pub in pubs:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4640
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4641
                                a = time.time()
1245
86d476d3d53f 10131 check for updates can traceback if check for updates is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1243
diff changeset
  4642
                        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
  4643
                            pub + ".sections"))
701
ba35d1b02c04 4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 697
diff changeset
  4644
                        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
  4645
                                section = sectioninfo.read(os.path.join(share_path,
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4646
                                    "opensolaris.org.sections"))
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  4647
                        sections[pub] = section
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4648
                        if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4649
                                print "Time for get_pkg_categories", time.time() - a
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4650
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4651
                return sections
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4652
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4653
        def __add_pkgs_to_lists_from_info(self, local_results, remote_results, 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4654
            application_list):
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4655
                status_str = _("Loading package list")
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4656
                gobject.idle_add(self.__update_statusbar_message, status_str)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4657
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4658
                pkg_add = self.__add_pkgs_to_lists_from_results(local_results,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4659
                    0, application_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4660
                self.__add_pkgs_to_lists_from_results(remote_results,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4661
                    pkg_add, application_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4662
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4663
        def __add_pkgs_to_lists_from_results(self, results, pkg_add,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4664
            application_list):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4665
                for result in results:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4666
                        pkg_pub = result.publisher
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4667
                        pkg_name = result.pkg_stem
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4668
                        pkg_fmri = fmri.PkgFmri(result.fmri)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4669
                        pkg_stem = pkg_fmri.get_pkg_stem()
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4670
                        summ = result.summary
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4671
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4672
                        if api.PackageInfo.INSTALLED in result.states:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4673
                                if api.PackageInfo.UPGRADABLE in result.states:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4674
                                        status_icon = self.update_available_icon
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4675
                                        pkg_state = enumerations.UPDATABLE
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4676
                                else:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4677
                                        status_icon = self.installed_icon
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4678
                                        pkg_state = enumerations.INSTALLED
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4679
                        else:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4680
                                status_icon = self.not_installed_icon
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4681
                                pkg_state = enumerations.NOT_INSTALLED
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1028
diff changeset
  4682
                        pkg_name = gui_misc.get_pkg_name(pkg_name)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4683
                        marked = False
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4684
                        pkgs = self.selected_pkgs.get(pkg_pub)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4685
                        if pkgs != None:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4686
                                if pkg_stem in pkgs:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4687
                                        marked = True
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4688
                        next_app = \
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4689
                            [
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4690
                                marked, status_icon, pkg_name, summ, pkg_state,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4691
                                pkg_fmri, pkg_stem, None, True, None, pkg_pub
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4692
                            ]
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4693
                        application_list.insert(pkg_add, next_app)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4694
                        pkg_add += 1
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4695
                return pkg_add
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4696
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4697
        def __add_pkgs_to_lists(self, pkgs_from_api, pubs, application_list,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4698
            category_list, section_list):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4699
                if section_list != None:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4700
                        self.__init_sections(section_list)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4701
                sections = self.__get_categories_for_pubs(pubs)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4702
                pkg_add = 0
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4703
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4704
                        a = time.time()
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4705
                for entry in pkgs_from_api:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4706
                        (pkg_pub, pkg_name, ver), summ, cats, states = entry
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4707
                        if debug:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4708
                                print entry
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4709
                        pkg_fmri = fmri.PkgFmri("%s@%s" % (pkg_name,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4710
                            ver), publisher=pkg_pub)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4711
                        pkg_stem = pkg_fmri.get_pkg_stem()
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4712
                        pkg_name = gui_misc.get_pkg_name(pkg_name)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4713
                        if api.PackageInfo.INSTALLED in states:
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4714
                                pkg_state = enumerations.INSTALLED
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4715
                                if api.PackageInfo.UPGRADABLE in states:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4716
                                        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
  4717
                                        pkg_state = enumerations.UPDATABLE
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4718
                                else:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4719
                                        status_icon = self.installed_icon
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4720
                        else:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4721
                                pkg_state = enumerations.NOT_INSTALLED
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4722
                                status_icon = self.not_installed_icon
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4723
                        marked = False
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4724
                        pkgs = self.selected_pkgs.get(pkg_pub)
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4725
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4726
                                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
  4727
                                        marked = True
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4728
                        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
  4729
                            [
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4730
                                marked, status_icon, pkg_name, summ, pkg_state,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4731
                                pkg_fmri, pkg_stem, None, True, None, pkg_pub
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4732
                            ]
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4733
                        self.__add_package_to_list(next_app,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4734
                            application_list,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4735
                            pkg_add, pkg_name,
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4736
                            cats, category_list, pkg_pub)
1139
1d9a377bb97e 7184 PM not properly behaving when repository doesn't contain any packages.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1138
diff changeset
  4737
                        pkg_add += 1
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4738
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4739
                        print "Time to add packages:", time.time() - a
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4740
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4741
                        self.__add_categories_to_sections(sections,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4742
                            category_list, section_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4743
                return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4744
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4745
        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
  4746
                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
  4747
                        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
  4748
                                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
  4749
                                        self.__add_category_to_section(_(category),
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4750
                                            _(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
  4751
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4752
                # Sort the Categories into alphabetical order
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4753
                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
  4754
                        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
  4755
                        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
  4756
                        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
  4757
                        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
  4758
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4759
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4760
        def __add_package_to_list(self, app, application_list, pkg_add,
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4761
            pkg_name, cats, category_list, pub):
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4762
                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
  4763
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4764
                        return
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4765
                for cat in cats:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4766
                        names = cat[1].split('/', 2)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4767
                        if len(names) > 1:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4768
                                self.__add_package_to_category(names[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
  4769
                                    row_iter, application_list,
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4770
                                    category_list)
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4771
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4772
        @staticmethod
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4773
        def __add_package_to_category(category_name, package, 
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4774
            application_list, category_list):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4775
                if not package or category_name == 'All':
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4776
                        return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4777
                if not category_name:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4778
                        return
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4779
                category_id = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4780
                for category in category_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4781
                        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
  4782
                                category_id = category[enumerations.CATEGORY_ID]
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  4783
                                break
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4784
                if not category_id:                       # Category not exists
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4785
                        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
  4786
                        category_list.append(None, [category_id, category_name,
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4787
                            None, None])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4788
                if application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4789
                    enumerations.CATEGORY_LIST_COLUMN):
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4790
                        a = application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4791
                            enumerations.CATEGORY_LIST_COLUMN)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4792
                        a.append(category_id)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4793
                else:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4794
                        category_list = []
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4795
                        category_list.append(category_id)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4796
                        application_list.set(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4797
                            enumerations.CATEGORY_LIST_COLUMN, category_list)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4798
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
  4799
        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
  4800
                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
  4801
                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
  4802
                            [ 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
  4803
1406
46c950f90950 11475 The PM category tree includes categories from other publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1405
diff changeset
  4804
                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
  4805
                #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
  4806
                #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
  4807
                #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
  4808
                #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
  4809
                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
  4810
                        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
  4811
                                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
  4812
                        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
  4813
                                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
  4814
                        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
  4815
                                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
  4816
                                        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
  4817
                                                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
  4818
                                        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
  4819
                                                = 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
  4820
                                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
  4821
                                        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
  4822
                                                {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
  4823
                                                    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
  4824
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4825
                #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
  4826
                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
  4827
                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
  4828
                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
  4829
                        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
  4830
                        #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
  4831
                        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
  4832
                                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
  4833
                        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
  4834
                                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
  4835
                        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
  4836
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4837
                        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
  4838
                            [ 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
  4839
                            "<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
  4840
                            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
  4841
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4842
                        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
  4843
                                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
  4844
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4845
                        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
  4846
                        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
  4847
                                category_tree.append(cat_iter, category_ids[cat_id])
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4848
                self.recent_searches_cat_iter = category_tree.append(None,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4849
                    [RECENT_SEARCH_ID,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4850
                    "<span foreground='#757575'><b>" + _("Recent Searches") +
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4851
                    "</b></span>", None, None])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4852
                if self.recent_searches and len(self.recent_searches) > 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4853
                        for recent_search in self.recent_searches_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4854
                                category_tree.append(self.recent_searches_cat_iter, 
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4855
                                    self.recent_searches[recent_search])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4856
                
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
  4857
                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
  4858
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4859
                #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
  4860
                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
  4861
                        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
  4862
                            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
  4863
                        return
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4864
                self.__restore_category_state()
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4865
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4866
        def __add_recent_search(self, text, pub_prefix, application_list):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4867
                self.adding_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4868
                category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4869
                if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4870
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4871
                if self.is_all_publishers:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4872
                        pub_prefix = _("All Publishers")
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4873
                recent_search = "(%d) <b>%s</b> %s" % \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4874
                        (len(application_list), text, pub_prefix)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4875
                if not (recent_search in self.recent_searches):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4876
                        cat_iter = category_tree.append(self.recent_searches_cat_iter,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4877
                            [RECENT_SEARCH_ID + 1, recent_search, text, application_list])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4878
                        self.recent_searches[recent_search] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4879
                                [RECENT_SEARCH_ID + 1, recent_search, text,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4880
                                application_list]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4881
                        self.recent_searches_list.append(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4882
                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4883
                        rs_iter = category_tree.iter_children(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4884
                            self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4885
                        while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4886
                                rs_value = category_tree.get_value(rs_iter,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4887
                                    enumerations.CATEGORY_NAME)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4888
                                if rs_value == recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4889
                                        category_tree.remove(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4890
                                        break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4891
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4892
                        cat_iter = category_tree.append(self.recent_searches_cat_iter,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4893
                            [RECENT_SEARCH_ID + 1, recent_search, text, application_list])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4894
                        self.recent_searches_list.remove(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4895
                        self.recent_searches_list.append(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4896
                path = category_tree.get_path(cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4897
                self.w_categories_treeview.expand_to_path(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4898
                self.__unselect_category()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4899
                self.w_categories_treeview.scroll_to_cell(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4900
                self.adding_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4901
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4902
        def __clear_recent_searches(self):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4903
                category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4904
                if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4905
                        return                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4906
                if self.recent_searches == None or len(self.recent_searches) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4907
                        return                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4908
                self.__set_searchentry_to_prompt()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4909
                selection, sel_path = self.__get_selection_and_category_path()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4910
                rs_iter = category_tree.iter_children(self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4911
                while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4912
                        category_tree.remove(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4913
                        if category_tree.iter_is_valid(rs_iter):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4914
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4915
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4916
                                break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4917
                del(self.recent_searches_list[:])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4918
                self.recent_searches.clear()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4919
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4920
                rs_path = category_tree.get_path(self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4921
                if selection and sel_path and rs_path and len(sel_path) > 0 and \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4922
                        len(rs_path) > 0 and sel_path[0] == rs_path[0]:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4923
                        self.__restore_setup_for_browse()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4924
                               
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4925
        def __restore_recent_search(self, sel_category):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4926
                if not sel_category:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4927
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4928
                if not self.is_all_publishers:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4929
                        self.__save_setup_before_search(single_search=True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4930
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4931
                application_list = sel_category[enumerations.SECTION_LIST_OBJECT]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4932
                text = sel_category[enumerations.CATEGORY_DESCRIPTION]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4933
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4934
                pkg_stems = []
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4935
                pkg_stem_states = {}
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4936
                for row in application_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4937
                        pkg_stems.append(row[enumerations.STEM_COLUMN])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4938
                #Check for changes in pacakge installation status
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4939
                try:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4940
                        info = self.api_o.info(pkg_stems, True, frozenset(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4941
                                    [api.PackageInfo.STATE, api.PackageInfo.IDENTITY]))
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4942
                        for info_s in info.get(0):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4943
                                pkg_stem = fmri.PkgFmri(info_s.fmri).get_pkg_stem(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4944
                                    include_scheme = True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4945
                                if api.PackageInfo.INSTALLED in info_s.states:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4946
                                        pkg_stem_states[pkg_stem] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4947
                                                enumerations.INSTALLED
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4948
                                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4949
                                        pkg_stem_states[pkg_stem] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4950
                                                enumerations.NOT_INSTALLED
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4951
                except (api_errors.TransportError):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4952
                        pass
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4953
                except (api_errors.InvalidDepotResponseException):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4954
                        pass
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4955
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4956
                #Create a new result list updated with current installation status
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4957
                tmp_app_list = self.__get_new_application_liststore()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4958
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4959
                for row in application_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4960
                        pkg_stem = row[enumerations.STEM_COLUMN]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4961
                        pub = row[enumerations.PUBLISHER_COLUMN]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4962
                        marked = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4963
                        pkgs = None
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4964
                        if self.selected_pkgs != None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4965
                                pkgs = self.selected_pkgs.get(pub)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4966
                        if pkgs != None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4967
                                if pkg_stem in pkgs:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4968
                                        marked = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4969
                        if row[enumerations.MARK_COLUMN] != marked:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4970
                                row[enumerations.MARK_COLUMN] = marked
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4971
                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4972
                        if pkg_stem_states.has_key(pkg_stem):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4973
                                row[enumerations.STATUS_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4974
                                        pkg_stem_states[pkg_stem]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4975
                                if pkg_stem_states[pkg_stem] == \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4976
                                        enumerations.NOT_INSTALLED:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4977
                                        row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4978
                                                self.not_installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4979
                                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4980
                                        row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4981
                                                self.installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4982
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4983
                                row[enumerations.STATUS_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4984
                                        enumerations.NOT_INSTALLED
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4985
                                row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4986
                                        self.not_installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4987
                        tmp_app_list.append(row)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4988
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4989
                self.__clear_before_search(show_list=True, in_setup=False,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4990
                    unselect_cat=False)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4991
                self.in_search_mode = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4992
                self.in_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4993
                self.__set_search_text_mode(enumerations.SEARCH_STYLE_NORMAL)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4994
                self.w_searchentry.set_text(text)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4995
                self.__set_main_view_package_list()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4996
                self.__init_tree_views(tmp_app_list, None, None, None, None,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4997
                    enumerations.NAME_COLUMN)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4998
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4999
        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
  5000
                #Restore expanded Category state
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  5001
                if self.w_categories_treeview == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  5002
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  5003
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  5004
                if model == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  5005
                        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
  5006
                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
  5007
                        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
  5008
                        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
  5009
                                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
  5010
                                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
  5011
                                        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
  5012
                #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
  5013
                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
  5014
                        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
  5015
                        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
  5016
                            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
  5017
                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
  5018
                        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
  5019
                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
  5020
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5021
        @staticmethod
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5022
        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
  5023
            section_list):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5024
                '''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
  5025
                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
  5026
                is skipped. Sections must be case sensitive'''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5027
                if not category_name:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5028
                        return
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5029
                for section in section_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5030
                        if section[enumerations.SECTION_NAME] == section_name:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5031
                                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
  5032
                                for category in category_list:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5033
                                        category[enumerations.CATEGORY_NAME] = \
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5034
                                            _(category[enumerations.CATEGORY_NAME])
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5035
                                        if category[enumerations.CATEGORY_NAME] == \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5036
                                            category_name:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5037
                                                section_lst = category[ \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5038
                                                    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
  5039
                                                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
  5040
                                                    True
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5041
                                                if not section_lst:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5042
                                                        category[ \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5043
                                                    enumerations.SECTION_LIST_OBJECT] = \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5044
                                                            [section_id, ]
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5045
                                                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5046
                                                        if not section_name in \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5047
                                                            section_lst:
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5048
                                                                section_lst.append(
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5049
                                                                    section_id)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5050
                                break
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5051
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5052
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5053
        def __progress_set_fraction(self, count, total):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5054
                self.__progress_pulse_stop()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5055
                if count == total:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5056
                        self.w_progress_frame.hide()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5057
                        return False
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5058
                if self.api_o.can_be_canceled():
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  5059
                        self.progress_cancel.set_sensitive(True)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5060
                else:
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  5061
                        self.progress_cancel.set_sensitive(False)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5062
                self.w_progress_frame.show()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5063
                result = (count + 0.0)/total
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5064
                if result > 1.0:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5065
                        result = 1.0
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5066
                elif result < 0.0:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5067
                        result = 0.0
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5068
                self.w_status_progressbar.set_fraction(result)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5069
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5070
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5071
        def __progress_pulse_start(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5072
                if self.progress_stop_thread == True:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5073
                        self.progress_stop_thread = False
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5074
                        Thread(target = self.__progress_pulse).start()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5075
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5076
        def __progress_pulse_stop(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5077
                self.progress_stop_thread = True
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5078
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5079
        def __progress_pulse(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5080
                gobject.idle_add(self.w_progress_frame.show)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5081
                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
  5082
                        if self.api_o != None and self.api_o.can_be_canceled():
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  5083
                                gobject.idle_add(self.progress_cancel.set_sensitive, True)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5084
                        else:
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  5085
                                gobject.idle_add(self.progress_cancel.set_sensitive,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  5086
                                    False)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5087
                        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
  5088
                        time.sleep(0.1)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5089
                gobject.idle_add(self.w_progress_frame.hide)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5090
                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
  5091
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5092
        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
  5093
                if msg_title:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5094
                        title = msg_title
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5095
                else:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5096
                        title = _("Package Manager")
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5097
                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
  5098
                    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
  5099
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5100
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5101
# Static Methods
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5102
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5103
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5104
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5105
        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
  5106
                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
  5107
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5108
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5109
        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
  5110
                '''Function which sets icon size'''
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5111
                if data == enumerations.FILTER_NAME:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5112
                        renderer.set_property("xalign", 0)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5113
                        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
  5114
                elif data == enumerations.FILTER_ICON:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5115
                        renderer.set_property("xalign", 0)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5116
                        renderer.set_property("width", 24)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5117
                return
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5118
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5119
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5120
        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
  5121
                '''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
  5122
                selected'''
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5123
                if itr:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5124
                        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
  5125
                                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
  5126
                                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
  5127
                        else:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5128
                                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
  5129
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5130
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5131
        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
  5132
                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
  5133
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5134
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5135
        def combobox_id_separator(model, itr):
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  5136
                return model.get_value(itr, 0) == -1 and \
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  5137
                    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
  5138
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5139
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5140
        def combobox_filter_id_separator(model, itr):
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5141
                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
  5142
                    model.get_value(itr, 2) == ""
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5143
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5144
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5145
        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
  5146
                dt = None
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5147
                try:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5148
                        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
  5149
                except AttributeError:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5150
                        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
  5151
                return dt
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5152
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5153
        @staticmethod
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5154
        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
  5155
                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
  5156
                    [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
  5157
                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
  5158
                try:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5159
                        version = found[0]
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5160
                except IndexError:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5161
                        version = None
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5162
                return version
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5163
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5164
#-----------------------------------------------------------------------------#
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5165
# Public Methods
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5166
#-----------------------------------------------------------------------------#
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5167
        def init_show_filter(self):
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5168
                """ 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
  5169
                    labels it is displaying."""
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5170
                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
  5171
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5172
        def reload_packages(self):
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5173
                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
  5174
                    self.pr, self.w_main_window)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5175
                self.cache_o = self.__get_cache_obj(self.api_o)
1426
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  5176
                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
  5177
                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
  5178
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
  5179
        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
  5180
                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
  5181
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  5182
        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
  5183
                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
  5184
                        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
  5185
                        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
  5186
                            'busy', True)
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  5187
                if not self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  5188
                        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
  5189
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  5190
        def unset_busy_cursor(self):
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5191
                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
  5192
                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
  5193
                        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
  5194
                        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
  5195
                            '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
  5196
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5197
        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
  5198
                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
  5199
                        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
  5200
                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
  5201
                if self.first_run:
28b257c5f33e 12266 Wrong focus in package manager on startup
John Rice <john.rice@sun.com>
parents: 1446
diff changeset
  5202
                        self.__update_reload_button()
28b257c5f33e 12266 Wrong focus in package manager on startup
John Rice <john.rice@sun.com>
parents: 1446
diff changeset
  5203
                        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
  5204
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5205
        @staticmethod
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5206
        def __get_cache_obj(api_o):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5207
                cache_o = cache.CacheListStores(api_o)
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  5208
                return cache_o
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  5209
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5210
        def __setup_search_completion(self):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5211
                completion = gtk.EntryCompletion()
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5212
                if self.cache_o != None:
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5213
                        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
  5214
                completion.set_model(self.search_completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5215
                self.w_searchentry.set_completion(completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5216
                completion.set_text_column(0)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5217
                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
  5218
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5219
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5220
        def process_package_list_end(self):
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  5221
                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
  5222
                if self.update_all_proceed:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  5223
                        self.__on_update_all(None)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  5224
                        self.update_all_proceed = False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5225
                self.__enable_disable_install_remove()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5226
                self.update_statusbar()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5227
                self.in_setup = False
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5228
                self.cancelled = False
1441
45be39b77b70 12097 Selections switching issue
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1440
diff changeset
  5229
                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
  5230
                if self.set_section != 0 or \
1441
45be39b77b70 12097 Selections switching issue
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1440
diff changeset
  5231
                    active_filter != enumerations.FILTER_ALL:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5232
                        self.__application_refilter()
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  5233
                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
  5234
                        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
  5235
                                self.unset_busy_cursor()
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5236
                if debug_perf:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5237
                        print "End process_package_list_end", time.time()
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  5238
                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
  5239
                        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
  5240
                                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
  5241
                                    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
  5242
                        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
  5243
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  5244
        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
  5245
                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
  5246
                    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
  5247
                    "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
  5248
                    icon_name)
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  5249
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  5250
        def __count_selected_packages(self):
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5251
                self.all_selected = 0
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5252
                for pub_name in self.selected_pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5253
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5254
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5255
                                break
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5256
                        self.all_selected += len(pkgs)
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  5257
 
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5258
        def update_statusbar(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5259
                '''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
  5260
                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
  5261
                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
  5262
1530
0f782abf79b0 12708 Packages can not be installed or removed in the All publishers search result
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1516
diff changeset
  5263
                self.__count_selected_packages()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5264
                if not self.in_search_mode:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5265
                        if self.application_list == None:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5266
                                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
  5267
                        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
  5268
                        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
  5269
                        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
  5270
                                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
  5271
                                        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
  5272
                        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
  5273
                                {"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
  5274
                                "selected": selected_in_list}
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5275
                        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
  5276
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5277
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5278
                # 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
  5279
                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
  5280
                        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
  5281
                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
  5282
                        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
  5283
                        e1 = "</b>"
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5284
                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
  5285
                        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
  5286
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  5287
                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
  5288
                        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
  5289
                        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
  5290
                        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
  5291
                                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
  5292
                                        _("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
  5293
                                        " 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
  5294
                                        {"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
  5295
                                        "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
  5296
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  5297
                                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
  5298
                                        _("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
  5299
                                        "...") % \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  5300
                                        {"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
  5301
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  5302
                        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
  5303
                                _("%(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
  5304
                                "%(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
  5305
                                {"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
  5306
                                    "s1": s1, "search_text": search_text, "e1": e1, }
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5307
                self.__update_statusbar_message(status_str)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5308
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5309
        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
  5310
                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
  5311
                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
  5312
                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
  5313
                        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
  5314
                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
  5315
                    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
  5316
                package_installed =  False
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5317
                if package_info:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5318
                        package_installed =  \
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  5319
                            (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
  5320
                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
  5321
                        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
  5322
                            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
  5323
                        if (package_info and
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  5324
                            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
  5325
                                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
  5326
                                    enumerations.INSTALLED
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5327
                                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
  5328
                                    self.installed_icon
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5329
                        else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5330
                                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
  5331
                                    enumerations.UPDATABLE
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5332
                                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
  5333
                                    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
  5334
                else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5335
                        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
  5336
                            enumerations.NOT_INSTALLED
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5337
                        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
  5338
                            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
  5339
                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
  5340
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
  5341
        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
  5342
                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
  5343
                        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
  5344
                                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
  5345
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
  5346
        @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
  5347
        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
  5348
                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
  5349
                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
  5350
                        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
  5351
                        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
  5352
                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
  5353
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  5354
        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
  5355
                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
  5356
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5357
                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
  5358
                default_publisher = self.default_publisher
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  5359
                self.__do_refresh(ignore_transport_ex=True)
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
  5360
                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
  5361
                        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
  5362
                        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
  5363
                        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
  5364
                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
  5365
                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
  5366
                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
  5367
                        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
  5368
                                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
  5369
                                        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
  5370
                                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
  5371
                                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
  5372
                                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
  5373
                                        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
  5374
                                            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
  5375
                                            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
  5376
                                        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
  5377
                                            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
  5378
                                            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
  5379
                                        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
  5380
                                                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
  5381
                                                        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
  5382
                                                        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
  5383
                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
  5384
                        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
  5385
                        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
  5386
                                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
  5387
                        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
  5388
                                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
  5389
                                        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
  5390
                                        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
  5391
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
  5392
                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
  5393
                        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
  5394
                                pkg_list = update_list.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5395
                                for pkg in pkg_list:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5396
                                        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
  5397
                                        if pub != default_publisher:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5398
                                                pkg_stem = self.__get_pkg_stem(
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5399
                                                    pkg, pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5400
                                        else:
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5401
                                                pkg_stem = self.__get_pkg_stem(
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5402
                                                    pkg)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5403
                                        if pkg_stem:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5404
                                                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
  5405
                                                        del self.info_cache[pkg_stem]
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5406
                                                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
  5407
                # 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
  5408
                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
  5409
                self.__process_package_selection()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5410
                self.__enable_disable_selection_menus()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5411
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5412
                self.update_statusbar()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5413
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
  5414
        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
  5415
                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
  5416
                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
  5417
                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
  5418
                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
  5419
                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
  5420
                    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
  5421
                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
  5422
                        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
  5423
                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
  5424
                    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
  5425
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5426
        def __reset_home_dir(self):
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5427
                # We reset the HOME directory in case the user called us
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5428
                # with gksu and had NFS mounted home directory in which
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5429
                # case dbus called from gconf cannot write to the directory.
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5430
                if os.getuid() == 0:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5431
                        home_dir = self.__find_root_home_dir()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5432
                        os.putenv('HOME', home_dir)
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5433
1028
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5434
        @staticmethod
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5435
        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
  5436
                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
  5437
                 
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5438
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5439
                        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
  5440
                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
  5441
                        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
  5442
                                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
  5443
                        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
  5444
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5445
                        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
  5446
                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
  5447
                        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
  5448
                                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
  5449
                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
  5450
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5451
        @staticmethod
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5452
        def __get_pkg_stem(pkg_name, pkg_pub=None):
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5453
                pkg_str = "pkg:/"
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5454
                if pkg_pub == None:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5455
                        return_str = "%s%s" % (pkg_str, pkg_name)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5456
                else:
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5457
                        return_str = "%s/%s/%s" % (pkg_str, pkg_pub, pkg_name)
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5458
                return return_str
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5459
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5460
        def restart_after_ips_update(self):
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5461
                self.__main_application_quit(restart = True)
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5462
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5463
        def shutdown_after_image_update(self, exit_pm = False):
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5464
                if exit_pm == True:
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5465
                        self.__on_mainwindow_delete_event(None, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5466
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5467
        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
  5468
                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
  5469
                    self.pr, self.w_main_window)
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5470
                self.cache_o = self.__get_cache_obj(self.api_o)
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5471
                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
  5472
                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
  5473
                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
  5474
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5475
        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
  5476
                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
  5477
                
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5478
        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
  5479
                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
  5480
                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
  5481
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5482
###############################################################################
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5483
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5484
# Main
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5485
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5486
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5487
def main():
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5488
        gtk.main()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5489
        return 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5490
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5491
if __name__ == '__main__':
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  5492
        debug = False
1554
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  5493
        debug_perf = False
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5494
        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
  5495
        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
  5496
        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
  5497
        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
  5498
        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
  5499
        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
  5500
        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
  5501
        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
  5502
            "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
  5503
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5504
        try:
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5505
                opts, args = getopt.getopt(sys.argv[1:], "hR:Ui:", \
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5506
                    ["help", "image-dir=", "update-all", "info-install="])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5507
        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
  5508
                print "%s, for help use --help" % msg
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5509
                sys.exit(2)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  5510
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
  5511
        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
  5512
                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
  5513
        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
  5514
                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
  5515
                app_path = os.path.realpath(cmd)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  5516
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  5517
        for option, argument in opts:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5518
                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
  5519
                        print """\
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  5520
Use -R (--image-dir) to specify image directory.
1556
9f92a327d343 12859 Strings containing Update All need to be updated
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1555
diff changeset
  5521
Use -U (--update-all) to proceed with Updates"""
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5522
                        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
  5523
                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
  5524
                        image_dir = argument
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  5525
                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
  5526
                        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
  5527
                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
  5528
                        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
  5529
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5530
        if image_dir == None:
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  5531
                try:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5532
                        image_dir = os.environ["PKG_IMAGE"]
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  5533
                except KeyError:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5534
                        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
  5535
        try:
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  5536
                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
  5537
        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
  5538
                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
  5539
                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
  5540
                sys.exit(1)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5541
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5542
        # Setup webinstall
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  5543
        if info_install_arg or len(sys.argv) == 2 and not update_all_proceed:
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5544
                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
  5545
                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
  5546
                        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
  5547
                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
  5548
                main()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5549
                sys.exit(0)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5550
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5551
        # Setup packagemanager
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5552
        packagemanager = PackageManager()
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5553
        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
  5554
        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
  5555
        packagemanager.update_all_proceed = update_all_proceed
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5556
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5557
        while gtk.events_pending():
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5558
                gtk.main_iteration(False)
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5559
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5560
        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
  5561
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5562
        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
  5563
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5564
        main()