mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
Added tox configuration
... and fixed pep8 warnings. There's a lot of them that are still ignored, but that's because it's too much of a step to take at once.
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
# Created By: Virgil Dupras
|
||||
# Created On: 2009-04-29
|
||||
# Copyright 2014 Hardcoded Software (http://www.hardcoded.net)
|
||||
#
|
||||
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||
# which should be included with this package. The terms are also available at
|
||||
#
|
||||
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
import sys
|
||||
from PyQt5.QtCore import QSize
|
||||
from PyQt5.QtWidgets import (QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QWidget,
|
||||
QApplication)
|
||||
from PyQt5.QtWidgets import (
|
||||
QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QWidget,
|
||||
QApplication
|
||||
)
|
||||
|
||||
from hscommon.trans import trget
|
||||
from core.scanner import ScanType
|
||||
@@ -31,9 +33,9 @@ SCAN_TYPE_ORDER = [
|
||||
class PreferencesDialog(PreferencesDialogBase):
|
||||
def __init__(self, parent, app):
|
||||
PreferencesDialogBase.__init__(self, parent, app)
|
||||
|
||||
|
||||
self.scanTypeComboBox.currentIndexChanged[int].connect(self.scanTypeChanged)
|
||||
|
||||
|
||||
def _setupPreferenceWidgets(self):
|
||||
scanTypeLabels = [
|
||||
tr("Filename"),
|
||||
@@ -87,7 +89,7 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
self._setupAddCheckbox('debugModeBox', tr("Debug mode (restart required)"))
|
||||
self.widgetsVLayout.addWidget(self.debugModeBox)
|
||||
self._setupBottomPart()
|
||||
|
||||
|
||||
def _load(self, prefs, setchecked):
|
||||
scan_type_index = SCAN_TYPE_ORDER.index(prefs.scan_type)
|
||||
self.scanTypeComboBox.setCurrentIndex(scan_type_index)
|
||||
@@ -99,7 +101,7 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
setchecked(self.tagYearBox, prefs.scan_tag_year)
|
||||
setchecked(self.matchSimilarBox, prefs.match_similar)
|
||||
setchecked(self.wordWeightingBox, prefs.word_weighting)
|
||||
|
||||
|
||||
def _save(self, prefs, ischecked):
|
||||
prefs.scan_type = SCAN_TYPE_ORDER[self.scanTypeComboBox.currentIndex()]
|
||||
prefs.scan_tag_track = ischecked(self.tagTrackBox)
|
||||
@@ -110,15 +112,17 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
prefs.scan_tag_year = ischecked(self.tagYearBox)
|
||||
prefs.match_similar = ischecked(self.matchSimilarBox)
|
||||
prefs.word_weighting = ischecked(self.wordWeightingBox)
|
||||
|
||||
|
||||
def resetToDefaults(self):
|
||||
self.load(preferences.Preferences())
|
||||
|
||||
|
||||
#--- Events
|
||||
def scanTypeChanged(self, index):
|
||||
scan_type = SCAN_TYPE_ORDER[self.scanTypeComboBox.currentIndex()]
|
||||
word_based = scan_type in (ScanType.Filename, ScanType.Fields, ScanType.FieldsNoOrder,
|
||||
ScanType.Tag)
|
||||
word_based = scan_type in (
|
||||
ScanType.Filename, ScanType.Fields, ScanType.FieldsNoOrder,
|
||||
ScanType.Tag
|
||||
)
|
||||
tag_based = scan_type == ScanType.Tag
|
||||
self.filterHardnessSlider.setEnabled(word_based)
|
||||
self.matchSimilarBox.setEnabled(word_based)
|
||||
@@ -129,7 +133,7 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
self.tagTitleBox.setEnabled(tag_based)
|
||||
self.tagGenreBox.setEnabled(tag_based)
|
||||
self.tagYearBox.setEnabled(tag_based)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from ..testapp import TestApp
|
||||
@@ -137,4 +141,5 @@ if __name__ == '__main__':
|
||||
dgapp = TestApp()
|
||||
dialog = PreferencesDialog(None, dgapp)
|
||||
dialog.show()
|
||||
sys.exit(app.exec_())
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user