MCPcopy Create free account
hub / github.com/PyQt5/PyQt / __init__

Method __init__

Demo/Lib/Application.py:20–38  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

18class SharedApplication(QApplication):
19
20 def __init__(self, *args, **kwargs):
21 super(SharedApplication, self).__init__(*args, **kwargs)
22 self._running = False
23 key = "SharedApplication"
24 self._memory = QSharedMemory(key, self)
25
26 isAttached = self._memory.isAttached()
27 print("isAttached", isAttached)
28 if isAttached: # 如果进程附加在共享内存上
29 detach = self._memory.detach() # 取消进程附加在共享内存上
30 print("detach", detach)
31
32 if self._memory.create(1) and self._memory.error() != QSharedMemory.AlreadyExists:
33 # 创建共享内存,如果创建失败,则说明已经创建,否则未创建
34 print("create ok")
35 else:
36 print("create failed")
37 self._running = True
38 del self._memory
39
40 def isRunning(self):
41 return self._running

Callers 1

__init__Method · 0.45

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected