1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-05-08 09:49:51 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
2e13c4ccb5
Update internationalization files 2021-08-24 03:54:54 -05:00
da72ffd1fd
Add ability to use non-native dialog for directories
- Add preference for native dialogs
- Add non-native directory selection to allow selecting multiple folders
  fixes #874 when using non-native.
2021-08-24 03:52:43 -05:00
2c9437bef4
Fix #897 2021-08-24 03:13:03 -05:00
6 changed files with 64 additions and 31 deletions

View File

@ -36,79 +36,79 @@ msgstr ""
msgid "Sending to Trash" msgid "Sending to Trash"
msgstr "" msgstr ""
#: core\app.py:290 #: core\app.py:287
msgid "A previous action is still hanging in there. You can't start a new one yet. Wait a few seconds, then try again." msgid "A previous action is still hanging in there. You can't start a new one yet. Wait a few seconds, then try again."
msgstr "" msgstr ""
#: core\app.py:300 #: core\app.py:297
msgid "No duplicates found." msgid "No duplicates found."
msgstr "" msgstr ""
#: core\app.py:315 #: core\app.py:312
msgid "All marked files were copied successfully." msgid "All marked files were copied successfully."
msgstr "" msgstr ""
#: core\app.py:316 #: core\app.py:313
msgid "All marked files were moved successfully." msgid "All marked files were moved successfully."
msgstr "" msgstr ""
#: core\app.py:317 #: core\app.py:314
msgid "All marked files were successfully sent to Trash." msgid "All marked files were successfully sent to Trash."
msgstr "" msgstr ""
#: core\app.py:323 #: core\app.py:320
msgid "Could not load file: {}" msgid "Could not load file: {}"
msgstr "" msgstr ""
#: core\app.py:379 #: core\app.py:376
msgid "'{}' already is in the list." msgid "'{}' already is in the list."
msgstr "" msgstr ""
#: core\app.py:381 #: core\app.py:378
msgid "'{}' does not exist." msgid "'{}' does not exist."
msgstr "" msgstr ""
#: core\app.py:389 #: core\app.py:386
msgid "All selected %d matches are going to be ignored in all subsequent scans. Continue?" msgid "All selected %d matches are going to be ignored in all subsequent scans. Continue?"
msgstr "" msgstr ""
#: core\app.py:463 #: core\app.py:460
msgid "Select a directory to copy marked files to" msgid "Select a directory to copy marked files to"
msgstr "" msgstr ""
#: core\app.py:465 #: core\app.py:462
msgid "Select a directory to move marked files to" msgid "Select a directory to move marked files to"
msgstr "" msgstr ""
#: core\app.py:504 #: core\app.py:501
msgid "Select a destination for your exported CSV" msgid "Select a destination for your exported CSV"
msgstr "" msgstr ""
#: core\app.py:510 core\app.py:764 core\app.py:774 #: core\app.py:507 core\app.py:761 core\app.py:771
msgid "Couldn't write to file: {}" msgid "Couldn't write to file: {}"
msgstr "" msgstr ""
#: core\app.py:533 #: core\app.py:530
msgid "You have no custom command set up. Set it up in your preferences." msgid "You have no custom command set up. Set it up in your preferences."
msgstr "" msgstr ""
#: core\app.py:691 core\app.py:703 #: core\app.py:688 core\app.py:700
msgid "You are about to remove %d files from results. Continue?" msgid "You are about to remove %d files from results. Continue?"
msgstr "" msgstr ""
#: core\app.py:739 #: core\app.py:736
msgid "{} duplicate groups were changed by the re-prioritization." msgid "{} duplicate groups were changed by the re-prioritization."
msgstr "" msgstr ""
#: core\app.py:783 #: core\app.py:780
msgid "The selected directories contain no scannable file." msgid "The selected directories contain no scannable file."
msgstr "" msgstr ""
#: core\app.py:796 #: core\app.py:793
msgid "Collecting files to scan" msgid "Collecting files to scan"
msgstr "" msgstr ""
#: core\app.py:843 #: core\app.py:840
msgid "%s (%d discarded)" msgid "%s (%d discarded)"
msgstr "" msgstr ""

