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

Instead of "manually" added a "Clear Picture Cache" menu item in the objc code, added an "edition" argument to main_menu UI script and conditionally add it there.

--HG--
branch : xibless
This commit is contained in:
Virgil Dupras 2012-07-29 11:28:39 -04:00
parent abe9041a67
commit 244af5b652
6 changed files with 10 additions and 11 deletions

View File

@ -69,7 +69,8 @@ def build_xibless(edition):
xibless.generate('cocoa/base/ui/directory_panel.py', 'cocoa/autogen/DirectoryPanel_UI', localizationTable='Localizable') xibless.generate('cocoa/base/ui/directory_panel.py', 'cocoa/autogen/DirectoryPanel_UI', localizationTable='Localizable')
xibless.generate('cocoa/base/ui/prioritize_dialog.py', 'cocoa/autogen/PrioritizeDialog_UI', localizationTable='Localizable') xibless.generate('cocoa/base/ui/prioritize_dialog.py', 'cocoa/autogen/PrioritizeDialog_UI', localizationTable='Localizable')
xibless.generate('cocoa/base/ui/result_window.py', 'cocoa/autogen/ResultWindow_UI', localizationTable='Localizable') xibless.generate('cocoa/base/ui/result_window.py', 'cocoa/autogen/ResultWindow_UI', localizationTable='Localizable')
xibless.generate('cocoa/base/ui/main_menu.py', 'cocoa/autogen/MainMenu_UI', localizationTable='Localizable') xibless.generate('cocoa/base/ui/main_menu.py', 'cocoa/autogen/MainMenu_UI',
localizationTable='Localizable', args={'edition': edition})
xibless.generate('cocoa/base/ui/preferences_panel.py', 'cocoa/autogen/PreferencesPanel_UI', xibless.generate('cocoa/base/ui/preferences_panel.py', 'cocoa/autogen/PreferencesPanel_UI',
localizationTable='Localizable', args={'edition': edition}) localizationTable='Localizable', args={'edition': edition})
if edition == 'pe': if edition == 'pe':

View File

@ -1,5 +1,6 @@
ownerclass = 'AppDelegateBase' ownerclass = 'AppDelegateBase'
ownerimport = 'AppDelegateBase.h' ownerimport = 'AppDelegateBase.h'
edition = args.get('edition', 'se')
result = Menu("") result = Menu("")
appMenu = result.addMenu("dupeGuru") appMenu = result.addMenu("dupeGuru")
@ -29,6 +30,8 @@ fileMenu.addItem("Load Results...", Action(None, 'loadResults'), 'cmd+o')
owner.recentResultsMenu = fileMenu.addMenu("Load Recent Results") owner.recentResultsMenu = fileMenu.addMenu("Load Recent Results")
fileMenu.addItem("Save Results...", Action(None, 'saveResults'), 'cmd+s') fileMenu.addItem("Save Results...", Action(None, 'saveResults'), 'cmd+s')
fileMenu.addItem("Export Results to XHTML", Action(None, 'exportToXHTML'), 'cmd+shift+e') fileMenu.addItem("Export Results to XHTML", Action(None, 'exportToXHTML'), 'cmd+shift+e')
if edition == 'pe':
fileMenu.addItem("Clear Picture Cache", Action(owner, 'clearPictureCache'), 'cmd+shift+p')
editMenu.addItem("Mark All", Action(None, 'markAll'), 'cmd+a') editMenu.addItem("Mark All", Action(None, 'markAll'), 'cmd+a')
editMenu.addItem("Mark None", Action(None, 'markNone'), 'cmd+shift+a') editMenu.addItem("Mark None", Action(None, 'markNone'), 'cmd+shift+a')

View File

@ -10,4 +10,5 @@ http://www.hardcoded.net/licenses/bsd_license
#import "AppDelegateBase.h" #import "AppDelegateBase.h"
@interface AppDelegate : AppDelegateBase {} @interface AppDelegate : AppDelegateBase {}
- (void)clearPictureCache;
@end @end

View File

@ -67,14 +67,8 @@ http://www.hardcoded.net/licenses/bsd_license
return [[DetailsPanelPE alloc] initWithApp:model]; return [[DetailsPanelPE alloc] initWithApp:model];
} }
//Delegate - (void)clearPictureCache
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{ {
// index 2 is just after "Clear Ingore List" [(ResultWindow *)[self resultWindow] clearPictureCache];
NSMenuItem *mi = [actionsMenu insertItemWithTitle:TR(@"Clear Picture Cache")
action:@selector(clearPictureCache:) keyEquivalent:@"P" atIndex:2];
[mi setTarget:[self resultWindow]];
[mi setKeyEquivalentModifierMask:NSCommandKeyMask|NSShiftKeyMask];
[super applicationDidFinishLaunching:aNotification];
} }
@end @end

View File

@ -10,5 +10,5 @@ http://www.hardcoded.net/licenses/bsd_license
#import "../base/ResultWindow.h" #import "../base/ResultWindow.h"
@interface ResultWindow : ResultWindowBase {} @interface ResultWindow : ResultWindowBase {}
- (IBAction)clearPictureCache:(id)sender; - (void)clearPictureCache;
@end @end

View File

@ -48,7 +48,7 @@ http://www.hardcoded.net/licenses/bsd_license
} }
/* Actions */ /* Actions */
- (IBAction)clearPictureCache:(id)sender - (void)clearPictureCache
{ {
NSString *msg = TR(@"Do you really want to remove all your cached picture analysis?"); NSString *msg = TR(@"Do you really want to remove all your cached picture analysis?");
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO