Python PyQt5.QtCore.Qt 模块,WaitCursor() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt5.QtCore.Qt.WaitCursor()

项目:spyking-circus    作者:spyking-circus    | 项目源码 | 文件源码
def remove_templates(self, event):
        print_and_log(['Deleting templates: %s' %str(sorted(self.inspect_templates))], 'default', logger)
        self.app.setOverrideCursor(QCursor(Qt.WaitCursor))

        if len(self.inspect_templates) > 0:
            self.to_delete = numpy.concatenate((self.to_delete, self.to_consider[self.inspect_templates]))
            self.generate_data()
            self.collections        = None
            self.selected_points    = set()
            self.selected_templates = set()
            self.inspect_points     = set()
            self.inspect_templates  = set()
            self.score_ax1.clear()
            self.score_ax2.clear()
            self.score_ax3.clear()
            self.update_lag(self.use_lag)
            self.update_data_sort_order()
            self.update_detail_plot()
            self.update_waveforms()
            self.plot_scores()
            # do lengthy process
        self.app.restoreOverrideCursor()
项目:TextStageProcessor    作者:mhyhre    | 项目源码 | 文件源码
def makeLSA(self):
        self.calculator.setConfiguration(self.configurations)
        self.calculator.lsa_components_count = self.lsa_components_count.value()
        self.buttonMakeLSA.setEnabled(False)
        self.button2DView.setEnabled(False)
        self.buttonRelationTable.setEnabled(False)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.textEdit.setText("")
        self.configurations['need_full_preprocessing'] = self.radio_preprocessing_full.isChecked()
        self.configurations["minimal_word_size"] = self.spinBoxMinimalWordsLen.value()
        self.configurations["cut_ADJ"] = self.checkBoxPrilag.isChecked()
        self.configurations["need_apriori"] = self.checkBoxNeedApriori.isChecked()
        self.radio_preprocessing_full.setEnabled(False)
        self.radio_preprocessing_stopwords.setEnabled(False)
        self.groupBoxFullPreprocessingPanel.setEnabled(False)
        self.profiler.start()
        self.calculator.start()
