mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 13:44:37 +00:00
cocoa: move scan type selector to directory window
Also, use dynamic scan type labels supplied by core.
This commit is contained in:
parent
f8686ffb55
commit
2be4ae8f65
@ -21,6 +21,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
|||||||
HSRecentFiles *_recentDirectories;
|
HSRecentFiles *_recentDirectories;
|
||||||
DirectoryOutline *outline;
|
DirectoryOutline *outline;
|
||||||
BOOL _alwaysShowPopUp;
|
BOOL _alwaysShowPopUp;
|
||||||
|
NSPopUpButton *scanTypePopup;
|
||||||
NSPopUpButton *addButtonPopUp;
|
NSPopUpButton *addButtonPopUp;
|
||||||
NSPopUpButton *loadRecentButtonPopUp;
|
NSPopUpButton *loadRecentButtonPopUp;
|
||||||
HSOutlineView *outlineView;
|
HSOutlineView *outlineView;
|
||||||
@ -28,6 +29,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
|||||||
NSButton *loadResultsButton;
|
NSButton *loadResultsButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property (readwrite, retain) NSPopUpButton *scanTypePopup;
|
||||||
@property (readwrite, retain) NSPopUpButton *addButtonPopUp;
|
@property (readwrite, retain) NSPopUpButton *addButtonPopUp;
|
||||||
@property (readwrite, retain) NSPopUpButton *loadRecentButtonPopUp;
|
@property (readwrite, retain) NSPopUpButton *loadRecentButtonPopUp;
|
||||||
@property (readwrite, retain) HSOutlineView *outlineView;
|
@property (readwrite, retain) HSOutlineView *outlineView;
|
||||||
|
@ -14,6 +14,7 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
|||||||
|
|
||||||
@implementation DirectoryPanel
|
@implementation DirectoryPanel
|
||||||
|
|
||||||
|
@synthesize scanTypePopup;
|
||||||
@synthesize addButtonPopUp;
|
@synthesize addButtonPopUp;
|
||||||
@synthesize loadRecentButtonPopUp;
|
@synthesize loadRecentButtonPopUp;
|
||||||
@synthesize outlineView;
|
@synthesize outlineView;
|
||||||
@ -27,6 +28,8 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
|||||||
_app = aParentApp;
|
_app = aParentApp;
|
||||||
model = [_app model];
|
model = [_app model];
|
||||||
[[self window] setTitle:[model appName]];
|
[[self window] setTitle:[model appName]];
|
||||||
|
[[self scanTypePopup] addItemsWithTitles:[[aParentApp model] getScanOptions]];
|
||||||
|
[[self scanTypePopup] bind:@"selectedIndex" toObject:[NSUserDefaultsController sharedUserDefaultsController] withKeyPath:@"values.scanType" options:nil];
|
||||||
_alwaysShowPopUp = NO;
|
_alwaysShowPopUp = NO;
|
||||||
[self fillPopUpMenu];
|
[self fillPopUpMenu];
|
||||||
_recentDirectories = [[HSRecentFiles alloc] initWithName:@"recentDirectories" menu:[addButtonPopUp menu]];
|
_recentDirectories = [[HSRecentFiles alloc] initWithName:@"recentDirectories" menu:[addButtonPopUp menu]];
|
||||||
|
@ -5,6 +5,8 @@ result = Window(425, 300, "dupeGuru")
|
|||||||
promptLabel = Label(result, "Select folders to scan and press \"Scan\".")
|
promptLabel = Label(result, "Select folders to scan and press \"Scan\".")
|
||||||
directoryOutline = OutlineView(result)
|
directoryOutline = OutlineView(result)
|
||||||
directoryOutline.OBJC_CLASS = 'HSOutlineView'
|
directoryOutline.OBJC_CLASS = 'HSOutlineView'
|
||||||
|
scanTypePopup = Popup(result)
|
||||||
|
scanTypeLabel = Label(result, "Scan Type:")
|
||||||
addButton = Button(result, "")
|
addButton = Button(result, "")
|
||||||
removeButton = Button(result, "")
|
removeButton = Button(result, "")
|
||||||
loadResultsButton = Button(result, "Load Results")
|
loadResultsButton = Button(result, "Load Results")
|
||||||
@ -13,6 +15,7 @@ addPopup = Popup(None)
|
|||||||
loadRecentPopup = Popup(None)
|
loadRecentPopup = Popup(None)
|
||||||
|
|
||||||
owner.outlineView = directoryOutline
|
owner.outlineView = directoryOutline
|
||||||
|
owner.scanTypePopup = scanTypePopup
|
||||||
owner.removeButton = removeButton
|
owner.removeButton = removeButton
|
||||||
owner.loadResultsButton = loadResultsButton
|
owner.loadResultsButton = loadResultsButton
|
||||||
owner.addButtonPopUp = addPopup
|
owner.addButtonPopUp = addPopup
|
||||||
@ -46,19 +49,24 @@ directoryOutline.allowsColumnReordering = False
|
|||||||
directoryOutline.allowsColumnSelection = False
|
directoryOutline.allowsColumnSelection = False
|
||||||
directoryOutline.allowsMultipleSelection = True
|
directoryOutline.allowsMultipleSelection = True
|
||||||
|
|
||||||
|
scanTypeLabel.width = 90
|
||||||
|
scanTypeLayout = HLayout([scanTypeLabel, scanTypePopup], filler=scanTypePopup)
|
||||||
|
|
||||||
for button in (addButton, removeButton):
|
for button in (addButton, removeButton):
|
||||||
button.width = 28
|
button.width = 28
|
||||||
for button in (loadResultsButton, scanButton):
|
for button in (loadResultsButton, scanButton):
|
||||||
button.width = 118
|
button.width = 118
|
||||||
|
|
||||||
buttonLayout = HLayout([addButton, removeButton, None, loadResultsButton, scanButton])
|
buttonLayout = HLayout([addButton, removeButton, None, loadResultsButton, scanButton])
|
||||||
|
bottomLayout = VLayout([None, scanTypeLayout, buttonLayout])
|
||||||
promptLabel.packToCorner(Pack.UpperLeft)
|
promptLabel.packToCorner(Pack.UpperLeft)
|
||||||
promptLabel.fill(Pack.Right)
|
promptLabel.fill(Pack.Right)
|
||||||
directoryOutline.packRelativeTo(promptLabel, Pack.Below)
|
directoryOutline.packRelativeTo(promptLabel, Pack.Below)
|
||||||
buttonLayout.packRelativeTo(directoryOutline, Pack.Below, margin=8)
|
bottomLayout.packRelativeTo(directoryOutline, Pack.Below, margin=8)
|
||||||
directoryOutline.fill(Pack.LowerRight)
|
directoryOutline.fill(Pack.LowerRight)
|
||||||
buttonLayout.fill(Pack.Right)
|
bottomLayout.fill(Pack.Right)
|
||||||
|
|
||||||
promptLabel.setAnchor(Pack.UpperLeft, growX=True)
|
promptLabel.setAnchor(Pack.UpperLeft, growX=True)
|
||||||
directoryOutline.setAnchor(Pack.UpperLeft, growX=True, growY=True)
|
directoryOutline.setAnchor(Pack.UpperLeft, growX=True, growY=True)
|
||||||
|
scanTypeLayout.setAnchor(Pack.Below)
|
||||||
buttonLayout.setAnchor(Pack.Below)
|
buttonLayout.setAnchor(Pack.Below)
|
||||||
|
@ -5,22 +5,15 @@ dialogTitles = {
|
|||||||
'pe': "dupeGuru PE Preferences",
|
'pe': "dupeGuru PE Preferences",
|
||||||
}
|
}
|
||||||
dialogHeights = {
|
dialogHeights = {
|
||||||
'se': 345,
|
'se': 325,
|
||||||
'me': 365,
|
'me': 345,
|
||||||
'pe': 275,
|
'pe': 255,
|
||||||
}
|
|
||||||
scanTypeNames = {
|
|
||||||
'se': ["Filename", "Content", "Folders"],
|
|
||||||
'me': ["Filename", "Filename - Fields", "Filename - Fields (No Order)", "Tags", "Content", "Audio Content"],
|
|
||||||
'pe': ["Contents", "EXIF Timestamp"],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = Window(410, dialogHeights[edition], dialogTitles[edition])
|
result = Window(410, dialogHeights[edition], dialogTitles[edition])
|
||||||
tabView = TabView(result)
|
tabView = TabView(result)
|
||||||
basicTab = tabView.addTab("Basic")
|
basicTab = tabView.addTab("Basic")
|
||||||
advancedTab = tabView.addTab("Advanced")
|
advancedTab = tabView.addTab("Advanced")
|
||||||
scanTypePopup = Popup(basicTab.view, scanTypeNames[edition])
|
|
||||||
scanTypeLabel = Label(basicTab.view, "Scan Type:")
|
|
||||||
thresholdSlider = Slider(basicTab.view, 1, 100, 80)
|
thresholdSlider = Slider(basicTab.view, 1, 100, 80)
|
||||||
thresholdLabel = Label(basicTab.view, "Filter hardness:")
|
thresholdLabel = Label(basicTab.view, "Filter hardness:")
|
||||||
moreResultsLabel = Label(basicTab.view, "More results")
|
moreResultsLabel = Label(basicTab.view, "More results")
|
||||||
@ -59,8 +52,6 @@ copyMoveLabel = Label(advancedTab.view, "Copy and Move:")
|
|||||||
copyMovePopup = Popup(advancedTab.view, ["Right in destination", "Recreate relative path", "Recreate absolute path"])
|
copyMovePopup = Popup(advancedTab.view, ["Right in destination", "Recreate relative path", "Recreate absolute path"])
|
||||||
|
|
||||||
resetToDefaultsButton = Button(result, "Reset To Defaults")
|
resetToDefaultsButton = Button(result, "Reset To Defaults")
|
||||||
|
|
||||||
scanTypePopup.bind('selectedIndex', defaults, 'values.scanType')
|
|
||||||
thresholdSlider.bind('value', defaults, 'values.minMatchPercentage')
|
thresholdSlider.bind('value', defaults, 'values.minMatchPercentage')
|
||||||
thresholdValueLabel.bind('value', defaults, 'values.minMatchPercentage')
|
thresholdValueLabel.bind('value', defaults, 'values.minMatchPercentage')
|
||||||
fontSizeCombo.bind('value', defaults, 'values.TableFontSize')
|
fontSizeCombo.bind('value', defaults, 'values.TableFontSize')
|
||||||
@ -98,7 +89,7 @@ result.canResize = False
|
|||||||
result.canMinimize = False
|
result.canMinimize = False
|
||||||
thresholdValueLabel.formatter = NumberFormatter(NumberStyle.Decimal)
|
thresholdValueLabel.formatter = NumberFormatter(NumberStyle.Decimal)
|
||||||
thresholdValueLabel.formatter.maximumFractionDigits = 0
|
thresholdValueLabel.formatter.maximumFractionDigits = 0
|
||||||
allLabels = [scanTypeLabel, thresholdValueLabel, moreResultsLabel, fewerResultsLabel,
|
allLabels = [thresholdValueLabel, moreResultsLabel, fewerResultsLabel,
|
||||||
thresholdLabel, fontSizeLabel, customCommandLabel, copyMoveLabel]
|
thresholdLabel, fontSizeLabel, customCommandLabel, copyMoveLabel]
|
||||||
allCheckboxes = [mixKindBox, removeEmptyFoldersBox, checkForUpdatesBox, regexpCheckbox,
|
allCheckboxes = [mixKindBox, removeEmptyFoldersBox, checkForUpdatesBox, regexpCheckbox,
|
||||||
ignoreHardlinksBox, debugModeCheckbox]
|
ignoreHardlinksBox, debugModeCheckbox]
|
||||||
@ -114,10 +105,10 @@ for label in allLabels:
|
|||||||
label.controlSize = ControlSize.Small
|
label.controlSize = ControlSize.Small
|
||||||
fewerResultsLabel.alignment = TextAlignment.Right
|
fewerResultsLabel.alignment = TextAlignment.Right
|
||||||
for checkbox in allCheckboxes:
|
for checkbox in allCheckboxes:
|
||||||
checkbox.font = scanTypeLabel.font
|
checkbox.font = thresholdValueLabel.font
|
||||||
resetToDefaultsButton.action = Action(defaults, 'revertToInitialValues:')
|
resetToDefaultsButton.action = Action(defaults, 'revertToInitialValues:')
|
||||||
|
|
||||||
scanTypeLabel.width = thresholdLabel.width = fontSizeLabel.width = 94
|
thresholdLabel.width = fontSizeLabel.width = 94
|
||||||
fontSizeCombo.width = 66
|
fontSizeCombo.width = 66
|
||||||
thresholdValueLabel.width = 25
|
thresholdValueLabel.width = 25
|
||||||
resetToDefaultsButton.width = 136
|
resetToDefaultsButton.width = 136
|
||||||
@ -133,18 +124,14 @@ tabView.fill(Pack.Right)
|
|||||||
resetToDefaultsButton.packRelativeTo(tabView, Pack.Below, align=Pack.Right)
|
resetToDefaultsButton.packRelativeTo(tabView, Pack.Below, align=Pack.Right)
|
||||||
tabView.fill(Pack.Below, margin=14)
|
tabView.fill(Pack.Below, margin=14)
|
||||||
tabView.setAnchor(Pack.UpperLeft, growX=True, growY=True)
|
tabView.setAnchor(Pack.UpperLeft, growX=True, growY=True)
|
||||||
scanTypePopup.packToCorner(Pack.UpperRight)
|
thresholdLayout = HLayout([thresholdLabel, thresholdSlider, thresholdValueLabel], filler=thresholdSlider)
|
||||||
scanTypeLabel.packRelativeTo(scanTypePopup, Pack.Left)
|
thresholdLayout.packToCorner(Pack.UpperLeft)
|
||||||
scanTypePopup.fill(Pack.Left)
|
thresholdLayout.fill(Pack.Right)
|
||||||
thresholdSlider.packRelativeTo(scanTypePopup, Pack.Below)
|
|
||||||
thresholdValueLabel.packRelativeTo(thresholdSlider, Pack.Right)
|
|
||||||
thresholdSlider.fill(Pack.Right)
|
|
||||||
# We want to give the labels as much space as possible, and we only "know" how much is available
|
# We want to give the labels as much space as possible, and we only "know" how much is available
|
||||||
# after the slider's fill operation.
|
# after the slider's fill operation.
|
||||||
moreResultsLabel.width = fewerResultsLabel.width = thresholdSlider.width // 2
|
moreResultsLabel.width = fewerResultsLabel.width = thresholdSlider.width // 2
|
||||||
moreResultsLabel.packRelativeTo(thresholdSlider, Pack.Below, align=Pack.Left, margin=6)
|
moreResultsLabel.packRelativeTo(thresholdSlider, Pack.Below, align=Pack.Left, margin=6)
|
||||||
fewerResultsLabel.packRelativeTo(thresholdSlider, Pack.Below, align=Pack.Right, margin=6)
|
fewerResultsLabel.packRelativeTo(thresholdSlider, Pack.Below, align=Pack.Right, margin=6)
|
||||||
thresholdLabel.packRelativeTo(thresholdSlider, Pack.Left)
|
|
||||||
fontSizeCombo.packRelativeTo(moreResultsLabel, Pack.Below)
|
fontSizeCombo.packRelativeTo(moreResultsLabel, Pack.Below)
|
||||||
fontSizeLabel.packRelativeTo(fontSizeCombo, Pack.Left)
|
fontSizeLabel.packRelativeTo(fontSizeCombo, Pack.Left)
|
||||||
|
|
||||||
|
@ -123,6 +123,9 @@ class PyDupeGuruBase(PyBaseApp):
|
|||||||
self.model.ignore_list_dialog.show()
|
self.model.ignore_list_dialog.show()
|
||||||
|
|
||||||
#---Information
|
#---Information
|
||||||
|
def getScanOptions(self) -> list:
|
||||||
|
return [o.label for o in self.model.SCANNER_CLASS.get_scan_options()]
|
||||||
|
|
||||||
def resultsAreModified(self) -> bool:
|
def resultsAreModified(self) -> bool:
|
||||||
return self.model.results.is_modified
|
return self.model.results.is_modified
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user