View File

@ -913,3 +913,13 @@ msgstr ""
#: qt\se\preferences_dialog.py:80 #: qt\se\preferences_dialog.py:80
msgid "MB" msgid "MB"
msgstr "" msgstr ""
#: qt\preferences_dialog.py:163
msgid "Use native OS dialogs"
msgstr ""
#: qt\preferences_dialog.py:166
msgid ""
"For actions such as file/folder selection use the OS native dialogs.\n"
"Some native dialogs have limited functionality."
msgstr ""

View File

@ -6,6 +6,7 @@
from PyQt5.QtCore import QRect, Qt from PyQt5.QtCore import QRect, Qt
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QListView,
QWidget, QWidget,
QFileDialog, QFileDialog,
QHeaderView, QHeaderView,
@ -285,14 +286,25 @@ class DirectoriesDialog(QMainWindow):
# --- Events # --- Events
def addFolderTriggered(self): def addFolderTriggered(self):
no_native = not self.app.prefs.use_native_dialogs
title = tr("Select a folder to add to the scanning list") title = tr("Select a folder to add to the scanning list")
flags = QFileDialog.ShowDirsOnly file_dialog = QFileDialog(self, title, self.lastAddedFolder)
dirpath = str(QFileDialog.getExistingDirectory(self, title, self.lastAddedFolder, flags)) file_dialog.setFileMode(QFileDialog.DirectoryOnly)
if not dirpath: file_dialog.setOption(QFileDialog.DontUseNativeDialog, no_native)
if no_native:
file_view = file_dialog.findChild(QListView, "listView")
if file_view:
file_view.setSelectionMode(QAbstractItemView.MultiSelection)
f_tree_view = file_dialog.findChild(QTreeView)
if f_tree_view:
f_tree_view.setSelectionMode(QAbstractItemView.MultiSelection)
if not file_dialog.exec():
return return
self.lastAddedFolder = dirpath
self.app.model.add_directory(dirpath) paths = file_dialog.selectedFiles()
self.recentFolders.insertItem(dirpath) self.lastAddedFolder = paths[-1]
[self.app.model.add_directory(path) for path in paths]
[self.recentFolders.insertItem(path) for path in paths]
def appModeButtonSelected(self, index): def appModeButtonSelected(self, index):
if index == 2: if index == 2:

View File

@ -6,8 +6,6 @@
# which should be included with this package. The terms are also available at # which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html # http://www.gnu.org/licenses/gpl-3.0.html
import urllib.parse
from PyQt5.QtCore import pyqtSignal, Qt, QRect, QUrl, QModelIndex, QItemSelection from PyQt5.QtCore import pyqtSignal, Qt, QRect, QUrl, QModelIndex, QItemSelection
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QComboBox, QComboBox,
@ -105,13 +103,11 @@ class DirectoriesModel(TreeModel):
return None return None
def dropMimeData(self, mime_data, action, row, column, parent_index): def dropMimeData(self, mime_data, action, row, column, parent_index):
# the data in mimeData is urlencoded **in utf-8**!!! What we do is to decode, the mime data # the data in mimeData is urlencoded **in utf-8**
# with 'ascii', which works since it's urlencoded. Then, we pass that to urllib.
if not mime_data.hasFormat("text/uri-list"): if not mime_data.hasFormat("text/uri-list"):
return False return False
data = bytes(mime_data.data("text/uri-list")).decode("ascii") data = bytes(mime_data.data("text/uri-list")).decode("ascii")
unquoted = urllib.parse.unquote(data) urls = data.split("\r\n")
urls = unquoted.split("\r\n")
paths = [QUrl(url).toLocalFile() for url in urls if url] paths = [QUrl(url).toLocalFile() for url in urls if url]
for path in paths: for path in paths:
self.model.add_directory(path) self.model.add_directory(path)

View File

