Python PyQt5.QtWidgets.QApplication.processEvents() Examples

The following are 17 code examples of PyQt5.QtWidgets.QApplication.processEvents(). 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: test_uamodeler.py    From opcua-modeler with GNU General Public License v3.0 6 votes vote down vote up
def test_delete_save(modeler, mgr, model):
    path = "test_delete_save.uamodel"
    val = 0.99
    modeler.tree_ui.expand_to_node("Objects")
    obj_node = mgr.add_folder(1, "myobj")
    obj2_node = mgr.add_folder(1, "myobj2")
    QApplication.processEvents()
    modeler.tree_ui.expand_to_node("myobj2")
    var_node = mgr.add_variable(1, "myvar", val)
    mgr.save_ua_model(path)
    mgr.save_xml(path)

    QApplication.processEvents()
    modeler.tree_ui.expand_to_node(obj2_node)
    mgr.delete_node(obj2_node)
    mgr.save_ua_model(path)
    mgr.save_xml(path)
    assert obj2_node not in mgr.new_nodes
    assert var_node not in mgr.new_nodes 
Example #2
Source File: hidden_model.py    From Offline-MapMatching with GNU General Public License v3.0 5 votes vote down vote up
def initProgressbar(self, maximum):
        if self.pb is not None:
            self.pb.setValue(0)
            self.pb.setMaximum(maximum)
            QApplication.processEvents() 
Example #3
Source File: trezorClient.py    From PIVX-SPMT with MIT License 5 votes vote down vote up
def updateSigProgress(self, percent):
        # -1 simply adds a waiting message to the actual progress
        if percent == -1:
            t = self.mBox2.text()
            messageText = t + "<br>Please confirm action on your Trezor device..."
        else:
            messageText = self.messageText + "Signature Progress: <b style='color:red'>" + str(percent) + " %</b>"
        self.mBox2.setText(messageText)
        QApplication.processEvents()



# From trezorlib.btc 
Example #4
Source File: ledgerClient.py    From PIVX-SPMT with MIT License 5 votes vote down vote up
def updateSigProgress(self, percent):
        messageText = self.messageText + "Signature Progress: <b style='color:red'>" + str(percent) + " %</b>"
        self.mBox2.setText(messageText)
        QApplication.processEvents() 
Example #5
Source File: test_simulator_tab_gui.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def test_participant_table(self):
        stc = self.form.simulator_tab_controller  # type: SimulatorTabController
        stc.ui.tabWidget.setCurrentIndex(2)
        self.assertEqual(stc.participant_table_model.rowCount(), 0)

        for i in range(3):
            stc.ui.btnAddParticipant.click()

        QApplication.processEvents()
        self.assertEqual(stc.participant_table_model.rowCount(), 3)

        participants = stc.project_manager.participants
        self.assertEqual(participants[0].name, "Alice")
        self.assertEqual(participants[1].name, "Bob")
        self.assertEqual(participants[2].name, "Carl")

        stc.ui.tableViewParticipants.selectRow(1)
        stc.ui.btnUp.click()

        self.assertEqual(participants[0].name, "Bob")
        self.assertEqual(participants[1].name, "Alice")
        self.assertEqual(participants[2].name, "Carl")

        stc.ui.btnDown.click()

        self.assertEqual(participants[0].name, "Alice")
        self.assertEqual(participants[1].name, "Bob")
        self.assertEqual(participants[2].name, "Carl")

        stc.ui.btnDown.click()

        self.assertEqual(participants[0].name, "Alice")
        self.assertEqual(participants[1].name, "Carl")
        self.assertEqual(participants[2].name, "Bob") 
Example #6
Source File: splash.py    From QssStylesheetEditor with GNU General Public License v3.0 5 votes vote down vote up
def clearMessage(self):
        """Clear message on the splash image"""
        super(SplashScreen, self).clearMessage()
        QApplication.processEvents() 
Example #7
Source File: splash.py    From QssStylesheetEditor with GNU General Public License v3.0 5 votes vote down vote up
def showMessage(self, msg):
        """Show the progress message on the splash image"""
        super(SplashScreen, self).showMessage(msg, self.labelAlignment, Qt.white)
        QApplication.processEvents() 
Example #8
Source File: load_visuals_txt.py    From bluesky with GNU General Public License v3.0 5 votes vote down vote up
def update(self, value):
            if self.dialog:
                self.dialog.setValue(value)
                QApplication.processEvents()
            else:
                print('Progress: %.2f%% done' % value) 
Example #9
Source File: base.py    From wonambi with GNU General Public License v3.0 5 votes vote down vote up
def _repr_png_(self):
        """This is used by ipython to plot inline.
        """
        app.process_events()
        QApplication.processEvents()

        img = read_pixels()
        return bytes(_make_png(img)) 
Example #10
Source File: hidden_model.py    From Offline-MapMatching with GNU General Public License v3.0 5 votes vote down vote up
def updateProgressbar(self):
        if self.pb is not None:
            self.pb.setValue(self.pb.value() + 1)
            QApplication.processEvents() 
