mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Change preferences to use spinboxes where applicable
- Change LineEdit to Spinbox for minimum file size 0-1,000,000KB - Change LineEdit to Spinbox for big file size 0-1,000,000MB
This commit is contained in:
parent
e11f996dfc
commit
99ad297906
@ -6,17 +6,16 @@
|
|||||||
|
|
||||||
from PyQt5.QtCore import QSize
|
from PyQt5.QtCore import QSize
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
|
QSpinBox,
|
||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
QHBoxLayout,
|
QHBoxLayout,
|
||||||
QLabel,
|
QLabel,
|
||||||
QSizePolicy,
|
QSizePolicy,
|
||||||
QSpacerItem,
|
QSpacerItem,
|
||||||
QWidget,
|
QWidget,
|
||||||
QLineEdit,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from hscommon.trans import trget
|
from hscommon.trans import trget
|
||||||
from hscommon.util import tryint
|
|
||||||
|
|
||||||
from core.app import AppMode
|
from core.app import AppMode
|
||||||
from core.scanner import ScanType
|
from core.scanner import ScanType
|
||||||
@ -56,16 +55,17 @@ class PreferencesDialog(PreferencesDialogBase):
|
|||||||
"ignoreSmallFilesBox", tr("Ignore files smaller than"), self.widget
|
"ignoreSmallFilesBox", tr("Ignore files smaller than"), self.widget
|
||||||
)
|
)
|
||||||
self.horizontalLayout_2.addWidget(self.ignoreSmallFilesBox)
|
self.horizontalLayout_2.addWidget(self.ignoreSmallFilesBox)
|
||||||
self.sizeThresholdEdit = QLineEdit(self.widget)
|
self.sizeThresholdSpinBox = QSpinBox(self.widget)
|
||||||
sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
|
sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(
|
sizePolicy.setHeightForWidth(
|
||||||
self.sizeThresholdEdit.sizePolicy().hasHeightForWidth()
|
self.sizeThresholdSpinBox.sizePolicy().hasHeightForWidth()
|
||||||
)
|
)
|
||||||
self.sizeThresholdEdit.setSizePolicy(sizePolicy)
|
self.sizeThresholdSpinBox.setSizePolicy(sizePolicy)
|
||||||
self.sizeThresholdEdit.setMaximumSize(QSize(50, 16777215))
|
self.sizeThresholdSpinBox.setMaximumSize(QSize(100, 16777215))
|
||||||
self.horizontalLayout_2.addWidget(self.sizeThresholdEdit)
|
self.sizeThresholdSpinBox.setRange(0, 1000000)
|
||||||
|
self.horizontalLayout_2.addWidget(self.sizeThresholdSpinBox)
|
||||||
self.label_6 = QLabel(self.widget)
|
self.label_6 = QLabel(self.widget)
|
||||||
self.label_6.setText(tr("KB"))
|
self.label_6.setText(tr("KB"))
|
||||||
self.horizontalLayout_2.addWidget(self.label_6)
|
self.horizontalLayout_2.addWidget(self.label_6)
|
||||||
@ -74,13 +74,16 @@ class PreferencesDialog(PreferencesDialogBase):
|
|||||||
self.verticalLayout_4.addLayout(self.horizontalLayout_2)
|
self.verticalLayout_4.addLayout(self.horizontalLayout_2)
|
||||||
self.horizontalLayout_2b = QHBoxLayout()
|
self.horizontalLayout_2b = QHBoxLayout()
|
||||||
self._setupAddCheckbox(
|
self._setupAddCheckbox(
|
||||||
"bigFilePartialHashesBox", tr("Partially hash files bigger than"), self.widget
|
"bigFilePartialHashesBox",
|
||||||
|
tr("Partially hash files bigger than"),
|
||||||
|
self.widget,
|
||||||
)
|
)
|
||||||
self.horizontalLayout_2b.addWidget(self.bigFilePartialHashesBox)
|
self.horizontalLayout_2b.addWidget(self.bigFilePartialHashesBox)
|
||||||
self.bigSizeThresholdEdit = QLineEdit(self.widget)
|
self.bigSizeThresholdSpinBox = QSpinBox(self.widget)
|
||||||
self.bigSizeThresholdEdit.setSizePolicy(sizePolicy)
|
self.bigSizeThresholdSpinBox.setSizePolicy(sizePolicy)
|
||||||
self.bigSizeThresholdEdit.setMaximumSize(QSize(75, 16777215))
|
self.bigSizeThresholdSpinBox.setMaximumSize(QSize(100, 16777215))
|
||||||
self.horizontalLayout_2b.addWidget(self.bigSizeThresholdEdit)
|
self.bigSizeThresholdSpinBox.setRange(0, 1000000)
|
||||||
|
self.horizontalLayout_2b.addWidget(self.bigSizeThresholdSpinBox)
|
||||||
self.label_6b = QLabel(self.widget)
|
self.label_6b = QLabel(self.widget)
|
||||||
self.label_6b.setText(tr("MB"))
|
self.label_6b.setText(tr("MB"))
|
||||||
self.horizontalLayout_2b.addWidget(self.label_6b)
|
self.horizontalLayout_2b.addWidget(self.label_6b)
|
||||||
@ -104,9 +107,9 @@ class PreferencesDialog(PreferencesDialogBase):
|
|||||||
setchecked(self.matchSimilarBox, prefs.match_similar)
|
setchecked(self.matchSimilarBox, prefs.match_similar)
|
||||||
setchecked(self.wordWeightingBox, prefs.word_weighting)
|
setchecked(self.wordWeightingBox, prefs.word_weighting)
|
||||||
setchecked(self.ignoreSmallFilesBox, prefs.ignore_small_files)
|
setchecked(self.ignoreSmallFilesBox, prefs.ignore_small_files)
|
||||||
self.sizeThresholdEdit.setText(str(prefs.small_file_threshold))
|
self.sizeThresholdSpinBox.setValue(prefs.small_file_threshold)
|
||||||
setchecked(self.bigFilePartialHashesBox, prefs.big_file_partial_hashes)
|
setchecked(self.bigFilePartialHashesBox, prefs.big_file_partial_hashes)
|
||||||
self.bigSizeThresholdEdit.setText(str(prefs.big_file_size_threshold))
|
self.bigSizeThresholdSpinBox.setValue(prefs.big_file_size_threshold)
|
||||||
|
|
||||||
# Update UI state based on selected scan type
|
# Update UI state based on selected scan type
|
||||||
scan_type = prefs.get_scan_type(AppMode.Standard)
|
scan_type = prefs.get_scan_type(AppMode.Standard)
|
||||||
@ -119,6 +122,6 @@ class PreferencesDialog(PreferencesDialogBase):
|
|||||||
prefs.match_similar = ischecked(self.matchSimilarBox)
|
prefs.match_similar = ischecked(self.matchSimilarBox)
|
||||||
prefs.word_weighting = ischecked(self.wordWeightingBox)
|
prefs.word_weighting = ischecked(self.wordWeightingBox)
|
||||||
prefs.ignore_small_files = ischecked(self.ignoreSmallFilesBox)
|
prefs.ignore_small_files = ischecked(self.ignoreSmallFilesBox)
|
||||||
prefs.small_file_threshold = tryint(self.sizeThresholdEdit.text())
|
prefs.small_file_threshold = self.sizeThresholdSpinBox.value()
|
||||||
prefs.big_file_partial_hashes = ischecked(self.bigFilePartialHashesBox)
|
prefs.big_file_partial_hashes = ischecked(self.bigFilePartialHashesBox)
|
||||||
prefs.big_file_size_threshold = tryint(self.bigSizeThresholdEdit.text())
|
prefs.big_file_size_threshold = self.bigSizeThresholdSpinBox.value()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user