def __init__(self, *args, **kwargs): self.mainWindow = None self.connections = {} self.connectionsChanged = Signal() self.update = Signal() self.update.connect(self.connectionsChanged) self.qObj = QtCore.QObject() # common shared data from processes self.sharedData = {} # bridge files and directories to watch for updates # could make this a map of # {file : every callback that depends on it?} self._bridgeFilePaths = [] # watch them # test to make file paths update live self.watcher = QtCore.QFileSystemWatcher( parent=self.qObj) # actually this is probably extremely unsafe # map of fileName : pid? or process object? self.processes = {} # timer to poll them so we know if a program is shut down self.timer = QtCore.QTimer(parent=self.qObj) self.timer.setTimerType(QtCore.Qt.VeryCoarseTimer)
def getObject(self): if self._o: return self._o self._o = QtCore.QObject() self._o.setObjectName("PySideObject") return self._o
def populateList(self, lst): o = QtCore.QObject() o.setObjectName("obj") item = QtWidgets.QListWidgetItem("item0") item.setData(QtCore.Qt.UserRole, o) #item._data = o self.assertTrue(sys.getrefcount(o), 3) self.assertTrue(sys.getrefcount(item), 2) lst.addItem(item) self.assertTrue(sys.getrefcount(item), 3)
def testAdresses(self): q = QtCore.QObject() ptr = wrapper.getCppPointer(q) print("CppPointer to an instance of PySide.QtCore.QObject = 0x%016X" % ptr[0]) # None of the following is expected to raise an # OverflowError on 64-bit systems # largest 32-bit address wrapper.wrapInstance(0xFFFFFFFF, QtCore.QObject) # a regular, slightly smaller 32-bit address wrapper.wrapInstance(0xFFFFFFF, QtCore.QObject) # an actual 64-bit address (> 4 GB, the first non 32-bit address) wrapper.wrapInstance(0x100000000, QtCore.QObject) # largest 64-bit address wrapper.wrapInstance(0xFFFFFFFFFFFFFFFF, QtCore.QObject)
def __init__(self, session_bus): dbus.service.Object.__init__(self, session_bus, "/ServerController") QtCore.QCoreApplication.instance().aboutToQuit.connect( self._on_application_quit) try: app_name = QtCore.QCoreApplication.applicationName() self.object = QtCore.QObject() self.configuration = config.Configuration( config.get_config_directory(app_name)) self.configuration.write_config() self.directory_tree = model.DirectoryTree( self.configuration.config.base_directory) self.communication_server = server.CommunicationServer( self.configuration.config.starting_port, self.directory_tree, self.object) self.video_server = server.VideoServer( self.configuration.config.starting_port + 1, self.directory_tree, self.object) except Exception as exc: ErrorHandler.handle_exception(exc) return self.communication_server.error_occurred.connect( ErrorHandler.handle_error)
def testReference(self): o = QtCore.QObject() m = MyObject(o) self.assertEqual(sys.getrefcount(o), 3) del m self.assertEqual(sys.getrefcount(o), 2)
def testGet(self): o = QtCore.QObject() setValue(o) self.assertEqual(o.property('test1'), ['Name'])