mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 06:37:17 +00:00
Add option to profile scans
- Add preference for profiling scans - Move debug options to tab in preferences - Add label with clickable link to debug output (appdata) to debug tab in preferences - Update translation source files
This commit is contained in:
@@ -356,7 +356,7 @@ class DirectoriesDialog(QMainWindow):
|
||||
msg = tr("You have unsaved results, do you really want to continue?")
|
||||
if not self.app.confirm(title, msg):
|
||||
return
|
||||
self.app.model.start_scanning()
|
||||
self.app.model.start_scanning(self.app.prefs.profile_scan)
|
||||
|
||||
def scanTypeChanged(self, index):
|
||||
scan_options = self.app.model.SCANNER_CLASS.get_scan_options()
|
||||
|
||||
@@ -68,8 +68,6 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
tr("Ignore duplicates hardlinking to the same file"),
|
||||
)
|
||||
self.widgetsVLayout.addWidget(self.ignoreHardlinkMatches)
|
||||
self._setupAddCheckbox("debugModeBox", tr("Debug mode (restart required)"))
|
||||
self.widgetsVLayout.addWidget(self.debugModeBox)
|
||||
self._setupBottomPart()
|
||||
|
||||
def _load(self, prefs, setchecked, section):
|
||||
|
||||
@@ -34,8 +34,6 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
tr("Ignore duplicates hardlinking to the same file"),
|
||||
)
|
||||
self.widgetsVLayout.addWidget(self.ignoreHardlinkMatches)
|
||||
self._setupAddCheckbox("debugModeBox", tr("Debug mode (restart required)"))
|
||||
self.widgetsVLayout.addWidget(self.debugModeBox)
|
||||
|
||||
self.cacheTypeRadio = RadioBox(self, items=["Sqlite", "Shelve"], spread=False)
|
||||
cache_form = QFormLayout()
|
||||
|
||||
@@ -24,6 +24,7 @@ class Preferences(PreferencesBase):
|
||||
self.use_regexp = get("UseRegexp", self.use_regexp)
|
||||
self.remove_empty_folders = get("RemoveEmptyFolders", self.remove_empty_folders)
|
||||
self.debug_mode = get("DebugMode", self.debug_mode)
|
||||
self.profile_scan = get("ProfileScan", self.profile_scan)
|
||||
self.destination_type = get("DestinationType", self.destination_type)
|
||||
self.custom_command = get("CustomCommand", self.custom_command)
|
||||
self.language = get("Language", self.language)
|
||||
@@ -93,6 +94,7 @@ class Preferences(PreferencesBase):
|
||||
self.ignore_hardlink_matches = False
|
||||
self.remove_empty_folders = False
|
||||
self.debug_mode = False
|
||||
self.profile_scan = False
|
||||
self.destination_type = 1
|
||||
self.custom_command = ""
|
||||
self.language = trans.installed_lang if trans.installed_lang else ""
|
||||
@@ -144,6 +146,7 @@ class Preferences(PreferencesBase):
|
||||
set_("UseRegexp", self.use_regexp)
|
||||
set_("RemoveEmptyFolders", self.remove_empty_folders)
|
||||
set_("DebugMode", self.debug_mode)
|
||||
set_("ProfileScan", self.profile_scan)
|
||||
set_("DestinationType", self.destination_type)
|
||||
set_("CustomCommand", self.custom_command)
|
||||
set_("Language", self.language)
|
||||
|
||||
@@ -29,7 +29,7 @@ from PyQt5.QtWidgets import (
|
||||
QFormLayout,
|
||||
)
|
||||
from PyQt5.QtGui import QPixmap, QIcon
|
||||
from hscommon import plat
|
||||
from hscommon import desktop, plat
|
||||
|
||||
from hscommon.trans import trget
|
||||
from hscommon.plat import ISLINUX
|
||||
@@ -69,7 +69,8 @@ class Sections(Flag):
|
||||
|
||||
GENERAL = auto()
|
||||
DISPLAY = auto()
|
||||
ALL = GENERAL | DISPLAY
|
||||
DEBUG = auto()
|
||||
ALL = GENERAL | DISPLAY | DEBUG
|
||||
|
||||
|
||||
class PreferencesDialogBase(QDialog):
|
||||
@@ -82,6 +83,7 @@ class PreferencesDialogBase(QDialog):
|
||||
self._setupUi()
|
||||
|
||||
self.filterHardnessSlider.valueChanged["int"].connect(self.filterHardnessLabel.setNum)
|
||||
self.debug_location_label.linkActivated.connect(desktop.open_path)
|
||||
self.buttonBox.clicked.connect(self.buttonClicked)
|
||||
self.buttonBox.accepted.connect(self.accept)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
@@ -234,6 +236,18 @@ use the modifier key to drag the floating window around"
|
||||
details_groupbox.setLayout(self.details_groupbox_layout)
|
||||
self.displayVLayout.addWidget(details_groupbox)
|
||||
|
||||
def _setupDebugPage(self):
|
||||
self._setupAddCheckbox("debugModeBox", tr("Debug mode (restart required)"))
|
||||
self._setupAddCheckbox("profile_scan_box", tr("Profile scan operation"))
|
||||
self.profile_scan_box.setToolTip(tr("Profile the scan operation and save logs for optimization."))
|
||||
self.debugVLayout.addWidget(self.debugModeBox)
|
||||
self.debugVLayout.addWidget(self.profile_scan_box)
|
||||
self.debug_location_label = QLabel(
|
||||
tr('Logs located in: <a href="{}">{}</a>').format(self.app.model.appdata, self.app.model.appdata),
|
||||
wordWrap=True,
|
||||
)
|
||||
self.debugVLayout.addWidget(self.debug_location_label)
|
||||
|
||||
def _setupAddCheckbox(self, name, label, parent=None):
|
||||
if parent is None:
|
||||
parent = self
|
||||
@@ -253,13 +267,17 @@ use the modifier key to drag the floating window around"
|
||||
self.tabwidget = QTabWidget()
|
||||
self.page_general = QWidget()
|
||||
self.page_display = QWidget()
|
||||
self.page_debug = QWidget()
|
||||
self.widgetsVLayout = QVBoxLayout()
|
||||
self.page_general.setLayout(self.widgetsVLayout)
|
||||
self.displayVLayout = QVBoxLayout()
|
||||
self.displayVLayout.setSpacing(5) # arbitrary value, might conflict with style
|
||||
self.page_display.setLayout(self.displayVLayout)
|
||||
self.debugVLayout = QVBoxLayout()
|
||||
self.page_debug.setLayout(self.debugVLayout)
|
||||
self._setupPreferenceWidgets()
|
||||
self._setupDisplayPage()
|
||||
self._setupDebugPage()
|
||||
# self.mainVLayout.addLayout(self.widgetsVLayout)
|
||||
self.buttonBox = QDialogButtonBox(self)
|
||||
self.buttonBox.setStandardButtons(
|
||||
@@ -270,8 +288,10 @@ use the modifier key to drag the floating window around"
|
||||
self.layout().setSizeConstraint(QLayout.SetFixedSize)
|
||||
self.tabwidget.addTab(self.page_general, tr("General"))
|
||||
self.tabwidget.addTab(self.page_display, tr("Display"))
|
||||
self.tabwidget.addTab(self.page_debug, tr("Debug"))
|
||||
self.displayVLayout.addStretch(0)
|
||||
self.widgetsVLayout.addStretch(0)
|
||||
self.debugVLayout.addStretch(0)
|
||||
|
||||
def _load(self, prefs, setchecked, section):
|
||||
# Edition-specific
|
||||
@@ -295,7 +315,6 @@ use the modifier key to drag the floating window around"
|
||||
setchecked(self.useRegexpBox, prefs.use_regexp)
|
||||
setchecked(self.removeEmptyFoldersBox, prefs.remove_empty_folders)
|
||||
setchecked(self.ignoreHardlinkMatches, prefs.ignore_hardlink_matches)
|
||||
setchecked(self.debugModeBox, prefs.debug_mode)
|
||||
self.copyMoveDestinationComboBox.setCurrentIndex(prefs.destination_type)
|
||||
self.customCommandEdit.setText(prefs.custom_command)
|
||||
if section & Sections.DISPLAY:
|
||||
@@ -322,6 +341,9 @@ use the modifier key to drag the floating window around"
|
||||
except ValueError:
|
||||
langindex = 0
|
||||
self.languageComboBox.setCurrentIndex(langindex)
|
||||
if section & Sections.DEBUG:
|
||||
setchecked(self.debugModeBox, prefs.debug_mode)
|
||||
setchecked(self.profile_scan_box, prefs.profile_scan)
|
||||
self._load(prefs, setchecked, section)
|
||||
|
||||
def save(self):
|
||||
@@ -336,6 +358,7 @@ use the modifier key to drag the floating window around"
|
||||
prefs.remove_empty_folders = ischecked(self.removeEmptyFoldersBox)
|
||||
prefs.ignore_hardlink_matches = ischecked(self.ignoreHardlinkMatches)
|
||||
prefs.debug_mode = ischecked(self.debugModeBox)
|
||||
prefs.profile_scan = ischecked(self.profile_scan_box)
|
||||
prefs.reference_bold_font = ischecked(self.reference_bold_font)
|
||||
prefs.details_dialog_titlebar_enabled = ischecked(self.details_dialog_titlebar_enabled)
|
||||
prefs.details_dialog_vertical_titlebar = ischecked(self.details_dialog_vertical_titlebar)
|
||||
@@ -376,6 +399,8 @@ use the modifier key to drag the floating window around"
|
||||
section_to_update = Sections.GENERAL
|
||||
if current_tab is self.page_display:
|
||||
section_to_update = Sections.DISPLAY
|
||||
if current_tab is self.page_debug:
|
||||
section_to_update = Sections.DEBUG
|
||||
self.resetToDefaults(section_to_update)
|
||||
|
||||
def showEvent(self, event):
|
||||
|
||||
@@ -103,8 +103,6 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
self.widget,
|
||||
)
|
||||
self.verticalLayout_4.addWidget(self.ignoreHardlinkMatches)
|
||||
self._setupAddCheckbox("debugModeBox", tr("Debug mode (restart required)"), self.widget)
|
||||
self.verticalLayout_4.addWidget(self.debugModeBox)
|
||||
self.widgetsVLayout.addWidget(self.widget)
|
||||
self._setupBottomPart()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user