1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 22:51:39 +00:00

[#194 state:fixed] Added the "Replace with symlink" deletion option.

This commit is contained in:
Virgil Dupras
2012-08-01 12:36:23 -04:00
parent 5247ac8abd
commit 5a5a74d0e1
9 changed files with 71 additions and 53 deletions

View File

@@ -1,47 +1,49 @@
ownerclass = 'DeletionOptions'
ownerimport = 'DeletionOptions.h'
result = Window(450, 215, "Deletion Options")
result = Window(450, 240, "Deletion Options")
messageLabel = Label(result, "")
hardlinkCheckbox = Checkbox(result, "Hardlink deleted files")
hardlinkLabel = Label(result, "After having deleted a duplicate, place a hardlink targeting the "
linkCheckbox = Checkbox(result, "Link deleted files")
linkLabel = Label(result, "After having deleted a duplicate, place a link targeting the "
"reference file to replace the deleted file.")
linkTypeChoice = RadioButtons(result, ["Symlink", "Hardlink"], columns=2)
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.linkButton = linkCheckbox
owner.linkTypeRadio = linkTypeChoice
owner.directButton = directCheckbox
owner.messageTextField = messageLabel
result.canMinimize = False
result.canResize = False
hardlinkLabel.controlSize = const.NSSmallControlSize
directLabel.controlSize = const.NSSmallControlSize
linkLabel.controlSize = ControlSize.Small
directLabel.controlSize = ControlSize.Small
linkTypeChoice.controlSize = ControlSize.Small
proceedButton.keyEquivalent = '\\r'
cancelButton.keyEquivalent = '\\e'
hardlinkCheckbox.action = directCheckbox.action = Action(owner, 'updateOptions')
linkCheckbox.action = directCheckbox.action = linkTypeChoice.action = Action(owner, 'updateOptions')
proceedButton.action = Action(owner, 'proceed')
cancelButton.action = Action(owner, 'cancel')
hardlinkLabel.height *= 2 # 2 lines
linkLabel.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)
mainLayout = VLayout([messageLabel, linkCheckbox, linkLabel, linkTypeChoice, directCheckbox,
directLabel])
mainLayout.packToCorner(Pack.UpperLeft)
mainLayout.fill(Pack.Right)
buttonLayout = HLayout([cancelButton, proceedButton])
buttonLayout.packToCorner(Pack.LowerRight)
# indent the labels under checkboxes a little bit to the right
for label in (hardlinkLabel, directLabel):
label.x += 20
label.width -= 20
for indentedView in (linkLabel, directLabel, linkTypeChoice):
indentedView.x += 20
indentedView.width -= 20
# We actually don't want the link choice radio buttons to take all the width, it looks weird.
linkTypeChoice.width = 170