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