Example #11
Source File: webengineelem.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def _click_js(self, _click_target: usertypes.ClickTarget) -> None:
        # FIXME:qtwebengine Have a proper API for this
        # pylint: disable=protected-access
        view = self._tab._widget
        assert view is not None
        # pylint: enable=protected-access
        attribute = QWebEngineSettings.JavascriptCanOpenWindows
        could_open_windows = view.settings().testAttribute(attribute)
        view.settings().setAttribute(attribute, True)

        # Get QtWebEngine do apply the settings
        # (it does so with a 0ms QTimer...)
        # This is also used in Qt's tests:
        # https://github.com/qt/qtwebengine/commit/5e572e88efa7ba7c2b9138ec19e606d3e345ac90
        QApplication.processEvents(  # type: ignore[call-overload]
            QEventLoop.ExcludeSocketNotifiers |
            QEventLoop.ExcludeUserInputEvents)

        def reset_setting(_arg: typing.Any) -> None:
            """Set the JavascriptCanOpenWindows setting to its old value."""
            assert view is not None
            try:
                view.settings().setAttribute(attribute, could_open_windows)
            except RuntimeError:
                # Happens if this callback gets called during QWebEnginePage
                # destruction, i.e. if the tab was closed in the meantime.
                pass

        self._js_call('click', callback=reset_setting) 
Example #12
Source File: QgsVideo.py    From QGISFMV with GNU General Public License v3.0 5 votes vote down vote up
def resizeEvent(self, _):
        """
        @type _: QMouseEvent
        @param _:
        @return:
        """
        self.surface.updateVideoRect()
        self.update()
        # Magnifier Glass
        if self._interaction.magnifier and not self.dragPos.isNull():
            draw.drawMagnifierOnVideo(self, self.dragPos, self.currentFrame(), self.painter)
        # QApplication.processEvents() 
Example #13
Source File: QgsVideo.py    From QGISFMV with GNU General Public License v3.0 5 votes vote down vote up
def UpdateSurface(self):
        ''' Update Video Surface only is is stopped or paused '''
        if self.parent.playerState in (QMediaPlayer.StoppedState,
                                       QMediaPlayer.PausedState):
            self.update()
        QApplication.processEvents() 
Example #14
Source File: instance_widget.py    From parsec-cloud with GNU Affero General Public License v3.0 5 votes vote down vote up
def clear_widgets(self):
        item = self.layout().takeAt(0)
        if item:
            item.widget().hide()
            item.widget().setParent(None)
        QApplication.processEvents() 
Example #15
Source File: history.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def tick(self):
        """Increase the displayed progress value."""
        self._value += 1
        if self._progress is not None:
            self._progress.setValue(self._value)
            QApplication.processEvents() 
Example #16
Source File: history.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def start(self, text, maximum):
        """Start showing a progress dialog."""
        self._progress = QProgressDialog()
        self._progress.setMinimumDuration(500)
        self._progress.setLabelText(text)
        self._progress.setMaximum(maximum)
        self._progress.setCancelButton(None)
        self._progress.show()
        QApplication.processEvents() 
Example #17
Source File: test_uamodeler.py    From opcua-modeler with GNU General Public License v3.0 4 votes vote down vote up
def test_structs_2(modeler, mgr):
    mgr.new_model()

    urns = modeler.get_current_server().get_namespace_array()
    ns_node = mgr.server_mgr.get_node(ua.ObjectIds.Server_NamespaceArray)
    urns = ns_node.get_value()
    urns.append("urn://modeller/testing")
    ns_node.set_value(urns)

    path = "test_save_structs_2.xml"

    struct_node = mgr.server_mgr.get_node(ua.ObjectIds.Structure)
    modeler.tree_ui.expand_to_node(struct_node)
    mystruct = mgr.add_data_type(1, "MyStruct")
    QApplication.processEvents()
    modeler.tree_ui.expand_to_node("MyStruct")
    var_node = mgr.add_variable(1, "myvar", 0.1)

    mgr.save_xml(path)
    mgr.close_model()
    mgr.open_xml(path)

    struct_node = mgr.server_mgr.get_node(ua.ObjectIds.Structure)
    mystruct_node = struct_node.get_child("1:MyStruct")
    var2_node = mystruct_node.add_variable(1, "myvar2", 0.2)
    # following code break...why??!?!??!
    #QApplication.processEvents()
    #modeler.tree_ui.expand_to_node("MyStruct")
    #var2_node = mgr.add_variable(1, "myvar2", 0.2)

    mgr.save_xml(path)
    mgr.close_model()
    mgr.open_xml(path)

    struct_node = mgr.server_mgr.get_node(ua.ObjectIds.Structure)
    mystruct = struct_node.get_child("1:MyStruct")
    assert len(mystruct.get_children()) == 2

    mgr.server_mgr.load_type_definitions()

    st = ua.MyStruct()
    assert hasattr(st, "myvar")
    assert hasattr(st, "myvar2")
    mgr.close_model()