项目:TextStageProcessor    作者:mhyhre    | 项目源码 | 文件源码
def makeClassification(self):
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.textEdit.setText("")
        self.checkBoxNeedPreprocessing.setEnabled(False)
        need_preprocessing = self.checkBoxNeedPreprocessing.isChecked()
        self.configurations['classification_knn_k'] = self.spinBox_KNN_K.value()

        if self.radioButtonNaiveBayes.isChecked():
            self.calculator.setMethod(ClassificationCalculator.METHOD_NAIVE_BAYES, need_preprocessing)

        if self.radioButtonRocchio.isChecked():
            self.calculator.setMethod(ClassificationCalculator.METHOD_ROCCHIO, need_preprocessing)

        if self.radioButtonKNN.isChecked():
            self.calculator.setMethod(ClassificationCalculator.METHOD_KNN, need_preprocessing)

        if self.radioButtonLLSF.isChecked():
            self.calculator.setMethod(ClassificationCalculator.METHOD_LLSF, need_preprocessing)

        if self.radioButtonID3.isChecked():
            self.calculator.setMethod(ClassificationCalculator.METHOD_ID3, need_preprocessing)

        self.profiler.start()
        self.calculator.start()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def start(self):
        self.startButton.setEnabled(False)

        QApplication.setOverrideCursor(Qt.WaitCursor)

        self.bytesWritten = 0
        self.bytesReceived = 0

        while not self.tcpServer.isListening() and not self.tcpServer.listen():
            ret = QMessageBox.critical(self, "Loopback",
                    "Unable to start the test: %s." % self.tcpServer.errorString(),
                    QMessageBox.Retry | QMessageBox.Cancel)
            if ret == QMessageBox.Cancel:
                return

        self.serverStatusLabel.setText("Listening")
        self.clientStatusLabel.setText("Connecting")

        self.tcpClient.connectToHost(QHostAddress(QHostAddress.LocalHost), self.tcpServer.serverPort())
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def modelFromFile(self, fileName):
        f = QFile(fileName)
        if not f.open(QFile.ReadOnly):
            return QStringListModel(self.completer)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        words = []
        while not f.atEnd():
            line = f.readLine().trimmed()
            if line.length() != 0:
                try:
                    line = str(line, encoding='ascii')
                except TypeError:
                    line = str(line)

                words.append(line)

        QApplication.restoreOverrideCursor()

        return QStringListModel(words, self.completer)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def save(self):
        filename, _ = QFileDialog.getSaveFileName(self,
                "Choose a file name", '.', "HTML (*.html *.htm)")
        if not filename:
            return

        file = QFile(filename)
        if not file.open(QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "Dock Widgets",
                    "Cannot write file %s:\n%s." % (filename, file.errorString()))
            return

        out = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        out << self.textEdit.toHtml()
        QApplication.restoreOverrideCursor()

        self.statusBar().showMessage("Saved '%s'" % filename, 2000)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def start(self):
        self.startButton.setEnabled(False)

        QApplication.setOverrideCursor(Qt.WaitCursor)

        self.bytesWritten = 0
        self.bytesReceived = 0

        while not self.tcpServer.isListening() and not self.tcpServer.listen():
            ret = QMessageBox.critical(self, "Loopback",
                    "Unable to start the test: %s." % self.tcpServer.errorString(),
                    QMessageBox.Retry | QMessageBox.Cancel)
            if ret == QMessageBox.Cancel:
                return

        self.serverStatusLabel.setText("Listening")
        self.clientStatusLabel.setText("Connecting")

        self.tcpClient.connectToHost(QHostAddress(QHostAddress.LocalHost), self.tcpServer.serverPort())
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def modelFromFile(self, fileName):
        f = QFile(fileName)
        if not f.open(QFile.ReadOnly):
            return QStringListModel(self.completer)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        words = []
        while not f.atEnd():
            line = f.readLine().trimmed()
            if line.length() != 0:
                try:
                    line = str(line, encoding='ascii')
                except TypeError:
                    line = str(line)

                words.append(line)

        QApplication.restoreOverrideCursor()

        return QStringListModel(words, self.completer)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def save(self):
        filename, _ = QFileDialog.getSaveFileName(self,
                "Choose a file name", '.', "HTML (*.html *.htm)")
        if not filename:
            return

        file = QFile(filename)
        if not file.open(QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "Dock Widgets",
                    "Cannot write file %s:\n%s." % (filename, file.errorString()))
            return

        out = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        out << self.textEdit.toHtml()
        QApplication.restoreOverrideCursor()

        self.statusBar().showMessage("Saved '%s'" % filename, 2000)
