def readDB(self): """Datamodel includes the following files: config.dat, devices.dat """ singleton.data_model = DataModel(directory = self.config_dir.get()) # singleton.data_model = DataModel(directory = tools.getConfigDir()) if (self.first_start): print(pre, "readDB : first start") singleton.data_model.clearAll() singleton.data_model.saveAll() # If camera collection is corrupt if not singleton.data_model.checkCameraCollection(): singleton.data_model.clearCameraCollection()
class MyGui(QtWidgets.QMainWindow): def __init__(self, parent=None): super(MyGui, self).__init__() self.initVars() self.setupUi() def initVars(self): self.dm = DataModel(directory=singleton.config_dir.get()) # self.dm.clearAll() print(cute_mongo_forms.__file__) def setupUi(self): # self.setGeometry(QtCore.QRect(100,100,500,500)) self.w = QtWidgets.QWidget(self) self.setCentralWidget(self.w) self.lay = QtWidgets.QVBoxLayout(self.w) self.container = self.dm.getDeviceListAndForm(self.w) self.lay.addWidget(self.container.widget) def closeEvent(self, e): print("closeEvent!") e.accept()
def test1(): dm = DataModel() dm.clearAll() dm.saveAll() collection = dm.camera_collection collection.new( RTSPCameraRow, { "slot": 1, "address": "192.168.1.41", "username": "******", "password": "******", "tail": "" }) collection.new( RTSPCameraRow, { "slot": 2, "address": "192.168.1.42", "username": "******", "password": "******", "tail": "" }) for element in collection.get(): print("test1 : 1", element) gpu_handler = GPUHandler(n_720p=5, n_1080p=5, n_1440p=0, n_4K=0, msbuftime=300, verbose=False) livethread = LiveThread( name="live_thread", # verbose = True, verbose=False, # affinity = self.pardic["live affinity"] ) filterchain_group = FilterChainGroup(datamodel=dm, livethread=livethread, gpu_handler=gpu_handler, verbose=True) filterchain_group.update() print("\n ADDING ONE \n") collection.new( RTSPCameraRow, { "slot": 3, "address": "192.168.1.43", "username": "******", "password": "******", "tail": "" }) filterchain_group.update() print("\n REMOVING ONE \n") entry = next(collection.get({"address": "192.168.1.41"})) collection.delete(entry["_id"]) filterchain_group.update() print("\n BYE \n") filterchain_group.close()
def initVars(self): self.dm = DataModel(directory=singleton.config_dir.get()) # self.dm.clearAll() print(cute_mongo_forms.__file__)
def initVars(self): from valkka.live.datamodel.base import DataModel singleton.data_model = DataModel(directory=singleton.config_dir.get())