Python PyQt5.QtWidgets.QApplication.__init__() Examples

The following are code examples for showing how to use PyQt5.QtWidgets.QApplication.__init__(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: Linalfred   Author: PeterHo   File: singleton.py    MIT License 5 votes vote down vote up
def __init__(self, argv, application_id=None):
        QApplication.__init__(self, argv)

        self.socket_filename = os.path.expanduser("~/.ipc_%s" % self.generate_ipc_id())
        self.shared_mem = QSharedMemory()
        self.shared_mem.setKey(self.socket_filename)

        if self.shared_mem.attach():
            self.is_running = True
            return

        self.is_running = False
        if not self.shared_mem.create(1):
            print("Unable to create single instance")
            return
        # start local server
        self.server = QLocalServer(self)
        # connect signal for incoming connections
        self.server.newConnection.connect(self.receive_message)
        # if socket file exists, delete it
        if os.path.exists(self.socket_filename):
            os.remove(self.socket_filename)
        # listen
        self.server.listen(self.socket_filename)

        SingletonApp.instance = self

        # 监听关闭事件
        signal.signal(signal.SIGINT, self.onExit)
        # signal.signal(signal.SIGKILL, onExit)
        signal.signal(signal.SIGTERM, self.onExit)
        self.timer = QTimer()
        self.timer.start(500)
        self.timer.timeout.connect(lambda: None) 
Example 2
Project: ems   Author: mtils   File: qmlwidget_app.py    MIT License 5 votes vote down vote up
def __init__(self, argv, path=None):
        '''
        Constructor
        '''
        kwargs = {
            'argv': sys.argv,
            'path': path
        }
        #print(kwargs)
        #super().__init__(argv, path=path)
        #super().__init__(argv)
        
        #super().__init__(**kwargs)
        BaseApp.__init__(self, argv, path)
        try:
            QApplication.__init__(self, argv)
        except TypeError:
            pass
        
        #QApplication.__init__(self, argv)
        #QApplication.__init__(self, [])

        self._services = {}
        self._serviceTimers = {}
        self._standardActions = {}
        self._widgetController = None 
Example 3
Project: ems   Author: mtils   File: qwidget_app.py    MIT License 5 votes vote down vote up
def __init__(self, argv, path=None):
        '''
        Constructor
        '''
        kwargs = {
            'argv': sys.argv,
            'path': path
        }
        #print(kwargs)
        #super().__init__(argv, path=path)
        #super().__init__(argv)
        
        #super().__init__(**kwargs)
        BaseApp.__init__(self, argv, path)
        try:
            QApplication.__init__(self, argv)
        except TypeError:
            pass
        
        #QApplication.__init__(self, argv)
        #QApplication.__init__(self, [])

        self._services = {}
        self._serviceTimers = {}
        self._standardActions = {}
        self._widgetController = None 
Example 4
Project: Tachy2GIS   Author: Archaeological-Museum-Hamburg   File: TachyTestFixture.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, args):
        QApplication.__init__(self, args)
        self.tachyReader = TachyReader(QSerialPort.Baud9600)
        self.tachyReader.setPort('COM10')
        self.pollingThread = QThread()
        self.tachyReader.moveToThread(self.pollingThread)
        self.pollingThread.start()
        self.tachyReader.lineReceived.connect(self.vertexReceived)
        self.tachyReader.beginListening()
        self.lineCount = 0 
Example 5
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self):
            QObject.__init__(self)
            self._filesize = None 
Example 6
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QObject.__init__(self)
        self.filters = []
        self._paused = False
        self._localAPI = TaskhiveAPI() 
Example 7
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI() 
Example 8
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QObject.__init__(self)
        self._msgThread = None
        self._sendThread = None
        self._inboxThread = None 
Example 9
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, task_id):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI()
        self,task_id = task_id

    #def run(self):
     #   self._localAPI.create_bitmessage_api()
      #  messages = self._localAPI. 
Example 10
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, task_JSON):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI()
        self._JSON = task_JSON 
Example 11
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI() 
Example 12
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI() 
Example 13
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QObject.__init__(self) 
Example 14
Project: taskhive-core   Author: RZZT   File: taskhive.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self):
            QObject.__init__(self)
            self.db = DatabaseConnection() 
Example 15
Project: HearthPacks   Author: Arzaroth   File: gui.py    BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __init__(self, opts):
        QApplication.__init__(self, [])
        self.opts = opts
        self.initUI() 
Example 16
Project: spyrit   Author: pvaret   File: Application.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__( self, args ):

    QApplication.__init__( self, args )

    self.args           = args
    self.bootstrapped   = False
    self.local_encoding = locale.getpreferredencoding()  ## Try to guess the
                                                         ## local encoding.
    self.core = None

    self.aboutToQuit.connect( self.beforeStop )