src/packagemanager.py
author Padraig O'Briain <padraig.obriain@sun.com>
Mon, 14 Dec 2009 08:00:28 +0000
changeset 1571 d66522ea16be
parent 1566 367d13217341
child 1572 b1bcb39eb27c
permissions -rw-r--r--
8531 Allow a user to cancel a search in Package Manager GUI
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")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   419
                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
   420
                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
   421
                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
   422
                infobuffer = self.w_info_textview.get_buffer()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   423
                infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)                
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   424
                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
   425
                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
   426
                self.w_main_hpaned = \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   427
                    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
   428
                self.w_main_vpaned = \
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_vpaned")
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   430
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   431
                self.w_application_treeview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   432
                    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
   433
                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
   434
                    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
   435
                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
   436
                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
   437
                      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
   438
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   439
                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
   440
                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
   441
                    self.__categoriestreeview_compare_func)
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
   442
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   443
                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
   444
                self.w_generalinfo_textview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   445
                    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
   446
                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
   447
                    "bold", weight=pango.WEIGHT_BOLD)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   448
                self.w_installedfiles_textview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   449
                    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
   450
                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
   451
                    "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
   452
                self.w_license_textview = \
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
   453
                    w_tree_main.get_widget("licensetextview")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   454
                self.w_dependencies_textview = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   455
                    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
   456
                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
   457
                    "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
   458
                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
   459
                    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
   460
                self.w_startpage_frame = \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   461
                    w_tree_main.get_widget("startpage_frame")
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   462
                self.w_startpage_eventbox = \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   463
                    w_tree_main.get_widget("startpage_eventbox")
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   464
                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
   465
                    gtk.gdk.color_parse("white"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   466
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   467
                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
   468
                #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
   469
                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
   470
                        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
   471
                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
   472
                        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
   473
    
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   474
                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
   475
                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
   476
                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
   477
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   478
                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
   479
                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
   480
                self.w_status_progressbar.set_pulse_step(0.1)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   481
                self.w_progress_frame.hide()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   482
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   483
                self.w_main_view_notebook = \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   484
                    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
   485
                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
   486
                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
   487
                try:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   488
                        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
   489
                except TypeError:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   490
                        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
   491
                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
   492
                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
   493
                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
   494
                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
   495
                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
   496
                self.w_installupdate_button = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   497
                    w_tree_main.get_widget("install_update_button")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   498
                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
   499
                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
   500
                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
   501
                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
   502
                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
   503
                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
   504
                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
   505
                    'pm-refresh')
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   506
                self.w_version_info_menuitem = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   507
                    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
   508
                self.w_version_info_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   509
                self.w_installupdate_menuitem = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   510
                    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
   511
                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
   512
                    self.w_installupdate_menuitem, 'pm-install_update')
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   513
                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
   514
                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
   515
                    'pm-remove')
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   516
                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
   517
                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
   518
                    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
   519
                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
   520
                    "file_export_selections")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   521
                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
   522
                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
   523
                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
   524
                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
   525
                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
   526
                self.w_selectupdates_menuitem = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   527
                    w_tree_main.get_widget("edit_select_updates")
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   528
                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
   529
                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
   530
                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
   531
                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
   532
                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
   533
                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
   534
                self.is_all_publishers = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
   535
                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
   536
                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
   537
                self.saved_section_active = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   538
                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
   539
                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
   540
                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
   541
                self.saved_category_list = None
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   542
                self.saved_section_list = None
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   543
                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
   544
                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
   545
                self.statusbar_message_id = 0
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
   546
                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
   547
                toolbar.set_expand(True)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
   548
                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
   549
                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
   550
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   551
                # Setup Start Page
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   552
                self.document = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   553
                self.view = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   554
                self.current_url = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   555
                self.opener = None
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   556
                self.__setup_startpage(self.show_startpage)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   557
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   558
                try:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   559
                        dic_mainwindow = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   560
                            {
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   561
                                "on_mainwindow_delete_event": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   562
                                    self.__on_mainwindow_delete_event,
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   563
                                "on_mainwindow_check_resize": \
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   564
                                    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
   565
                                "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
   566
                                    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
   567
                                "on_mainwindow_style_set": \
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   568
                                    self.__on_mainwindow_style_set,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   569
                                "on_searchentry_changed":self.__on_searchentry_changed,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   570
                                "on_searchentry_focus_in_event": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   571
                                    self.__on_searchentry_focus_in,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   572
                                "on_searchentry_focus_out_event": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   573
                                    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
   574
                                "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
   575
                                    self.__do_search,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   576
                                "on_filtercombobox_changed": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   577
                                    self.__on_filtercombobox_changed,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   578
                                "on_repositorycombobox_changed": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   579
                                    self.__on_repositorycombobox_changed,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   580
                                #menu signals
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   581
                                "on_file_export_selections": \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   582
                                        self.__on_file_export_selections,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   583
                                "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
   584
                                "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
   585
                                "on_package_version_info_activate": \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   586
                                    self.__on_version_info,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   587
                                "on_package_install_update_activate": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   588
                                    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
   589
                                "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
   590
                                    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
   591
                                "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
   592
                                    self.__on_file_add_publisher,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   593
                                "on_package_remove_activate":self.__on_remove,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   594
                                "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
   595
                                "on_help_help_activate":self.__on_help_help,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   596
                                "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
   597
                                "on_edit_delete_activate":self.__on_delete,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   598
                                "on_edit_copy_activate":self.__on_copy,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   599
                                "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
   600
                                "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
   601
                                "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
   602
                                "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
   603
                                "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
   604
                                "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
   605
                                "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
   606
                                "on_progress_cancel_clicked": \
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   607
                                    self.__on_progress_cancel_clicked,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   608
                                "on_edit_select_all_activate":self.__on_select_all,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   609
                                "on_edit_select_updates_activate": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   610
                                    self.__on_select_updates,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   611
                                "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
   612
                                "on_edit_preferences_activate":self.__on_preferences,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   613
                                # XXX disabled until new API
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   614
                                "on_package_update_all_activate":self.__on_update_all,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   615
                                #toolbar signals
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   616
                                # XXX disabled until new API
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   617
                                "on_update_all_button_clicked":self.__on_update_all,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   618
                                "on_reload_button_clicked":self.__on_reload,
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   619
                                "on_install_update_button_clicked": \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   620
                                    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
   621
                                "on_remove_button_clicked":self.__on_remove,
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   622
                                "on_help_start_page_activate":self.__on_startpage,
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   623
                                "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
   624
                                    self.__on_notebook_change,
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   625
                                "on_infosearch_button_clicked": \
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   626
                                    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
   627
                                "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
   628
                                    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
   629
                                "on_applicationtreeview_query_tooltip": \
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
   630
                                    self.__on_applicationtreeview_query_tooltip,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   631
                            }
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   632
                        dic_preferences = \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   633
                            {
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   634
                                "on_preferencesdialog_delete_event": \
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
   635
                                    self.__on_preferencesdialog_delete_event,
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   636
                                "on_startpage_checkbutton_toggled": \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   637
                                    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
   638
                                "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
   639
                                    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
   640
                                "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
   641
                                    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
   642
                                "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
   643
                                    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
   644
                                "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
   645
                                    self.on_confirm_remove_checkbutton_toggled,
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   646
                                "on_preferenceshelp_clicked": \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   647
                                    self.__on_preferenceshelp_clicked,
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   648
                                "on_preferencesclose_clicked": \
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   649
                                    self.__on_preferencesclose_clicked,
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
   650
                            }
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
   651
                        dic_api_search_error = \
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
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
                                "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
   654
                                    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
   655
                                "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
   656
                                    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
   657
                                "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
   658
                                    self.__on_api_search_error_delete_event,
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
   659
                            }
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
   660
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   661
                        dic_confirm = \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   662
                            {
1533
c0e5725362e6 12857 Export Selection confirmation dialog does not handle delete event
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1531
diff changeset
   663
                                "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
   664
                                    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
   665
                                "on_help_conf_clicked": \
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   666
                                    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
   667
                                "on_ok_conf_clicked": \
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   668
                                    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
   669
                                "on_cancel_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_cancel_button_clicked,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   671
                            }        
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   672
                            
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   673
                        dic_version_info = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   674
                            {
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   675
                                "on_info_ok_clicked": \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   676
                                    self.__on_info_ok_button_clicked,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   677
                                "on_info_help_clicked": \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   678
                                    self.__on_info_help_button_clicked,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   679
                                "on_version_info_dialog_delete_event": \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   680
                                    self.__on_version_info_dialog_delete_event,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   681
                            }        
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   682
                        w_tree_confirm.signal_autoconnect(dic_confirm)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   683
                        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
   684
                        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
   685
                        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
   686
                            dic_api_search_error)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
   687
                        w_version_info.signal_autoconnect(dic_version_info)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   688
                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
   689
                        print _(
1418
754a34456922 11821 Some translatable strings in Package Manager are wrong
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1414
diff changeset
   690
                            "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
   691
                            "Check declare_signals()") \
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   692
                            % error
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
   693
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
   694
                self.package_selection = None
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
   695
                self.application_list_filter = None
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   696
                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
   697
                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
   698
                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
   699
                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
   700
                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
   701
                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
   702
                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
   703
                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
   704
                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
   705
                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
   706
                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
   707
                self.in_setup = True
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   708
                self.__set_initial_sizes()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   709
                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
   710
                self.__setup_busy_cursor()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   711
                if self.show_startpage:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   712
                        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
   713
                else:
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(
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   715
                            NOTEBOOK_PACKAGE_LIST_PAGE)
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   716
                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
   717
                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
   718
                self.__setup_text_signals()
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   719
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   720
        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
   721
                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
   722
                        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
   723
                        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
   724
                            self.initial_app_height)
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 968
diff changeset
   725
                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
   726
                        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
   727
                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
   728
                        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
   729
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   730
        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
   731
                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
   732
                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
   733
                    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
   734
                gdk_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
   735
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
   736
                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
   737
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   738
        def __fix_initial_values(self):
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   739
                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
   740
                        self.initial_app_width = 800
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   741
                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
   742
                        self.initial_app_height = 600
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   743
                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
   744
                        self.initial_app_hpos = 200
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   745
                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
   746
                        self.initial_app_vpos = 320
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   747
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   748
                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
   749
                        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
   750
        @staticmethod
a91433e8f0ed 11211 Add stock images to PM top level menus
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1366
diff changeset
   751
        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
   752
                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
   753
                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
   754
                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
   755
                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
   756
                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
   757
                    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
   758
                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
   759
                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
   760
                    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
   761
                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
   762
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   763
        @staticmethod
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
   764
        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
   765
                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
   766
                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
   767
                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
   768
                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
   769
                        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
   770
                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
   771
                        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
   772
                        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
   773
                                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
   774
                        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
   775
                                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
   776
                return None
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   777
                
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   778
        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
   779
                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
   780
                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
   781
                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
   782
                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
   783
                    _("<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
   784
                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
   785
1533
c0e5725362e6 12857 Export Selection confirmation dialog does not handle delete event
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1531
diff changeset
   786
        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
   787
                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
   788
                return True
c0e5725362e6 12857 Export Selection confirmation dialog does not handle delete event
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1531
diff changeset
   789
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   790
        @staticmethod
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   791
        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
   792
                gui_misc.display_help("webinstall")
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
   793
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   794
        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
   795
                self.w_exportconfirm_dialog.hide()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   796
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   797
        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
   798
                self.w_exportconfirm_dialog.hide()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   799
                self.__export_selections()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   800
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   801
        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
   802
                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
   803
                        return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   804
                        
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   805
                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
   806
                infobuffer.set_text("")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   807
                textiter = infobuffer.get_end_iter()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   808
                
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   809
                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
   810
                        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
   811
                            "%s\n" % pub_name, "bold")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   812
                        for pkg in pkgs.keys():
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   813
                                infobuffer.insert(textiter,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   814
                                    "\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
   815
                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
   816
                self.w_exportconfirm_dialog.show()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   817
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   818
        def __export_selections(self):
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   819
                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
   820
                if not filename:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   821
                        return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   822
                try:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   823
                        fobj = open(filename, 'w')
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   824
                except IOError, ex_sel:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   825
                        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
   826
                        return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   827
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   828
                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
   829
                    pubs=self.selected_pkgs.keys())
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   830
                fobj.close()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   831
                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
   832
                    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
   833
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   834
        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
   835
                filename = None
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   836
                chooser = gtk.FileChooserDialog(_("Export Selections"), 
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   837
                    self.w_main_window,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   838
                    gtk.FILE_CHOOSER_ACTION_SAVE,
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   839
                    (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
   840
                    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
   841
        
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   842
                file_filter = gtk.FileFilter()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   843
                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
   844
                file_filter.add_pattern("*.p5i")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   845
                chooser.add_filter(file_filter)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   846
                file_filter = gtk.FileFilter()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   847
                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
   848
                file_filter.add_pattern("*")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   849
                chooser.add_filter(file_filter)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   850
                
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   851
                path = tempfile.gettempdir()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   852
                name = _("my_packages")
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   853
                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
   854
                        self.last_export_selection_path != "":
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   855
                        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
   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
                        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
   858
                        self.pylintstub = ext
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   859
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   860
                #Check name
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   861
                base_name = None
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   862
                m = re.match("(.*)(-\d+)$", name)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   863
                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
   864
                        base_name = name
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   865
                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
   866
                        base_name = m.group(1)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   867
                name = name + '.p5i'
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   868
                if base_name:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   869
                        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
   870
                                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
   871
                                        str(i) + '.p5i'
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   872
                                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
   873
                                        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
   874
                                        break
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   875
                chooser.set_current_folder(path)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   876
                chooser.set_current_name(name)
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   877
                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
   878
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   879
                response = chooser.run()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   880
                if response == gtk.RESPONSE_OK:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   881
                        filename = chooser.get_filename()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   882
                        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
   883
                chooser.destroy()
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   884
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
   885
                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
   886
1480
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   887
        @staticmethod
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   888
        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
   889
                ''' 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
   890
                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
   891
                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
   892
                return
05ad339c1b13 12346 Add icons for High Contrast theme
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1479
diff changeset
   893
                
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
   894
        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
   895
                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
   896
                        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
   897
                                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
   898
                        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
   899
                                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
   900
                                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
   901
                        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
   902
                        
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
                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
   904
                        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
   905
                                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
   906
                        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
   907
                        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
   908
        
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   909
        def __search_completion_cb(self, entry):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   910
                text = entry.get_text()
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   911
                if text:
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   912
                        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
   913
                                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
   914
                                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
   915
                                        len_search_completion >= \
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   916
                                                self.max_search_completion:
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   917
                                        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
   918
                                        if itr:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   919
                                                self.search_completion.remove(itr)
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   920
                                self.search_completion.append([text])
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   921
                return
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
   922
                
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
   923
        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
   924
                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
   925
                    "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
   926
                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
   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_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
   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_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
   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_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
   933
                    "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
   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::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
   936
                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
   937
                    "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
   938
                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
   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_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
   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_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
   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_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
   945
                    "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
   946
                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
   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_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
   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_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
   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
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
        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
   954
                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
   955
                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
   956
                        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
   957
                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
   958
                        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
   959
                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
   960
                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
   961
                        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
   962
                        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
   963
                        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
   964
                                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
   965
                        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
   966
                        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
   967
                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
   968
                        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
   969
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
        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
   971
                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
   972
                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
   973
                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
   974
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
   975
        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
   976
                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
   977
                        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
   978
                        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
   979
                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
   980
                        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
   981
                        self.w_deselect_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
   982
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   983
        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
   984
                if self.is_all_publishers:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
   985
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
   986
                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
   987
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
   988
        def __setup_startpage(self, show_startpage):
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   989
                self.opener = urllib.FancyURLopener()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   990
                self.document = gtkhtml2.Document()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   991
                self.document.connect('request_url', self.__request_url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   992
                self.document.connect('link_clicked', self.__handle_link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   993
                self.document.clear()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   994
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   995
                self.view = gtkhtml2.View()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   996
                self.view.set_document(self.document)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   997
                self.view.connect('request_object', self.__request_object)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   998
                self.view.connect('on_url', self.__on_url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
   999
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1000
                try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1001
                        self.lang, encode = locale.getlocale(locale.LC_CTYPE)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1002
                        if debug:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1003
                                print "Lang: %s: Encode: %s" % (self.lang, encode)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1004
                except locale.Error:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1005
                        self.lang = "C"
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1006
                if self.lang == None or self.lang == "":
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1007
                        self.lang = "C"
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1008
                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
  1009
                # 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
  1010
                self.__load_startpage()
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1011
                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
  1012
                        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
  1013
                                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
  1014
                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
  1015
                        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
  1016
                                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
  1017
                        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
  1018
                                NOTEBOOK_PACKAGE_LIST_PAGE)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1019
                self.w_startpage_frame.add(self.view)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1020
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1021
        # Stub handler required by GtkHtml widget
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1022
        def __request_object(self, *vargs):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1023
                pass
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1024
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1025
        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
  1026
                self.link_load_page = ""
1095
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1027
                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
  1028
                        return
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_LANG_BASE):
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1030
                        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
  1031
                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
  1032
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1033
        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
  1034
                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
  1035
                        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
  1036
                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
  1037
                        return True
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1038
                        
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1039
                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
  1040
                        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
  1041
                                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
  1042
                        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
  1043
                                return True
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1044
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1135
diff changeset
  1045
                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
  1046
                        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
  1047
                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
  1048
                        return True
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1049
                return False
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1050
67b0d3b9c7e1 8526 PM locale start_page detection needs enhanced
John Rice <john.rice@sun.com>
parents: 1093
diff changeset
  1051
        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
  1052
                self.document.open_stream('text/html')
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
  1053
                self.document.write_stream(_(
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
  1054
                    "<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
  1055
                    "PackageManager!</H2><br>"
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
  1056
                    "<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
  1057
                    "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
  1058
                    % (start_page_url))
955
65a22a086fc9 6970 Start page needs to be updateable
John Rice <john.rice@sun.com>
parents: 947
diff changeset
  1059
                self.document.close_stream()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  1060
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1061
        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
  1062
                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
  1063
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1064
                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
  1065
                        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
  1066
                            (pub, _("failed to respond"), err))
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1067
                for pub in error.invalid_servers:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1068
                        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
  1069
                            (pub, _("invalid response"),
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1070
                                _("A valid response was not returned.")))
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1071
                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
  1072
                        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
  1073
                            (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
  1074
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  1075
        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
  1076
                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
  1077
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1078
        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
  1079
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1080
                        return
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1081
                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
  1082
                        self.w_infosearch_frame.hide()
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  1083
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1084
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1085
                repo_count = 0
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1086
                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
  1087
                        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
  1088
                                repo_count += 1
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1089
                if repo_count == 0:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1090
                        self.w_infosearch_frame.hide()
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1091
                        return
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1092
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1093
                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
  1094
                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
  1095
                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
  1096
                infobuffer.set_text("")
968
77305ca94261 7563 Remote search error rework (follow on)
John Rice <john.rice@sun.com>
parents: 963
diff changeset
  1097
                textiter = infobuffer.get_end_iter()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1098
                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
  1099
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1100
                        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
  1101
                                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
  1102
                                    "%(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
  1103
                                    "err_type": err_type}, "bold")
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1104
                                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
  1105
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1106
                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
  1107
                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
  1108
                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
  1109
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1110
        def __on_url(self, view, link):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1111
                # 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
  1112
                if link == None or link == "":
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1113
                        self.update_statusbar()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1114
                else:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1115
                        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
  1116
                        if display_link != None:
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1117
                                self.__update_statusbar_message(display_link)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1118
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1119
                                self.update_statusbar()
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1120
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1121
        @staticmethod
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1122
        def __is_relative_to_server(url):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1123
                parts = urlparse.urlparse(url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1124
                if parts[0] or parts[1]:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1125
                        return 0
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1126
                return 1
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1127
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1128
        def __open_url(self, url):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1129
                uri = self.__resolve_uri(url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1130
                return self.opener.open(uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1131
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1132
        def __resolve_uri(self, uri):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1133
                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
  1134
                        return urlparse.urljoin(self.current_url, uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1135
                return uri
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1136
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1137
        def __request_url(self, document, url, stream):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1138
                f = self.__open_url(url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1139
                stream.set_cancel_func(self.__stream_cancel)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1140
                stream.write(f.read())
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1141
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1142
        # 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
  1143
        def __stream_cancel(self, *vargs):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1144
                pass
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1145
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1146
        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
  1147
                self.__update_statusbar_message(_("Loading... %s") % link)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1148
                try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1149
                        f = self.__open_url(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1150
                except  (IOError, OSError), err:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1151
                        if debug:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1152
                                print "err: %s" % (err)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1153
                        self.__update_statusbar_message(_("Stopped"))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1154
                        return False
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1155
                self.current_url = self.__resolve_uri(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1156
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1157
                self.document.clear()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1158
                headers = f.info()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1159
                mime = headers.getheader('Content-type').split(';')[0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1160
                if mime:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1161
                        self.document.open_stream(mime)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1162
                else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1163
                        self.document.open_stream('text/plain')
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1164
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1165
                self.document.write_stream(f.read())
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1166
                self.document.close_stream()
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1167
                self.__update_statusbar_message(_("Done"))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1168
                return True
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1169
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1170
        def __link_load_error(self, link):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1171
                self.document.clear()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1172
                self.document.open_stream('text/html')
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1173
                self.document.write_stream(_(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1174
                    "<html><head></head><body><font color='#000000'>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1175
                    <a href='stub'></a></font>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1176
                    <a href='pm?%s=internal&uri=%s'>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1177
                    <IMG SRC = 'startpage_star.png' \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1178
                    style='border-style: none'></a> <br><br>\
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1179
                    <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
  1180
                    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
  1181
                    % (PM_ACTION, START_PAGE_HOME, link))
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1182
                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
  1183
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1184
        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
  1185
                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
  1186
                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
  1187
                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
  1188
                        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
  1189
                                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
  1190
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1191
                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
  1192
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1193
        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
  1194
                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
  1195
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1196
                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
  1197
                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
  1198
                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
  1199
                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
  1200
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1201
        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
  1202
                self.__set_search_start()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1203
                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
  1204
                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
  1205
                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
  1206
                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
  1207
                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
  1208
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1209
        def __handle_view_all_publishers_installed(self):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1210
                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
  1211
                self.__set_main_view_package_list()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1212
                self.update_statusbar()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1213
                
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1214
        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
  1215
                query_dict = self.__urlparse_qs(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1216
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1217
                action = None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1218
                if query_dict.has_key(PM_ACTION):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1219
                        action = query_dict[PM_ACTION][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1220
                elif handle_what == DISPLAY_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1221
                        return link
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1222
                ext_uri = ""
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1223
                protocol = None
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1224
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1225
                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
  1226
                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
  1227
                        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
  1228
                                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
  1229
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1230
                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
  1231
                        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
  1232
                        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
  1233
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1234
                        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
  1235
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1236
                # 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
  1237
                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
  1238
                        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
  1239
                        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
  1240
                                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
  1241
                                        {"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
  1242
                        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
  1243
                        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
  1244
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1245
                # 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
  1246
                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
  1247
                        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
  1248
                                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
  1249
                                        {"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
  1250
                        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
  1251
                        return
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1252
                # Change view to All Publishers (Installed)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1253
                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
  1254
                        if handle_what == DISPLAY_LINK:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1255
                                return _("View installed packages for %(s1)sAll "
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1256
                                    "Publishers%(e1)s") % {"s1": s1, "e1": e1}
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1257
                        self.__handle_view_all_publishers_installed()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1258
                        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
  1259
                # 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
  1260
                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
  1261
                        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
  1262
                                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
  1263
                                        {"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
  1264
                        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
  1265
                        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
  1266
                        return                        
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1267
                # 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
  1268
                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
  1269
                        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
  1270
                                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
  1271
                                        {"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
  1272
                        self.__update_statusbar_message(
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  1273
                            _("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
  1274
                            {"s1": s1, "e1": e1})
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  1275
                        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
  1276
                        return
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1277
                # View Recent Search Results
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1278
                if search_action and \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1279
                        search_action.find(INTERNAL_SEARCH_VIEW_RESULTS) > -1:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1280
                        recent_search = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1281
                                re.findall(r'<span>(.*)<\/span>', search_action)[0]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1282
                        if handle_what == DISPLAY_LINK:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1283
                                return _("View results for %s") % recent_search
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1284
                        category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1285
                        if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1286
                                return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1287
                        rs_iter = category_tree.iter_children(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1288
                            self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1289
                        while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1290
                                rs_value = category_tree.get_value(rs_iter,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1291
                                    enumerations.CATEGORY_NAME)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1292
                                if rs_value == recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1293
                                        path = category_tree.get_path(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1294
                                        self.w_categories_treeview.set_cursor(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1295
                                        self.w_categories_treeview.scroll_to_cell(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1296
                                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1297
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  1298
                        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
  1299
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1300
                # Internal Browse
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1301
                if action == ACTION_INTERNAL:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1302
                        if query_dict.has_key(INTERNAL_URI):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1303
                                int_uri = query_dict[INTERNAL_URI][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1304
                                if handle_what == DISPLAY_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1305
                                        return int_uri
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1306
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1307
                                if handle_what == CLICK_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1308
                                        self.__link_load_error(_("No URI specified"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1309
                                return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1310
                        if handle_what == CLICK_LINK and \
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1311
                            not self.__load_uri(document, int_uri):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1312
                                self.__link_load_error(int_uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1313
                        return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1314
                # External browse
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1315
                elif action == ACTION_EXTERNAL:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1316
                        if query_dict.has_key(EXTERNAL_URI):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1317
                                ext_uri = query_dict[EXTERNAL_URI][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1318
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1319
                                if handle_what == CLICK_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1320
                                        self.__link_load_error(_("No URI specified"))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1321
                                return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1322
                        if query_dict.has_key(EXTERNAL_PROTOCOL):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1323
                                protocol = query_dict[EXTERNAL_PROTOCOL][0]
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1324
                        else:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1325
                                protocol = DEFAULT_PROTOCOL
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1326
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1327
                        if handle_what == DISPLAY_LINK:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1328
                                return protocol + "://" + ext_uri
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1329
                        try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1330
                                gnome.url_show(protocol + "://" + ext_uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1331
                        except gobject.GError:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1332
                                self.__link_load_error(protocol + "://" + ext_uri)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1333
                elif handle_what == DISPLAY_LINK:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1334
                        return None
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1335
                elif action == None:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1336
                        try:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1337
                                gnome.url_show(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1338
                        except gobject.GError:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1339
                                self.__link_load_error(link)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1340
                # Handle empty and unsupported actions
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1341
                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
  1342
                        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
  1343
                        return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1344
                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
  1345
                        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
  1346
                        return
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1347
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1348
        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
  1349
                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
  1350
                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
  1351
                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
  1352
                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
  1353
                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
  1354
                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
  1355
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1356
        @staticmethod
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1357
        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
  1358
                scheme, netloc, url, params, querystring, fragment = urlparse.urlparse(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1359
                    url)
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1360
                if debug:
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1361
                        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
  1362
                            "querystring %s, fragment %s"
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1363
                            % (scheme, netloc, url, params, querystring, fragment))
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  1364
                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
  1365
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1366
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1367
        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
  1368
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1369
                        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
  1370
                        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
  1371
                        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
  1372
                        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
  1373
                        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
  1374
                        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
  1375
                        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
  1376
                        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
  1377
                        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
  1378
                        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
  1379
                        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
  1380
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1381
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1382
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1383
        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
  1384
                return gtk.TreeStore(
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1385
                        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
  1386
                        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
  1387
                        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
  1388
                        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
  1389
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1390
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1391
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1392
        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
  1393
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1394
                        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
  1395
                        gobject.TYPE_STRING,      # enumerations.SECTION_NAME
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1396
                        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
  1397
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1398
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1399
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1400
        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
  1401
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1402
                        gobject.TYPE_INT,         # enumerations.FILTER_ID
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1403
                        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
  1404
                        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
  1405
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1406
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1407
        @staticmethod
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1408
        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
  1409
                return gtk.ListStore(
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1410
                        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
  1411
                        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
  1412
                        )
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1413
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1414
        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
  1415
            application_list_filter, application_list_sort,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1416
            application_sort_column):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1417
                ##APPLICATION MAIN TREEVIEW
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1418
                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
  1419
                        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
  1420
                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
  1421
                        application_list_sort = \
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1422
                            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
  1423
                        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
  1424
                            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
  1425
                        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
  1426
                            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
  1427
                            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
  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
                        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
  1430
                            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
  1431
                            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
  1432
                            enumerations.DESCRIPTION_COLUMN)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1433
                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
  1434
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1435
                column = gtk.TreeViewColumn("", toggle_renderer,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1436
                    active = enumerations.MARK_COLUMN)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1437
                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
  1438
                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
  1439
                column.connect('clicked', self.__select_column_clicked)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1440
                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
  1441
                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
  1442
                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
  1443
                    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
  1444
                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
  1445
                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
  1446
                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
  1447
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1448
                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
  1449
                column = gtk.TreeViewColumn(_("Name"), name_renderer,
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1450
                    text = enumerations.NAME_COLUMN)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1451
                column.set_resizable(True)
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1452
                column.set_min_width(150)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1453
                column.set_sort_column_id(enumerations.NAME_COLUMN)
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1454
                column.set_sort_indicator(True)
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1455
                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
  1456
                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
  1457
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1458
                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
  1459
                column = self.__create_icon_column(_("Status"), True,
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1460
                    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
  1461
                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
  1462
                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
  1463
                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
  1464
                    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
  1465
                self.w_application_treeview.append_column(column)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1466
                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
  1467
                        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
  1468
                        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
  1469
                        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
  1470
                            repository_renderer,
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1471
                            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
  1472
                        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
  1473
                        column.set_resizable(True)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1474
                        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
  1475
                        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
  1476
                            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
  1477
                        column.connect_after('clicked',
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1478
                            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
  1479
                        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
  1480
                        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
  1481
                            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
  1482
                            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
  1483
                            enumerations.PUBLISHER_COLUMN)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1484
                description_renderer = gtk.CellRendererText()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1485
                column = gtk.TreeViewColumn(_('Description'),
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1486
                    description_renderer,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1487
                    text = enumerations.DESCRIPTION_COLUMN)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1488
                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
  1489
                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
  1490
                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
  1491
                column.set_cell_data_func(description_renderer,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1492
                    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
  1493
                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
  1494
                    self.__application_treeview_column_sorted, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1495
                self.w_application_treeview.append_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1496
                #Added selection listener
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1497
                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
  1498
                self.application_list = application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1499
                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
  1500
                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
  1501
                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
  1502
                    application_list_sort)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1503
1093
264017d0a284 8504 Delay when switching from All Repositories search
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1092
diff changeset
  1504
        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
  1505
            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
  1506
            application_list_sort = None, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1507
            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
  1508
                '''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
  1509
                filters'''
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1510
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1511
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1512
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1513
                        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
  1514
                        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
  1515
                elif application_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1516
                        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
  1517
                        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
  1518
                else:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1519
                        self.__disconnect_models()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1520
                        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
  1521
                        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
  1522
                # 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
  1523
                # 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
  1524
                # section to "All Categories" one.
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1525
                if section_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1526
                        row = section_list[self.set_section]
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1527
                        if row[enumerations.SECTION_ENABLED] and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1528
                            self.set_section >= 0 and \
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1529
                            self.set_section < len(section_list):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1530
                                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
  1531
                                        self.set_section = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1532
                        else:
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
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1535
                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
  1536
                        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
  1537
                            application_list_filter, application_list_sort, 
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1538
                            application_sort_column)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1539
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1540
                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
  1541
                        # 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
  1542
                        # 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
  1543
                        # and scrolling up and down using keyboard.
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1544
                        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
  1545
                        vadj.connect('value-changed',
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1546
                            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
  1547
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1548
                        # 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
  1549
                        # 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
  1550
                        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
  1551
                            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
  1552
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  1553
                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
  1554
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1555
                        ##CATEGORIES TREEVIEW
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1556
                        enumerations.CATEGORY_NAME_renderer = gtk.CellRendererText()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1557
                        column = gtk.TreeViewColumn(_('Name'),
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1558
                            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
  1559
                            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
  1560
                        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
  1561
                        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
  1562
                        #Added selection listener
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1563
                        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
  1564
                        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
  1565
                            enumerations.CATEGORY_NAME)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1566
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1567
                if section_list != None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1568
                        self.section_list = section_list
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1569
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1570
                        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
  1571
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1572
                if application_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  1573
                        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
  1574
                            self.application_list_sort)
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1575
                        if application_list_filter == None:
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  1576
                                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
  1577
                                    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
  1578
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1579
                if self.first_run:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1580
                        category_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1581
                            self.__on_category_selection_changed, None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1582
                        self.w_categories_treeview.connect("row-activated",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1583
                            self.__on_category_row_activated, None)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1584
                        self.w_categories_treeview.connect("focus-in-event",
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1585
                            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
  1586
                        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
  1587
                            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
  1588
                        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
  1589
                            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
  1590
                        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
  1591
                            self.__on_categoriestreeview_row_expanded, None)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1592
                        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
  1593
                        self.package_selection.connect("changed",
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1594
                            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
  1595
                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
  1596
                        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
  1597
                self.a11y_application_treeview = \
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1598
                    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
  1599
                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
  1600
                if obj != None:
4501e2b0febd 11382 traceback on console when starting packagemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1357
diff changeset
  1601
                        obj.set_name(_("all selection toggle"))
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1602
                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
  1603
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1604
        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
  1605
                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
  1606
                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
  1607
                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
  1608
                    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
  1609
                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
  1610
                    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
  1611
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1612
                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
  1613
                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
  1614
                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
  1615
                    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
  1616
                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
  1617
                    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
  1618
                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
  1619
                    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
  1620
                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
  1621
                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
  1622
1347
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  1623
        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
  1624
                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
  1625
                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
  1626
                    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
  1627
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  1628
        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
  1629
                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
  1630
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1631
        def __init_repository_tree_view(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1632
                cell = gtk.CellRendererText()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1633
                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
  1634
                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
  1635
                    enumerations.REPOSITORY_NAME)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1636
                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
  1637
                    self.combobox_id_separator)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1638
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1639
        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
  1640
                # 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
  1641
                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
  1642
                        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
  1643
                            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
  1644
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1645
        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
  1646
                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
  1647
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1648
        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
  1649
                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
  1650
                if status == enumerations.INSTALLED:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1651
                        desc = _("Installed")
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1652
                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
  1653
                        desc = _("Not 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.UPDATABLE:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1655
                        desc = _("Updates Available")
864
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1656
                else:
590c24c40a56 6202 All category does not report updates available.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 863
diff changeset
  1657
                        desc = None
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1658
                if desc != None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1659
                        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
  1660
                            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
  1661
                            STATUS_COLUMN_INDEX)
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1662
                        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
  1663
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1664
        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
  1665
                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
  1666
                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
  1667
                    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
  1668
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1669
                if self.__doing_search():
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1670
                        return
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1671
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1672
                a11y_enabled = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1673
                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
  1674
                        a11y_enabled = True
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1675
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
  1676
                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
  1677
                        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
  1678
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1679
                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
  1680
                if visible_range == None:
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1681
                        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
  1682
                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
  1683
                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
  1684
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1685
                # 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
  1686
                # 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
  1687
                # 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
  1688
                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
  1689
                        check_range = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  1690
                        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
  1691
                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
  1692
                        check_range = False
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1693
                
833
9aef5ca23264 5914 Images in "Status" column need accessible descriptions
Padraig O'Briain <padraig.obriain@sun.com>
parents: 830
diff changeset
  1694
                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
  1695
                        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
  1696
                                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
  1697
                                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
  1698
                                 # 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
  1699
                                 # 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
  1700
                                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
  1701
                                    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
  1702
                                        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
  1703
                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1704
                                        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
  1705
                                                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
  1706
                                                        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
  1707
                                                                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
  1708
                                                else:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1709
                                                        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
  1710
                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
  1711
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1712
                sort_filt_model = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1713
                    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
  1714
1430
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1715
                if a11y_enabled:
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1716
                        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
  1717
                            str(a11y_start))                
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1718
                        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
  1719
                                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
  1720
                                a11y_start += 1
b7ce3a0a17eb 11915 Retrieving descriptions can be very slow in PackageManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1427
diff changeset
  1721
                                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
  1722
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1723
        def __doing_search(self):
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1724
                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
  1725
                
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1726
        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
  1727
                column = gtk.TreeViewColumn()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1728
                column.set_title(name)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1729
                #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
  1730
                #column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1731
                render_pixbuf = gtk.CellRendererPixbuf()
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1732
                column.pack_start(render_pixbuf, expand = expand_pixbuf)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1733
                column.add_attribute(render_pixbuf, "pixbuf", enum_value)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1734
                column.set_fixed_width(32)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1735
                if set_data_func:
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1736
                        column.set_cell_data_func(render_pixbuf,
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1737
                            self.cell_data_function, None)
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  1738
                return column
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  1739
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1740
        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
  1741
                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
  1742
                        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
  1743
                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
  1744
                        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
  1745
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1746
        def __disconnect_repository_model(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1747
                self.w_repository_combobox.set_model(None)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  1748
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1749
        @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
  1750
        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
  1751
                get_val = treemodel.get_value
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1752
                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
  1753
                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
  1754
                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
  1755
                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
  1756
                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
  1757
                        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
  1758
                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
  1759
                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
  1760
                return cmp(name1, name2)
602
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1761
cd5a41269b1e 3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 594
diff changeset
  1762
        @staticmethod
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1763
        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
  1764
                columns = treeview.get_columns()
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1765
                if columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1766
                        for column in columns:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  1767
                                treeview.remove_column(column)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1768
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1769
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  1770
        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
  1771
                '''This function is for initializing the sections list'''
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1772
                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
  1773
                # 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
  1774
                # 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
  1775
                # 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
  1776
                section_list.append([0, _('All Categories'), enabled ])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1777
                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
  1778
                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
  1779
                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
  1780
                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
  1781
                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
  1782
                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
  1783
                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
  1784
                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
  1785
                section_list.append([8, _('Web Services'), enabled ])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  1786
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1787
        def __init_show_filter(self):
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1788
                max_length = 0
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1789
                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
  1790
                        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
  1791
                        if filter_id == -1:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1792
                                continue
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1793
                        max_length = self.__get_max_text_length(
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1794
                            max_length, label, self.w_filter_combobox)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1795
                
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  1796
                if self.initial_show_filter >= enumerations.FILTER_ALL and \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1797
                    self.initial_show_filter < len(self.filter_list):
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1798
                        row = self.filter_list[self.initial_show_filter]
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  1799
                        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
  1800
                                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
  1801
                else:
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
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1803
                return max_length
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1804
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1805
        @staticmethod
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1806
        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
  1807
                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
  1808
                        return 0
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1809
                context = widget.get_pango_context()
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1810
                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
  1811
                current_length = pango.PIXELS(
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1812
                    metrics.get_approximate_char_width() * len(text))
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1813
                if current_length > length_to_check:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1814
                        return current_length
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1815
                else:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  1816
                        return length_to_check
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1817
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
  1818
        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
  1819
                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
  1820
                        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
  1821
                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
  1822
                        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
  1823
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1824
        def __on_mainwindow_delete_event(self, widget, event):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1825
                ''' handler for delete event of the main window '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1826
                if self.__check_if_something_was_changed() == True:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1827
                        # XXX Change this to not quit and show dialog
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1828
                        # XXX if some changes were applied:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1829
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1830
                        return True
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1831
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1832
                        self.__main_application_quit()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1833
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
  1834
        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
  1835
                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
  1836
                        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
  1837
                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
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
                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
  1840
                        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
  1841
                                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
  1842
                        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
  1843
                                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
  1844
                
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1845
        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
  1846
                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
  1847
                        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
  1848
                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
  1849
                        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
  1850
                        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
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 = \
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
                            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
  1854
                                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
  1855
                                
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
                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
  1857
                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
  1858
                    widget.get_size()[1]-status_height)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  1859
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1860
        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
  1861
                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
  1862
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  1863
        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
  1864
                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
  1865
                return True
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  1866
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1867
        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
  1868
                self.api_search_error_dialog.hide()
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  1869
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1870
        def __on_file_quit_activate(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1871
                ''' handler for quit menu event '''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1872
                self.__on_mainwindow_delete_event(None, None)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1873
1395
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1874
        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
  1875
                ''' 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
  1876
                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
  1877
                    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
  1878
                    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
  1879
2465b8d261e0 11670 Dialogs rework: [Manage Publishers / Add Publisher / Modify Publisher/ Modify Repository]
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1392
diff changeset
  1880
        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
  1881
                ''' 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
  1882
                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
  1883
                    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
  1884
                    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
  1885
543
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1886
        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
  1887
                ''' 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
  1888
                beadm.Beadmin(self)
9889330c2ab5 3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 539
diff changeset
  1889
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  1890
        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
  1891
                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
  1892
                        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
  1893
                        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
  1894
                                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
  1895
                                    gtk.STOCK_CANCEL)
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(
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1897
                                   "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
  1898
                        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
  1899
                else:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1900
                        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
  1901
                                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
  1902
                                    None)
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  1903
                        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
  1904
                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
  1905
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1906
        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
  1907
                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
  1908
                        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
  1909
                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
  1910
                        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
  1911
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1912
        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
  1913
                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
  1914
                        try:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1915
                                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
  1916
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1917
                        except AttributeError:
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1918
                                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
  1919
                                    self.statusbar_message_id)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1920
                        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
  1921
        
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1922
        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
  1923
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  1924
                        return
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  1925
                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
  1926
                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
  1927
                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
  1928
                        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
  1929
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  1930
        def __setup_before_all_publishers_mode(self):
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1931
                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
  1932
                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
  1933
                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
  1934
                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
  1935
                
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1936
                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
  1937
                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
  1938
                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
  1939
                # 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
  1940
                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
  1941
                    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
  1942
                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
  1943
                        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
  1944
                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
  1945
                        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
  1946
                            NOTEBOOK_START_PAGE)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  1947
                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
  1948
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1949
        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
  1950
                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
  1951
                        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
  1952
                        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
  1953
  
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1954
        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
  1955
                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
  1956
                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
  1957
                    "<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
  1958
                    "<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
  1959
                    "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
  1960
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1961
                body = "<TR><TD></TD><TD>"
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1962
                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
  1963
                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
  1964
                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
  1965
                        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
  1966
                        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
  1967
                                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
  1968
                                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
  1969
                                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
  1970
                                        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
  1971
                                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
  1972
                                        (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
  1973
                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
  1974
                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
  1975
                    "<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
  1976
                    "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
  1977
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  1978
                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
  1979
                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
  1980
                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
  1981
                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
  1982
                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
  1983
                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
  1984
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1985
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1986
        def __setup_search_installed_page(self, text):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1987
                header = INFORMATION_PAGE_HEADER
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1988
                header += _("alt='[Information]' title='Information' ALIGN='bottom'></TD>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1989
                    "<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
  1990
                    "</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
  1991
                    "All Publishers (Installed).</TD></TR>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1992
                    )
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1993
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1994
                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
  1995
                    "<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
  1996
                    "<TR><TD></TD><TD<TD>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1997
                    )
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1998
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  1999
                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
  2000
                    "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
  2001
                    "%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
  2002
                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
  2003
                    "</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
  2004
                    "%(all_pubs)s'>(Search)</a></li>")  % \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2005
                    {"text": text, "all_pubs": INTERNAL_SEARCH_ALL_PUBS}
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2006
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2007
                body += _("<li style='padding-left:7px'>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2008
                    "See <a href='pm?pm-action=internal&search="
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2009
                    "%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
  2010
                footer = "</table>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2011
                self.__link_load_page(header + body + footer)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2012
                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
  2013
                self.__set_focus_on_searchentry()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2014
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2015
        def __setup_recent_search_page(self):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2016
                header = INFORMATION_PAGE_HEADER
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2017
                header += _("alt='[Information]' title='Information' ALIGN='bottom'></TD>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2018
                    "<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
  2019
                    "<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
  2020
                    "in this session.</TD></TR>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2021
                    )
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2022
                body = "<TR><TD></TD><TD>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2023
                search_list = ""
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2024
                for search in self.recent_searches_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2025
                        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
  2026
                                search
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2027
                        search_list += "'pm?pm-action=internal&search=%s" % \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2028
                                INTERNAL_SEARCH_VIEW_RESULTS
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2029
                        search_list += " <span>%s</span>'>" % search
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2030
                        search_list += _("results")
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2031
                        search_list += "</a></li>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2032
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2033
                if len(self.recent_searches_list) > 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2034
                        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
  2035
                        body += ngettext(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2036
                            "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
  2037
                            "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
  2038
                            "to view the stored results:",
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2039
                            len(self.recent_searches_list)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2040
                            )
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2041
                        body += "</TD></TR><TR><TD></TD><TD>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2042
                        body += search_list
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2043
                body += "<TD></TD></TR>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2044
                footer = "</table>"
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2045
                self.__link_load_page(header + body + footer)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2046
                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
  2047
                    
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2048
        def __setup_zero_filtered_results_page(self):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2049
                header = INFORMATION_PAGE_HEADER
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2050
                active_filter = self.w_filter_combobox.get_active()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2051
                header += _("alt='[Information]' title='Information' ALIGN='bottom'></TD>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2052
                    "<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
  2053
                header += ngettext(
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2054
                    "There is one package in this category, "
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2055
                    "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
  2056
                    "<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
  2057
                    "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
  2058
                    "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
  2059
                    "<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
  2060
                    self.length_visible_list) % \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2061
                        self.__get_filter_combobox_description(active_filter)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2062
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2063
                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
  2064
                    "<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
  2065
                    "<TR><TD></TD><TD<TD>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2066
                    )
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2067
                body += _("<li style='padding-left:7px'>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2068
                    "<a href='pm?pm-action=internal&"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2069
                    "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
  2070
                    INTERNAL_SEARCH_VIEW_ALL
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2071
                footer = "</TD></TR></table>"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2072
                self.__link_load_page(header + body + footer)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2073
                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
  2074
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2075
        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
  2076
                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
  2077
                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
  2078
                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
  2079
                    "<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
  2080
                header += ngettext(
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2081
                    "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
  2082
                    "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
  2083
                    "<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
  2084
                    "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
  2085
                    "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
  2086
                    "<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
  2087
                    "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
  2088
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2089
                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
  2090
                    "<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
  2091
                    "<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
  2092
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2093
                body += _("<li style='padding-left:7px'>"
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2094
                    "<a href='pm?pm-action=internal&"
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2095
                    "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
  2096
                    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
  2097
                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
  2098
                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
  2099
                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
  2100
                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
  2101
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2102
        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
  2103
                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
  2104
                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
  2105
                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
  2106
                        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
  2107
                                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
  2108
                                break
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2109
                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
  2110
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2111
        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
  2112
                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
  2113
                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
  2114
                    "<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
  2115
                    "<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
  2116
                    "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
  2117
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2118
                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
  2119
                    "<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
  2120
                    "<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
  2121
                    "<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
  2122
                    "<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
  2123
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2124
                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
  2125
                        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
  2126
                            "</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
  2127
                            "%(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
  2128
                            {"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
  2129
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2130
                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
  2131
                    "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
  2132
                    "%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
  2133
                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
  2134
                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
  2135
                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
  2136
                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
  2137
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2138
        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
  2139
                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
  2140
                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
  2141
                        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
  2142
                        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
  2143
                        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
  2144
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2145
        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
  2146
                header = _(
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2147
                    "<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
  2148
                    "<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
  2149
                    "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
  2150
                    "<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
  2151
                    "<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
  2152
                    "<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
  2153
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2154
                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
  2155
                    "<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
  2156
                    "<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
  2157
                    "<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
  2158
                    )
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2159
                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
  2160
                    "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
  2161
                    "%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
  2162
                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
  2163
                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
  2164
                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
  2165
                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
  2166
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2167
        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
  2168
                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
  2169
                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
  2170
                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
  2171
                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
  2172
                self.__init_tree_views(application_list, None, None)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2173
                if unselect_cat:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2174
                        self.__unselect_category()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2175
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2176
        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
  2177
                self.in_search_mode = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2178
                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
  2179
                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
  2180
                self.w_infosearch_frame.hide()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2181
                if self.last_visible_publisher == \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2182
                        self.publisher_options[PUBLISHER_INSTALLED]:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2183
                        self.is_all_publishers_installed = True
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2184
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2185
                        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
  2186
                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
  2187
                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
  2188
                    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
  2189
                        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
  2190
                            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
  2191
                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
  2192
                # Reset MARK_COLUMN        
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2193
                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
  2194
                        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
  2195
                        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
  2196
                        marked = False
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2197
                        pkgs = None
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2198
                        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
  2199
                                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
  2200
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2201
                                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
  2202
                                        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
  2203
                        # 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
  2204
                        # 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
  2205
                        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
  2206
                                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
  2207
                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
  2208
                        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
  2209
                            None, None,
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2210
                            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
  2211
                            self.saved_application_list_sort)
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  2212
                        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
  2213
                else:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2214
                        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
  2215
                            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
  2216
                            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
  2217
                            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
  2218
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2219
                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
  2220
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2221
        def __save_application_list(self, app_list):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2222
                self.saved_application_list = app_list
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2223
                                
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2224
        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
  2225
                #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
  2226
                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
  2227
                        return
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2228
                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
  2229
                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
  2230
                        self.application_list_sort
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_filter = \
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2232
                        self.application_list_filter
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2233
                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
  2234
                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
  2235
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2236
                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
  2237
                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
  2238
                        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
  2239
                        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
  2240
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2241
        def __do_search(self, widget=None, ev=None):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2242
                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
  2243
                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
  2244
                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
  2245
                        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
  2246
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2247
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2248
                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
  2249
                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
  2250
                        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
  2251
                        return
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2252
                if self.is_all_publishers_installed:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2253
                        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
  2254
                        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
  2255
                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
  2256
                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
  2257
                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
  2258
                        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
  2259
                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
  2260
                        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
  2261
                        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
  2262
                        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
  2263
                                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
  2264
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2265
                                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
  2266
                                        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
  2267
                                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
  2268
                                        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
  2269
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2270
                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
  2271
                        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
  2272
                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
  2273
                self.__set_focus_on_searchentry()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2274
                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
  2275
                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
  2276
                        
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2277
                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
  2278
                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
  2279
                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
  2280
                    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
  2281
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2282
        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
  2283
                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
  2284
                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
  2285
                        return None, (0,)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2286
                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
  2287
                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
  2288
                        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
  2289
                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
  2290
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
        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
  2292
                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
  2293
                if selection:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2294
                        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
  2295
                        selection.unselect_all()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2296
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
  2297
        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
  2298
                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
  2299
                        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
  2300
                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
  2301
                        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
  2302
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2303
        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
  2304
                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
  2305
                self.search_time_sec = 0
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2306
                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
  2307
                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
  2308
                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
  2309
                self.in_setup = False
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2310
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
  2311
        @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
  2312
        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
  2313
                if repo == None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2314
                        return None
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2315
                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
  2316
                ret_uri = None
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2317
                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
  2318
                        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
  2319
                                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
  2320
                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
  2321
                        uri = origin_uri.uri
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2322
                        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
  2323
                                ret_uri = uri.strip("/")
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2324
                return ret_uri
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2325
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2326
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2327
        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
  2328
                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
  2329
                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
  2330
                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
  2331
                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
  2332
                # 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
  2333
                searches = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2334
                servers = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2335
                result = []
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2336
                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
  2337
                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
  2338
                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
  2339
                if search_all:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2340
                        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
  2341
                        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
  2342
                else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2343
                        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
  2344
                        if pub_prefix != None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2345
                                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
  2346
                        else:
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_preferred_publisher()
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2348
                        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
  2349
                        servers.append({"origin": origin_uri})
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2350
                if debug:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2351
                        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
  2352
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2353
                #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
  2354
                case_sensitive = False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2355
                return_actions = True
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2356
                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
  2357
                    [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
  2358
                    servers=servers))
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2359
                if debug:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2360
                        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
  2361
                                ("".join(pargs), case_sensitive, return_actions)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2362
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2363
                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
  2364
                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
  2365
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2366
                # 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
  2367
                sort_col = enumerations.NAME_COLUMN
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2368
                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
  2369
                        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
  2370
                            itertools.chain(*searches):
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2371
                                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
  2372
                                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2373
                                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2374
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
  2375
                                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
  2376
                                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
  2377
                                    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
  2378
                                        active_pub = pub["prefix"]
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2379
                                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
  2380
                                if last_name != name:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2381
                                        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
  2382
                                                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
  2383
                                                    % (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
  2384
                                        a_res = name, active_pub
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2385
                                        result.append(a_res)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2386
                                        #Ignore Status when fetching
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2387
                                        application_list = \
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2388
                                                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
  2389
                                        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
  2390
                                        self.in_setup = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2391
                                        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
  2392
                                            application_list, None, None, None, None,
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2393
                                            sort_col)
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2394
                                last_name = name
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2395
                                self.pylintstub = query_num
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2396
                except api_errors.ProblematicSearchServers, ex:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2397
                        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
  2398
                        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
  2399
                        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
  2400
                                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
  2401
                                        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
  2402
                                                _("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
  2403
                                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2404
                                        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
  2405
                                                pub_prefix, text)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2406
                                return
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2407
                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
  2408
                        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
  2409
                        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
  2410
                        gobject.idle_add(self.__process_after_cancel)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2411
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2412
                except Exception, ex:
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2413
                        # 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
  2414
                        self.__process_after_search_failure()
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2415
                        return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2416
                if debug:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2417
                        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
  2418
                if len(result) == 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2419
                        if debug:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2420
                                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
  2421
                        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
  2422
                                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
  2423
                                        _("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
  2424
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2425
                                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
  2426
                                        pub_prefix, text)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2427
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2428
                #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
  2429
                if self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  2430
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2431
                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
  2432
                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
  2433
                        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
  2434
                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
  2435
                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
  2436
                    application_list)
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2437
                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
  2438
                        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
  2439
                        if debug:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2440
                                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
  2441
                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
  2442
                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
  2443
                    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
  2444
                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
  2445
                        return
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2446
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2447
                if search_all:
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2448
                        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
  2449
                            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
  2450
                else:
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2451
                        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
  2452
                            len(application_list))
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2453
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2454
        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
  2455
                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
  2456
                        return
1459
54133287c1c5 12203 PM Search error and help page UI feedback
John Rice <john.rice@sun.com>
parents: 1458
diff changeset
  2457
                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
  2458
                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
  2459
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2460
        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
  2461
                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
  2462
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2463
        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
  2464
                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
  2465
                
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2466
        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
  2467
                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
  2468
                        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
  2469
                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
  2470
                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
  2471
                self.in_setup = True
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2472
                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
  2473
                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
  2474
                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
  2475
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2476
        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
  2477
                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
  2478
                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
  2479
                        application_list.append(
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2480
                            [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
  2481
                            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
  2482
                            pub])
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2483
                return application_list
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2484
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2485
        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
  2486
                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
  2487
                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
  2488
                    application_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2489
                return application_list
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2490
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2491
        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
  2492
            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
  2493
                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
  2494
                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
  2495
                    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
  2496
                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
  2497
                    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
  2498
28cb54b3370e 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
        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
  2500
                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
  2501
                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
  2502
                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
  2503
                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
  2504
                        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
  2505
                        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
  2506
                                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
  2507
                                        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
  2508
                                            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
  2509
                                                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
  2510
                                                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
  2511
                                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
  2512
                                        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
  2513
                        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
  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
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2516
                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
  2517
                        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
  2518
                                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
  2519
                                          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
  2520
                                          [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
  2521
                                          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
  2522
                                          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
  2523
                                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
  2524
                        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
  2525
                                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
  2526
                                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
  2527
                        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
  2528
                                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
  2529
                                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
  2530
                        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
  2531
                                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
  2532
                                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
  2533
                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
  2534
                        return results
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2535
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2536
        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
  2537
                ''' 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
  2538
                performance when assistive technologies are enabled'''
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2539
                if self.in_setup:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2540
                        return
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2541
                self.application_refilter_id = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2542
                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
  2543
                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
  2544
                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
  2545
                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
  2546
                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
  2547
                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
  2548
                if app_id != None:
bcdaf5bdde1c 12910 Switching categories after sorting packages got traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1530
diff changeset
  2549
                        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
  2550
                if model != None:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2551
                        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
  2552
                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
  2553
                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
  2554
                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
  2555
                        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
  2556
                            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
  2557
                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
  2558
                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
  2559
                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
  2560
                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
  2561
                        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
  2562
                        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
  2563
                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
  2564
                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
  2565
                self.__enable_disable_install_remove()
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2566
                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
  2567
                        len_filtered_list == 0 and \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2568
                        self.w_filter_combobox.get_active() != \
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2569
                        (enumerations.FILTER_SELECTED):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2570
                        self.__setup_zero_filtered_results_page()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  2571
                        self.update_statusbar()
697
a1fd77e4007a 4852 PM search is slow
John Rice <john.rice@sun.com>
parents: 696
diff changeset
  2572
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2573
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2574
        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
  2575
                self.w_searchentry.paste_clipboard()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2576
1202
e4fbdfd3714e 8821 The behavior of Clear menu item is incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1191
diff changeset
  2577
        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
  2578
                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
  2579
                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
  2580
                return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2581
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2582
        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
  2583
                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
  2584
                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
  2585
                        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
  2586
                        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
  2587
                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
  2588
                        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
  2589
                            self.w_main_clipboard)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2590
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2591
        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
  2592
                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
  2593
                self.w_paste_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2594
1243
d1f303f7dd86 9858 Need to get focus in package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1236
diff changeset
  2595
        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
  2596
                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
  2597
                        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
  2598
                                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
  2599
                else:
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.__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
  2601
                        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
  2602
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2603
        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
  2604
                self.w_searchentry.grab_focus()
1005
739eb81725b8 7824 Menus/shortcuts don't match HIG
John Rice <john.rice@sun.com>
parents: 996
diff changeset
  2605
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  2606
        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
  2607
                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
  2608
                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
  2609
63d5b301cab4 10223 Disabling 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
        def __clear_search_results(self):
1212
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2611
                # 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
  2612
                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
  2613
                        self.__clear_before_search()
6fcbc6b651be 9944 PM allow filtering of Search Results
John Rice <john.rice@sun.com>
parents: 1209
diff changeset
  2614
                        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
  2615
                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
  2616
                        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
  2617
                                != 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
  2618
                                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
  2619
                else:
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  2620
                        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
  2621
                return
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  2622
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2623
        def __on_progress_cancel_clicked(self, widget):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2624
                Thread(target = self.api_o.cancel, args = ()).start()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  2625
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2626
        def __on_startpage(self, widget):
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2627
                self.__load_startpage()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2628
                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
  2629
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
  2630
        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
  2631
                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
  2632
                    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
  2633
                        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
  2634
                        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
  2635
                        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
  2636
                        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
  2637
                                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
  2638
                                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
  2639
                        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
  2640
                            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
  2641
                                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
  2642
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
  2643
        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
  2644
                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
  2645
                    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
  2646
                    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
  2647
                    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
  2648
                        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
  2649
                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
  2650
                        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
  2651
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2652
        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
  2653
                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
  2654
                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
  2655
                        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
  2656
                        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
  2657
                        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
  2658
                        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
  2659
                        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
  2660
                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
  2661
                        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
  2662
                                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
  2663
                        else:
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, 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
  2665
                        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
  2666
                        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
  2667
                        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
  2668
                        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
  2669
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2670
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2671
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2672
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2673
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2674
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2675
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2676
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2677
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2678
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2679
                            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
  2680
                        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
  2681
                        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
  2682
                                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
  2683
                        else:
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2684
                                filtered_iter = \
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2685
                                        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
  2686
                                            iter_next)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2687
                                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
  2688
                                    filtered_iter)
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2689
                                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
  2690
                                        list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2691
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2692
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2693
                        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
  2694
                        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
  2695
                        if select_all and not mark_value:
929
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2696
                                model.set_value(itr, enumerations.MARK_COLUMN, True)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2697
                                pkg_stem = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2698
                                    enumerations.STEM_COLUMN)
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2699
                                pkg_status = model.get_value(itr,
66da4e8c37b4 6989 Remove button enabled unexpectedly
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 927
diff changeset
  2700
                                    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
  2701
                                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
  2702
                                    enumerations.PUBLISHER_COLUMN)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2703
                                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
  2704
                                    enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2705
                                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
  2706
                                    enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2707
                                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
  2708
                                    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
  2709
                        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
  2710
                                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
  2711
                                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
  2712
                                    enumerations.STEM_COLUMN)
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  2713
                                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
  2714
                
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2715
                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
  2716
                self.w_deselect_menuitem.set_sensitive(select_all)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2717
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2718
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2719
                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
  2720
                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
  2721
                        
539e3dc08316 11215 PM Allow toggle of select all from main list header
John Rice <john.rice@sun.com>
parents: 1344
diff changeset
  2722
        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
  2723
                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
  2724
                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
  2725
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2726
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2727
        def __on_select_updates(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2728
                sort_filt_model = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2729
                    self.w_application_treeview.get_model() #gtk.TreeModelSort
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2730
                filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2731
                model = filt_model.get_model() #gtk.ListStore
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2732
                iter_next = sort_filt_model.get_iter_first()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2733
                list_of_paths = []
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2734
                while iter_next != None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2735
                        sorted_path = sort_filt_model.get_path(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2736
                        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
  2737
                            iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2738
                        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
  2739
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2740
                        filtered_path = \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2741
                            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
  2742
                        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
  2743
                        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
  2744
                            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
  2745
                                list_of_paths.append(path)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2746
                        iter_next = sort_filt_model.iter_next(iter_next)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2747
                for path in list_of_paths:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2748
                        itr = model.get_iter(path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2749
                        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
  2750
                        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
  2751
                        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
  2752
                        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
  2753
                            enumerations.PUBLISHER_COLUMN)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2754
                        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
  2755
                            enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2756
                        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
  2757
                            enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2758
                        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
  2759
                            pkg_publisher, pkg_description)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2760
                self.__enable_disable_selection_menus()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2761
                self.update_statusbar()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  2762
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2763
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2764
        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
  2765
                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
  2766
                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
  2767
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2768
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2769
        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
  2770
                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
  2771
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2772
        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
  2773
                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
  2774
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2775
        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
  2776
                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
  2777
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2778
        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
  2779
                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
  2780
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2781
        def __on_preferences(self, widget):
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2782
                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
  2783
                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
  2784
                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
  2785
                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
  2786
                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
  2787
                self.w_preferencesdialog.show()
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2788
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2789
        def __on_preferencesclose_clicked(self, widget):
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2790
                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
  2791
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2792
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2793
        def __on_preferenceshelp_clicked(widget):
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  2794
                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
  2795
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2796
        def __on_startpage_checkbutton_toggled(self, widget):
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2797
                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
  2798
                try:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2799
                        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
  2800
                            self.show_startpage)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2801
                except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2802
                        pass
872
6e436e167ae4 6354 Add Preferences Dialog to PM
John Rice <john.rice@sun.com>
parents: 871
diff changeset
  2803
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2804
        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
  2805
                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
  2806
                try:
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.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
  2808
                            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
  2809
                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
  2810
                        pass
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  2811
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2812
        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
  2813
                active = widget.get_active()
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2814
                if reverse:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2815
                        active = not active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2816
                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
  2817
                try:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2818
                        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
  2819
                            self.show_image_update)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2820
                except GError:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2821
                        pass
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2822
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2823
        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
  2824
                active = widget.get_active()
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2825
                if reverse:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2826
                        active = not active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2827
                self.show_install = active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2828
                try:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2829
                        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
  2830
                            self.show_install)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2831
                except GError:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2832
                        pass
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2833
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2834
        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
  2835
                active = widget.get_active()
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2836
                if reverse:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2837
                        active = not active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2838
                self.show_remove = active
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2839
                try:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2840
                        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
  2841
                            self.show_remove)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2842
                except GError:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2843
                        pass
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  2844
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2845
        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
  2846
                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
  2847
                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
  2848
                        if active:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2849
                                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
  2850
                                        self.current_repos_with_search_errors:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2851
                                        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
  2852
                                                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
  2853
                                        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
  2854
                                        self.pylintstub = err_str
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2855
                        else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  2856
                                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
  2857
                                        self.current_repos_with_search_errors:
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2858
                                        self.gconf_not_show_repos = \
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2859
                                            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
  2860
                                            pub + ",", "")
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2861
                        try:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  2862
                                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
  2863
                                    self.gconf_not_show_repos)
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2864
                        except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  2865
                                pass
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  2866
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2867
        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
  2868
                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
  2869
                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
  2870
                        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
  2871
                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
  2872
                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
  2873
                        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
  2874
                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
  2875
                        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
  2876
                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
  2877
                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
  2878
                        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
  2879
                        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
  2880
                        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
  2881
                                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
  2882
                        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
  2883
                        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
  2884
                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
  2885
                        self.w_deselect_menuitem.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2886
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2887
        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
  2888
                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
  2889
                        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
  2890
                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
  2891
                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
  2892
                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
  2893
                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
  2894
                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
  2895
                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
  2896
                return False
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2897
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
  2898
        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
  2899
                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
  2900
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
        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
  2902
                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
  2903
                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
  2904
                if bounds:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2905
                        #enable selection functions
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2906
                        self.w_cut_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2907
                        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
  2908
                        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
  2909
                        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
  2910
                                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
  2911
                        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
  2912
                                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
  2913
                        self.w_deselect_menuitem.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2914
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2915
                        self.w_cut_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  2916
                        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
  2917
                        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
  2918
                        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
  2919
                        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
  2920
                                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
  2921
                        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
  2922
                                self.w_selectall_menuitem.set_sensitive(True)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  2923
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2924
        def __refilter_on_idle(self):
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2925
                if self.application_refilter_id != 0:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2926
                        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
  2927
                        self.application_refilter_id = 0
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2928
                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
  2929
                        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
  2930
                            self.__application_refilter)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2931
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  2932
        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
  2933
                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
  2934
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2935
        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
  2936
                '''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
  2937
                # Activated sub node in Recent Searches category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2938
                if self.in_recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2939
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2940
                # User activated Recent Searches Top Level category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2941
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2942
                if model != None and self.recent_searches_cat_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2943
                        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
  2944
                        selection, curr_path = self.__get_selection_and_category_path()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2945
                        self.pylintstub = selection
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2946
                        if curr_path == rs_path:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2947
                                self.__setup_recent_search_page()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2948
                                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
  2949
                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
  2950
                        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
  2951
                        return
1122
cf87b7d8fe39 8888 Gtk warning emitted on Reload
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1109
diff changeset
  2952
                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
  2953
                        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
  2954
                            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
  2955
                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
  2956
                        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
  2957
                        return
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2958
                self.__set_main_view_package_list()
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2959
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  2960
                self.__refilter_on_idle()
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2961
1405
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2962
        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
  2963
                # 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
  2964
                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
  2965
                        return
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 show_list:
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2967
                        self.w_main_view_notebook.set_current_page(
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2968
                                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
  2969
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  2970
                        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
  2971
                                NOTEBOOK_START_PAGE)
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  2972
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2973
        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
  2974
                self.w_categories_treeview.set_cursor(path)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2975
                self.__save_expanded_path(path, False)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2976
                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
  2977
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2978
        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
  2979
                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
  2980
                        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
  2981
                self.w_categories_treeview.set_cursor(path)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2982
                self.__save_expanded_path(path, True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2983
                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
  2984
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  2985
        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
  2986
                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
  2987
                        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
  2988
                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
  2989
                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
  2990
                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
  2991
                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
  2992
                        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
  2993
                        cellx = pthinfo[2]
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2994
                        #Clicking on row toggle icon just select the path
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2995
                        if cellx <= CATEGORY_TOGGLE_ICON_WIDTH:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2996
                                self.w_categories_treeview.set_cursor(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  2997
                                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
  2998
                                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
  2999
                        #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
  3000
                        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
  3001
                        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
  3002
                                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
  3003
                                        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
  3004
                                        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
  3005
                                        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
  3006
                                            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
  3007
                                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
  3008
                                        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
  3009
                                                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
  3010
                                        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
  3011
                                                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
  3012
                                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
  3013
                                        tree_view.expand_row(path, False)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3014
                                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
  3015
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3016
        @staticmethod
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3017
        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
  3018
                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
  3019
                if not value:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3020
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3021
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3022
                try:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3023
                        value = re.sub(REGEX_STRIP_MARKUP, "", value)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3024
                        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
  3025
                        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
  3026
                except (TypeError, re.error):
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3027
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3028
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3029
                return match is None
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3030
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3031
        def __in_recent_searches(self, path):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3032
                if not path or len(path) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3033
                        return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3034
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3035
                if model == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3036
                        return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3037
                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
  3038
                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
  3039
                        return True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3040
                return False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3041
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3042
        def __save_expanded_path(self, path, expanded):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3043
                if not path or len(path) == 0:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3044
                        return                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3045
                self.category_expanded_paths[(self.last_visible_publisher, path)] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3046
                        expanded
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3047
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3048
        def __save_active_category(self, path):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3049
                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
  3050
                        return                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3051
                self.category_active_paths[self.last_visible_publisher] = path
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3052
                self.saved_section_active = path[0]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3053
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3054
        def __on_category_selection_changed(self, selection, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3055
                '''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
  3056
                if self.in_setup:
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3057
                        return
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  3058
                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
  3059
                if not itr:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3060
                        return
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3061
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3062
                path = model.get_path(itr)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3063
                sel_category = model[path]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3064
                if sel_category[enumerations.CATEGORY_ID] == RECENT_SEARCH_ID:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3065
                        if not self.adding_recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3066
                                self.__setup_recent_search_page()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3067
                                if not self.is_all_publishers:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3068
                                        self.__save_setup_before_search(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3069
                                            single_search=True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3070
                                self.in_search_mode = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3071
                                self.in_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3072
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3073
                                self.__set_main_view_package_list()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3074
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3075
                elif sel_category[enumerations.CATEGORY_ID] > RECENT_SEARCH_ID:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3076
                        self.__restore_recent_search(sel_category)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3077
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3078
                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
  3079
                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
  3080
                        #Required for A11Y support because focus event not triggered
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3081
                        #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
  3082
                        self.__unset_search(True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3083
                        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
  3084
                        return
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3085
                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
  3086
                        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
  3087
                            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
  3088
                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
  3089
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3090
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3091
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3092
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3093
        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
  3094
            keyboard_mode, tooltip):
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3095
                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
  3096
                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
  3097
                if not info:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3098
                        return False
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3099
                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
  3100
                    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
  3101
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3102
        @staticmethod
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3103
        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
  3104
                tip = ""
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  3105
                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
  3106
                        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
  3107
                        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
  3108
                                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
  3109
                        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
  3110
                        if row:
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  3111
                                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
  3112
                                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
  3113
                                        tip = _("Installed")
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  3114
                                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
  3115
                                        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
  3116
                                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
  3117
                                        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
  3118
c7e62905037b 11218 PM show tooltip on status icons in main list view
John Rice <john.rice@sun.com>
parents: 1347
diff changeset
  3119
                if tip != "":
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3120
                        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
  3121
                        tooltip.set_text(tip)
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3122
                        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
  3123
                else:
1439
e27bd0469aa0 12020 Launch PM with warnings on OpenSolaris 125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1430
diff changeset
  3124
                        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
  3125
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3126
        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
  3127
                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
  3128
                        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
  3129
                        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
  3130
                                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
  3131
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3132
                        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
  3133
                                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
  3134
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
                        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
  3136
                        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
  3137
                                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
  3138
                        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
  3139
                        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
  3140
                                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
  3141
                        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
  3142
                        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
  3143
                        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
  3144
                        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
  3145
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
                        #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
  3147
                        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
  3148
                        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
  3149
                            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
  3150
                        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
  3151
                        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
  3152
                        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
  3153
                        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
  3154
                        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
  3155
                            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
  3156
                            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
  3157
                        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
  3158
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  3159
                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
  3160
                        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
  3161
                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
  3162
                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
  3163
                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
  3164
                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
  3165
                        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
  3166
                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
  3167
                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
  3168
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
                #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
  3170
                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
  3171
                        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
  3172
                        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
  3173
                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
  3174
                        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
  3175
                        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
  3176
                        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
  3177
                        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
  3178
                            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
  3179
                        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
  3180
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
        @staticmethod
1501
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3182
        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
  3183
                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
  3184
                if not value:
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3185
                        return True
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3186
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3187
                value = value.lower()
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3188
                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
  3189
d7bb82be7a11 11867 Enable interactive search on PM tree views
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1497
diff changeset
  3190
        @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
  3191
        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
  3192
                #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
  3193
                #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
  3194
                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
  3195
1341
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
                #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
  3197
                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
  3198
861
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  3199
        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
  3200
                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
  3201
                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
  3202
                        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
  3203
                        self.show_info_id = 0
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3204
                if itr:
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3205
                        self.selected_pkgstem = \
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3206
                               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
  3207
                        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
  3208
                        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
  3209
                        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
  3210
                        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
  3211
                            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
  3212
                                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
  3213
                        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
  3214
                            INFO_NOTEBOOK_LICENSE_PAGE):
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3215
                                self.__on_notebook_change(None, None, 
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  3216
                                    INFO_NOTEBOOK_LICENSE_PAGE)
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3217
                        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
  3218
                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
  3219
                        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
  3220
                        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
  3221
                        self.selected_pkgstem = None
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3222
                        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
  3223
861
2a5fb898a335 4578 IPS GUI does not update the package info after upgrading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 844
diff changeset
  3224
        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
  3225
                '''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
  3226
                if self.in_setup:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3227
                        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
  3228
                self.__process_package_selection()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3229
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3230
        def __on_filtercombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3231
                '''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
  3232
                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
  3233
                        return
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3234
                active = self.w_filter_combobox.get_active()
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3235
                if active != enumerations.FILTER_SELECTED:
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  3236
                        self.saved_filter_combobox_active = active
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  3237
                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
  3238
                self.set_busy_cursor()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3239
                self.__refilter_on_idle()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3240
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3241
        def __unset_search(self, same_repo):
963
43c2dd2d4943 7563 Remote search error rework
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 962
diff changeset
  3242
                self.w_infosearch_frame.hide()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3243
                self.__update_tooltips()
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3244
                self.in_search_mode = False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3245
                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
  3246
                self.is_all_publishers = False
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3247
                if same_repo:
1179
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3248
                        self.__restore_setup_for_browse()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3249
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3250
        def __on_repositorycombobox_changed(self, widget):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3251
                '''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
  3252
                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
  3253
                        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
  3254
                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
  3255
                        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
  3256
                                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
  3257
                        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
  3258
                        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
  3259
                        if self.in_setup:
c6980ed4c49b 12710 Package Manager hangs after clicking on category
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1501
diff changeset
  3260
                                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
  3261
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3262
                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
  3263
                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
  3264
                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
  3265
                        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
  3266
                                return
1232
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_add_index:
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3268
                                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
  3269
                                    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
  3270
                                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
  3271
                                return
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3272
                        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
  3273
                        self.__unset_search(same_repo)
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3274
                        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
  3275
                                self.__set_searchentry_to_prompt()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3276
                                return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3277
                        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
  3278
                        selected_publisher = self.__get_selected_publisher()
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3279
                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
  3280
                        return
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3281
                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
  3282
                        self.__set_all_publishers_mode()
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3283
                        return
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3284
                        
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3285
                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
  3286
                        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
  3287
                            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
  3288
                        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
  3289
                        self.__on_file_add_publisher(None)
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  3290
                        return
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3291
                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
  3292
                        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
  3293
                        self.is_all_publishers_installed = True
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3294
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3295
                        self.is_all_publishers_installed = False
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3296
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3297
                self.cancelled = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3298
                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
  3299
                self.set_busy_cursor()
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3300
                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
  3301
                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
  3302
                        self.__unset_search(False)
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3303
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3304
                pub = [selected_publisher, ]
944
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  3305
                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
  3306
                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
  3307
                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
  3308
                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
  3309
                self.__set_main_view_package_list()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3310
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3311
        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
  3312
                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
  3313
                if pub_iter == None:
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  3314
                        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
  3315
                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
  3316
                            enumerations.REPOSITORY_NAME)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3317
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
  3318
        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
  3319
                self.saved_filter_combobox_active = self.initial_show_filter
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3320
                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
  3321
                    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
  3322
                self.__unset_saved()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3323
                self.publisher_changed = True
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3324
                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
  3325
                self.saved_repository_combobox_active = \
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3326
                        self.w_repository_combobox.get_active()
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3327
                gobject.idle_add(self.__init_tree_views, application_list,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3328
                    category_list, section_list)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3329
1203
d146c4940f88 9815 Wrong cache generated while doing single repo search.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1202
diff changeset
  3330
        def __unset_saved(self):
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3331
                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
  3332
                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
  3333
                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
  3334
                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
  3335
                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
  3336
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
  3337
        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
  3338
                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
  3339
                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
  3340
                    status_str)
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3341
                if self.is_all_publishers_installed: 
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3342
                        self.__do_refresh()
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3343
                else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3344
                        self.__do_refresh(pubs=[pub])
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3345
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3346
        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
  3347
                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
  3348
                try:
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3349
                        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
  3350
                        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
  3351
                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
  3352
                        if ignore_transport_ex == False:
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3353
                                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
  3354
                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
  3355
                        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
  3356
                        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
  3357
                            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
  3358
                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
  3359
                        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
  3360
                        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
  3361
                            None, gtk.MESSAGE_INFO)
1488
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3362
                except Exception:
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3363
                        err = str(ex)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3364
                        gobject.idle_add(self.error_occurred, err,
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3365
                            None, gtk.MESSAGE_INFO)
5aae3a0df3aa 11937 Stack trace when reloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1487
diff changeset
  3366
                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
  3367
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  3368
        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
  3369
                application_list = self.__get_new_application_liststore()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3370
                category_list = self.__get_new_category_liststore()
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3371
                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
  3372
                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
  3373
                        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
  3374
                                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
  3375
                        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
  3376
                        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
  3377
                                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
  3378
                                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
  3379
                        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
  3380
                            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
  3381
                        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
  3382
                                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
  3383
                                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
  3384
                        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
  3385
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  3386
                return application_list, category_list, section_list
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3387
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3388
        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
  3389
            confirmation_list):
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3390
                for pub_name in self.selected_pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3391
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3392
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3393
                                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
  3394
                        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
  3395
                                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
  3396
                                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
  3397
                                    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
  3398
                                        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
  3399
                                        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
  3400
                                                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
  3401
                                                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
  3402
                                                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
  3403
                                                    [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
  3404
                                                    desc, status])
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3405
        def __on_version_info(self, widget):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3406
                model, itr = self.package_selection.get_selected()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3407
                if itr:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3408
                        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
  3409
                        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
  3410
                        self.set_busy_cursor()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3411
                        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
  3412
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3413
        def __get_info(self, pkg_stem, name):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3414
                self.api_o.reset()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3415
                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
  3416
                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
  3417
                if self.exiting:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3418
                        return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3419
                plan_pkg = None
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3420
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3421
                installed_only = False
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3422
                if local_info:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3423
                        if (local_info.build_release == remote_info.build_release
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3424
                            and local_info.branch == remote_info.branch):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3425
                                installed_only = True
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3426
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3427
                if not installed_only:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3428
                        install_update_list = []
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3429
                        stuff_to_do = False
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3430
                        install_update_list.append(pkg_stem)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3431
                        try:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3432
                                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
  3433
                                    install_update_list,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3434
                                    refresh_catalogs = False) 
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3435
                        except api_errors.ApiException:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3436
                                gobject.idle_add(self.unset_busy_cursor)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3437
                                return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3438
                        if stuff_to_do:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3439
                                plan = self.api_o.describe().get_changes()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3440
                                plan_pkg = None
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3441
                                for pkg_plan in plan:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3442
                                        if name == pkg_plan[1].pkg_stem:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3443
                                                plan_pkg = pkg_plan[1]
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3444
                                                break
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3445
                                if plan_pkg == None:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3446
                                        gobject.idle_add(self.unset_busy_cursor)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3447
                                        return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3448
                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
  3449
                    plan_pkg, name)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3450
                return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3451
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3452
        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
  3453
                if self.exiting:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3454
                        return
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3455
                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
  3456
                installable_fmt = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3457
                    _("%(version)s (Build %(build)s-%(branch)s)")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3458
                if local_info:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3459
                        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
  3460
                        installed_label = yes_text % \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3461
                            {"version": local_info.version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3462
                            "build": local_info.build_release,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3463
                            "branch": local_info.branch}
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3464
                        if (local_info.build_release == remote_info.build_release
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3465
                            and local_info.branch == remote_info.branch):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3466
                                installable_label = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3467
                                    _("Installed package is up-to-date")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3468
                                self.w_info_expander.hide()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3469
                                self.w_version_info_dialog.set_size_request(-1, -1)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3470
                        else:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3471
                                if plan_pkg == None:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3472
                                        # Updateable but cannot do it
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3473
                                        installable_label = _("None")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3474
                                        self.__setup_version_info_details(name,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3475
                                            remote_info.version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3476
                                            remote_info.build_release,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3477
                                            remote_info.branch)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3478
                else:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3479
                        installed_label = _("No")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3480
                        if plan_pkg:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3481
                                if plan_pkg.build_release == remote_info.build_release \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3482
                                    and plan_pkg.branch == remote_info.branch:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3483
                                        installable_label = installable_fmt % \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3484
                                            {"version": plan_pkg.version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3485
                                            "build": plan_pkg.build_release,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3486
                                            "branch": plan_pkg.branch}
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3487
                                        self.w_info_expander.hide()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3488
                                else:
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3489
                                        installable_label = installable_fmt % \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3490
                                            {"version": plan_pkg.version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3491
                                            "build": plan_pkg.build_release,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3492
                                            "branch": plan_pkg.branch}
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3493
                                            
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,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3497
                                            remote_info.branch)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3498
                        
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3499
                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
  3500
                self.w_info_installable_label.set_text(installable_label)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3501
                self.w_info_ok_button.grab_focus()                
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3502
                self.w_version_info_dialog.show()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3503
                self.unset_busy_cursor()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3504
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3505
        def __setup_version_info_details(self, name, version, build_release, branch):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3506
                installable_fmt = \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3507
                    _("%(version)s (Build %(build)s-%(branch)s)")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3508
                expander_fmt = _(
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3509
                    "The latest version of %s cannot be installed "
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3510
                    "until you update your system. "
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3511
                    "Run \"Updates\" to get your system up-to-date.")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3512
                installable_exp = installable_fmt % \
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3513
                    {"version": version,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3514
                    "build": build_release,
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3515
                    "branch": branch}
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3516
                expander_text = installable_exp + "\n\n"
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3517
                expander_text += expander_fmt % name   
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3518
                
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3519
                # 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
  3520
                # without requiring a scrollbar  
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3521
                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
  3522
                self.w_info_expander.set_expanded(True)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3523
                self.w_info_expander.show()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3524
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3525
                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
  3526
                details_buff.set_text("")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3527
                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
  3528
                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
  3529
                    _("Latest Version: "), "bold")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3530
                details_buff.insert(itr, expander_text)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3531
                         
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3532
        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
  3533
                self.w_version_info_dialog.hide()
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3534
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3535
        @staticmethod
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3536
        def __on_info_help_button_clicked(widget):
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3537
                gui_misc.display_help("package-version")
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3538
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3539
        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
  3540
                self.__on_info_ok_button_clicked(None)
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3541
                return True
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3542
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3543
        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
  3544
                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
  3545
                install_update = []
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3546
                confirmation_list = None
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3547
                if self.show_install:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3548
                        confirmation_list = []
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3549
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3550
                if self.all_selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3551
                        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
  3552
                                    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
  3553
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
  3554
                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
  3555
                        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
  3556
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3557
                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
  3558
                    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
  3559
                    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
  3560
                    confirmation_list = confirmation_list)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3561
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3562
        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
  3563
                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
  3564
                confirmation = None
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3565
                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
  3566
                        confirmation = []
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3567
                installupdate.InstallUpdate([], self,
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3568
                    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
  3569
                    parent_name = _("Package Manager"),
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 868
diff changeset
  3570
                    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
  3571
                    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
  3572
                    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
  3573
                    confirmation_list = confirmation)
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  3574
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3575
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3576
        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
  3577
                wTreePlan = gtk.glade.XML(self.gladefile, "aboutdialog")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3578
                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
  3579
                aboutdialog.set_icon(self.window_icon)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3580
                aboutdialog.connect("response", lambda x = None, \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3581
                    y = None: aboutdialog.destroy())
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3582
                aboutdialog.run()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3583
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  3584
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  3585
        def __on_help_help(widget):
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1219
diff changeset
  3586
                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
  3587
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3588
        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
  3589
                for pub_name in self.selected_pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3590
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3591
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3592
                                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
  3593
                        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
  3594
                                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
  3595
                                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
  3596
                                    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
  3597
                                        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
  3598
                                        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
  3599
                                                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
  3600
                                                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
  3601
                                                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
  3602
                                                    [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
  3603
                                                    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
  3604
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3605
        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
  3606
                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
  3607
                remove_list = []
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3608
                confirmation_list = None
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3609
                if self.show_remove:
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3610
                        confirmation_list = []
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3611
                if self.all_selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3612
                        self.__add_remove_pkgs_for_publishers(remove_list, 
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3613
                            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
  3614
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
  3615
                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
  3616
                        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
  3617
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  3618
                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
  3619
                    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
  3620
                    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
  3621
                    confirmation_list = confirmation_list)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3622
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3623
        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
  3624
                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
  3625
                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
  3626
63d5b301cab4 10223 Disabling other then currently selected publisher should not switch the view to another publisher.
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1418
diff changeset
  3627
        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
  3628
                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
  3629
                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
  3630
                    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
  3631
                        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
  3632
                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
  3633
                self.in_setup = True
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  3634
                self.last_visible_publisher = None
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3635
                self.set_busy_cursor()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3636
                status_str = _("Refreshing package catalog information")
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  3637
                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
  3638
                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
  3639
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3640
        def __catalog_refresh(self):
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3641
                """Update image's catalogs."""
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3642
                success = self.__do_refresh(immediate=True)
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  3643
                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
  3644
                self.__catalog_refresh_done()
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3645
                if not success:
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3646
                        return -1
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3647
                return 0
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  3648
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  3649
        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
  3650
                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
  3651
                        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
  3652
1427
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3653
        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
  3654
                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
  3655
                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
  3656
                        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
  3657
                            index)
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3658
                        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
  3659
                            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
  3660
                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
  3661
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3662
        def __main_application_quit(self, restart = False):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3663
                '''quits the main gtk loop'''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3664
                self.cancelled = True
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3665
                self.exiting = True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3666
                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
  3667
1373
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3668
                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
  3669
                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
  3670
                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
  3671
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3672
                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
  3673
                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
  3674
                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
  3675
                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
  3676
                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
  3677
                        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
  3678
                                start_insearch = True
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3679
                        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
  3680
                                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
  3681
                                    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
  3682
                        else:
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  3683
                                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
  3684
                        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
  3685
                                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
  3686
                        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
  3687
                        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
  3688
                        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
  3689
                        vpos = save_vpos
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3690
                try:
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  3691
                        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
  3692
                                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
  3693
                                    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
  3694
                        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
  3695
                        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
  3696
                            start_insearch)
1006
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3697
                        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
  3698
                        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
  3699
                        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
  3700
                        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
  3701
                except GError:
2b6ae834c4b2 7921 PM should handle gconf lookup failures gracefully
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1005
diff changeset
  3702
                        pass
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3703
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  3704
                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
  3705
                        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
  3706
                            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
  3707
                else:
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3708
                        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
  3709
                                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
  3710
                                    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
  3711
                        else:
8853588846af 11646 Restoring All Publisher should also restore last viewed publisher categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1426
diff changeset
  3712
                                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
  3713
2c27280fc3cb 10169 Package Manager fails to cache package list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1246
diff changeset
  3714
                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
  3715
                        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
  3716
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3717
                if self.api_o.can_be_canceled():
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  3718
                        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
  3719
                self.__do_exit()
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3720
                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
  3721
                return True
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3722
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3723
        @staticmethod
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3724
        def __do_exit():
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3725
                if threading.activeCount() == 1:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3726
                        gtk.main_quit()
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  3727
                        sys.exit(0)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3728
                return True
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3729
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3730
        def __check_if_something_was_changed(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3731
                ''' 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
  3732
                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
  3733
                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
  3734
                        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
  3735
                                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
  3736
                                        return True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3737
                return False
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3738
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
  3739
        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
  3740
                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
  3741
                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
  3742
                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
  3743
                        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
  3744
                        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
  3745
                                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
  3746
                                    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
  3747
                                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
  3748
                                   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
  3749
                                   enumerations.REPOSITORY_NAME)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3750
                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
  3751
                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
  3752
                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
  3753
                if self.default_publisher != default_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3754
                        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
  3755
                        self.default_publisher = default_pub
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3756
                selected_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3757
                enabled_repos = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3758
                for repo in self.selected_pkgs:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3759
                        selected_repos.append(repo)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3760
                i = 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3761
                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
  3762
                for pub in api_o.get_publishers():
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3763
                        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
  3764
                        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
  3765
                                continue
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  3766
                        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
  3767
                        if cmp(prefix, self.default_publisher) == 0:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3768
                                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
  3769
                        self.repositories_list.append([i, prefix, ])
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3770
                        enabled_repos.append(prefix)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3771
                        i = i + 1
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3772
                self.repositories_list.append([-1, "", ])
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3773
                i = i + 1
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3774
                self.repo_combobox_all_pubs_installed_index = i
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3775
                self.repositories_list.append(
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3776
                    [self.repo_combobox_all_pubs_installed_index, 
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3777
                    self.publisher_options[PUBLISHER_INSTALLED], ])
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3778
                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
  3779
                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
  3780
                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
  3781
                    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
  3782
                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
  3783
                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
  3784
                i = i + 1
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3785
                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
  3786
                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
  3787
                    self.publisher_options[PUBLISHER_ADD], ])
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3788
                pkgs_to_remove = []
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3789
                for repo_name in selected_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3790
                        if repo_name not in enabled_repos:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3791
                                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
  3792
                                for pkg_stem in pkg_stems:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3793
                                        pkgs_to_remove.append(pkg_stem)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3794
                for pkg_stem in pkgs_to_remove:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3795
                        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
  3796
                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
  3797
                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
  3798
                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
  3799
                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
  3800
                        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
  3801
                                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
  3802
                                    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
  3803
                                    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
  3804
                                        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
  3805
                                           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
  3806
                                        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
  3807
                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
  3808
                        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
  3809
                                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
  3810
                                    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
  3811
                                    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
  3812
                                        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
  3813
                                           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
  3814
                                        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
  3815
                                                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
  3816
                                        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
  3817
                        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
  3818
                                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
  3819
                                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
  3820
                                        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
  3821
                                            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
  3822
                                                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
  3823
                                                   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
  3824
                                                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
  3825
                                # 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
  3826
                                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
  3827
                                        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
  3828
                                        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
  3829
                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
  3830
                        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
  3831
                elif self.default_publisher:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3832
                        self.w_repository_combobox.set_active(active)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3833
                else:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3834
                        self.w_repository_combobox.set_active(0)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3835
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3836
        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
  3837
                '''Toggle function for column enumerations.MARK_COLUMN'''
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3838
                applicationModel = model_sort.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3839
                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
  3840
                filterModel = applicationModel.get_model()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3841
                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
  3842
                itr = filterModel.get_iter(child_path)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3843
                if itr:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3844
                        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
  3845
                        filterModel.set_value(itr, enumerations.MARK_COLUMN,
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3846
                            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
  3847
                        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
  3848
                            enumerations.STATUS_COLUMN)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3849
                        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
  3850
                        if modified:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3851
                                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
  3852
                        else:
1414
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  3853
                                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
  3854
                                    enumerations.PUBLISHER_COLUMN)
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3855
                                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
  3856
                                    enumerations.DESCRIPTION_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3857
                                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
  3858
                                    enumerations.NAME_COLUMN)
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3859
                                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
  3860
                                    pkg_status, pkg_publisher, pkg_description)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3861
                        self.update_statusbar()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3862
                        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
  3863
                        self.__enable_disable_install_remove()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  3864
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3865
        def __update_reload_button(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3866
                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
  3867
                        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
  3868
                        self.w_reload_button.set_sensitive(True)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3869
                else:
1232
5235f14e0e8f 10118 PM Search UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1228
diff changeset
  3870
                        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
  3871
                        self.w_reload_button.set_sensitive(False)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3872
1512
29ea2bc4074b 12108 Add "Do not prompt" checkbox on confirmation dialogs
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1511
diff changeset
  3873
        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
  3874
                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
  3875
                        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
  3876
                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
  3877
                if status == enumerations.NOT_INSTALLED or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3878
                    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
  3879
                        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
  3880
                                self.to_install_update[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3881
                        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
  3882
                                self.to_install_update[pub] += 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3883
                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
  3884
                        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
  3885
                                self.to_remove[pub] = 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3886
                        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
  3887
                                self.to_remove[pub] += 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3888
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3889
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3890
        def __update_tooltips(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3891
                to_remove = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3892
                to_install = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3893
                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
  3894
                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
  3895
                        packages = self.to_remove.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3896
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3897
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3898
                                        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
  3899
                                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
  3900
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3901
                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
  3902
                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
  3903
                        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
  3904
                        if packages > 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3905
                                if no_iter == 0:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3906
                                        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
  3907
                                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
  3908
                                no_iter += 1
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3909
                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
  3910
                        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
  3911
                            "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
  3912
                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
  3913
                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
  3914
                        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
  3915
                            "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
  3916
                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
  3917
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3918
        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
  3919
                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
  3920
                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
  3921
                        pkgs = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3922
                        status = None
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3923
                        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
  3924
                                status = pkgs.pop(stem)[0]
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3925
                        if status == enumerations.NOT_INSTALLED or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3926
                            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
  3927
                                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
  3928
                                        self.to_install_update[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3929
                                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
  3930
                                        self.to_install_update[pub] -= 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3931
                        if status == enumerations.UPDATABLE or \
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3932
                            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
  3933
                                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
  3934
                                        self.to_remove[pub] = 0
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3935
                                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
  3936
                                        self.to_remove[pub] -= 1
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3937
                        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
  3938
                                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
  3939
                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
  3940
                        self.selected_pkgs.pop(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3941
                self.__update_tooltips()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3942
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3943
        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
  3944
                # 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
  3945
                # 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
  3946
                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
  3947
                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
  3948
                        stems = self.selected_pkgs.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3949
                        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
  3950
                                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
  3951
                for pkg_stem in remove_pub:
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  3952
                        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
  3953
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3954
        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
  3955
                self.showing_empty_details = True
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3956
                if self.show_info_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3957
                        gobject.source_remove(self.show_info_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3958
                        self.show_info_id = 0
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3959
                if self.show_licenses_id != 0:
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3960
                        gobject.source_remove(self.show_licenses_id)
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3961
                        self.show_licenses_id = 0
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3962
                self.w_installedfiles_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3963
                self.w_dependencies_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3964
                self.w_generalinfo_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3965
                self.w_license_textview.get_buffer().set_text("")
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3966
                return
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  3967
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  3968
        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
  3969
                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
  3970
                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
  3971
                        return
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3972
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3973
                instbuffer = self.w_installedfiles_textview.get_buffer()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3974
                depbuffer = self.w_dependencies_textview.get_buffer()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  3975
                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
  3976
                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
  3977
                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
  3978
                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
  3979
                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
  3980
                return
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  3981
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3982
        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
  3983
                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
  3984
                        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
  3985
                                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
  3986
                        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
  3987
                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
  3988
                        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
  3989
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  3990
                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
  3991
                        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
  3992
                            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
  3993
                        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
  3994
                            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
  3995
                        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
  3996
                            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
  3997
                            self.installed_icon, self.not_installed_icon,
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3998
                            self.update_available_icon, 
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  3999
                            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
  4000
                        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
  4001
                            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
  4002
                        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
  4003
                        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
  4004
                            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
  4005
                        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
  4006
                            enumerations.INFO_DEPEND_DEPEND_INFO]
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4007
                        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
  4008
                            enumerations.INFO_DEPEND_DEPEND_INSTALLED_INFO]
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4009
                        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
  4010
                            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
  4011
                        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
  4012
                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
  4013
                        return False
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4014
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
  4015
        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
  4016
                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
  4017
                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
  4018
                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
  4019
                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
  4020
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4021
        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
  4022
                names = []
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4023
                states = None
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4024
                installed_states = []
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4025
                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
  4026
                        states = dep_info[0]
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4027
                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
  4028
                        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
  4029
                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
  4030
                i = 0
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4031
                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
  4032
                        if states != None:
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4033
                                name = fmri.extract_pkg_name(x)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4034
                                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
  4035
                                    {"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
  4036
                                    "build": states[i].build_release,
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4037
                                    "branch": states[i].branch}
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4038
                                found = False
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4039
                                for state in installed_states:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4040
                                        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
  4041
                                                installed_version = version_fmt % \
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4042
                                                    {"version": state.version,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4043
                                                    "build": state.build_release,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4044
                                                    "branch": state.branch}
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4045
                                                found = True
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4046
                                                break
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4047
                                if not found:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4048
                                        installed_version = (_("(not installed)"))
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4049
                                names.append((name, version, installed_version,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4050
                                    found))
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4051
                                i += 1
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4052
                        else:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4053
                                names.append(x)
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4054
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
  4055
                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
  4056
                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
  4057
                if states == None:
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4058
                        if len(names) == 0:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4059
                                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
  4060
                                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
  4061
                                    _("None"), "bold")
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4062
                        else:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4063
                                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
  4064
                                        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
  4065
                                        dep_str = "%s\n" % (names[i]) 
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4066
                                        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
  4067
                        return
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4068
                max_name_len = 0
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4069
                max_version_len = 0
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4070
                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
  4071
                        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
  4072
                                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
  4073
                        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
  4074
                                max_version_len = len(version)
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4075
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4076
                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
  4077
                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
  4078
                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
  4079
                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
  4080
                i = 1
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4081
                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
  4082
                    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
  4083
                i += 1
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4084
                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
  4085
                    (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
  4086
                    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
  4087
                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
  4088
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4089
                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
  4090
                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
  4091
                    _("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
  4092
                installed_icon = None
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4093
                not_installed_icon = None
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4094
                i += 0
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4095
                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
  4096
                        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
  4097
                                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
  4098
                                        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
  4099
                                            self.installed_icon,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4100
                                            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
  4101
                                icon = installed_icon
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4102
                        else:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4103
                                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
  4104
                                        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
  4105
                                            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
  4106
                                            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
  4107
                                icon = not_installed_icon
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4108
                        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
  4109
                        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
  4110
                        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
  4111
                        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
  4112
                        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
  4113
                        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
  4114
                        i += 1
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4115
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4116
        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
  4117
            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
  4118
                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
  4119
                    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
  4120
                        return
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4121
                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
  4122
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  4123
                if self.__setting_from_cache(pkg_stem):
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4124
                        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
  4125
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
  4126
                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
  4127
                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
  4128
                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
  4129
815
3ffb48a98485 5665 pkg manager "general info" not nearly as good as "pkg info"
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 808
diff changeset
  4130
                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
  4131
                        network_str = \
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4132
                            _("\nThis might be caused by network problem "
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4133
                            "while accessing the repository.")
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4134
                        instbuffer.set_text( \
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4135
                            _("Files Details not available for this package...") +
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4136
                            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
  4137
                        depbuffer.set_text(_(
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4138
                            "Dependencies info not available for this package...") +
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4139
                            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
  4140
                        infobuffer.set_text(
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4141
                            _("Information not available for this package...") +
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4142
                            network_str)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4143
                        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
  4144
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  4145
                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
  4146
                    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
  4147
                    self.installed_icon, self.not_installed_icon,
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4148
                    self.update_available_icon,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4149
                    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
  4150
                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
  4151
                        # 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
  4152
                        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
  4153
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4154
                if not remote_info:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  4155
                        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
  4156
1443
95818bb59a24 12103 make files tab information easier to understand
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1442
diff changeset
  4157
                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
  4158
                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
  4159
                        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
  4160
                                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
  4161
                                    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
  4162
                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
  4163
                        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
  4164
                                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
  4165
                                    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
  4166
                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
  4167
                        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
  4168
                                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
  4169
                                    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
  4170
                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
  4171
                        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
  4172
                                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
  4173
                                    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
  4174
                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
  4175
                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
  4176
                    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
  4177
                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
  4178
                        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
  4179
                            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
  4180
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
  4181
        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
  4182
                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
  4183
                    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
  4184
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4185
                lic = ""
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4186
                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
  4187
                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
  4188
                        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
  4189
                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
  4190
                        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
  4191
                                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
  4192
                                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
  4193
                        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
  4194
                                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
  4195
                        except UnicodeDecodeError:
1226
7dc1fa06611c 9180 Empty license textview due to conversion problem
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1220
diff changeset
  4196
                                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
  4197
                                    "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
  4198
                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
  4199
                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
  4200
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  4201
        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
  4202
                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
  4203
                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
  4204
                    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
  4205
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4206
        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
  4207
                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
  4208
                        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
  4209
                            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
  4210
                        return
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4211
                info = None
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4212
                try:
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4213
                        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
  4214
                            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
  4215
                except (api_errors.TransportError):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4216
                        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
  4217
                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
  4218
                        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
  4219
                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
  4220
                    self.last_show_licenses_id):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4221
                        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
  4222
                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
  4223
                        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
  4224
                        # Get license from remote
1049
d5915588c408 8177 Install/Uninstall PM gets traceback
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1031
diff changeset
  4225
                                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
  4226
                                    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
  4227
                        except (api_errors.TransportError):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4228
                                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
  4229
                        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
  4230
                                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
  4231
                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
  4232
                    self.last_show_licenses_id):
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4233
                        return
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4234
                pkgs_info = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4235
                package_info = None
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4236
                no_licenses = 0
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4237
                if info:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4238
                        pkgs_info = info[0]
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4239
                if pkgs_info:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4240
                        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
  4241
                if package_info:
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4242
                        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
  4243
                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
  4244
                        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
  4245
                            license_id)
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4246
                        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
  4247
                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
  4248
                        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
  4249
                            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
  4250
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  4251
        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
  4252
                self.show_info_id = 0
911
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4253
                if not (model and path):
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4254
                        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
  4255
                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
  4256
                        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
  4257
                            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
  4258
                        # 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
  4259
                        # 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
  4260
                        # 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
  4261
                        # 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
  4262
                        # 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
  4263
                                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
  4264
                                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
  4265
865
81af5326a965 6239 time.sleep() should not be called when getting package info
Padraig O'Briain <padraig.obriain@sun.com>
parents: 864
diff changeset
  4266
                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
  4267
                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
  4268
                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
  4269
                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
  4270
                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
  4271
                        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
  4272
                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
  4273
                    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
  4274
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
        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
  4276
                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
  4277
                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
  4278
                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
  4279
                    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
  4280
                    enumerations.INSTALLED or pkg_status ==
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4281
                    enumerations.UPDATABLE):
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  4282
                        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
  4283
                            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
  4284
                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
  4285
                    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
  4286
                    enumerations.NOT_INSTALLED or pkg_status ==
0a13415002e4 6634 License information not displayed
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 906
diff changeset
  4287
                    enumerations.UPDATABLE):
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1365
diff changeset
  4288
                        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
  4289
                            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
  4290
                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
  4291
                    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
  4292
                        if local_info:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4293
                                info = local_info
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4294
                        else:
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4295
                                info = remote_info
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4296
                        dep_info = None
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4297
                        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
  4298
                        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
  4299
                                try:
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4300
                                        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
  4301
                                            info.dependencies,
1412
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4302
                                            False,
c948dbc8a1a5 5321 package manager dependencies tab could show installation status
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1411
diff changeset
  4303
                                            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
  4304
                                            api.PackageInfo.IDENTITY]))
1479
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4305
                                        temp_info = []
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4306
                                        for depend in info.dependencies:
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4307
                                                name = fmri.extract_pkg_name(depend)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4308
                                                temp_info.append(name)
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4309
                                        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
  4310
                                            temp_info,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4311
                                            True,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4312
                                            frozenset([api.PackageInfo.STATE,
36a1f409ebfa 12356 Dependencies tab information is misleading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1478
diff changeset
  4313
                                            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
  4314
                                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
  4315
                                        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
  4316
                                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
  4317
                                        pass
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4318
                        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
  4319
                            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
  4320
                            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
  4321
                return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4322
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4323
        # 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
  4324
        @staticmethod
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4325
        def __locale_distinguished_name(action):
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4326
                if action.key_attr == None:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4327
                        return str(action)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4328
                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
  4329
                    (_(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
  4330
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4331
        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
  4332
                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
  4333
                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
  4334
                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
  4335
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4336
                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
  4337
                        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
  4338
                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
  4339
                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
  4340
                        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
  4341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4342
                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
  4343
                    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
  4344
                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
  4345
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4346
                # Top level Section has been selected
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4347
                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
  4348
                        selected_section = selected_category
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4349
                        return selected_section, 0
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4350
                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
  4351
                        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
  4352
                        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
  4353
                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
  4354
                        # 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
  4355
                        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
  4356
                        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
  4357
                                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
  4358
                        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
  4359
                            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
  4360
                        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
  4361
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4362
        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
  4363
                '''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
  4364
                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
  4365
                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
  4366
                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
  4367
                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
  4368
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  4369
                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
  4370
                        return category
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  4371
                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
  4372
                if filter_id == enumerations.FILTER_SELECTED:
895
f5bc5c3ac784 6980 Behavior of Selected Packages filter
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 894
diff changeset
  4373
                        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
  4374
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4375
                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
  4376
                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
  4377
                        self.__get_active_section_and_category()
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4378
                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4379
                in_recent_search = False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4380
                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
  4381
                        #Clicked on All Categories
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4382
                        category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4383
                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
  4384
                        #Clicked on subcategory
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4385
                        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
  4386
                                category = True
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4387
                elif category_list:
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4388
                        #Clicked on Top Level section                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4389
                        if selected_section < RECENT_SEARCH_ID_OFFSET:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4390
                                categories_in_section = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4391
                                        self.section_categories_list[selected_section]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4392
                                for cat_id in category_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4393
                                        if cat_id in categories_in_section:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4394
                                                category = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4395
                                                break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4396
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4397
                                in_recent_search = True
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4398
                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
  4399
                        return False
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4400
                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
  4401
                        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
  4402
                return (category &
725eed9b5897 9442 Use Search API in PM for all searches
John Rice <john.rice@sun.com>
parents: 1168
diff changeset
  4403
                    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
  4404
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4405
        @staticmethod
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4406
        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
  4407
                '''Function for filtercombobox'''
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  4408
                if filter_id == enumerations.FILTER_ALL:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4409
                        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
  4410
                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
  4411
                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
  4412
                        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
  4413
                            enumerations.UPDATABLE)
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  4414
                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
  4415
                        return status == enumerations.UPDATABLE
937
e421cb3097da 7290 Behavior of the search
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 929
diff changeset
  4416
                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
  4417
                        return status == enumerations.NOT_INSTALLED
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4418
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4419
        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
  4420
                if len(self.repositories_list) <= 1:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4421
                        return True
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4422
                else:
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4423
                        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
  4424
                        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
  4425
                        if not pkg:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4426
                                return False
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  4427
                        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
  4428
                                return True
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4429
                        else:
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4430
                                return False
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4431
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4432
        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
  4433
                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
  4434
                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4435
                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
  4436
                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
  4437
                        self.unset_busy_cursor()
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  4438
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4439
        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
  4440
                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
  4441
                        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
  4442
                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
  4443
                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
  4444
                        for row in model:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4445
                                if not row[enumerations.MARK_COLUMN]:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4446
                                        self.w_selectall_menuitem.set_sensitive(True)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4447
                                        return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4448
                        self.w_selectall_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4449
                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4450
                        self.w_selectall_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4451
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4452
        def __enable_disable_install_remove(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4453
                if not self.user_rights:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4454
                        self.w_installupdate_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4455
                        self.w_installupdate_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4456
                        self.w_remove_button.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4457
                        self.w_remove_menuitem.set_sensitive(False)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4458
                        return
1413
3506ea295efa 11806 PM installs packages even if they are not checked
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1412
diff changeset
  4459
                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
  4460
                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
  4461
                self.__enable_disable_export_selections()
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4462
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4463
        def __enable_if_selected_for_removal(self):
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4464
                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
  4465
                selected = 0
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4466
                for pub in self.to_remove:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4467
                        selected = self.to_remove.get(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4468
                        if selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4469
                                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
  4470
                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
  4471
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4472
                self.w_remove_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4473
                self.w_remove_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4474
                return sensitive
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4475
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4476
        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
  4477
                sensitive = False
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4478
                selected = 0
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4479
                for pub in self.to_install_update:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4480
                        selected = self.to_install_update.get(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4481
                        if selected > 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4482
                                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
  4483
                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
  4484
                        sensitive = True
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4485
                self.w_installupdate_button.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4486
                self.w_installupdate_menuitem.set_sensitive(sensitive)
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4487
                return sensitive
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4488
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4489
        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
  4490
                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
  4491
                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
  4492
                        return
aaeaa58aeb99 7029 Allow use of previous publisher at start of Package Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1368
diff changeset
  4493
                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
  4494
                        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
  4495
                                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
  4496
                                        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
  4497
                                            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
  4498
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4499
                self.w_selectupdates_menuitem.set_sensitive(False)
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4500
                return
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4501
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4502
        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
  4503
                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
  4504
                try:
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4505
                        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
  4506
                            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
  4507
                finally:
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4508
                        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
  4509
                return res
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  4510
1478
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4511
        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
  4512
                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
  4513
                        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
  4514
                else:
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4515
                        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
  4516
                return
1e51eaebc8ee 12178 PM support Export Selections in .p5i format
John Rice <john.rice@sun.com>
parents: 1468
diff changeset
  4517
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4518
        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
  4519
                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
  4520
                        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
  4521
                                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
  4522
                                        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
  4523
                                        return
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4524
                self.w_deselect_menuitem.set_sensitive(False)
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4525
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4526
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
  4527
        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
  4528
            category_list, section_list):
882
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  4529
                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
  4530
                        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
  4531
                            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
  4532
                        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
  4533
                        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
  4534
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1216
diff changeset
  4535
        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
  4536
            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
  4537
                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
  4538
                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
  4539
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4540
                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
  4541
                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
  4542
                try:                
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4543
                        if self.is_all_publishers_installed:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4544
                                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
  4545
                                    pkg_list = api.ImageInterface.LIST_INSTALLED)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4546
                        else:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4547
                                pubs.append(pub)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4548
                                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
  4549
                                    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
  4550
                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
  4551
                        # 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
  4552
                        # 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
  4553
                        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
  4554
                        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
  4555
                            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
  4556
                        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
  4557
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4558
                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
  4559
                    category_list, section_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4560
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
  4561
        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
  4562
                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
  4563
                #ImageInfo for categories
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4564
                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
  4565
                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
  4566
                        "usr/share/package-manager/data")
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4567
                if len(pubs) == 0:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4568
                        section = sectioninfo.read(os.path.join(share_path,
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4569
                                    "opensolaris.org.sections"))
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4570
                        sections["opensolaris.org"] = section
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4571
                        return sections
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  4572
                        
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  4573
                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
  4574
                        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
  4575
                                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
  4576
                        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
  4577
                            pub + ".sections"))
701
ba35d1b02c04 4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 697
diff changeset
  4578
                        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
  4579
                                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
  4580
                                    "opensolaris.org.sections"))
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1074
diff changeset
  4581
                        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
  4582
                        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
  4583
                                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
  4584
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4585
                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
  4586
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4587
        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
  4588
            application_list):
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4589
                status_str = _("Loading package list")
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4590
                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
  4591
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4592
                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
  4593
                    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
  4594
                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
  4595
                    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
  4596
28cb54b3370e 9519 Package Manager and Update Manager should not call misc.get_inventory_list
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1550
diff changeset
  4597
        def __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
  4598
            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
  4599
                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
  4600
                        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
  4601
                        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
  4602
                        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
  4603
                        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
  4604
                        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
  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
                        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
  4607
                                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
  4608
                                        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
  4609
                                        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
  4610
                                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
  4611
                                        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
  4612
                                        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
  4613
                        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
  4614
                                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
  4615
                                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
  4616
                        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
  4617
                        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
  4618
                        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
  4619
                        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
  4620
                                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
  4621
                                        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
  4622
                        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
  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
                                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
  4625
                                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
  4626
                            ]
28cb54b3370e 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
                        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
  4628
                        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
  4629
                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
  4630
28cb54b3370e 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
        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
  4632
            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
  4633
                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
  4634
                        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
  4635
                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
  4636
                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
  4637
                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
  4638
                        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
  4639
                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
  4640
                        (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
  4641
                        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
  4642
                                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
  4643
                        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
  4644
                            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
  4645
                        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
  4646
                        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
  4647
                        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
  4648
                                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
  4649
                                if api.PackageInfo.UPGRADABLE in states:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4650
                                        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
  4651
                                        pkg_state = enumerations.UPDATABLE
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4652
                                else:
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4653
                                        status_icon = self.installed_icon
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4654
                        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
  4655
                                pkg_state = enumerations.NOT_INSTALLED
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  4656
                                status_icon = self.not_installed_icon
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4657
                        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
  4658
                        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
  4659
                        if pkgs != None:
ac6a04f601a8 11278 PackageManager should maintain selections across searches and publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1413
diff changeset
  4660
                                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
  4661
                                        marked = True
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4662
                        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
  4663
                            [
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
  4664
                                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
  4665
                                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
  4666
                            ]
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
  4667
                        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
  4668
                            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
  4669
                            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
  4670
                            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
  4671
                        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
  4672
                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
  4673
                        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
  4674
                if category_list != None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4675
                        self.__add_categories_to_sections(sections,
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4676
                            category_list, section_list)
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4677
                return
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4678
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4679
        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
  4680
                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
  4681
                        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
  4682
                                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
  4683
                                        self.__add_category_to_section(_(category),
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4684
                                            _(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
  4685
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
  4686
                # 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
  4687
                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
  4688
                        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
  4689
                        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
  4690
                        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
  4691
                        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
  4692
                return
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  4693
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4694
        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
  4695
            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
  4696
                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
  4697
                if category_list == None:
82c30f24369f 6635 Need support Search across All Repositories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 942
diff changeset
  4698
                        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
  4699
                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
  4700
                        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
  4701
                        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
  4702
                                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
  4703
                                    row_iter, application_list,
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4704
                                    category_list)
825
5d8b3ed4c293 6002 Two entries appear in packagemanager for installed package
Padraig O'Briain <padraig.obriain@sun.com>
parents: 823
diff changeset
  4705
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
  4706
        @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
  4707
        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
  4708
            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
  4709
                if not package or category_name == 'All':
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4710
                        return
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4711
                if not category_name:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4712
                        return
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4713
                category_id = None
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  4714
                for category in category_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4715
                        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
  4716
                                category_id = category[enumerations.CATEGORY_ID]
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  4717
                                break
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4718
                if not category_id:                       # Category not exists
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4719
                        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
  4720
                        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
  4721
                            None, None])
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4722
                if application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4723
                    enumerations.CATEGORY_LIST_COLUMN):
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4724
                        a = application_list.get_value(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4725
                            enumerations.CATEGORY_LIST_COLUMN)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4726
                        a.append(category_id)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  4727
                else:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4728
                        category_list = []
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4729
                        category_list.append(category_id)
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4730
                        application_list.set(package,
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4731
                            enumerations.CATEGORY_LIST_COLUMN, category_list)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4732
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4733
        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
  4734
                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
  4735
                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
  4736
                            [ 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
  4737
1406
46c950f90950 11475 The PM category tree includes categories from other publishers
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1405
diff changeset
  4738
                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
  4739
                #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
  4740
                #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
  4741
                #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
  4742
                #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
  4743
                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
  4744
                        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
  4745
                                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
  4746
                        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
  4747
                                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
  4748
                        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
  4749
                                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
  4750
                                        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
  4751
                                                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
  4752
                                        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
  4753
                                                = 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
  4754
                                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
  4755
                                        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
  4756
                                                {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
  4757
                                                    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
  4758
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4759
                #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
  4760
                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
  4761
                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
  4762
                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
  4763
                        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
  4764
                        #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
  4765
                        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
  4766
                                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
  4767
                        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
  4768
                                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
  4769
                        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
  4770
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4771
                        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
  4772
                            [ 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
  4773
                            "<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
  4774
                            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
  4775
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4776
                        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
  4777
                                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
  4778
                        
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4779
                        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
  4780
                        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
  4781
                                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
  4782
                self.recent_searches_cat_iter = category_tree.append(None,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4783
                    [RECENT_SEARCH_ID,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4784
                    "<span foreground='#757575'><b>" + _("Recent Searches") +
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4785
                    "</b></span>", None, None])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4786
                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
  4787
                        for recent_search in self.recent_searches_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4788
                                category_tree.append(self.recent_searches_cat_iter, 
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4789
                                    self.recent_searches[recent_search])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4790
                
1341
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4791
                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
  4792
                
5109323388e9 10401 PM Search, Source and Filter UI adjustments to align with usability feedback
John Rice <john.rice@sun.com>
parents: 1333
diff changeset
  4793
                #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
  4794
                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
  4795
                        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
  4796
                            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
  4797
                        return
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4798
                self.__restore_category_state()
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4799
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4800
        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
  4801
                self.adding_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4802
                category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4803
                if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4804
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4805
                if self.is_all_publishers:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4806
                        pub_prefix = _("All Publishers")
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4807
                recent_search = "(%d) <b>%s</b> %s" % \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4808
                        (len(application_list), text, pub_prefix)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4809
                if not (recent_search in self.recent_searches):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4810
                        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
  4811
                            [RECENT_SEARCH_ID + 1, recent_search, text, application_list])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4812
                        self.recent_searches[recent_search] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4813
                                [RECENT_SEARCH_ID + 1, recent_search, text,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4814
                                application_list]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4815
                        self.recent_searches_list.append(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4816
                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4817
                        rs_iter = category_tree.iter_children(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4818
                            self.recent_searches_cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4819
                        while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4820
                                rs_value = category_tree.get_value(rs_iter,
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4821
                                    enumerations.CATEGORY_NAME)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4822
                                if rs_value == recent_search:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4823
                                        category_tree.remove(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4824
                                        break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4825
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4826
                        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
  4827
                            [RECENT_SEARCH_ID + 1, recent_search, text, application_list])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4828
                        self.recent_searches_list.remove(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4829
                        self.recent_searches_list.append(recent_search)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4830
                path = category_tree.get_path(cat_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4831
                self.w_categories_treeview.expand_to_path(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4832
                self.__unselect_category()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4833
                self.w_categories_treeview.scroll_to_cell(path)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4834
                self.adding_recent_search = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4835
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4836
        def __clear_recent_searches(self):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4837
                category_tree = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4838
                if category_tree == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4839
                        return                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4840
                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
  4841
                        return                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4842
                self.__set_searchentry_to_prompt()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4843
                selection, sel_path = self.__get_selection_and_category_path()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4844
                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
  4845
                while rs_iter:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4846
                        category_tree.remove(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4847
                        if category_tree.iter_is_valid(rs_iter):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4848
                                rs_iter = category_tree.iter_next(rs_iter)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4849
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4850
                                break
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4851
                del(self.recent_searches_list[:])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4852
                self.recent_searches.clear()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4853
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4854
                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
  4855
                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
  4856
                        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
  4857
                        self.__restore_setup_for_browse()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4858
                               
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4859
        def __restore_recent_search(self, sel_category):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4860
                if not sel_category:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4861
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4862
                if not self.is_all_publishers:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4863
                        self.__save_setup_before_search(single_search=True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4864
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4865
                application_list = sel_category[enumerations.SECTION_LIST_OBJECT]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4866
                text = sel_category[enumerations.CATEGORY_DESCRIPTION]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4867
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4868
                pkg_stems = []
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4869
                pkg_stem_states = {}
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4870
                for row in application_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4871
                        pkg_stems.append(row[enumerations.STEM_COLUMN])
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4872
                #Check for changes in pacakge installation status
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4873
                try:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4874
                        info = self.api_o.info(pkg_stems, True, frozenset(
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4875
                                    [api.PackageInfo.STATE, api.PackageInfo.IDENTITY]))
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4876
                        for info_s in info.get(0):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4877
                                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
  4878
                                    include_scheme = True)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4879
                                if api.PackageInfo.INSTALLED in info_s.states:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4880
                                        pkg_stem_states[pkg_stem] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4881
                                                enumerations.INSTALLED
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
                                        pkg_stem_states[pkg_stem] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4884
                                                enumerations.NOT_INSTALLED
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4885
                except (api_errors.TransportError):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4886
                        pass
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4887
                except (api_errors.InvalidDepotResponseException):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4888
                        pass
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4889
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4890
                #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
  4891
                tmp_app_list = self.__get_new_application_liststore()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4892
                
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4893
                for row in application_list:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4894
                        pkg_stem = row[enumerations.STEM_COLUMN]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4895
                        pub = row[enumerations.PUBLISHER_COLUMN]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4896
                        marked = False
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4897
                        pkgs = None
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4898
                        if self.selected_pkgs != None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4899
                                pkgs = self.selected_pkgs.get(pub)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4900
                        if pkgs != None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4901
                                if pkg_stem in pkgs:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4902
                                        marked = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4903
                        if row[enumerations.MARK_COLUMN] != marked:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4904
                                row[enumerations.MARK_COLUMN] = marked
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4905
                        
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4906
                        if pkg_stem_states.has_key(pkg_stem):
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4907
                                row[enumerations.STATUS_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4908
                                        pkg_stem_states[pkg_stem]
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4909
                                if pkg_stem_states[pkg_stem] == \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4910
                                        enumerations.NOT_INSTALLED:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4911
                                        row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4912
                                                self.not_installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4913
                                else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4914
                                        row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4915
                                                self.installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4916
                        else:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4917
                                row[enumerations.STATUS_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4918
                                        enumerations.NOT_INSTALLED
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4919
                                row[enumerations.STATUS_ICON_COLUMN] = \
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4920
                                        self.not_installed_icon
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4921
                        tmp_app_list.append(row)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4922
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4923
                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
  4924
                    unselect_cat=False)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4925
                self.in_search_mode = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4926
                self.in_recent_search = True
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4927
                self.__set_search_text_mode(enumerations.SEARCH_STYLE_NORMAL)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4928
                self.w_searchentry.set_text(text)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4929
                self.__set_main_view_package_list()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4930
                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
  4931
                    enumerations.NAME_COLUMN)
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4932
1440
9e86c7d8eb63 12021 Unset search reports traceback messages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1439
diff changeset
  4933
        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
  4934
                #Restore expanded Category state
1539
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4935
                if self.w_categories_treeview == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4936
                        return
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4937
                model = self.w_categories_treeview.get_model()
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4938
                if model == None:
608b666a9ced 12098 Recent search results
John Rice <john.rice@sun.com>
parents: 1533
diff changeset
  4939
                        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
  4940
                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
  4941
                        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
  4942
                        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
  4943
                                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
  4944
                                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
  4945
                                        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
  4946
                #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
  4947
                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
  4948
                        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
  4949
                        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
  4950
                            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
  4951
                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
  4952
                        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
  4953
                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
  4954
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  4955
        @staticmethod
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4956
        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
  4957
            section_list):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  4958
                '''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
  4959
                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
  4960
                is skipped. Sections must be case sensitive'''
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4961
                if not category_name:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4962
                        return
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4963
                for section in section_list:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4964
                        if section[enumerations.SECTION_NAME] == section_name:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4965
                                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
  4966
                                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
  4967
                                        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
  4968
                                            _(category[enumerations.CATEGORY_NAME])
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4969
                                        if category[enumerations.CATEGORY_NAME] == \
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4970
                                            category_name:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4971
                                                section_lst = category[ \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4972
                                                    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
  4973
                                                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
  4974
                                                    True
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4975
                                                if not section_lst:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4976
                                                        category[ \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4977
                                                    enumerations.SECTION_LIST_OBJECT] = \
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4978
                                                            [section_id, ]
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4979
                                                else:
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4980
                                                        if not section_name in \
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4981
                                                            section_lst:
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4982
                                                                section_lst.append(
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  4983
                                                                    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
  4984
                                break
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  4985
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4986
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4987
        def __progress_set_fraction(self, count, total):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4988
                self.__progress_pulse_stop()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4989
                if count == total:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4990
                        self.w_progress_frame.hide()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4991
                        return False
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4992
                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
  4993
                        self.progress_cancel.set_sensitive(True)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4994
                else:
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  4995
                        self.progress_cancel.set_sensitive(False)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4996
                self.w_progress_frame.show()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4997
                result = (count + 0.0)/total
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4998
                if result > 1.0:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  4999
                        result = 1.0
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5000
                elif result < 0.0:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5001
                        result = 0.0
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5002
                self.w_status_progressbar.set_fraction(result)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5003
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5004
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5005
        def __progress_pulse_start(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5006
                if self.progress_stop_thread == True:
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5007
                        self.progress_stop_thread = False
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5008
                        Thread(target = self.__progress_pulse).start()
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5009
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5010
        def __progress_pulse_stop(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5011
                self.progress_stop_thread = True
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5012
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5013
        def __progress_pulse(self):
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5014
                gobject.idle_add(self.w_progress_frame.show)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5015
                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
  5016
                        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
  5017
                                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
  5018
                        else:
1550
14df4437e8d2 12101 Package version information dialog
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1539
diff changeset
  5019
                                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
  5020
                                    False)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5021
                        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
  5022
                        time.sleep(0.1)
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5023
                gobject.idle_add(self.w_progress_frame.hide)
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5024
                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
  5025
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5026
        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
  5027
                if msg_title:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5028
                        title = msg_title
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5029
                else:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5030
                        title = _("Package Manager")
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5031
                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
  5032
                    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
  5033
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5034
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5035
# Static Methods
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5036
#-----------------------------------------------------------------------------#
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5037
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5038
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5039
        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
  5040
                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
  5041
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5042
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5043
        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
  5044
                '''Function which sets icon size'''
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5045
                if data == enumerations.FILTER_NAME:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5046
                        renderer.set_property("xalign", 0)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5047
                        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
  5048
                elif data == enumerations.FILTER_ICON:
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5049
                        renderer.set_property("xalign", 0)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5050
                        renderer.set_property("width", 24)
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5051
                return
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5052
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5053
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5054
        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
  5055
                '''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
  5056
                selected'''
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5057
                if itr:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5058
                        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
  5059
                                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
  5060
                                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
  5061
                        else:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5062
                                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
  5063
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5064
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5065
        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
  5066
                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
  5067
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5068
        @staticmethod
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5069
        def combobox_id_separator(model, itr):
896
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  5070
                return model.get_value(itr, 0) == -1 and \
9e8d60765dba 6982 Addition of Repository Dropdown
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 895
diff changeset
  5071
                    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
  5072
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5073
        @staticmethod
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5074
        def combobox_filter_id_separator(model, itr):
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5075
                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
  5076
                    model.get_value(itr, 2) == ""
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5077
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5078
        @staticmethod
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5079
        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
  5080
                dt = None
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5081
                try:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5082
                        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
  5083
                except AttributeError:
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5084
                        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
  5085
                return dt
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5086
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5087
        @staticmethod
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5088
        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
  5089
                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
  5090
                    [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
  5091
                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
  5092
                try:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5093
                        version = found[0]
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5094
                except IndexError:
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5095
                        version = None
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5096
                return version
500
e3ac4c2d99a1 1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents: 483
diff changeset
  5097
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5098
#-----------------------------------------------------------------------------#
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5099
# Public Methods
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5100
#-----------------------------------------------------------------------------#
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5101
        def init_show_filter(self):
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5102
                """ 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
  5103
                    labels it is displaying."""
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5104
                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
  5105
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5106
        def reload_packages(self):
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1165
diff changeset
  5107
                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
  5108
                    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
  5109
                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
  5110
                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
  5111
                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
  5112
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
  5113
        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
  5114
                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
  5115
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  5116
        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
  5117
                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
  5118
                        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
  5119
                        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
  5120
                            'busy', True)
1411
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  5121
                if not self.exiting:
f37688b2d3f0 11034 Packagemanager hangs if quit during catalog refresh
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1406
diff changeset
  5122
                        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
  5123
770
51cc59540c42 4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 757
diff changeset
  5124
        def unset_busy_cursor(self):
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5125
                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
  5126
                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
  5127
                        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
  5128
                        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
  5129
                            '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
  5130
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5131
        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
  5132
                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
  5133
                        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
  5134
                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
  5135
                if self.first_run:
28b257c5f33e 12266 Wrong focus in package manager on startup
John Rice <john.rice@sun.com>
parents: 1446
diff changeset
  5136
                        self.__update_reload_button()
28b257c5f33e 12266 Wrong focus in package manager on startup
John Rice <john.rice@sun.com>
parents: 1446
diff changeset
  5137
                        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
  5138
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
  5139
        @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
  5140
        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
  5141
                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
  5142
                return cache_o
b7593a33c0cf 6725 Add caching support for lists/categories
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 878
diff changeset
  5143
1219
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5144
        def __setup_search_completion(self):
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5145
                completion = gtk.EntryCompletion()
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5146
                if self.cache_o != None:
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5147
                        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
  5148
                completion.set_model(self.search_completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5149
                self.w_searchentry.set_completion(completion)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5150
                completion.set_text_column(0)
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5151
                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
  5152
8977dcf4ef8a 816 Provide Search Text completion
John Rice <john.rice@sun.com>
parents: 1218
diff changeset
  5153
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5154
        def process_package_list_end(self):
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  5155
                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
  5156
                if self.update_all_proceed:
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  5157
                        self.__on_update_all(None)
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  5158
                        self.update_all_proceed = False
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5159
                self.__enable_disable_install_remove()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5160
                self.update_statusbar()
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5161
                self.in_setup = False
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5162
                self.cancelled = False
1441
45be39b77b70 12097 Selections switching issue
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1440
diff changeset
  5163
                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
  5164
                if self.set_section != 0 or \
1441
45be39b77b70 12097 Selections switching issue
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1440
diff changeset
  5165
                    active_filter != enumerations.FILTER_ALL:
892
ff66cde11b73 6973 Initial Category
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 882
diff changeset
  5166
                        self.__application_refilter()
1092
533747c91289 8453 Simultaneous calls to load_catalogs on startup
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1087
diff changeset
  5167
                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
  5168
                        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
  5169
                                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
  5170
                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
  5171
                        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
  5172
                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
  5173
                        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
  5174
                                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
  5175
                                    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
  5176
                        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
  5177
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  5178
        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
  5179
                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
  5180
                    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
  5181
                    "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
  5182
                    icon_name)
827
a3fae94c1cce 5765 Enhancements to Categories
Padraig O'Briain <padraig.obriain@sun.com>
parents: 825
diff changeset
  5183
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
  5184
        def __count_selected_packages(self):
1566
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5185
                self.all_selected = 0
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5186
                for pub_name in self.selected_pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5187
                        pkgs = self.selected_pkgs.get(pub_name)
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5188
                        if not pkgs:
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5189
                                break
367d13217341 9801 PM Manage Installed Packages
John Rice <john.rice@sun.com>
parents: 1561
diff changeset
  5190
                        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
  5191
 
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5192
        def update_statusbar(self):
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5193
                '''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
  5194
                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
  5195
                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
  5196
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
  5197
                self.__count_selected_packages()
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5198
                if not self.in_search_mode:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5199
                        if self.application_list == None:
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5200
                                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
  5201
                        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
  5202
                        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
  5203
                        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
  5204
                                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
  5205
                                        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
  5206
                        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
  5207
                                {"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
  5208
                                "selected": selected_in_list}
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5209
                        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
  5210
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5211
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5212
                # 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
  5213
                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
  5214
                        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
  5215
                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
  5216
                        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
  5217
                        e1 = "</b>"
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5218
                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
  5219
                        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
  5220
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  5221
                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
  5222
                        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
  5223
                        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
  5224
                        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
  5225
                                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
  5226
                                        _("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
  5227
                                        " 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
  5228
                                        {"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
  5229
                                        "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
  5230
                        else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  5231
                                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
  5232
                                        _("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
  5233
                                        "...") % \
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  5234
                                        {"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
  5235
                else:
768bf44266e9 11669 Enhance handling of Search All Publishers to match current UI Spec
John Rice <john.rice@sun.com>
parents: 1395
diff changeset
  5236
                        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
  5237
                                _("%(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
  5238
                                "%(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
  5239
                                {"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
  5240
                                    "s1": s1, "search_text": search_text, "e1": e1, }
1236
15707d6de40b 6972 Progress in StatusBar
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1233
diff changeset
  5241
                self.__update_statusbar_message(status_str)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5242
1333
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5243
        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
  5244
                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
  5245
                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
  5246
                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
  5247
                        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
  5248
                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
  5249
                    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
  5250
                package_installed =  False
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5251
                if package_info:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5252
                        package_installed =  \
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  5253
                            (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
  5254
                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
  5255
                        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
  5256
                            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
  5257
                        if (package_info and
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1459
diff changeset
  5258
                            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
  5259
                                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
  5260
                                    enumerations.INSTALLED
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5261
                                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
  5262
                                    self.installed_icon
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5263
                        else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5264
                                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
  5265
                                    enumerations.UPDATABLE
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5266
                                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
  5267
                                    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
  5268
                else:
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5269
                        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
  5270
                            enumerations.NOT_INSTALLED
618b99a9d8e7 6253 In Packagemanager package shows wrong status after installation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1332
diff changeset
  5271
                        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
  5272
                            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
  5273
                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
  5274
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
  5275
        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
  5276
                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
  5277
                        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
  5278
                                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
  5279
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
  5280
        @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
  5281
        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
  5282
                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
  5283
                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
  5284
                        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
  5285
                        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
  5286
                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
  5287
868
3ccd83eaeaf9 6439 Accessible image descriptions not correct after sorting
Padraig O'Briain <padraig.obriain@sun.com>
parents: 866
diff changeset
  5288
        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
  5289
                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
  5290
                        return
1206
9ad95431706f 9710 PM search should return results incrementally
John Rice <john.rice@sun.com>
parents: 1203
diff changeset
  5291
                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
  5292
                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
  5293
                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
  5294
                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
  5295
                        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
  5296
                        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
  5297
                        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
  5298
                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
  5299
                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
  5300
                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
  5301
                        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
  5302
                                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
  5303
                                        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
  5304
                                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
  5305
                                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
  5306
                                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
  5307
                                        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
  5308
                                            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
  5309
                                            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
  5310
                                        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
  5311
                                            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
  5312
                                            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
  5313
                                        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
  5314
                                                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
  5315
                                                        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
  5316
                                                        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
  5317
                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
  5318
                        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
  5319
                        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
  5320
                                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
  5321
                        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
  5322
                                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
  5323
                                        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
  5324
                                        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
  5325
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
  5326
                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
  5327
                        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
  5328
                                pkg_list = update_list.get(pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5329
                                for pkg in pkg_list:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5330
                                        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
  5331
                                        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
  5332
                                                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
  5333
                                                    pkg, pub)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5334
                                        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
  5335
                                                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
  5336
                                                    pkg)
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5337
                                        if pkg_stem:
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5338
                                                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
  5339
                                                        del self.info_cache[pkg_stem]
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5340
                                                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
  5341
                # 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
  5342
                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
  5343
                self.__process_package_selection()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5344
                self.__enable_disable_selection_menus()
871
9fc6dca6583b 6516 split the repository data models
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 869
diff changeset
  5345
                self.__enable_disable_install_remove()
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5346
                self.update_statusbar()
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5347
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
  5348
        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
  5349
                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
  5350
                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
  5351
                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
  5352
                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
  5353
                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
  5354
                    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
  5355
                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
  5356
                        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
  5357
                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
  5358
                    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
  5359
1555
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5360
        def __reset_home_dir(self):
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5361
                # 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
  5362
                # 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
  5363
                # 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
  5364
                if os.getuid() == 0:
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5365
                        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
  5366
                        os.putenv('HOME', home_dir)
20c7e2600d0d 13077 Help button for Export Selections Confirmation
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1554
diff changeset
  5367
1028
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5368
        @staticmethod
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5369
        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
  5370
                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
  5371
                 
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5372
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5373
                        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
  5374
                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
  5375
                        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
  5376
                                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
  5377
                        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
  5378
                try:
4a3a17ce4334 7852 Package Manager fails at startup with NFS mounted home dir
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1024
diff changeset
  5379
                        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
  5380
                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
  5381
                        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
  5382
                                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
  5383
                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
  5384
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
  5385
        @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
  5386
        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
  5387
                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
  5388
                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
  5389
                        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
  5390
                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
  5391
                        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
  5392
                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
  5393
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5394
        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
  5395
                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
  5396
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5397
        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
  5398
                if exit_pm == True:
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5399
                        self.__on_mainwindow_delete_event(None, None)
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5400
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5401
        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
  5402
                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
  5403
                    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
  5404
                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
  5405
                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
  5406
                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
  5407
                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
  5408
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5409
        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
  5410
                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
  5411
                
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5412
        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
  5413
                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
  5414
                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
  5415
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5416
###############################################################################
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5417
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5418
# Main
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5419
#-----------------------------------------------------------------------------#
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5420
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5421
def main():
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5422
        gtk.main()
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5423
        return 0
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5425
if __name__ == '__main__':
866
1768eb95fd29 6355 Add StartPage to PM
John Rice <john.rice@sun.com>
parents: 865
diff changeset
  5426
        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
  5427
        debug_perf = False
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5428
        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
  5429
        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
  5430
        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
  5431
        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
  5432
        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
  5433
        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
  5434
        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
  5435
        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
  5436
            "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
  5437
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5438
        try:
1487
2c36e9347c4f 12099 Change the be rename sequence in Update All.
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1481
diff changeset
  5439
                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
  5440
                    ["help", "image-dir=", "update-all", "info-install="])
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5441
        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
  5442
                print "%s, for help use --help" % msg
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5443
                sys.exit(2)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  5444
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
  5445
        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
  5446
                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
  5447
        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
  5448
                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
  5449
                app_path = os.path.realpath(cmd)
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  5450
450
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  5451
        for option, argument in opts:
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5452
                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
  5453
                        print """\
579517b41de2 1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents: 424
diff changeset
  5454
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
  5455
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
  5456
                        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
  5457
                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
  5458
                        image_dir = argument
823
0db1bfc6d455 4848 PM fails with a blank error message
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 821
diff changeset
  5459
                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
  5460
                        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
  5461
                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
  5462
                        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
  5463
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5464
        if image_dir == None:
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  5465
                try:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5466
                        image_dir = os.environ["PKG_IMAGE"]
457
9ee1bf88afb2 1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents: 450
diff changeset
  5467
                except KeyError:
483
2110c070804c #2735: pylint_gui_cleanup
John Rice <john.rice@sun.com>
parents: 457
diff changeset
  5468
                        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
  5469
        try:
5f9ba0da1277 9441 packagemanager dumps core if X-server display is not available
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1139
diff changeset
  5470
                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
  5471
        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
  5472
                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
  5473
                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
  5474
                sys.exit(1)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5475
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5476
        # Setup webinstall
1497
a98b3c4931f9 12297 Change Update All to Check for Updates
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1495
diff changeset
  5477
        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
  5478
                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
  5479
                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
  5480
                        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
  5481
                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
  5482
                main()
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5483
                sys.exit(0)
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 995
diff changeset
  5484
927
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5485
        # Setup packagemanager
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5486
        packagemanager = PackageManager()
2beb452e6245 6352 Add MimeType support for adding Authorities and Packages via PM
John Rice <john.rice@sun.com>
parents: 925
diff changeset
  5487
        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
  5488
        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
  5489
        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
  5490
577
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5491
        while gtk.events_pending():
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5492
                gtk.main_iteration(False)
cd4e8df4322b 873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 576
diff changeset
  5493
1213
7ae0d11a54b6 9936 PM show filter usability enhancements
John Rice <john.rice@sun.com>
parents: 1212
diff changeset
  5494
        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
  5495
1455
2a76c8548981 12172 PM going blank on upgrade from b122 to b125
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1450
diff changeset
  5496
        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
  5497
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff changeset
  5498
        main()