Example #1
0
 def slot_func():
     if ((cl.tag in self.process_map)
             and (len(self.process_map[cl.tag]) > 0)):
         cont = container.VideoContainerNxM(
             parent=None,
             gpu_handler=self.gpu_handler,
             filterchain_group=self.filterchain_group,
             title=cl.name,
             n_dim=1,
             m_dim=1,
             child_class=container.MVisionContainer,
             # serializable parameters (for re-creating this container):
             child_class_pars={"mvision_class": cl},
             # non-seriazable parameters:
             child_class_pars_={
                 "thread": self.thread,
                 "process_map": self.process_map
             })
         cont.signals.closing.connect(self.rem_mvision_container_slot)
         self.mvision_containers.append(cont)
     else:
         QtWidgets.QMessageBox.about(
             self, "Enough!",
             "Can't instantiate more detectors of this type (max number is "
             + str(cl.max_instances) + ")")
Example #2
0
 def slot_func():
     # print(">process_map", singleton.process_map)
     if ((cl.tag in singleton.client_process_map)
             and len(singleton.client_process_map[cl.tag]) > 0):
         master_tag = cl.master
         if singleton.get_avail_master_process(master_tag) is not None:
             cont = container.VideoContainerNxM(
                 parent=None,
                 gpu_handler=self.gpu_handler,
                 filterchain_group=self.filterchain_group,
                 title=cl.name,
                 n_dim=1,
                 m_dim=1,
                 child_class=container.MVisionClientContainer,
                 child_class_pars={
                     "mvision_class": cl,
                 },
             )
             cont.signals.closing.connect(self.rem_grid_container_slot)
             self.containers_grid.append(cont)
         else:
             QtWidgets.QMessageBox.about(
                 self, "Enough!",
                 "Can't instantiate more master processes for this detector"
             )
     else:
         QtWidgets.QMessageBox.about(
             self, "Enough!",
             "Can't instantiate more detectors of this type (max number is "
             + str(cl.max_instances) + ")")
Example #3
0
 def slot_func():
     cont = container.VideoContainerNxM(
         gpu_handler=self.gpu_handler,
         filterchain_group=self.filterchain_group,
         n_dim=n,
         m_dim=m)
     cont.signals.closing.connect(self.rem_container_slot)
     self.containers.append(cont)
Example #4
0
 def slot_func():
     if ( (cl.tag in singleton.process_map) and (len(singleton.process_map[cl.tag])>0) ):
         cont = container.VideoContainerNxM(
             parent            = None,
             gpu_handler       = self.gpu_handler,
             filterchain_group = self.filterchain_group,
             title             = cl.name,
             n_dim             = 1,
             m_dim             = 1,
             child_class       = container.MVisionContainer,
             child_class_pars  = {
                 "mvision_class": cl,
                 # "thread"       : singleton.thread,
                 # "process_map"  : singleton.process_map
                 }, 
             )
         cont.signals.closing.connect(self.rem_grid_container_slot)
         self.containers_grid.append(cont)
     else:
         QtWidgets.QMessageBox.about(self,"Enough!","Can't instantiate more detectors of this type (max number is "+str(cl.max_instances)+")")     
Example #5
0
    def deSerializeContainers(self):
        """Re-creates containers, based on the list saved into layout_collection
        
        This is the inverse of self.serializeContainers
        
        Containers must be closed & self.contiainers etc. list must be cleared before calling this
        """
        # glo = globals()
        # print("glo>",glo)
        singleton.reCacheDevicesById() # singleton.devices_by_id will be used by the containers
        
        try:
            row = next(singleton.data_model.layout_collection.get())
        except StopIteration:
            return
        
        container_list = row["layout"]

        # print(">", container_list)
        for container_dic in container_list:
            t = container_dic.pop("type") # get the type & remove it from the dict

            if t == "VideoContainerNxM":
                container_dic["child_class"] = nameToClass(container_dic.pop("child_class")) # swap from class name to class instance
                container_dic["geom"] = tuple(container_dic["geom"])  # woops.. tuple does not json-serialize, but is changed to list .. so change it back to tuplee
                # non-serializable parameters:
                dic = {
                    "parent"            : None,
                    "gpu_handler"       : self.gpu_handler,         # RootContainers(s) pass this downstream to child containers
                    "filterchain_group" : self.filterchain_group    # RootContainers(s) pass this downstream to child containers
                    }
                container_dic.update(dic)
                # now container has the parameters to instantiate the object
                print(">", container_dic)
                cont = container.VideoContainerNxM(**container_dic) # instantiate container
                cont.signals.closing.connect(self.rem_grid_container_slot)
                self.containers_grid.append(cont)
            
            if t == "PlayVideoContainerNxM":
                container_dic["child_class"] = nameToClass(container_dic.pop("child_class")) # swap from class name to class instance
                container_dic["geom"] = tuple(container_dic["geom"])  # woops.. tuple does not json-serialize, but is changed to list .. so change it back to tuplee
                # non-serializable parameters:
                dic = {
                    "parent"              : None,
                    "gpu_handler"         : self.gpu_handler,            # RootContainers(s) pass this downstream to child containers
                    "filterchain_group"   : self.filterchain_group_play,
                    "valkkafsmanager"     : self.valkkafsmanager,
                    "playback_controller" : self.playback_controller
                    }
                container_dic.update(dic)
                # now container has the parameters to instantiate the object
                print(">", container_dic)
                cont = container.PlayVideoContainerNxM(**container_dic) # instantiate container
                cont.signals.closing.connect(self.rem_playback_grid_container_slot)
                self.containers_playback.append(cont)
            
            elif t == "QMainWindow":
                geom = container_dic["geom"]
                self.setGeometry(geom[0], geom[1], geom[2], geom[3])
                
            elif t == "CameraListWindow":
                geom = container_dic["geom"]
                self.camera_list_win.setVisible(True)
                self.camera_list_win.setGeometry(geom[0], geom[1], geom[2], geom[3])