Simplified model --> cocoa communication.

This commit is contained in:
Virgil Dupras 2011-09-21 15:24:26 -04:00
parent f0441db88a
commit b44e52689f
5 changed files with 12 additions and 6 deletions

View File

@ -49,7 +49,6 @@ http://www.hardcoded.net/licenses/bsd_license
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
- (void)applicationWillTerminate:(NSNotification *)aNotification;
- (void)recentFileClicked:(NSString *)path;
- (void)showExtraFairwareReminder:(NSNotification *)aNotification;
/* Actions */
- (IBAction)loadResults:(id)sender;
@ -60,4 +59,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)showPreferencesPanel:(id)sender;
- (IBAction)showResultWindow:(id)sender;
- (IBAction)startScanning:(id)sender;
/* model --> view */
- (void)showExtraFairwareReminder;
@end

View File

@ -18,6 +18,7 @@ http://www.hardcoded.net/licenses/bsd_license
@implementation AppDelegateBase
- (void)awakeFromNib
{
[py bindCocoa:self];
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
/* Because the pref pane is lazily loaded, we have to manually do the update check if the
preference is set.
@ -33,8 +34,6 @@ http://www.hardcoded.net/licenses/bsd_license
_aboutBox = nil; // Lazily loaded
_preferencesPanel = nil; // Lazily loaded
[[[self directoryPanel] window] makeKeyAndOrderFront:self];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(showExtraFairwareReminder:) name:ShowExtraFairwareReminder object:nil];
}
/* Virtual */
@ -207,7 +206,9 @@ http://www.hardcoded.net/licenses/bsd_license
[py loadResultsFrom:path];
}
- (void)showExtraFairwareReminder:(NSNotification *)aNotification
/* model --> view */
- (void)showExtraFairwareReminder
{
ExtraFairwareReminder *dialog = [[ExtraFairwareReminder alloc] initWithPy:py];
[dialog start];

View File

@ -10,7 +10,6 @@ http://www.hardcoded.net/licenses/bsd_license
#define JobStarted @"JobStarted"
#define JobInProgress @"JobInProgress"
#define ShowExtraFairwareReminder @"ShowExtraFairwareReminder"
#define jobLoad @"job_load"
#define jobScan @"job_scan"

View File

@ -10,6 +10,7 @@ http://www.hardcoded.net/licenses/bsd_license
#import "PyApp.h"
@interface PyDupeGuruBase : PyApp
- (void)bindCocoa:(id)cocoa;
//Actions
- (NSNumber *)addDirectory:(NSString *)name;
- (void)removeDirectory:(NSNumber *)index;

View File

@ -44,6 +44,9 @@ class PyDupeGuruBase(PyFairware):
self.py = modelclass(self, appdata)
self.progress = cocoa.ThreadedJobPerformer()
def bindCocoa_(self, cocoa):
self.cocoa = cocoa
#---Directories
def addDirectory_(self, directory):
return self.py.add_directory(directory)
@ -211,7 +214,7 @@ class PyDupeGuruBase(PyFairware):
NSUserDefaults.standardUserDefaults().setObject_forKey_(value, key_name)
def show_extra_fairware_reminder(self):
NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_('ShowExtraFairwareReminder', self, None)
self.cocoa.showExtraFairwareReminder()
class PyDetailsPanel(PyGUIObject):
py_class = DetailsPanel