class FileMenu(QuickMenu): title = "File" elements = [ QuickMenuElement(title="Save Window Layout"), QuickMenuElement(title="Load Window Layout"), QuickMenuElement(title="Exit") ]
class GridMenu(QuickMenu): title = "Video Grid" elements = [ QuickMenuElement(title="Grid 1x1"), QuickMenuElement(title="Grid 2x2"), QuickMenuElement(title="Grid 3x3"), QuickMenuElement(title="Grid 4x4") ]
class RightClickMenu(QuickMenu): title = "popup" elements = [ QuickMenuSection(title="Choose Action"), QuickMenuElement(title="Maximize / Normalize Size", method_name="maximize"), QuickMenuElement(title="Remove Camera") ]
class ConfigMenu(QuickMenu): title = "Configuration" """ elements = [ QuickMenuElement(title="Manage Cameras"), QuickMenuElement(title="Memory Usage") ] """ elements = [QuickMenuElement(title="Configuration dialog")]
def setupUi(self): self.setStyleSheet(style.main_gui) self.setWindowTitle(singleton.program_name) self.setGeometry(QtCore.QRect(100, 100, 500, 500)) self.w = QtWidgets.QWidget(self) self.setCentralWidget(self.w) self.filemenu = FileMenu(parent=self) self.viewmenu = ViewMenu(parent=self) # grids up to 4x4 self.configmenu = ConfigMenu(parent=self) if self.mvision: mvision_elements = [] for cl in self.mvision_classes + self.mvision_client_classes: if cl.auto_menu: el = QuickMenuElement(title = cl.name, method_name = cl.name) mvision_elements.append(el) class MVisionMenu(QuickMenu): title = "Machine Vision" elements = mvision_elements self.mvisionmenu = MVisionMenu(parent = self) self.aboutmenu = AboutMenu(parent=self) # create container and their windows self.manage_cameras_container = singleton.data_model.getDeviceListAndForm(None) self.manage_memory_container = singleton.data_model.getConfigForm() self.manage_valkkafs_container = singleton.data_model.getValkkaFSForm() self.manage_memory_container.signals.save.connect(self.config_modified_slot) self.manage_cameras_container.getForm().signals.save_record.connect(self.config_modified_slot) self.manage_valkkafs_container.signals.save.connect(self.valkkafs_modified_slot) self.config_win = QTabCapsulate( "Configuration", [ (self.manage_cameras_container. widget, "Camera Configuration"), (self.manage_memory_container. widget, "Memory Configuration"), (self.manage_valkkafs_container.widget, "Recording Configuration") ] ) self.config_win.signals.close.connect(self.config_dialog_close_slot) # when the configuration dialog is reopened, inform the camera configuration form .. this way it can re-check if usb cams are available self.config_win.signals.show.connect(self.manage_cameras_container.getForm().show_slot) self.config_win.signals.show.connect(self.manage_cameras_container.choose_first_slot) # so that we have at least one device chosen self.makeCameraTree() self.camera_list_win = QCapsulate(self.treelist, "Camera List") self.wait_label = QtWidgets.QLabel("Restarting Valkka, please wait ..") self.wait_window = QCapsulate(self.wait_label, "Wait", nude = True)
class AboutMenu(QuickMenu): title = "About" elements = [QuickMenuElement(title="About Valkka Live")]
class PluginsMenu(QuickMenu): title = "Plugins" elements = [QuickMenuElement(title="Machine Vision")]
class ViewMenu(QuickMenu): title = "View" elements = [QuickMenuElement(title="Camera List"), GridMenu]
class AboutMenu(QuickMenu): title = "About" elements = [QuickMenuElement(title="About Program")]
class ScreenMenu(QuickMenu): title = "Change Screen" elements = [ QuickMenuElement(title="Screen 1"), QuickMenuElement(title="Screen 2") ]
def setupUi(self): self.setStyleSheet(style.main_gui) self.setWindowTitle("Valkka Live") self.setGeometry(QtCore.QRect(100, 100, 500, 500)) self.w = QtWidgets.QWidget(self) self.setCentralWidget(self.w) self.filemenu = FileMenu(parent=self) self.viewmenu = ViewMenu(parent=self) # grids up to 4x4 self.configmenu = ConfigMenu(parent=self) if self.mvision: mvision_elements = [] for cl in self.mvision_classes: el = QuickMenuElement(title=cl.name, method_name=cl.name) mvision_elements.append(el) class MVisionMenu(QuickMenu): title = "Machine Vision" elements = mvision_elements self.mvisionmenu = MVisionMenu(parent=self) self.aboutmenu = AboutMenu(parent=self) # create container and their windows self.manage_cameras_container = self.dm.getDeviceListAndForm(None) #self.manage_cameras_win = self.QCapsulate( # self.manage_cameras_container.widget, "Camera Configuration", blocking = True) self.manage_memory_container = self.dm.getConfigForm() #self.manage_memory_win = self.QCapsulate( # self.manage_memory_container.widget, "Memory Configuration", blocking = True) # self.manage_memory_container.signals.save # self.manage_cameras_container.getForm().signals.save_record # ListAndForm : has a list and a formset (SlotFormSet). SlotFormSet has the signals self.manage_memory_container.signals.save.connect( self.config_modified_slot) self.manage_cameras_container.getForm().signals.save_record.connect( self.config_modified_slot) self.config_win = self.QTabCapsulate( "Configuration", [(self.manage_cameras_container.widget, "Camera Configuration"), (self.manage_memory_container.widget, "Memory Configuration")]) self.config_win.signals.close.connect(self.config_dialog_close_slot) # when the configuration dialog is reopened, inform the camera configuration form .. this way it can re-check if usb cams are available self.config_win.signals.show.connect( self.manage_cameras_container.getForm().show_slot) self.makeCameraTree() self.camera_list_win = self.QCapsulate(self.treelist, "Camera List") # self.camera_list_win.show() # self.treelist.show() # self.wait_widget = QtWidgets.QWidget() # self.wait_lay = QtWidgets.QHBoxLayout(self.wait_widget) # self.wait_label = QtWidgets.QLabel("Restarting Valkka, please wait ..", self.wait_widget) self.wait_label = QtWidgets.QLabel("Restarting Valkka, please wait ..") self.wait_window = self.QCapsulate(self.wait_label, "Wait", nude=True)