@ -30,6 +30,7 @@ class Preferences(PreferencesBase):
if not self.language and trans.installed_lang: if not self.language and trans.installed_lang:
self.language = trans.installed_lang self.language = trans.installed_lang
self.portable = get("Portable", False) self.portable = get("Portable", False)
self.use_native_dialogs = get("UseNativeDialogs", True)
self.tableFontSize = get("TableFontSize", self.tableFontSize) self.tableFontSize = get("TableFontSize", self.tableFontSize)
self.reference_bold_font = get("ReferenceBoldFont", self.reference_bold_font) self.reference_bold_font = get("ReferenceBoldFont", self.reference_bold_font)
@ -92,6 +93,7 @@ class Preferences(PreferencesBase):
self.destination_type = 1 self.destination_type = 1
self.custom_command = "" self.custom_command = ""
self.language = trans.installed_lang if trans.installed_lang else "" self.language = trans.installed_lang if trans.installed_lang else ""
self.use_native_dialogs = True
self.tableFontSize = QApplication.font().pointSize() self.tableFontSize = QApplication.font().pointSize()
self.reference_bold_font = True self.reference_bold_font = True
@ -140,6 +142,7 @@ class Preferences(PreferencesBase):
set_("CustomCommand", self.custom_command) set_("CustomCommand", self.custom_command)
set_("Language", self.language) set_("Language", self.language)
set_("Portable", self.portable) set_("Portable", self.portable)
set_("UseNativeDialogs", self.use_native_dialogs)
set_("TableFontSize", self.tableFontSize) set_("TableFontSize", self.tableFontSize)
set_("ReferenceBoldFont", self.reference_bold_font) set_("ReferenceBoldFont", self.reference_bold_font)

View File

@ -158,6 +158,16 @@ On MacOS, the tab bar will fill up the window's width instead."
) )
) )
layout.addWidget(self.tabs_default_pos) layout.addWidget(self.tabs_default_pos)
self._setupAddCheckbox(
"use_native_dialogs",
tr("Use native OS dialogs"),
)
self.use_native_dialogs.setToolTip(
tr(
"For actions such as file/folder selection use the OS native dialogs.\nSome native dialogs have limited functionality."
)
)
layout.addWidget(self.use_native_dialogs)
self.ui_groupbox.setLayout(layout) self.ui_groupbox.setLayout(layout)
self.displayVLayout.addWidget(self.ui_groupbox) self.displayVLayout.addWidget(self.ui_groupbox)
@ -286,6 +296,7 @@ use the modifier key to drag the floating window around"
if section & Sections.DISPLAY: if section & Sections.DISPLAY:
setchecked(self.reference_bold_font, prefs.reference_bold_font) setchecked(self.reference_bold_font, prefs.reference_bold_font)
setchecked(self.tabs_default_pos, prefs.tabs_default_pos) setchecked(self.tabs_default_pos, prefs.tabs_default_pos)
setchecked(self.use_native_dialogs, prefs.use_native_dialogs)
setchecked( setchecked(
self.details_dialog_titlebar_enabled, self.details_dialog_titlebar_enabled,
prefs.details_dialog_titlebar_enabled, prefs.details_dialog_titlebar_enabled,
@ -329,6 +340,7 @@ use the modifier key to drag the floating window around"
prefs.custom_command = str(self.customCommandEdit.text()) prefs.custom_command = str(self.customCommandEdit.text())
prefs.tableFontSize = self.fontSizeSpinBox.value() prefs.tableFontSize = self.fontSizeSpinBox.value()
prefs.tabs_default_pos = ischecked(self.tabs_default_pos) prefs.tabs_default_pos = ischecked(self.tabs_default_pos)
prefs.use_native_dialogs = ischecked(self.use_native_dialogs)
lang = self.supportedLanguages[self.languageComboBox.currentIndex()] lang = self.supportedLanguages[self.languageComboBox.currentIndex()]
oldlang = self.app.prefs.language oldlang = self.app.prefs.language
if oldlang not in self.supportedLanguages: if oldlang not in self.supportedLanguages: