From 880f0787ce513199cd5349a2e77da29ecce4d5b8 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 13 Sep 2011 18:19:46 -0400 Subject: [PATCH] [#138] Added label and ok/cancel buttons to pri-dialog (Cocoa). --- cocoa/base/PrioritizeDialog.h | 2 + cocoa/base/PrioritizeDialog.m | 10 ++ cocoa/base/PyPrioritizeDialog.h | 1 + cocoa/base/ResultWindow.m | 7 +- cocoa/base/en.lproj/PrioritizeDialog.xib | 201 ++++++++++++++++++++--- core/app_cocoa_inter.py | 3 + 6 files changed, 201 insertions(+), 23 deletions(-) diff --git a/cocoa/base/PrioritizeDialog.h b/cocoa/base/PrioritizeDialog.h index a6a28add..873ffdd2 100644 --- a/cocoa/base/PrioritizeDialog.h +++ b/cocoa/base/PrioritizeDialog.h @@ -28,4 +28,6 @@ http://www.hardcoded.net/licenses/bsd_license - (IBAction)addSelected:(id)sender; - (IBAction)removeSelected:(id)sender; +- (IBAction)ok:(id)sender; +- (IBAction)cancel:(id)sender; @end; \ No newline at end of file diff --git a/cocoa/base/PrioritizeDialog.m b/cocoa/base/PrioritizeDialog.m index b6658c2f..8f12257f 100644 --- a/cocoa/base/PrioritizeDialog.m +++ b/cocoa/base/PrioritizeDialog.m @@ -42,4 +42,14 @@ http://www.hardcoded.net/licenses/bsd_license { [[self py] removeSelected]; } + +- (IBAction)ok:(id)sender +{ + [NSApp stopModal]; +} + +- (IBAction)cancel:(id)sender +{ + [NSApp abortModal]; +} @end \ No newline at end of file diff --git a/cocoa/base/PyPrioritizeDialog.h b/cocoa/base/PyPrioritizeDialog.h index e51130e6..d461018a 100644 --- a/cocoa/base/PyPrioritizeDialog.h +++ b/cocoa/base/PyPrioritizeDialog.h @@ -16,4 +16,5 @@ http://www.hardcoded.net/licenses/bsd_license - (PySelectableList *)prioritizationList; - (void)addSelected; - (void)removeSelected; +- (void)performReprioritization; @end \ No newline at end of file diff --git a/cocoa/base/ResultWindow.m b/cocoa/base/ResultWindow.m index 1a06c37c..e53725c0 100644 --- a/cocoa/base/ResultWindow.m +++ b/cocoa/base/ResultWindow.m @@ -342,7 +342,12 @@ http://www.hardcoded.net/licenses/bsd_license - (IBAction)reprioritizeResults:(id)sender { PrioritizeDialog *dlg = [[PrioritizeDialog alloc] initWithPy:py]; - [dlg showWindow:nil]; + NSInteger result = [NSApp runModalForWindow:[dlg window]]; + if (result == NSRunStoppedResponse) { + [[dlg py] performReprioritization]; + } + [dlg release]; + [[self window] makeKeyAndOrderFront:nil]; } - (IBAction)resetColumnsToDefault:(id)sender diff --git a/cocoa/base/en.lproj/PrioritizeDialog.xib b/cocoa/base/en.lproj/PrioritizeDialog.xib index 14095a0e..4a3de4fa 100644 --- a/cocoa/base/en.lproj/PrioritizeDialog.xib +++ b/cocoa/base/en.lproj/PrioritizeDialog.xib @@ -11,6 +11,7 @@ 1617 + NSTextField NSPopUpButton NSScroller NSButton @@ -40,9 +41,9 @@ NSApplication - 15 + 9 2 - {{196, 240}, {570, 302}} + {{196, 240}, {609, 401}} 1618477056 Re-Prioritize duplicates NSWindow @@ -55,7 +56,7 @@ 268 - {{17, 258}, {216, 26}} + {{17, 298}, {268, 26}} @@ -93,7 +94,7 @@ - 268 + 276 @@ -102,7 +103,7 @@ 256 - {208, 233} + {260, 233} @@ -116,7 +117,7 @@ - 205 + 257 40 1000 @@ -145,14 +146,14 @@ 337772096 2560 - Text Cell + 6 System controlBackgroundColor - + 3 MC42NjY2NjY2NjY3AA @@ -197,7 +198,7 @@ 1 - {{1, 1}, {208, 233}} + {{1, 1}, {260, 233}} @@ -232,7 +233,7 @@ 0.99581589958159 - {{20, 20}, {210, 235}} + {{20, 60}, {262, 235}} @@ -245,7 +246,7 @@ - 268 + 274 @@ -254,7 +255,7 @@ 256 - {248, 233} + {248, 260} @@ -285,7 +286,7 @@ 337772096 2048 - Text Cell + @@ -313,7 +314,7 @@ 1 - {{1, 1}, {248, 233}} + {{1, 1}, {248, 260}} @@ -340,6 +341,7 @@ {{1, 119}, {223, 15}} + _NS:1216 1 @@ -347,7 +349,7 @@ 0.99581589958159 - {{300, 20}, {250, 235}} + {{339, 60}, {250, 262}} @@ -361,7 +363,7 @@ 268 - {{232, 162}, {66, 32}} + {{284, 186}, {53, 32}} @@ -385,10 +387,10 @@ 268 - {{232, 133}, {66, 32}} + {{284, 160}, {53, 32}} - + _NS:161 YES @@ -406,11 +408,84 @@ 25 + + + 289 + {{513, 12}, {82, 32}} + + + + _NS:161 + YES + + 67239424 + 134217728 + Ok + + _NS:161 + + -2038284033 + 129 + + DQ + 200 + 25 + + + + + 289 + {{431, 12}, {82, 32}} + + + + _NS:161 + YES + + 67239424 + 134217728 + Cancel + + _NS:161 + + -2038284033 + 129 + + Gw + 200 + 25 + + + + + 268 + {{17, 330}, {575, 51}} + + + + _NS:3936 + YES + + 67239424 + 4194304 + Add criteria to the right box and click OK to send the dupes that correspond the best to these criteria to their respective group's reference position. Read the help file for more information. + + _NS:3936 + + + 6 + System + controlColor + + + + + - {570, 302} + {609, 401} - + {{0, 0}, {1920, 1058}} {10000000000000, 10000000000000} @@ -459,6 +534,30 @@ 35 + + + cancel: + + + + 42 + + + + ok: + + + + 43 + + + + window + + + + 44 + @@ -498,10 +597,13 @@ 2 + + + @@ -636,6 +738,45 @@ + + 36 + + + + + + + + 37 + + + + + 38 + + + + + + + + 39 + + + + + 40 + + + + + + + + 41 + + + @@ -644,7 +785,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{357, 418}, {480, 270}} - + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -663,14 +804,20 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - 35 + 44 @@ -687,6 +834,8 @@ HSWindowController id + id + id id @@ -694,6 +843,14 @@ addSelected: id + + cancel: + id + + + ok: + id + removeSelected: id diff --git a/core/app_cocoa_inter.py b/core/app_cocoa_inter.py index 55009477..2d07d7f9 100644 --- a/core/app_cocoa_inter.py +++ b/core/app_cocoa_inter.py @@ -290,3 +290,6 @@ class PyPrioritizeDialog(PyGUIObject): def removeSelected(self): self.py.remove_selected() + + def performReprioritization(self): + self.py.perform_reprioritization()