author | Padraig O'Briain <padraig.obriain@sun.com> |
Mon, 22 Dec 2008 08:10:44 +0000 | |
changeset 796 | bcd90655ad83 |
parent 795 | fbb9b3da7188 |
child 808 | 6c89385ac9ff |
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 |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
42 |
TYPE_AHEAD_DELAY = 600 # 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) |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
68 |
import pkg.misc as misc |
539
7486304966c5
1449 pkg requires operational history
Shawn Walker <shawn.walker@sun.com>
parents:
537
diff
changeset
|
69 |
import pkg.client.history as history |
424
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 = "/" |
791
123e9401e939
5778 Inability to set locale leads to stack trace
Danek Duvall <danek.duvall@sun.com>
parents:
781
diff
changeset
|
103 |
misc.setlocale(locale.LC_ALL, "") |
424
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) |
757
995eec9b002a
5064 The buttons are missing icons
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
724
diff
changeset
|
200 |
w_whats_new_button = w_tree_main.get_widget("whats_new_button") |
995eec9b002a
5064 The buttons are missing icons
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
724
diff
changeset
|
201 |
#The whats new button hidden as this is not yet available |
995eec9b002a
5064 The buttons are missing icons
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
724
diff
changeset
|
202 |
w_whats_new_button.set_visible_horizontal(False) |
995eec9b002a
5064 The buttons are missing icons
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
724
diff
changeset
|
203 |
w_whats_new_button.set_visible_vertical(False) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
204 |
|
483 | 205 |
self.__update_reload_button() |
206 |
self.w_main_clipboard.request_text(self.__clipboard_text_received) |
|
207 |
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
|
208 |
|
483 | 209 |
try: |
210 |
dic_mainwindow = \ |
|
211 |
{ |
|
212 |
"on_mainwindow_delete_event": \ |
|
213 |
self.__on_mainwindow_delete_event, |
|
214 |
"on_searchentry_changed":self.__on_searchentry_changed, |
|
215 |
"on_searchentry_focus_in_event": \ |
|
216 |
self.__on_searchentry_focus_in, |
|
217 |
"on_searchentry_focus_out_event": \ |
|
218 |
self.__on_searchentry_focus_out, |
|
219 |
"on_searchentry_event":self.__on_searchentry_event, |
|
220 |
"on_sectionscombobox_changed": \ |
|
221 |
self.__on_sectionscombobox_changed, |
|
222 |
"on_filtercombobox_changed": \ |
|
223 |
self.__on_filtercombobox_changed, |
|
224 |
"on_repositorycombobox_changed": \ |
|
225 |
self.__on_repositorycombobox_changed, |
|
226 |
#menu signals |
|
227 |
"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
|
228 |
"on_file_be_activate":self.__on_file_be_activate, |
483 | 229 |
"on_package_install_update_activate": \ |
230 |
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
|
231 |
"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
|
232 |
self.__on_edit_repositories_activate, |
483 | 233 |
"on_package_remove_activate":self.__on_remove, |
234 |
"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
|
235 |
"on_help_help_activate":self.__on_help_help, |
483 | 236 |
"on_edit_paste_activate":self.__on_edit_paste, |
237 |
"on_edit_clear_activate":self.__on_clear_paste, |
|
238 |
"on_edit_copy_activate":self.__on_copy, |
|
239 |
"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
|
240 |
"on_clear_search_clicked":self.__on_clear_search, |
483 | 241 |
"on_edit_select_all_activate":self.__on_select_all, |
242 |
"on_edit_select_updates_activate": \ |
|
243 |
self.__on_select_updates, |
|
244 |
"on_edit_deselect_activate":self.__on_deselect, |
|
245 |
# XXX disabled until new API |
|
246 |
"on_package_update_all_activate":self.__on_update_all, |
|
247 |
#toolbar signals |
|
248 |
# XXX disabled until new API |
|
249 |
"on_update_all_button_clicked":self.__on_update_all, |
|
250 |
"on_reload_button_clicked":self.__on_reload, |
|
251 |
"on_install_update_button_clicked": \ |
|
252 |
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
|
253 |
"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
|
254 |
"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
|
255 |
self.__on_notebook_change, |
483 | 256 |
} |
257 |
dic_progress = \ |
|
258 |
{ |
|
259 |
"on_cancel_progressdialog_clicked": \ |
|
260 |
self.__on_cancel_progressdialog_clicked, |
|
261 |
} |
|
262 |
w_tree_main.signal_autoconnect(dic_mainwindow) |
|
263 |
w_tree_progress.signal_autoconnect(dic_progress) |
|
264 |
except AttributeError, error: |
|
265 |
print self._( \ |
|
266 |
'GUI will not respond to any event! %s.' + \ |
|
267 |
'Check declare_signals()') \ |
|
268 |
% error |
|
269 |
||
270 |
self.package_selection = None |
|
271 |
self.category_list_filter = None |
|
697 | 272 |
self.application_list_filter = None |
273 |
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
|
274 |
self.in_setup = True |
483 | 275 |
self.w_main_window.show_all() |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
276 |
gdk_win = self.w_main_window.get_window() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
277 |
self.gdk_window = gtk.gdk.Window(gdk_win, gtk.gdk.screen_width(), |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
278 |
gtk.gdk.screen_height(), gtk.gdk.WINDOW_CHILD, 0, gtk.gdk.INPUT_ONLY) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
279 |
gdk_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
280 |
self.gdk_window.set_cursor(gdk_cursor) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
281 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
282 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
283 |
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
|
284 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
285 |
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
|
286 |
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
|
287 |
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
|
288 |
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
|
289 |
gobject.TYPE_STRING, # enumerations.DESCRIPTION_COLUMN |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
290 |
gobject.TYPE_INT, # enumerations.STATUS_COLUMN |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
291 |
gobject.TYPE_PYOBJECT, # enumerations.FMRI_COLUMN |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
292 |
gobject.TYPE_STRING, # enumerations.STEM_COLUMN |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
293 |
gobject.TYPE_STRING, # enumerations.DISPLAY_NAME_COLUMN |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
294 |
gobject.TYPE_BOOLEAN, # enumerations.IS_VISIBLE_COLUMN |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
295 |
gobject.TYPE_PYOBJECT # enumerations.CATEGORY_LIST_COLUMN |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
296 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
297 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
298 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
299 |
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
|
300 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
301 |
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
|
302 |
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
|
303 |
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
|
304 |
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
|
305 |
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
|
306 |
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
|
307 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
308 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
309 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
310 |
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
|
311 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
312 |
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
|
313 |
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
|
314 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
315 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
316 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
317 |
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
|
318 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
319 |
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
|
320 |
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
|
321 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
322 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
323 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
324 |
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
|
325 |
return gtk.ListStore( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
326 |
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
|
327 |
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
|
328 |
) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
329 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
330 |
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
|
331 |
'''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
|
332 |
filters''' |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
333 |
self.__disconnect_models() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
334 |
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
|
335 |
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
|
336 |
##APPLICATION MAIN TREEVIEW |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
337 |
application_list_filter = application_list.filter_new() |
483 | 338 |
application_list_sort = \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
339 |
gtk.TreeModelSort(application_list_filter) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
340 |
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
|
341 |
enumerations.NAME_COLUMN, gtk.SORT_ASCENDING) |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
342 |
application_list_sort.set_sort_func(\ |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
343 |
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
|
344 |
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
|
345 |
|
483 | 346 |
column = gtk.TreeViewColumn("", toggle_renderer, \ |
347 |
active = enumerations.MARK_COLUMN) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
348 |
column.set_sort_column_id(enumerations.MARK_COLUMN) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
349 |
column.set_sort_indicator(True) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
350 |
column.set_cell_data_func(toggle_renderer, self.cell_data_function, None) |
483 | 351 |
self.w_application_treeview.append_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
352 |
column = gtk.TreeViewColumn() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
353 |
column.set_title("") |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
354 |
#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
|
355 |
#column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
356 |
render_pixbuf = gtk.CellRendererPixbuf() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
357 |
column.pack_start(render_pixbuf, expand = False) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
358 |
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
|
359 |
column.set_fixed_width(32) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
360 |
column.set_cell_data_func(render_pixbuf, self.cell_data_function, None) |
483 | 361 |
self.w_application_treeview.append_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
362 |
name_renderer = gtk.CellRendererText() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
363 |
column = gtk.TreeViewColumn(self._("Name"), name_renderer, \ |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
364 |
text = enumerations.NAME_COLUMN) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
365 |
column.set_resizable(True) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
366 |
column.set_sort_column_id(enumerations.NAME_COLUMN) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
367 |
column.set_sort_indicator(True) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
368 |
column.set_cell_data_func(name_renderer, self.cell_data_function, None) |
483 | 369 |
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
|
370 |
column = gtk.TreeViewColumn() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
371 |
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
|
372 |
#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
|
373 |
#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
|
374 |
render_pixbuf = gtk.CellRendererPixbuf() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
375 |
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
|
376 |
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
|
377 |
enumerations.STATUS_ICON_COLUMN) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
378 |
column.set_fixed_width(32) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
379 |
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
|
380 |
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
|
381 |
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
|
382 |
self.w_application_treeview.append_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
383 |
description_renderer = gtk.CellRendererText() |
483 | 384 |
column = gtk.TreeViewColumn(self._('Description'), \ |
385 |
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
|
386 |
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
|
387 |
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
|
388 |
column.set_sort_indicator(True) |
483 | 389 |
column.set_cell_data_func(description_renderer, \ |
390 |
self.cell_data_function, None) |
|
391 |
self.w_application_treeview.append_column(column) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
392 |
#Added selection listener |
483 | 393 |
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
|
394 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
395 |
##CATEGORIES TREEVIEW |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
396 |
#enumerations.CATEGORY_NAME |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
397 |
category_list_filter = category_list.filter_new() |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
398 |
enumerations.CATEGORY_NAME_renderer = gtk.CellRendererText() |
483 | 399 |
column = gtk.TreeViewColumn(self._('Name'), \ |
400 |
enumerations.CATEGORY_NAME_renderer, \ |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
401 |
text = enumerations.CATEGORY_NAME) |
483 | 402 |
self.w_categories_treeview.append_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
403 |
#Added selection listener |
483 | 404 |
category_selection = self.w_categories_treeview.get_selection() |
405 |
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
|
406 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
407 |
if self.first_run: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
408 |
##SECTION COMBOBOX |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
409 |
#enumerations.SECTION_NAME |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
410 |
cell = gtk.CellRendererText() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
411 |
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
|
412 |
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
|
413 |
enumerations.SECTION_NAME) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
414 |
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
|
415 |
self.combobox_id_separator) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
416 |
##FILTER COMBOBOX |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
417 |
#enumerations.FILTER_NAME |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
418 |
cell = gtk.CellRendererText() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
419 |
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
|
420 |
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
|
421 |
enumerations.FILTER_NAME) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
422 |
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
|
423 |
self.combobox_id_separator) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
424 |
##FILTER COMBOBOX |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
425 |
#enumerations.FILTER_NAME |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
426 |
cell = gtk.CellRendererText() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
427 |
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
|
428 |
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
|
429 |
enumerations.REPOSITORY_NAME) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
430 |
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
|
431 |
self.combobox_id_separator) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
432 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
433 |
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
|
434 |
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
|
435 |
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
|
436 |
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
|
437 |
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
|
438 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
439 |
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
|
440 |
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
|
441 |
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
|
442 |
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
|
443 |
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
|
444 |
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
|
445 |
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
|
446 |
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
|
447 |
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
|
448 |
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
|
449 |
application_list_sort) |
483 | 450 |
category_selection.connect("changed", \ |
451 |
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
|
452 |
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
|
453 |
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
|
454 |
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
|
455 |
self.first_run = False |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
456 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
457 |
def __disconnect_models(self): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
458 |
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
|
459 |
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
|
460 |
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
|
461 |
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
|
462 |
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
|
463 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
464 |
@staticmethod |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
465 |
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
|
466 |
get_val = treemodel.get_value |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
467 |
status1 = get_val(iter1, enumerations.STATUS_COLUMN) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
468 |
status2 = get_val(iter2, enumerations.STATUS_COLUMN) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
469 |
return cmp(status1, status2) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
470 |
|
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
471 |
@staticmethod |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
472 |
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
|
473 |
columns = treeview.get_columns() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
474 |
if columns: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
475 |
for column in columns: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
476 |
treeview.remove_column(column) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
477 |
|
483 | 478 |
def __init_sections(self): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
479 |
'''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
|
480 |
Category. It sets active section combobox entry "All"''' |
795
fbb9b3da7188
5230 UI improvements - to many "All" possibilities
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
793
diff
changeset
|
481 |
self.section_list.append([0, self._('All Categories'), ]) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
482 |
self.section_list.append([-1, "", ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
483 |
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
|
484 |
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
|
485 |
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
|
486 |
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
|
487 |
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
|
488 |
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
|
489 |
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
|
490 |
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
|
491 |
|
483 | 492 |
def __init_show_filter(self): |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
493 |
self.filter_list.append([0, self._('All Packages'), ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
494 |
self.filter_list.append([-1, "", ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
495 |
self.filter_list.append([2, self._('Installed Packages'), ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
496 |
self.filter_list.append([3, self._('Updates'), ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
497 |
self.filter_list.append([4, self._('Non-installed Packages'), ]) |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
498 |
self.filter_list.append([-1, "", ]) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
499 |
# self.filter_list.append([self._('Locked Packages'), ]) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
500 |
# self.filter_list.append(["", ]) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
501 |
self.filter_list.append([6, self._('Selected Packages'), ]) |
483 | 502 |
|
503 |
def __on_cancel_progressdialog_clicked(self, widget): |
|
504 |
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
|
505 |
self.progress_stop_timer_thread = True |
483 | 506 |
|
507 |
def __on_mainwindow_delete_event(self, widget, event): |
|
508 |
''' handler for delete event of the main window ''' |
|
509 |
if self.__check_if_something_was_changed() == True: |
|
510 |
# XXX Change this to not quit and show dialog |
|
511 |
# XXX if some changes were applied: |
|
512 |
self.__main_application_quit() |
|
513 |
return True |
|
514 |
else: |
|
515 |
self.__main_application_quit() |
|
516 |
||
517 |
def __on_file_quit_activate(self, widget): |
|
518 |
''' handler for quit menu event ''' |
|
519 |
self.__on_mainwindow_delete_event(None, None) |
|
520 |
||
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
521 |
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
|
522 |
''' 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
|
523 |
repository.Repository(self) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
524 |
|
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
525 |
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
|
526 |
''' 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
|
527 |
beadm.Beadmin(self) |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
528 |
|
483 | 529 |
def __on_searchentry_changed(self, widget): |
530 |
'''On text search field changed we should refilter the main view''' |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
531 |
self.set_busy_cursor() |
697 | 532 |
if self.application_refilter_id != 0: |
533 |
gobject.source_remove(self.application_refilter_id) |
|
534 |
self.application_refilter_id = 0 |
|
535 |
if self.w_searchentry_dialog.get_text() == "": |
|
536 |
self.application_refilter_id = \ |
|
537 |
gobject.idle_add(self.__application_refilter) |
|
538 |
else: |
|
539 |
self.application_refilter_id = \ |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
540 |
gobject.timeout_add(TYPE_AHEAD_DELAY, |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
541 |
self.__application_refilter) |
483 | 542 |
|
697 | 543 |
def __application_refilter(self): |
793
0f219154d202
5526 Package Manager _very_ slow after UA "Screen R&M" turned on
Padraig O'Briain <padraig.obriain@sun.com>
parents:
791
diff
changeset
|
544 |
''' Disconnecting the model from the treeview improves |
0f219154d202
5526 Package Manager _very_ slow after UA "Screen R&M" turned on
Padraig O'Briain <padraig.obriain@sun.com>
parents:
791
diff
changeset
|
545 |
performance when assistive technologies are enabled''' |
0f219154d202
5526 Package Manager _very_ slow after UA "Screen R&M" turned on
Padraig O'Briain <padraig.obriain@sun.com>
parents:
791
diff
changeset
|
546 |
model = self.w_application_treeview.get_model() |
0f219154d202
5526 Package Manager _very_ slow after UA "Screen R&M" turned on
Padraig O'Briain <padraig.obriain@sun.com>
parents:
791
diff
changeset
|
547 |
self.w_application_treeview.set_model(None) |
697 | 548 |
self.application_list_filter.refilter() |
793
0f219154d202
5526 Package Manager _very_ slow after UA "Screen R&M" turned on
Padraig O'Briain <padraig.obriain@sun.com>
parents:
791
diff
changeset
|
549 |
self.w_application_treeview.set_model(model) |
483 | 550 |
gobject.idle_add(self.__enable_disable_selection_menus) |
697 | 551 |
self.application_refilter_id = 0 |
552 |
return False |
|
483 | 553 |
|
554 |
def __on_edit_paste(self, widget): |
|
555 |
self.w_searchentry_dialog.insert_text(self.main_clipboard_text, \ |
|
556 |
self.w_searchentry_dialog.get_position()) |
|
557 |
||
558 |
def __on_clear_paste(self, widget): |
|
559 |
bounds = self.w_searchentry_dialog.get_selection_bounds() |
|
560 |
self.w_searchentry_dialog.delete_text(bounds[0], bounds[1]) |
|
561 |
return |
|
562 |
||
563 |
def __on_copy(self, widget): |
|
564 |
bounds = self.w_searchentry_dialog.get_selection_bounds() |
|
565 |
text = self.w_searchentry_dialog.get_chars(bounds[0], bounds[1]) |
|
566 |
self.w_main_clipboard.set_text(text) |
|
567 |
return |
|
568 |
||
569 |
def __on_cut(self, widget): |
|
570 |
bounds = self.w_searchentry_dialog.get_selection_bounds() |
|
571 |
text = self.w_searchentry_dialog.get_chars(bounds[0], bounds[1]) |
|
572 |
self.w_searchentry_dialog.delete_text(bounds[0], bounds[1]) |
|
573 |
self.w_main_clipboard.set_text(text) |
|
574 |
return |
|
575 |
||
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
576 |
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
|
577 |
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
|
578 |
return |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
579 |
|
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
|
580 |
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
|
581 |
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
|
582 |
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
|
583 |
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
|
584 |
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
|
585 |
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
|
586 |
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
|
587 |
|
483 | 588 |
def __on_select_all(self, widget): |
589 |
sort_filt_model = \ |
|
590 |
self.w_application_treeview.get_model() #gtk.TreeModelSort |
|
591 |
filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter |
|
592 |
model = filt_model.get_model() #gtk.ListStore |
|
593 |
iter_next = sort_filt_model.get_iter_first() |
|
594 |
list_of_paths = [] |
|
595 |
while iter_next != None: |
|
596 |
sorted_path = sort_filt_model.get_path(iter_next) |
|
597 |
filtered_path = \ |
|
598 |
sort_filt_model.convert_path_to_child_path(sorted_path) |
|
599 |
path = filt_model.convert_path_to_child_path(filtered_path) |
|
600 |
list_of_paths.append(path) |
|
601 |
iter_next = sort_filt_model.iter_next(iter_next) |
|
602 |
for path in list_of_paths: |
|
603 |
itr = model.get_iter(path) |
|
604 |
model.set_value(itr, enumerations.MARK_COLUMN, True) |
|
605 |
self.__enable_disable_selection_menus() |
|
606 |
self.update_statusbar() |
|
607 |
self.__enable_disable_install_update() |
|
608 |
self.__enable_disable_remove() |
|
609 |
||
610 |
def __on_select_updates(self, widget): |
|
611 |
sort_filt_model = \ |
|
612 |
self.w_application_treeview.get_model() #gtk.TreeModelSort |
|
613 |
filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter |
|
614 |
model = filt_model.get_model() #gtk.ListStore |
|
615 |
iter_next = sort_filt_model.get_iter_first() |
|
616 |
list_of_paths = [] |
|
617 |
while iter_next != None: |
|
618 |
sorted_path = sort_filt_model.get_path(iter_next) |
|
619 |
filtered_iter = sort_filt_model.convert_iter_to_child_iter(None, \ |
|
620 |
iter_next) |
|
621 |
app_iter = filt_model.convert_iter_to_child_iter(filtered_iter) |
|
622 |
||
623 |
filtered_path = \ |
|
624 |
sort_filt_model.convert_path_to_child_path(sorted_path) |
|
625 |
path = filt_model.convert_path_to_child_path(filtered_path) |
|
626 |
if model.get_value(app_iter, \ |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
627 |
enumerations.STATUS_COLUMN) == enumerations.UPDATABLE: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
628 |
list_of_paths.append(path) |
483 | 629 |
iter_next = sort_filt_model.iter_next(iter_next) |
630 |
for path in list_of_paths: |
|
631 |
itr = model.get_iter(path) |
|
632 |
model.set_value(itr, enumerations.MARK_COLUMN, True) |
|
633 |
self.__enable_disable_selection_menus() |
|
634 |
self.update_statusbar() |
|
635 |
self.__enable_disable_install_update() |
|
636 |
self.__enable_disable_remove() |
|
637 |
||
638 |
def __on_deselect(self, widget): |
|
639 |
sort_filt_model = \ |
|
640 |
self.w_application_treeview.get_model() #gtk.TreeModelSort |
|
641 |
filt_model = sort_filt_model.get_model() #gtk.TreeModelFilter |
|
642 |
model = filt_model.get_model() #gtk.ListStore |
|
643 |
iter_next = sort_filt_model.get_iter_first() |
|
644 |
list_of_paths = [] |
|
645 |
while iter_next != None: |
|
646 |
sorted_path = sort_filt_model.get_path(iter_next) |
|
647 |
filtered_iter = sort_filt_model.convert_iter_to_child_iter(None, \ |
|
648 |
iter_next) |
|
649 |
app_iter = filt_model.convert_iter_to_child_iter(filtered_iter) |
|
650 |
filtered_path = \ |
|
651 |
sort_filt_model.convert_path_to_child_path(sorted_path) |
|
652 |
path = filt_model.convert_path_to_child_path(filtered_path) |
|
653 |
if model.get_value(app_iter, enumerations.MARK_COLUMN): |
|
654 |
list_of_paths.append(path) |
|
655 |
iter_next = sort_filt_model.iter_next(iter_next) |
|
656 |
for path in list_of_paths: |
|
657 |
itr = model.get_iter(path) |
|
658 |
model.set_value(itr, enumerations.MARK_COLUMN, False) |
|
659 |
self.__enable_disable_selection_menus() |
|
660 |
self.update_statusbar() |
|
661 |
self.__enable_disable_install_update() |
|
662 |
self.__enable_disable_remove() |
|
663 |
||
664 |
def __on_searchentry_focus_in(self, widget, event): |
|
665 |
self.w_paste_menuitem.set_sensitive(True) |
|
666 |
||
667 |
def __on_searchentry_focus_out(self, widget, event): |
|
668 |
self.w_paste_menuitem.set_sensitive(False) |
|
669 |
||
670 |
def __on_searchentry_event(self, widget, event): |
|
671 |
self.w_main_clipboard.request_text(self.__clipboard_text_received) |
|
672 |
if widget.get_selection_bounds(): |
|
673 |
#enable selection functions |
|
674 |
self.w_cut_menuitem.set_sensitive(True) |
|
675 |
self.w_copy_menuitem.set_sensitive(True) |
|
676 |
self.w_clear_menuitem.set_sensitive(True) |
|
677 |
else: |
|
678 |
self.w_cut_menuitem.set_sensitive(False) |
|
679 |
self.w_copy_menuitem.set_sensitive(False) |
|
680 |
self.w_clear_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
681 |
|
483 | 682 |
def __on_category_selection_changed(self, selection, widget): |
683 |
'''This function is for handling category selection changes''' |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
684 |
self.set_busy_cursor() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
685 |
gobject.idle_add(self.__application_refilter) |
483 | 686 |
|
687 |
def __on_package_selection_changed(self, selection, widget): |
|
688 |
'''This function is for handling package selection changes''' |
|
689 |
model, itr = selection.get_selected() |
|
690 |
if itr: |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
691 |
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
|
692 |
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
|
693 |
model.get_value(itr, enumerations.NAME_COLUMN) |
483 | 694 |
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
|
695 |
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
|
696 |
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
|
697 |
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
|
698 |
|
483 | 699 |
|
700 |
def __on_filtercombobox_changed(self, widget): |
|
701 |
'''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
|
702 |
if self.in_setup: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
703 |
return |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
704 |
self.set_busy_cursor() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
705 |
gobject.idle_add(self.__application_refilter) |
483 | 706 |
|
707 |
def __on_sectionscombobox_changed(self, widget): |
|
708 |
'''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
|
709 |
if self.in_setup: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
710 |
return |
483 | 711 |
selected_section = widget.get_active() |
712 |
if selected_section == 0: |
|
713 |
for category in self.category_list: |
|
714 |
category[enumerations.CATEGORY_VISIBLE] = True |
|
715 |
else: |
|
716 |
for category in self.category_list: |
|
717 |
if category[enumerations.CATEGORY_ID] == 0: |
|
718 |
category[enumerations.CATEGORY_VISIBLE] = True |
|
719 |
else: |
|
720 |
category_list = \ |
|
721 |
category[enumerations.SECTION_LIST_OBJECT] |
|
722 |
if not category_list: |
|
723 |
category[enumerations.CATEGORY_VISIBLE] \ |
|
724 |
= False |
|
725 |
else: |
|
726 |
for section in category_list: |
|
727 |
if section == selected_section: |
|
728 |
category[enumerations. \ |
|
729 |
CATEGORY_VISIBLE] = \ |
|
730 |
True |
|
731 |
else: |
|
732 |
category[enumerations. \ |
|
733 |
CATEGORY_VISIBLE] = \ |
|
734 |
False |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
735 |
self.set_busy_cursor() |
483 | 736 |
self.category_list_filter.refilter() |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
737 |
gobject.idle_add(self.__application_refilter) |
483 | 738 |
|
739 |
def __on_repositorycombobox_changed(self, widget): |
|
740 |
'''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
|
741 |
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
|
742 |
return |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
743 |
self.set_busy_cursor() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
744 |
gobject.idle_add(self.__application_refilter) |
483 | 745 |
|
746 |
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
|
747 |
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
|
748 |
install_update = [] |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
749 |
for row in self.application_list: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
750 |
if row[enumerations.MARK_COLUMN] and \ |
780
f14d54a68c1a
5822 Installing one package attempts to update all packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
773
diff
changeset
|
751 |
(row[enumerations.STATUS_COLUMN] == |
f14d54a68c1a
5822 Installing one package attempts to update all packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
773
diff
changeset
|
752 |
enumerations.NOT_INSTALLED or |
f14d54a68c1a
5822 Installing one package attempts to update all packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
773
diff
changeset
|
753 |
row[enumerations.STATUS_COLUMN] == enumerations.UPDATABLE): |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
754 |
install_update.append(row[\ |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
755 |
enumerations.STEM_COLUMN]) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
756 |
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
|
757 |
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
|
758 |
action = enumerations.INSTALL_UPDATE) |
483 | 759 |
|
760 |
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
|
761 |
opensolaris_image = True |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
762 |
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
|
763 |
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
|
764 |
["SUNWipkg", "SUNWcs"]) |
483 | 765 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
766 |
if notfound: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
767 |
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
|
768 |
|
510
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
769 |
if opensolaris_image: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
770 |
# 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
|
771 |
# 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
|
772 |
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
|
773 |
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
|
774 |
"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
|
775 |
"\nPlease wait ...")) |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
776 |
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
|
777 |
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
|
778 |
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
|
779 |
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
|
780 |
return |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
781 |
else: |
35ac691b5187
3193 IPS GUI throws exceptions when installing/upgrading a package
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
500
diff
changeset
|
782 |
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
|
783 |
|
483 | 784 |
#2790: Make sure ipkg and ipkg-gui are up to date, if not update them and |
785 |
# prompt user to restart |
|
786 |
if not self.ips_uptodate: |
|
787 |
# Prompt user |
|
788 |
msgbox = gtk.MessageDialog(parent = self.w_main_window, \ |
|
789 |
buttons = gtk.BUTTONS_YES_NO, \ |
|
790 |
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
|
791 |
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
|
792 |
"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
|
793 |
"before\nrunning Update All.\n\nDo you want to update " \ |
483 | 794 |
"them now?")) |
795 |
msgbox.set_title(self._("Update All")) |
|
796 |
result = msgbox.run() |
|
797 |
msgbox.destroy() |
|
798 |
if result == gtk.RESPONSE_YES: |
|
799 |
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
|
800 |
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
|
801 |
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
|
802 |
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
|
803 |
ips_update = True, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
804 |
action = enumerations.INSTALL_UPDATE) |
483 | 805 |
else: |
806 |
msgbox = gtk.MessageDialog(parent = self.w_main_window, \ |
|
807 |
buttons = gtk.BUTTONS_OK, \ |
|
808 |
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
|
809 |
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
|
810 |
"run.\n\nIt can not be run until SUNWipkg and " \ |
483 | 811 |
"SUNWipkg-gui have been updated.")) |
812 |
msgbox.set_title(self._("Update All")) |
|
813 |
result = msgbox.run() |
|
814 |
msgbox.destroy() |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
815 |
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
|
816 |
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
|
817 |
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
|
818 |
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
|
819 |
action = enumerations.IMAGE_UPDATE) |
483 | 820 |
|
821 |
def __on_help_about(self, widget): |
|
822 |
wTreePlan = gtk.glade.XML(self.gladefile, "aboutdialog") |
|
823 |
aboutdialog = wTreePlan.get_widget("aboutdialog") |
|
824 |
aboutdialog.connect("response", lambda x = None, \ |
|
825 |
y = None: aboutdialog.destroy()) |
|
826 |
aboutdialog.run() |
|
827 |
||
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
828 |
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
|
829 |
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
|
830 |
'/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
|
831 |
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
|
832 |
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
|
833 |
|
483 | 834 |
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
|
835 |
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
|
836 |
remove_list = [] |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
837 |
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
|
838 |
if pkg[enumerations.MARK_COLUMN] and \ |
780
f14d54a68c1a
5822 Installing one package attempts to update all packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
773
diff
changeset
|
839 |
(pkg[enumerations.STATUS_COLUMN] == enumerations.INSTALLED or |
f14d54a68c1a
5822 Installing one package attempts to update all packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
773
diff
changeset
|
840 |
pkg[enumerations.STATUS_COLUMN] == enumerations.UPDATABLE): |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
841 |
remove_list.append(\ |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
842 |
pkg[enumerations.STEM_COLUMN]) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
843 |
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
|
844 |
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
|
845 |
action = enumerations.REMOVE) |
483 | 846 |
|
847 |
def __on_reload(self, widget): |
|
848 |
if self.description_thread_running: |
|
849 |
self.cancelled = True |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
850 |
self.in_setup = True |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
851 |
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
|
852 |
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
|
853 |
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
|
854 |
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
|
855 |
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
|
856 |
self.__disconnect_models() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
857 |
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
|
858 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
859 |
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
|
860 |
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
|
861 |
#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
|
862 |
#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
|
863 |
time.sleep(0.2) |
483 | 864 |
self.process_package_list_start(self.image_directory) |
865 |
self.__enable_disable_selection_menus() |
|
866 |
self.update_statusbar() |
|
867 |
self.__update_install_update_button(None, True) |
|
868 |
self.__update_remove_button(None, True) |
|
869 |
||
870 |
def __clipboard_text_received(self, clipboard, text, data): |
|
871 |
self.main_clipboard_text = text |
|
872 |
return |
|
873 |
||
874 |
def __main_application_quit(self, restart_app = False): |
|
875 |
'''quits the main gtk loop''' |
|
876 |
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
|
877 |
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
|
878 |
return |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
879 |
|
483 | 880 |
if restart_app: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
881 |
if self.image_dir_arg: |
483 | 882 |
gobject.spawn_async([self.application_path, "-R", \ |
883 |
self.image_dir_arg]) |
|
884 |
else: |
|
885 |
gobject.spawn_async([self.application_path]) |
|
796
bcd90655ad83
4019 Package Manager close bug
Padraig O'Briain <padraig.obriain@sun.com>
parents:
795
diff
changeset
|
886 |
self.w_main_window.hide() |
483 | 887 |
gtk.main_quit() |
888 |
sys.exit(0) |
|
889 |
return True |
|
890 |
||
891 |
def __check_if_something_was_changed(self): |
|
892 |
''' Returns True if any of the check boxes for package was changed, false |
|
893 |
if not''' |
|
894 |
for pkg in self.application_list: |
|
895 |
if pkg[enumerations.MARK_COLUMN] == True: |
|
896 |
return True |
|
897 |
return False |
|
898 |
||
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
|
899 |
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
|
900 |
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
|
901 |
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
|
902 |
return |
483 | 903 |
repositories = img.catalogs |
904 |
default_authority = img.get_default_authority() |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
905 |
i = 0 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
906 |
active = 0 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
907 |
for repo in repositories: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
908 |
if cmp(repo, default_authority) == 0: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
909 |
active = i |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
910 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
911 |
repositories_list.append([i, repo, ]) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
912 |
i = i + 1 |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
913 |
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
|
914 |
if default_authority: |
483 | 915 |
self.w_repository_combobox.set_active(active) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
916 |
else: |
483 | 917 |
self.w_repository_combobox.set_active(0) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
918 |
|
483 | 919 |
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
|
920 |
'''Toggle function for column enumerations.MARK_COLUMN''' |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
921 |
applicationModel = model_sort.get_model() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
922 |
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
|
923 |
filterModel = applicationModel.get_model() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
924 |
child_path = applicationModel.convert_path_to_child_path(applicationPath) |
483 | 925 |
itr = filterModel.get_iter(child_path) |
926 |
if itr: |
|
927 |
modified = filterModel.get_value(itr, enumerations.MARK_COLUMN) |
|
928 |
filterModel.set_value(itr, enumerations.MARK_COLUMN, \ |
|
929 |
not modified) |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
930 |
pkg_status = filterModel.get_value(itr, \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
931 |
enumerations.STATUS_COLUMN) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
932 |
self.update_statusbar() |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
933 |
self.__update_install_update_button(pkg_status, modified) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
934 |
self.__update_remove_button(pkg_status, modified) |
483 | 935 |
self.__enable_disable_selection_menus() |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
936 |
|
483 | 937 |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
938 |
def __update_install_update_button(self, pkg_status, toggle_true): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
939 |
if not toggle_true and self.user_rights: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
940 |
if pkg_status == enumerations.NOT_INSTALLED or \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
941 |
pkg_status == enumerations.UPDATABLE: |
483 | 942 |
self.w_installupdate_button.set_sensitive(True) |
943 |
self.w_installupdate_menuitem.set_sensitive(True) |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
944 |
return |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
945 |
elif self.user_rights: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
946 |
instup_button = self.w_installupdate_button |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
947 |
instup_menu = self.w_installupdate_menuitem |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
948 |
for row in self.application_list: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
949 |
if row[enumerations.MARK_COLUMN]: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
950 |
status = row[enumerations.STATUS_COLUMN] |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
951 |
if status == enumerations.NOT_INSTALLED or \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
952 |
status == enumerations.UPDATABLE: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
953 |
instup_button.set_sensitive(True) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
954 |
instup_menu.set_sensitive(True) |
483 | 955 |
return |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
956 |
else: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
957 |
self.w_installupdate_button.set_sensitive(False) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
958 |
self.w_installupdate_menuitem.set_sensitive(False) |
483 | 959 |
|
960 |
def __update_reload_button(self): |
|
961 |
if self.user_rights: |
|
962 |
self.w_reload_button.set_sensitive(True) |
|
963 |
else: |
|
964 |
self.w_reload_button.set_sensitive(False) |
|
965 |
||
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
966 |
def __update_remove_button(self, pkg_status, toggle_true): |
483 | 967 |
if not toggle_true and self.user_rights: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
968 |
if pkg_status == enumerations.INSTALLED or \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
969 |
pkg_status == enumerations.UPDATABLE: |
483 | 970 |
self.w_remove_button.set_sensitive(True) |
971 |
self.w_remove_menuitem.set_sensitive(True) |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
972 |
return |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
973 |
elif self.user_rights: |
483 | 974 |
for row in self.application_list: |
975 |
if row[enumerations.MARK_COLUMN]: |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
976 |
status = row[enumerations.STATUS_COLUMN] |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
977 |
if status == enumerations.INSTALLED or \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
978 |
status == enumerations.UPDATABLE: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
979 |
self.w_remove_button.set_sensitive(True) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
980 |
self.w_remove_menuitem.set_sensitive(True) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
981 |
return |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
982 |
else: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
983 |
self.w_remove_button.set_sensitive(False) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
984 |
self.w_remove_menuitem.set_sensitive(False) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
985 |
|
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
|
986 |
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
|
987 |
pkg_name = pkg.get_name() |
483 | 988 |
if icon and icon != pkg: |
989 |
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
|
990 |
else: |
483 | 991 |
self.w_packageicon_image.set_from_pixbuf( \ |
992 |
self.__get_pixbuf_from_path("/usr/share/package-manager/", \ |
|
993 |
"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
|
994 |
self.w_packagename_label.set_markup("<b>" + pkg_name + "</b>") |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
995 |
|
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
996 |
pkg_stem = pkg.get_pkg_stem() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
997 |
if self.__setting_from_cache(pkg_stem): |
636
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
998 |
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
|
999 |
|
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_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
|
1001 |
self._("Fetching description...")) |
483 | 1002 |
instbuffer = self.w_installedfiles_textview.get_buffer() |
1003 |
depbuffer = self.w_dependencies_textview.get_buffer() |
|
1004 |
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
|
1005 |
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
|
1006 |
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
|
1007 |
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
|
1008 |
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
|
1009 |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1010 |
def __setting_from_cache(self, pkg_stem): |
636
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1011 |
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
|
1012 |
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
|
1013 |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1014 |
if self.info_cache.has_key(pkg_stem): |
636
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1015 |
self.w_shortdescription_label.set_text(\ |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1016 |
self.info_cache[pkg_stem][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
|
1017 |
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
|
1018 |
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
|
1019 |
infobuffer = self.w_generalinfo_textview.get_buffer() |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1020 |
infobuffer.set_text(self.info_cache[pkg_stem][1]) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1021 |
instbuffer.set_text(self.info_cache[pkg_stem][2]) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1022 |
depbuffer.set_text(self.info_cache[pkg_stem][3]) |
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
|
1023 |
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
|
1024 |
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
|
1025 |
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
|
1026 |
|
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 |
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
|
1028 |
pkg_name = pkg.get_name() |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1029 |
pkg_stem = pkg.get_pkg_stem() |
636
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1030 |
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
|
1031 |
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
|
1032 |
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
|
1033 |
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
|
1034 |
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
|
1035 |
"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
|
1036 |
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
|
1037 |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1038 |
if self.__setting_from_cache(pkg_stem): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1039 |
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
|
1040 |
|
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 |
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
|
1042 |
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
|
1043 |
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
|
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 |
if not pkg_info: |
483 | 1046 |
self.w_shortdescription_label.set_text( \ |
1047 |
self._("Description not available for this package...")) |
|
1048 |
instbuffer.set_text( \ |
|
1049 |
self._("Files Details not available for this package...")) |
|
1050 |
depbuffer.set_text(self._( \ |
|
1051 |
"Dependencies info not available for this package...")) |
|
1052 |
infobuffer.set_text( \ |
|
1053 |
self._("Information not available for this package...")) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1054 |
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
|
1055 |
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
|
1056 |
#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
|
1057 |
if len(description) > MAX_DESC_LEN: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1058 |
description = description[:MAX_DESC_LEN] + " ..." |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1059 |
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
|
1060 |
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
|
1061 |
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
|
1062 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1063 |
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
|
1064 |
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
|
1065 |
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
|
1066 |
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
|
1067 |
#Name: SUNWckr |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1068 |
#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
|
1069 |
#Version: 0.5.11 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1070 |
#Branch: 0.75 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1071 |
#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
|
1072 |
#Size: 293696981024 |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1073 |
#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
|
1074 |
|
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1075 |
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
|
1076 |
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
|
1077 |
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
|
1078 |
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
|
1079 |
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
|
1080 |
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
|
1081 |
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
|
1082 |
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
|
1083 |
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
|
1084 |
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
|
1085 |
|
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 |
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
|
1087 |
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
|
1088 |
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
|
1089 |
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
|
1090 |
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
|
1091 |
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
|
1092 |
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
|
1093 |
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
|
1094 |
|
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 |
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
|
1096 |
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
|
1097 |
depbuffer.set_text(dep_str) |
483 | 1098 |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1099 |
self.info_cache[pkg_stem] = \ |
636
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
1100 |
(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
|
1101 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1102 |
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
|
1103 |
lic = "" |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1104 |
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
|
1105 |
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
|
1106 |
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
|
1107 |
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
|
1108 |
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
|
1109 |
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
|
1110 |
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
|
1111 |
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
|
1112 |
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
|
1113 |
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
|
1114 |
lic_u += "" |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1115 |
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
|
1116 |
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
|
1117 |
|
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
|
1118 |
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
|
1119 |
#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
|
1120 |
# 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
|
1121 |
# 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
|
1122 |
time.sleep(1) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1123 |
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
|
1124 |
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
|
1125 |
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
|
1126 |
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
|
1127 |
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
|
1128 |
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
|
1129 |
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
|
1130 |
pkgs_info = None |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1131 |
package_info = None |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1132 |
no_licenses = 0 |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1133 |
if info: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1134 |
pkgs_info = info[0] |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1135 |
if pkgs_info: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1136 |
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
|
1137 |
if package_info: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1138 |
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
|
1139 |
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
|
1140 |
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
|
1141 |
None) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1142 |
return |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1143 |
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
|
1144 |
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
|
1145 |
package_info.licenses) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1146 |
else: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1147 |
return |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1148 |
|
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
|
1149 |
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
|
1150 |
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
|
1151 |
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
|
1152 |
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
|
1153 |
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
|
1154 |
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
|
1155 |
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
|
1156 |
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
|
1157 |
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
|
1158 |
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
|
1159 |
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
|
1160 |
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
|
1161 |
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
|
1162 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1163 |
def __show_package_info(self, model, itr, th_no): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1164 |
installed = False |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1165 |
pkg = model.get_value(itr, enumerations.FMRI_COLUMN) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1166 |
status = model.get_value(itr, enumerations.STATUS_COLUMN) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1167 |
if status == enumerations.UPDATABLE or status == enumerations.INSTALLED: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1168 |
installed = True |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1169 |
gobject.idle_add( \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1170 |
self.__show_fetching_package_info, pkg, pkg) |
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
|
1171 |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1172 |
if self.info_cache.has_key(pkg.get_pkg_stem()): |
636
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
608
diff
changeset
|
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 |
# 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
|
1176 |
# 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
|
1177 |
time.sleep(1) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1178 |
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
|
1179 |
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
|
1180 |
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
|
1181 |
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
|
1182 |
|
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 |
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
|
1184 |
if th_no == self.pkginfo_thread: |
483 | 1185 |
if not pkg: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1186 |
gobject.idle_add(self.__update_package_info, pkg, pkg, \ |
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
|
1187 |
installed, pkg_info) |
483 | 1188 |
else: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1189 |
gobject.idle_add(self.__update_package_info, pkg, pkg, \ |
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
|
1190 |
installed, pkg_info) |
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1191 |
img.history.operation_result = \ |
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1192 |
history.RESULT_SUCCEEDED |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1193 |
else: |
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1194 |
img.history.operation_result = \ |
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1195 |
history.RESULT_SUCCEEDED |
483 | 1196 |
return |
1197 |
||
1198 |
# This function is ported from pkg.actions.generic.distinguished_name() |
|
1199 |
def __locale_distinguished_name(self, action): |
|
1200 |
if action.key_attr == None: |
|
1201 |
return str(action) |
|
1202 |
return "%s: %s" % \ |
|
1203 |
(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
|
1204 |
|
483 | 1205 |
def __application_filter(self, model, itr): |
1206 |
'''This function is used to filter content in the main |
|
1207 |
application view''' |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1208 |
if self.in_setup or self.cancelled: |
483 | 1209 |
return False |
1210 |
# 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
|
1211 |
selected_category = 0 |
483 | 1212 |
selection = self.w_categories_treeview.get_selection() |
1213 |
category_model, category_iter = selection.get_selected() |
|
1214 |
if not category_iter: #no category was selected, so select "All" |
|
1215 |
selection.select_path(0) |
|
1216 |
category_model, category_iter = selection.get_selected() |
|
1217 |
if category_iter: |
|
1218 |
selected_category = category_model.get_value(category_iter, \ |
|
1219 |
enumerations.CATEGORY_ID) |
|
1220 |
category_list_iter = model.get_value(itr, \ |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1221 |
enumerations.CATEGORY_LIST_COLUMN) |
483 | 1222 |
category = False |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1223 |
repo = self.__is_pkg_repository_visible(model, itr) |
483 | 1224 |
if category_list_iter: |
1225 |
sel = False |
|
1226 |
for category_iter in category_list_iter: |
|
1227 |
if category != True: |
|
1228 |
category = \ |
|
1229 |
self.category_filter(self.category_list, \ |
|
1230 |
category_iter) |
|
1231 |
if selected_category != 0: |
|
1232 |
if selected_category == \ |
|
1233 |
self.category_list.get_value(category_iter, \ |
|
1234 |
enumerations.CATEGORY_ID): |
|
1235 |
sel = True |
|
1236 |
category = sel |
|
1237 |
else: |
|
1238 |
if selected_category == 0: |
|
1239 |
selected_section = self.w_sections_combobox.get_active() |
|
1240 |
if selected_section == 0: |
|
1241 |
category = True |
|
1242 |
if (model.get_value(itr, enumerations.IS_VISIBLE_COLUMN) == False): |
|
1243 |
return False |
|
1244 |
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
|
1245 |
return (repo & category & \ |
483 | 1246 |
self.__is_package_filtered(model, itr)) |
1247 |
if not model.get_value(itr, enumerations.NAME_COLUMN) == None: |
|
1248 |
if self.w_searchentry_dialog.get_text().lower() in \ |
|
1249 |
model.get_value \ |
|
1250 |
(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
|
1251 |
return (repo & category & \ |
483 | 1252 |
self.__is_package_filtered(model, itr)) |
1253 |
if not model.get_value(itr, enumerations.DESCRIPTION_COLUMN) == None: |
|
1254 |
if self.w_searchentry_dialog.get_text().lower() in \ |
|
1255 |
model.get_value \ |
|
1256 |
(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
|
1257 |
return (repo & category & \ |
483 | 1258 |
self.__is_package_filtered(model, itr)) |
1259 |
else: |
|
1260 |
return False |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1261 |
|
483 | 1262 |
def __is_package_filtered(self, model, itr): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1263 |
'''Function for filtercombobox''' |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1264 |
# 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
|
1265 |
# XXX It should be faster and better for localisations. |
483 | 1266 |
filter_text = self.w_filter_combobox.get_active() |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1267 |
if filter_text == 0: |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1268 |
return True |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1269 |
status = model.get_value(itr, enumerations.STATUS_COLUMN) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1270 |
if filter_text == 2: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1271 |
return (status == enumerations.INSTALLED or status == \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1272 |
enumerations.UPDATABLE) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1273 |
elif filter_text == 3: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1274 |
return status == enumerations.UPDATABLE |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1275 |
elif filter_text == 4: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1276 |
return status == enumerations.NOT_INSTALLED |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1277 |
elif filter_text == 6: |
483 | 1278 |
return model.get_value(itr, enumerations.MARK_COLUMN) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1279 |
elif filter_text == 8: |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1280 |
# XXX Locked support |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1281 |
return False |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1282 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1283 |
|
483 | 1284 |
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
|
1285 |
if len(self.repositories_list) <= 1: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1286 |
return True |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1287 |
else: |
483 | 1288 |
auth_iter = self.w_repository_combobox.get_active_iter() |
1289 |
authority = self.repositories_list.get_value(auth_iter, \ |
|
1290 |
enumerations.REPOSITORY_NAME) |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1291 |
pkg = model.get_value(itr, \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1292 |
enumerations.FMRI_COLUMN) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1293 |
if not pkg: |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1294 |
return False |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1295 |
if cmp(pkg.get_authority(), authority) == 0: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1296 |
return True |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1297 |
else: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1298 |
return False |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1299 |
|
483 | 1300 |
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
|
1301 |
ret = self.__catalog_refresh(False) |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1302 |
if ret != -1: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1303 |
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
|
1304 |
else: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1305 |
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
|
1306 |
self.progress_stop_timer_thread = True |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1307 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1308 |
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
|
1309 |
self.api_o.reset() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1310 |
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
|
1311 |
ret = True |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
1312 |
try: |
594
b072bc027c54
3770 pkg install when authority unavailable traces back
Brock Pytlik <bpytlik@sun.com>
parents:
577
diff
changeset
|
1313 |
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
|
1314 |
list_of_packages, filters = []) |
b072bc027c54
3770 pkg install when authority unavailable traces back
Brock Pytlik <bpytlik@sun.com>
parents:
577
diff
changeset
|
1315 |
if upgrade_needed: |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1316 |
ret = False |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1317 |
except (api_errors.InvalidCertException, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1318 |
api_errors.PlanCreationException, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1319 |
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
|
1320 |
raise |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1321 |
except api_errors.CanceledException: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1322 |
raise |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1323 |
return ret |
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
1324 |
|
483 | 1325 |
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
|
1326 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1327 |
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
|
1328 |
return |
483 | 1329 |
self.__enable_disable_select_all() |
1330 |
self.__enable_disable_select_updates() |
|
1331 |
self.__enable_disable_deselect() |
|
1332 |
# XXX disabled until new API |
|
1333 |
self.__enable_disable_update_all() |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
1334 |
|
483 | 1335 |
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
|
1336 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1337 |
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
|
1338 |
return |
483 | 1339 |
if len(self.w_application_treeview.get_model()) > 0: |
1340 |
for row in self.w_application_treeview.get_model(): |
|
1341 |
if not row[enumerations.MARK_COLUMN]: |
|
1342 |
self.w_selectall_menuitem.set_sensitive(True) |
|
1343 |
return |
|
1344 |
self.w_selectall_menuitem.set_sensitive(False) |
|
1345 |
else: |
|
1346 |
self.w_selectall_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1347 |
|
483 | 1348 |
def __enable_disable_install_update(self): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1349 |
for row in self.application_list: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1350 |
if row[enumerations.MARK_COLUMN]: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1351 |
status = row[enumerations.STATUS_COLUMN] |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1352 |
if self.user_rights and \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1353 |
(status == enumerations.UPDATABLE or |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1354 |
status == enumerations.NOT_INSTALLED): |
483 | 1355 |
self.w_installupdate_button.set_sensitive(True) |
1356 |
self.w_installupdate_menuitem.set_sensitive(True) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1357 |
return |
483 | 1358 |
self.w_installupdate_button.set_sensitive(False) |
1359 |
self.w_installupdate_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1360 |
|
483 | 1361 |
def __enable_disable_remove(self): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1362 |
for row in self.application_list: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1363 |
if row[enumerations.MARK_COLUMN]: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1364 |
status = row[enumerations.STATUS_COLUMN] |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1365 |
if self.user_rights and \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1366 |
(status == enumerations.UPDATABLE or |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1367 |
status == enumerations.INSTALLED): |
483 | 1368 |
self.w_remove_button.set_sensitive(True) |
1369 |
self.w_remove_menuitem.set_sensitive(True) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1370 |
return |
483 | 1371 |
self.w_remove_button.set_sensitive(False) |
1372 |
self.w_remove_menuitem.set_sensitive(False) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1373 |
|
483 | 1374 |
def __enable_disable_select_updates(self): |
1375 |
for row in self.w_application_treeview.get_model(): |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1376 |
if row[enumerations.STATUS_COLUMN] == enumerations.UPDATABLE: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1377 |
if not row[enumerations.MARK_COLUMN]: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1378 |
self.w_selectupdates_menuitem. \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1379 |
set_sensitive(True) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1380 |
return |
483 | 1381 |
self.w_selectupdates_menuitem.set_sensitive(False) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1382 |
return |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1383 |
|
483 | 1384 |
def __enable_disable_update_all(self): |
773
68018dae1ed4
5645 Package Manager should have busy cursor for certain actions (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
770
diff
changeset
|
1385 |
update_available = False |
483 | 1386 |
for row in self.application_list: |
773
68018dae1ed4
5645 Package Manager should have busy cursor for certain actions (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
770
diff
changeset
|
1387 |
if self.__is_pkg_repository_visible(self.application_list, |
483 | 1388 |
row.iter): |
773
68018dae1ed4
5645 Package Manager should have busy cursor for certain actions (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
770
diff
changeset
|
1389 |
if self.application_list.get_value(row.iter, |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1390 |
enumerations.STATUS_COLUMN) == \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1391 |
enumerations.UPDATABLE and self.user_rights: |
773
68018dae1ed4
5645 Package Manager should have busy cursor for certain actions (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
770
diff
changeset
|
1392 |
update_available = True |
68018dae1ed4
5645 Package Manager should have busy cursor for certain actions (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
770
diff
changeset
|
1393 |
break |
68018dae1ed4
5645 Package Manager should have busy cursor for certain actions (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
770
diff
changeset
|
1394 |
self.w_updateall_button.set_sensitive(update_available) |
68018dae1ed4
5645 Package Manager should have busy cursor for certain actions (follow up)
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
770
diff
changeset
|
1395 |
self.w_updateall_menuitem.set_sensitive(update_available) |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1396 |
self.unset_busy_cursor() |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1397 |
|
483 | 1398 |
def __enable_disable_deselect(self): |
1399 |
for row in self.w_application_treeview.get_model(): |
|
1400 |
if row[enumerations.MARK_COLUMN]: |
|
1401 |
self.w_deselect_menuitem.set_sensitive(True) |
|
1402 |
return |
|
1403 |
self.w_deselect_menuitem.set_sensitive(False) |
|
1404 |
return |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1405 |
|
483 | 1406 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1407 |
def __catalog_refresh(self, reload_gui=True): |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1408 |
"""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
|
1409 |
full_refresh = True |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1410 |
try: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1411 |
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
|
1412 |
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
|
1413 |
except api_errors.UnrecognizedAuthorityException: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1414 |
# 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
|
1415 |
# 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
|
1416 |
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
|
1417 |
raise |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1418 |
except api_errors.PermissionsException: |
714
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1419 |
#Error will already have been reported in |
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1420 |
#Manage Repository dialog |
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1421 |
self.__catalog_refresh_done() |
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1422 |
return -1 |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1423 |
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
|
1424 |
total = cre.total |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1425 |
succeeded = cre.succeeded |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1426 |
ermsg = self._("Network problem.\n\n") |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1427 |
ermsg += self._("Details:\n") |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1428 |
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
|
1429 |
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
|
1430 |
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
|
1431 |
if isinstance(err, HTTPError): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1432 |
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
|
1433 |
(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
|
1434 |
elif isinstance(err, URLError): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1435 |
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
|
1436 |
ermsg += " %s: %s\n" % \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1437 |
(urlparse.urlsplit( |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1438 |
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
|
1439 |
err.args[0][1]) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1440 |
else: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1441 |
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
|
1442 |
socket.timeout): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1443 |
ermsg += " %s: %s\n" % \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1444 |
(auth["origin"], "timeout") |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1445 |
else: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1446 |
ermsg += " %s: %s\n" % \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1447 |
(auth["origin"], \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1448 |
err.args[0][1]) |
714
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1449 |
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
|
1450 |
ermsg += err.data |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1451 |
else: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1452 |
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
|
1453 |
ermsg += "\n" |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1454 |
|
714
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1455 |
gobject.idle_add(self.error_occured, ermsg, \ |
cd9870c8faae
4987 Improve error messages for PM
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
701
diff
changeset
|
1456 |
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
|
1457 |
self.__catalog_refresh_done() |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1458 |
return -1 |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1459 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1460 |
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
|
1461 |
self.__catalog_refresh_done() |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1462 |
raise |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1463 |
except Exception: |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1464 |
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
|
1465 |
raise |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1466 |
if reload_gui: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1467 |
self.__catalog_refresh_done() |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1468 |
return 0 |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1469 |
|
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
|
1470 |
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
|
1471 |
""" 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
|
1472 |
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
|
1473 |
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
|
1474 |
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
|
1475 |
repositories_list = self.__get_new_repositories_liststore() |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1476 |
authority = api_o.img.get_default_authority() |
526
8c243883ae41
822 Depot traceback on "pkgsend -s <server> open foo"
Dan Price <dp@eng.sun.com>
parents:
510
diff
changeset
|
1477 |
try: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1478 |
pkgs_known = misc.get_inventory_list(api_o.img, None, |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1479 |
True, True) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
562
diff
changeset
|
1480 |
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
|
1481 |
# 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
|
1482 |
# 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
|
1483 |
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
|
1484 |
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
|
1485 |
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
|
1486 |
return |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1487 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1488 |
#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
|
1489 |
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
|
1490 |
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
|
1491 |
#Imageinfo for categories |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1492 |
imginfo = imageinfo.ImageInfo() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1493 |
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
|
1494 |
catalogs = api_o.img.catalogs |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1495 |
categories = {} |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1496 |
sections = {} |
701
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1497 |
share_path = "/usr/share/package-manager/data/" |
483 | 1498 |
for cat in catalogs: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1499 |
category = imginfo.read(self.application_dir + |
701
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1500 |
share_path + cat) |
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1501 |
if len(category) == 0: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1502 |
category = imginfo.read(self.application_dir + |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1503 |
share_path + "opensolaris.org") |
483 | 1504 |
categories[cat] = category |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1505 |
section = sectioninfo.read(self.application_dir + |
701
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1506 |
share_path + cat + ".sections") |
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1507 |
if len(section) == 0: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1508 |
section = sectioninfo.read(self.application_dir + |
701
ba35d1b02c04
4884 Package Manager corruption?
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
697
diff
changeset
|
1509 |
share_path + "opensolaris.org.sections") |
483 | 1510 |
sections[cat] = section |
1511 |
icon_path = self.application_dir + \ |
|
1512 |
"/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
|
1513 |
pkg_count = 0 |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1514 |
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
|
1515 |
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
|
1516 |
progress_increment = \ |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1517 |
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
|
1518 |
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
|
1519 |
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
|
1520 |
gtk.main_iteration(False) |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1521 |
prev_pfmri_str = "" |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1522 |
prev_state = None |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1523 |
for pkg, state in pkgs_known: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1524 |
if prev_pfmri_str and \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1525 |
prev_pfmri_str == pkg.get_short_fmri() and \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1526 |
prev_state == state: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1527 |
continue |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1528 |
prev_pfmri_str = pkg.get_short_fmri() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1529 |
prev_state = state |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1530 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1531 |
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
|
1532 |
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
|
1533 |
if progress_percent <= PACKAGE_PROGRESS_PERCENT_TOTAL: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1534 |
progressdialog_progress(progress_percent, |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1535 |
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
|
1536 |
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
|
1537 |
gtk.main_iteration(False) |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1538 |
|
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1539 |
status_icon = None |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1540 |
pkg_name = pkg.get_name() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1541 |
pkg_stem = pkg.get_pkg_stem() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1542 |
package_icon = self.__get_pixbuf_from_path(icon_path, pkg_name) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1543 |
pkg_state = enumerations.NOT_INSTALLED |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1544 |
if state["state"] == "installed": |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1545 |
pkg_state = enumerations.INSTALLED |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1546 |
if state["upgradable"] == True: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1547 |
status_icon = update_available_icon |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1548 |
pkg_state = enumerations.UPDATABLE |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1549 |
else: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1550 |
status_icon = installed_icon |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1551 |
app = \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1552 |
[ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1553 |
False, status_icon, package_icon, pkg_name, |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1554 |
'...', pkg_state, pkg, pkg_stem, None, True, None |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1555 |
] |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1556 |
row_iter = application_list.insert(pkg_count, app) |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1557 |
pkg_count += 1 |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1558 |
apc = self.__add_package_to_category |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1559 |
app_ls = application_list |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1560 |
for cat in categories: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1561 |
if cat in categories: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1562 |
if pkg_name in categories[cat]: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1563 |
pkg_categories = categories[cat][pkg_name] |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1564 |
for pcat in pkg_categories.split(","): |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1565 |
if pcat: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1566 |
apc(self._(pcat), None, |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1567 |
None, row_iter, |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1568 |
app_ls, category_list) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1569 |
for authority in sections: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1570 |
for section in sections[authority]: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1571 |
for category in sections[authority][section].split(","): |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1572 |
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
|
1573 |
self._(section), category_list) |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1574 |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1575 |
#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
|
1576 |
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
|
1577 |
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
|
1578 |
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
|
1579 |
r = [] |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1580 |
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
|
1581 |
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
|
1582 |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1583 |
progressdialog_progress(PACKAGE_PROGRESS_PERCENT_TOTAL, total_pkg_count, |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1584 |
total_pkg_count) |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1585 |
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
|
1586 |
application_list, category_list, repositories_list) |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1587 |
return |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1588 |
|
483 | 1589 |
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
|
1590 |
category_icon, package, application_list, category_list): |
483 | 1591 |
if not package or category_name == self._('All'): |
1592 |
return |
|
1593 |
if not category_name: |
|
1594 |
return |
|
1595 |
# XXX check if needed |
|
1596 |
# category_name = self._('All') |
|
1597 |
# category_description = self._('All packages') |
|
1598 |
# category_icon = None |
|
1599 |
category_ref = None |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1600 |
for category in category_list: |
483 | 1601 |
if category[enumerations.CATEGORY_NAME] == category_name: |
1602 |
category_ref = category.iter |
|
1603 |
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
|
1604 |
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
|
1605 |
category_list)+1, category_name, category_description, \ |
483 | 1606 |
category_icon, True, None]) |
1607 |
if category_ref: |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1608 |
if application_list.get_value(package, \ |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1609 |
enumerations.CATEGORY_LIST_COLUMN): |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1610 |
a = application_list.get_value(package, \ |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1611 |
enumerations.CATEGORY_LIST_COLUMN) |
483 | 1612 |
a.append(category_ref) |
1613 |
else: |
|
1614 |
category_list = [] |
|
1615 |
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
|
1616 |
application_list.set(package, \ |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1617 |
enumerations.CATEGORY_LIST_COLUMN, category_list) |
483 | 1618 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1619 |
def __add_category_to_section(self, category_name, section_name, category_list): |
483 | 1620 |
'''Adds the section to section list in category. If there is no such |
1621 |
section, than it is not added. If there was already section than it |
|
1622 |
is skipped. Sections must be case sensitive''' |
|
1623 |
if not category_name: |
|
1624 |
return |
|
1625 |
for section in self.section_list: |
|
1626 |
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
|
1627 |
for category in category_list: |
483 | 1628 |
if category[enumerations.CATEGORY_NAME] == \ |
1629 |
category_name: |
|
1630 |
if not category[ \ |
|
1631 |
enumerations.SECTION_LIST_OBJECT]: |
|
1632 |
category[ \ |
|
1633 |
enumerations. \ |
|
1634 |
SECTION_LIST_OBJECT] = \ |
|
1635 |
[section[ \ |
|
1636 |
enumerations.SECTION_ID], ] |
|
1637 |
else: |
|
1638 |
if not section_name in \ |
|
1639 |
category[ \ |
|
1640 |
enumerations. \ |
|
1641 |
SECTION_LIST_OBJECT]: |
|
1642 |
category[enumerations. \ |
|
1643 |
SECTION_LIST_OBJECT \ |
|
1644 |
].append(section[ \ |
|
1645 |
enumerations. \ |
|
1646 |
SECTION_ID]) |
|
1647 |
||
1648 |
def __get_pixbuf_from_path(self, path, icon_name): |
|
1649 |
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
|
1650 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1651 |
# 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
|
1652 |
# 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
|
1653 |
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
|
1654 |
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
|
1655 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1656 |
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
|
1657 |
return None |
483 | 1658 |
try: |
1659 |
return gtk.gdk.pixbuf_new_from_file( \ |
|
1660 |
self.application_dir + path + icon + ".png") |
|
1661 |
except gobject.GError: |
|
1662 |
try: |
|
1663 |
return gtk.gdk.pixbuf_new_from_file( \ |
|
1664 |
self.application_dir + path + icon + ".svg") |
|
1665 |
except gobject.GError: |
|
1666 |
iconview = gtk.IconView() |
|
1667 |
icon = iconview.render_icon(getattr(gtk, \ |
|
1668 |
"STOCK_MISSING_IMAGE"), \ |
|
1669 |
size = gtk.ICON_SIZE_MENU, |
|
1670 |
detail = None) |
|
1671 |
# XXX Could return image-we don't want to show ugly icon. |
|
1672 |
return None |
|
1673 |
||
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1674 |
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
|
1675 |
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
|
1676 |
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
|
1677 |
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
|
1678 |
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
|
1679 |
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
|
1680 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1681 |
# 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
|
1682 |
# 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
|
1683 |
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
|
1684 |
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
|
1685 |
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
|
1686 |
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
|
1687 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1688 |
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
|
1689 |
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
|
1690 |
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
|
1691 |
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
|
1692 |
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
|
1693 |
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
|
1694 |
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
|
1695 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1696 |
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
|
1697 |
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
|
1698 |
"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
|
1699 |
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
|
1700 |
|
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1701 |
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
|
1702 |
msgbox = gtk.MessageDialog(parent = \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1703 |
self.w_main_window, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1704 |
buttons = gtk.BUTTONS_CLOSE, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1705 |
flags = gtk.DIALOG_MODAL, \ |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1706 |
type = msg_type, \ |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1707 |
message_format = None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1708 |
msgbox.set_markup(error_msg) |
602
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1709 |
title = None |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1710 |
if msg_title: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1711 |
title = msg_title |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1712 |
else: |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1713 |
title = self._("Package Manager") |
cd5a41269b1e
3911 menu item, dialog header 'Manage Repositories'
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
594
diff
changeset
|
1714 |
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
|
1715 |
msgbox.run() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1716 |
msgbox.destroy() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1717 |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1718 |
#-----------------------------------------------------------------------------# |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1719 |
# Static Methods |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1720 |
#-----------------------------------------------------------------------------# |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1721 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1722 |
@staticmethod |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
1723 |
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
|
1724 |
return message |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1725 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1726 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1727 |
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
|
1728 |
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
|
1729 |
|
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1730 |
@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
|
1731 |
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
|
1732 |
found = [] |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1733 |
notfound = [] |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1734 |
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
|
1735 |
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
|
1736 |
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
|
1737 |
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
|
1738 |
notfound = e.notfound |
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1739 |
|
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1740 |
return notfound |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1741 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1742 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1743 |
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
|
1744 |
'''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
|
1745 |
selected''' |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1746 |
if itr: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1747 |
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
|
1748 |
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
|
1749 |
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
|
1750 |
else: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1751 |
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
|
1752 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1753 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1754 |
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
|
1755 |
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
|
1756 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1757 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1758 |
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
|
1759 |
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
|
1760 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1761 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1762 |
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
|
1763 |
'''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
|
1764 |
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
|
1765 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1766 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1767 |
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
|
1768 |
dt = None |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1769 |
try: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1770 |
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
|
1771 |
except AttributeError: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1772 |
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
|
1773 |
return dt |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1774 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1775 |
@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
|
1776 |
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
|
1777 |
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
|
1778 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1779 |
@staticmethod |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1780 |
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
|
1781 |
'''helper function''' |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1782 |
# 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
|
1783 |
manifest = None |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1784 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1785 |
# 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
|
1786 |
if packagemanager.cancelled: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1787 |
return manifest |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1788 |
try: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1789 |
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
|
1790 |
except OSError: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1791 |
# 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
|
1792 |
# 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
|
1793 |
# 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
|
1794 |
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
|
1795 |
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
|
1796 |
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
|
1797 |
pass |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1798 |
return manifest |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1799 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1800 |
@staticmethod |
724
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1801 |
def update_desc(description, pkg): |
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1802 |
pkg[enumerations.DESCRIPTION_COLUMN] = description |
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1803 |
return |
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1804 |
|
483 | 1805 |
#-----------------------------------------------------------------------------# |
1806 |
# Public Methods |
|
1807 |
#-----------------------------------------------------------------------------# |
|
500
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1808 |
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
|
1809 |
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
|
1810 |
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
|
1811 |
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
|
1812 |
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
|
1813 |
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
|
1814 |
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
|
1815 |
|
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
1816 |
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
|
1817 |
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
|
1818 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1819 |
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
|
1820 |
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
|
1821 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1822 |
def reload_packages(self): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1823 |
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
|
1824 |
self.__on_reload(None) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1825 |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1826 |
def set_busy_cursor(self): |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1827 |
self.gdk_window.show() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1828 |
|
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1829 |
def unset_busy_cursor(self): |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1830 |
self.gdk_window.hide() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1831 |
|
483 | 1832 |
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
|
1833 |
self.cancelled = True |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1834 |
self.setup_progressdialog_show() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1835 |
while gtk.events_pending(): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1836 |
gtk.main_iteration(False) |
483 | 1837 |
self.image_directory = image_directory |
1838 |
# 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
|
1839 |
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
|
1840 |
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
|
1841 |
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
|
1842 |
# 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
|
1843 |
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
|
1844 |
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
|
1845 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1846 |
@staticmethod |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1847 |
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
|
1848 |
api_o = None |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1849 |
try: |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1850 |
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
|
1851 |
CLIENT_API_VERSION, \ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1852 |
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
|
1853 |
except (api_errors.VersionException,\ |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1854 |
api_errors.ImageNotFoundException): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1855 |
raise |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1856 |
return api_o |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1857 |
|
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
|
1858 |
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
|
1859 |
category_list, repositories_list): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1860 |
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
|
1861 |
self.update_statusbar() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1862 |
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
|
1863 |
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
|
1864 |
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
|
1865 |
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
|
1866 |
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
|
1867 |
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
|
1868 |
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
|
1869 |
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
|
1870 |
None, start_editing=False) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1871 |
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
|
1872 |
while gtk.events_pending(): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1873 |
gtk.main_iteration(False) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1874 |
self.__get_manifests_thread() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1875 |
self.w_progress_dialog.hide() |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1876 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1877 |
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
|
1878 |
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
|
1879 |
args = ()).start() |
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1880 |
|
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
1881 |
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
|
1882 |
#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
|
1883 |
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
|
1884 |
"/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
|
1885 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1886 |
def get_manifests_for_packages(self): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1887 |
''' 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
|
1888 |
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
|
1889 |
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
|
1890 |
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
|
1891 |
time.sleep(3) |
724
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1892 |
count = 0 |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1893 |
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
|
1894 |
img = self.api_o.img |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1895 |
for pkg in self.application_list: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1896 |
if self.cancelled: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1897 |
self.description_thread_running = False |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1898 |
return |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1899 |
info = None |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1900 |
package = pkg[enumerations.FMRI_COLUMN] |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1901 |
if (img and package): |
724
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1902 |
man = self.get_manifest(img, package, filtered = True) |
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1903 |
if man: |
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1904 |
info = man.get("description", "") |
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1905 |
gobject.idle_add(self.update_desc, info, pkg) |
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1906 |
count += 1 |
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1907 |
if count % 2 == 0: |
f67376f059f7
4986 PM search is slow during loading of descriptions
John Rice <john.rice@sun.com>
parents:
714
diff
changeset
|
1908 |
time.sleep(0.001) |
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1909 |
img.history.operation_name = "info" |
556
1c3526ca7b9e
2022 client should provide operational intent to server
Shawn Walker <shawn.walker@sun.com>
parents:
543
diff
changeset
|
1910 |
img.history.operation_result = history.RESULT_SUCCEEDED |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1911 |
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
|
1912 |
|
483 | 1913 |
def update_statusbar(self): |
1914 |
'''Function which updates statusbar''' |
|
1915 |
installed = 0 |
|
1916 |
selected = 0 |
|
1917 |
broken = 0 |
|
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1918 |
for pkg_row in self.application_list: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1919 |
if pkg_row[enumerations.STATUS_COLUMN] == enumerations.INSTALLED \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1920 |
or pkg_row[enumerations.STATUS_COLUMN] == \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1921 |
enumerations.UPDATABLE: |
483 | 1922 |
installed = installed + 1 |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1923 |
if pkg_row[enumerations.MARK_COLUMN]: |
483 | 1924 |
selected = selected + 1 |
1925 |
listed_str = self._('%d packages listed') % len(self.application_list) |
|
1926 |
inst_str = self._('%d installed') % installed |
|
1927 |
sel_str = self._('%d selected') % selected |
|
1928 |
broken_str = self._('%d broken') % broken |
|
1929 |
self.w_main_statusbar.push(0, listed_str + ', ' + inst_str + ', ' + \ |
|
1930 |
sel_str + ', ' + broken_str + '.') |
|
1931 |
||
1932 |
||
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1933 |
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
|
1934 |
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
|
1935 |
img.clear_pkg_state() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
1936 |
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
|
1937 |
installed_icon = self.get_icon_pixbuf("status_installed") |
483 | 1938 |
for row in self.application_list: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1939 |
if row[enumerations.NAME_COLUMN] in update_list: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1940 |
pkg = row[enumerations.FMRI_COLUMN] |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1941 |
pkg_stem = row[enumerations.STEM_COLUMN] |
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
|
1942 |
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
|
1943 |
self.get_installed_version(self.api_o, pkg) |
483 | 1944 |
if package_installed: |
770
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1945 |
inst_stem = package_installed.get_pkg_stem() |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1946 |
if inst_stem == pkg_stem: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1947 |
row[enumerations.STATUS_COLUMN] = \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1948 |
enumerations.INSTALLED |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1949 |
row[enumerations.STATUS_ICON_COLUMN] = \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1950 |
installed_icon |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1951 |
else: |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1952 |
row[enumerations.STATUS_COLUMN] = \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1953 |
enumerations.NOT_INSTALLED |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1954 |
row[enumerations.STATUS_ICON_COLUMN] = \ |
51cc59540c42
4341 IPS GUI and CLI list different status for some packages
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
757
diff
changeset
|
1955 |
None |
483 | 1956 |
row[enumerations.MARK_COLUMN] = False |
1957 |
self.w_installupdate_button.set_sensitive(False) |
|
1958 |
self.w_installupdate_menuitem.set_sensitive(False) |
|
1959 |
self.w_remove_button.set_sensitive(False) |
|
1960 |
self.w_remove_menuitem.set_sensitive(False) |
|
1961 |
self.__enable_disable_selection_menus() |
|
1962 |
self.update_statusbar() |
|
1963 |
||
1964 |
def shutdown_after_ips_update(self): |
|
1965 |
||
1966 |
# 2790: As IPS and IPS-GUI have been updated the IPS GUI must be shutdown |
|
1967 |
# and restarted |
|
1968 |
msgbox = gtk.MessageDialog(parent = self.w_main_window, \ |
|
1969 |
buttons = gtk.BUTTONS_OK, \ |
|
1970 |
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
|
1971 |
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
|
1972 |
"updated and Package Manager will now be restarted.\n\nAfter " \ |
483 | 1973 |
"restart select Update All to continue.")) |
1974 |
msgbox.set_title(self._("Update All")) |
|
1975 |
msgbox.run() |
|
1976 |
msgbox.destroy() |
|
1977 |
self.__main_application_quit(restart_app = True) |
|
1978 |
||
1979 |
def shutdown_after_image_update(self): |
|
1980 |
||
1981 |
msgbox = gtk.MessageDialog(parent = self.w_main_window, \ |
|
1982 |
buttons = gtk.BUTTONS_OK, \ |
|
1983 |
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
|
1984 |
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
|
1985 |
"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
|
1986 |
"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
|
1987 |
"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
|
1988 |
"relnotes/200811/x86/")) |
483 | 1989 |
msgbox.set_title(self._("Update All")) |
1990 |
msgbox.run() |
|
1991 |
msgbox.destroy() |
|
1992 |
self.__main_application_quit() |
|
1993 |
||
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1994 |
############################################################################### |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1995 |
#-----------------------------------------------------------------------------# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1996 |
# Test functions |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1997 |
#-----------------------------------------------------------------------------# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1998 |
def fill_with_fake_data(self): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
1999 |
'''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
|
2000 |
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
|
2001 |
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
|
2002 |
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
|
2003 |
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
|
2004 |
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
|
2005 |
|
543
9889330c2ab5
3201 Add Dialog for setting default and removing Boot Environments
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
539
diff
changeset
|
2006 |
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
|
2007 |
self.get_icon_pixbuf("None"), "acc", None, None, None, 4, "desc6", \ |
483 | 2008 |
"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
|
2009 |
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
|
2010 |
self.get_icon_pixbuf(self._('All')), "acc_gam", \ |
483 | 2011 |
"2.3", None, "2.8", \ |
2012 |
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
|
2013 |
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
|
2014 |
self.get_icon_pixbuf("Other"), "gam_grap", "2.3", None, None, 4, \ |
483 | 2015 |
"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
|
2016 |
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
|
2017 |
self.get_icon_pixbuf("Office"), "grap_gam", "2.3", None, "2.8", 4, \ |
483 | 2018 |
"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
|
2019 |
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
|
2020 |
self.get_icon_pixbuf("None"), "grap", "2.3", None, "2.8", 4, \ |
483 | 2021 |
"desc0", "Object Name3", None, True, None] |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2022 |
itr1 = self.application_list.append(app1) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2023 |
itr2 = self.application_list.append(app2) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2024 |
itr3 = self.application_list.append(app3) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2025 |
itr4 = self.application_list.append(app4) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2026 |
itr5 = self.application_list.append(app5) |
483 | 2027 |
# 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
|
2028 |
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
|
2029 |
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
|
2030 |
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
|
2031 |
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
|
2032 |
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
|
2033 |
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
|
2034 |
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
|
2035 |
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
|
2036 |
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
|
2037 |
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
|
2038 |
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
|
2039 |
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
|
2040 |
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
|
2041 |
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
|
2042 |
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
|
2043 |
self.application_list, self.category_list) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2044 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2045 |
# Category names until xdg is imported. |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2046 |
# from xdg.DesktopEntry import * |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2047 |
# entry = DesktopEntry () |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2048 |
# directory = '/usr/share/desktop-directories' |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2049 |
# for root, dirs, files in os.walk (directory): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2050 |
# for name in files: |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2051 |
# entry.parse (os.path.join (root, name)) |
483 | 2052 |
# self.__add_category_to_section (entry.getName (), \ |
2053 |
# self._('Applications Desktop')) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2054 |
|
483 | 2055 |
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
|
2056 |
self._('Applications Desktop'), self.category_list) |
483 | 2057 |
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
|
2058 |
self._('Applications Desktop'), self.category_list) |
483 | 2059 |
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
|
2060 |
self._('Applications Desktop'), self.category_list) |
483 | 2061 |
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
|
2062 |
self._('Applications Desktop'), self.category_list) |
483 | 2063 |
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
|
2064 |
self._('Applications Desktop'), self.category_list) |
483 | 2065 |
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
|
2066 |
self._('Applications Desktop'), self.category_list) |
483 | 2067 |
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
|
2068 |
self._('Applications Desktop'), self.category_list) |
483 | 2069 |
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
|
2070 |
self._('Applications Desktop'), self.category_list) |
483 | 2071 |
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
|
2072 |
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
|
2073 |
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
|
2074 |
self._('Operating System'), self.category_list) |
483 | 2075 |
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
|
2076 |
self._('Operating System'), self.category_list) |
483 | 2077 |
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
|
2078 |
self._('Operating System'), self.category_list) |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2079 |
#Can be twice :) |
483 | 2080 |
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
|
2081 |
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
|
2082 |
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
|
2083 |
self.category_list) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2084 |
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
|
2085 |
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
|
2086 |
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
|
2087 |
self.in_setup = False |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2088 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2089 |
############################################################################### |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2090 |
#-----------------------------------------------------------------------------# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2091 |
# Main |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2092 |
#-----------------------------------------------------------------------------# |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2093 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2094 |
def main(): |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2095 |
gtk.main() |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2096 |
return 0 |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2097 |
|
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2098 |
if __name__ == '__main__': |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2099 |
packagemanager = PackageManager() |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2100 |
passed_test_arg = False |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2101 |
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
|
2102 |
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
|
2103 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2104 |
try: |
483 | 2105 |
opts, args = getopt.getopt(sys.argv[1:], "htR:", \ |
2106 |
["help", "test-gui", "image-dir="]) |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2107 |
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
|
2108 |
print "%s, for help use --help" % msg |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2109 |
sys.exit(2) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2110 |
|
781
06837558bc07
5798 GUI Packagemanger does not start if the user's home directory is not world readable
Padraig O'Briain <padraig.obriain@sun.com>
parents:
780
diff
changeset
|
2111 |
if os.path.isabs(sys.argv[0]): |
06837558bc07
5798 GUI Packagemanger does not start if the user's home directory is not world readable
Padraig O'Briain <padraig.obriain@sun.com>
parents:
780
diff
changeset
|
2112 |
packagemanager.application_path = sys.argv[0] |
06837558bc07
5798 GUI Packagemanger does not start if the user's home directory is not world readable
Padraig O'Briain <padraig.obriain@sun.com>
parents:
780
diff
changeset
|
2113 |
else: |
06837558bc07
5798 GUI Packagemanger does not start if the user's home directory is not world readable
Padraig O'Briain <padraig.obriain@sun.com>
parents:
780
diff
changeset
|
2114 |
cmd = os.path.join(os.getcwd(), sys.argv[0]) |
06837558bc07
5798 GUI Packagemanger does not start if the user's home directory is not world readable
Padraig O'Briain <padraig.obriain@sun.com>
parents:
780
diff
changeset
|
2115 |
packagemanager.application_path = os.path.realpath(cmd) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2116 |
|
450
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2117 |
for option, argument in opts: |
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2118 |
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
|
2119 |
print """\ |
579517b41de2
1313 How to list packages I don't have installed?
Michal Pryc <Michal.Pryc@Sun.COM>
parents:
424
diff
changeset
|
2120 |
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
|
2121 |
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
|
2122 |
sys.exit(0) |
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2123 |
if option in ("-t", "--test-gui"): |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2124 |
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
|
2125 |
if option in ("-R", "--image-dir"): |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2126 |
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
|
2127 |
image_dir = argument |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2128 |
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
|
2129 |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2130 |
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
|
2131 |
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
|
2132 |
sys.exit(2) |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2133 |
if not passed_imagedir_arg: |
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2134 |
try: |
483 | 2135 |
image_dir = os.environ["PKG_IMAGE"] |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2136 |
except KeyError: |
483 | 2137 |
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
|
2138 |
packagemanager.provided_image_dir = False |
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2139 |
|
577
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2140 |
while gtk.events_pending(): |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2141 |
gtk.main_iteration(False) |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2142 |
|
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2143 |
packagemanager.init_sections() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2144 |
packagemanager.init_show_filter() |
cd4e8df4322b
873 Text is wrong in the General Info tab
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
576
diff
changeset
|
2145 |
|
457
9ee1bf88afb2
1905 GUI package manager slow responsiveness
John.Rice@Sun.COM
parents:
450
diff
changeset
|
2146 |
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
|
2147 |
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
|
2148 |
else: |
e3ac4c2d99a1
1723 startup performance 3087 shutdown too long 1915 category ordering
John Rice <john.rice@sun.com>
parents:
483
diff
changeset
|
2149 |
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
|
2150 |
|
424
a767ef6bf887
2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents:
diff
changeset
|
2151 |
main() |