From 726269214681c2f7ea5685c2041698886e5f1b13 Mon Sep 17 00:00:00 2001 From: Robert Klep Date: Wed, 5 Nov 2014 22:15:50 +0100 Subject: [PATCH] Fixed issue with preference pane not loading --- quotefix/preferences.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/quotefix/preferences.py b/quotefix/preferences.py index f4d5146..373a32a 100644 --- a/quotefix/preferences.py +++ b/quotefix/preferences.py @@ -1,5 +1,5 @@ # -*- coding:utf-8 -*- -from AppKit import NSPreferencesModule, NSNib, NSBox, NSNibTopLevelObjects, NSObject, NSPreferences, NSWorkspace, NSURL, NSBundle, NSImage, NSDateFormatter, NSLocale, NSDateFormatterMediumStyle, NSColor, MessageViewer +from AppKit import NSPreferencesModule, NSNib, NSBox, NSNibTopLevelObjects, NSNibOwner, NSObject, NSPreferences, NSWorkspace, NSURL, NSBundle, NSImage, NSDateFormatter, NSLocale, NSDateFormatterMediumStyle, NSColor, MessageViewer from Foundation import NSLog from quotefix.utils import swizzle, htmlunescape from quotefix.attribution import CustomizedAttribution @@ -11,10 +11,9 @@ class QuoteFixPreferencesModule(NSPreferencesModule): def init(self): - context = { NSNibTopLevelObjects : [] } - nib = NSNib.alloc().initWithNibNamed_bundle_("QuoteFixPreferencesModule.nib", NSBundle.bundleWithIdentifier_('name.klep.mail.QuoteFix')) - inited = nib.instantiateNibWithExternalNameTable_(context) - self.view = filter(lambda _: isinstance(_, NSBox), context[NSNibTopLevelObjects])[0] + bundle = NSBundle.bundleWithIdentifier_('name.klep.mail.QuoteFix') + nib = bundle.loadNibNamed_owner_topLevelObjects_('QuoteFixPreferencesModule', self, None) + self.view = filter(lambda _: isinstance(_, NSBox), nib[1])[0] self.setMinSize_(self.view.boundsSize()) self.setPreferencesView_(self.view) return self @@ -118,7 +117,9 @@ def setLastUpdateCheck(self): formatter.setTimeStyle_(NSDateFormatterMediumStyle) formatter.setDateStyle_(NSDateFormatterMediumStyle) date = formatter.stringFromDate_(date) - self.lastUpdateCheck.setStringValue_(date) + self.lastUpdateCheck.setStringValue_(date) + else: + self.lastUpdateCheck.setStringValue_('Never') # act as a delegate for text fields def controlTextDidChange_(self, notification):