项目:Python_SelfLearning    作者:fukuit    | 项目源码 | 文件源码
def exec_process(self):
        if os.path.exists(self.dirname):
            try:
                QApplication.setOverrideCursor(Qt.WaitCursor)
                self.fileList.setup(self.dirname, '.py')
                maxCnt = self.fileList.length
                self.pbar.setValue(0)
                self.pbar.setMinimum(0)
                self.pbar.setMaximum(maxCnt)
                self.fileList.start()
            except Exception as e:
                self.print_log(str(e))
            finally:
                QApplication.restoreOverrideCursor()
        else:
            self.print_log('{0} is not exists'.format(self.dirname))
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def read_opened_filenames(self):
        if self.project_file is not None:
            tree = ET.parse(self.project_file)
            root = tree.getroot()
            file_names = []

            for file_tag in root.findall("open_file"):
                pos = int(file_tag.attrib["position"])
                filename = os.path.normpath(os.path.join(self.project_path, file_tag.attrib["name"]))
                file_names.insert(pos, filename)

            QApplication.setOverrideCursor(Qt.WaitCursor)
            file_names = FileOperator.uncompress_archives(file_names, QDir.tempPath())
            QApplication.restoreOverrideCursor()
            return file_names
        return []
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def draw_spectrogram(self, show_full_scene=False, force_redraw=False):
        self.setCursor(Qt.WaitCursor)
        window_size = 2 ** self.ui.sliderFFTWindowSize.value()
        data_min, data_max = self.ui.sliderSpectrogramMin.value(), self.ui.sliderSpectrogramMax.value()

        redraw_needed = self.ui.gvSpectrogram.scene_manager.set_parameters(self.signal.data, window_size=window_size,
                                                                           data_min=data_min, data_max=data_max)
        self.ui.gvSpectrogram.scene_manager.update_scene_rect()

        if show_full_scene:
            self.ui.gvSpectrogram.show_full_scene()

        if redraw_needed or force_redraw:
            self.ui.gvSpectrogram.scene_manager.show_full_scene()
            self.ui.gvSpectrogram.show_full_scene()

        self.on_slider_y_scale_value_changed()

        self.__set_samples_in_view()
        self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def contextMenuEvent(self, event: QContextMenuEvent):
        if self.signal is None:
            return

        menu = QMenu()
        apply_to_all_action = menu.addAction(self.tr("Apply values (BitLen, 0/1-Threshold, Tolerance) to all signals"))
        menu.addSeparator()
        auto_detect_action = menu.addAction(self.tr("Auto-Detect signal parameters"))
        action = menu.exec_(self.mapToGlobal(event.pos()))
        if action == apply_to_all_action:
            self.setCursor(Qt.WaitCursor)
            self.apply_to_all_clicked.emit(self.signal)
            self.unsetCursor()
        elif action == auto_detect_action:
            self.setCursor(Qt.WaitCursor)
            self.signal.auto_detect()
            self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def handle_signal_loaded(self, protocol):
        self.setCursor(Qt.WaitCursor)
        self.ui.cbShowDataBitsOnly.setEnabled(True)
        self.ui.chkBoxLockSIV.setEnabled(True)
        self.ui.btnAutoDetect.setEnabled(True)
        self.protocol = protocol

        # Apply bit length of original signal to current modulator
        self.ui.spinBoxBitLength.setValue(self.ui.gVOriginalSignal.signal.bit_len)

        # https://github.com/jopohl/urh/issues/130
        self.ui.gVModulated.show_full_scene(reinitialize=True)
        self.ui.gVCarrier.show_full_scene(reinitialize=True)
        self.ui.gVData.show_full_scene(reinitialize=True)

        self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def draw_sine_wave(self):
        if self.dialog_ui.graphicsViewSineWave.scene_manager:
            self.dialog_ui.graphicsViewSineWave.scene_manager.clear_path()

        QApplication.instance().setOverrideCursor(Qt.WaitCursor)
        self.__set_status_of_editable_elements(enabled=False)
        t = np.arange(0, self.num_samples) / self.sample_rate
        arg = ((2 * np.pi * self.frequency * t + self.phase) * 1j).astype(np.complex64)
        self.complex_wave = self.amplitude * np.exp(arg)  # type: np.ndarray
        self.draw_data = np.insert(self.original_data, self.position, self.complex_wave).imag.astype(np.float32)
        y, h = self.dialog_ui.graphicsViewSineWave.view_rect().y(), self.dialog_ui.graphicsViewSineWave.view_rect().height()
        self.insert_indicator.setRect(self.position, y - h, self.num_samples, 2 * h + abs(y))

        self.__set_status_of_editable_elements(enabled=True)
        QApplication.instance().restoreOverrideCursor()
        self.dialog_ui.graphicsViewSineWave.plot_data(self.draw_data)
        self.dialog_ui.graphicsViewSineWave.show_full_scene()
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def start(self):
        self.startButton.setEnabled(False)

        QApplication.setOverrideCursor(Qt.WaitCursor)

        self.bytesWritten = 0
        self.bytesReceived = 0

        while not self.tcpServer.isListening() and not self.tcpServer.listen():
            ret = QMessageBox.critical(self, "Loopback",
                    "Unable to start the test: %s." % self.tcpServer.errorString(),
                    QMessageBox.Retry | QMessageBox.Cancel)
            if ret == QMessageBox.Cancel:
                return

        self.serverStatusLabel.setText("Listening")
        self.clientStatusLabel.setText("Connecting")

        self.tcpClient.connectToHost(QHostAddress(QHostAddress.LocalHost), self.tcpServer.serverPort())
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def modelFromFile(self, fileName):
        f = QFile(fileName)
        if not f.open(QFile.ReadOnly):
            return QStringListModel(self.completer)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        words = []
        while not f.atEnd():
            line = f.readLine().trimmed()
            if line.length() != 0:
                try:
                    line = str(line, encoding='ascii')
                except TypeError:
                    line = str(line)

                words.append(line)

        QApplication.restoreOverrideCursor()

        return QStringListModel(words, self.completer)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def save(self):
        filename, _ = QFileDialog.getSaveFileName(self,
                "Choose a file name", '.', "HTML (*.html *.htm)")
        if not filename:
            return

        file = QFile(filename)
        if not file.open(QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "Dock Widgets",
                    "Cannot write file %s:\n%s." % (filename, file.errorString()))
            return

        out = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        out << self.textEdit.toHtml()
        QApplication.restoreOverrideCursor()

        self.statusBar().showMessage("Saved '%s'" % filename, 2000)
