1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

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

View File

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

View File

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

View File

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

View File

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