From 2688bb37517cbb5e19db619c6272865ef7e7dddc Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Sun, 26 Oct 2014 13:38:07 +0100 Subject: [PATCH] Separate the file browser show hidden files option from the option to ignore hidden files on load. --- picard/tagger.py | 4 +-- picard/ui/options/advanced.py | 3 ++ picard/ui/ui_options_advanced.py | 8 +++-- ui/options_advanced.ui | 51 ++++++++++++++++++-------------- 4 files changed, 40 insertions(+), 26 deletions(-) diff --git a/picard/tagger.py b/picard/tagger.py index 1727bef5b..19253ad13 100644 --- a/picard/tagger.py +++ b/picard/tagger.py @@ -341,7 +341,7 @@ class Tagger(QtGui.QApplication): pattern = config.setting['ignore_regex'] if pattern: ignoreregex = re.compile(pattern) - ignore_hidden = not config.persist["show_hidden_files"] + ignore_hidden = config.setting["ignore_hidden_files"] new_files = [] for filename in filenames: filename = os.path.normpath(os.path.realpath(filename)) @@ -366,7 +366,7 @@ class Tagger(QtGui.QApplication): file.load(partial(self._file_loaded, target=target)) def add_directory(self, path): - ignore_hidden = not config.persist["show_hidden_files"] + ignore_hidden = config.setting["ignore_hidden_files"] walk = os.walk(unicode(path)) def get_files(): diff --git a/picard/ui/options/advanced.py b/picard/ui/options/advanced.py index 2f37b1e9b..734e2fea7 100644 --- a/picard/ui/options/advanced.py +++ b/picard/ui/options/advanced.py @@ -35,6 +35,7 @@ class AdvancedOptionsPage(OptionsPage): options = [ config.TextOption("setting", "ignore_regex", ""), + config.BoolOption("setting", "ignore_hidden_files", False), ] def __init__(self, parent=None): @@ -45,9 +46,11 @@ class AdvancedOptionsPage(OptionsPage): def load(self): self.ui.ignore_regex.setText(config.setting["ignore_regex"]) + self.ui.ignore_hidden_files.setChecked(config.setting["ignore_hidden_files"]) def save(self): config.setting["ignore_regex"] = unicode(self.ui.ignore_regex.text()) + config.setting["ignore_hidden_files"] = self.ui.ignore_hidden_files.isChecked() def live_checker(self, text): self.ui.regex_error.setStyleSheet("") diff --git a/picard/ui/ui_options_advanced.py b/picard/ui/ui_options_advanced.py index d95690e37..0b819ff05 100644 --- a/picard/ui/ui_options_advanced.py +++ b/picard/ui/ui_options_advanced.py @@ -13,7 +13,7 @@ except AttributeError: class Ui_AdvancedOptionsPage(object): def setupUi(self, AdvancedOptionsPage): AdvancedOptionsPage.setObjectName(_fromUtf8("AdvancedOptionsPage")) - AdvancedOptionsPage.resize(338, 435) + AdvancedOptionsPage.resize(392, 435) self.vboxlayout = QtGui.QVBoxLayout(AdvancedOptionsPage) self.vboxlayout.setObjectName(_fromUtf8("vboxlayout")) self.groupBox = QtGui.QGroupBox(AdvancedOptionsPage) @@ -30,7 +30,10 @@ class Ui_AdvancedOptionsPage(object): self.regex_error = QtGui.QLabel(self.groupBox) self.regex_error.setText(_fromUtf8("")) self.regex_error.setObjectName(_fromUtf8("regex_error")) - self.gridlayout.addWidget(self.regex_error, 3, 0, 1, 1) + self.gridlayout.addWidget(self.regex_error, 4, 0, 1, 1) + self.ignore_hidden_files = QtGui.QCheckBox(self.groupBox) + self.ignore_hidden_files.setObjectName(_fromUtf8("ignore_hidden_files")) + self.gridlayout.addWidget(self.ignore_hidden_files, 3, 0, 1, 1) self.vboxlayout.addWidget(self.groupBox) spacerItem = QtGui.QSpacerItem(181, 21, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.vboxlayout.addItem(spacerItem) @@ -41,4 +44,5 @@ class Ui_AdvancedOptionsPage(object): def retranslateUi(self, AdvancedOptionsPage): self.groupBox.setTitle(_("Advanced options")) self.label_ignore_regex.setText(_("Ignore file paths matching the following regular expression:")) + self.ignore_hidden_files.setText(_("Ignore hidden files")) diff --git a/ui/options_advanced.ui b/ui/options_advanced.ui index 0d8a399c5..23d3d624d 100644 --- a/ui/options_advanced.ui +++ b/ui/options_advanced.ui @@ -6,7 +6,7 @@ 0 0 - 338 + 392 435 @@ -16,27 +16,34 @@ Advanced options - - - 2 - - - - - Ignore file paths matching the following regular expression: - - - - - - - - - - - - - + + + 2 + + + + + Ignore file paths matching the following regular expression: + + + + + + + + + + + + + + + + + Ignore hidden files + + +