项目:spyking-circus    作者:spyking-circus    | 项目源码 | 文件源码
def process_started(self):
        # Disable everything except for the stop button and the output area
        all_children = [obj for obj in self.ui.findChildren(QWidget)
                        if isinstance(obj, (QCheckBox, QPushButton, QLineEdit))]
        self._previous_state = [(obj, obj.isEnabled()) for obj in all_children]
        for obj in all_children:
            obj.setEnabled(False)
        self.ui.btn_stop.setEnabled(True)
        # If we let the user interact, this messes with the cursor we use to
        # support the progress bar display
        self.ui.edit_stdout.setTextInteractionFlags(Qt.NoTextInteraction)
        self.app.setOverrideCursor(Qt.WaitCursor)
项目:spyking-circus    作者:spyking-circus    | 项目源码 | 文件源码
def suggest_pairs(self, event):
        self.inspect_points = set()
        indices  = numpy.where(self.score_y > numpy.maximum(0, self.score_z-self.suggest_value))[0]
        self.app.setOverrideCursor(QCursor(Qt.WaitCursor))
        self.update_inspect(indices, add_or_remove='add')
        self.app.restoreOverrideCursor()
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def lockGUI(self, locked: bool) -> None:
        if locked:
            qApp.setOverrideCursor(Qt.WaitCursor)
            self.parent.cliplist.setEnabled(False)
            self.parent.parent.setEnabled(False)
            self.blockSignals(True)
        else:
            self.blockSignals(False)
            self.parent.parent.setEnabled(True)
            self.parent.cliplist.setEnabled(True)
            qApp.restoreOverrideCursor()
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def showKeyframes(self):
        qApp.setOverrideCursor(Qt.WaitCursor)
        keyframes = self.parent.videoService.getKeyframes(self.media, formatted_time=True)
        kframes = KeyframesDialog(keyframes, self)
        kframes.show()
项目:TextStageProcessor    作者:mhyhre    | 项目源码 | 文件源码
def makeClassification(self):
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.textEdit.setText("")
        self.checkBoxNeedPreprocessing.setEnabled(False)

        self.calculator.knn_n_neighbors = self.knn_n_neighbors.value()
        self.calculator.linear_svm_c = self.linear_svm_c.value()
        self.calculator.rbf_svm_c = self.rbf_svm_c.value()

        self.calculator.need_preprocessing = self.checkBoxNeedPreprocessing.isChecked()
        self.calculator.method_index = self.tabWidget.currentIndex()
        self.profiler.start()
        self.calculator.start()
项目:TextStageProcessor    作者:mhyhre    | 项目源码 | 文件源码
def processIt(self):
        self.buttonProcess.setEnabled(False)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.textEdit.setText("")
        self.calculator.need_preprocessing = self.checkBoxEnablePreprocessing.isChecked()
        self.calculator.need_apriori = self.checkBoxNeedApriori.isChecked()
        self.calculator.min_support = self.spinBoxMinSupport.value()
        self.calculator.min_conf = self.spinBoxMinConf.value()
        self.profiler.start()
        self.calculator.start()
项目:TextStageProcessor    作者:mhyhre    | 项目源码 | 文件源码
def process_it(self):
        self.buttonProcess.setEnabled(False)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.progressBar.setValue(0)
        self.textEdit.setText("")
        self.calculator.result_sentence_count = self.spinBoxOutputSentenceCount.value()

        if(self.radioButtonMethodWordsSum.isChecked()):
            self.calculator.setCalculationMethod(AnnotationMakerCalculator.METHOD_BY_WORDS_SUM)

        if (self.radioButtonMethodSentenceValue.isChecked()):
            self.calculator.setCalculationMethod(AnnotationMakerCalculator.METHOD_BY_SENTENCE_VALUE )
        self.profiler.start()
        self.calculator.start()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def loadFile(self, fileName):
        file = QFile(fileName)
        if not file.open( QFile.ReadOnly | QFile.Text):
            QMessageBox.warning(self, "Recent Files",
                    "Cannot read file %s:\n%s." % (fileName, file.errorString()))
            return

        instr = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.textEdit.setPlainText(instr.readAll())
        QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)
        self.statusBar().showMessage("File loaded", 2000)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def saveFile(self, fileName):
        file = QFile(fileName)
        if not file.open( QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "Recent Files",
                    "Cannot write file %s:\n%s." % (fileName, file.errorString()))
            return

        outstr = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        outstr << self.textEdit.toPlainText()
        QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)
        self.statusBar().showMessage("File saved", 2000)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def loadFile(self, fileName):
        file = QFile(fileName)
        if not file.open( QFile.ReadOnly | QFile.Text):
            QMessageBox.warning(self, "Recent Files",
                    "Cannot read file %s:\n%s." % (fileName, file.errorString()))
            return

        instr = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.textEdit.setPlainText(instr.readAll())
        QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)
        self.statusBar().showMessage("File loaded", 2000)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def saveFile(self, fileName):
        file = QFile(fileName)
        if not file.open( QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "Recent Files",
                    "Cannot write file %s:\n%s." % (fileName, file.errorString()))
            return

        outstr = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        outstr << self.textEdit.toPlainText()
        QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)
        self.statusBar().showMessage("File saved", 2000)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def resize_me(self):
        QApplication.instance().setOverrideCursor(Qt.WaitCursor)
        w = self.font().pointSize() + 2
        for i in range(10):
            self.setColumnWidth(i, 2 * w)
        for i in range(10, self.model().col_count):
            self.setColumnWidth(i, w * len(str(i + 1)))
        QApplication.instance().restoreOverrideCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def on_btn_fuzzing_clicked(self):
        fuz_mode = "Successive"
        if self.ui.rbConcurrent.isChecked():
            fuz_mode = "Concurrent"
        elif self.ui.rBExhaustive.isChecked():
            fuz_mode = "Exhaustive"

        self.setCursor(Qt.WaitCursor)
        fuzz_action = Fuzz(self.table_model.protocol, fuz_mode)
        self.table_model.undo_stack.push(fuzz_action)
        for row in fuzz_action.added_message_indices:
            self.table_model.update_checksums_for_row(row)
        self.unsetCursor()
        self.ui.tableMessages.setFocus()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def on_view_type_changed(self):
        self.setCursor(Qt.WaitCursor)
        self.table_model.proto_view = self.ui.cbViewType.currentIndex()
        self.ui.tableMessages.resize_columns()
        self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def on_fuzzing_finished(self):
        self.ui.stackedWidgetFuzzing.setCurrentWidget(self.ui.pageFuzzingUI)
        # Calculate Checksums for Fuzzed Messages
        self.setCursor(Qt.WaitCursor)

        self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def on_set_noise_in_graphic_view_clicked(self):
        self.setCursor(Qt.WaitCursor)
        start = self.ui.gvSignal.selection_area.x
        end = start + self.ui.gvSignal.selection_area.width

        new_thresh = self.signal.calc_noise_threshold(start, end)
        self.ui.spinBoxNoiseTreshold.setValue(new_thresh)
        self.ui.spinBoxNoiseTreshold.editingFinished.emit()
        self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def on_cb_signal_view_index_changed(self):
        self.setCursor(Qt.WaitCursor)

        self.__set_spectrogram_adjust_widgets_visibility()

        if self.ui.cbSignalView.currentText().lower() == "spectrogram":
            self.ui.stackedWidget.setCurrentWidget(self.ui.pageSpectrogram)
            self.draw_spectrogram(show_full_scene=True)
            self.__set_selected_bandwidth()
        else:
            self.ui.stackedWidget.setCurrentWidget(self.ui.pageSignal)
            self.ui.gvSignal.scene_type = self.ui.cbSignalView.currentIndex()
            self.ui.gvSignal.redraw_view(reinitialize=True)

            if self.ui.cbSignalView.currentIndex() == 1:
                self.ui.gvLegend.y_scene = self.scene_manager.scene.sceneRect().y()
                self.ui.gvLegend.scene_height = self.scene_manager.scene.sceneRect().height()
                self.ui.gvLegend.refresh()
            else:
                self.ui.gvLegend.hide()

            self.ui.gvSignal.auto_fit_view()
            self.ui.gvSignal.refresh_selection_area()
            self.on_slider_y_scale_value_changed()  # apply YScale to new view
            self.__set_samples_in_view()
            self.__set_duration()

        self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def on_bandpass_filter_triggered(self, f_low: float, f_high: float):
        self.filter_abort_wanted = False

        QApplication.instance().setOverrideCursor(Qt.WaitCursor)
        filter_bw = Filter.read_configured_filter_bw()
        filtered = Array("f", 2 * self.signal.num_samples)
        p = Process(target=perform_filter, args=(filtered, self.signal.data, f_low, f_high, filter_bw))
        p.daemon = True
        p.start()

        while p.is_alive():
            QApplication.instance().processEvents()

            if self.filter_abort_wanted:
                p.terminate()
                p.join()
                QApplication.instance().restoreOverrideCursor()
                return

            time.sleep(0.1)

        filtered = np.frombuffer(filtered.get_obj(), dtype=np.complex64)
        signal = self.signal.create_new(new_data=filtered.astype(np.complex64))
        signal.name = self.signal.name + " filtered with f_low={0:.4n} f_high={1:.4n} bw={2:.4n}".format(f_low, f_high,
                                                                                                         filter_bw)
        self.signal_created.emit(signal)
        QApplication.instance().restoreOverrideCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def add_signal(self, signal, group_id=0, index=-1):
        self.setCursor(Qt.WaitCursor)
        pa = ProtocolAnalyzer(signal)
        sig_frame = self.signal_tab_controller.add_signal_frame(pa, index=index)
        pa = self.compare_frame_controller.add_protocol(pa, group_id)

        signal.blockSignals(True)
        has_entry = self.project_manager.read_project_file_for_signal(signal)

        if not has_entry and not signal.changed:
            signal.auto_detect()

        signal.blockSignals(False)

        self.signal_protocol_dict[sig_frame] = pa

        sig_frame.refresh(draw_full_signal=True)  # protocol is derived here
        if self.project_manager.read_participants_for_signal(signal, pa.messages):
            sig_frame.ui.gvSignal.redraw_view()

        sig_frame.ui.gvSignal.auto_fit_view()
        self.set_frame_numbers()

        self.compare_frame_controller.filter_search_results()
        self.refresh_main_menu()
        self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def on_open_recent_action_triggered(self):
        action = self.sender()
        try:
            if os.path.isdir(action.data()):
                self.project_manager.set_project_folder(action.data())
            elif os.path.isfile(action.data()):
                self.setCursor(Qt.WaitCursor)
                self.add_files(FileOperator.uncompress_archives([action.data()], QDir.tempPath()))
                self.unsetCursor()
        except Exception as e:
            Errors.generic_error(self.tr("Failed to open"), str(e), traceback.format_exc())
            self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def on_signals_recorded(self, file_names: list, sample_rate: float):
        QApplication.instance().setOverrideCursor(Qt.WaitCursor)
        for filename in file_names:
            self.add_signalfile(filename, enforce_sample_rate=sample_rate)
        QApplication.instance().restoreOverrideCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __add_urls_to_group(self, file_urls, group_id=0):
        local_files = [file_url.toLocalFile() for file_url in file_urls if file_url.isLocalFile()]
        if len(local_files) > 0:
            self.setCursor(Qt.WaitCursor)
            self.add_files(FileOperator.uncompress_archives(local_files, QDir.tempPath()), group_id=group_id)
            self.unsetCursor()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def save_as(self, filename: str):
        QApplication.instance().setOverrideCursor(Qt.WaitCursor)
        self.filename = filename
        FileOperator.save_signal(self)
        self.name = os.path.splitext(os.path.basename(filename))[0]
        self.changed = False
        QApplication.instance().restoreOverrideCursor()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_file(self, fileName):
        """(file open for writing)-> boolean
        """
        fname = QFile(fileName)

        if not fname.open(QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "Application",
                                "Cannot write file %s:\n%s." % (fileName, fname.errorString()))
            return False

        outf = QTextStream(fname)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        outf << self.ui.textEdit.toPlainText()
        QApplication.restoreOverrideCursor()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_file(self, fileName):
        '''(file open for writing)-> boolean
        '''
        fname = QFile(fileName)

        if not fname.open(QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "Application",
                                "Cannot write file %s:\n%s." % (fileName, fname.errorString()))
            return False

        outf = QTextStream(fname)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        outf << self.ui.textEdit.toPlainText()
        QApplication.restoreOverrideCursor()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_file(self, filename):
        '''(file open for writing)-> boolean
        '''
        file_name = QFile(filename)

        if not file_name.open(QFile.WriteOnly | QFile.Text):
            return False

        outf = QTextStream(file_name)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        outf << self.ui.textEdit.toPlainText()
        QApplication.restoreOverrideCursor()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_file(self, filename):
        '''(file open for writing)-> boolean
        '''
        fname = QFile(filename)

        if not fname.open(QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "Application",
                                      "Cannot write file %s:\n%s." % (filename, fname.errorString()))
            return False

        outf = QTextStream(fname)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        outf << self.ui.textEdit.toPlainText()
        QApplication.restoreOverrideCursor()
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def loadFile(self, fileName):
        file = QFile(fileName)
        if not file.open( QFile.ReadOnly | QFile.Text):
            QMessageBox.warning(self, "Recent Files",
                    "Cannot read file %s:\n%s." % (fileName, file.errorString()))
            return

        instr = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.textEdit.setPlainText(instr.readAll())
        QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)
        self.statusBar().showMessage("File loaded", 2000)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def saveFile(self, fileName):
        file = QFile(fileName)
        if not file.open( QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "Recent Files",
                    "Cannot write file %s:\n%s." % (fileName, file.errorString()))
            return

        outstr = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        outstr << self.textEdit.toPlainText()
        QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)
        self.statusBar().showMessage("File saved", 2000)
项目:spyking-circus    作者:spyking-circus    | 项目源码 | 文件源码
def finalize(self, event):


        if comm.rank == 0:
            self.app.setOverrideCursor(QCursor(Qt.WaitCursor))
            self.mpi_wait = comm.bcast(numpy.array([1], dtype=numpy.int32), root=0)

        comm.Barrier()
        self.all_merges = comm.bcast(self.all_merges, root=0)
        self.to_delete  = comm.bcast(self.to_delete, root=0)

        slice_templates(self.params, to_merge=self.all_merges, to_remove=list(self.to_delete), extension=self.ext_out)
        slice_clusters(self.params, self.clusters, to_merge=self.all_merges, to_remove=list(self.to_delete), extension=self.ext_out, light=True)

        if comm.rank == 0:
            new_result = {'spiketimes' : {}, 'amplitudes' : {}}

            to_keep = set(numpy.unique(self.indices)) - set(self.to_delete)
            to_keep = numpy.array(list(to_keep))

            for count, temp_id in enumerate(to_keep):
                key_before = 'temp_' + str(temp_id)
                key_after  = 'temp_' + str(count)
                new_result['spiketimes'][key_after] = self.result['spiketimes'].pop(key_before)
                new_result['amplitudes'][key_after] = self.result['amplitudes'].pop(key_before)

            keys = ['spiketimes', 'amplitudes']

            if self.params.getboolean('fitting', 'collect_all'):
                keys += ['gspikes']
                new_result['gspikes'] = io.get_garbage(self.params)['gspikes']

            mydata = h5py.File(self.file_out_suff + '.result%s.hdf5' %self.ext_out, 'w', libver='latest')
            for key in keys:
                mydata.create_group(key)
                for temp in new_result[key].keys():
                    tmp_path = '%s/%s' %(key, temp)
                    mydata.create_dataset(tmp_path, data=new_result[key][temp])
            mydata.close()

            mydata  = h5py.File(self.file_out_suff + '.templates%s.hdf5' %self.ext_out, 'r+', libver='latest')
            version     = mydata.create_dataset('version', data=numpy.array([circus.__version__.encode('ascii', 'ignore')]))
            maxoverlaps = mydata.create_dataset('maxoverlap', shape=(len(to_keep), len(to_keep)), dtype=numpy.float32)
            maxlag      = mydata.create_dataset('maxlag', shape=(len(to_keep), len(to_keep)), dtype=numpy.int32)
            for c, i in enumerate(to_keep):
                maxoverlaps[c, :] = self.overlap[i, to_keep]*self.shape[0] * self.shape[1]
                maxlag[c, :]      = self.lag[i, to_keep]
            mydata.close()

            self.app.restoreOverrideCursor()

        sys.exit(0)
项目:QtPropertyBrowserV2.6-for-pyqt5    作者:theall    | 项目源码 | 文件源码
def __init__(self):
        self.m_cursorNames = QList()
        self.m_cursorIcons = QMap()
        self.m_valueToCursorShape = QMap()
        self.m_cursorShapeToValue = QMap()

        self.appendCursor(Qt.ArrowCursor, QCoreApplication.translate("QtCursorDatabase", "Arrow"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-arrow.png"))
        self.appendCursor(Qt.UpArrowCursor, QCoreApplication.translate("QtCursorDatabase", "Up Arrow"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-uparrow.png"))
        self.appendCursor(Qt.CrossCursor, QCoreApplication.translate("QtCursorDatabase", "Cross"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-cross.png"))
        self.appendCursor(Qt.WaitCursor, QCoreApplication.translate("QtCursorDatabase", "Wait"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-wait.png"))
        self.appendCursor(Qt.IBeamCursor, QCoreApplication.translate("QtCursorDatabase", "IBeam"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-ibeam.png"))
        self.appendCursor(Qt.SizeVerCursor, QCoreApplication.translate("QtCursorDatabase", "Size Vertical"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizev.png"))
        self.appendCursor(Qt.SizeHorCursor, QCoreApplication.translate("QtCursorDatabase", "Size Horizontal"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizeh.png"))
        self.appendCursor(Qt.SizeFDiagCursor, QCoreApplication.translate("QtCursorDatabase", "Size Backslash"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizef.png"))
        self.appendCursor(Qt.SizeBDiagCursor, QCoreApplication.translate("QtCursorDatabase", "Size Slash"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizeb.png"))
        self.appendCursor(Qt.SizeAllCursor, QCoreApplication.translate("QtCursorDatabase", "Size All"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizeall.png"))
        self.appendCursor(Qt.BlankCursor, QCoreApplication.translate("QtCursorDatabase", "Blank"),
                     QIcon())
        self.appendCursor(Qt.SplitVCursor, QCoreApplication.translate("QtCursorDatabase", "Split Vertical"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-vsplit.png"))
        self.appendCursor(Qt.SplitHCursor, QCoreApplication.translate("QtCursorDatabase", "Split Horizontal"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-hsplit.png"))
        self.appendCursor(Qt.PointingHandCursor, QCoreApplication.translate("QtCursorDatabase", "Pointing Hand"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-hand.png"))
        self.appendCursor(Qt.ForbiddenCursor, QCoreApplication.translate("QtCursorDatabase", "Forbidden"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-forbidden.png"))
        self.appendCursor(Qt.OpenHandCursor, QCoreApplication.translate("QtCursorDatabase", "Open Hand"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-openhand.png"))
        self.appendCursor(Qt.ClosedHandCursor, QCoreApplication.translate("QtCursorDatabase", "Closed Hand"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-closedhand.png"))
        self.appendCursor(Qt.WhatsThisCursor, QCoreApplication.translate("QtCursorDatabase", "What's This"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-whatsthis.png"))
        self.appendCursor(Qt.BusyCursor, QCoreApplication.translate("QtCursorDatabase", "Busy"),
                     QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-busy.png"))
项目:TextStageProcessor    作者:mhyhre    | 项目源码 | 文件源码
def OnStartMethod(self):
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.startMethod.setEnabled(False)
        self.tabWidget.setEnabled(False)

        self.textEdit.setText("")
        plt.cla()
        plt.clf()

        self.calculator.set_method_index(self.tabWidget.currentIndex())

        self.calculator.need_preprocessing = self.checkBoxNeedPreprocessing.isChecked()
        self.checkBoxNeedPreprocessing.setEnabled(False)

        self.calculator.need_tf_idf = self.checkBoxNeedCalculateTFIDF.isChecked()
        self.checkBoxNeedCalculateTFIDF.setEnabled(False)

        # ???????? ????????? ? ????? ? ???????
        self.calculator.kmeans_cluster_count = self.kmeans_cluster_count.value()

        self.calculator.dbscan_min_pts = self.dbscan_min_pts.value()
        self.calculator.dbscan_eps = self.dbscan_eps.value()

        self.calculator.ward_clusters_count = self.ward_clusters_count.value()

        self.calculator.spectral_clusters_count = self.spectral_clusters_count.value()

        self.calculator.aa_damping = self.aa_damping.value()
        self.calculator.aa_max_iter = self.aa_max_iter.value()
        self.calculator.aa_no_change_stop = self.aa_no_change_stop.value()

        self.calculator.mean_shift_quantile = self.mean_shift_quantile.value()

        self.calculator.birch_threshold = self.birch_threshold.value()
        self.calculator.birch_branching_factor = self.birch_branching_factor.value()
        self.calculator.birch_clusters_count = self.birch_clusters_count.value()

        self.profiler.start()
        self.calculator.start()


    # ??????? ??? ?????????? ????????