Esempio n. 1
0
 def on_install(self, editor):
     self._completer = QtWidgets.QCompleter([""], editor)
     self._completer.setCompletionMode(self._completer.PopupCompletion)
     self._completer.activated.connect(self._insert_completion)
     self._completer.highlighted.connect(
         self._on_selected_completion_changed)
     self._completer.setModel(QtGui.QStandardItemModel())
     self._helper = TextHelper(editor)
     Mode.on_install(self, editor)
Esempio n. 2
0
 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 = ""
Esempio n. 3
0
 def _create_completer(self):
     if not self.smart_completion:
         self._completer = QtWidgets.QCompleter([''], self.editor)
     else:
         self._completer = SubsequenceCompleter(self.editor)
     self._completer.setCompletionMode(self._completer.PopupCompletion)
     if self.case_sensitive:
         self._completer.setCaseSensitivity(QtCore.Qt.CaseSensitive)
     else:
         self._completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
     self._completer.activated.connect(self._insert_completion)
     self._completer.highlighted.connect(
         self._on_selected_completion_changed)
     self._completer.highlighted.connect(self._display_completion_tooltip)
Esempio n. 4
0
 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])
Esempio n. 5
0
 def _create_completer(self):
     if self.filter_mode != self.FILTER_FUZZY:
         self._completer = QtWidgets.QCompleter([''], self.editor)
         if self.filter_mode == self.FILTER_CONTAINS:
             try:
                 self._completer.setFilterMode(QtCore.Qt.MatchContains)
             except AttributeError:
                 # only available with PyQt5
                 pass
     else:
         self._completer = SubsequenceCompleter(self.editor)
     self._completer.setCompletionMode(self._completer.PopupCompletion)
     if self.case_sensitive:
         self._completer.setCaseSensitivity(QtCore.Qt.CaseSensitive)
     else:
         self._completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
     self._completer.activated.connect(self._insert_completion)
     self._completer.highlighted.connect(
         self._on_selected_completion_changed)
     self._completer.highlighted.connect(self._display_completion_tooltip)
Esempio n. 6
0
 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)