Python PyQt5.QtWidgets.QApplication.setOverrideCursor() Examples

The following are 9 code examples of PyQt5.QtWidgets.QApplication.setOverrideCursor(). 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 also want to check out all available functions/classes of the module PyQt5.QtWidgets.QApplication , or try the search function .
Example #1
Source File: foldArea.py    From Hydra with GNU General Public License v3.0 7 votes vote down vote up
def mouseMoveEvent(self, event: QMouseEvent) -> None:

        pattern = re.compile(FOLDING_PATTERN)
        block: QTextBlock = self.editor.getBlockUnderCursor(event)

        if pattern.match(block.text()):

            cursor: QCursor = QCursor(Qt.PointingHandCursor)
            QApplication.setOverrideCursor(cursor)
            QApplication.changeOverrideCursor(cursor)

        else:

            self.returnCursorToNormal() 
Example #2
Source File: CSVImportDialog.py    From urh with GNU General Public License v3.0 6 votes vote down vote up
def on_accepted(self):
        QApplication.setOverrideCursor(Qt.WaitCursor)

        iq_data, sample_rate = self.parse_csv_file(self.filename, self.ui.comboBoxCSVSeparator.currentText(),
                                                   self.ui.spinBoxIDataColumn.value()-1,
                                                   self.ui.spinBoxQDataColumn.value()-1,
                                                   self.ui.spinBoxTimestampColumn.value()-1)

        target_filename = self.filename.rstrip(".csv")
        if os.path.exists(target_filename + ".complex"):
            i = 1
            while os.path.exists(target_filename + "_" + str(i) + ".complex"):
                i += 1
        else:
            i = None

        target_filename = target_filename if not i else target_filename + "_" + str(i)
        target_filename += ".complex"

        iq_data.tofile(target_filename)

        self.data_imported.emit(target_filename, sample_rate if sample_rate is not None else 0)
        QApplication.restoreOverrideCursor() 
Example #3
Source File: SignalFrame.py    From urh with GNU General Public License v3.0 6 votes vote down vote up
def on_export_fta_wanted(self):
        try:
            initial_name = self.signal.name + "-spectrogram.ft"
        except Exception as e:
            logger.exception(e)
            initial_name = "spectrogram.ft"

        filename = FileOperator.get_save_file_name(initial_name, caption="Export spectrogram")
        if not filename:
            return
        QApplication.setOverrideCursor(Qt.WaitCursor)
        try:
            self.ui.gvSpectrogram.scene_manager.spectrogram.export_to_fta(sample_rate=self.signal.sample_rate,
                                                                          filename=filename,
                                                                          include_amplitude=filename.endswith(".fta"))
        except Exception as e:
            Errors.exception(e)
        finally:
            QApplication.restoreOverrideCursor() 
Example #4
Source File: ProjectManager.py    From urh with GNU General Public License v3.0 6 votes vote down vote up
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 = file_tag.attrib["name"]
                if not os.path.isfile(filename):
                    filename = os.path.normpath(os.path.join(self.project_path, filename))
                file_names.insert(pos, filename)

            QApplication.setOverrideCursor(Qt.WaitCursor)
            file_names = FileOperator.uncompress_archives(file_names, QDir.tempPath())
            QApplication.restoreOverrideCursor()
            return file_names
        return [] 
Example #5
Source File: interSubs.py    From interSubs with MIT License 5 votes vote down vote up
def main(self):
		while 1:
			to_new_word = False

			try:
				word, globalX = config.queue_to_translate.get(False)
			except:
				time.sleep(config.update_time)
				continue

			# changing cursor to hourglass during translation
			QApplication.setOverrideCursor(Qt.WaitCursor)

			threads = []
			for translation_function_name in config.translation_function_names:
				threads.append(threading.Thread(target = globals()[translation_function_name], args = (word,)))
			for x in threads:
				x.start()
			while any(thread.is_alive() for thread in threads):
				if config.queue_to_translate.qsize():
					to_new_word = True
					break
				time.sleep(config.update_time)

			QApplication.restoreOverrideCursor()

			if to_new_word:
				continue

			if config.block_popup:
				continue

			self.get_translations.emit(word, globalX, False)

# drawing layer
# because can't calculate outline with precision 
Example #6
Source File: media_cue_menus.py    From linux-show-player with GNU General Public License v3.0 5 votes vote down vote up
def add_uri_audio_media_cue():
        """Add audio MediaCue(s) form user-selected files"""

        if get_backend() is None:
            QMessageBox.critical(MainWindow(), 'Error', 'Backend not loaded')
            return

        # Default path to system "music" folder
        path = QStandardPaths.writableLocation(QStandardPaths.MusicLocation)

        # Get the backend extensions and create a filter for the Qt file-dialog
        extensions = get_backend().supported_extensions()
        filters = qfile_filters(extensions, anyfile=False)
        # Display a file-dialog for the user to choose the media-files
        files, _ = QFileDialog.getOpenFileNames(MainWindow(),
                                                translate('MediaCueMenus',
                                                          'Select media files'),
                                                path, filters)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        # Create media cues, and add them to the Application cue_model
        for file in files:
            cue = CueFactory.create_cue('URIAudioCue', uri='file://' + file)
            # Use the filename without extension as cue name
            cue.name = os.path.splitext(os.path.basename(file))[0]
            Application().cue_model.add(cue)

        QApplication.restoreOverrideCursor() 
Example #7
Source File: canvas.py    From CNNArt with Apache License 2.0 5 votes vote down vote up
def override_cursor(self, cursor):
        self._cursor = cursor
        if self.current_cursor() is None:
            QApplication.setOverrideCursor(cursor)
        else:
            QApplication.changeOverrideCursor(cursor) 
Example #8
Source File: foldArea.py    From Hydra with GNU General Public License v3.0 5 votes vote down vote up
def returnCursorToNormal(self) -> None:

        cursor: QCursor = QCursor(Qt.ArrowCursor)
        QApplication.setOverrideCursor(cursor)
        QApplication.changeOverrideCursor(cursor) 
Example #9
Source File: SignalFrame.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
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.iq_array.as_complex64(), 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()