Python PyQt5.QtWidgets.QCompleter() Examples

The following are 14 code examples for showing how to use PyQt5.QtWidgets.QCompleter(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: Traffic-Rules-Violation-Detection   Author: rahatzamancse   File: SearchWindow.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, search_result, parent=None):
        super(SearchWindow, self).__init__(parent)
        loadUi("UI/Search.ui", self)

        self.search_result = search_result

        self.color.addItems(["None"])
        self.color.addItems(Database.get_instance().get_car_color_list())

        completer = QCompleter()
        self.substring.setCompleter(completer)
        model = QStringListModel()
        completer.setModel(model)
        licenseList = Database.get_instance().get_licenses()
        model.setStringList(licenseList)

        self.search_button.clicked.connect(self.search)

        cams = Database.get_instance().get_cam_list(None)
        self.camera.clear()
        self.camera.addItems(["None"])
        self.camera.addItems(id for id, cam, feed in cams)
        self.camera.setCurrentIndex(0) 
Example 2
Project: urh   Author: jopohl   File: CSVImportDialog.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, filename="", parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogCSVImport()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowFlags(Qt.Window)

        self.ui.btnAutoDefault.hide()

        completer = QCompleter()
        completer.setModel(QDirModel(completer))
        self.ui.lineEditFilename.setCompleter(completer)

        self.filename = None  # type: str
        self.ui.lineEditFilename.setText(filename)
        self.update_file()

        self.ui.tableWidgetPreview.setColumnHidden(self.COLUMNS["T"], True)
        self.update_preview()

        self.create_connects() 
Example 3
def __init__(self, search_result, parent=None):
        super(SearchWindow, self).__init__(parent)
        loadUi("UI/Search.ui", self)

        self.search_result = search_result

        self.color.addItems(["None"])
        self.color.addItems(Database.getInstance().getCarColorsList())

        completer = QCompleter()
        self.substring.setCompleter(completer)
        model = QStringListModel()
        completer.setModel(model)
        licenseList = Database.getInstance().getLicenseList()
        model.setStringList(licenseList)

        self.search_button.clicked.connect(self.search)

        cams = Database.getInstance().getCamList(None)
        self.camera.clear()
        self.camera.addItems(["None"])
        self.camera.addItems(id for id, cam, feed in cams)
        self.camera.setCurrentIndex(0) 
Example 4
Project: QualCoder   Author: ccbogel   File: add_item_name.py    License: MIT License 6 votes vote down vote up
def __init__(self, model, linktypes, fromname, parent=None):
        super(DialogLinkTo, self).__init__(parent)  # overrride accept method
        self.linktype = None
        self.linkitem = None
        self.linktypes = linktypes
        self.model = model

        self.setupUi()
        completer = QtWidgets.QCompleter()#[x['name'] for x in model.nativedata])
        completer.setCompletionMode(QtWidgets.QCompleter.InlineCompletion)
        completer.setCompletionColumn(0)
        completer.setCompletionRole(Qt.DisplayRole)
        completer.setCaseSensitivity(Qt.CaseInsensitive)
        completer.setModel(model)
        self.lineEdit.setCompleter(completer)

        self.combo.setModel(linktypes)
        self.setWindowTitle('Create link to %s'%fromname)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed); 
Example 5
Project: asammdf   Author: danielhrisca   File: search.py    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self, sorted_keys, channels_db, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setupUi(self)
        self.channels_db = channels_db

        self.matches = 0
        self.current_index = 1
        self.entries = []

        completer = QtWidgets.QCompleter(sorted_keys, self)
        completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
        completer.setModelSorting(QtWidgets.QCompleter.CaseInsensitivelySortedModel)
        completer.setFilterMode(QtCore.Qt.MatchContains)
        self.search.setCompleter(completer)

        self.search.textChanged.connect(self.display_results)

        self.up_btn.clicked.connect(self.up)
        self.down_btn.clicked.connect(self.down) 
Example 6
Project: KStock   Author: aseylys   File: Helpers.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, ticks, parent = None):
        QtWidgets.QDialog.__init__(self, parent)

        self.setupUi(self)
        completer = QtWidgets.QCompleter()
        completer.setCaseSensitivity(False)
        self.tickEdit.setCompleter(completer)

        model = QtCore.QStringListModel()
        completer.setModel(model)
        model.setStringList(ticks)

        self.okBut.clicked.connect(self.accept)
        self.cancelBut.clicked.connect(self.close) 
Example 7
Project: dash-masternode-tool   Author: Bertrand256   File: hw_word_dlg.py    License: MIT License 5 votes vote down vote up
def setupUi(self):
        ui_hw_word_dlg.Ui_HardwareWalletWordDlg.setupUi(self, self)
        self.setWindowTitle('')
        self.lblWord.setText(self.message)
        self.setWindowTitle('Get word')
        model = QStringListModel()
        model.setStringList(self.wordlist)
        self.completer = QCompleter()
        self.completer.setModel(model)
        self.edtWord.setCompleter(self.completer)
        self.layout().setSizeConstraint(QLayout.SetFixedSize) 
Example 8
Project: kite   Author: pyrocko   File: config.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        QtWidgets.QDialog.__init__(self, *args, **kwargs)

        self.completer = QtWidgets.QCompleter()
        self.completer_model = QtWidgets.QFileSystemModel(self.completer)
        self.completer.setModel(self.completer_model)
        self.completer.setMaxVisibleItems(8)

        loadUi(get_resource('dialog_config.ui'), self)

        self.ok_button.released.connect(
            self.setAttributes)
        self.ok_button.released.connect(
            self.close)

        self.apply_button.released.connect(
            self.setAttributes)

        self.vector_color_picker = QtWidgets.QColorDialog(self)
        self.vector_color_picker. \
            setCurrentColor(QtGui.QColor(*getConfig().vector_color))
        self.vector_color_picker. \
            setOption(self.vector_color_picker.ShowAlphaChannel)
        self.vector_color_picker.colorSelected.connect(
            self.updateVectorColor)
        self.vector_color_picker.setModal(True)
        self.vector_color.clicked.connect(
            self.vector_color_picker.show)

        self.vector_color.setValue = self.setButtonColor
        self.vector_color.value = self.getButtonColor

        self.chooseStoreDirButton.released.connect(
            self.chooseStoreDir)
        self.completer_model.setRootPath('')
        self.completer.setParent(self.default_gf_dir)
        self.default_gf_dir.setCompleter(self.completer)

        self.getAttributes() 
Example 9
Project: grap   Author: AirbusCyber   File: QtShim.py    License: MIT License 5 votes vote down vote up
def get_QCompleter():
    """QCompleter getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QCompleter
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QCompleter 
Example 10
def _on_user_find_success(self, job):
        users = job.ret
        completer = QCompleter(users)
        completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.line_edit_share.setCompleter(completer)
        self.line_edit_share.completer().complete() 
Example 11
Project: parsec-cloud   Author: Scille   File: custom_dialogs.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(
        self,
        message,
        placeholder="",
        default_text="",
        completion=None,
        button_text=None,
        validator=None,
    ):
        super().__init__()
        self.setupUi(self)
        self.dialog = None
        button_text = button_text or _("ACTION_OK")
        self.button_ok.setText(button_text)
        self.label_message.setText(message)
        self.line_edit_text.setPlaceholderText(placeholder)
        self.line_edit_text.setText(default_text)
        if validator:
            self.line_edit_text.setValidator(validator)
        if completion:
            completer = QCompleter(completion)
            completer.setCaseSensitivity(Qt.CaseInsensitive)
            completer.popup().setStyleSheet("border: 1px solid rgb(30, 78, 162);")
            self.line_edit_text.setCompleter(completer)
        self.button_ok.clicked.connect(self._on_button_clicked)
        self.setFocus()
        self.line_edit_text.setFocus() 
Example 12
Project: urh   Author: jopohl   File: test_simulator_tab_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def test_expression_line_edit(self):
        e = ExpressionLineEdit()
        e.setCompleter(QCompleter(self.form.simulator_tab_controller.completer_model, e))
        e.setValidator(RuleExpressionValidator(self.form.simulator_tab_controller.sim_expression_parser))

        self.assertEqual(e.text(), "")
        QTest.keyClick(e, Qt.Key_R, Qt.NoModifier)
        self.assertEqual(e.text(), "r") 
Example 13
Project: urh   Author: jopohl   File: ProjectDialog.py    License: GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, new_project=True, project_manager: ProjectManager = None, parent=None):
        super().__init__(parent)
        if not new_project:
            assert project_manager is not None

        self.ui = Ui_ProjectDialog()
        self.ui.setupUi(self)
        self.setWindowFlags(Qt.Window)

        if new_project:
            self.participant_table_model = ParticipantTableModel([])
        else:
            self.participant_table_model = ParticipantTableModel(project_manager.participants)

            self.ui.spinBoxSampleRate.setValue(project_manager.device_conf["sample_rate"])
            self.ui.spinBoxFreq.setValue(project_manager.device_conf["frequency"])
            self.ui.spinBoxBandwidth.setValue(project_manager.device_conf["bandwidth"])
            self.ui.spinBoxGain.setValue(project_manager.device_conf.get("gain", config.DEFAULT_GAIN))
            self.ui.txtEdDescription.setPlainText(project_manager.description)
            self.ui.lineEdit_Path.setText(project_manager.project_path)
            self.ui.lineEditBroadcastAddress.setText(project_manager.broadcast_address_hex)

            self.ui.btnSelectPath.hide()
            self.ui.lineEdit_Path.setDisabled(True)
            self.setWindowTitle("Edit project settings")
            self.ui.lNewProject.setText("Edit project")

        self.ui.tblParticipants.setModel(self.participant_table_model)
        self.participant_table_model.update()

        self.ui.lineEditBroadcastAddress.setValidator(QRegExpValidator(QRegExp("([a-fA-F ]|[0-9]){,}")))

        self.sample_rate = self.ui.spinBoxSampleRate.value()
        self.freq = self.ui.spinBoxFreq.value()
        self.bandwidth = self.ui.spinBoxBandwidth.value()
        self.gain = self.ui.spinBoxGain.value()
        self.description = self.ui.txtEdDescription.toPlainText()
        self.broadcast_address_hex = self.ui.lineEditBroadcastAddress.text()

        self.path = self.ui.lineEdit_Path.text()
        self.new_project = new_project
        self.committed = False
        self.setModal(True)

        completer = QCompleter()
        completer.setModel(QDirModel(completer))
        self.ui.lineEdit_Path.setCompleter(completer)

        self.create_connects()
        # add two participants
        if self.participant_table_model.rowCount() == 0 and new_project:
            self.ui.btnAddParticipant.click()
            self.ui.btnAddParticipant.click()

        if new_project:
            self.ui.lineEdit_Path.setText(os.path.realpath(os.path.join(os.curdir, "new")))

        self.on_line_edit_path_text_edited()
        self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) 
Example 14
Project: urh   Author: jopohl   File: SniffSettingsWidget.py    License: GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, device_name: str, project_manager: ProjectManager, signal=None, backend_handler=None,
                 network_raw_mode=False, signals=None, parent=None):
        super().__init__(parent)
        self.ui = Ui_SniffSettings()
        self.ui.setupUi(self)

        signals = signals if signals is not None else []
        self.project_manager = project_manager

        for encoding in self.project_manager.decodings:
            self.ui.comboBox_sniff_encoding.addItem(encoding.name)

        self.bootstrap(project_manager.device_conf, signal, enforce_default=True)

        self.sniffer = ProtocolSniffer(samples_per_symbol=self.ui.spinbox_sniff_SamplesPerSymbol.value(),
                                       center=self.ui.spinbox_sniff_Center.value(),
                                       center_spacing=self.ui.spinBoxCenterSpacing.value(),
                                       noise=self.ui.spinbox_sniff_Noise.value(),
                                       tolerance=self.ui.spinbox_sniff_ErrorTolerance.value(),
                                       modulation_type=self.ui.combox_sniff_Modulation.currentText(),
                                       bits_per_symbol=self.ui.spinBoxBitsPerSymbol.value(),
                                       device=device_name,
                                       backend_handler=BackendHandler() if backend_handler is None else backend_handler,
                                       network_raw_mode=network_raw_mode)

        self.sniffer.adaptive_noise = self.ui.checkBoxAdaptiveNoise.isChecked()
        self.sniffer.automatic_center = self.ui.checkBoxAutoCenter.isChecked()

        self.__set_center_offset_visibility()

        self.create_connects()
        self.ui.comboBox_sniff_encoding.currentIndexChanged.emit(self.ui.comboBox_sniff_encoding.currentIndex())
        self.ui.comboBox_sniff_viewtype.setCurrentIndex(settings.read('default_view', 0, int))

        # Auto Complete like a Boss
        completer = QCompleter()
        completer.setModel(QDirModel(completer))
        self.ui.lineEdit_sniff_OutputFile.setCompleter(completer)

        self.signals = signals

        if len(signals) == 0:
            self.ui.label_sniff_Signal.hide()
            self.ui.btn_sniff_use_signal.hide()
            self.ui.comboBox_sniff_signal.hide()
        else:
            for signal in signals:
                self.ui.comboBox_sniff_signal.addItem(signal.name)