diff -r 28b14d2df6a1 -r be23a662d709 src/eric7/RemoteServerInterface/EricServerFileDialog.py --- a/src/eric7/RemoteServerInterface/EricServerFileDialog.py Sat Feb 10 11:28:58 2024 +0100 +++ b/src/eric7/RemoteServerInterface/EricServerFileDialog.py Sun Feb 11 18:35:44 2024 +0100 @@ -11,10 +11,15 @@ import fnmatch import re -from PyQt6.QtCore import QLocale, Qt, pyqtSlot, QPoint +from PyQt6.QtCore import QLocale, QPoint, Qt, pyqtSlot from PyQt6.QtWidgets import ( - QDialog, QTreeWidgetItem, QAbstractItemView, QCompleter, QLineEdit, QInputDialog, - QMenu + QAbstractItemView, + QCompleter, + QDialog, + QInputDialog, + QLineEdit, + QMenu, + QTreeWidgetItem, ) from eric7.EricGui import EricPixmapCache @@ -31,6 +36,7 @@ """ Class defining the dialog accept modes. """ + AcceptOpen = 0 AcceptSave = 1 @@ -39,11 +45,13 @@ """ Class defining what the user may select in the file dialog. """ + AnyFile = 0 ExistingFile = 1 Directory = 2 ExistingFiles = 3 + class EricServerFileDialog(QDialog, Ui_EricServerFileDialog): """ Class implementing a file dialog showing the file system of the eric-ide server. @@ -51,7 +59,7 @@ IsDirectoryRole = Qt.ItemDataRole.UserRole - def __init__(self, parent=None, caption="", directory="", filter=""): + def __init__(self, parent=None, caption="", directory="", filter=""): # noqa: M132 """ Constructor @@ -181,7 +189,7 @@ self.filterCombo.clear() self.filterCombo.addItems(filters) - def setNameFilter(self, filter): + def setNameFilter(self, filter): # noqa: M132 """ Public method to set the current name filter. @@ -457,9 +465,9 @@ @pyqtSlot(int) def on_filterCombo_currentIndexChanged(self, index): """ - Slot documentation goes here. + Private slot handling the selection of a new file filter.. - @param index DESCRIPTION + @param index index of the selected entry @type int """ filters = self.__filters[index] @@ -476,7 +484,6 @@ """ self.__filenameCache.clear() self.__directoryCache.clear() - try: directory, sep, dirListing = self.__fsInterface.listdir(directory) @@ -503,7 +510,9 @@ self.listing.clear() for dirEntry in sorted( dirListing, - key=lambda d: " " + d['name'].lower() if d["is_dir"] else d["name"].lower(), + key=lambda d: ( + " " + d['name'].lower() if d["is_dir"] else d["name"].lower() + ), ): if dirEntry["is_dir"]: type_ = self.tr("Directory") @@ -524,7 +533,6 @@ itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter) itm.setData(0, EricServerFileDialog.IsDirectoryRole, dirEntry["is_dir"]) - filters = self.__filters[self.filterCombo.currentIndex()] self.__filterList(filters) @@ -540,7 +548,6 @@ " reported by the eric-ide server.</p><p>Reason: {1}</p>" ).format(directory, str(err)), ) - # 4. update some dependent states self.nameEdit.clear() @@ -549,7 +556,7 @@ @pyqtSlot(QPoint) def on_listing_customContextMenuRequested(self, pos): """ - Priovate slot to show a context menu. + Private slot to show a context menu. @param pos mouse pointer position to show the menu at @type QPoint