diff --git a/cocoa/base/DirectoryPanel.h b/cocoa/base/DirectoryPanel.h index 5c3d1356..03f738c0 100644 --- a/cocoa/base/DirectoryPanel.h +++ b/cocoa/base/DirectoryPanel.h @@ -21,6 +21,7 @@ http://www.gnu.org/licenses/gpl-3.0.html HSRecentFiles *_recentDirectories; DirectoryOutline *outline; BOOL _alwaysShowPopUp; + NSPopUpButton *scanTypePopup; NSPopUpButton *addButtonPopUp; NSPopUpButton *loadRecentButtonPopUp; HSOutlineView *outlineView; @@ -28,6 +29,7 @@ http://www.gnu.org/licenses/gpl-3.0.html NSButton *loadResultsButton; } +@property (readwrite, retain) NSPopUpButton *scanTypePopup; @property (readwrite, retain) NSPopUpButton *addButtonPopUp; @property (readwrite, retain) NSPopUpButton *loadRecentButtonPopUp; @property (readwrite, retain) HSOutlineView *outlineView; diff --git a/cocoa/base/DirectoryPanel.m b/cocoa/base/DirectoryPanel.m index 04c96a7e..322328f7 100644 --- a/cocoa/base/DirectoryPanel.m +++ b/cocoa/base/DirectoryPanel.m @@ -14,6 +14,7 @@ http://www.gnu.org/licenses/gpl-3.0.html @implementation DirectoryPanel +@synthesize scanTypePopup; @synthesize addButtonPopUp; @synthesize loadRecentButtonPopUp; @synthesize outlineView; @@ -27,6 +28,8 @@ http://www.gnu.org/licenses/gpl-3.0.html _app = aParentApp; model = [_app model]; [[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; [self fillPopUpMenu]; _recentDirectories = [[HSRecentFiles alloc] initWithName:@"recentDirectories" menu:[addButtonPopUp menu]]; diff --git a/cocoa/base/ui/directory_panel.py b/cocoa/base/ui/directory_panel.py index 291ce57a..01587102 100644 --- a/cocoa/base/ui/directory_panel.py +++ b/cocoa/base/ui/directory_panel.py @@ -5,6 +5,8 @@ result = Window(425, 300, "dupeGuru") promptLabel = Label(result, "Select folders to scan and press \"Scan\".") directoryOutline = OutlineView(result) directoryOutline.OBJC_CLASS = 'HSOutlineView' +scanTypePopup = Popup(result) +scanTypeLabel = Label(result, "Scan Type:") addButton = Button(result, "") removeButton = Button(result, "") loadResultsButton = Button(result, "Load Results") @@ -13,6 +15,7 @@ addPopup = Popup(None) loadRecentPopup = Popup(None) owner.outlineView = directoryOutline +owner.scanTypePopup = scanTypePopup owner.removeButton = removeButton owner.loadResultsButton = loadResultsButton owner.addButtonPopUp = addPopup @@ -46,19 +49,24 @@ directoryOutline.allowsColumnReordering = False directoryOutline.allowsColumnSelection = False directoryOutline.allowsMultipleSelection = True +scanTypeLabel.width = 90 +scanTypeLayout = HLayout([scanTypeLabel, scanTypePopup], filler=scanTypePopup) + for button in (addButton, removeButton): button.width = 28 for button in (loadResultsButton, scanButton): button.width = 118 buttonLayout = HLayout([addButton, removeButton, None, loadResultsButton, scanButton]) +bottomLayout = VLayout([None, scanTypeLayout, buttonLayout]) promptLabel.packToCorner(Pack.UpperLeft) promptLabel.fill(Pack.Right) directoryOutline.packRelativeTo(promptLabel, Pack.Below) -buttonLayout.packRelativeTo(directoryOutline, Pack.Below, margin=8) +bottomLayout.packRelativeTo(directoryOutline, Pack.Below, margin=8) directoryOutline.fill(Pack.LowerRight) -buttonLayout.fill(Pack.Right) +bottomLayout.fill(Pack.Right) promptLabel.setAnchor(Pack.UpperLeft, growX=True) directoryOutline.setAnchor(Pack.UpperLeft, growX=True, growY=True) +scanTypeLayout.setAnchor(Pack.Below) buttonLayout.setAnchor(Pack.Below) diff --git a/cocoa/base/ui/preferences_panel.py b/cocoa/base/ui/preferences_panel.py index df7bf585..84a170ed 100644 --- a/cocoa/base/ui/preferences_panel.py +++ b/cocoa/base/ui/preferences_panel.py @@ -5,22 +5,15 @@ dialogTitles = { 'pe': "dupeGuru PE Preferences", } dialogHeights = { - 'se': 345, - 'me': 365, - 'pe': 275, -} -scanTypeNames = { - 'se': ["Filename", "Content", "Folders"], - 'me': ["Filename", "Filename - Fields", "Filename - Fields (No Order)", "Tags", "Content", "Audio Content"], - 'pe': ["Contents", "EXIF Timestamp"], + 'se': 325, + 'me': 345, + 'pe': 255, } result = Window(410, dialogHeights[edition], dialogTitles[edition]) tabView = TabView(result) basicTab = tabView.addTab("Basic") advancedTab = tabView.addTab("Advanced") -scanTypePopup = Popup(basicTab.view, scanTypeNames[edition]) -scanTypeLabel = Label(basicTab.view, "Scan Type:") thresholdSlider = Slider(basicTab.view, 1, 100, 80) thresholdLabel = Label(basicTab.view, "Filter hardness:") 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"]) resetToDefaultsButton = Button(result, "Reset To Defaults") - -scanTypePopup.bind('selectedIndex', defaults, 'values.scanType') thresholdSlider.bind('value', defaults, 'values.minMatchPercentage') thresholdValueLabel.bind('value', defaults, 'values.minMatchPercentage') fontSizeCombo.bind('value', defaults, 'values.TableFontSize') @@ -98,7 +89,7 @@ result.canResize = False result.canMinimize = False thresholdValueLabel.formatter = NumberFormatter(NumberStyle.Decimal) thresholdValueLabel.formatter.maximumFractionDigits = 0 -allLabels = [scanTypeLabel, thresholdValueLabel, moreResultsLabel, fewerResultsLabel, +allLabels = [thresholdValueLabel, moreResultsLabel, fewerResultsLabel, thresholdLabel, fontSizeLabel, customCommandLabel, copyMoveLabel] allCheckboxes = [mixKindBox, removeEmptyFoldersBox, checkForUpdatesBox, regexpCheckbox, ignoreHardlinksBox, debugModeCheckbox] @@ -114,10 +105,10 @@ for label in allLabels: label.controlSize = ControlSize.Small fewerResultsLabel.alignment = TextAlignment.Right for checkbox in allCheckboxes: - checkbox.font = scanTypeLabel.font + checkbox.font = thresholdValueLabel.font resetToDefaultsButton.action = Action(defaults, 'revertToInitialValues:') -scanTypeLabel.width = thresholdLabel.width = fontSizeLabel.width = 94 +thresholdLabel.width = fontSizeLabel.width = 94 fontSizeCombo.width = 66 thresholdValueLabel.width = 25 resetToDefaultsButton.width = 136 @@ -133,18 +124,14 @@ tabView.fill(Pack.Right) resetToDefaultsButton.packRelativeTo(tabView, Pack.Below, align=Pack.Right) tabView.fill(Pack.Below, margin=14) tabView.setAnchor(Pack.UpperLeft, growX=True, growY=True) -scanTypePopup.packToCorner(Pack.UpperRight) -scanTypeLabel.packRelativeTo(scanTypePopup, Pack.Left) -scanTypePopup.fill(Pack.Left) -thresholdSlider.packRelativeTo(scanTypePopup, Pack.Below) -thresholdValueLabel.packRelativeTo(thresholdSlider, Pack.Right) -thresholdSlider.fill(Pack.Right) +thresholdLayout = HLayout([thresholdLabel, thresholdSlider, thresholdValueLabel], filler=thresholdSlider) +thresholdLayout.packToCorner(Pack.UpperLeft) +thresholdLayout.fill(Pack.Right) # 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. moreResultsLabel.width = fewerResultsLabel.width = thresholdSlider.width // 2 moreResultsLabel.packRelativeTo(thresholdSlider, Pack.Below, align=Pack.Left, margin=6) fewerResultsLabel.packRelativeTo(thresholdSlider, Pack.Below, align=Pack.Right, margin=6) -thresholdLabel.packRelativeTo(thresholdSlider, Pack.Left) fontSizeCombo.packRelativeTo(moreResultsLabel, Pack.Below) fontSizeLabel.packRelativeTo(fontSizeCombo, Pack.Left) diff --git a/cocoa/inter/app.py b/cocoa/inter/app.py index 496853be..f15e5a24 100644 --- a/cocoa/inter/app.py +++ b/cocoa/inter/app.py @@ -123,6 +123,9 @@ class PyDupeGuruBase(PyBaseApp): self.model.ignore_list_dialog.show() #---Information + def getScanOptions(self) -> list: + return [o.label for o in self.model.SCANNER_CLASS.get_scan_options()] + def resultsAreModified(self) -> bool: return self.model.results.is_modified