mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 22:51:39 +00:00
xibless-ified DeletionOptions.
--HG-- branch : xibless
This commit is contained in:
@@ -11,15 +11,21 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
@interface DeletionOptions : NSWindowController
|
||||
{
|
||||
IBOutlet NSTextField *messageTextField;
|
||||
IBOutlet NSButton *hardlinkButton;
|
||||
IBOutlet NSButton *directButton;
|
||||
|
||||
PyDeletionOptions *model;
|
||||
|
||||
NSTextField *messageTextField;
|
||||
NSButton *hardlinkButton;
|
||||
NSButton *directButton;
|
||||
}
|
||||
|
||||
@property (readwrite, retain) NSTextField *messageTextField;
|
||||
@property (readwrite, retain) NSButton *hardlinkButton;
|
||||
@property (readwrite, retain) NSButton *directButton;
|
||||
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef;
|
||||
|
||||
- (IBAction)updateOptions:(id)sender;
|
||||
- (IBAction)proceed:(id)sender;
|
||||
- (IBAction)cancel:(id)sender;
|
||||
- (void)updateOptions;
|
||||
- (void)proceed;
|
||||
- (void)cancel;
|
||||
@end
|
||||
@@ -7,14 +7,20 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
*/
|
||||
|
||||
#import "DeletionOptions.h"
|
||||
#import "DeletionOptions_UI.h"
|
||||
#import "HSPyUtil.h"
|
||||
|
||||
@implementation DeletionOptions
|
||||
|
||||
@synthesize messageTextField;
|
||||
@synthesize hardlinkButton;
|
||||
@synthesize directButton;
|
||||
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef
|
||||
{
|
||||
self = [super initWithWindowNibName:@"DeletionOptions"];
|
||||
[self window];
|
||||
self = [super initWithWindow:nil];
|
||||
model = [[PyDeletionOptions alloc] initWithModel:aPyRef];
|
||||
[self setWindow:createDeletionOptions_UI(self)];
|
||||
[model bindCallback:createCallback(@"DeletionOptionsView", self)];
|
||||
return self;
|
||||
}
|
||||
@@ -25,18 +31,18 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (IBAction)updateOptions:(id)sender
|
||||
- (void)updateOptions
|
||||
{
|
||||
[model setHardlink:[hardlinkButton state] == NSOnState];
|
||||
[model setDirect:[directButton state] == NSOnState];
|
||||
}
|
||||
|
||||
- (IBAction)proceed:(id)sender
|
||||
- (void)proceed
|
||||
{
|
||||
[NSApp stopModalWithCode:NSOKButton];
|
||||
}
|
||||
|
||||
- (IBAction)cancel:(id)sender
|
||||
- (void)cancel
|
||||
{
|
||||
[NSApp stopModalWithCode:NSCancelButton];
|
||||
}
|
||||
|
||||
47
cocoa/base/ui/deletion_options.py
Normal file
47
cocoa/base/ui/deletion_options.py
Normal file
@@ -0,0 +1,47 @@
|
||||
ownerclass = 'DeletionOptions'
|
||||
ownerimport = 'DeletionOptions.h'
|
||||
|
||||
result = Window(450, 215, "Deletion Options")
|
||||
messageLabel = Label(result, "")
|
||||
hardlinkCheckbox = Checkbox(result, "Hardlink deleted files")
|
||||
hardlinkLabel = Label(result, "After having deleted a duplicate, place a hardlink targeting the "
|
||||
"reference file to replace the deleted file.")
|
||||
directCheckbox = Checkbox(result, "Directly delete files")
|
||||
directLabel = Label(result, "Instead of sending files to trash, delete them directly. This option "
|
||||
"is usually used as a workaround when the normal deletion method doesn't work.")
|
||||
proceedButton = Button(result, "Proceed")
|
||||
cancelButton = Button(result, "Cancel")
|
||||
|
||||
owner.hardlinkButton = hardlinkCheckbox
|
||||
owner.directButton = directCheckbox
|
||||
owner.messageTextField = messageLabel
|
||||
|
||||
result.canMinimize = False
|
||||
result.canResize = False
|
||||
hardlinkLabel.controlSize = const.NSSmallControlSize
|
||||
directLabel.controlSize = const.NSSmallControlSize
|
||||
proceedButton.keyEquivalent = '\\r'
|
||||
cancelButton.keyEquivalent = '\\e'
|
||||
hardlinkCheckbox.action = directCheckbox.action = Action(owner, 'updateOptions')
|
||||
proceedButton.action = Action(owner, 'proceed')
|
||||
cancelButton.action = Action(owner, 'cancel')
|
||||
|
||||
hardlinkLabel.height *= 2 # 2 lines
|
||||
directLabel.height *= 3 # 3 lines
|
||||
proceedButton.width = 92
|
||||
cancelButton.width = 92
|
||||
|
||||
messageLabel.packToCorner(Pack.UpperLeft)
|
||||
hardlinkCheckbox.packRelativeTo(messageLabel, Pack.Below)
|
||||
hardlinkLabel.packRelativeTo(hardlinkCheckbox, Pack.Below)
|
||||
directCheckbox.packRelativeTo(hardlinkLabel, Pack.Below)
|
||||
directLabel.packRelativeTo(directCheckbox, Pack.Below)
|
||||
for view in (messageLabel, hardlinkCheckbox, hardlinkLabel, directCheckbox, directLabel):
|
||||
view.fill(Pack.Right)
|
||||
proceedButton.packToCorner(Pack.LowerRight)
|
||||
cancelButton.packRelativeTo(proceedButton, Pack.Left)
|
||||
|
||||
# indent the labels under checkboxes a little bit to the right
|
||||
for label in (hardlinkLabel, directLabel):
|
||||
label.x += 20
|
||||
label.width -= 20
|
||||
Reference in New Issue
Block a user