More changes to enable localization

git-svn-id: http://munki.googlecode.com/svn/trunk@920 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-11-18 18:21:13 +00:00
parent 01bbf73ef2
commit c1c9ce2ac7
4 changed files with 19 additions and 5 deletions

View File

@@ -124,9 +124,11 @@ class MSUAppDelegate(NSObject):
#NSLog(u"Building table of available updates.")
self.buildUpdateTableData()
if self._optionalInstalls:
#NSLog(u"Building table of optional software.")
NSLog(u"Building table of optional software.")
self.buildOptionalInstallsData()
#NSLog(u"Showing main window.")
self.mainWindowController.theWindow.makeKeyAndOrderFront_(self)
#NSLog(u"Main window was made key and ordered front")
if self._listofupdates:
return
# no list of updates; let's check the LastCheckResult for more info
@@ -230,6 +232,7 @@ class MSUAppDelegate(NSObject):
if showRemovalDetail:
item["display_name"] = ((item.get("display_name") or item.get("name", ""))
+ NSLocalizedString(u" (will be removed)", None))
item["description"] = NSLocalizedString(u"This item will be removed.", None)
updatelist.append(item)
if not showRemovalDetail:
row = {}

View File

@@ -39,10 +39,12 @@ class MSUOptionalInstallsViewController(NSViewController):
"status": "", "original_status": ""}])
def optionallist(self):
#NSLog(u"MSUOptionalInstallsViewController.optionallist")
return self._optionallist
objc.accessor(optionallist) # PyObjC KVO hack
def setOptionallist_(self, newlist):
#NSLog(u"MSUOptionalInstallsViewController.setOptionallist_")
self._optionallist = NSArray.arrayWithArray_(newlist)
objc.accessor(setOptionallist_) # PyObjC KVO hack
@@ -52,6 +54,7 @@ class MSUOptionalInstallsViewController(NSViewController):
#self.updateAddRemoveBtnState()
def updateRowStatus(self):
#NSLog(u"MSUOptionalInstallsViewController.updateRowStatus")
if len(self.array_controller.selectedObjects()):
row = self.array_controller.selectedObjects()[0]
if row['managed'] == row['original_managed']:
@@ -98,6 +101,7 @@ class MSUOptionalInstallsViewController(NSViewController):
NSApp.delegate().addOrRemoveOptionalSoftware()
def updateDescriptionView(self):
#NSLog(u"MSUOptionalInstallsViewController.updateDescriptionView")
if len(self.array_controller.selectedObjects()):
row = self.array_controller.selectedObjects()[0]
description = row.get("description","")
@@ -112,5 +116,6 @@ class MSUOptionalInstallsViewController(NSViewController):
self.descriptionView.mainFrame().loadHTMLString_baseURL_(u"", None)
def tableViewSelectionDidChange_(self, sender):
#NSLog(u"MSUOptionalInstallsViewController.tableViewSelectionDidChange_")
self.performSelectorOnMainThread_withObject_waitUntilDone_(self.updateDescriptionView, None, NO)

View File

@@ -221,13 +221,13 @@ class MSUStatusWindowController(NSObject):
self.window.orderFront_(self)
return ""
if message.startswith(u"TITLE: "):
self.window.setTitle_(message[7:])
self.window.setTitle_(NSLocalizedString(message[7:], None))
return ""
if message.startswith(u"MESSAGE: "):
self.messageFld.setStringValue_(message[9:])
self.messageFld.setStringValue_(NSLocalizedString(message[9:], None))
return ""
if message.startswith(u"DETAIL: "):
self.detailFld.setStringValue_(message[8:])
self.detailFld.setStringValue_(NSLocalizedString(message[8:], None))
return ""
if message.startswith(u"PERCENT: "):
self.setPercentageDone(message[9:])

View File

@@ -36,14 +36,18 @@ class MSUupdatesViewController(NSViewController):
updateNowBtn = IBOutlet()
_updatelist = NSArray.arrayWithArray_([{"image": NSImage.imageNamed_("Empty.png"),
"name": "", "version": "", "size": "",
"name": "",
"version": "",
"size": "",
"description": ""}])
def updatelist(self):
#NSLog(u"MSUupdatesViewController.updatelist")
return self._updatelist
objc.accessor(updatelist) # PyObjC KVO hack
def setUpdatelist_(self, newlist):
#NSLog(u"MSUupdatesViewController.setUpdatelist_")
self._updatelist = NSArray.arrayWithArray_(newlist)
objc.accessor(setUpdatelist_) # PyObjC KVO hack
@@ -64,6 +68,7 @@ class MSUupdatesViewController(NSViewController):
NSApp.delegate().buildOptionalInstallsData()
def updateDescriptionView(self):
#NSLog(u"MSUupdatesViewController.updateDescriptionView")
if len(self.array_controller.selectedObjects()):
row = self.array_controller.selectedObjects()[0]
description = row.get("description","")
@@ -77,6 +82,7 @@ class MSUupdatesViewController(NSViewController):
self.descriptionView.mainFrame().loadHTMLString_baseURL_(u"", None)
def tableViewSelectionDidChange_(self, sender):
#NSLog(u"MSUupdatesViewController.tableViewSelectionDidChange_")
self.performSelectorOnMainThread_withObject_waitUntilDone_(self.updateDescriptionView, None, NO)