Пример #1
0
def initQCoreApplication():
    """ Initializes the QtCore.QApplication instance. Creates one if it doesn't exist.

        Sets Argos specific attributes, such as the OrganizationName, so that the application
        persistent settings are read/written to the correct settings file/winreg. It is therefore
        important to call this function (or initQApplication) at startup.

        Returns the application.
    """
    app = QtCore.QCoreApplication(sys.argv)
    initArgosApplicationSettings(app)
    return app
Пример #2
0
    def __init__(self, argv, locale=None, gui=True, icon_themes=None):
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        standard.install()
        icons.install(icon_themes or get_icon_themes())

        if gui:
            self._app = ColaQApplication(list(argv))
            self._app.setWindowIcon(icons.cola())
            self._install_style()
        else:
            self._app = QtCore.QCoreApplication(argv)
Пример #3
0
    def __init__(self, argv, locale=None, gui=True):
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()
        icons.install()

        fsmonitor.current().files_changed.connect(self._update_files)

        if gui:
            self._app = current(tuple(argv))
            self._app.setWindowIcon(icons.cola())
        else:
            self._app = QtCore.QCoreApplication(argv)
Пример #4
0
    def on_messageReceived_sub(self, sub, msg):
        print("on_messageReceived_sub", sub, msg.payload)
        if msg.payload == b"200":
            print("unsubscribe")
            self.client.unsubscribe(sub.topic)

    def on_disconnect(self):
        print("on_disconnect")
        self.timer.stop()
        QtCore.QCoreApplication.quit()

    def on_messageSent(self, mid):
        print("on_messageSent", mid)

    def publish(self):
        mid = self.client.publish("foo/bar", str(self.m_counter).encode())
        print(mid)
        self.m_counter += 1

    @QtCore.Slot(bytes, MqttTopicName)
    def on_messageReceived(self, msg, topic):
        print("on_messageReceived", msg, topic)


if __name__ == "__main__":
    import sys

    app = QtCore.QCoreApplication(sys.argv)
    rec = Receiver()
    sys.exit(app.exec_())