def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) completer = self.Completer() model = QtWidgets.QDirModel(completer) model.setIconProvider(FileIconProvider()) completer.setModel(model) self.setCompleter(completer) self.setDragEnabled(True)
def __init__(self, parent, path): super().__init__(parent) self.setupUi(self) self.enable_ok() completer = QtWidgets.QCompleter(self) completer.setModel(QtWidgets.QDirModel(completer)) self.lineEditPath.setCompleter(completer) if not path: self.lineEditPath.setText(os.path.expanduser("~")) else: self.lineEditPath.setText(path) self.prev_pth = ""
def __init__(self, parent, path): super().__init__(parent) self.setupUi(self) self.enable_ok() completer = QtWidgets.QCompleter(self) completer.setModel(QtWidgets.QDirModel(completer)) self.lineEditPath.setCompleter(completer) if not path: self.lineEditPath.setText(os.path.expanduser("~")) else: self.lineEditPath.setText(path) self.prev_pth = "" self.comboBoxExtension.addItems(sorted(Settings().all_extensions)) self.comboBoxExtension.addItems( [ext.upper() for ext in Settings().all_extensions])
def __init__(self, parent=None): super(FilePicker, self).__init__(parent) self._default_dir = os.path.expanduser('~') self._pick_dirs = True layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.line_edit = QtWidgets.QLineEdit() self.path = os.path.expanduser('~') layout.addWidget(self.line_edit) self.tool_button = QtWidgets.QToolButton() self.tool_button.setText('...') layout.addWidget(self.tool_button) self.setLayout(layout) completer = QtWidgets.QCompleter(self) self._mdl = QtWidgets.QDirModel(completer) completer.setModel(self._mdl) self.line_edit.setCompleter(completer) self.pick_dirs = False self.tool_button.clicked.connect(self._pick) self.line_edit.textChanged.connect(self._on_path_changed)