--- a/src/gui/modules/beadmin.py Tue Dec 23 09:31:28 2008 -0800
+++ b/src/gui/modules/beadmin.py Fri Jan 02 08:08:46 2009 +0000
@@ -66,15 +66,15 @@
self.parent = parent
if nobe:
- msg = self.parent._("The <b>libbe</b> library was not " \
- "found on your system." \
+ msg = _("The <b>libbe</b> library was not "
+ "found on your system."
"\nAll functions for managing Boot Environments are disabled")
msgbox = gtk.MessageDialog(
- buttons = gtk.BUTTONS_CLOSE, \
- flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO, \
+ buttons = gtk.BUTTONS_CLOSE,
+ flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO,
message_format = None)
msgbox.set_markup(msg)
- msgbox.set_title(self.parent._("BE management"))
+ msgbox.set_title(_("BE management"))
msgbox.run()
msgbox.destroy()
return
@@ -94,7 +94,7 @@
self.initial_default = 0
w_tree_beadmin = gtk.glade.XML(parent.gladefile, "beadmin")
w_tree_progress = gtk.glade.XML(parent.gladefile, "progressdialog")
- w_tree_beconfirmation = gtk.glade.XML(parent.gladefile, \
+ w_tree_beconfirmation = gtk.glade.XML(parent.gladefile,
"beconfirmationdialog")
self.w_beadmin_dialog = w_tree_beadmin.get_widget("beadmin")
self.w_be_treeview = w_tree_beadmin.get_widget("betreeview")
@@ -147,8 +147,8 @@
w_tree_beadmin.signal_autoconnect(dic)
w_tree_beconfirmation.signal_autoconnect(dic_conf)
except AttributeError, error:
- print self.parent._('GUI will not respond to any event! %s. \
- Check beadmin.py signals') \
+ print _("GUI will not respond to any event! %s. "
+ "Check beadmin.py signals") \
% error
Thread(target = self.__progress_pulse).start()
Thread(target = self.__prepare_beadmin_list).start()
@@ -158,12 +158,12 @@
sel = self.w_beconfirmation_treeview.get_selection()
sel.set_mode(gtk.SELECTION_NONE)
self.w_beadmin_dialog.show_all()
- self.w_progress_dialog.set_title(\
- self.parent._("Loading Boot Environment Information"))
- self.w_progressinfo_label.set_text(\
- self.parent._("Fetching BE entries..."))
+ self.w_progress_dialog.set_title(
+ _("Loading Boot Environment Information"))
+ self.w_progressinfo_label.set_text(
+ _("Fetching BE entries..."))
self.be_destroy_supports_capital_f = \
- self.__check_if_be_supports_capital_f()
+ self.__check_if_be_supports_capital_f()
self.w_progress_dialog.show()
def __progress_pulse(self):
@@ -189,7 +189,7 @@
self.w_be_treeview.append_column(column)
name_renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn(self.parent._("Boot Environment"), \
+ column = gtk.TreeViewColumn(_("Boot Environment"),
name_renderer, text = BE_NAME)
column.set_cell_data_func(name_renderer, self.__cell_data_function, None)
column.set_expand(True)
@@ -197,16 +197,16 @@
datetime_renderer = gtk.CellRendererText()
datetime_renderer.set_property('xalign', 0.0)
- column = gtk.TreeViewColumn(self.parent._("Created"), datetime_renderer, \
+ column = gtk.TreeViewColumn(_("Created"), datetime_renderer,
text = BE_DATE_TIME)
- column.set_cell_data_func(datetime_renderer, \
+ column.set_cell_data_func(datetime_renderer,
self.__cell_data_function, None)
column.set_expand(True)
self.w_be_treeview.append_column(column)
size_renderer = gtk.CellRendererText()
size_renderer.set_property('xalign', 1.0)
- column = gtk.TreeViewColumn(self.parent._("Size"), size_renderer, \
+ column = gtk.TreeViewColumn(_("Size"), size_renderer,
text = BE_SIZE)
column.set_cell_data_func(size_renderer, self.__cell_data_function, None)
column.set_expand(False)
@@ -214,21 +214,21 @@
radio_renderer = gtk.CellRendererToggle()
radio_renderer.connect('toggled', self.__active_pane_default, model)
- column = gtk.TreeViewColumn(self.parent._("Active on Reboot"), \
+ column = gtk.TreeViewColumn(_("Active on Reboot"),
radio_renderer, active = BE_ACTIVE_DEFAULT)
radio_renderer.set_property("activatable", True)
radio_renderer.set_property("radio", True)
- column.set_cell_data_func(radio_renderer, \
+ column.set_cell_data_func(radio_renderer,
self.__cell_data_default_function, None)
column.set_expand(False)
self.w_be_treeview.append_column(column)
toggle_renderer = gtk.CellRendererToggle()
toggle_renderer.connect('toggled', self.__active_pane_toggle, model)
- column = gtk.TreeViewColumn(self.parent._("Delete"), toggle_renderer, \
+ column = gtk.TreeViewColumn(_("Delete"), toggle_renderer,
active = BE_MARKED)
toggle_renderer.set_property("activatable", True)
- column.set_cell_data_func(toggle_renderer, \
+ column.set_cell_data_func(toggle_renderer,
self.__cell_data_delete_function, None)
column.set_expand(False)
self.w_be_treeview.append_column(column)
@@ -242,9 +242,9 @@
self.__enable_disable_reset()
def __on_ok_be_clicked(self, widget):
- self.w_progress_dialog.set_title(self.parent._("Applying changes"))
- self.w_progressinfo_label.set_text(\
- self.parent._("Applying changes, please wait ..."))
+ self.w_progress_dialog.set_title(_("Applying changes"))
+ self.w_progressinfo_label.set_text(
+ _("Applying changes, please wait ..."))
if self.w_reset_button.get_property('sensitive') == 0:
self.progress_stop_thread = True
self.__on_beadmin_delete_event(None, None)
@@ -284,11 +284,11 @@
summary_text = ""
be_change_no = len(treestore)
if be_change_no == 0:
- treestore.append([self.parent._("No change")])
+ treestore.append([_("No change")])
self.w_beconfirmation_treeview.set_sensitive(False)
else:
summary_text += \
- self.parent._("%d BE's will be deleted") % be_change_no
+ _("%d BE's will be deleted") % be_change_no
if default:
self.w_beconfirmationdefault_label.set_text(default+"\n")
@@ -296,11 +296,11 @@
if be_change_no > 0:
summary_text += "\n"
summary_text += \
- self.parent._("The Active BE will be changed upon reboot")
+ _("The Active BE will be changed upon reboot")
else:
self.w_beconfirmationdefault_label.set_sensitive(False)
- self.w_beconfirmationdefault_label.set_text(\
- self.parent._("No change\n"))
+ self.w_beconfirmationdefault_label.set_text(
+ _("No change\n"))
self.w_beconfirmationsummary_label.set_text(summary_text)
self.w_beconfirmation_treeview.expand_all()
self.w_cancelbe_button.grab_focus()
@@ -336,12 +336,12 @@
self.progress_stop_thread = True
msg = ""
if not_default:
- msg += self.parent._("<b>Couldn't change Active " \
+ msg += _("<b>Couldn't change Active "
"Boot Environment to:</b>\n") + not_default
if len(not_deleted) > 0:
if not_default:
msg += "\n\n"
- msg += self.parent._("<b>Couldn't delete Boot " \
+ msg += _("<b>Couldn't delete Boot "
"Environments:</b>\n")
for row in not_deleted:
msg += row + "\n"
@@ -351,12 +351,12 @@
def __error_occured(self, error_msg, reset=True):
msg = error_msg
- msgbox = gtk.MessageDialog(parent = self.w_beadmin_dialog, \
- buttons = gtk.BUTTONS_CLOSE, \
- flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_ERROR, \
+ msgbox = gtk.MessageDialog(parent = self.w_beadmin_dialog,
+ buttons = gtk.BUTTONS_CLOSE,
+ flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_ERROR,
message_format = None)
msgbox.set_markup(msg)
- msgbox.set_title("BE error")
+ msgbox.set_title(_("BE error"))
msgbox.run()
msgbox.destroy()
if reset:
@@ -368,8 +368,7 @@
itr = model.get_iter(path)
if itr:
modified = model.get_value(itr, BE_MARKED)
- model.set_value(itr, BE_MARKED, \
- not modified)
+ model.set_value(itr, BE_MARKED, not modified)
self.__enable_disable_reset()
def __enable_disable_reset(self):
@@ -392,8 +391,7 @@
itr = model.get_iter(path)
if itr:
modified = model.get_value(itr, BE_ACTIVE_DEFAULT)
- model.set_value(itr, BE_ACTIVE_DEFAULT, \
- not modified)
+ model.set_value(itr, BE_ACTIVE_DEFAULT, not modified)
self.__enable_disable_reset()
def __create_view_with_be(self, be_list):
@@ -407,8 +405,8 @@
if error_code != None and error_code == 0:
be_list_loop = be_list[1]
elif error_code != None and error_code != 0:
- msg = self.parent._("The <b>libbe</b> library couldn't " \
- "prepare list of Boot Environments." \
+ msg = _("The <b>libbe</b> library couldn't "
+ "prepare list of Boot Environments."
"\nAll functions for managing Boot Environments are disabled")
self.__error_occured(msg, False)
return
@@ -437,11 +435,11 @@
try:
date_format = \
unicode(
- self.parent._("%m/%d/%y %H:%M"),
+ _("%m/%d/%y %H:%M"),
"utf-8").encode(
locale.getpreferredencoding())
except (UnicodeError, LookupError):
- print self.parent._(
+ print _(
"Error conversion from UTF-8 " \
"to %s.") \
% locale.getpreferredencoding()
@@ -456,11 +454,11 @@
try:
date_format = \
unicode(
- self.parent._("%m/%d/%y %H:%M"),
+ _("%m/%d/%y %H:%M"),
"utf-8").encode(
locale.getpreferredencoding())
except (UnicodeError, LookupError):
- print self.parent._(
+ print _(
"Error conversion from UTF-8 to %s.") \
% locale.getpreferredencoding()
date_format = "%F %H:%M"
@@ -477,15 +475,15 @@
locale.getpreferredencoding()).encode(
"utf-8")
except (UnicodeError, LookupError):
- print self.parent._(
+ print _(
"Error conversion from %s to UTF-8.") \
% locale.getpreferredencoding()
- self.be_list.insert(j, [j, False, \
- name, \
- date_time, active_img, \
+ self.be_list.insert(j, [j, False,
+ name,
+ date_time, active_img,
active_boot, converted_size])
j += 1
- self.w_be_treeview.set_cursor(self.initial_active, None, \
+ self.w_be_treeview.set_cursor(self.initial_active, None,
start_editing=True)
self.w_be_treeview.scroll_to_cell(self.initial_active)
@@ -568,7 +566,7 @@
return None
list_of_dates = []
try:
- proc = subprocess.Popen(cmd, stdout = subprocess.PIPE, \
+ proc = subprocess.Popen(cmd, stdout = subprocess.PIPE,
stderr = subprocess.PIPE,)
line_out = proc.stdout.readline()
while line_out:
--- a/src/gui/modules/installupdate.py Tue Dec 23 09:31:28 2008 -0800
+++ b/src/gui/modules/installupdate.py Fri Jan 02 08:08:46 2009 +0000
@@ -139,20 +139,20 @@
remove_warning_triange.hide()
if self.action == enumerations.REMOVE:
- self.w_installupdate_dialog.set_title(self.parent._(\
+ self.w_installupdate_dialog.set_title(_(
"Remove Confirmation"))
- self.w_information_label.set_text(\
- self.parent._("This action affects other packages.\n" \
- "Review the packages to be removed.\n" \
+ self.w_information_label.set_text(
+ _("This action affects other packages.\n"
+ "Review the packages to be removed.\n"
"Click Proceed to continue."))
- self.w_installing_dialog.set_title(\
- self.parent._("Removing Packages"))
- self.w_createplan_dialog.set_title(\
- self.parent._("Remove Check"))
- self.w_installingdialog_label.set_text(\
- self.parent._("Removing Packages..."))
- self.w_next_label.set_label(\
- self.parent._("_Proceed"))
+ self.w_installing_dialog.set_title(
+ _("Removing Packages"))
+ self.w_createplan_dialog.set_title(
+ _("Remove Check"))
+ self.w_installingdialog_label.set_text(
+ _("Removing Packages..."))
+ self.w_next_label.set_label(
+ _("_Proceed"))
remove_warning_triange.show()
try:
@@ -196,13 +196,13 @@
w_tree_errordialog.signal_autoconnect(dic_error)
w_tree_uaconfirm.signal_autoconnect(dic_uaconfirm)
except AttributeError, error:
- print self.parent._('GUI will not respond to any event! %s. \
- Check installupdate.py signals') \
+ print _("GUI will not respond to any event! %s. "
+ "Check installupdate.py signals") \
% error
# XXX Hidden until progress will give information about fmri
self.w_installingdialog_expander.hide()
- self.w_createplan_label.set_text(\
- self.parent._("Checking package dependencies..."))
+ self.w_createplan_label.set_text(
+ _("Checking package dependencies..."))
self.w_createplancancel_button.set_sensitive(True)
if self.action == enumerations.IMAGE_UPDATE:
self.w_ua_proceed_button.grab_focus()
@@ -215,8 +215,7 @@
evaluation stage - while the dialog is creating plan'''
if self.api_o.can_be_canceled():
Thread(target = self.api_o.cancel, args = ()).start()
- self.w_createplan_label.set_text(\
- self.parent._("Canceling..."))
+ self.w_createplan_label.set_text(_("Canceling..."))
self.w_createplancancel_button.set_sensitive(False)
def __on_cancel_button_clicked(self, widget):
@@ -231,7 +230,7 @@
user after evaluation stage on the dialog showing what will be installed
or updated'''
self.w_installupdate_dialog.hide()
- download_thread = Thread(target = self.__prepare_stage_ex, \
+ download_thread = Thread(target = self.__prepare_stage_ex,
args = (self.api_o, ))
download_thread.start()
@@ -240,8 +239,7 @@
download stage.'''
if self.api_o.can_be_canceled():
Thread(target = self.api_o.cancel, args = ()).start()
- self.w_download_label.set_text(\
- self.parent._("Canceling..."))
+ self.w_download_label.set_text(_("Canceling..."))
self.w_canceldownload_button.set_sensitive(False)
def __on_networkdown_close_clicked(self, widget):
@@ -257,7 +255,7 @@
def __on_ua_proceed_button_clicked(self, widget):
pulse_t = Thread(target = self.__progressdialog_progress_pulse)
- thread = Thread(target = self.__plan_the_install_updateimage_ex, \
+ thread = Thread(target = self.__plan_the_install_updateimage_ex,
args = (self.install_list, ))
pulse_t.start()
thread.start()
@@ -284,7 +282,7 @@
size_a_str = pkg.misc.bytes_to_str(cur_bytes)
if total_bytes >= 0:
size_b_str = pkg.misc.bytes_to_str(total_bytes)
- c = "Downloaded: " + size_a_str + " / " + size_b_str
+ c = _("Downloaded: ") + size_a_str + " / " + size_b_str
self.w_download_progressbar.set_text(c)
def __update_install_progress(self, current, total):
@@ -304,57 +302,55 @@
except Exception:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("An unknown error occured while " \
- "preparing the\nlist of packages\n\nPlease let the " \
- "developers know about this problem by filing\n" \
+ msg = _("An unknown error occured while "
+ "preparing the\nlist of packages\n\nPlease let the "
+ "developers know about this problem by filing\n"
"a bug at http://defect.opensolaris.org")
- msg += self.parent._("\n\nException value: ") + "\n" + str(sys.exc_value)
+ msg += _("\n\nException value: ") + "\n" + str(sys.exc_value)
gobject.idle_add(self.parent.error_occured, msg)
sys.exc_clear()
return
def __plan_the_install_updateimage(self, list_of_packages):
'''Function which plans the image'''
- gobject.idle_add(self.__update_createplan_progress, \
- self.parent._("Evaluation started.\n" \
- "Gathering packages information, please wait...\n"))
+ gobject.idle_add(self.__update_createplan_progress,
+ _("Evaluation started.\n"
+ "Gathering packages information, please wait...\n"))
stuff_to_do = False
if self.action == enumerations.INSTALL_UPDATE:
try:
- stuff_to_do, cre = self.api_o.plan_install( \
+ stuff_to_do, cre = self.api_o.plan_install(
list_of_packages, filters = [])
if cre and not cre.succeeded:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("Unexpected failure with" \
- "\ncatalog refresh during install" \
+ msg = _("Unexpected failure with"
+ "\ncatalog refresh during install"
" while \ndetermining what to update.")
gobject.idle_add(self.parent.error_occured, msg)
return
except api_errors.InvalidCertException:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("Accessing this restricted repository failed." \
- "\nYou either need to register to access this repository," \
- "\nthe certificate expired, or you need to accept the repository" \
+ msg = _("Accessing this restricted repository failed."
+ "\nYou either need to register to access this repository,"
+ "\nthe certificate expired, or you need to accept the repository"
"\ncertificate.")
- gobject.idle_add(self.parent.error_occured, msg, \
+ gobject.idle_add(self.parent.error_occured, msg,
None, gtk.MESSAGE_INFO)
return
except api_errors.PlanCreationException, e:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- err_msg = self.parent._("Install/Update failure" \
- " in plan creation.")
+ err_msg = _("Install/Update failure in plan creation.")
err_text = str(e)
- gobject.idle_add(self.__error_with_details, \
+ gobject.idle_add(self.__error_with_details,
err_msg, err_text)
return
except api_errors.InventoryException:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("Install failed.\n" \
- "The inventory is not correct.")
+ msg = _("Install failed.\nThe inventory is not correct.")
gobject.idle_add(self.parent.error_occured, msg)
return
except api_errors.CanceledException:
@@ -365,7 +361,7 @@
# network problem
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("Please check the network " \
+ msg = _("Please check the network "
"connection.\nIs the repository accessible?")
gobject.idle_add(self.parent.error_occured, msg, \
None, gtk.MESSAGE_INFO)
@@ -379,10 +375,9 @@
except api_errors.PlanCreationException, e:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- err_msg = self.parent._("Remove failure in plan" \
- " creation.")
+ err_msg = _("Remove failure in plan creation.")
err_text = str(e)
- gobject.idle_add(self.__error_with_details, \
+ gobject.idle_add(self.__error_with_details,
err_msg, err_text)
return
except api_errors.CanceledException:
@@ -399,13 +394,13 @@
# we are passing force, since we already checked if the
# SUNWipkg and SUNWipkg-gui are up to date.
stuff_to_do, opensolaris_image, cre = \
- self.api_o.plan_update_all(sys.argv[0], \
- refresh_catalogs = False, \
+ self.api_o.plan_update_all(sys.argv[0],
+ refresh_catalogs = False,
noexecute = False, force = True)
if cre and not cre.succeeded:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("Unexpected failure with" \
+ msg = _("Unexpected failure with"
"\ncatalog refresh during image-update" \
" while \ndetermining what to update.")
gobject.idle_add(self.parent.error_occured, msg)
@@ -413,27 +408,26 @@
except api_errors.CatalogRefreshException:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("Please check the network " \
+ msg = _("Please check the network "
"connection.\nIs the repository accessible?")
- gobject.idle_add(self.parent.error_occured, msg, \
+ gobject.idle_add(self.parent.error_occured, msg,
None, gtk.MESSAGE_INFO)
return
except api_errors.IpkgOutOfDateException:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("pkg(5) appears to be out of " \
- "date and should be\n updated before running " \
+ msg = _("pkg(5) appears to be out of "
+ "date and should be\n updated before running "
"Update All.\nPlease update SUNWipkg package")
- gobject.idle_add(self.parent.error_occured, msg, \
+ gobject.idle_add(self.parent.error_occured, msg,
None, gtk.MESSAGE_INFO)
return
except api_errors.PlanCreationException, e:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- err_msg = self.parent._("Update All failure in plan" \
- " creation.")
+ err_msg = _("Update All failure in plan creation.")
err_text = str(e)
- gobject.idle_add(self.__error_with_details, \
+ gobject.idle_add(self.__error_with_details,
err_msg, err_text)
return
except api_errors.CanceledException:
@@ -443,9 +437,9 @@
except api_errors.NetworkUnavailableException:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("Please check the network " \
+ msg = _("Please check the network "
"connection.\nIs the repository accessible?")
- gobject.idle_add(self.parent.error_occured, msg, \
+ gobject.idle_add(self.parent.error_occured, msg,
None, gtk.MESSAGE_INFO)
return
if stuff_to_do:
@@ -453,17 +447,17 @@
elif self.action == enumerations.INSTALL_UPDATE:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("Selected packages for update can\n" \
+ msg = _("Selected packages for update can\n"
"only be updated using Update All.")
- title = self.parent._("Unable to update")
- gobject.idle_add(self.parent.error_occured, msg, title, \
+ title = _("Unable to update")
+ gobject.idle_add(self.parent.error_occured, msg, title,
gtk.MESSAGE_INFO)
else:
self.progress_stop_timer_thread = True
gobject.idle_add(self.w_createplan_dialog.hide)
- msg = self.parent._("The action for selected packages " \
+ msg = _("The action for selected packages "
"could not be completed.")
- title = self.parent._("Unable to perform action")
+ title = _("Unable to perform action")
gobject.idle_add(self.parent.error_occured, msg, title)
@@ -477,12 +471,12 @@
gobject.idle_add(self.__prompt_to_load_beadm)
return
else:
- msg = self.parent._("An unknown error occured while " \
- "downloading the files\n\nPlease let the " \
- "developers know about this problem by filing\n" \
+ msg = _("An unknown error occured while "
+ "downloading the files\n\nPlease let the "
+ "developers know about this problem by filing\n"
"a bug at http://defect.opensolaris.org")
msg += \
- self.parent._("\n\nException value: ") + "\n" + \
+ _("\n\nException value: ") + "\n" + \
str(sys.exc_value)
gobject.idle_add(self.parent.error_occured, msg)
sys.exc_clear()
@@ -490,21 +484,21 @@
def __prepare_stage(self, api_o):
gobject.idle_add(self.w_downloadingfiles_dialog.show)
- text = self.parent._("Preparing to download packages, please wait...")
+ text = _("Preparing to download packages, please wait...")
gobject.idle_add(self.__add_info_to_downloadtext, text)
try:
api_o.prepare()
except api_errors.ProblematicPermissionsIndexException:
gobject.idle_add(self.w_downloadingfiles_dialog.hide)
- msg = self.parent._("An error occured while " \
+ msg = _("An error occured while "
"downloading the files\nPlease check your permissions.")
gobject.idle_add(self.parent.error_occured, msg)
return
except api_errors.PlanMissingException, e:
gobject.idle_add(self.w_downloadingfiles_dialog.hide)
- err_msg = self.parent._("Download failure.")
+ err_msg = _("Download failure.")
err_text = str(e)
- gobject.idle_add(self.__error_with_details, \
+ gobject.idle_add(self.__error_with_details,
err_msg, err_text)
return
except api_errors.CanceledException:
@@ -530,20 +524,20 @@
gobject.idle_add(self.__prompt_to_load_beadm)
return
else:
- msg = self.parent._("An unknown error occured while " \
- "installing\nupdating or removing packages" \
- "\n\nPlease let the developers know about this " \
- "problem by filing\na bug at " \
+ msg = _("An unknown error occured while "
+ "installing\nupdating or removing packages"
+ "\n\nPlease let the developers know about this "
+ "problem by filing\na bug at "
"http://defect.opensolaris.org")
msg += \
- self.parent._("\n\nException value: ") + "\n" + \
+ _("\n\nException value: ") + "\n" + \
str(sys.exc_value)
gobject.idle_add(self.parent.error_occured, msg)
sys.exc_clear()
return
def __execute_stage(self, api_o):
- text = self.parent._("Installing Packages...")
+ text = _("Installing Packages...")
gobject.idle_add(self.w_downloadingfiles_dialog.hide)
gobject.idle_add(self.w_installingdialog_label.set_text, text)
gobject.idle_add(self.w_installing_dialog.show)
@@ -551,35 +545,35 @@
api_o.execute_plan()
except api_errors.CorruptedIndexException:
gobject.idle_add(self.w_installing_dialog.hide)
- msg = self.parent._("There was an error during installation." \
- "\nThe index is corrupted. You might wan't try to fix" \
- "\nthis problem by running command:" \
+ msg = _("There was an error during installation."
+ "\nThe index is corrupted. You might wan't try to fix"
+ "\nthis problem by running command:"
"\npfexec pkg rebuild-index")
gobject.idle_add(self.parent.error_occured, msg)
return
except api_errors.ProblematicPermissionsIndexException:
gobject.idle_add(self.w_installing_dialog.hide)
- msg = self.parent._("An error occured while " \
+ msg = _("An error occured while "
"installing the files\nPlease check your permissions")
gobject.idle_add(self.parent.error_occured, msg)
return
except api_errors.ImageplanStateException:
gobject.idle_add(self.w_installing_dialog.hide)
- msg = self.parent._("There was an error during installation." \
- "\nThe State of the image is incorrect and the operation" \
+ msg = _("There was an error during installation."
+ "\nThe State of the image is incorrect and the operation"
"\ncan't be finished.")
gobject.idle_add(self.parent.error_occured, msg)
return
except api_errors.ImageUpdateOnLiveImageException:
gobject.idle_add(self.w_installing_dialog.hide)
- msg = self.parent._("This is an Live Image. The install" \
+ msg = _("This is an Live Image. The install"
"\noperation can't be performed.")
gobject.idle_add(self.parent.error_occured, msg)
return
except api_errors.PlanMissingException:
gobject.idle_add(self.w_installing_dialog.hide)
- msg = self.parent._("There was an error during installation." \
- "\nThe Plan of the operation is missing and the operation" \
+ msg = _("There was an error during installation."
+ "\nThe Plan of the operation is missing and the operation"
"\ncan't be finished.")
gobject.idle_add(self.parent.error_occured, msg)
return
@@ -618,15 +612,15 @@
self.w_error_dialog.destroy()
def __prompt_to_load_beadm(self):
- msgbox = gtk.MessageDialog(parent = self.parent.w_main_window, \
- buttons = gtk.BUTTONS_OK_CANCEL, flags = gtk.DIALOG_MODAL, \
- type = gtk.MESSAGE_ERROR, \
- message_format = self.parent._(\
- "Not enough disc space: selected action cannot " + \
- "be performed.\n\n" +\
- "You may click OK to launch BE Management to manage your " + \
- "existing BE's and free up disc space."))
- msgbox.set_title(self.parent._("Not Enough Disc Space"))
+ msgbox = gtk.MessageDialog(parent = self.parent.w_main_window,
+ buttons = gtk.BUTTONS_OK_CANCEL, flags = gtk.DIALOG_MODAL,
+ type = gtk.MESSAGE_ERROR,
+ message_format = _(
+ "Not enough disc space: selected action cannot " +
+ "be performed.\n\n" +
+ "You may click OK to launch BE Management to manage your " +
+ "existing BE's and free up disc space."))
+ msgbox.set_title(_("Not Enough Disc Space"))
result = msgbox.run()
msgbox.destroy()
if result == gtk.RESPONSE_OK:
@@ -657,9 +651,9 @@
function'''
cur_eval_fmri = self.eval_cur_fmri
if cur_eval_fmri:
- gobject.idle_add(self.__update_createplan_progress, \
- self.parent._("Evaluating: %s\n") % cur_eval_fmri)
- text = self.parent._("Evaluating package " + \
+ gobject.idle_add(self.__update_createplan_progress,
+ _("Evaluating: %s\n") % cur_eval_fmri)
+ text = _("Evaluating package " +
"%s") % cur_eval_fmri.get_name()
gobject.idle_add(self.w_createplan_label.set_text, text)
@@ -668,45 +662,41 @@
nupdt = self.eval_goal_update_npkgs
nremv = self.eval_goal_remove_npkgs
nbytes = self.dl_goal_nbytes
- gobject.idle_add(self.__eval_output_done, \
+ gobject.idle_add(self.__eval_output_done,
ninst, nupdt, nremv, nbytes)
def __eval_output_done(self, ninst, nupdt, nremv, nbytes):
label_text = ""
if nupdt > 0 and nupdt != 1:
- label_text += \
- self.parent._("%d packages will be updated\n") % nupdt
+ label_text += _("%d packages will be updated\n") % nupdt
elif nupdt == 1:
- label_text += \
- self.parent._("%d package will be updated\n") % nupdt
+ label_text += _("%d package will be updated\n") % nupdt
if ninst > 0 and ninst != 1:
- label_text += \
- self.parent._("%d packages will be installed\n\n") % ninst
+ label_text += _("%d packages will be installed\n\n") % ninst
elif ninst == 1:
- label_text += \
- self.parent._("%d package will be installed\n\n") % ninst
+ label_text += _("%d package will be installed\n\n") % ninst
if nremv > 0 and nremv != 1:
label_text += \
- self.parent._("%d packages will be removed\n\n") % nremv
+ _("%d packages will be removed\n\n") % nremv
elif nremv == 1:
label_text += \
- self.parent._("%d package will be removed\n\n") % nremv
+ _("%d package will be removed\n\n") % nremv
if not nbytes:
nbytes = 0
if nbytes > 0:
size_str = pkg.misc.bytes_to_str(nbytes)
- label_text += self.parent._("%s will be downloaded") % size_str
+ label_text += _("%s will be downloaded") % size_str
self.w_summary_label.set_text(label_text)
def __afterplan_nonleaf_dialog(self, non_leaf_exception):
- self.w_installupdate_dialog.set_title(self.parent._(\
+ self.w_installupdate_dialog.set_title(_(
"Remove Confirmation"))
- self.w_information_label.set_text(\
- self.parent._("This action couldn't be finished.\n" \
- "Some of the selected packages depends on other.\n" \
+ self.w_information_label.set_text(
+ _("This action couldn't be finished.\n"
+ "Some of the selected packages depends on other.\n"
"Please review the dependencies."))
self.w_next_button.hide()
- self.w_cancel_button.set_label(self.parent._("Close"))
+ self.w_cancel_button.set_label(_("Close"))
pkg_blocker = non_leaf_exception[0]
treestore = gtk.TreeStore(str)
pkg_iter = treestore.append(None, [pkg_blocker])
@@ -714,7 +704,7 @@
treestore.append(pkg_iter, [pkg_a])
self.w_review_treeview.set_model(treestore)
self.w_review_treeview.expand_all()
- label_text = self.parent._("None of the packages will be removed")
+ label_text = _("None of the packages will be removed")
self.w_summary_label.set_text(label_text)
self.progress_stop_timer_thread = True
self.w_createplan_dialog.hide()
@@ -796,7 +786,7 @@
self.dl_cur_nbytes, self.dl_goal_nbytes)
if self.prev_pkg != self.dl_cur_pkg:
self.prev_pkg = self.dl_cur_pkg
- text = self.parent._("Downloading: ") + self.dl_cur_pkg
+ text = _("Downloading: ") + self.dl_cur_pkg
gobject.idle_add(self.__add_info_to_downloadtext, text)
return
@@ -806,10 +796,10 @@
def act_output(self):
if self.act_phase != self.act_phase_last:
self.act_phase_last = self.act_phase
- gobject.idle_add(\
- self.w_installingdialog_label.set_text, \
+ gobject.idle_add(
+ self.w_installingdialog_label.set_text,
self.act_phase)
- gobject.idle_add(self.__update_install_progress, \
+ gobject.idle_add(self.__update_install_progress,
self.act_cur_nactions, self.act_goal_nactions)
return
@@ -823,8 +813,8 @@
def __indexing_progress(self):
if not self.progress_stop_timer_running:
- self.w_installingdialog_label.set_text(\
- self.parent._("Creating packages index..."))
+ self.w_installingdialog_label.set_text(
+ _("Creating packages index..."))
Thread(target = self.__update_install_pulse).start()
def ind_output_done(self):
--- a/src/gui/modules/repository.py Tue Dec 23 09:31:28 2008 -0800
+++ b/src/gui/modules/repository.py Fri Jan 02 08:08:46 2009 +0000
@@ -144,8 +144,8 @@
w_tree_repository.signal_autoconnect(dic)
w_tree_repositorymodify.signal_autoconnect(dic_conf)
except AttributeError, error:
- print self.parent._('GUI will not respond to any event! %s. \
- Check repository.py signals') \
+ print _("GUI will not respond to any event! %s. "
+ "Check repository.py signals") \
% error
Thread(target = self.__prepare_repository_list).start()
@@ -165,12 +165,12 @@
self.w_repository_remove_button.set_sensitive(False)
def __init_tree_views(self):
name_renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn(self.parent._("Repository Name"), \
- name_renderer, text = 0) # 0 = Name
+ column = gtk.TreeViewColumn(_("Repository Name"),
+ name_renderer, text = 0) # 0 = Name
column.set_expand(True)
self.w_repository_treeview.append_column(column)
radio_renderer = gtk.CellRendererToggle()
- column = gtk.TreeViewColumn(self.parent._("Preferred"), \
+ column = gtk.TreeViewColumn(_("Preferred"),
radio_renderer, active = 1) # 1 = Preferred
radio_renderer.set_property("activatable", True)
radio_renderer.set_property("radio", True)
@@ -178,12 +178,12 @@
radio_renderer.connect('toggled', self.__preferred_default)
self.w_repository_treeview.append_column(column)
- def __prepare_repository_list(self, clear_add_entries=True, selected_auth=None, \
+ def __prepare_repository_list(self, clear_add_entries=True, selected_auth=None,
stop_thread=True):
self.number_of_changes += 1
self.img.load_config()
auths = self.img.gen_authorities()
- gobject.idle_add(self.__create_view_with_auths, auths, \
+ gobject.idle_add(self.__create_view_with_auths, auths,
clear_add_entries, selected_auth)
if stop_thread:
self.progress_stop_thread = True
@@ -202,15 +202,14 @@
for a in auths:
l = self.img.split_authority(a)
name = l[0]
- is_preferred = \
- name == preferred
+ is_preferred = name == preferred
if is_preferred:
self.initial_default = j
if selected_auth:
if name == selected_auth:
select_auth = j
- self.repository_list.insert(j, \
- [name, is_preferred, l[1]])
+ self.repository_list.insert(j,
+ [name, is_preferred, l[1]])
j += 1
if j > 0:
self.w_repository_modify_button.set_sensitive(False)
@@ -218,8 +217,8 @@
self.w_repository_treeview.set_model(self.list_filter)
if select_auth == -1:
select_auth = self.initial_default
- self.w_repository_treeview.set_cursor(select_auth, \
- None, start_editing=False)
+ self.w_repository_treeview.set_cursor(select_auth,
+ None, start_editing=False)
self.w_repository_treeview.scroll_to_cell(select_auth)
def __preferred_default(self, cell, filtered_path):
@@ -238,10 +237,10 @@
row[1] = False
model.set_value(itr, 1, not preferred)
except api_errors.PermissionsException:
- err = self.parent._("Couldn't change" \
- " the preferred authority.\n" \
+ err = _("Couldn't change"
+ " the preferred authority.\n"
"Please check your permissions.")
- self.__error_occured(err, \
+ self.__error_occured(err,
msg_type=gtk.MESSAGE_INFO)
self.__prepare_repository_list()
@@ -283,16 +282,14 @@
if len(name) == 0:
return False
if not misc.valid_auth_prefix(name):
- self.name_error = self.parent._(\
- "Name contains invalid characters")
+ self.name_error = _("Name contains invalid characters")
return False
model = self.w_repository_treeview.get_model()
if model:
for row in model:
if row[0] == name:
- self.name_error = self.parent._(\
- "Name already in use")
+ self.name_error = _("Name already in use")
return False
return True
@@ -313,7 +310,7 @@
if valid_start:
self.url_error = None
else:
- self.url_error = self.parent._("URL is not valid")
+ self.url_error = _("URL is not valid")
return False
return True
@@ -368,8 +365,8 @@
def __on_repositoryadd_clicked(self, widget):
name = self.w_repository_name.get_text()
url = self.w_repository_url.get_text()
- p_title = self.parent._("Applying changes")
- p_text = self.parent._("Applying changes, please wait ...")
+ p_title = _("Applying changes")
+ p_text = _("Applying changes, please wait ...")
self.__run_with_prog_in_thread(self.__add_repository, p_title, p_text,
name, url)
return
@@ -384,8 +381,8 @@
def __on_repositoryremove_clicked(self, widget):
- p_title = self.parent._("Applying changes")
- p_text = self.parent._("Applying changes, please wait ...")
+ p_title = _("Applying changes")
+ p_text = _("Applying changes, please wait ...")
self.__run_with_prog_in_thread(self.__delete_selected_row, p_title,
p_text)
@@ -414,15 +411,14 @@
self.w_repositorymodify_dialog.hide()
name = self.w_repositorymodify_name.get_text()
url = self.w_repositorymodify_url.get_text()
- p_title = self.parent._("Applying changes")
- p_text = self.parent._("Applying changes, please wait ...")
+ p_title = _("Applying changes")
+ p_text = _("Applying changes, please wait ...")
self.__run_with_prog_in_thread(self.__update_repository, p_title,
p_text, name, url)
def __update_repository(self, name, url):
url_same = True
name_same = True
- strt = self.parent._
if name != self.old_modify_name:
name_same = False
if url != self.old_modify_url:
@@ -437,9 +433,9 @@
omn = self.old_modify_name
if not self.__is_name_valid(name):
self.progress_stop_thread = True
- err = strt("Failed to modify %s." % omn + \
- "\nThe choosen" + \
- " repository name %s is already in use" % name)
+ err = _("Failed to modify %s."
+ "\nThe choosen repository name %s is "
+ "already in use") % (omn, name)
gobject.idle_add(self.__error_occured, err)
self.progress_stop_thread = True
return
@@ -447,8 +443,8 @@
self.__delete_repository(self.old_modify_name, False)
except api_errors.PermissionsException:
# Do nothing
- err = strt("Failed to modify %s." % omn +
- "\nPlease check your permissions.")
+ err = _("Failed to modify %s."
+ "\nPlease check your permissions.") % omn
self.__error_with_reset_repo_selection(err,
gtk.MESSAGE_INFO)
return
@@ -467,9 +463,9 @@
except api_errors.PermissionsException:
# Do nothing
somn = self.old_modify_name
- err = strt("Failed to modify %s." % somn + \
- "\nPlease check your permissions.")
- self.__error_with_reset_repo_selection(err, \
+ err = _("Failed to modify %s."
+ "\nPlease check your permissions.") % omn
+ self.__error_with_reset_repo_selection(err,
gtk.MESSAGE_INFO)
return
except RuntimeError, ex:
@@ -489,8 +485,8 @@
self.old_modify_url, False, stop_thread=False)
if somn != name:
self.__delete_repository(name, False)
- err = self.parent._("Failed to modify %s.") % somn + \
- self.parent._(
+ err = _("Failed to modify %s.") % somn + \
+ _(
"\nPlease check the network connection or URL.\n"
"Is the repository accessible?")
gobject.idle_add(self.__error_occured, err,
@@ -501,8 +497,8 @@
#and was modified
#To not existed repository
somn = self.old_modify_name
- err = self.parent._("Failed to modify %s.") % somn + \
- self.parent._(
+ err = _("Failed to modify %s.") % somn + \
+ _(
"\nPlease check the network connection or URL.\n"
"Is the repository accessible?")
gobject.idle_add(self.__error_occured, err,
@@ -527,7 +523,7 @@
def __add_repository(self, auth, origin_url, silent=True, stop_thread=True):
if not misc.valid_auth_url(origin_url):
- err = self.parent._("Invalid URL:\n%s" % origin_url)
+ err = _("Invalid URL:\n%s" % origin_url)
gobject.idle_add(self.__error_occured, err)
gobject.idle_add(self.w_repository_name.grab_focus)
self.progress_stop_thread = True
@@ -539,28 +535,28 @@
self.img.set_authority(auth, origin_url=origin_url,
ssl_key=ssl_key, ssl_cert=ssl_cert,
refresh_allowed=refresh_catalogs)
- self.__prepare_repository_list(silent, \
+ self.__prepare_repository_list(silent,
auth, stop_thread=stop_thread)
except RuntimeError, ex:
if not silent:
raise
- err = (self.parent._("Failed to add %s.") % auth)
+ err = (_("Failed to add %s.") % auth)
err += str(ex)
self.__error_with_reset_repo_selection(err)
return
except api_errors.PermissionsException:
if not silent:
raise
- err = (self.parent._("Failed to add %s.") % auth) + \
- self.parent._("\nPlease check your permissions.")
- self.__error_with_reset_repo_selection(err, \
+ err = (_("Failed to add %s.") % auth) + \
+ _("\nPlease check your permissions.")
+ self.__error_with_reset_repo_selection(err,
gtk.MESSAGE_INFO)
except api_errors.CatalogRefreshException:
if not silent:
raise
self.__delete_repository(auth)
- err = self.parent._("Failed to add %s.") % auth + \
- self.parent._(
+ err = _("Failed to add %s.") % auth + \
+ _(
"\nPlease check the network connection or URL.\nIs the "
"repository accessible?")
self.__error_with_reset_repo_selection(err, gtk.MESSAGE_INFO)
@@ -573,19 +569,19 @@
except RuntimeError, ex:
if not silent:
raise
- err = (self.parent._("Failed to delete %s.") % name)
+ err = (_("Failed to delete %s.") % name)
err += str(ex)
self.__error_with_reset_repo_selection(err)
return
except api_errors.PermissionsException:
if not silent:
raise
- err = (self.parent._("Failed to delete %s.") % name) + \
- self.parent._("\nPlease check your permissions.")
- self.__error_with_reset_repo_selection(err, \
+ err = (_("Failed to delete %s.") % name) + \
+ _("\nPlease check your permissions.")
+ self.__error_with_reset_repo_selection(err,
gtk.MESSAGE_INFO)
- def __error_with_reset_repo_selection(self, error_msg, \
+ def __error_with_reset_repo_selection(self, error_msg,
msg_type=gtk.MESSAGE_ERROR):
gobject.idle_add(self.__error_occured, error_msg, msg_type)
self.__reset_repo_selection()
@@ -599,11 +595,11 @@
self.__prepare_repository_list(False, sel)
def __error_occured(self, error_msg, msg_type=gtk.MESSAGE_ERROR):
- msgbox = gtk.MessageDialog(parent = \
- self.w_repository_dialog, \
- buttons = gtk.BUTTONS_CLOSE, \
- flags = gtk.DIALOG_MODAL, \
- type = msg_type, \
+ msgbox = gtk.MessageDialog(parent =
+ self.w_repository_dialog,
+ buttons = gtk.BUTTONS_CLOSE,
+ flags = gtk.DIALOG_MODAL,
+ type = msg_type,
message_format = None)
msgbox.set_markup(error_msg)
msgbox.set_title("Edit Repositories error")
--- a/src/packagemanager.py Tue Dec 23 09:31:28 2008 -0800
+++ b/src/packagemanager.py Fri Jan 02 08:08:46 2009 +0000
@@ -106,8 +106,7 @@
"/usr/share/locale")
module.textdomain("pkg")
# XXX Remove and use _() where self._ and self.parent._ are being used
- self._ = gettext.gettext
- main_window_title = self._('Package Manager')
+ main_window_title = _('Package Manager')
self.user_rights = portable.is_admin()
self.cancelled = False # For background processes
self.image_directory = None
@@ -185,9 +184,9 @@
self.w_main_clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD)
self.w_progress_dialog = w_tree_progress.get_widget("progressdialog")
- self.w_progress_dialog.set_title(self._("Update All"))
+ self.w_progress_dialog.set_title(_("Update All"))
self.w_progressinfo_label = w_tree_progress.get_widget("progressinfo")
- self.w_progressinfo_label.set_text(self._( \
+ self.w_progressinfo_label.set_text(_(
"Checking SUNWipkg and SUNWipkg-gui versions\n\nPlease wait ..."))
self.w_progressbar = w_tree_progress.get_widget("progressbar")
self.w_progressbar.set_pulse_step(0.1)
@@ -262,9 +261,9 @@
w_tree_main.signal_autoconnect(dic_mainwindow)
w_tree_progress.signal_autoconnect(dic_progress)
except AttributeError, error:
- print self._( \
- 'GUI will not respond to any event! %s.' + \
- 'Check declare_signals()') \
+ print _(
+ "GUI will not respond to any event! %s."
+ "Check declare_signals()") \
% error
self.package_selection = None
@@ -360,7 +359,7 @@
column.set_cell_data_func(render_pixbuf, self.cell_data_function, None)
self.w_application_treeview.append_column(column)
name_renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn(self._("Name"), name_renderer, \
+ column = gtk.TreeViewColumn(_("Name"), name_renderer,
text = enumerations.NAME_COLUMN)
column.set_resizable(True)
column.set_sort_column_id(enumerations.NAME_COLUMN)
@@ -368,12 +367,12 @@
column.set_cell_data_func(name_renderer, self.cell_data_function, None)
self.w_application_treeview.append_column(column)
column = gtk.TreeViewColumn()
- column.set_title(self._("Status"))
+ column.set_title(_("Status"))
#Commented, since there was funny jumping of the icons
#column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
render_pixbuf = gtk.CellRendererPixbuf()
column.pack_start(render_pixbuf, expand = True)
- column.add_attribute(render_pixbuf, "pixbuf", \
+ column.add_attribute(render_pixbuf, "pixbuf",
enumerations.STATUS_ICON_COLUMN)
column.set_fixed_width(32)
column.set_sort_column_id(enumerations.STATUS_ICON_COLUMN)
@@ -381,12 +380,12 @@
column.set_cell_data_func(render_pixbuf, self.cell_data_function, None)
self.w_application_treeview.append_column(column)
description_renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn(self._('Description'), \
+ column = gtk.TreeViewColumn(_('Description'),
description_renderer, text = enumerations.DESCRIPTION_COLUMN)
column.set_resizable(True)
column.set_sort_column_id(enumerations.DESCRIPTION_COLUMN)
column.set_sort_indicator(True)
- column.set_cell_data_func(description_renderer, \
+ column.set_cell_data_func(description_renderer,
self.cell_data_function, None)
self.w_application_treeview.append_column(column)
#Added selection listener
@@ -396,8 +395,8 @@
#enumerations.CATEGORY_NAME
category_list_filter = category_list.filter_new()
enumerations.CATEGORY_NAME_renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn(self._('Name'), \
- enumerations.CATEGORY_NAME_renderer, \
+ column = gtk.TreeViewColumn(_('Name'),
+ enumerations.CATEGORY_NAME_renderer,
text = enumerations.CATEGORY_NAME)
self.w_categories_treeview.append_column(column)
#Added selection listener
@@ -409,17 +408,17 @@
#enumerations.SECTION_NAME
cell = gtk.CellRendererText()
self.w_sections_combobox.pack_start(cell, True)
- self.w_sections_combobox.add_attribute(cell, 'text', \
+ self.w_sections_combobox.add_attribute(cell, 'text',
enumerations.SECTION_NAME)
- self.w_sections_combobox.set_row_separator_func( \
+ self.w_sections_combobox.set_row_separator_func(
self.combobox_id_separator)
##FILTER COMBOBOX
#enumerations.FILTER_NAME
cell = gtk.CellRendererText()
self.w_filter_combobox.pack_start(cell, True)
- self.w_filter_combobox.add_attribute(cell, 'text', \
+ self.w_filter_combobox.add_attribute(cell, 'text',
enumerations.FILTER_NAME)
- self.w_filter_combobox.set_row_separator_func(\
+ self.w_filter_combobox.set_row_separator_func(
self.combobox_id_separator)
##FILTER COMBOBOX
#enumerations.FILTER_NAME
@@ -478,27 +477,27 @@
def __init_sections(self):
'''This function is for initializing sections combo box, also adds "All"
Category. It sets active section combobox entry "All"'''
- self.section_list.append([0, self._('All Categories'), ])
+ self.section_list.append([0, _('All Categories'), ])
self.section_list.append([-1, "", ])
- self.section_list.append([2, self._('Meta Packages'), ])
- self.section_list.append([3, self._('Applications'), ])
- self.section_list.append([4, self._('Desktop (GNOME)'), ])
- self.section_list.append([5, self._('Development'), ])
- self.section_list.append([6, self._('Distributions'), ])
- self.section_list.append([7, self._('Drivers'), ])
- self.section_list.append([8, self._('System'), ])
- self.section_list.append([9, self._('Web Services'), ])
+ self.section_list.append([2, _('Meta Packages'), ])
+ self.section_list.append([3, _('Applications'), ])
+ self.section_list.append([4, _('Desktop (GNOME)'), ])
+ self.section_list.append([5, _('Development'), ])
+ self.section_list.append([6, _('Distributions'), ])
+ self.section_list.append([7, _('Drivers'), ])
+ self.section_list.append([8, _('System'), ])
+ self.section_list.append([9, _('Web Services'), ])
def __init_show_filter(self):
- self.filter_list.append([0, self._('All Packages'), ])
+ self.filter_list.append([0, _('All Packages'), ])
self.filter_list.append([-1, "", ])
- self.filter_list.append([2, self._('Installed Packages'), ])
- self.filter_list.append([3, self._('Updates'), ])
- self.filter_list.append([4, self._('Non-installed Packages'), ])
+ self.filter_list.append([2, _('Installed Packages'), ])
+ self.filter_list.append([3, _('Updates'), ])
+ self.filter_list.append([4, _('Non-installed Packages'), ])
self.filter_list.append([-1, "", ])
- # self.filter_list.append([self._('Locked Packages'), ])
+ # self.filter_list.append([_('Locked Packages'), ])
# self.filter_list.append(["", ])
- self.filter_list.append([6, self._('Selected Packages'), ])
+ self.filter_list.append([6, _('Selected Packages'), ])
def __on_cancel_progressdialog_clicked(self, widget):
self.progress_canceled = True
@@ -580,7 +579,7 @@
def __on_notebook_change(self, widget, event, pagenum):
if pagenum == 3:
licbuffer = self.w_license_textview.get_buffer()
- leg_txt = self._("Fetching legal information...")
+ leg_txt = _("Fetching legal information...")
licbuffer.set_text(leg_txt)
Thread(target = self.__show_package_licenses, \
args = (self.pkginfo_thread,)).start()
@@ -769,8 +768,8 @@
if opensolaris_image:
# Load the catalogs from the repository, its a long
# running tasks so need a progress dialog
- self.w_progress_dialog.set_title(self._("Update All"))
- self.w_progressinfo_label.set_text(self._( \
+ self.w_progress_dialog.set_title(_("Update All"))
+ self.w_progressinfo_label.set_text(_( \
"Checking SUNWipkg and SUNWipkg-gui versions\n" \
"\nPlease wait ..."))
Thread(target = self.__progressdialog_progress_pulse).start()
@@ -785,37 +784,37 @@
# prompt user to restart
if not self.ips_uptodate:
# Prompt user
- msgbox = gtk.MessageDialog(parent = self.w_main_window, \
- buttons = gtk.BUTTONS_YES_NO, \
- flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_QUESTION, \
- message_format = self._("Newer versions of SUNWipkg and " \
- "SUNWipkg-gui\n" + "are available and must be updated " \
- "before\nrunning Update All.\n\nDo you want to update " \
+ msgbox = gtk.MessageDialog(parent = self.w_main_window,
+ buttons = gtk.BUTTONS_YES_NO,
+ flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_QUESTION,
+ message_format = _("Newer versions of SUNWipkg and "
+ "SUNWipkg-gui\n" + "are available and must be updated "
+ "before\nrunning Update All.\n\nDo you want to update "
"them now?"))
- msgbox.set_title(self._("Update All"))
+ msgbox.set_title(_("Update All"))
result = msgbox.run()
msgbox.destroy()
if result == gtk.RESPONSE_YES:
pkg_list = [self.ipkg_fmri, self.ipkggui_fmri]
self.api_o.reset()
- installupdate.InstallUpdate(pkg_list, \
- self, self.api_o, \
- ips_update = True, \
+ installupdate.InstallUpdate(pkg_list,
+ self, self.api_o,
+ ips_update = True,
action = enumerations.INSTALL_UPDATE)
else:
- msgbox = gtk.MessageDialog(parent = self.w_main_window, \
- buttons = gtk.BUTTONS_OK, \
- flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO, \
- message_format = self._("Update All was not " \
- "run.\n\nIt can not be run until SUNWipkg and " \
+ msgbox = gtk.MessageDialog(parent = self.w_main_window,
+ buttons = gtk.BUTTONS_OK,
+ flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO,
+ message_format = _("Update All was not "
+ "run.\n\nIt can not be run until SUNWipkg and "
"SUNWipkg-gui have been updated."))
- msgbox.set_title(self._("Update All"))
+ msgbox.set_title(_("Update All"))
result = msgbox.run()
msgbox.destroy()
else:
self.api_o.reset()
- installupdate.InstallUpdate([], self, \
- self.api_o, ips_update = False, \
+ installupdate.InstallUpdate([], self,
+ self.api_o, ips_update = False,
action = enumerations.IMAGE_UPDATE)
def __on_help_about(self, widget):
@@ -840,16 +839,16 @@
pkg[enumerations.STATUS_COLUMN] == enumerations.UPDATABLE):
remove_list.append(\
pkg[enumerations.STEM_COLUMN])
- installupdate.InstallUpdate(remove_list, self, \
- self.api_o, ips_update = False, \
+ installupdate.InstallUpdate(remove_list, self,
+ self.api_o, ips_update = False,
action = enumerations.REMOVE)
def __on_reload(self, widget):
if self.description_thread_running:
self.cancelled = True
self.in_setup = True
- self.w_progress_dialog.set_title(self._("Refreshing catalogs"))
- self.w_progressinfo_label.set_text(self._("Refreshing catalogs..."))
+ self.w_progress_dialog.set_title(_("Refreshing catalogs"))
+ self.w_progressinfo_label.set_text(_("Refreshing catalogs..."))
self.progress_stop_timer_thread = False
Thread(target = self.__progressdialog_progress_pulse).start()
self.w_progress_dialog.show()
@@ -879,7 +878,7 @@
if restart_app:
if self.image_dir_arg:
- gobject.spawn_async([self.application_path, "-R", \
+ gobject.spawn_async([self.application_path, "-R",
self.image_dir_arg])
else:
gobject.spawn_async([self.application_path])
@@ -925,9 +924,9 @@
itr = filterModel.get_iter(child_path)
if itr:
modified = filterModel.get_value(itr, enumerations.MARK_COLUMN)
- filterModel.set_value(itr, enumerations.MARK_COLUMN, \
+ filterModel.set_value(itr, enumerations.MARK_COLUMN,
not modified)
- pkg_status = filterModel.get_value(itr, \
+ pkg_status = filterModel.get_value(itr,
enumerations.STATUS_COLUMN)
self.update_statusbar()
self.__update_install_update_button(pkg_status, modified)
@@ -988,7 +987,7 @@
if icon and icon != pkg:
self.w_packageicon_image.set_from_pixbuf(icon)
else:
- self.w_packageicon_image.set_from_pixbuf( \
+ self.w_packageicon_image.set_from_pixbuf(
self.__get_pixbuf_from_path("/usr/share/package-manager/", \
"PM_package_36x"))
self.w_packagename_label.set_markup("<b>" + pkg_name + "</b>")
@@ -997,14 +996,15 @@
if self.__setting_from_cache(pkg_stem):
return
- self.w_shortdescription_label.set_text( \
- self._("Fetching description..."))
+ self.w_shortdescription_label.set_text(
+ _("Fetching description..."))
instbuffer = self.w_installedfiles_textview.get_buffer()
depbuffer = self.w_dependencies_textview.get_buffer()
infobuffer = self.w_generalinfo_textview.get_buffer()
- instbuffer.set_text(self._("Fetching information..."))
- depbuffer.set_text(self._("Fetching information..."))
- infobuffer.set_text(self._("Fetching information..."))
+ fetching_text = _("Fetching information...")
+ instbuffer.set_text(fetching_text)
+ depbuffer.set_text(fetching_text)
+ infobuffer.set_text(fetching_text)
return
def __setting_from_cache(self, pkg_stem):
@@ -1012,8 +1012,8 @@
self.info_cache = {}
if self.info_cache.has_key(pkg_stem):
- self.w_shortdescription_label.set_text(\
- self.info_cache[pkg_stem][0])
+ self.w_shortdescription_label.set_text(
+ self.info_cache[pkg_stem][0])
instbuffer = self.w_installedfiles_textview.get_buffer()
depbuffer = self.w_dependencies_textview.get_buffer()
infobuffer = self.w_generalinfo_textview.get_buffer()
@@ -1030,7 +1030,7 @@
if icon and icon != pkg:
self.w_packageicon_image.set_from_pixbuf(icon)
else:
- self.w_packageicon_image.set_from_pixbuf( \
+ self.w_packageicon_image.set_from_pixbuf(
self.__get_pixbuf_from_path("/usr/share/package-manager/", \
"PM_package_36x"))
self.w_packagename_label.set_markup("<b>" + pkg_name + "</b>")
@@ -1043,27 +1043,27 @@
infobuffer = self.w_generalinfo_textview.get_buffer()
if not pkg_info:
- self.w_shortdescription_label.set_text( \
- self._("Description not available for this package..."))
+ self.w_shortdescription_label.set_text(
+ _("Description not available for this package..."))
instbuffer.set_text( \
- self._("Files Details not available for this package..."))
- depbuffer.set_text(self._( \
+ _("Files Details not available for this package..."))
+ depbuffer.set_text(_(
"Dependencies info not available for this package..."))
- infobuffer.set_text( \
- self._("Information not available for this package..."))
+ infobuffer.set_text(
+ _("Information not available for this package..."))
return
description = pkg_info.summary
#XXX long term need to have something more robust here for multi byte
if len(description) > MAX_DESC_LEN:
description = description[:MAX_DESC_LEN] + " ..."
self.w_shortdescription_label.set_text(description)
- inst_str = self._("Root: %s\n") % self.api_o.img.get_root()
- dep_str = self._("Dependencies:\n")
+ inst_str = _("Root: %s\n") % self.api_o.img.get_root()
+ dep_str = _("Dependencies:\n")
if installed:
- info_str = self._("Information for installed package:\n\n")
+ info_str = _("Information for installed package:\n\n")
else:
- info_str = self._("Information for latest available package:\n\n")
+ info_str = _("Information for latest available package:\n\n")
#Name: SUNWckr
#FMRI: pkg://opensolaris.org/[email protected],5.11-0.75:20071114T203148Z
#Version: 0.5.11
@@ -1084,12 +1084,12 @@
inst_str += ''.join(["\t%s\n" % x for x in pkg_info.links])
if description:
- info_str += self._(" Description:\t%s\n") % description
- info_str += self._(" Name:\t\t%s\n") % pkg_name
- info_str += self._(" FMRI:\t\t%s\n") % pkg.get_fmri()
- info_str += self._(" Version:\t\t%s\n") % \
+ info_str += _(" Description:\t%s\n") % description
+ info_str += _(" Name:\t\t%s\n") % pkg_name
+ info_str += _(" FMRI:\t\t%s\n") % pkg.get_fmri()
+ info_str += _(" Version:\t\t%s\n") % \
pkg.version.get_short_version()
- info_str += self._(" Packaged:\t%s\n") % \
+ info_str += _(" Packaged:\t%s\n") % \
self.get_datetime(pkg.version)
infobuffer.set_text(info_str)
@@ -1097,13 +1097,13 @@
depbuffer.set_text(dep_str)
self.info_cache[pkg_stem] = \
- (description, info_str, inst_str, dep_str)
+ (description, info_str, inst_str, dep_str)
def __update_package_license(self, licenses):
lic = ""
lic_u = ""
if licenses == None:
- lic_u = self._("Not available")
+ lic_u = _("Not available")
else:
for licens in licenses:
lic += licens.get_text()
@@ -1123,8 +1123,7 @@
if th_no != self.pkginfo_thread:
return
if self.selected_pkgname == None:
- gobject.idle_add(self.__update_package_license, \
- None)
+ gobject.idle_add(self.__update_package_license, None)
return
info = self.api_o.info([self.selected_pkgname], True, True)
pkgs_info = None
@@ -1137,18 +1136,17 @@
if package_info:
no_licenses = len(package_info.licenses)
if no_licenses == 0:
- gobject.idle_add(self.__update_package_license, \
- None)
+ gobject.idle_add(self.__update_package_license, None)
return
if th_no == self.pkginfo_thread:
- gobject.idle_add(self.__update_package_license, \
+ gobject.idle_add(self.__update_package_license,
package_info.licenses)
else:
return
def __get_pkg_info(self, pkg_name, installed):
- info = self.api_o.info([pkg_name], installed, get_licenses=False, \
- get_action_info=True)
+ info = self.api_o.info([pkg_name], installed, get_licenses=False,
+ get_action_info=True)
pkgs_info = None
package_info = None
if info:
@@ -1166,8 +1164,7 @@
status = model.get_value(itr, enumerations.STATUS_COLUMN)
if status == enumerations.UPDATABLE or status == enumerations.INSTALLED:
installed = True
- gobject.idle_add( \
- self.__show_fetching_package_info, pkg, pkg)
+ gobject.idle_add(self.__show_fetching_package_info, pkg, pkg)
if self.info_cache.has_key(pkg.get_pkg_stem()):
return
@@ -1183,24 +1180,23 @@
pkg_info = self.__get_pkg_info(pkg.get_name(), installed)
if th_no == self.pkginfo_thread:
if not pkg:
- gobject.idle_add(self.__update_package_info, pkg, pkg, \
+ gobject.idle_add(self.__update_package_info, pkg, pkg,
installed, pkg_info)
else:
- gobject.idle_add(self.__update_package_info, pkg, pkg, \
+ gobject.idle_add(self.__update_package_info, pkg, pkg,
installed, pkg_info)
- img.history.operation_result = \
- history.RESULT_SUCCEEDED
+ img.history.operation_result = history.RESULT_SUCCEEDED
else:
- img.history.operation_result = \
- history.RESULT_SUCCEEDED
+ img.history.operation_result = history.RESULT_SUCCEEDED
return
# This function is ported from pkg.actions.generic.distinguished_name()
- def __locale_distinguished_name(self, action):
+ @staticmethod
+ def __locale_distinguished_name(action):
if action.key_attr == None:
return str(action)
return "%s: %s" % \
- (self._(action.name), action.attrs.get(action.key_attr, "???"))
+ (_(action.name), action.attrs.get(action.key_attr, "???"))
def __application_filter(self, model, itr):
'''This function is used to filter content in the main
@@ -1217,7 +1213,7 @@
if category_iter:
selected_category = category_model.get_value(category_iter, \
enumerations.CATEGORY_ID)
- category_list_iter = model.get_value(itr, \
+ category_list_iter = model.get_value(itr,
enumerations.CATEGORY_LIST_COLUMN)
category = False
repo = self.__is_pkg_repository_visible(model, itr)
@@ -1288,8 +1284,7 @@
auth_iter = self.w_repository_combobox.get_active_iter()
authority = self.repositories_list.get_value(auth_iter, \
enumerations.REPOSITORY_NAME)
- pkg = model.get_value(itr, \
- enumerations.FMRI_COLUMN)
+ pkg = model.get_value(itr, enumerations.FMRI_COLUMN)
if not pkg:
return False
if cmp(pkg.get_authority(), authority) == 0:
@@ -1389,7 +1384,7 @@
if self.application_list.get_value(row.iter,
enumerations.STATUS_COLUMN) == \
enumerations.UPDATABLE and self.user_rights:
- update_available = True
+ update_available = True
break
self.w_updateall_button.set_sensitive(update_available)
self.w_updateall_menuitem.set_sensitive(update_available)
@@ -1423,10 +1418,10 @@
except api_errors.CatalogRefreshException, cre:
total = cre.total
succeeded = cre.succeeded
- ermsg = self._("Network problem.\n\n")
- ermsg += self._("Details:\n")
+ ermsg = _("Network problem.\n\n")
+ ermsg += _("Details:\n")
ermsg += "%s/%s" % (succeeded, total)
- ermsg += self._(" catalogs successfully updated:\n")
+ ermsg += _(" catalogs successfully updated:\n")
for auth, err in cre.failed:
if isinstance(err, HTTPError):
ermsg += " %s: %s - %s\n" % \
@@ -1449,10 +1444,10 @@
elif "data" in err.__dict__ and err.data:
ermsg += err.data
else:
- ermsg += self._("Unknown error")
+ ermsg += _("Unknown error")
ermsg += "\n"
- gobject.idle_add(self.error_occured, ermsg, \
+ gobject.idle_add(self.error_occured, ermsg,
None, gtk.MESSAGE_INFO)
self.__catalog_refresh_done()
return -1
@@ -1480,7 +1475,7 @@
except api_errors.InventoryException:
# Can't happen when all_known is true and no args,
# but here for completeness.
- err = self._("Error occured while getting list of packages")
+ err = _("Error occured while getting list of packages")
gobject.idle_add(self.w_progress_dialog.hide)
gobject.idle_add(self.error_occured, err)
return
@@ -1563,14 +1558,14 @@
pkg_categories = categories[cat][pkg_name]
for pcat in pkg_categories.split(","):
if pcat:
- apc(self._(pcat), None,
+ apc(_(pcat), None,
None, row_iter,
app_ls, category_list)
for authority in sections:
for section in sections[authority]:
for category in sections[authority][section].split(","):
- self.__add_category_to_section(self._(category),
- self._(section), category_list)
+ self.__add_category_to_section(_(category),
+ _(section), category_list)
#1915 Sort the Categories into alphabetical order and prepend All Category
if len(category_list) > 0:
@@ -1578,7 +1573,7 @@
rows.sort(self.__sort)
r = []
category_list.reorder([r[-1] for r in rows])
- category_list.prepend([0, self._('All'), None, None, True, None])
+ category_list.prepend([0, _('All'), None, None, True, None])
progressdialog_progress(PACKAGE_PROGRESS_PERCENT_TOTAL, total_pkg_count,
total_pkg_count)
@@ -1586,15 +1581,16 @@
application_list, category_list, repositories_list)
return
- def __add_package_to_category(self, category_name, category_description, \
+ @staticmethod
+ def __add_package_to_category(category_name, category_description,
category_icon, package, application_list, category_list):
- if not package or category_name == self._('All'):
+ if not package or category_name == _('All'):
return
if not category_name:
return
# XXX check if needed
- # category_name = self._('All')
- # category_description = self._('All packages')
+ # category_name = _('All')
+ # category_description = _('All packages')
# category_icon = None
category_ref = None
for category in category_list:
@@ -1605,15 +1601,15 @@
category_list)+1, category_name, category_description, \
category_icon, True, None])
if category_ref:
- if application_list.get_value(package, \
+ if application_list.get_value(package,
enumerations.CATEGORY_LIST_COLUMN):
- a = application_list.get_value(package, \
+ a = application_list.get_value(package,
enumerations.CATEGORY_LIST_COLUMN)
a.append(category_ref)
else:
category_list = []
category_list.append(category_ref)
- application_list.set(package, \
+ application_list.set(package,
enumerations.CATEGORY_LIST_COLUMN, category_list)
def __add_category_to_section(self, category_name, section_name, category_list):
@@ -1656,16 +1652,16 @@
if not png_exists and not svg_exists:
return None
try:
- return gtk.gdk.pixbuf_new_from_file( \
+ return gtk.gdk.pixbuf_new_from_file(
self.application_dir + path + icon + ".png")
except gobject.GError:
try:
- return gtk.gdk.pixbuf_new_from_file( \
+ return gtk.gdk.pixbuf_new_from_file(
self.application_dir + path + icon + ".svg")
except gobject.GError:
iconview = gtk.IconView()
- icon = iconview.render_icon(getattr(gtk, \
- "STOCK_MISSING_IMAGE"), \
+ icon = iconview.render_icon(getattr(gtk,
+ "STOCK_MISSING_IMAGE"),
size = gtk.ICON_SIZE_MENU,
detail = None)
# XXX Could return image-we don't want to show ugly icon.
@@ -1685,8 +1681,8 @@
self.progress_fraction_time_count <= \
INITIAL_PROGRESS_TOTAL_PERCENTAGE:
- gobject.idle_add(self.w_progressbar.set_fraction, \
- self.progress_fraction_time_count)
+ gobject.idle_add(self.w_progressbar.set_fraction,
+ self.progress_fraction_time_count)
self.progress_fraction_time_count += \
INITIAL_PROGRESS_TIME_PERCENTAGE
time.sleep(INITIAL_PROGRESS_TIME_INTERVAL)
@@ -1694,23 +1690,23 @@
self.progress_fraction_time_count = 0
def __progressdialog_progress_percent(self, fraction, count, total):
- gobject.idle_add(self.w_progressinfo_label.set_text, self._( \
+ gobject.idle_add(self.w_progressinfo_label.set_text, _(
"Processing package entries: %d of %d") % (count, total) )
gobject.idle_add(self.w_progressbar.set_fraction, fraction)
def error_occured(self, error_msg, msg_title=None, msg_type=gtk.MESSAGE_ERROR):
- msgbox = gtk.MessageDialog(parent = \
- self.w_main_window, \
- buttons = gtk.BUTTONS_CLOSE, \
- flags = gtk.DIALOG_MODAL, \
- type = msg_type, \
+ msgbox = gtk.MessageDialog(parent =
+ self.w_main_window,
+ buttons = gtk.BUTTONS_CLOSE,
+ flags = gtk.DIALOG_MODAL,
+ type = msg_type,
message_format = None)
msgbox.set_markup(error_msg)
title = None
if msg_title:
title = msg_title
else:
- title = self._("Package Manager")
+ title = _("Package Manager")
msgbox.set_title(title)
msgbox.run()
msgbox.destroy()
@@ -1719,9 +1715,9 @@
# Static Methods
#-----------------------------------------------------------------------------#
- @staticmethod
- def N_(message):
- return message
+ #@staticmethod
+ #def N_(message):
+ # return message
@staticmethod
def __sort(a, b):
@@ -1806,9 +1802,9 @@
# Public Methods
#-----------------------------------------------------------------------------#
def setup_progressdialog_show(self):
- self.w_progress_dialog.set_title(self._("Loading Repository Information"))
+ self.w_progress_dialog.set_title(_("Loading Repository Information"))
self.w_progressinfo_label.set_text(
- self._( "Fetching package entries ..."))
+ _( "Fetching package entries ..."))
self.w_progress_cancel.hide()
self.w_progress_dialog.show()
Thread(target = self.__progressdialog_progress_time).start()
@@ -1841,21 +1837,21 @@
self.api_o = api_o
# Acquire image contents and update progress bar as you do so.
Thread(target = self.__get_image_from_directory, args = (api_o,
- self.__progressdialog_progress_percent)).start()
+ self.__progressdialog_progress_percent)).start()
@staticmethod
def __get_api_object(img_dir, progtrack):
api_o = None
try:
- api_o = api.ImageInterface(img_dir, \
- CLIENT_API_VERSION, \
+ api_o = api.ImageInterface(img_dir,
+ CLIENT_API_VERSION,
progtrack, None, PKG_CLIENT_NAME)
except (api_errors.VersionException,\
api_errors.ImageNotFoundException):
raise
return api_o
- def process_package_list_end(self, api_o, application_list, \
+ def process_package_list_end(self, api_o, application_list,
category_list, repositories_list):
self.__init_tree_views(application_list, category_list, repositories_list)
self.update_statusbar()
@@ -1866,8 +1862,8 @@
gtk.main_iteration(False)
self.w_categories_treeview.expand_all()
self.w_categories_treeview.grab_focus()
- self.w_categories_treeview.set_cursor(0, \
- None, start_editing=False)
+ self.w_categories_treeview.set_cursor(0,
+ None, start_editing=False)
self.w_application_treeview.expand_all()
while gtk.events_pending():
gtk.main_iteration(False)
@@ -1922,10 +1918,10 @@
installed = installed + 1
if pkg_row[enumerations.MARK_COLUMN]:
selected = selected + 1
- listed_str = self._('%d packages listed') % len(self.application_list)
- inst_str = self._('%d installed') % installed
- sel_str = self._('%d selected') % selected
- broken_str = self._('%d broken') % broken
+ listed_str = _('%d packages listed') % len(self.application_list)
+ inst_str = _('%d installed') % installed
+ sel_str = _('%d selected') % selected
+ broken_str = _('%d broken') % broken
self.w_main_statusbar.push(0, listed_str + ', ' + inst_str + ', ' + \
sel_str + ', ' + broken_str + '.')
@@ -1965,28 +1961,28 @@
# 2790: As IPS and IPS-GUI have been updated the IPS GUI must be shutdown
# and restarted
- msgbox = gtk.MessageDialog(parent = self.w_main_window, \
- buttons = gtk.BUTTONS_OK, \
- flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO, \
- message_format = self._("SUNWipkg and SUNWipkg-gui have been " \
- "updated and Package Manager will now be restarted.\n\nAfter " \
+ msgbox = gtk.MessageDialog(parent = self.w_main_window,
+ buttons = gtk.BUTTONS_OK,
+ flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO,
+ message_format = _("SUNWipkg and SUNWipkg-gui have been "
+ "updated and Package Manager will now be restarted.\n\nAfter "
"restart select Update All to continue."))
- msgbox.set_title(self._("Update All"))
+ msgbox.set_title(_("Update All"))
msgbox.run()
msgbox.destroy()
self.__main_application_quit(restart_app = True)
def shutdown_after_image_update(self):
- msgbox = gtk.MessageDialog(parent = self.w_main_window, \
- buttons = gtk.BUTTONS_OK, \
- flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO, \
- message_format = self._("Update All has completed and Package " \
- "Manager will now exit.\n\nPlease reboot after reviewing the " \
- "release notes posted at:\n\n" \
- "http://opensolaris.org/os/project/indiana/resources/" \
+ msgbox = gtk.MessageDialog(parent = self.w_main_window,
+ buttons = gtk.BUTTONS_OK,
+ flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_INFO,
+ message_format = _("Update All has completed and Package " \
+ "Manager will now exit.\n\nPlease reboot after reviewing the "
+ "release notes posted at:\n\n"
+ "http://opensolaris.org/os/project/indiana/resources/"
"relnotes/200811/x86/"))
- msgbox.set_title(self._("Update All"))
+ msgbox.set_title(_("Update All"))
msgbox.run()
msgbox.destroy()
self.__main_application_quit()
@@ -2007,7 +2003,7 @@
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", \
+ self.get_icon_pixbuf(_('All')), "acc_gam", \
"2.3", None, "2.8", \
4, "desc7", "Object Name2", None, True, None]
app3 = [False, self.get_icon_pixbuf("None"), \
@@ -2025,21 +2021,21 @@
itr4 = self.application_list.append(app4)
itr5 = self.application_list.append(app5)
# self.__add_package_to_category(_("All"),None,None,None);
- self.__add_package_to_category(self._("Accessories"), \
+ self.__add_package_to_category(_("Accessories"), \
None, None, itr1, self.application_list, self.category_list)
- self.__add_package_to_category(self._("Accessories"), None, None, itr2, \
+ self.__add_package_to_category(_("Accessories"), None, None, itr2,
self.application_list, self.category_list)
- self.__add_package_to_category(self._("Games"), None, None, itr3, \
+ self.__add_package_to_category(_("Games"), None, None, itr3,
self.application_list, self.category_list)
- self.__add_package_to_category(self._("Graphics"), None, None, itr3, \
+ self.__add_package_to_category(_("Graphics"), None, None, itr3,
self.application_list, self.category_list)
- self.__add_package_to_category(self._("Games"), None, None, itr2, \
+ self.__add_package_to_category(_("Games"), None, None, itr2,
self.application_list, self.category_list)
- self.__add_package_to_category(self._("Graphics"), None, None, itr4, \
+ self.__add_package_to_category(_("Graphics"), None, None, itr4,
self.application_list, self.category_list)
- self.__add_package_to_category(self._("Games"), None, None, itr4, \
+ self.__add_package_to_category(_("Games"), None, None, itr4,
self.application_list, self.category_list)
- self.__add_package_to_category(self._("Graphics"), None, None, itr5, \
+ self.__add_package_to_category(_("Graphics"), None, None, itr5,
self.application_list, self.category_list)
# Category names until xdg is imported.
@@ -2049,39 +2045,39 @@
# for root, dirs, files in os.walk (directory):
# for name in files:
# entry.parse (os.path.join (root, name))
- # self.__add_category_to_section (entry.getName (), \
- # self._('Applications Desktop'))
+ # self.__add_category_to_section (entry.getName (),
+ # _('Applications Desktop'))
- self.__add_category_to_section(self._("Accessories"), \
- self._('Applications Desktop'), self.category_list)
- self.__add_category_to_section(self._("Games"), \
- self._('Applications Desktop'), self.category_list)
- self.__add_category_to_section(self._("Graphics"), \
- self._('Applications Desktop'), self.category_list)
- self.__add_category_to_section(self._("Internet"), \
- self._('Applications Desktop'), self.category_list)
- self.__add_category_to_section(self._("Office"), \
- self._('Applications Desktop'), self.category_list)
- self.__add_category_to_section(self._("Sound & Video"), \
- self._('Applications Desktop'), self.category_list)
- self.__add_category_to_section(self._("System Tools"), \
- self._('Applications Desktop'), self.category_list)
- self.__add_category_to_section(self._("Universal Access"), \
- self._('Applications Desktop'), self.category_list)
- self.__add_category_to_section(self._("Developer Tools"), \
- self._('Applications Desktop'), self.category_list)
- self.__add_category_to_section(self._("Core"), \
- self._('Operating System'), self.category_list)
- self.__add_category_to_section(self._("Graphics"), \
- self._('Operating System'), self.category_list)
- self.__add_category_to_section(self._("Media"), \
- self._('Operating System'), self.category_list)
+ self.__add_category_to_section(_("Accessories"),
+ _('Applications Desktop'), self.category_list)
+ self.__add_category_to_section(_("Games"),
+ _('Applications Desktop'), self.category_list)
+ self.__add_category_to_section(_("Graphics"),
+ _('Applications Desktop'), self.category_list)
+ self.__add_category_to_section(_("Internet"),
+ _('Applications Desktop'), self.category_list)
+ self.__add_category_to_section(_("Office"),
+ _('Applications Desktop'), self.category_list)
+ self.__add_category_to_section(_("Sound & Video"),
+ _('Applications Desktop'), self.category_list)
+ self.__add_category_to_section(_("System Tools"),
+ _('Applications Desktop'), self.category_list)
+ self.__add_category_to_section(_("Universal Access"),
+ _('Applications Desktop'), self.category_list)
+ self.__add_category_to_section(_("Developer Tools"),
+ _('Applications Desktop'), self.category_list)
+ self.__add_category_to_section(_("Core"),
+ _('Operating System'), self.category_list)
+ self.__add_category_to_section(_("Graphics"),
+ _('Operating System'), self.category_list)
+ self.__add_category_to_section(_("Media"),
+ _('Operating System'), self.category_list)
#Can be twice :)
- self.__add_category_to_section(self._("Developer Tools"), \
- self._('Operating System'), self.category_list)
- self.__add_category_to_section(self._("Office"), "Progs", \
+ self.__add_category_to_section(_("Developer Tools"),
+ _('Operating System'), self.category_list)
+ self.__add_category_to_section(_("Office"), "Progs",
self.category_list)
- self.__add_category_to_section(self._("Office2"), "Progs", \
+ self.__add_category_to_section(_("Office2"), "Progs",
self.category_list)
self.__setup_repositories_combobox(self.api_o)
self.in_setup = False
--- a/src/tests/gui_pylintrc Tue Dec 23 09:31:28 2008 -0800
+++ b/src/tests/gui_pylintrc Fri Jan 02 08:08:46 2009 +0000
@@ -108,7 +108,11 @@
[VARIABLES]
-[CLASSES]
+# In this case we define '_' (the function name for gettext) so that pylint
+# doesn't complain about things like _("this is i18n string")
+additional-builtins=_
+
+[CLASSES]
[DESIGN]
--- a/src/updatemanager.py Tue Dec 23 09:31:28 2008 -0800
+++ b/src/updatemanager.py Fri Jan 02 08:08:46 2009 +0000
@@ -100,7 +100,6 @@
def __init__(self, parent):
progress.ProgressTracker.__init__(self)
self.parent = parent
- self._ = gettext.gettext
self.act_started = False
self.ind_started = False
@@ -116,14 +115,14 @@
self.dl_started = False
def cat_output_start(self):
- catstr = self._("Fetching catalog: '%s' ..." % (self.cat_cur_catalog))
+ catstr = _("Fetching catalog: '%s' ..." % (self.cat_cur_catalog))
gobject.idle_add(self.parent.output, "%s" % catstr)
def cat_output_done(self):
- gobject.idle_add(self.parent.output_done, self._("Fetching catalog"))
+ gobject.idle_add(self.parent.output_done, _("Fetching catalog"))
def eval_output_start(self):
- s = self._("Creating Plan ... ")
+ s = _("Creating Plan ... ")
gobject.idle_add(self.parent.output, "%s" % s)
def eval_output_progress(self):
@@ -134,7 +133,7 @@
gobject.idle_add(self.parent.progress_pulse)
def eval_output_done(self):
- gobject.idle_add(self.parent.output_done, self._("Creating Plan"))
+ gobject.idle_add(self.parent.output_done, _("Creating Plan"))
self.last_print_time = 0
def ver_output(self):
@@ -145,14 +144,14 @@
return
gobject.idle_add(self.parent.progress_pulse)
gobject.idle_add(self.parent.output,
- self._("Verifying: %s ...") %
+ _("Verifying: %s ...") %
self.ver_cur_fmri.get_pkg_stem())
else:
gobject.idle_add(self.parent.output, "")
self.last_print_time = 0
def ver_output_error(self, actname, errors):
- gobject.idle_add(self.parent.output_done, self._("Verifying"))
+ gobject.idle_add(self.parent.output_done, _("Verifying"))
def dl_output(self):
gobject.idle_add(self.parent.dl_progress,
@@ -166,9 +165,9 @@
self.dl_started = True
def dl_output_done(self):
- self.dl_cur_pkg = self._("Completed")
+ self.dl_cur_pkg = _("Completed")
self.dl_output()
- gobject.idle_add(self.parent.output_done, self._("Download"))
+ gobject.idle_add(self.parent.output_done, _("Download"))
def act_output(self):
if (time.time() - self.last_print_time) >= 0.05:
@@ -184,7 +183,7 @@
def act_output_done(self):
self.act_output()
- gobject.idle_add(self.parent.output_done, self._("Install"))
+ gobject.idle_add(self.parent.output_done, _("Install"))
def ind_output(self):
if (time.time() - self.last_print_time) >= IND_DELAY:
@@ -200,7 +199,7 @@
def ind_output_done(self):
self.act_output()
- gobject.idle_add(self.parent.output_done, self._("Index"))
+ gobject.idle_add(self.parent.output_done, _("Index"))
class Updatemanager:
@@ -217,8 +216,6 @@
"/usr/share/locale")
module.textdomain("pkg")
# XXX Remove and use _() where self._ and self.parent._ are being used
- self._ = gettext.gettext
-
# Duplicate ListStore setup in get_updates_to_list()
self.um_list = \
gtk.ListStore(
@@ -369,9 +366,8 @@
w_xmltree_ua.signal_autoconnect(dic_ua)
except AttributeError, error:
- print self._('GUI will not respond to any event! %s. \
- Check updatemanager.py signals') \
- % error
+ print _("GUI will not respond to any event! %s. "
+ "Check updatemanager.py signals") % error
self.pr = GUIProgressTracker(self)
self.api_obj = None
@@ -408,64 +404,64 @@
def __progress_steps_start(self):
self.__progress_steps(
- UPDATE_ACTIVE, self._("Evaluate"),
- UPDATE_INACTIVE, self._("Download"),
- UPDATE_INACTIVE, self._("Install"),
- UPDATE_INACTIVE, self._("Index"))
+ UPDATE_ACTIVE, _("Evaluate"),
+ UPDATE_INACTIVE, _("Download"),
+ UPDATE_INACTIVE, _("Install"),
+ UPDATE_INACTIVE, _("Index"))
def __progress_steps_download(self):
self.__progress_steps(
- UPDATE_DONE, self._("Evaluate"),
- UPDATE_ACTIVE, self._("Download"),
- UPDATE_INACTIVE, self._("Install"),
- UPDATE_INACTIVE, self._("Index"))
+ UPDATE_DONE, _("Evaluate"),
+ UPDATE_ACTIVE, _("Download"),
+ UPDATE_INACTIVE, _("Install"),
+ UPDATE_INACTIVE, _("Index"))
def __progress_steps_install(self):
self.__progress_steps(
- UPDATE_DONE, self._("Evaluate"),
- UPDATE_DONE, self._("Download"),
- UPDATE_ACTIVE, self._("Install"),
- UPDATE_INACTIVE, self._("Index"))
+ UPDATE_DONE, _("Evaluate"),
+ UPDATE_DONE, _("Download"),
+ UPDATE_ACTIVE, _("Install"),
+ UPDATE_INACTIVE, _("Index"))
def __progress_steps_index(self):
self.__progress_steps(
- UPDATE_DONE, self._("Evaluate"),
- UPDATE_DONE, self._("Download"),
- UPDATE_DONE, self._("Install"),
- UPDATE_ACTIVE, self._("Index"))
+ UPDATE_DONE, _("Evaluate"),
+ UPDATE_DONE, _("Download"),
+ UPDATE_DONE, _("Install"),
+ UPDATE_ACTIVE, _("Index"))
def __progress_steps_done(self):
self.__progress_steps(
- UPDATE_DONE, self._("Evaluate"),
- UPDATE_DONE, self._("Download"),
- UPDATE_DONE, self._("Install"),
- UPDATE_DONE, self._("Index"))
+ UPDATE_DONE, _("Evaluate"),
+ UPDATE_DONE, _("Download"),
+ UPDATE_DONE, _("Install"),
+ UPDATE_DONE, _("Index"))
def __progress_cancel_eval(self):
self.__progress_cancel_step(self.w_progress_eval_img,
- self.w_progress_eval_label, self._("Evaluate - canceling..."))
+ self.w_progress_eval_label, _("Evaluate - canceling..."))
def __progress_cancel_download(self):
self.__progress_cancel_step(self.w_progress_download_img,
- self.w_progress_download_label, self._("Download - canceling..."))
+ self.w_progress_download_label, _("Download - canceling..."))
def __progress_error_eval(self):
self.__progress_error_step(self.w_progress_eval_img,
- self.w_progress_eval_label, self._("Evaluate - failed"))
+ self.w_progress_eval_label, _("Evaluate - failed"))
def __progress_error_download(self):
self.__progress_error_step(self.w_progress_download_img,
- self.w_progress_download_label, self._("Download - failed"))
+ self.w_progress_download_label, _("Download - failed"))
def __progress_error_install(self):
self.__progress_error_step(self.w_progress_install_img,
- self.w_progress_install_label, self._("Install - failed"))
+ self.w_progress_install_label, _("Install - failed"))
def __progress_error_index(self):
self.__progress_error_step(self.w_progress_index_img,
- self.w_progress_index_label, self._("Index - failed"))
+ self.w_progress_index_label, _("Index - failed"))
@staticmethod
def __progress_active_step(widget_image, widget_label, str_step):
@@ -602,14 +598,14 @@
self.w_select_checkbox.show()
self.w_um_install_button.show()
self.w_um_treeview.append_column(column)
- self.w_um_intro_label.set_text(self._(
- "Updates are available for the following packages.\n"
- "Select the packages you want to update and click Install."))
+ self.w_um_intro_label.set_text(_(
+ "Updates are available for the following packages.\n"
+ "Select the packages you want to update and click Install."))
# Show Cancel, Update All only
else:
self.w_select_checkbox.hide()
self.w_um_install_button.hide()
- self.w_um_intro_label.set_text(self._(
+ self.w_um_intro_label.set_text(_(
"Updates are available for the following packages.\n"
"Click Update All to create a new boot environment and "
"install all packages into it."))
@@ -623,7 +619,7 @@
#self.w_um_treeview.append_column(column)
name_renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn(self._("Name"), name_renderer,
+ column = gtk.TreeViewColumn(_("Name"), name_renderer,
text = UM_NAME)
column.set_cell_data_func(name_renderer, self.__cell_data_function, None)
column.set_expand(True)
@@ -638,7 +634,7 @@
version_renderer = gtk.CellRendererText()
version_renderer.set_property('xalign', 0.0)
- column = gtk.TreeViewColumn(self._("Latest Version"), version_renderer,
+ column = gtk.TreeViewColumn(_("Latest Version"), version_renderer,
text = UM_LATEST_VER)
column.set_cell_data_func(version_renderer,
self.__cell_data_function, None)
@@ -647,7 +643,7 @@
size_renderer = gtk.CellRendererText()
size_renderer.set_property('xalign', 0.0)
- column = gtk.TreeViewColumn(self._("Size (Meg)"), size_renderer,
+ column = gtk.TreeViewColumn(_("Size (Meg)"), size_renderer,
text = UM_SIZE)
column.set_cell_data_func(size_renderer, self.__cell_data_function, None)
column.set_expand(True)
@@ -719,7 +715,7 @@
# incorporated, could then indicate this to user
# and take action when doing install to run image-update.
#if state["incorporated"]:
- # incState = self._("Inc")
+ # incState = _("Inc")
#else:
# incState = "--"
@@ -728,7 +724,7 @@
pkg.get_fmri()])
if debug:
- print self._("count: %d") % count
+ print _("count: %d") % count
self.progress_stop_thread = True
gobject.idle_add(self.w_um_treeview.set_model, um_list)
@@ -757,20 +753,20 @@
infobuffer = self.w_um_textview.get_buffer()
infobuffer.set_text("")
textiter = infobuffer.get_end_iter()
- infobuffer.insert_with_tags_by_name(textiter, self._("Error\n"),
+ infobuffer.insert_with_tags_by_name(textiter, _("Error\n"),
"bold")
infobuffer.insert(textiter,
- self._("'%s' is not an install image\n") %
+ _("'%s' is not an install image\n") %
ine.user_specified)
except api_errors.VersionException, ve:
self.w_um_expander.set_expanded(True)
infobuffer = self.w_um_textview.get_buffer()
infobuffer.set_text("")
textiter = infobuffer.get_end_iter()
- infobuffer.insert_with_tags_by_name(textiter, self._("Error\n"),
+ infobuffer.insert_with_tags_by_name(textiter, _("Error\n"),
"bold")
infobuffer.insert(textiter,
- self._("Version mismatch: expected %s received %s\n") %
+ _("Version mismatch: expected %s received %s\n") %
(ve.expected_version, ve.received_version))
return None
@@ -781,7 +777,7 @@
infobuffer = self.w_um_textview.get_buffer()
textiter = infobuffer.get_end_iter()
infobuffer.insert_with_tags_by_name(textiter,
- "\nNo Updates available", "bold")
+ _("\nNo Updates available"), "bold")
self.w_um_install_button.set_sensitive(False)
self.w_um_updateall_button.set_sensitive(False)
@@ -815,7 +811,7 @@
def __update_details_from_info(self, name, info):
ver = "%s-%s" % (info.version, info.branch)
- str_details = self._(
+ str_details = _(
'\nDescription:\t\t%s\nFMRI: \t\t\t%s' +
'\nVersion: \t\t%s\nPackaged on:\t\t%s' +
'\nSize: \t\t\t%s\n') \
@@ -839,7 +835,7 @@
while gtk.events_pending():
gtk.main_iteration(False)
except ValueError:
- print self._('%s is not valid image, trying root image') \
+ print _('%s is not valid image, trying root image') \
% image_directory
try:
dr = os.environ["PKG_IMAGE"]
@@ -849,7 +845,7 @@
image_obj.find_root(dr)
image_obj.load_config()
except ValueError:
- print self._('%s is not valid root image, return None') \
+ print _('%s is not valid root image, return None') \
% dr
image_obj = None
return image_obj
@@ -887,7 +883,7 @@
else:
infobuffer = self.w_um_textview.get_buffer()
infobuffer.set_text(
- self._("\nFetching details for %s ...") % fmri)
+ _("\nFetching details for %s ...") % fmri)
self.selection_timer = Timer(SELECTION_CHANGE_LIMIT,
self.__show_package_info_thread,
args=(fmri, )).start()
@@ -910,7 +906,7 @@
infobuffer.set_text("")
textiter = infobuffer.get_end_iter()
infobuffer.insert_with_tags_by_name(textiter,
- "\nNo details available", "bold")
+ _("\nNo details available"), "bold")
def __on_um_dialog_close(self, widget):
self.__exit_app()
@@ -940,15 +936,15 @@
self.__progress_cancel_download()
self.__update_progress_info(
- self._("\nCanceling update, please wait ..."))
+ _("\nCanceling update, please wait ..."))
self.w_progress_cancel.set_sensitive(False)
Thread(target = self.api_obj.cancel).start()
else:
self.__update_progress_info(
- self._("\nUnable to cancel at this time."))
+ _("\nUnable to cancel at this time."))
def __on_install_button_clicked(self, widget):
- self.setup_progressdialog_show(self._("Installing Updates"),
+ self.setup_progressdialog_show(_("Installing Updates"),
showCancel = True, showOK = True,
isInstall = True, showCloseOnFinish = debug)
Thread(target = self.__install).start()
@@ -960,7 +956,7 @@
def __on_ua_proceed_button_clicked(self, widget):
self.w_ua_confirm_dialog.hide()
self.ua_start = time.time()
- self.setup_progressdialog_show(self._("Update All"),
+ self.setup_progressdialog_show(_("Update All"),
showCancel = True, showOK = True,
isInstall = True, showCloseOnFinish = debug)
@@ -980,13 +976,13 @@
self.__selectall_toggle(widget.get_active())
def __handle_incorporated_error(self, list_incorp):
- self.__update_progress_info(self._("ERROR"), True)
+ self.__update_progress_info(_("ERROR"), True)
self.__update_progress_info(
- self._("Following Incorporated package(s) cannot be updated:"))
+ _("Following Incorporated package(s) cannot be updated:"))
for i in list_incorp:
self.__update_progress_info("\t%s" % i)
self.__update_progress_info(
- self._("Update using: Update All\n"), True)
+ _("Update using: Update All\n"), True)
def __handle_update_progress_error(self, str_error, ex = None,
stage = UPDATE_EVAL):
@@ -1003,13 +999,13 @@
gobject.idle_add(self.__progress_error_eval)
gobject.idle_add(self.__update_progress_info,
- self._("\nERROR"), True)
+ _("\nERROR"), True)
if ex != None:
gobject.idle_add(self.__update_progress_info,
- self._("%s\n%s" % (str_error, ex)))
+ _("%s\n%s" % (str_error, ex)))
else:
gobject.idle_add(self.__update_progress_info,
- self._("%s\n" % str_error))
+ _("%s\n" % str_error))
self.__cleanup()
def __update_image(self, be_name = None):
@@ -1020,7 +1016,7 @@
# Evaluate
try:
gobject.idle_add(self.__update_progress_info,
- self._("\nEvaluate\n"), True)
+ _("\nEvaluate\n"), True)
if self.__get_api_obj() == None:
return
@@ -1031,19 +1027,18 @@
# self.api_obj.plan_update_all(sys.argv[0], be_name)
if cre:
self.__handle_update_progress_error(
- self._(
- "Update All failed during catalog refresh\n"
- "while determining what to update:"), cre,
- stage = self.update_stage)
+ _("Update All failed during catalog refresh\n"
+ "while determining what to update:"), cre,
+ stage = self.update_stage)
return
if not opensolaris_image:
self.__handle_update_progress_error(
- self._("This is not an OpenSolaris image\n"),
+ _("This is not an OpenSolaris image\n"),
stage = self.update_stage)
return
if not stuff_to_do:
self.__handle_update_progress_error(
- self._("No updates available for this image."),
+ _("No updates available for this image."),
stage = self.update_stage)
return
except (api_errors.CanceledException):
@@ -1051,17 +1046,17 @@
return
except api_errors.CatalogRefreshException, cre:
self.__handle_update_progress_error(
- self._("Update All failed during catalog refresh\n"
+ _("Update All failed during catalog refresh\n"
"while determining what to update:"), cre,
stage = self.update_stage)
except api_errors.PlanCreationException, pce:
self.__handle_update_progress_error(
- self._("Update All failure in plan creation:"), pce,
+ _("Update All failure in plan creation:"), pce,
stage = self.update_stage)
return
except api_errors.IpkgOutOfDateException:
self.__handle_update_progress_error(
- self._(
+ _(
"pkg(5) appears to be out of date and should be\n" +
"updated before running Update All.\n" +
"Please update pkg(5) using:\n" +
@@ -1071,17 +1066,17 @@
return
except api_errors.ApiException, aex:
self.__handle_update_progress_error(
- self._("Update All API failure in evaluation:"), aex,
+ _("Update All API failure in evaluation:"), aex,
stage = self.update_stage)
return
except Exception, uex:
self.__handle_update_progress_error(
- self._("Update All unexpected error in evaluation:"),
+ _("Update All unexpected error in evaluation:"),
uex, stage = self.update_stage)
return
- if self.__shared_update_steps(self._("Update All"),
- self._("Update All finished successfully.\n")) != 0:
+ if self.__shared_update_steps(_("Update All"),
+ _("Update All finished successfully.\n")) != 0:
return
gobject.idle_add(self.__display_update_image_success)
@@ -1091,15 +1086,15 @@
info_str = ""
if elapsed >= 1.0:
info_str = \
- self._(
+ _(
"\nUpdate All finished successfully in %1.f mins\n\n" %
elapsed)
else:
info_str = \
- self._(
+ _(
"\nUpdate All finished successfully in < 1 min\n\n")
- info_str += self._(
+ info_str += _(
"Please reboot after reviewing the release notes posted at:\n\n"
"http://opensolaris.org/os/project/indiana/resources/"
"relnotes/200811/x86/")
@@ -1109,7 +1104,7 @@
buttons = gtk.BUTTONS_CLOSE, flags = gtk.DIALOG_MODAL,
type = gtk.MESSAGE_INFO,
message_format = info_str)
- msgbox.set_title(self._("Update All Completed"))
+ msgbox.set_title(_("Update All Completed"))
msgbox.run()
msgbox.destroy()
self.__exit_app()
@@ -1126,26 +1121,26 @@
list_fmris_to_install = self.__get_selected_fmris()
if len(list_fmris_to_install) == 0:
self.__handle_update_progress_error(
- self._("Nothing selected to update."))
+ _("Nothing selected to update."))
return
if self.__get_api_obj() == None:
return
if debug:
- print self._("Updating ...")
+ print _("Updating ...")
print list_fmris_to_install
# Evaluate
try:
gobject.idle_add(self.__update_progress_info,
- self._("\nEvaluate\n"), True)
+ _("\nEvaluate\n"), True)
ret, exception_caught = \
self.__get_api_obj().plan_install(list_fmris_to_install,
[], refresh_catalogs = self.do_refresh)
if exception_caught != None:
self.__handle_update_progress_error(
- self._("Update error in plan install:"),
+ _("Update error in plan install:"),
exception_caught,
stage = self.update_stage)
return
@@ -1155,12 +1150,12 @@
return
except (api_errors.ApiException), aex:
self.__handle_update_progress_error(
- self._("Update unexpected API error:"), aex,
+ _("Update unexpected API error:"), aex,
stage = self.update_stage)
return
except (Exception), uex:
self.__handle_update_progress_error(
- self._("Update unexpected error:"), uex,
+ _("Update unexpected error:"), uex,
stage = self.update_stage)
return
@@ -1183,12 +1178,12 @@
gobject.idle_add(self.__handle_incorporated_error, list_incorp)
gobject.idle_add(self.__update_progress_info,
- self._("Packages to be installed:"))
+ _("Packages to be installed:"))
for i in list_planned:
gobject.idle_add(self.__update_progress_info, "\t%s" % i)
- if self.__shared_update_steps(self._("Update"),
- self._("Update finished successfully.")) != 0:
+ if self.__shared_update_steps(_("Update"),
+ _("Update finished successfully.")) != 0:
return
gobject.idle_add(self.__remove_installed, list_planned)
@@ -1207,26 +1202,26 @@
self.install_error = True
gobject.idle_add(self.__progress_error_download)
gobject.idle_add(self.__update_progress_info,
- self._("\nERROR"), True)
+ _("\nERROR"), True)
gobject.idle_add(self.__update_progress_info,
- self._("%s Download failed:\n%s" % (what_msg, aex)))
+ _("%s Download failed:\n%s" % (what_msg, aex)))
self.__cleanup()
return 1
except EnvironmentError, uex:
if uex.errno in (errno.EDQUOT, errno.ENOSPC):
self.__handle_update_progress_error(
- self._(
+ _(
"%s exceded available disc space" % (what_msg)),
stage = self.update_stage)
gobject.idle_add(self.__prompt_to_load_beadm)
else:
self.__handle_update_progress_error(
- self._("%s unexpected error:" % (what_msg)),
+ _("%s unexpected error:" % (what_msg)),
uex, stage = self.update_stage)
return 1
except Exception, uex:
self.__handle_update_progress_error(
- self._("%s unexpected error:" % (what_msg)),
+ _("%s unexpected error:" % (what_msg)),
uex, stage = self.update_stage)
return 1
@@ -1242,33 +1237,33 @@
self.install_error = True
gobject.idle_add(self.__progress_error_install)
gobject.idle_add(self.__update_progress_info,
- self._("\nERROR"), True)
+ _("\nERROR"), True)
gobject.idle_add(self.__update_progress_info,
- self._("%s Execute plan failed:\n%s" % (what_msg, aex)))
+ _("%s Execute plan failed:\n%s" % (what_msg, aex)))
self.__cleanup()
return 1
except EnvironmentError, uex:
if uex.errno in (errno.EDQUOT, errno.ENOSPC):
self.__handle_update_progress_error(
- self._(
+ _(
"%s exceded available disc space" % what_msg),
stage = self.update_stage)
gobject.idle_add(self.__prompt_to_load_beadm)
else:
self.__handle_update_progress_error(
- self._("%s unexpected error:" % (what_msg)),
+ _("%s unexpected error:" % (what_msg)),
uex, stage = self.update_stage)
return 1
except Exception, uex:
self.__handle_update_progress_error(
- self._("%s unexpected error:" % (what_msg)),
+ _("%s unexpected error:" % (what_msg)),
uex, stage = self.update_stage)
return 1
self.__cleanup()
gobject.idle_add(self.__progress_steps_done)
gobject.idle_add(self.__update_progress_info,
- self._(success_msg), True)
+ _(success_msg), True)
gobject.idle_add(self.w_progress_ok.set_sensitive, True)
return 0
@@ -1277,12 +1272,12 @@
msgbox = gtk.MessageDialog(parent = self.w_progress_dialog,
buttons = gtk.BUTTONS_OK_CANCEL, flags = gtk.DIALOG_MODAL,
type = gtk.MESSAGE_ERROR,
- message_format = self._(
+ message_format = _(
"Not enough disc space: the Update All action cannot "
"be performed.\n\n"
"Click OK to launch BE Management to manage your "
"existing BE's and free up disc space."))
- msgbox.set_title(self._("Not Enough Disc Space"))
+ msgbox.set_title(_("Not Enough Disc Space"))
result = msgbox.run()
msgbox.destroy()
if result == gtk.RESPONSE_OK:
@@ -1450,14 +1445,14 @@
if not dl_started:
self.cur_pkg = ""
self.__progress_steps_download()
- self.__update_progress_info(self._("\nDownload\n"), True)
+ self.__update_progress_info(_("\nDownload\n"), True)
if self.cur_pkg != dl_cur_pkg:
self.__update_progress_info("%s" % dl_cur_pkg)
self.cur_pkg = dl_cur_pkg
self.__update_progress_info(
- self._("\tpkg %d/%d: \tfiles %d/%d \txfer %.2f/%.2f(meg)") %
+ _("\tpkg %d/%d: \tfiles %d/%d \txfer %.2f/%.2f(meg)") %
(dl_cur_npkgs, dl_goal_npkgs,
dl_cur_nfiles, dl_goal_nfiles,
dl_cur_nmegbytes, dl_goal_nmegbytes))
@@ -1474,13 +1469,13 @@
if not act_started:
self.__progress_steps_install()
- self.__update_progress_info(self._("\nInstall\n"), True)
+ self.__update_progress_info(_("\nInstall\n"), True)
self.__update_progress_info(
- self._("\t%s\t%d/%d actions") %
+ _("\t%s\t%d/%d actions") %
(act_phase, act_cur_nactions, act_goal_nactions))
else:
self.__update_progress_info(
- self._("\t%s\t%d/%d actions") %
+ _("\t%s\t%d/%d actions") %
(act_phase, act_cur_nactions, act_goal_nactions))
if debug:
@@ -1498,12 +1493,12 @@
return
self.update_stage = UPDATE_INDEX
self.__progress_steps_index()
- self.__update_progress_info(self._("Index\n"), True)
- self.__update_progress_info(self._("\t%-25s\t%d/%d actions" %
+ self.__update_progress_info(_("Index\n"), True)
+ self.__update_progress_info(_("\t%-25s\t%d/%d actions" %
(ind_phase, ind_cur_nitems, ind_goal_nitems)))
else:
self.__update_progress_info(
- self._("\t%-25s\t%d/%d actions") %
+ _("\t%-25s\t%d/%d actions") %
(ind_phase, ind_cur_nitems, ind_goal_nitems))
if debug:
@@ -1567,7 +1562,7 @@
um.do_refresh = do_refresh
um.init_tree_views()
- um.setup_progressdialog_show(um._("Checking for new software"),
+ um.setup_progressdialog_show(_("Checking for new software"),
showDetails = False)
gobject.timeout_add(UPDATES_FETCH_DELAY, um.setup_updates)
main()
--- a/src/updatemanagernotifier.py Tue Dec 23 09:31:28 2008 -0800
+++ b/src/updatemanagernotifier.py Fri Jan 02 08:08:46 2009 +0000
@@ -96,9 +96,6 @@
module.bindtextdomain("pkg", self.application_dir + \
"/usr/share/locale")
module.textdomain("pkg")
- # XXX Remove and use _() where self._ and self.parent._ are being used
- self._ = gettext.gettext
-
self.pr = None
self.last_check_filename = None
self.time_until_next_check = 0
@@ -308,7 +305,7 @@
while gtk.events_pending():
gtk.main_iteration(False)
except ValueError:
- print self._('%s is not valid image, trying root image') \
+ print _('%s is not valid image, trying root image') \
% image_directory
try:
dr = os.environ["PKG_IMAGE"]
@@ -318,7 +315,7 @@
image_obj.find_root(dr)
image_obj.load_config()
except ValueError:
- print self._('%s is not valid root image, return None') \
+ print _('%s is not valid root image, return None') \
% dr
image_obj = None
return image_obj
@@ -328,7 +325,7 @@
status_icon.set_visible(False)
status_icon.connect('activate', self.activate_status_icon)
status_icon.connect('notify', self.notify_status_icon)
- status_icon.set_tooltip(self._("Updates are available"))
+ status_icon.set_tooltip(_("Updates are available"))
return status_icon
def notify_status_icon(self, status_icon, paramspec):
@@ -350,8 +347,8 @@
if self.notify == None:
if pynotify.init("UpdateManager"):
self.notify = pynotify.Notification(\
- self._("Update Manager"), \
- self._("Updates available\nPlease click on icon to update."))
+ _("Update Manager"), \
+ _("Updates available\nPlease click on icon to update."))
if self.notify != None:
self.set_notify_position()
@@ -403,7 +400,8 @@
self.schedule_next_check_for_checks()
return False
- def check_already_running(self):
+ @staticmethod
+ def check_already_running():
atom = gtk.gdk.atom_intern("UPDATEMANAGERNOTIFIER",
only_if_exists = False)
pid = os.getpid()
@@ -425,7 +423,7 @@
fail = False
if fail == True:
- print self._("Another instance of UpdateManagerNotify is running")
+ print _("Another instance of UpdateManagerNotify is running")
sys.exit(1)
gtk.gdk.get_default_root_window().property_change(atom,