Print this page
*** NO COMMENTS ***
@@ -58,10 +58,11 @@
import pkg.client.history as history
import pkg.client.image as image
import pkg.client.progress as progress
import pkg.misc as misc
import pkg.portable as portable
+import pkg.gui.beadmin as beadm
import pkg.gui.imageinfo as imageinfo
import pkg.gui.installupdate as installupdate
import pkg.gui.remove as remove
import pkg.gui.enumerations as enumerations
@@ -225,10 +226,11 @@
self.__on_filtercombobox_changed,
"on_repositorycombobox_changed": \
self.__on_repositorycombobox_changed,
#menu signals
"on_file_quit_activate":self.__on_file_quit_activate,
+ "on_file_be_activate":self.__on_file_be_activate,
"on_package_install_update_activate": \
self.__on_install_update,
"on_package_remove_activate":self.__on_remove,
"on_help_about_activate":self.__on_help_about,
"on_edit_paste_activate":self.__on_edit_paste,
@@ -428,10 +430,14 @@
def __on_file_quit_activate(self, widget):
''' handler for quit menu event '''
self.__on_mainwindow_delete_event(None, None)
+ def __on_file_be_activate(self, widget):
+ ''' handler for be menu event '''
+ beadm.Beadmin(self)
+
def __on_searchentry_changed(self, widget):
'''On text search field changed we should refilter the main view'''
Thread(target = self.__on_searchentry_threaded, args = ()).start()
def __on_searchentry_threaded(self):
@@ -619,11 +625,11 @@
def __on_install_update(self, widget):
installupdate.InstallUpdate(self.application_list, self, False)
def __on_update_all(self, widget):
opensolaris_image = True
- fmris, notfound = self.__installed_fmris_from_args(self.image_o, \
+ notfound = self.__installed_fmris_from_args(self.image_o, \
["SUNWipkg", "SUNWcs"])
if notfound:
opensolaris_image = False
@@ -1217,16 +1223,16 @@
self.category_list.clear()
self.application_list_filter.refilter()
try:
pkgs_known = [ pf[0] for pf in
sorted(image_obj.inventory(all_known = True)) ]
- except image.InventoryException, e:
+ except image.InventoryException:
# Can't happen when all_known is true and no args,
# but here for completeness.
raise
#Only one instance of those icons should be in memory
- update_available_icon = self.__get_icon_pixbuf("new_update")
+ update_available_icon = self.get_icon_pixbuf("new_update")
#Imageinfo for categories
imginfo = imageinfo.ImageInfo()
sectioninfo = imageinfo.ImageInfo()
catalogs = image_obj.catalogs
categories = {}
@@ -1387,10 +1393,11 @@
#1915 Sort the Categories into alphabetical order and prepend All Category
if len(self.category_list) > 0:
rows = [tuple(r) + (i,) for i, r in enumerate(self.category_list)]
rows.sort(self.__sort)
+ r = []
self.category_list.reorder([r[-1] for r in rows])
self.category_list.prepend([0, self._('All'), None, None, True, None])
gobject.idle_add(progressdialog_progress, PACKAGE_PROGRESS_PERCENT_TOTAL,
pkg_count, total_pkg_count)
@@ -1452,15 +1459,10 @@
SECTION_LIST_OBJECT \
].append(section[ \
enumerations. \
SECTION_ID])
- def __get_icon_pixbuf(self, icon_name):
- #2821: The __get_icon_pixbuf should use PACKAGE_MANAGER_ROOT
- return self.__get_pixbuf_from_path(self.application_dir + \
- "/usr/share/icons/package-manager/", icon_name)
-
def __get_pixbuf_from_path(self, path, icon_name):
icon = icon_name.replace(' ', '_')
# Performance: Faster to check if files exist rather than catching
# exceptions when they do not. Picked up open failures using dtrace
@@ -1483,21 +1485,10 @@
size = gtk.ICON_SIZE_MENU,
detail = None)
# XXX Could return image-we don't want to show ugly icon.
return None
- def __installed_fmris_from_args(self, img, args):
- found = []
- notfound = []
- try:
- for m in img.inventory(args):
- found.append(m[0])
- except image.InventoryException, e:
- notfound = e.notfound
-
- return found, notfound
-
def __progressdialog_progress_pulse(self):
while not self.progress_stop_timer_thread:
gobject.idle_add(self.w_progressbar.pulse)
time.sleep(0.1)
gobject.idle_add(self.w_progress_dialog.hide)
@@ -1538,10 +1529,22 @@
@staticmethod
def __sort(a, b):
return cmp(a[1], b[1])
@staticmethod
+ def __installed_fmris_from_args(img, args):
+ found = []
+ notfound = []
+ try:
+ for m in img.inventory(args):
+ found.append(m[0])
+ except image.InventoryException, e:
+ notfound = e.notfound
+
+ return notfound
+
+ @staticmethod
def cell_data_function(column, renderer, model, itr, data):
'''Function which sets the background colour to black if package is
selected'''
if itr:
if model.get_value(itr, enumerations.MARK_COLUMN):
@@ -1656,10 +1659,15 @@
self.w_filter_combobox.set_active(0)
self.w_sections_combobox.set_active(0)
self.application_list_filter.set_visible_func(self.__application_filter)
self.__setup_repositories_combobox(self.image_o)
+ def get_icon_pixbuf(self, icon_name):
+ #2821: The get_icon_pixbuf should use PACKAGE_MANAGER_ROOT
+ return self.__get_pixbuf_from_path(self.application_dir + \
+ "/usr/share/icons/package-manager/", icon_name)
+
def get_manifests_for_packages(self):
''' Function, which get's manifest for packages. If the manifest is not
locally tries to retrieve it. For installed packages gets manifest
for the particular version (local operation only), if the package is
not installed than the newest one'''
@@ -1776,25 +1784,25 @@
#-----------------------------------------------------------------------------#
# Test functions
#-----------------------------------------------------------------------------#
def fill_with_fake_data(self):
'''test data for gui'''
- app1 = [False, self.__get_icon_pixbuf("locked"), \
- self.__get_icon_pixbuf("None"), "acc", None, None, None, 4, "desc6", \
+ app1 = [False, self.get_icon_pixbuf("locked"), \
+ self.get_icon_pixbuf("None"), "acc", None, None, None, 4, "desc6", \
"Object Name1", None, True, None]
- app2 = [False, self.__get_icon_pixbuf("update_available"), \
- self.__get_icon_pixbuf(self._('All')), "acc_gam", \
+ app2 = [False, self.get_icon_pixbuf("update_available"), \
+ self.get_icon_pixbuf(self._('All')), "acc_gam", \
"2.3", None, "2.8", \
4, "desc7", "Object Name2", None, True, None]
- app3 = [False, self.__get_icon_pixbuf("None"), \
- self.__get_icon_pixbuf("Other"), "gam_grap", "2.3", None, None, 4, \
+ app3 = [False, self.get_icon_pixbuf("None"), \
+ self.get_icon_pixbuf("Other"), "gam_grap", "2.3", None, None, 4, \
"desc8", "Object Name3", None, True, None]
- app4 = [False, self.__get_icon_pixbuf("update_locked"), \
- self.__get_icon_pixbuf("Office"), "grap_gam", "2.3", None, "2.8", 4, \
+ app4 = [False, self.get_icon_pixbuf("update_locked"), \
+ self.get_icon_pixbuf("Office"), "grap_gam", "2.3", None, "2.8", 4, \
"desc9", "Object Name2", None, True, None]
- app5 = [False, self.__get_icon_pixbuf("update_available"), \
- self.__get_icon_pixbuf("None"), "grap", "2.3", None, "2.8", 4, \
+ app5 = [False, self.get_icon_pixbuf("update_available"), \
+ self.get_icon_pixbuf("None"), "grap", "2.3", None, "2.8", 4, \
"desc0", "Object Name3", None, True, None]
itr1 = self.application_list.append(app1)
itr2 = self.application_list.append(app2)
itr3 = self.application_list.append(app3)
itr4 = self.application_list.append(app4)