From c1c9ce2ac75cfcd88f88ac6c8ae76688a56cd613 Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Thu, 18 Nov 2010 18:21:13 +0000 Subject: [PATCH] More changes to enable localization git-svn-id: http://munki.googlecode.com/svn/trunk@920 a4e17f2e-e282-11dd-95e1-755cbddbdd66 --- code/Managed Software Update/MSUAppDelegate.py | 5 ++++- .../MSUOptionalInstallsViewController.py | 5 +++++ code/Managed Software Update/MSUStatusWindowController.py | 6 +++--- code/Managed Software Update/MSUupdatesViewController.py | 8 +++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/code/Managed Software Update/MSUAppDelegate.py b/code/Managed Software Update/MSUAppDelegate.py index 15c17136..a232bc6d 100644 --- a/code/Managed Software Update/MSUAppDelegate.py +++ b/code/Managed Software Update/MSUAppDelegate.py @@ -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 = {} diff --git a/code/Managed Software Update/MSUOptionalInstallsViewController.py b/code/Managed Software Update/MSUOptionalInstallsViewController.py index 2d38470d..0be2d080 100644 --- a/code/Managed Software Update/MSUOptionalInstallsViewController.py +++ b/code/Managed Software Update/MSUOptionalInstallsViewController.py @@ -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) diff --git a/code/Managed Software Update/MSUStatusWindowController.py b/code/Managed Software Update/MSUStatusWindowController.py index 390c8b55..4c73b5fb 100644 --- a/code/Managed Software Update/MSUStatusWindowController.py +++ b/code/Managed Software Update/MSUStatusWindowController.py @@ -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:]) diff --git a/code/Managed Software Update/MSUupdatesViewController.py b/code/Managed Software Update/MSUupdatesViewController.py index bb89299a..322b48e5 100644 --- a/code/Managed Software Update/MSUupdatesViewController.py +++ b/code/Managed Software Update/MSUupdatesViewController.py @@ -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)