1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-05-07 09:19:50 +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"
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."
msgstr ""
#: core\app.py:300
#: core\app.py:297
msgid "No duplicates found."
msgstr ""
#: core\app.py:315
#: core\app.py:312
msgid "All marked files were copied successfully."
msgstr ""
#: core\app.py:316
#: core\app.py:313
msgid "All marked files were moved successfully."
msgstr ""
#: core\app.py:317
#: core\app.py:314
msgid "All marked files were successfully sent to Trash."
msgstr ""
#: core\app.py:323
#: core\app.py:320
msgid "Could not load file: {}"
msgstr ""
#: core\app.py:379
#: core\app.py:376
msgid "'{}' already is in the list."
msgstr ""
#: core\app.py:381
#: core\app.py:378
msgid "'{}' does not exist."
msgstr ""
#: core\app.py:389
#: core\app.py:386
msgid "All selected %d matches are going to be ignored in all subsequent scans. Continue?"
msgstr ""
#: core\app.py:463
#: core\app.py:460
msgid "Select a directory to copy marked files to"
msgstr ""
#: core\app.py:465
#: core\app.py:462
msgid "Select a directory to move marked files to"
msgstr ""
#: core\app.py:504
#: core\app.py:501
msgid "Select a destination for your exported CSV"
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: {}"
msgstr ""
#: core\app.py:533
#: core\app.py:530
msgid "You have no custom command set up. Set it up in your preferences."
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?"
msgstr ""
#: core\app.py:739
#: core\app.py:736
msgid "{} duplicate groups were changed by the re-prioritization."
msgstr ""
#: core\app.py:783
#: core\app.py:780
msgid "The selected directories contain no scannable file."
msgstr ""
#: core\app.py:796
#: core\app.py:793
msgid "Collecting files to scan"
msgstr ""
#: core\app.py:843
#: core\app.py:840
msgid "%s (%d discarded)"
msgstr ""

View File

@ -913,3 +913,13 @@ msgstr ""
#: qt\se\preferences_dialog.py:80
msgid "MB"
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.QtWidgets import (
QListView,
QWidget,
QFileDialog,
QHeaderView,
@ -285,14 +286,25 @@ class DirectoriesDialog(QMainWindow):
# --- Events
def addFolderTriggered(self):
no_native = not self.app.prefs.use_native_dialogs
title = tr("Select a folder to add to the scanning list")
flags = QFileDialog.ShowDirsOnly
dirpath = str(QFileDialog.getExistingDirectory(self, title, self.lastAddedFolder, flags))
if not dirpath:
file_dialog = QFileDialog(self, title, self.lastAddedFolder)
file_dialog.setFileMode(QFileDialog.DirectoryOnly)
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
self.lastAddedFolder = dirpath
self.app.model.add_directory(dirpath)
self.recentFolders.insertItem(dirpath)
paths = file_dialog.selectedFiles()
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):
if index == 2:

View File

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

View File

@ -30,6 +30,7 @@ class Preferences(PreferencesBase):
if not self.language and trans.installed_lang:
self.language = trans.installed_lang
self.portable = get("Portable", False)
self.use_native_dialogs = get("UseNativeDialogs", True)
self.tableFontSize = get("TableFontSize", self.tableFontSize)
self.reference_bold_font = get("ReferenceBoldFont", self.reference_bold_font)
@ -92,6 +93,7 @@ class Preferences(PreferencesBase):
self.destination_type = 1
self.custom_command = ""
self.language = trans.installed_lang if trans.installed_lang else ""
self.use_native_dialogs = True
self.tableFontSize = QApplication.font().pointSize()
self.reference_bold_font = True
@ -140,6 +142,7 @@ class Preferences(PreferencesBase):
set_("CustomCommand", self.custom_command)
set_("Language", self.language)
set_("Portable", self.portable)
set_("UseNativeDialogs", self.use_native_dialogs)
set_("TableFontSize", self.tableFontSize)
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)
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.displayVLayout.addWidget(self.ui_groupbox)
@ -286,6 +296,7 @@ use the modifier key to drag the floating window around"
if section & Sections.DISPLAY:
setchecked(self.reference_bold_font, prefs.reference_bold_font)
setchecked(self.tabs_default_pos, prefs.tabs_default_pos)
setchecked(self.use_native_dialogs, prefs.use_native_dialogs)
setchecked(
self.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.tableFontSize = self.fontSizeSpinBox.value()
prefs.tabs_default_pos = ischecked(self.tabs_default_pos)
prefs.use_native_dialogs = ischecked(self.use_native_dialogs)
lang = self.supportedLanguages[self.languageComboBox.currentIndex()]
oldlang = self.app.prefs.language
if oldlang not in self.supportedLanguages: