author | Michal Pryc <Michal.Pryc@Sun.Com> |
Fri, 07 Nov 2008 20:28:02 +0000 | |
changeset 714 | cd9870c8faae |
parent 701 | ba35d1b02c04 |
child 724 | f67376f059f7 |
permissions | -rw-r--r-- |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.4 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
4 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
8 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
13 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
19 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
21 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
22 |
# Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
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 |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
26 |
# Progress: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
27 |
# Startup Progress has two phases: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
28 |
# - Start phase: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
29 |
# The start phase should be fairly constant at around a few seconds and so is given 5% |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
30 |
# of the total progress bar. |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
31 |
# - Package entry loading phase: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
32 |
# The package entry loading phase is given the remaining 95% of the bar for progress. |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
33 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
34 |
INITIAL_PROGRESS_TIME_INTERVAL = 0.5 # Time to update progress during start phase |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
35 |
INITIAL_PROGRESS_TIME_PERCENTAGE = 0.005 # Amount to update progress during start phase |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
36 |
INITIAL_PROGRESS_TOTAL_PERCENTAGE = 0.05 # Total progress for start phase |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
37 |
PACKAGE_PROGRESS_TOTAL_INCREMENTS = 95 # Total increments for loading phase |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
38 |
PACKAGE_PROGRESS_PERCENT_INCREMENT = 0.01 # Amount to update progress during loading phase |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
39 |
PACKAGE_PROGRESS_PERCENT_TOTAL = 1.0 # Total progress for loading phase |
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
|
40 |
MAX_DESC_LEN = 60 # Max length of the description |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
41 |
MAX_INFO_CACHE_LIMIT = 100 # Max number of package descriptions to cache |
697 | 42 |
TYPE_AHEAD_DELAY = 600 # Time of the last type in search box after which search is performed |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
43 |
|
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
|
44 |
CLIENT_API_VERSION = 4 |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
45 |
PKG_CLIENT_NAME = "packagemanager" |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
46 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
47 |
import getopt |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
48 |
import os |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
49 |
import sys |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
50 |
import time |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
51 |
import locale |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
52 |
import urlparse |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
53 |
import socket |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
54 |
import gettext |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
55 |
from threading import Thread |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
56 |
from urllib2 import HTTPError, URLError |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
57 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
58 |
try: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
59 |
import gobject |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
60 |
import gnome |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
61 |
gobject.threads_init() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
62 |
import gtk |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
63 |
import gtk.glade |
483 | 64 |
import pygtk |
65 |
pygtk.require("2.0") |
|
66 |
except ImportError: |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
67 |
sys.exit(1) |
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
537
diff
changeset
|
68 |
import pkg.client.history as history |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
69 |
import pkg.client.image as image |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
70 |
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
|
71 |
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
|
72 |
import pkg.client.api as api |
562
afe71b27984d
3618 Manifest retrieval error needs more info and to not show a traceback
Brock Pytlik <bpytlik@sun.com>
parents:
561
diff
changeset
|
73 |
import pkg.client.retrieve as retrieve |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
74 |
import pkg.portable as portable |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
75 |
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
|
76 |
import pkg.gui.beadmin as beadm |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
77 |
import pkg.gui.imageinfo as imageinfo |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
78 |
import pkg.gui.installupdate as installupdate |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
79 |
import pkg.gui.enumerations as enumerations |
576
6ee6de304041
3777 PKG_TIMEOUT_MAX is a placebo setting
Dan Price <dp@eng.sun.com>
parents:
565
diff
changeset
|
80 |
from pkg.client import global_settings |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
81 |
|
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
82 |
# 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
|
83 |
import __builtin__ |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
84 |
__builtin__._ = gettext.gettext |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
85 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
86 |
class PackageManager: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
87 |
def __init__(self): |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
88 |
self.api_o = None |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
89 |
socket.setdefaulttimeout( |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
90 |
int(os.environ.get("PKG_CLIENT_TIMEOUT", "30"))) # in seconds |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
91 |
|
576
6ee6de304041
3777 PKG_TIMEOUT_MAX is a placebo setting
Dan Price <dp@eng.sun.com>
parents:
565
diff
changeset
|
92 |
# Override default PKG_TIMEOUT_MAX if a value has been specified |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
93 |
# in the environment. |
576
6ee6de304041
3777 PKG_TIMEOUT_MAX is a placebo setting
Dan Price <dp@eng.sun.com>
parents:
565
diff
changeset
|
94 |
global_settings.PKG_TIMEOUT_MAX = int(os.environ.get("PKG_TIMEOUT_MAX", |
6ee6de304041
3777 PKG_TIMEOUT_MAX is a placebo setting
Dan Price <dp@eng.sun.com>
parents:
565
diff
changeset
|
95 |
global_settings.PKG_TIMEOUT_MAX)) |
696
6bbfd2dece6f
4371 user-agent string needs to be different for different client front-ends
Danek Duvall <danek.duvall@sun.com>
parents:
660
diff
changeset
|
96 |
|
6bbfd2dece6f
4371 user-agent string needs to be different for different client front-ends
Danek Duvall <danek.duvall@sun.com>
parents:
660
diff
changeset
|
97 |
global_settings.client_name = PKG_CLIENT_NAME |
483 | 98 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
99 |
try: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
100 |
self.application_dir = os.environ["PACKAGE_MANAGER_ROOT"] |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
101 |
except KeyError: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
102 |
self.application_dir = "/" |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
103 |
locale.setlocale(locale.LC_ALL, '') |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
104 |
for module in (gettext, gtk.glade): |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
105 |
module.bindtextdomain("pkg", self.application_dir + \ |
483 | 106 |
"/usr/share/locale") |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
107 |
module.textdomain("pkg") |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
108 |
# XXX Remove and use _() where self._ and self.parent._ are being used |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
109 |
self._ = gettext.gettext |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
110 |
main_window_title = self._('Package Manager') |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
111 |
self.user_rights = portable.is_admin() |
483 | 112 |
self.cancelled = False # For background processes |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
113 |
self.image_directory = None |
483 | 114 |
self.description_thread_running = False # For background processes |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
115 |
self.pkginfo_thread = -1 # For background processes |
483 | 116 |
gtk.rc_parse('~/.gtkrc-1.2-gnome2') # Load gtk theme |
117 |
self.main_clipboard_text = None |
|
118 |
self.ipkg_fmri = "SUNWipkg" |
|
119 |
self.ipkggui_fmri = "SUNWipkg-gui" |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
120 |
self.progress_stop_timer_thread = False |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
121 |
self.progress_fraction_time_count = 0 |
483 | 122 |
self.progress_canceled = False |
123 |
self.ips_uptodate = False |
|
124 |
self.image_dir_arg = None |
|
125 |
self.application_path = None |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
126 |
self.first_run = True |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
127 |
self.provided_image_dir = True |
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
|
128 |
self.selected_pkgname = None |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
129 |
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
|
130 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
131 |
self.section_list = self.__get_new_section_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
132 |
self.filter_list = self.__get_new_filter_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
133 |
self.application_list = None |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
134 |
self.category_list = None |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
135 |
self.repositories_list = None |
483 | 136 |
|
137 |
self.pr = progress.NullProgressTracker() |
|
138 |
||
139 |
# Create Widgets and show gui |
|
140 |
||
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
141 |
self.gladefile = self.application_dir + \ |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
142 |
"/usr/share/package-manager/packagemanager.glade" |
483 | 143 |
w_tree_main = gtk.glade.XML(self.gladefile, "mainwindow") |
144 |
w_tree_progress = gtk.glade.XML(self.gladefile, "progressdialog") |
|
145 |
||
146 |
self.w_main_window = w_tree_main.get_widget("mainwindow") |
|
147 |
self.w_application_treeview = \ |
|
148 |
w_tree_main.get_widget("applicationtreeview") |
|
149 |
self.w_categories_treeview = w_tree_main.get_widget("categoriestreeview") |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
150 |
self.w_info_notebook = w_tree_main.get_widget("notebook1") |
483 | 151 |
self.w_generalinfo_textview = \ |
152 |
w_tree_main.get_widget("generalinfotextview") |
|
153 |
self.w_installedfiles_textview = \ |
|
154 |
w_tree_main.get_widget("installedfilestextview") |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
155 |
self.w_license_textview = \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
156 |
w_tree_main.get_widget("licensetextview") |
483 | 157 |
self.w_dependencies_textview = \ |
158 |
w_tree_main.get_widget("dependenciestextview") |
|
159 |
self.w_packagename_label = w_tree_main.get_widget("packagenamelabel") |
|
160 |
self.w_shortdescription_label = \ |
|
161 |
w_tree_main.get_widget("shortdescriptionlabel") |
|
162 |
self.w_searchentry_dialog = w_tree_main.get_widget("searchentry") |
|
163 |
self.w_installupdate_button = \ |
|
164 |
w_tree_main.get_widget("install_update_button") |
|
165 |
self.w_remove_button = w_tree_main.get_widget("remove_button") |
|
166 |
self.w_updateall_button = w_tree_main.get_widget("update_all_button") |
|
167 |
self.w_reload_button = w_tree_main.get_widget("reloadbutton") |
|
168 |
self.w_repository_combobox = w_tree_main.get_widget("repositorycombobox") |
|
169 |
self.w_sections_combobox = w_tree_main.get_widget("sectionscombobox") |
|
170 |
self.w_filter_combobox = w_tree_main.get_widget("filtercombobox") |
|
171 |
self.w_packageicon_image = w_tree_main.get_widget("packageimage") |
|
172 |
self.w_main_statusbar = w_tree_main.get_widget("statusbar") |
|
173 |
self.w_installupdate_menuitem = \ |
|
174 |
w_tree_main.get_widget("package_install_update") |
|
175 |
self.w_remove_menuitem = w_tree_main.get_widget("package_remove") |
|
176 |
self.w_updateall_menuitem = w_tree_main.get_widget("package_update_all") |
|
177 |
self.w_cut_menuitem = w_tree_main.get_widget("edit_cut") |
|
178 |
self.w_copy_menuitem = w_tree_main.get_widget("edit_copy") |
|
179 |
self.w_paste_menuitem = w_tree_main.get_widget("edit_paste") |
|
180 |
self.w_clear_menuitem = w_tree_main.get_widget("edit_clear") |
|
181 |
self.w_selectall_menuitem = w_tree_main.get_widget("edit_select_all") |
|
182 |
self.w_selectupdates_menuitem = \ |
|
183 |
w_tree_main.get_widget("edit_select_updates") |
|
184 |
self.w_deselect_menuitem = w_tree_main.get_widget("edit_deselect") |
|
185 |
self.w_main_clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD) |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
186 |
|
483 | 187 |
self.w_progress_dialog = w_tree_progress.get_widget("progressdialog") |
188 |
self.w_progress_dialog.set_title(self._("Update All")) |
|
189 |
self.w_progressinfo_label = w_tree_progress.get_widget("progressinfo") |
|
190 |
self.w_progressinfo_label.set_text(self._( \ |
|
191 |
"Checking SUNWipkg and SUNWipkg-gui versions\n\nPlease wait ...")) |
|
192 |
self.w_progressbar = w_tree_progress.get_widget("progressbar") |
|
193 |
self.w_progressbar.set_pulse_step(0.1) |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
194 |
self.w_progress_cancel = w_tree_progress.get_widget("progresscancel") |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
195 |
self.progress_canceled = False |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
196 |
clear_search_image = w_tree_main.get_widget("clear_image") |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
197 |
clear_search_image.set_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_MENU) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
198 |
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
|
199 |
toolbar.set_expand(True) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
200 |
|
483 | 201 |
self.__update_reload_button() |
202 |
self.w_main_clipboard.request_text(self.__clipboard_text_received) |
|
203 |
self.w_main_window.set_title(main_window_title) |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
204 |
|
483 | 205 |
try: |
206 |
dic_mainwindow = \ |
|
207 |
{ |
|
208 |
"on_mainwindow_delete_event": \ |
|
209 |
self.__on_mainwindow_delete_event, |
|
210 |
"on_searchentry_changed":self.__on_searchentry_changed, |
|
211 |
"on_searchentry_focus_in_event": \ |
|
212 |
self.__on_searchentry_focus_in, |
|
213 |
"on_searchentry_focus_out_event": \ |
|
214 |
self.__on_searchentry_focus_out, |
|
215 |
"on_searchentry_event":self.__on_searchentry_event, |
|
216 |
"on_sectionscombobox_changed": \ |
|
217 |
self.__on_sectionscombobox_changed, |
|
218 |
"on_filtercombobox_changed": \ |
|
219 |
self.__on_filtercombobox_changed, |
|
220 |
"on_repositorycombobox_changed": \ |
|
221 |
self.__on_repositorycombobox_changed, |
|
222 |
#menu signals |
|
223 |
"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
|
224 |
"on_file_be_activate":self.__on_file_be_activate, |
483 | 225 |
"on_package_install_update_activate": \ |
226 |
self.__on_install_update, |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
227 |
"on_settings_edit_repositories_activate": \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
228 |
self.__on_edit_repositories_activate, |
483 | 229 |
"on_package_remove_activate":self.__on_remove, |
230 |
"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
|
231 |
"on_help_help_activate":self.__on_help_help, |
483 | 232 |
"on_edit_paste_activate":self.__on_edit_paste, |
233 |
"on_edit_clear_activate":self.__on_clear_paste, |
|
234 |
"on_edit_copy_activate":self.__on_copy, |
|
235 |
"on_edit_cut_activate":self.__on_cut, |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
236 |
"on_clear_search_clicked":self.__on_clear_search, |
483 | 237 |
"on_edit_select_all_activate":self.__on_select_all, |
238 |
"on_edit_select_updates_activate": \ |
|
239 |
self.__on_select_updates, |
|
240 |
"on_edit_deselect_activate":self.__on_deselect, |
|
241 |
# XXX disabled until new API |
|
242 |
"on_package_update_all_activate":self.__on_update_all, |
|
243 |
#toolbar signals |
|
244 |
# XXX disabled until new API |
|
245 |
"on_update_all_button_clicked":self.__on_update_all, |
|
246 |
"on_reload_button_clicked":self.__on_reload, |
|
247 |
"on_install_update_button_clicked": \ |
|
248 |
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
|
249 |
"on_remove_button_clicked":self.__on_remove, |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
250 |
"on_notebook1_switch_page": \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
251 |
self.__on_notebook_change, |
483 | 252 |
} |
253 |
dic_progress = \ |
|
254 |
{ |
|
255 |
"on_cancel_progressdialog_clicked": \ |
|
256 |
self.__on_cancel_progressdialog_clicked, |
|
257 |
} |
|
258 |
w_tree_main.signal_autoconnect(dic_mainwindow) |
|
259 |
w_tree_progress.signal_autoconnect(dic_progress) |
|
260 |
except AttributeError, error: |
|
261 |
print self._( \ |
|
262 |
'GUI will not respond to any event! %s.' + \ |
|
263 |
'Check declare_signals()') \ |
|
264 |
% error |
|
265 |
||
266 |
self.package_selection = None |
|
267 |
self.category_list_filter = None |
|
697 | 268 |
self.application_list_filter = None |
269 |
self.application_refilter_id = 0 |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
270 |
self.in_setup = True |
483 | 271 |
self.w_main_window.show_all() |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
272 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
273 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
274 |
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
|
275 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
276 |
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
|
277 |
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
|
278 |
gtk.gdk.Pixbuf, # enumerations.ICON_COLUMN |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
279 |
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
|
280 |
gobject.TYPE_STRING, # enumerations.INSTALLED_VERSION_COLUMN |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
281 |
gobject.TYPE_PYOBJECT, # enumerations.INSTALLED_OBJECT_COLUMN |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
282 |
gobject.TYPE_STRING, # enumerations.LATEST_AVAILABLE_COLUMN |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
283 |
gobject.TYPE_INT, # enumerations.RATING_COLUMN |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
284 |
gobject.TYPE_STRING, # enumerations.DESCRIPTION_COLUMN |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
285 |
gobject.TYPE_PYOBJECT, # enumerations.PACKAGE_OBJECT_COLUMN |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
286 |
gobject.TYPE_BOOLEAN, # enumerations.IS_VISIBLE_COLUMN |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
287 |
gobject.TYPE_PYOBJECT # enumerations.CATEGORY_LIST_OBJECT |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
288 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
289 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
290 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
291 |
def __get_new_category_liststore(): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
292 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
293 |
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
|
294 |
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
|
295 |
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
|
296 |
gtk.gdk.Pixbuf, # enumerations.CATEGORY_ICON |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
297 |
gobject.TYPE_BOOLEAN, # enumerations.CATEGORY_VISIBLE |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
298 |
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
|
299 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
300 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
301 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
302 |
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
|
303 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
304 |
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
|
305 |
gobject.TYPE_STRING, # enumerations.SECTION_NAME |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
306 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
307 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
308 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
309 |
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
|
310 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
311 |
gobject.TYPE_INT, # enumerations.FILTER_ID |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
312 |
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
|
313 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
314 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
315 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
316 |
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
|
317 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
318 |
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
|
319 |
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
|
320 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
321 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
322 |
def __init_tree_views(self, application_list, category_list, repositories_list): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
323 |
'''This function connects treeviews with their models and also applies |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
324 |
filters''' |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
325 |
self.__disconnect_models() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
326 |
self.__remove_treeview_columns(self.w_application_treeview) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
327 |
self.__remove_treeview_columns(self.w_categories_treeview) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
328 |
##APPLICATION MAIN TREEVIEW |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
329 |
application_list_filter = application_list.filter_new() |
483 | 330 |
application_list_sort = \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
331 |
gtk.TreeModelSort(application_list_filter) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
332 |
application_list_sort.set_sort_column_id(\ |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
333 |
enumerations.NAME_COLUMN, gtk.SORT_ASCENDING) |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
334 |
application_list_sort.set_sort_func(\ |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
335 |
enumerations.STATUS_ICON_COLUMN, self.__status_sort_func) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
336 |
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
|
337 |
|
483 | 338 |
column = gtk.TreeViewColumn("", toggle_renderer, \ |
339 |
active = enumerations.MARK_COLUMN) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
340 |
column.set_sort_column_id(enumerations.MARK_COLUMN) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
341 |
column.set_sort_indicator(True) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
342 |
column.set_cell_data_func(toggle_renderer, self.cell_data_function, None) |
483 | 343 |
self.w_application_treeview.append_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
344 |
column = gtk.TreeViewColumn() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
345 |
column.set_title("") |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
346 |
#Commented, since there was funny jumping of the icons |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
347 |
#column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
348 |
render_pixbuf = gtk.CellRendererPixbuf() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
349 |
column.pack_start(render_pixbuf, expand = False) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
350 |
column.add_attribute(render_pixbuf, "pixbuf", enumerations.ICON_COLUMN) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
351 |
column.set_fixed_width(32) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
352 |
column.set_cell_data_func(render_pixbuf, self.cell_data_function, None) |
483 | 353 |
self.w_application_treeview.append_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
354 |
name_renderer = gtk.CellRendererText() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
355 |
column = gtk.TreeViewColumn(self._("Name"), name_renderer, \ |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
356 |
text = enumerations.NAME_COLUMN) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
357 |
column.set_resizable(True) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
358 |
column.set_sort_column_id(enumerations.NAME_COLUMN) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
359 |
column.set_sort_indicator(True) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
360 |
column.set_cell_data_func(name_renderer, self.cell_data_function, None) |
483 | 361 |
self.w_application_treeview.append_column(column) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
362 |
column = gtk.TreeViewColumn() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
363 |
column.set_title(self._("Status")) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
364 |
#Commented, since there was funny jumping of the icons |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
365 |
#column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
366 |
render_pixbuf = gtk.CellRendererPixbuf() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
367 |
column.pack_start(render_pixbuf, expand = True) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
368 |
column.add_attribute(render_pixbuf, "pixbuf", \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
369 |
enumerations.STATUS_ICON_COLUMN) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
370 |
column.set_fixed_width(32) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
371 |
column.set_sort_column_id(enumerations.STATUS_ICON_COLUMN) |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
372 |
column.set_sort_indicator(True) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
373 |
column.set_cell_data_func(render_pixbuf, self.cell_data_function, None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
374 |
self.w_application_treeview.append_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
375 |
installed_version_renderer = gtk.CellRendererText() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
376 |
column = gtk.TreeViewColumn(self._('Installed Version'), \ |
483 | 377 |
installed_version_renderer, \ |
378 |
text = enumerations.INSTALLED_VERSION_COLUMN) |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
379 |
column.set_sort_column_id(enumerations.INSTALLED_VERSION_COLUMN) |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
380 |
column.set_sort_indicator(True) |
483 | 381 |
column.set_cell_data_func(installed_version_renderer, \ |
382 |
self.cell_data_function, None) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
383 |
latest_available_renderer = gtk.CellRendererText() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
384 |
column = gtk.TreeViewColumn(self._('Latest Version'), \ |
483 | 385 |
latest_available_renderer, \ |
386 |
text = enumerations.LATEST_AVAILABLE_COLUMN) |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
387 |
column.set_sort_column_id(enumerations.LATEST_AVAILABLE_COLUMN) |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
388 |
column.set_sort_indicator(True) |
483 | 389 |
column.set_cell_data_func(latest_available_renderer, \ |
390 |
self.cell_data_function, None) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
391 |
rating_renderer = gtk.CellRendererText() |
483 | 392 |
column = gtk.TreeViewColumn(self._('Rating'), rating_renderer, \ |
393 |
text = enumerations.RATING_COLUMN) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
394 |
column.set_cell_data_func(rating_renderer, self.cell_data_function, None) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
395 |
description_renderer = gtk.CellRendererText() |
483 | 396 |
column = gtk.TreeViewColumn(self._('Description'), \ |
397 |
description_renderer, text = enumerations.DESCRIPTION_COLUMN) |
|
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
398 |
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
|
399 |
column.set_sort_column_id(enumerations.DESCRIPTION_COLUMN) |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
400 |
column.set_sort_indicator(True) |
483 | 401 |
column.set_cell_data_func(description_renderer, \ |
402 |
self.cell_data_function, None) |
|
403 |
self.w_application_treeview.append_column(column) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
404 |
#Added selection listener |
483 | 405 |
self.package_selection = self.w_application_treeview.get_selection() |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
406 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
407 |
##CATEGORIES TREEVIEW |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
408 |
#enumerations.CATEGORY_NAME |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
409 |
category_list_filter = category_list.filter_new() |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
410 |
enumerations.CATEGORY_NAME_renderer = gtk.CellRendererText() |
483 | 411 |
column = gtk.TreeViewColumn(self._('Name'), \ |
412 |
enumerations.CATEGORY_NAME_renderer, \ |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
413 |
text = enumerations.CATEGORY_NAME) |
483 | 414 |
self.w_categories_treeview.append_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
415 |
#Added selection listener |
483 | 416 |
category_selection = self.w_categories_treeview.get_selection() |
417 |
category_selection.set_mode(gtk.SELECTION_SINGLE) |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
418 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
419 |
if self.first_run: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
420 |
##SECTION COMBOBOX |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
421 |
#enumerations.SECTION_NAME |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
422 |
cell = gtk.CellRendererText() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
423 |
self.w_sections_combobox.pack_start(cell, True) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
424 |
self.w_sections_combobox.add_attribute(cell, 'text', \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
425 |
enumerations.SECTION_NAME) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
426 |
self.w_sections_combobox.set_row_separator_func( \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
427 |
self.combobox_id_separator) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
428 |
##FILTER COMBOBOX |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
429 |
#enumerations.FILTER_NAME |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
430 |
cell = gtk.CellRendererText() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
431 |
self.w_filter_combobox.pack_start(cell, True) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
432 |
self.w_filter_combobox.add_attribute(cell, 'text', \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
433 |
enumerations.FILTER_NAME) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
434 |
self.w_filter_combobox.set_row_separator_func(\ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
435 |
self.combobox_id_separator) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
436 |
##FILTER COMBOBOX |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
437 |
#enumerations.FILTER_NAME |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
438 |
cell = gtk.CellRendererText() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
439 |
self.w_repository_combobox.pack_start(cell, True) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
440 |
self.w_repository_combobox.add_attribute(cell, 'text', \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
441 |
enumerations.REPOSITORY_NAME) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
442 |
self.w_repository_combobox.set_row_separator_func( \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
443 |
self.combobox_id_separator) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
444 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
445 |
self.application_list = application_list |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
446 |
self.category_list = category_list |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
447 |
self.repositories_list = repositories_list |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
448 |
self.category_list_filter = category_list_filter |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
449 |
self.application_list_filter = application_list_filter |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
450 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
451 |
self.w_sections_combobox.set_model(self.section_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
452 |
self.w_sections_combobox.set_active(0) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
453 |
self.w_filter_combobox.set_model(self.filter_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
454 |
self.w_filter_combobox.set_active(0) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
455 |
self.w_repository_combobox.set_model(repositories_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
456 |
self.w_categories_treeview.set_model(category_list_filter) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
457 |
self.w_application_treeview.set_model(application_list_sort) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
458 |
application_list_filter.set_visible_func(self.__application_filter) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
459 |
category_list_filter.set_visible_func(self.category_filter) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
460 |
toggle_renderer.connect('toggled', self.__active_pane_toggle, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
461 |
application_list_sort) |
483 | 462 |
category_selection.connect("changed", \ |
463 |
self.__on_category_selection_changed, None) |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
464 |
self.package_selection.set_mode(gtk.SELECTION_SINGLE) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
465 |
self.package_selection.connect("changed", \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
466 |
self.__on_package_selection_changed, None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
467 |
self.first_run = False |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
468 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
469 |
def __disconnect_models(self): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
470 |
self.w_application_treeview.set_model(None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
471 |
self.w_categories_treeview.set_model(None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
472 |
self.w_repository_combobox.set_model(None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
473 |
self.w_sections_combobox.set_model(None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
474 |
self.w_filter_combobox.set_model(None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
475 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
476 |
@staticmethod |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
477 |
def __status_sort_func(treemodel, iter1, iter2, user_data=None): |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
478 |
get_val = treemodel.get_value |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
479 |
lat1 = get_val(iter1, enumerations.LATEST_AVAILABLE_COLUMN) |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
480 |
ins1 = get_val(iter1, enumerations.INSTALLED_VERSION_COLUMN) |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
481 |
lat2 = get_val(iter2, enumerations.LATEST_AVAILABLE_COLUMN) |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
482 |
ins2 = get_val(iter2, enumerations.INSTALLED_VERSION_COLUMN) |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
483 |
if ins1 and not ins2: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
484 |
return -1 |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
485 |
if ins2 and not ins1: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
486 |
return 1 |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
487 |
if lat1 and not lat2: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
488 |
return -1 |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
489 |
if lat2 and not lat1: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
490 |
return 1 |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
491 |
return 0 |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
492 |
|
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
493 |
@staticmethod |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
494 |
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
|
495 |
columns = treeview.get_columns() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
496 |
if columns: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
497 |
for column in columns: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
498 |
treeview.remove_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
499 |
|
483 | 500 |
def __init_sections(self): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
501 |
'''This function is for initializing sections combo box, also adds "All" |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
502 |
Category. It sets active section combobox entry "All"''' |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
503 |
self.section_list.append([0, self._('All'), ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
504 |
self.section_list.append([-1, "", ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
505 |
self.section_list.append([2, self._('Meta Packages'), ]) |
608
802615be8db8
1717 Data file opensolaris.org not up-to-date for OpenSolaris 2008.05 and 2008.11
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
602
diff
changeset
|
506 |
self.section_list.append([3, self._('Applications'), ]) |
802615be8db8
1717 Data file opensolaris.org not up-to-date for OpenSolaris 2008.05 and 2008.11
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
602
diff
changeset
|
507 |
self.section_list.append([4, self._('Desktop (GNOME)'), ]) |
802615be8db8
1717 Data file opensolaris.org not up-to-date for OpenSolaris 2008.05 and 2008.11
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
602
diff
changeset
|
508 |
self.section_list.append([5, self._('Development'), ]) |
802615be8db8
1717 Data file opensolaris.org not up-to-date for OpenSolaris 2008.05 and 2008.11
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
602
diff
changeset
|
509 |
self.section_list.append([6, self._('Distributions'), ]) |
802615be8db8
1717 Data file opensolaris.org not up-to-date for OpenSolaris 2008.05 and 2008.11
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
602
diff
changeset
|
510 |
self.section_list.append([7, self._('Drivers'), ]) |
802615be8db8
1717 Data file opensolaris.org not up-to-date for OpenSolaris 2008.05 and 2008.11
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
602
diff
changeset
|
511 |
self.section_list.append([8, self._('System'), ]) |
802615be8db8
1717 Data file opensolaris.org not up-to-date for OpenSolaris 2008.05 and 2008.11
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
602
diff
changeset
|
512 |
self.section_list.append([9, self._('Web Services'), ]) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
513 |
|
483 | 514 |
def __init_show_filter(self): |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
515 |
self.filter_list.append([0, self._('All Packages'), ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
516 |
self.filter_list.append([-1, "", ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
517 |
self.filter_list.append([2, self._('Installed Packages'), ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
518 |
self.filter_list.append([3, self._('Updates'), ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
519 |
self.filter_list.append([4, self._('Non-installed Packages'), ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
520 |
self.filter_list.append([-1, "", ]) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
521 |
# self.filter_list.append([self._('Locked Packages'), ]) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
522 |
# self.filter_list.append(["", ]) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
523 |
self.filter_list.append([6, self._('Selected Packages'), ]) |
483 | 524 |
|
525 |
def __on_cancel_progressdialog_clicked(self, widget): |
|
526 |
self.progress_canceled = True |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
527 |
self.progress_stop_timer_thread = True |
483 | 528 |
|
529 |
def __on_mainwindow_delete_event(self, widget, event): |
|
530 |
''' handler for delete event of the main window ''' |
|
531 |
if self.__check_if_something_was_changed() == True: |
|
532 |
# XXX Change this to not quit and show dialog |
|
533 |
# XXX if some changes were applied: |
|
534 |
self.__main_application_quit() |
|
535 |
return True |
|
536 |
else: |
|
537 |
self.__main_application_quit() |
|
538 |
||
539 |
def __on_file_quit_activate(self, widget): |
|
540 |
''' handler for quit menu event ''' |
|
541 |
self.__on_mainwindow_delete_event(None, None) |
|
542 |
||
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
543 |
def __on_edit_repositories_activate(self, widget): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
544 |
''' handler for repository menu event ''' |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
545 |
repository.Repository(self) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
546 |
|
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
547 |
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
|
548 |
''' 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
|
549 |
beadm.Beadmin(self) |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
550 |
|
483 | 551 |
def __on_searchentry_changed(self, widget): |
552 |
'''On text search field changed we should refilter the main view''' |
|
697 | 553 |
if self.application_refilter_id != 0: |
554 |
gobject.source_remove(self.application_refilter_id) |
|
555 |
self.application_refilter_id = 0 |
|
556 |
if self.w_searchentry_dialog.get_text() == "": |
|
557 |
self.application_refilter_id = \ |
|
558 |
gobject.idle_add(self.__application_refilter) |
|
559 |
else: |
|
560 |
self.application_refilter_id = \ |
|
561 |
gobject.timeout_add(TYPE_AHEAD_DELAY, self.__application_refilter) |
|
483 | 562 |
|
697 | 563 |
def __application_refilter(self): |
564 |
self.application_list_filter.refilter() |
|
483 | 565 |
gobject.idle_add(self.__enable_disable_selection_menus) |
697 | 566 |
self.application_refilter_id = 0 |
567 |
return False |
|
483 | 568 |
|
569 |
def __on_edit_paste(self, widget): |
|
570 |
self.w_searchentry_dialog.insert_text(self.main_clipboard_text, \ |
|
571 |
self.w_searchentry_dialog.get_position()) |
|
572 |
||
573 |
def __on_clear_paste(self, widget): |
|
574 |
bounds = self.w_searchentry_dialog.get_selection_bounds() |
|
575 |
self.w_searchentry_dialog.delete_text(bounds[0], bounds[1]) |
|
576 |
return |
|
577 |
||
578 |
def __on_copy(self, widget): |
|
579 |
bounds = self.w_searchentry_dialog.get_selection_bounds() |
|
580 |
text = self.w_searchentry_dialog.get_chars(bounds[0], bounds[1]) |
|
581 |
self.w_main_clipboard.set_text(text) |
|
582 |
return |
|
583 |
||
584 |
def __on_cut(self, widget): |
|
585 |
bounds = self.w_searchentry_dialog.get_selection_bounds() |
|
586 |
text = self.w_searchentry_dialog.get_chars(bounds[0], bounds[1]) |
|
587 |
self.w_searchentry_dialog.delete_text(bounds[0], bounds[1]) |
|
588 |
self.w_main_clipboard.set_text(text) |
|
589 |
return |
|
590 |
||
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
591 |
def __on_clear_search(self, widget): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
592 |
self.w_searchentry_dialog.delete_text(0, -1) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
593 |
return |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
594 |
|
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
|
595 |
def __on_notebook_change(self, widget, event, pagenum): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
596 |
if pagenum == 3: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
597 |
licbuffer = self.w_license_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
|
598 |
leg_txt = self._("Fetching legal information...") |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
599 |
licbuffer.set_text(leg_txt) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
600 |
Thread(target = self.__show_package_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
|
601 |
args = (self.pkginfo_thread,)).start() |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
602 |
|
483 | 603 |
def __on_select_all(self, widget): |
604 |
sort_filt_model = \ |
|
605 |
self.w_application_treeview.get_model() #gtk.TreeModelSort |
|
606 |
filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter |
|
607 |
model = filt_model.get_model() #gtk.ListStore |
|
608 |
iter_next = sort_filt_model.get_iter_first() |
|
609 |
list_of_paths = [] |
|
610 |
while iter_next != None: |
|
611 |
sorted_path = sort_filt_model.get_path(iter_next) |
|
612 |
filtered_path = \ |
|
613 |
sort_filt_model.convert_path_to_child_path(sorted_path) |
|
614 |
path = filt_model.convert_path_to_child_path(filtered_path) |
|
615 |
list_of_paths.append(path) |
|
616 |
iter_next = sort_filt_model.iter_next(iter_next) |
|
617 |
for path in list_of_paths: |
|
618 |
itr = model.get_iter(path) |
|
619 |
model.set_value(itr, enumerations.MARK_COLUMN, True) |
|
620 |
self.__enable_disable_selection_menus() |
|
621 |
self.update_statusbar() |
|
622 |
self.__enable_disable_install_update() |
|
623 |
self.__enable_disable_remove() |
|
624 |
||
625 |
def __on_select_updates(self, widget): |
|
626 |
sort_filt_model = \ |
|
627 |
self.w_application_treeview.get_model() #gtk.TreeModelSort |
|
628 |
filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter |
|
629 |
model = filt_model.get_model() #gtk.ListStore |
|
630 |
iter_next = sort_filt_model.get_iter_first() |
|
631 |
list_of_paths = [] |
|
632 |
while iter_next != None: |
|
633 |
sorted_path = sort_filt_model.get_path(iter_next) |
|
634 |
filtered_iter = sort_filt_model.convert_iter_to_child_iter(None, \ |
|
635 |
iter_next) |
|
636 |
app_iter = filt_model.convert_iter_to_child_iter(filtered_iter) |
|
637 |
||
638 |
filtered_path = \ |
|
639 |
sort_filt_model.convert_path_to_child_path(sorted_path) |
|
640 |
path = filt_model.convert_path_to_child_path(filtered_path) |
|
641 |
if model.get_value(app_iter, \ |
|
642 |
enumerations.INSTALLED_VERSION_COLUMN): |
|
643 |
if model.get_value(app_iter, \ |
|
644 |
enumerations.LATEST_AVAILABLE_COLUMN): |
|
645 |
list_of_paths.append(path) |
|
646 |
iter_next = sort_filt_model.iter_next(iter_next) |
|
647 |
for path in list_of_paths: |
|
648 |
itr = model.get_iter(path) |
|
649 |
model.set_value(itr, enumerations.MARK_COLUMN, True) |
|
650 |
self.__enable_disable_selection_menus() |
|
651 |
self.update_statusbar() |
|
652 |
self.__enable_disable_install_update() |
|
653 |
self.__enable_disable_remove() |
|
654 |
||
655 |
def __on_deselect(self, widget): |
|
656 |
sort_filt_model = \ |
|
657 |
self.w_application_treeview.get_model() #gtk.TreeModelSort |
|
658 |
filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter |
|
659 |
model = filt_model.get_model() #gtk.ListStore |
|
660 |
iter_next = sort_filt_model.get_iter_first() |
|
661 |
list_of_paths = [] |
|
662 |
while iter_next != None: |
|
663 |
sorted_path = sort_filt_model.get_path(iter_next) |
|
664 |
filtered_iter = sort_filt_model.convert_iter_to_child_iter(None, \ |
|
665 |
iter_next) |
|
666 |
app_iter = filt_model.convert_iter_to_child_iter(filtered_iter) |
|
667 |
filtered_path = \ |
|
668 |
sort_filt_model.convert_path_to_child_path(sorted_path) |
|
669 |
path = filt_model.convert_path_to_child_path(filtered_path) |
|
670 |
if model.get_value(app_iter, enumerations.MARK_COLUMN): |
|
671 |
list_of_paths.append(path) |
|
672 |
iter_next = sort_filt_model.iter_next(iter_next) |
|
673 |
for path in list_of_paths: |
|
674 |
itr = model.get_iter(path) |
|
675 |
model.set_value(itr, enumerations.MARK_COLUMN, False) |
|
676 |
self.__enable_disable_selection_menus() |
|
677 |
self.update_statusbar() |
|
678 |
self.__enable_disable_install_update() |
|
679 |
self.__enable_disable_remove() |
|
680 |
||
681 |
def __on_searchentry_focus_in(self, widget, event): |
|
682 |
self.w_paste_menuitem.set_sensitive(True) |
|
683 |
||
684 |
def __on_searchentry_focus_out(self, widget, event): |
|
685 |
self.w_paste_menuitem.set_sensitive(False) |
|
686 |
||
687 |
def __on_searchentry_event(self, widget, event): |
|
688 |
self.w_main_clipboard.request_text(self.__clipboard_text_received) |
|
689 |
if widget.get_selection_bounds(): |
|
690 |
#enable selection functions |
|
691 |
self.w_cut_menuitem.set_sensitive(True) |
|
692 |
self.w_copy_menuitem.set_sensitive(True) |
|
693 |
self.w_clear_menuitem.set_sensitive(True) |
|
694 |
else: |
|
695 |
self.w_cut_menuitem.set_sensitive(False) |
|
696 |
self.w_copy_menuitem.set_sensitive(False) |
|
697 |
self.w_clear_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
698 |
|
483 | 699 |
def __on_category_selection_changed(self, selection, widget): |
700 |
'''This function is for handling category selection changes''' |
|
701 |
self.application_list_filter.refilter() |
|
702 |
self.__enable_disable_selection_menus() |
|
703 |
||
704 |
def __on_package_selection_changed(self, selection, widget): |
|
705 |
'''This function is for handling package selection changes''' |
|
706 |
model, itr = selection.get_selected() |
|
707 |
if itr: |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
708 |
self.pkginfo_thread += 1 |
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
|
709 |
self.selected_pkgname = \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
710 |
model.get_value(itr, enumerations.NAME_COLUMN) |
483 | 711 |
Thread(target = self.__show_package_info, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
712 |
args = (model, itr, self.pkginfo_thread)).start() |
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
|
713 |
if self.w_info_notebook.get_current_page() == 3: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
714 |
self.__on_notebook_change(None, None, 3) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
715 |
|
483 | 716 |
|
717 |
def __on_filtercombobox_changed(self, widget): |
|
718 |
'''On filter combobox changed''' |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
719 |
if self.in_setup: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
720 |
return |
483 | 721 |
self.application_list_filter.refilter() |
722 |
self.__enable_disable_selection_menus() |
|
723 |
||
724 |
def __on_sectionscombobox_changed(self, widget): |
|
725 |
'''On section combobox changed''' |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
726 |
if self.in_setup: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
727 |
return |
483 | 728 |
selected_section = widget.get_active() |
729 |
if selected_section == 0: |
|
730 |
for category in self.category_list: |
|
731 |
category[enumerations.CATEGORY_VISIBLE] = True |
|
732 |
else: |
|
733 |
for category in self.category_list: |
|
734 |
if category[enumerations.CATEGORY_ID] == 0: |
|
735 |
category[enumerations.CATEGORY_VISIBLE] = True |
|
736 |
else: |
|
737 |
category_list = \ |
|
738 |
category[enumerations.SECTION_LIST_OBJECT] |
|
739 |
if not category_list: |
|
740 |
category[enumerations.CATEGORY_VISIBLE] \ |
|
741 |
= False |
|
742 |
else: |
|
743 |
for section in category_list: |
|
744 |
if section == selected_section: |
|
745 |
category[enumerations. \ |
|
746 |
CATEGORY_VISIBLE] = \ |
|
747 |
True |
|
748 |
else: |
|
749 |
category[enumerations. \ |
|
750 |
CATEGORY_VISIBLE] = \ |
|
751 |
False |
|
752 |
self.category_list_filter.refilter() |
|
753 |
self.application_list_filter.refilter() |
|
754 |
self.__enable_disable_selection_menus() |
|
755 |
||
756 |
def __on_repositorycombobox_changed(self, widget): |
|
757 |
'''On repository combobox changed''' |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
758 |
if self.in_setup: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
759 |
return |
483 | 760 |
self.application_list_filter.refilter() |
761 |
self.__enable_disable_selection_menus() |
|
762 |
||
763 |
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
|
764 |
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
|
765 |
install_update = [] |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
766 |
for row in self.application_list: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
767 |
if row[enumerations.MARK_COLUMN]: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
768 |
install_update.append(row[\ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
769 |
enumerations.NAME_COLUMN]) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
770 |
installupdate.InstallUpdate(install_update, self, \ |
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
|
771 |
self.api_o, ips_update = False, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
772 |
action = enumerations.INSTALL_UPDATE) |
483 | 773 |
|
774 |
def __on_update_all(self, widget): |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
775 |
opensolaris_image = True |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
776 |
self.progress_stop_timer_thread = 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
|
777 |
notfound = self.__installed_fmris_from_args(self.api_o, \ |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
778 |
["SUNWipkg", "SUNWcs"]) |
483 | 779 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
780 |
if notfound: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
781 |
opensolaris_image = False |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
782 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
783 |
if opensolaris_image: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
784 |
# Load the catalogs from the repository, its a long |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
785 |
# running tasks so need a progress dialog |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
786 |
self.w_progress_dialog.set_title(self._("Update All")) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
787 |
self.w_progressinfo_label.set_text(self._( \ |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
788 |
"Checking SUNWipkg and SUNWipkg-gui versions\n" \ |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
789 |
"\nPlease wait ...")) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
790 |
Thread(target = self.__progressdialog_progress_pulse).start() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
791 |
Thread(target = self.__do_ips_uptodate_check).start() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
792 |
self.w_progress_dialog.run() |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
793 |
if self.progress_canceled: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
794 |
return |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
795 |
else: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
796 |
self.ips_uptodate = True |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
797 |
|
483 | 798 |
#2790: Make sure ipkg and ipkg-gui are up to date, if not update them and |
799 |
# prompt user to restart |
|
800 |
if not self.ips_uptodate: |
|
801 |
# Prompt user |
|
802 |
msgbox = gtk.MessageDialog(parent = self.w_main_window, \ |
|
803 |
buttons = gtk.BUTTONS_YES_NO, \ |
|
804 |
flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_QUESTION, \ |
|
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
805 |
message_format = self._("Newer versions of SUNWipkg and " \ |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
806 |
"SUNWipkg-gui\n" + "are available and must be updated " \ |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
807 |
"before\nrunning Update All.\n\nDo you want to update " \ |
483 | 808 |
"them now?")) |
809 |
msgbox.set_title(self._("Update All")) |
|
810 |
result = msgbox.run() |
|
811 |
msgbox.destroy() |
|
812 |
if result == gtk.RESPONSE_YES: |
|
813 |
pkg_list = [self.ipkg_fmri, self.ipkggui_fmri] |
|
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
|
814 |
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
|
815 |
installupdate.InstallUpdate(pkg_list, \ |
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
|
816 |
self, self.api_o, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
817 |
ips_update = True, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
818 |
action = enumerations.INSTALL_UPDATE) |
483 | 819 |
else: |
820 |
msgbox = gtk.MessageDialog(parent = self.w_main_window, \ |
|
821 |
buttons = gtk.BUTTONS_OK, \ |
|
822 |
flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO, \ |
|
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
823 |
message_format = self._("Update All was not " \ |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
824 |
"run.\n\nIt can not be run until SUNWipkg and " \ |
483 | 825 |
"SUNWipkg-gui have been updated.")) |
826 |
msgbox.set_title(self._("Update All")) |
|
827 |
result = msgbox.run() |
|
828 |
msgbox.destroy() |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
829 |
else: |
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
|
830 |
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
|
831 |
installupdate.InstallUpdate([], self, \ |
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
|
832 |
self.api_o, ips_update = False, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
833 |
action = enumerations.IMAGE_UPDATE) |
483 | 834 |
|
835 |
def __on_help_about(self, widget): |
|
836 |
wTreePlan = gtk.glade.XML(self.gladefile, "aboutdialog") |
|
837 |
aboutdialog = wTreePlan.get_widget("aboutdialog") |
|
838 |
aboutdialog.connect("response", lambda x = None, \ |
|
839 |
y = None: aboutdialog.destroy()) |
|
840 |
aboutdialog.run() |
|
841 |
||
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
842 |
def __on_help_help(self, widget): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
843 |
props = { gnome.PARAM_APP_DATADIR : self.application_dir + \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
844 |
'/usr/share/package-manager/help' } |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
845 |
gnome.program_init('package-manager', '0.1', properties=props) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
846 |
gnome.help_display('package-manager') |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
847 |
|
483 | 848 |
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
|
849 |
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
|
850 |
remove_list = [] |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
851 |
for pkg in self.application_list: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
852 |
if pkg[enumerations.MARK_COLUMN] and \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
853 |
pkg[enumerations.INSTALLED_VERSION_COLUMN]: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
854 |
remove_list.append(\ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
855 |
pkg[enumerations.NAME_COLUMN]) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
856 |
installupdate.InstallUpdate(remove_list, self, \ |
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
|
857 |
self.api_o, ips_update = False, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
858 |
action = enumerations.REMOVE) |
483 | 859 |
|
860 |
def __on_reload(self, widget): |
|
861 |
if self.description_thread_running: |
|
862 |
self.cancelled = True |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
863 |
self.in_setup = True |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
864 |
self.w_progress_dialog.set_title(self._("Refreshing catalogs")) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
865 |
self.w_progressinfo_label.set_text(self._("Refreshing catalogs...")) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
866 |
self.progress_stop_timer_thread = False |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
867 |
Thread(target = self.__progressdialog_progress_pulse).start() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
868 |
self.w_progress_dialog.show() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
869 |
self.__disconnect_models() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
870 |
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
|
871 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
872 |
def __catalog_refresh_done(self): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
873 |
self.progress_stop_timer_thread = True |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
874 |
#Let the progress_pulse finish. This should be done other way, but at |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
875 |
#The moment this works fine |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
876 |
time.sleep(0.2) |
483 | 877 |
self.process_package_list_start(self.image_directory) |
878 |
self.__enable_disable_selection_menus() |
|
879 |
self.update_statusbar() |
|
880 |
self.__update_install_update_button(None, True) |
|
881 |
self.__update_remove_button(None, True) |
|
882 |
||
883 |
def __clipboard_text_received(self, clipboard, text, data): |
|
884 |
self.main_clipboard_text = text |
|
885 |
return |
|
886 |
||
887 |
def __main_application_quit(self, restart_app = False): |
|
888 |
'''quits the main gtk loop''' |
|
889 |
self.cancelled = True |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
890 |
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
|
891 |
return |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
892 |
|
483 | 893 |
if restart_app: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
894 |
if self.image_dir_arg: |
483 | 895 |
gobject.spawn_async([self.application_path, "-R", \ |
896 |
self.image_dir_arg]) |
|
897 |
else: |
|
898 |
gobject.spawn_async([self.application_path]) |
|
899 |
gtk.main_quit() |
|
900 |
sys.exit(0) |
|
901 |
return True |
|
902 |
||
903 |
def __check_if_something_was_changed(self): |
|
904 |
''' Returns True if any of the check boxes for package was changed, false |
|
905 |
if not''' |
|
906 |
for pkg in self.application_list: |
|
907 |
if pkg[enumerations.MARK_COLUMN] == True: |
|
908 |
return True |
|
909 |
return False |
|
910 |
||
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
|
911 |
def __setup_repositories_combobox(self, api_o, repositories_list): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
912 |
img = api_o.img |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
913 |
if self.in_setup or img == None: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
914 |
return |
483 | 915 |
repositories = img.catalogs |
916 |
default_authority = img.get_default_authority() |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
917 |
i = 0 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
918 |
active = 0 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
919 |
for repo in repositories: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
920 |
if cmp(repo, default_authority) == 0: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
921 |
active = i |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
922 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
923 |
repositories_list.append([i, repo, ]) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
924 |
i = i + 1 |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
925 |
self.w_repository_combobox.set_model(repositories_list) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
926 |
if default_authority: |
483 | 927 |
self.w_repository_combobox.set_active(active) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
928 |
else: |
483 | 929 |
self.w_repository_combobox.set_active(0) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
930 |
|
483 | 931 |
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
|
932 |
'''Toggle function for column enumerations.MARK_COLUMN''' |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
933 |
applicationModel = model_sort.get_model() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
934 |
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
|
935 |
filterModel = applicationModel.get_model() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
936 |
child_path = applicationModel.convert_path_to_child_path(applicationPath) |
483 | 937 |
itr = filterModel.get_iter(child_path) |
938 |
if itr: |
|
939 |
modified = filterModel.get_value(itr, enumerations.MARK_COLUMN) |
|
940 |
filterModel.set_value(itr, enumerations.MARK_COLUMN, \ |
|
941 |
not modified) |
|
942 |
latest_available = filterModel.get_value(itr, \ |
|
943 |
enumerations.LATEST_AVAILABLE_COLUMN) |
|
944 |
installed_available = filterModel.get_value(itr, \ |
|
945 |
enumerations.INSTALLED_VERSION_COLUMN) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
946 |
self.update_statusbar() |
483 | 947 |
self.__update_install_update_button(latest_available, modified) |
948 |
self.__update_remove_button(installed_available, modified) |
|
949 |
self.__enable_disable_selection_menus() |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
950 |
|
483 | 951 |
|
952 |
def __update_install_update_button(self, latest_available, toggle_true): |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
953 |
if not toggle_true and self.user_rights: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
954 |
if latest_available: |
483 | 955 |
self.w_installupdate_button.set_sensitive(True) |
956 |
self.w_installupdate_menuitem.set_sensitive(True) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
957 |
else: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
958 |
available = None |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
959 |
for row in self.application_list: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
960 |
if row[enumerations.MARK_COLUMN]: |
483 | 961 |
available = \ |
962 |
row[enumerations.LATEST_AVAILABLE_COLUMN] |
|
963 |
if available: |
|
964 |
return |
|
965 |
if not available: |
|
966 |
self.w_installupdate_button.set_sensitive(False) |
|
967 |
self.w_installupdate_menuitem.set_sensitive(False) |
|
968 |
||
969 |
def __update_reload_button(self): |
|
970 |
if self.user_rights: |
|
971 |
self.w_reload_button.set_sensitive(True) |
|
972 |
else: |
|
973 |
self.w_reload_button.set_sensitive(False) |
|
974 |
||
975 |
def __update_remove_button(self, installed_available, toggle_true): |
|
976 |
if not toggle_true and self.user_rights: |
|
977 |
if installed_available: |
|
978 |
self.w_remove_button.set_sensitive(True) |
|
979 |
self.w_remove_menuitem.set_sensitive(True) |
|
980 |
else: |
|
981 |
available = None |
|
982 |
for row in self.application_list: |
|
983 |
if row[enumerations.MARK_COLUMN]: |
|
984 |
installed = \ |
|
985 |
row[enumerations.INSTALLED_VERSION_COLUMN] |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
986 |
if installed: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
987 |
return |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
988 |
if not available: |
483 | 989 |
self.w_remove_button.set_sensitive(False) |
990 |
self.w_remove_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
991 |
|
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
|
992 |
def __show_fetching_package_info(self, pkg, icon): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
993 |
pkg_name = pkg.get_name() |
483 | 994 |
if icon and icon != pkg: |
995 |
self.w_packageicon_image.set_from_pixbuf(icon) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
996 |
else: |
483 | 997 |
self.w_packageicon_image.set_from_pixbuf( \ |
998 |
self.__get_pixbuf_from_path("/usr/share/package-manager/", \ |
|
999 |
"PM_package_36x")) |
|
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
|
1000 |
self.w_packagename_label.set_markup("<b>" + pkg_name + "</b>") |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1001 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1002 |
if self.__setting_from_cache(pkg_name): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1003 |
return |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1004 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1005 |
self.w_shortdescription_label.set_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
|
1006 |
self._("Fetching description...")) |
483 | 1007 |
instbuffer = self.w_installedfiles_textview.get_buffer() |
1008 |
depbuffer = self.w_dependencies_textview.get_buffer() |
|
1009 |
infobuffer = self.w_generalinfo_textview.get_buffer() |
|
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
|
1010 |
instbuffer.set_text(self._("Fetching information...")) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1011 |
depbuffer.set_text(self._("Fetching information...")) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1012 |
infobuffer.set_text(self._("Fetching information...")) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1013 |
return |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1014 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1015 |
def __setting_from_cache(self, pkg_name): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1016 |
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
|
1017 |
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
|
1018 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1019 |
if self.info_cache.has_key(pkg_name): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1020 |
self.w_shortdescription_label.set_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
|
1021 |
self.info_cache[pkg_name][0]) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1022 |
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
|
1023 |
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
|
1024 |
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
|
1025 |
infobuffer.set_text(self.info_cache[pkg_name][1]) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1026 |
instbuffer.set_text(self.info_cache[pkg_name][2]) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1027 |
depbuffer.set_text(self.info_cache[pkg_name][3]) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1028 |
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
|
1029 |
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
|
1030 |
return False |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1031 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1032 |
def __update_package_info(self, pkg, icon, installed, pkg_info): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1033 |
pkg_name = pkg.get_name() |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1034 |
if icon and icon != pkg: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1035 |
self.w_packageicon_image.set_from_pixbuf(icon) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1036 |
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
|
1037 |
self.w_packageicon_image.set_from_pixbuf( \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1038 |
self.__get_pixbuf_from_path("/usr/share/package-manager/", \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1039 |
"PM_package_36x")) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1040 |
self.w_packagename_label.set_markup("<b>" + pkg_name + "</b>") |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1041 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1042 |
if self.__setting_from_cache(pkg_name): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1043 |
return |
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
|
1044 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1045 |
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
|
1046 |
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
|
1047 |
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
|
1048 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1049 |
if not pkg_info: |
483 | 1050 |
self.w_shortdescription_label.set_text( \ |
1051 |
self._("Description not available for this package...")) |
|
1052 |
instbuffer.set_text( \ |
|
1053 |
self._("Files Details not available for this package...")) |
|
1054 |
depbuffer.set_text(self._( \ |
|
1055 |
"Dependencies info not available for this package...")) |
|
1056 |
infobuffer.set_text( \ |
|
1057 |
self._("Information not available for this package...")) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1058 |
return |
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
|
1059 |
description = pkg_info.summary |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1060 |
#XXX long term need to have something more robust here for multi byte |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1061 |
if len(description) > MAX_DESC_LEN: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1062 |
description = description[:MAX_DESC_LEN] + " ..." |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1063 |
self.w_shortdescription_label.set_text(description) |
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
|
1064 |
inst_str = self._("Root: %s\n") % self.api_o.img.get_root() |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1065 |
dep_str = self._("Dependencies:\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
|
1066 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1067 |
if installed: |
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
|
1068 |
info_str = self._("Information for installed package:\n\n") |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1069 |
else: |
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
|
1070 |
info_str = self._("Information for latest available package:\n\n") |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1071 |
#Name: SUNWckr |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1072 |
#FMRI: pkg://opensolaris.org/[email protected],5.11-0.75:20071114T203148Z |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1073 |
#Version: 0.5.11 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1074 |
#Branch: 0.75 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1075 |
#Packaging Date: 2007-11-14 20:31:48 |
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
|
1076 |
#Size: 293696981024 |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1077 |
#Summary: Core Solaris Kernel (Root) |
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
|
1078 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1079 |
if pkg_info.dependencies: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1080 |
dep_str += ''.join(["\t%s\n" % x for x in pkg_info.dependencies]) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1081 |
if pkg_info.dirs: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1082 |
inst_str += ''.join(["\t%s\n" % x for x in pkg_info.dirs]) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1083 |
if pkg_info.files: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1084 |
inst_str += ''.join(["\t%s\n" % x for x in pkg_info.files]) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1085 |
if pkg_info.hardlinks: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1086 |
inst_str += ''.join(["\t%s\n" % x for x in pkg_info.hardlinks]) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1087 |
if pkg_info.links: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1088 |
inst_str += ''.join(["\t%s\n" % x for x in pkg_info.links]) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1089 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1090 |
if description: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1091 |
info_str += self._(" Description:\t%s\n") % description |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1092 |
info_str += self._(" Name:\t\t%s\n") % pkg_name |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1093 |
info_str += self._(" FMRI:\t\t%s\n") % pkg.get_fmri() |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1094 |
info_str += self._(" Version:\t\t%s\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
|
1095 |
pkg.version.get_short_version() |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1096 |
info_str += self._(" Packaged:\t%s\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
|
1097 |
self.get_datetime(pkg.version) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1098 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1099 |
infobuffer.set_text(info_str) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1100 |
instbuffer.set_text(inst_str) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1101 |
depbuffer.set_text(dep_str) |
483 | 1102 |
|
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
|
1103 |
self.info_cache[pkg_name] = \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1104 |
(description, info_str, inst_str, dep_str) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1105 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1106 |
def __update_package_license(self, licenses): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1107 |
lic = "" |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1108 |
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
|
1109 |
if licenses == None: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1110 |
lic_u = self._("Not available") |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1111 |
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
|
1112 |
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
|
1113 |
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
|
1114 |
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
|
1115 |
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
|
1116 |
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
|
1117 |
except UnicodeDecodeError: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1118 |
lic_u += "" |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1119 |
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
|
1120 |
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
|
1121 |
|
483 | 1122 |
def __update_description(self, description, package): |
1123 |
'''workaround function''' |
|
1124 |
for pkg in self.application_list: |
|
1125 |
p = pkg[enumerations.PACKAGE_OBJECT_COLUMN][0] |
|
1126 |
if p == package: |
|
1127 |
pkg[enumerations.DESCRIPTION_COLUMN] = description |
|
1128 |
return |
|
1129 |
||
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
|
1130 |
def __show_package_licenses(self, th_no): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1131 |
#XXX revisit this and replace with gobject.timer_add() instead of sleep |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1132 |
# sleep for a little time, this is done for the users who are |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1133 |
# fast browsing the list of the packages. |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1134 |
time.sleep(1) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1135 |
if th_no != self.pkginfo_thread: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1136 |
return |
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
|
1137 |
if self.selected_pkgname == None: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1138 |
gobject.idle_add(self.__update_package_license, \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1139 |
None) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1140 |
return |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1141 |
info = self.api_o.info([self.selected_pkgname], True, True) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1142 |
pkgs_info = None |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1143 |
package_info = None |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1144 |
no_licenses = 0 |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1145 |
if info: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1146 |
pkgs_info = info[0] |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1147 |
if pkgs_info: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1148 |
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
|
1149 |
if package_info: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1150 |
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
|
1151 |
if no_licenses == 0: |
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
|
1152 |
gobject.idle_add(self.__update_package_license, \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1153 |
None) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1154 |
return |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1155 |
if th_no == self.pkginfo_thread: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1156 |
gobject.idle_add(self.__update_package_license, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1157 |
package_info.licenses) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1158 |
else: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1159 |
return |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1160 |
|
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
|
1161 |
def __get_pkg_info(self, pkg_name, installed): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1162 |
info = self.api_o.info([pkg_name], installed, get_licenses=False, \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1163 |
get_action_info=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
|
1164 |
pkgs_info = None |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1165 |
package_info = None |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1166 |
if info: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1167 |
pkgs_info = info[0] |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1168 |
if pkgs_info: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1169 |
package_info = pkgs_info[0] |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1170 |
if package_info: |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1171 |
return package_info |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1172 |
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
|
1173 |
return |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1174 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1175 |
def __show_package_info(self, model, itr, th_no): |
483 | 1176 |
pkg = model.get_value(itr, enumerations.INSTALLED_OBJECT_COLUMN) |
1177 |
icon = model.get_value(itr, enumerations.INSTALLED_OBJECT_COLUMN) |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1178 |
installed = False |
483 | 1179 |
if not pkg: |
1180 |
packages = model.get_value(itr, \ |
|
1181 |
enumerations.PACKAGE_OBJECT_COLUMN) |
|
1182 |
pkg = max(packages) |
|
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
|
1183 |
gobject.idle_add( \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1184 |
self.__show_fetching_package_info, pkg, icon) |
483 | 1185 |
else: |
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
|
1186 |
gobject.idle_add( \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1187 |
self.__show_fetching_package_info, pkg, icon) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1188 |
installed = True |
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
|
1189 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1190 |
if self.info_cache.has_key(pkg.get_name()): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1191 |
return |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1192 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1193 |
# sleep for a little time, this is done for the users which are |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1194 |
# fast browsing the list of the packages. |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1195 |
time.sleep(1) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1196 |
if th_no != self.pkginfo_thread: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1197 |
return |
483 | 1198 |
man = 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
|
1199 |
img = self.api_o.img |
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1200 |
img.history.operation_name = "info" |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1201 |
|
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
|
1202 |
pkg_info = self.__get_pkg_info(pkg.get_name(), installed) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1203 |
if th_no == self.pkginfo_thread: |
483 | 1204 |
if not pkg: |
1205 |
gobject.idle_add(self.__update_package_info, pkg, icon, \ |
|
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
|
1206 |
installed, pkg_info) |
483 | 1207 |
else: |
1208 |
gobject.idle_add(self.__update_package_info, pkg, icon, \ |
|
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
|
1209 |
installed, pkg_info) |
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1210 |
img.history.operation_result = \ |
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1211 |
history.RESULT_SUCCEEDED |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1212 |
else: |
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1213 |
img.history.operation_result = \ |
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1214 |
history.RESULT_SUCCEEDED |
483 | 1215 |
return |
1216 |
||
1217 |
# This function is ported from pkg.actions.generic.distinguished_name() |
|
1218 |
def __locale_distinguished_name(self, action): |
|
1219 |
if action.key_attr == None: |
|
1220 |
return str(action) |
|
1221 |
return "%s: %s" % \ |
|
1222 |
(self._(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
|
1223 |
|
483 | 1224 |
def __application_filter(self, model, itr): |
1225 |
'''This function is used to filter content in the main |
|
1226 |
application view''' |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1227 |
if self.in_setup or self.cancelled: |
483 | 1228 |
return False |
1229 |
# XXX Show filter, chenge text to integers |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
1230 |
selected_category = 0 |
483 | 1231 |
selection = self.w_categories_treeview.get_selection() |
1232 |
category_model, category_iter = selection.get_selected() |
|
1233 |
if not category_iter: #no category was selected, so select "All" |
|
1234 |
selection.select_path(0) |
|
1235 |
category_model, category_iter = selection.get_selected() |
|
1236 |
if category_iter: |
|
1237 |
selected_category = category_model.get_value(category_iter, \ |
|
1238 |
enumerations.CATEGORY_ID) |
|
1239 |
category_list_iter = model.get_value(itr, \ |
|
1240 |
enumerations.CATEGORY_LIST_OBJECT) |
|
1241 |
category = False |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1242 |
repo = self.__is_pkg_repository_visible(model, itr) |
483 | 1243 |
if category_list_iter: |
1244 |
sel = False |
|
1245 |
for category_iter in category_list_iter: |
|
1246 |
if category != True: |
|
1247 |
category = \ |
|
1248 |
self.category_filter(self.category_list, \ |
|
1249 |
category_iter) |
|
1250 |
if selected_category != 0: |
|
1251 |
if selected_category == \ |
|
1252 |
self.category_list.get_value(category_iter, \ |
|
1253 |
enumerations.CATEGORY_ID): |
|
1254 |
sel = True |
|
1255 |
category = sel |
|
1256 |
else: |
|
1257 |
if selected_category == 0: |
|
1258 |
selected_section = self.w_sections_combobox.get_active() |
|
1259 |
if selected_section == 0: |
|
1260 |
category = True |
|
1261 |
if (model.get_value(itr, enumerations.IS_VISIBLE_COLUMN) == False): |
|
1262 |
return False |
|
1263 |
if self.w_searchentry_dialog.get_text() == "": |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1264 |
return (repo & category & \ |
483 | 1265 |
self.__is_package_filtered(model, itr)) |
1266 |
if not model.get_value(itr, enumerations.NAME_COLUMN) == None: |
|
1267 |
if self.w_searchentry_dialog.get_text().lower() in \ |
|
1268 |
model.get_value \ |
|
1269 |
(itr, enumerations.NAME_COLUMN).lower(): |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1270 |
return (repo & category & \ |
483 | 1271 |
self.__is_package_filtered(model, itr)) |
1272 |
if not model.get_value(itr, enumerations.DESCRIPTION_COLUMN) == None: |
|
1273 |
if self.w_searchentry_dialog.get_text().lower() in \ |
|
1274 |
model.get_value \ |
|
1275 |
(itr, enumerations.DESCRIPTION_COLUMN).lower(): |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1276 |
return (repo & category & \ |
483 | 1277 |
self.__is_package_filtered(model, itr)) |
1278 |
else: |
|
1279 |
return False |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1280 |
|
483 | 1281 |
def __is_package_filtered(self, model, itr): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1282 |
'''Function for filtercombobox''' |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1283 |
# XXX Instead of string comparison, we should do it through integers. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1284 |
# XXX It should be faster and better for localisations. |
483 | 1285 |
filter_text = self.w_filter_combobox.get_active() |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1286 |
if filter_text == 0: |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1287 |
return True |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1288 |
elif filter_text == 2: |
483 | 1289 |
return model.get_value(itr, \ |
1290 |
enumerations.INSTALLED_VERSION_COLUMN) != None |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1291 |
elif filter_text == 3: |
483 | 1292 |
return (model.get_value(itr, \ |
1293 |
enumerations.INSTALLED_VERSION_COLUMN) != None) & \ |
|
1294 |
(model.get_value(itr, \ |
|
1295 |
enumerations.LATEST_AVAILABLE_COLUMN) != None) |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1296 |
elif filter_text == 4: |
483 | 1297 |
return not model.get_value(itr, \ |
1298 |
enumerations.INSTALLED_VERSION_COLUMN) != None |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1299 |
elif filter_text == 6: |
483 | 1300 |
return model.get_value(itr, enumerations.MARK_COLUMN) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1301 |
elif filter_text == 8: |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1302 |
# XXX Locked support |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1303 |
return False |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1304 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1305 |
|
483 | 1306 |
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
|
1307 |
if len(self.repositories_list) <= 1: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1308 |
return True |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1309 |
else: |
483 | 1310 |
auth_iter = self.w_repository_combobox.get_active_iter() |
1311 |
authority = self.repositories_list.get_value(auth_iter, \ |
|
1312 |
enumerations.REPOSITORY_NAME) |
|
1313 |
packages = model.get_value(itr, \ |
|
1314 |
enumerations.PACKAGE_OBJECT_COLUMN) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1315 |
if not packages: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1316 |
return False |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1317 |
pkg = max(packages) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1318 |
if cmp(pkg.get_authority(), authority) == 0: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1319 |
return True |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1320 |
else: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1321 |
return False |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1322 |
|
483 | 1323 |
def __do_ips_uptodate_check(self): |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1324 |
ret = self.__catalog_refresh(False) |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1325 |
if ret != -1: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1326 |
self.ips_uptodate = self.__ipkg_ipkgui_uptodate() |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1327 |
else: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1328 |
self.progress_canceled = True |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1329 |
self.progress_stop_timer_thread = True |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1330 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1331 |
def __ipkg_ipkgui_uptodate(self): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1332 |
self.api_o.reset() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1333 |
list_of_packages = [self.ipkg_fmri, self.ipkggui_fmri] |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1334 |
ret = True |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
1335 |
try: |
594
b072bc027c54
3770 pkg install when authority unavailable traces back
Brock Pytlik <bpytlik@sun.com>
parents:
577
diff
changeset
|
1336 |
upgrade_needed, cre = self.api_o.plan_install( |
b072bc027c54
3770 pkg install when authority unavailable traces back
Brock Pytlik <bpytlik@sun.com>
parents:
577
diff
changeset
|
1337 |
list_of_packages, filters = []) |
b072bc027c54
3770 pkg install when authority unavailable traces back
Brock Pytlik <bpytlik@sun.com>
parents:
577
diff
changeset
|
1338 |
if upgrade_needed: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1339 |
ret = False |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1340 |
except (api_errors.InvalidCertException, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1341 |
api_errors.PlanCreationException, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1342 |
api_errors.InventoryException): |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
1343 |
raise |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1344 |
except api_errors.CanceledException: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1345 |
raise |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1346 |
return ret |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
1347 |
|
483 | 1348 |
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
|
1349 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1350 |
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
|
1351 |
return |
483 | 1352 |
self.__enable_disable_select_all() |
1353 |
self.__enable_disable_select_updates() |
|
1354 |
self.__enable_disable_deselect() |
|
1355 |
# XXX disabled until new API |
|
1356 |
self.__enable_disable_update_all() |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1357 |
|
483 | 1358 |
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
|
1359 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1360 |
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
|
1361 |
return |
483 | 1362 |
if len(self.w_application_treeview.get_model()) > 0: |
1363 |
for row in self.w_application_treeview.get_model(): |
|
1364 |
if not row[enumerations.MARK_COLUMN]: |
|
1365 |
self.w_selectall_menuitem.set_sensitive(True) |
|
1366 |
return |
|
1367 |
self.w_selectall_menuitem.set_sensitive(False) |
|
1368 |
else: |
|
1369 |
self.w_selectall_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1370 |
|
483 | 1371 |
def __enable_disable_install_update(self): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1372 |
for row in self.application_list: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1373 |
if row[enumerations.MARK_COLUMN]: |
483 | 1374 |
if row[enumerations.LATEST_AVAILABLE_COLUMN] and \ |
1375 |
self.user_rights: |
|
1376 |
self.w_installupdate_button.set_sensitive(True) |
|
1377 |
self.w_installupdate_menuitem.set_sensitive(True) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1378 |
return |
483 | 1379 |
self.w_installupdate_button.set_sensitive(False) |
1380 |
self.w_installupdate_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1381 |
|
483 | 1382 |
def __enable_disable_remove(self): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1383 |
for row in self.application_list: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1384 |
if row[enumerations.MARK_COLUMN]: |
483 | 1385 |
if row[enumerations.INSTALLED_VERSION_COLUMN] and \ |
1386 |
self.user_rights: |
|
1387 |
self.w_remove_button.set_sensitive(True) |
|
1388 |
self.w_remove_menuitem.set_sensitive(True) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1389 |
return |
483 | 1390 |
self.w_remove_button.set_sensitive(False) |
1391 |
self.w_remove_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1392 |
|
483 | 1393 |
def __enable_disable_select_updates(self): |
1394 |
for row in self.w_application_treeview.get_model(): |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1395 |
if row[enumerations.INSTALLED_VERSION_COLUMN]: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1396 |
if row[enumerations.LATEST_AVAILABLE_COLUMN]: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1397 |
if not row[enumerations.MARK_COLUMN]: |
483 | 1398 |
self.w_selectupdates_menuitem. \ |
1399 |
set_sensitive(True) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1400 |
return |
483 | 1401 |
self.w_selectupdates_menuitem.set_sensitive(False) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1402 |
return |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1403 |
|
483 | 1404 |
def __enable_disable_update_all(self): |
1405 |
for row in self.application_list: |
|
1406 |
if self.__is_pkg_repository_visible(self.application_list, \ |
|
1407 |
row.iter): |
|
1408 |
if self.application_list.get_value(row.iter, \ |
|
1409 |
enumerations.INSTALLED_VERSION_COLUMN): |
|
1410 |
if self.application_list.get_value(row.iter, \ |
|
1411 |
enumerations.LATEST_AVAILABLE_COLUMN) and \ |
|
1412 |
self.user_rights: |
|
1413 |
self.w_updateall_menuitem. \ |
|
1414 |
set_sensitive(True) |
|
1415 |
self.w_updateall_button. \ |
|
1416 |
set_sensitive(True) |
|
1417 |
return |
|
1418 |
self.w_updateall_button.set_sensitive(False) |
|
1419 |
self.w_updateall_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1420 |
|
483 | 1421 |
def __enable_disable_deselect(self): |
1422 |
for row in self.w_application_treeview.get_model(): |
|
1423 |
if row[enumerations.MARK_COLUMN]: |
|
1424 |
self.w_deselect_menuitem.set_sensitive(True) |
|
1425 |
return |
|
1426 |
self.w_deselect_menuitem.set_sensitive(False) |
|
1427 |
return |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1428 |
|
483 | 1429 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1430 |
def __catalog_refresh(self, reload_gui=True): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1431 |
"""Update image's catalogs.""" |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1432 |
full_refresh = True |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1433 |
try: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1434 |
self.api_o.refresh(full_refresh) |
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
|
1435 |
self.api_o.img.load_catalogs(self.pr) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1436 |
except api_errors.UnrecognizedAuthorityException: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1437 |
# In current implementation, this will never happen |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1438 |
# We are not refrehsing specific authority |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1439 |
self.__catalog_refresh_done() |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1440 |
raise |
714
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1441 |
except api_errors.PermissionsException, pe: |
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1442 |
#Error will already have been reported in |
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1443 |
#Manage Repository dialog |
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1444 |
self.__catalog_refresh_done() |
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1445 |
return -1 |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1446 |
except api_errors.CatalogRefreshException, cre: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1447 |
total = cre.total |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1448 |
succeeded = cre.succeeded |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1449 |
ermsg = self._("Network problem.\n\n") |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1450 |
ermsg += self._("Details:\n") |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1451 |
ermsg += "%s/%s" % (succeeded, total) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1452 |
ermsg += self._(" catalogs successfully updated:\n") |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1453 |
for auth, err in cre.failed: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1454 |
if isinstance(err, HTTPError): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1455 |
ermsg += " %s: %s - %s\n" % \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1456 |
(err.filename, err.code, err.msg) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1457 |
elif isinstance(err, URLError): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1458 |
if err.args[0][0] == 8: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1459 |
ermsg += " %s: %s\n" % \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1460 |
(urlparse.urlsplit( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1461 |
auth["origin"])[1].split(":")[0], |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1462 |
err.args[0][1]) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1463 |
else: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1464 |
if isinstance(err.args[0], \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1465 |
socket.timeout): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1466 |
ermsg += " %s: %s\n" % \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1467 |
(auth["origin"], "timeout") |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1468 |
else: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1469 |
ermsg += " %s: %s\n" % \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1470 |
(auth["origin"], \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1471 |
err.args[0][1]) |
714
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1472 |
elif "data" in err.__dict__ and err.data: |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1473 |
ermsg += err.data |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1474 |
else: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1475 |
ermsg += self._("Unknown error") |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1476 |
ermsg += "\n" |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1477 |
|
714
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1478 |
gobject.idle_add(self.error_occured, ermsg, \ |
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1479 |
None, gtk.MESSAGE_INFO) |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1480 |
self.__catalog_refresh_done() |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1481 |
return -1 |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1482 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1483 |
except api_errors.UnrecognizedAuthorityException: |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1484 |
self.__catalog_refresh_done() |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1485 |
raise |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1486 |
except Exception: |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1487 |
self.__catalog_refresh_done() |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1488 |
raise |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1489 |
if reload_gui: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1490 |
self.__catalog_refresh_done() |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1491 |
return 0 |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1492 |
|
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
|
1493 |
def __get_image_from_directory(self, api_o, progressdialog_progress): |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
1494 |
""" This method set up image from the given directory and |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
1495 |
returns the image object or None""" |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1496 |
application_list = self.__get_new_application_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1497 |
category_list = self.__get_new_category_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1498 |
repositories_list = self.__get_new_repositories_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1499 |
|
526
8c243883ae41
822 Depot traceback on "pkgsend -s <server> open foo"
Dan Price <dp@eng.sun.com>
parents:
510
diff
changeset
|
1500 |
try: |
8c243883ae41
822 Depot traceback on "pkgsend -s <server> open foo"
Dan Price <dp@eng.sun.com>
parents:
510
diff
changeset
|
1501 |
pkgs_known = [ pf[0] for pf in |
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
|
1502 |
sorted(api_o.img.inventory(all_known = True)) ] |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
562
diff
changeset
|
1503 |
except api_errors.InventoryException: |
526
8c243883ae41
822 Depot traceback on "pkgsend -s <server> open foo"
Dan Price <dp@eng.sun.com>
parents:
510
diff
changeset
|
1504 |
# Can't happen when all_known is true and no args, |
8c243883ae41
822 Depot traceback on "pkgsend -s <server> open foo"
Dan Price <dp@eng.sun.com>
parents:
510
diff
changeset
|
1505 |
# but here for completeness. |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1506 |
err = self._("Error occured while getting list of packages") |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1507 |
gobject.idle_add(self.w_progress_dialog.hide) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1508 |
gobject.idle_add(self.error_occured, err) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1509 |
return |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1510 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1511 |
#Only one instance of those icons should be in memory |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1512 |
update_available_icon = self.get_icon_pixbuf("status_newupdate") |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1513 |
installed_icon = self.get_icon_pixbuf("status_installed") |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1514 |
#Imageinfo for categories |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1515 |
imginfo = imageinfo.ImageInfo() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1516 |
sectioninfo = imageinfo.ImageInfo() |
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
|
1517 |
catalogs = api_o.img.catalogs |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1518 |
categories = {} |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1519 |
sections = {} |
701
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1520 |
share_path = "/usr/share/package-manager/data/" |
483 | 1521 |
for cat in catalogs: |
1522 |
category = imginfo.read(self.application_dir + \ |
|
701
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1523 |
share_path + cat) |
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1524 |
if len(category) == 0: |
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1525 |
category = imginfo.read(self.application_dir + \ |
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1526 |
share_path + "opensolaris.org") |
483 | 1527 |
categories[cat] = category |
1528 |
section = sectioninfo.read(self.application_dir + \ |
|
701
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1529 |
share_path + cat + ".sections") |
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1530 |
if len(section) == 0: |
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1531 |
section = sectioninfo.read(self.application_dir + \ |
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1532 |
share_path + "opensolaris.org.sections") |
483 | 1533 |
sections[cat] = section |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1534 |
# Speedup, instead of checking if the pkg is already in the list, |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1535 |
# iterating through all elements, we will only compare to the previous |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1536 |
# package and if the package is the same (version difference) then we |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1537 |
# are adding to the first iterator for the set of those packages. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1538 |
# We can do that, since the list pkgs_known is sorted |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1539 |
# This will give a sppedup from 18sec to ~3!!! |
483 | 1540 |
p_pkg_iter = None |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1541 |
p_pkg = None |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1542 |
insert_count = 0 |
483 | 1543 |
icon_path = self.application_dir + \ |
1544 |
"/usr/share/package-manager/data/pixmaps/" |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1545 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1546 |
pkg_count = 0 |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1547 |
progress_percent = INITIAL_PROGRESS_TOTAL_PERCENTAGE |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1548 |
total_pkg_count = len(pkgs_known) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1549 |
progress_increment = \ |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1550 |
total_pkg_count / PACKAGE_PROGRESS_TOTAL_INCREMENTS |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1551 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1552 |
self.progress_stop_timer_thread = True |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1553 |
while gtk.events_pending(): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1554 |
gtk.main_iteration(False) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1555 |
for pkg in pkgs_known: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1556 |
if progress_increment > 0 and pkg_count % progress_increment == 0: |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1557 |
progress_percent += PACKAGE_PROGRESS_PERCENT_INCREMENT |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1558 |
if progress_percent <= PACKAGE_PROGRESS_PERCENT_TOTAL: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1559 |
progressdialog_progress(progress_percent, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1560 |
pkg_count, total_pkg_count) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1561 |
while gtk.events_pending(): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1562 |
gtk.main_iteration(False) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1563 |
pkg_count += 1 |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1564 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1565 |
#speedup hack, check only last package |
483 | 1566 |
already_in_model = \ |
1567 |
self.check_if_pkg_have_row_in_model(pkg, p_pkg) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1568 |
if not already_in_model: #Create new row |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1569 |
available_version = None |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1570 |
version_installed = None |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1571 |
status_icon = None |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1572 |
fmris = [pkg, ] |
483 | 1573 |
package_installed = \ |
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
|
1574 |
self.get_installed_version(api_o, pkg) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1575 |
if package_installed: |
483 | 1576 |
version_installed = \ |
1577 |
package_installed.version.get_short_version() |
|
1578 |
#HACK, sometimes the package is installed but |
|
1579 |
#it's not in the pkgs_known |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1580 |
status_icon = installed_icon |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1581 |
if package_installed != pkg: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1582 |
fmris.append(package_installed) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1583 |
else: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1584 |
dt = self.get_datetime(pkg.version) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1585 |
dt_str = (":%02d%02d") % (dt.month, dt.day) |
483 | 1586 |
available_version = \ |
1587 |
pkg.version.get_short_version() + dt_str |
|
1588 |
package_icon = self.__get_pixbuf_from_path(icon_path, \ |
|
1589 |
pkg.get_name()) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1590 |
app = \ |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1591 |
[ |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1592 |
False, status_icon, package_icon, pkg.get_name(), |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1593 |
version_installed, package_installed, |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1594 |
available_version, -1, '...', fmris, |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1595 |
True, None |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1596 |
] |
483 | 1597 |
# XXX Small hack, if this is not applied, first package |
1598 |
# is listed twice. Insert is ~0.5 sec faster than append |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1599 |
if insert_count == 0: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1600 |
row_iter = application_list.append(app) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1601 |
else: |
483 | 1602 |
row_iter = \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1603 |
application_list.insert(insert_count, \ |
483 | 1604 |
app) |
1605 |
# XXX Do not iterate through all the catalogs. Package |
|
1606 |
# should know what is package fmri prefix? |
|
1607 |
apc = self.__add_package_to_category |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1608 |
app_ls = application_list |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1609 |
for cat in categories: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1610 |
if cat in categories: |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1611 |
name = pkg.get_name() |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1612 |
if name in categories[cat]: |
483 | 1613 |
pkg_categories = \ |
1614 |
categories[cat][ \ |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1615 |
name] |
483 | 1616 |
for pcat in \ |
1617 |
pkg_categories.split(","): |
|
1618 |
if pcat: |
|
1619 |
apc(self._( \ |
|
1620 |
pcat), None \ |
|
1621 |
, None, \ |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1622 |
row_iter, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1623 |
app_ls, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1624 |
category_list) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1625 |
insert_count = insert_count + 1 |
483 | 1626 |
p_pkg_iter = row_iter |
1627 |
p_pkg = pkg #The current become previous |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1628 |
else: |
483 | 1629 |
# XXX check versions in here. For all installed/not |
1630 |
# installed: |
|
1631 |
# if there is newer version, put it in the available |
|
1632 |
# field. |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1633 |
# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1634 |
# XXXhack, since image_get_version_installed(pkg) is not |
483 | 1635 |
# working,as it should. For example package: |
1636 |
# [email protected],5.11-0.79:20080205T152309Z |
|
1637 |
# is not installed and it's newer version of installed |
|
1638 |
# package: |
|
1639 |
# [email protected],5.11-0.75:20071114T201151Z |
|
1640 |
# the function returns only proper installed version for |
|
1641 |
# the older package and None for the newer. |
|
1642 |
# The hack is a little bit slow since we are iterating |
|
1643 |
# for all known packages |
|
1644 |
list_of_pkgs = \ |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1645 |
application_list.get_value(p_pkg_iter, \ |
483 | 1646 |
enumerations.PACKAGE_OBJECT_COLUMN) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1647 |
if pkg not in list_of_pkgs: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1648 |
list_of_pkgs.append(pkg) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1649 |
installed = application_list.get_value(p_pkg_iter, \ |
483 | 1650 |
enumerations.INSTALLED_OBJECT_COLUMN) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1651 |
latest = max(list_of_pkgs) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1652 |
dt = self.get_datetime(latest.version) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1653 |
dt_str = (":%02d%02d") % (dt.month, dt.day) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1654 |
if not installed: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1655 |
application_list.set_value(p_pkg_iter, \ |
483 | 1656 |
enumerations.LATEST_AVAILABLE_COLUMN, \ |
1657 |
latest.version.get_short_version() + \ |
|
1658 |
dt_str) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1659 |
else: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1660 |
if installed < latest: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1661 |
application_list.set_value( \ |
483 | 1662 |
p_pkg_iter, \ |
1663 |
enumerations. \ |
|
1664 |
LATEST_AVAILABLE_COLUMN, \ |
|
1665 |
latest.version.get_short_version() + \ |
|
1666 |
dt_str) |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1667 |
application_list.set_value(\ |
483 | 1668 |
p_pkg_iter, \ |
1669 |
enumerations.STATUS_ICON_COLUMN, \ |
|
1670 |
update_available_icon) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1671 |
# XXX How to get descriptions without manifest? |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1672 |
# XXX Downloading manifest is slow and can not work without |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1673 |
# XXX Network connection |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1674 |
#if not image_obj.has_manifest(pkg): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1675 |
# image_obj.get_manifest(pkg)#verify(pkg, pr) |
483 | 1676 |
#installed_version = None |
1677 |
#package_iter = None #the iterator which points for other package |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1678 |
for authority in sections: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1679 |
for section in sections[authority]: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1680 |
for category in sections[authority][section].split(","): |
483 | 1681 |
self.__add_category_to_section(self._(category), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1682 |
self._(section), category_list) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1683 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1684 |
#1915 Sort the Categories into alphabetical order and prepend All Category |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1685 |
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
|
1686 |
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
|
1687 |
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
|
1688 |
r = [] |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1689 |
category_list.reorder([r[-1] for r in rows]) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1690 |
category_list.prepend([0, self._('All'), None, None, True, None]) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1691 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1692 |
progressdialog_progress(PACKAGE_PROGRESS_PERCENT_TOTAL, pkg_count, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1693 |
total_pkg_count) |
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
|
1694 |
gobject.idle_add(self.process_package_list_end, api_o, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1695 |
application_list, category_list, repositories_list) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1696 |
|
483 | 1697 |
def __add_package_to_category(self, category_name, category_description, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1698 |
category_icon, package, application_list, category_list): |
483 | 1699 |
if not package or category_name == self._('All'): |
1700 |
return |
|
1701 |
if not category_name: |
|
1702 |
return |
|
1703 |
# XXX check if needed |
|
1704 |
# category_name = self._('All') |
|
1705 |
# category_description = self._('All packages') |
|
1706 |
# category_icon = None |
|
1707 |
category_ref = None |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1708 |
for category in category_list: |
483 | 1709 |
if category[enumerations.CATEGORY_NAME] == category_name: |
1710 |
category_ref = category.iter |
|
1711 |
if not category_ref: # Category not exists |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1712 |
category_ref = category_list.append([len( \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1713 |
category_list)+1, category_name, category_description, \ |
483 | 1714 |
category_icon, True, None]) |
1715 |
if category_ref: |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1716 |
if application_list.get_value(package, \ |
483 | 1717 |
enumerations.CATEGORY_LIST_OBJECT): |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1718 |
a = application_list.get_value(package, \ |
483 | 1719 |
enumerations.CATEGORY_LIST_OBJECT) |
1720 |
a.append(category_ref) |
|
1721 |
else: |
|
1722 |
category_list = [] |
|
1723 |
category_list.append(category_ref) |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1724 |
application_list.set(package, \ |
483 | 1725 |
enumerations.CATEGORY_LIST_OBJECT, category_list) |
1726 |
||
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1727 |
def __add_category_to_section(self, category_name, section_name, category_list): |
483 | 1728 |
'''Adds the section to section list in category. If there is no such |
1729 |
section, than it is not added. If there was already section than it |
|
1730 |
is skipped. Sections must be case sensitive''' |
|
1731 |
if not category_name: |
|
1732 |
return |
|
1733 |
for section in self.section_list: |
|
1734 |
if section[enumerations.SECTION_NAME] == section_name: |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1735 |
for category in category_list: |
483 | 1736 |
if category[enumerations.CATEGORY_NAME] == \ |
1737 |
category_name: |
|
1738 |
if not category[ \ |
|
1739 |
enumerations.SECTION_LIST_OBJECT]: |
|
1740 |
category[ \ |
|
1741 |
enumerations. \ |
|
1742 |
SECTION_LIST_OBJECT] = \ |
|
1743 |
[section[ \ |
|
1744 |
enumerations.SECTION_ID], ] |
|
1745 |
else: |
|
1746 |
if not section_name in \ |
|
1747 |
category[ \ |
|
1748 |
enumerations. \ |
|
1749 |
SECTION_LIST_OBJECT]: |
|
1750 |
category[enumerations. \ |
|
1751 |
SECTION_LIST_OBJECT \ |
|
1752 |
].append(section[ \ |
|
1753 |
enumerations. \ |
|
1754 |
SECTION_ID]) |
|
1755 |
||
1756 |
def __get_pixbuf_from_path(self, path, icon_name): |
|
1757 |
icon = icon_name.replace(' ', '_') |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1758 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1759 |
# Performance: Faster to check if files exist rather than catching |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1760 |
# exceptions when they do not. Picked up open failures using dtrace |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1761 |
png_exists = os.path.exists(self.application_dir + path + icon + ".png") |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1762 |
svg_exists = os.path.exists(self.application_dir + path + icon + ".svg") |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1763 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1764 |
if not png_exists and not svg_exists: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1765 |
return None |
483 | 1766 |
try: |
1767 |
return gtk.gdk.pixbuf_new_from_file( \ |
|
1768 |
self.application_dir + path + icon + ".png") |
|
1769 |
except gobject.GError: |
|
1770 |
try: |
|
1771 |
return gtk.gdk.pixbuf_new_from_file( \ |
|
1772 |
self.application_dir + path + icon + ".svg") |
|
1773 |
except gobject.GError: |
|
1774 |
iconview = gtk.IconView() |
|
1775 |
icon = iconview.render_icon(getattr(gtk, \ |
|
1776 |
"STOCK_MISSING_IMAGE"), \ |
|
1777 |
size = gtk.ICON_SIZE_MENU, |
|
1778 |
detail = None) |
|
1779 |
# XXX Could return image-we don't want to show ugly icon. |
|
1780 |
return None |
|
1781 |
||
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1782 |
def __progressdialog_progress_pulse(self): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1783 |
while not self.progress_stop_timer_thread: |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
1784 |
gobject.idle_add(self.w_progressbar.pulse) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1785 |
time.sleep(0.1) |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
1786 |
gobject.idle_add(self.w_progress_dialog.hide) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1787 |
self.progress_stop_timer_thread = False |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1788 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1789 |
# For initial setup before loading package entries allow 5% of progress bar |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1790 |
# update it on a time base as we have no other way to judge progress at this point |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1791 |
def __progressdialog_progress_time(self): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1792 |
while not self.progress_stop_timer_thread and \ |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1793 |
self.progress_fraction_time_count <= \ |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1794 |
INITIAL_PROGRESS_TOTAL_PERCENTAGE: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1795 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1796 |
gobject.idle_add(self.w_progressbar.set_fraction, \ |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1797 |
self.progress_fraction_time_count) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1798 |
self.progress_fraction_time_count += \ |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1799 |
INITIAL_PROGRESS_TIME_PERCENTAGE |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1800 |
time.sleep(INITIAL_PROGRESS_TIME_INTERVAL) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1801 |
self.progress_stop_timer_thread = False |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1802 |
self.progress_fraction_time_count = 0 |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1803 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1804 |
def __progressdialog_progress_percent(self, fraction, count, total): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1805 |
gobject.idle_add(self.w_progressinfo_label.set_text, self._( \ |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1806 |
"Processing package entries: %d of %d") % (count, total) ) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1807 |
gobject.idle_add(self.w_progressbar.set_fraction, fraction) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1808 |
|
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1809 |
def error_occured(self, error_msg, msg_title=None, msg_type=gtk.MESSAGE_ERROR): |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1810 |
msgbox = gtk.MessageDialog(parent = \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1811 |
self.w_main_window, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1812 |
buttons = gtk.BUTTONS_CLOSE, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1813 |
flags = gtk.DIALOG_MODAL, \ |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1814 |
type = msg_type, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1815 |
message_format = None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1816 |
msgbox.set_markup(error_msg) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1817 |
title = None |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1818 |
if msg_title: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1819 |
title = msg_title |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1820 |
else: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1821 |
title = self._("Package Manager") |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1822 |
msgbox.set_title(title) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1823 |
msgbox.run() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1824 |
msgbox.destroy() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1825 |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1826 |
#-----------------------------------------------------------------------------# |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1827 |
# Static Methods |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1828 |
#-----------------------------------------------------------------------------# |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1829 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1830 |
@staticmethod |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1831 |
def N_(message): |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1832 |
return message |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1833 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1834 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1835 |
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
|
1836 |
return cmp(a[1], b[1]) |
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1837 |
|
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1838 |
@staticmethod |
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
|
1839 |
def __installed_fmris_from_args(api_o, args_f): |
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1840 |
found = [] |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1841 |
notfound = [] |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1842 |
try: |
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
|
1843 |
for m in api_o.img.inventory(args_f): |
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1844 |
found.append(m[0]) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
562
diff
changeset
|
1845 |
except api_errors.InventoryException, e: |
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1846 |
notfound = e.notfound |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1847 |
|
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1848 |
return notfound |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1849 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1850 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1851 |
def cell_data_function(column, renderer, model, itr, data): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1852 |
'''Function which sets the background colour to black if package is |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1853 |
selected''' |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1854 |
if itr: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1855 |
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
|
1856 |
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
|
1857 |
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
|
1858 |
else: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1859 |
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
|
1860 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1861 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1862 |
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
|
1863 |
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
|
1864 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1865 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1866 |
def combobox_id_separator(model, itr): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1867 |
return model.get_value(itr, 0) == -1 |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1868 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1869 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1870 |
def check_if_pkg_have_row_in_model(pkg, p_pkg): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1871 |
"""Returns True if package is already in model or False if not""" |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1872 |
if p_pkg: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1873 |
if pkg.is_same_pkg(p_pkg): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1874 |
return True |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1875 |
else: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1876 |
return False |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1877 |
return False |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1878 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1879 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1880 |
def category_filter(model, itr): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1881 |
'''This function filters category in the main application view''' |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1882 |
return model.get_value(itr, enumerations.CATEGORY_VISIBLE) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1883 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1884 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1885 |
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
|
1886 |
dt = None |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1887 |
try: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1888 |
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
|
1889 |
except AttributeError: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1890 |
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
|
1891 |
return dt |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1892 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1893 |
@staticmethod |
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
|
1894 |
def get_installed_version(api_o, pkg): |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1895 |
return api_o.img.get_version_installed(pkg) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1896 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1897 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1898 |
def get_manifest(img, package, filtered = True): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1899 |
'''helper function''' |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1900 |
# XXX Should go to the -> imageinfo.py |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1901 |
manifest = None |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1902 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1903 |
# 3087 shutdown time is too long when closing down soon after startup |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1904 |
if packagemanager.cancelled: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1905 |
return manifest |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1906 |
try: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1907 |
manifest = img.get_manifest(package, filtered) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1908 |
except OSError: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1909 |
# XXX It is possible here that the user doesn't have network con, |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1910 |
# XXX proper permissions to save manifest, should we do something |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1911 |
# XXX and popup information dialog? |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1912 |
pass |
562
afe71b27984d
3618 Manifest retrieval error needs more info and to not show a traceback
Brock Pytlik <bpytlik@sun.com>
parents:
561
diff
changeset
|
1913 |
except (retrieve.ManifestRetrievalError, |
afe71b27984d
3618 Manifest retrieval error needs more info and to not show a traceback
Brock Pytlik <bpytlik@sun.com>
parents:
561
diff
changeset
|
1914 |
retrieve.DatastreamRetrievalError, NameError): |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1915 |
pass |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1916 |
return manifest |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1917 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1918 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1919 |
def update_desc(description, pkg, package): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1920 |
p = pkg[enumerations.PACKAGE_OBJECT_COLUMN][0] |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1921 |
if p == package: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1922 |
pkg[enumerations.DESCRIPTION_COLUMN] = description |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1923 |
return |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1924 |
|
483 | 1925 |
#-----------------------------------------------------------------------------# |
1926 |
# Public Methods |
|
1927 |
#-----------------------------------------------------------------------------# |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1928 |
def setup_progressdialog_show(self): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1929 |
self.w_progress_dialog.set_title(self._("Loading Repository Information")) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1930 |
self.w_progressinfo_label.set_text( |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1931 |
self._( "Fetching package entries ...")) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1932 |
self.w_progress_cancel.hide() |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1933 |
self.w_progress_dialog.show() |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1934 |
Thread(target = self.__progressdialog_progress_time).start() |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1935 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1936 |
def init_sections(self): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1937 |
self.__init_sections() #Initiates sections |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1938 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1939 |
def init_show_filter(self): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1940 |
self.__init_show_filter() #Initiates filter |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1941 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1942 |
def reload_packages(self): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1943 |
self.api_o = self.__get_api_object(self.image_directory, self.pr) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1944 |
self.__on_reload(None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1945 |
|
483 | 1946 |
def process_package_list_start(self, image_directory): |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1947 |
self.cancelled = True |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1948 |
self.setup_progressdialog_show() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1949 |
while gtk.events_pending(): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1950 |
gtk.main_iteration(False) |
483 | 1951 |
self.image_directory = image_directory |
1952 |
# Create our image object based on image directory. |
|
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
|
1953 |
api_o = self.__get_api_object(image_directory, self.pr) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1954 |
api_o.img.load_catalogs(self.pr) |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1955 |
self.api_o = api_o |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1956 |
# Acquire image contents and update progress bar as you do so. |
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
|
1957 |
Thread(target = self.__get_image_from_directory, args = (api_o, |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1958 |
self.__progressdialog_progress_percent)).start() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1959 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1960 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1961 |
def __get_api_object(img_dir, progtrack): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1962 |
api_o = None |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1963 |
try: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1964 |
api_o = api.ImageInterface(img_dir, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1965 |
CLIENT_API_VERSION, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1966 |
progtrack, None, PKG_CLIENT_NAME) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1967 |
except (api_errors.VersionException,\ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1968 |
api_errors.ImageNotFoundException): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1969 |
raise |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1970 |
return api_o |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1971 |
|
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
|
1972 |
def process_package_list_end(self, api_o, application_list, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1973 |
category_list, repositories_list): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1974 |
self.__init_tree_views(application_list, category_list, repositories_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1975 |
self.update_statusbar() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1976 |
self.in_setup = 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
|
1977 |
self.__setup_repositories_combobox(api_o, repositories_list) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1978 |
self.cancelled = False |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1979 |
while gtk.events_pending(): |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1980 |
gtk.main_iteration(False) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1981 |
self.w_categories_treeview.expand_all() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1982 |
self.w_categories_treeview.grab_focus() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1983 |
self.w_categories_treeview.set_cursor(0, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1984 |
None, start_editing=False) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1985 |
self.w_application_treeview.expand_all() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1986 |
while gtk.events_pending(): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1987 |
gtk.main_iteration(False) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1988 |
self.__get_manifests_thread() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1989 |
self.w_progress_dialog.hide() |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1990 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1991 |
def __get_manifests_thread(self): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1992 |
Thread(target = self.get_manifests_for_packages, |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1993 |
args = ()).start() |
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1994 |
|
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1995 |
def get_icon_pixbuf(self, icon_name): |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1996 |
#2821: The get_icon_pixbuf should use PACKAGE_MANAGER_ROOT |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1997 |
return self.__get_pixbuf_from_path(self.application_dir + \ |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1998 |
"/usr/share/icons/package-manager/", icon_name) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1999 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2000 |
def get_manifests_for_packages(self): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2001 |
''' Function, which get's manifest for packages. If the manifest is not |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2002 |
locally tries to retrieve it. For installed packages gets manifest |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2003 |
for the particular version (local operation only), if the package is |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2004 |
not installed than the newest one''' |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2005 |
time.sleep(3) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2006 |
self.description_thread_running = True |
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
|
2007 |
img = self.api_o.img |
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
2008 |
img.history.operation_name = "info" |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2009 |
for pkg in self.application_list: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2010 |
if self.cancelled: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2011 |
self.description_thread_running = False |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2012 |
return |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2013 |
info = 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
|
2014 |
img = self.api_o.img |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2015 |
package = pkg[enumerations.PACKAGE_OBJECT_COLUMN][0] |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2016 |
if (img and package): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2017 |
version = img.has_version_installed(package) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2018 |
if version: |
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
|
2019 |
version = \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
2020 |
self.get_installed_version(self.api_o, \ |
483 | 2021 |
package) |
2022 |
man = self.get_manifest(img, version, \ |
|
2023 |
filtered = True) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2024 |
if man: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2025 |
info = man.get("description", "") |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2026 |
else: |
483 | 2027 |
newest = max( \ |
2028 |
pkg[enumerations.PACKAGE_OBJECT_COLUMN]) |
|
2029 |
man = self.get_manifest(img, newest, \ |
|
2030 |
filtered = True) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2031 |
if man: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2032 |
info = man.get("description", "") |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2033 |
# XXX workaround, this should be done nicer |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
2034 |
gobject.idle_add(self.update_desc, info, pkg, package) |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
2035 |
time.sleep(0.01) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2036 |
img.history.operation_name = "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
|
2037 |
img = self.api_o.img |
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
2038 |
img.history.operation_result = history.RESULT_SUCCEEDED |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2039 |
self.description_thread_running = False |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
2040 |
|
483 | 2041 |
def update_statusbar(self): |
2042 |
'''Function which updates statusbar''' |
|
2043 |
installed = 0 |
|
2044 |
selected = 0 |
|
2045 |
broken = 0 |
|
2046 |
for pkg in self.application_list: |
|
2047 |
if pkg[enumerations.INSTALLED_VERSION_COLUMN]: |
|
2048 |
installed = installed + 1 |
|
2049 |
if pkg[enumerations.MARK_COLUMN]: |
|
2050 |
selected = selected + 1 |
|
2051 |
listed_str = self._('%d packages listed') % len(self.application_list) |
|
2052 |
inst_str = self._('%d installed') % installed |
|
2053 |
sel_str = self._('%d selected') % selected |
|
2054 |
broken_str = self._('%d broken') % broken |
|
2055 |
self.w_main_statusbar.push(0, listed_str + ', ' + inst_str + ', ' + \ |
|
2056 |
sel_str + ', ' + broken_str + '.') |
|
2057 |
||
2058 |
||
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2059 |
def update_package_list(self, update_list): |
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
|
2060 |
img = self.api_o.img |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2061 |
img.clear_pkg_state() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2062 |
img.load_catalogs(self.pr) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2063 |
installed_icon = self.get_icon_pixbuf("status_installed") |
483 | 2064 |
for row in self.application_list: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2065 |
status_icon = None |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2066 |
if row[enumerations.MARK_COLUMN] or \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2067 |
row[enumerations.NAME_COLUMN] in update_list: |
483 | 2068 |
pkg = row[enumerations.PACKAGE_OBJECT_COLUMN][0] |
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
|
2069 |
package_installed = \ |
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
2070 |
self.get_installed_version(self.api_o, pkg) |
483 | 2071 |
version_installed = None |
2072 |
if package_installed: |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2073 |
status_icon = installed_icon |
483 | 2074 |
version_installed = \ |
2075 |
package_installed.version.get_short_version() |
|
2076 |
row[enumerations.MARK_COLUMN] = False |
|
2077 |
row[enumerations.INSTALLED_VERSION_COLUMN] = \ |
|
2078 |
version_installed |
|
2079 |
row[enumerations.INSTALLED_OBJECT_COLUMN] = \ |
|
2080 |
package_installed |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2081 |
row[enumerations.STATUS_ICON_COLUMN] = \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2082 |
status_icon |
483 | 2083 |
if not package_installed: |
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
2084 |
pkg = max(row[enumerations.PACKAGE_OBJECT_COLUMN]) |
483 | 2085 |
dt = self.get_datetime(pkg.version) |
2086 |
dt_str = (":%02d%02d") % (dt.month, dt.day) |
|
2087 |
available_version = \ |
|
2088 |
pkg.version.get_short_version() + dt_str |
|
2089 |
row[enumerations.LATEST_AVAILABLE_COLUMN] = \ |
|
2090 |
available_version |
|
2091 |
else: |
|
2092 |
row[enumerations.LATEST_AVAILABLE_COLUMN] = None |
|
2093 |
self.w_installupdate_button.set_sensitive(False) |
|
2094 |
self.w_installupdate_menuitem.set_sensitive(False) |
|
2095 |
self.w_remove_button.set_sensitive(False) |
|
2096 |
self.w_remove_menuitem.set_sensitive(False) |
|
2097 |
self.__enable_disable_selection_menus() |
|
2098 |
self.update_statusbar() |
|
2099 |
||
2100 |
def shutdown_after_ips_update(self): |
|
2101 |
||
2102 |
# 2790: As IPS and IPS-GUI have been updated the IPS GUI must be shutdown |
|
2103 |
# and restarted |
|
2104 |
msgbox = gtk.MessageDialog(parent = self.w_main_window, \ |
|
2105 |
buttons = gtk.BUTTONS_OK, \ |
|
2106 |
flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO, \ |
|
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
2107 |
message_format = self._("SUNWipkg and SUNWipkg-gui have been " \ |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
2108 |
"updated and Package Manager will now be restarted.\n\nAfter " \ |
483 | 2109 |
"restart select Update All to continue.")) |
2110 |
msgbox.set_title(self._("Update All")) |
|
2111 |
msgbox.run() |
|
2112 |
msgbox.destroy() |
|
2113 |
self.__main_application_quit(restart_app = True) |
|
2114 |
||
2115 |
def shutdown_after_image_update(self): |
|
2116 |
||
2117 |
msgbox = gtk.MessageDialog(parent = self.w_main_window, \ |
|
2118 |
buttons = gtk.BUTTONS_OK, \ |
|
2119 |
flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO, \ |
|
653
2354712b6ff7
4213 CLI PM and UM need to point to correct release note URL on successful image update
John Rice <john.rice@sun.com>
parents:
641
diff
changeset
|
2120 |
message_format = self._("Update All has completed and Package " \ |
2354712b6ff7
4213 CLI PM and UM need to point to correct release note URL on successful image update
John Rice <john.rice@sun.com>
parents:
641
diff
changeset
|
2121 |
"Manager will now exit.\n\nPlease reboot after reviewing the " \ |
2354712b6ff7
4213 CLI PM and UM need to point to correct release note URL on successful image update
John Rice <john.rice@sun.com>
parents:
641
diff
changeset
|
2122 |
"release notes posted at:\n\n" \ |
2354712b6ff7
4213 CLI PM and UM need to point to correct release note URL on successful image update
John Rice <john.rice@sun.com>
parents:
641
diff
changeset
|
2123 |
"http://opensolaris.org/os/project/indiana/resources/" \ |
2354712b6ff7
4213 CLI PM and UM need to point to correct release note URL on successful image update
John Rice <john.rice@sun.com>
parents:
641
diff
changeset
|
2124 |
"relnotes/200811/x86/")) |
483 | 2125 |
msgbox.set_title(self._("Update All")) |
2126 |
msgbox.run() |
|
2127 |
msgbox.destroy() |
|
2128 |
self.__main_application_quit() |
|
2129 |
||
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2130 |
############################################################################### |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2131 |
#-----------------------------------------------------------------------------# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2132 |
# Test functions |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2133 |
#-----------------------------------------------------------------------------# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2134 |
def fill_with_fake_data(self): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2135 |
'''test data for gui''' |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2136 |
self.application_list = self.__get_new_application_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2137 |
self.category_list = self.__get_new_category_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2138 |
self.section_list = self.__get_new_section_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2139 |
self.filter_list = self.__get_new_filter_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2140 |
self.repositories_list = self.__get_new_repositories_liststore() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2141 |
|
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2142 |
app1 = [False, self.get_icon_pixbuf("locked"), \ |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2143 |
self.get_icon_pixbuf("None"), "acc", None, None, None, 4, "desc6", \ |
483 | 2144 |
"Object Name1", None, True, None] |
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2145 |
app2 = [False, self.get_icon_pixbuf("update_available"), \ |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2146 |
self.get_icon_pixbuf(self._('All')), "acc_gam", \ |
483 | 2147 |
"2.3", None, "2.8", \ |
2148 |
4, "desc7", "Object Name2", None, True, None] |
|
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2149 |
app3 = [False, self.get_icon_pixbuf("None"), \ |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2150 |
self.get_icon_pixbuf("Other"), "gam_grap", "2.3", None, None, 4, \ |
483 | 2151 |
"desc8", "Object Name3", None, True, None] |
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2152 |
app4 = [False, self.get_icon_pixbuf("update_locked"), \ |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2153 |
self.get_icon_pixbuf("Office"), "grap_gam", "2.3", None, "2.8", 4, \ |
483 | 2154 |
"desc9", "Object Name2", None, True, None] |
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2155 |
app5 = [False, self.get_icon_pixbuf("update_available"), \ |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2156 |
self.get_icon_pixbuf("None"), "grap", "2.3", None, "2.8", 4, \ |
483 | 2157 |
"desc0", "Object Name3", None, True, None] |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2158 |
itr1 = self.application_list.append(app1) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2159 |
itr2 = self.application_list.append(app2) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2160 |
itr3 = self.application_list.append(app3) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2161 |
itr4 = self.application_list.append(app4) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2162 |
itr5 = self.application_list.append(app5) |
483 | 2163 |
# self.__add_package_to_category(_("All"),None,None,None); |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2164 |
self.__add_package_to_category(self._("Accessories"), \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2165 |
None, None, itr1, self.application_list, self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2166 |
self.__add_package_to_category(self._("Accessories"), None, None, itr2, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2167 |
self.application_list, self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2168 |
self.__add_package_to_category(self._("Games"), None, None, itr3, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2169 |
self.application_list, self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2170 |
self.__add_package_to_category(self._("Graphics"), None, None, itr3, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2171 |
self.application_list, self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2172 |
self.__add_package_to_category(self._("Games"), None, None, itr2, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2173 |
self.application_list, self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2174 |
self.__add_package_to_category(self._("Graphics"), None, None, itr4, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2175 |
self.application_list, self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2176 |
self.__add_package_to_category(self._("Games"), None, None, itr4, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2177 |
self.application_list, self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2178 |
self.__add_package_to_category(self._("Graphics"), None, None, itr5, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2179 |
self.application_list, self.category_list) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2180 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2181 |
# Category names until xdg is imported. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2182 |
# from xdg.DesktopEntry import * |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2183 |
# entry = DesktopEntry () |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2184 |
# directory = '/usr/share/desktop-directories' |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2185 |
# for root, dirs, files in os.walk (directory): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2186 |
# for name in files: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2187 |
# entry.parse (os.path.join (root, name)) |
483 | 2188 |
# self.__add_category_to_section (entry.getName (), \ |
2189 |
# self._('Applications Desktop')) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2190 |
|
483 | 2191 |
self.__add_category_to_section(self._("Accessories"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2192 |
self._('Applications Desktop'), self.category_list) |
483 | 2193 |
self.__add_category_to_section(self._("Games"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2194 |
self._('Applications Desktop'), self.category_list) |
483 | 2195 |
self.__add_category_to_section(self._("Graphics"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2196 |
self._('Applications Desktop'), self.category_list) |
483 | 2197 |
self.__add_category_to_section(self._("Internet"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2198 |
self._('Applications Desktop'), self.category_list) |
483 | 2199 |
self.__add_category_to_section(self._("Office"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2200 |
self._('Applications Desktop'), self.category_list) |
483 | 2201 |
self.__add_category_to_section(self._("Sound & Video"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2202 |
self._('Applications Desktop'), self.category_list) |
483 | 2203 |
self.__add_category_to_section(self._("System Tools"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2204 |
self._('Applications Desktop'), self.category_list) |
483 | 2205 |
self.__add_category_to_section(self._("Universal Access"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2206 |
self._('Applications Desktop'), self.category_list) |
483 | 2207 |
self.__add_category_to_section(self._("Developer Tools"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2208 |
self._('Applications Desktop'), self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2209 |
self.__add_category_to_section(self._("Core"), \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2210 |
self._('Operating System'), self.category_list) |
483 | 2211 |
self.__add_category_to_section(self._("Graphics"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2212 |
self._('Operating System'), self.category_list) |
483 | 2213 |
self.__add_category_to_section(self._("Media"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2214 |
self._('Operating System'), self.category_list) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2215 |
#Can be twice :) |
483 | 2216 |
self.__add_category_to_section(self._("Developer Tools"), \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2217 |
self._('Operating System'), self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2218 |
self.__add_category_to_section(self._("Office"), "Progs", \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2219 |
self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2220 |
self.__add_category_to_section(self._("Office2"), "Progs", \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2221 |
self.category_list) |
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
|
2222 |
self.__setup_repositories_combobox(self.api_o) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
2223 |
self.in_setup = False |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2224 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2225 |
############################################################################### |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2226 |
#-----------------------------------------------------------------------------# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2227 |
# Main |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2228 |
#-----------------------------------------------------------------------------# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2229 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2230 |
def main(): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2231 |
gtk.main() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2232 |
return 0 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2233 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2234 |
if __name__ == '__main__': |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2235 |
packagemanager = PackageManager() |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2236 |
passed_test_arg = False |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2237 |
passed_imagedir_arg = False |
561
be1ad23e7704
1651 pkg treats -R <bogus-dir> as "use the image at /"
Brock Pytlik <bpytlik@sun.com>
parents:
560
diff
changeset
|
2238 |
packagemanager.provided_image_dir = True |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2239 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2240 |
try: |
483 | 2241 |
opts, args = getopt.getopt(sys.argv[1:], "htR:", \ |
2242 |
["help", "test-gui", "image-dir="]) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2243 |
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
|
2244 |
print "%s, for help use --help" % msg |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2245 |
sys.exit(2) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2246 |
|
483 | 2247 |
cmd = os.path.join(os.getcwd(), sys.argv[0]) |
2248 |
cmd = os.path.realpath(cmd) |
|
2249 |
packagemanager.application_path = cmd |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2250 |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2251 |
for option, argument in opts: |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2252 |
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
|
2253 |
print """\ |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2254 |
Use -R (--image-dir) to specify image directory. |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2255 |
Use -t (--test-gui) to work on fake data.""" |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2256 |
sys.exit(0) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2257 |
if option in ("-t", "--test-gui"): |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2258 |
passed_test_arg = True |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2259 |
if option in ("-R", "--image-dir"): |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2260 |
packagemanager.image_dir_arg = argument |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2261 |
image_dir = argument |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2262 |
passed_imagedir_arg = True |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2263 |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2264 |
if passed_test_arg and passed_imagedir_arg: |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2265 |
print "Options -R and -t can not be used together." |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2266 |
sys.exit(2) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2267 |
if not passed_imagedir_arg: |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2268 |
try: |
483 | 2269 |
image_dir = os.environ["PKG_IMAGE"] |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2270 |
except KeyError: |
483 | 2271 |
image_dir = os.getcwd() |
561
be1ad23e7704
1651 pkg treats -R <bogus-dir> as "use the image at /"
Brock Pytlik <bpytlik@sun.com>
parents:
560
diff
changeset
|
2272 |
packagemanager.provided_image_dir = False |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2273 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2274 |
while gtk.events_pending(): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2275 |
gtk.main_iteration(False) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2276 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2277 |
packagemanager.init_sections() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2278 |
packagemanager.init_show_filter() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2279 |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2280 |
if not passed_test_arg: |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2281 |
packagemanager.process_package_list_start(image_dir) |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
2282 |
else: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
2283 |
packagemanager.fill_with_fake_data() |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
2284 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2285 |
main() |