class WizardExample(vip_base): def cb_initialize_plugin(self): self.wizardwidget = QWizard() self.wizardwidget.addPage(self.createIntroPage()) self.wizardwidget.addPage(sinPage(self.control_api)) self.wizardwidget.addPage(plotPage(self.control_api)) self.wizardwidget.addPage( connectPage(self.control_api, 'WizardExample')) self.pl_set_widget_for_internal_usage(self.wizardwidget) self.wizardwidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.wizardwidget.customContextMenuRequested.connect( self.show_context_menu) return True def show_context_menu(self, pos): gloPos = self.wizardwidget.mapToGlobal(pos) self.cmenu = self.pl_create_control_context_menu() self.cmenu.exec_(gloPos) def cb_execute(self, Data=None, block_name=None, plugin_uname=None): pass def cb_set_parameter(self, name, value): pass def cb_quit(self): pass def cb_get_plugin_configuration(self): config = {} return config def cb_plugin_meta_updated(self): pass def createIntroPage(self): page = QWizardPage() page.setTitle("Introduction") label = QLabel("This wizard will show you a simple wizard.") label.setWordWrap(True) label2 = QLabel( "Therefore it will create a Sine plugin, a plot and connect these two." ) label2.setWordWrap(True) layout = QVBoxLayout() layout.addWidget(label) layout.addWidget(label2) page.setLayout(layout) return page
class WizardExample(vip_base): def cb_initialize_plugin(self): self.wizardwidget = QWizard() self.wizardwidget.addPage(self.createIntroPage()) self.wizardwidget.addPage(sinPage(self.control_api)) self.wizardwidget.addPage(plotPage(self.control_api)) self.wizardwidget.addPage(connectPage(self.control_api,'WizardExample')) self.pl_set_widget_for_internal_usage( self.wizardwidget ) self.wizardwidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.wizardwidget.customContextMenuRequested.connect(self.show_context_menu) return True def show_context_menu(self, pos): gloPos = self.wizardwidget.mapToGlobal(pos) self.cmenu = self.pl_create_control_context_menu() self.cmenu.exec_(gloPos) def cb_execute(self, Data=None, block_name = None, plugin_uname = None): pass def cb_set_parameter(self, name, value): pass def cb_quit(self): pass def cb_get_plugin_configuration(self): config = {} return config def cb_plugin_meta_updated(self): pass def createIntroPage(self): page = QWizardPage() page.setTitle("Introduction") label = QLabel("This wizard will show you a simple wizard.") label.setWordWrap(True) label2 = QLabel("Therefore it will create a Sine plugin, a plot and connect these two.") label2.setWordWrap(True) layout = QVBoxLayout() layout.addWidget(label) layout.addWidget(label2) page.setLayout(layout) return page
class WizardExample(vip_base): def createIntroPage(self): page = QWizardPage() page.setTitle("Introduction") label = QLabel("This wizard will show you a simple wizard.") label.setWordWrap(True) label2 = QLabel( "Therefore it will create a sinus plugin, a plot and connect these two." ) label2.setWordWrap(True) layout = QVBoxLayout() layout.addWidget(label) layout.addWidget(label2) page.setLayout(layout) return page def cb_initialize_plugin(self): #self.config = config # --------------------------- # Read configuration # --------------------------- # Note: this cfg items have to exist! # self.show_grid_x = int(self.config['x-grid']['value']) == '1' # self.show_grid_y = int(self.config['y-grid']['value']) == '1' # # int_re = re.compile(r'(\d+)') # # self.colors_selected = int_re.findall(self.config['color']['value']); # self.types_selected = int_re.findall(self.config['style']['value']); # -------------------------------- # Create Widget # -------------------------------- # Create Widget needed for this plugin self.wizardwidget = QWizard() self.wizardwidget.addPage(self.createIntroPage()) self.wizardwidget.addPage(sinPage(self.control_api)) self.wizardwidget.addPage(plotPage(self.control_api)) self.wizardwidget.addPage( connectPage(self.control_api, 'WizardExample')) # This call is important, because the background structure needs to know the used widget! # In the background the qmidiwindow will becreated and the widget will be added self.pl_set_widget_for_internal_usage(self.wizardwidget) self.wizardwidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.wizardwidget.customContextMenuRequested.connect( self.show_context_menu) return True def show_context_menu(self, pos): gloPos = self.wizardwidget.mapToGlobal(pos) self.cmenu = self.pl_create_control_context_menu() self.cmenu.exec_(gloPos) def cb_pause(self): # will be called, when plugin gets paused # can be used to get plugin in a defined state before pause # e.a. close communication ports, files etc. pass def cb_resume(self): # will be called when plugin gets resumed # can be used to wake up the plugin from defined pause state # e.a. reopen communication ports, files etc. pass def cb_execute(self, Data=None, block_name=None, plugin_uname=None): # Do main work here! # If this plugin is an IOP plugin, then there will be no Data parameter because it wont get data # If this plugin is a DPP, then it will get Data with data # param: Data is a Data hash and block_name is the block_name of Data origin # Data is a hash, so use ist like: Data[CORE_TIME_SIGNAL] = [t1, t2, ...] where CORE_TIME_SIGNAL is a signal_name # hash signal_name: value # Data could have multiple types stored in it e.a. Data['d1'] = int, Data['d2'] = [] pass def cb_set_parameter(self, name, value): # attetion: value is a string and need to be processed ! # if name == 'irgendeinParameter': # do that .... with value pass def cb_quit(self): # do something before plugin will close, e.a. close connections ... pass def cb_get_plugin_configuration(self): # # Implement a own part of the config # config is a hash of hass object # config_parameter_name : {} # config[config_parameter_name]['value'] NEEDS TO BE IMPLEMENTED # configs can be marked as advanced for create dialog # http://utilitymill.com/utility/Regex_For_Range # config = { # "amax": { # 'value': 3, # 'regex': '[0-9]+', # 'display_text' : 'This AMax', # 'advanced' : '1' # }, 'f': { # 'value': "1", # 'regex': '\d+.{0,1}\d*' # }} config = {} return config def cb_plugin_meta_updated(self): """ Whenever the meta information is updated this function is called (if implemented). :return: """ #dplugin_info = self.dplugin_info pass
class WizardExample(vip_base): def createIntroPage(self): page = QWizardPage() page.setTitle("Introduction") label = QLabel("This wizard will show you a simple wizard.") label.setWordWrap(True) label2 = QLabel("Therefore it will create a sinus plugin, a plot and connect these two.") label2.setWordWrap(True) layout = QVBoxLayout() layout.addWidget(label) layout.addWidget(label2) page.setLayout(layout) return page def cb_initialize_plugin(self): # self.config = config # --------------------------- # Read configuration # --------------------------- # Note: this cfg items have to exist! # self.show_grid_x = int(self.config['x-grid']['value']) == '1' # self.show_grid_y = int(self.config['y-grid']['value']) == '1' # # int_re = re.compile(r'(\d+)') # # self.colors_selected = int_re.findall(self.config['color']['value']); # self.types_selected = int_re.findall(self.config['style']['value']); # -------------------------------- # Create Widget # -------------------------------- # Create Widget needed for this plugin self.wizardwidget = QWizard() self.wizardwidget.addPage(self.createIntroPage()) self.wizardwidget.addPage(sinPage(self.control_api)) self.wizardwidget.addPage(plotPage(self.control_api)) self.wizardwidget.addPage(connectPage(self.control_api, "WizardExample")) # This call is important, because the background structure needs to know the used widget! # In the background the qmidiwindow will becreated and the widget will be added self.pl_set_widget_for_internal_usage(self.wizardwidget) self.wizardwidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.wizardwidget.customContextMenuRequested.connect(self.show_context_menu) return True def show_context_menu(self, pos): gloPos = self.wizardwidget.mapToGlobal(pos) self.cmenu = self.pl_create_control_context_menu() self.cmenu.exec_(gloPos) def cb_pause(self): # will be called, when plugin gets paused # can be used to get plugin in a defined state before pause # e.a. close communication ports, files etc. pass def cb_resume(self): # will be called when plugin gets resumed # can be used to wake up the plugin from defined pause state # e.a. reopen communication ports, files etc. pass def cb_execute(self, Data=None, block_name=None, plugin_uname=None): # Do main work here! # If this plugin is an IOP plugin, then there will be no Data parameter because it wont get data # If this plugin is a DPP, then it will get Data with data # param: Data is a Data hash and block_name is the block_name of Data origin # Data is a hash, so use ist like: Data[CORE_TIME_SIGNAL] = [t1, t2, ...] where CORE_TIME_SIGNAL is a signal_name # hash signal_name: value # Data could have multiple types stored in it e.a. Data['d1'] = int, Data['d2'] = [] pass def cb_set_parameter(self, name, value): # attetion: value is a string and need to be processed ! # if name == 'irgendeinParameter': # do that .... with value pass def cb_quit(self): # do something before plugin will close, e.a. close connections ... pass def cb_get_plugin_configuration(self): # # Implement a own part of the config # config is a hash of hass object # config_parameter_name : {} # config[config_parameter_name]['value'] NEEDS TO BE IMPLEMENTED # configs can be marked as advanced for create dialog # http://utilitymill.com/utility/Regex_For_Range # config = { # "amax": { # 'value': 3, # 'regex': '[0-9]+', # 'display_text' : 'This AMax', # 'advanced' : '1' # }, 'f': { # 'value': "1", # 'regex': '\d+.{0,1}\d*' # }} config = {} return config def cb_plugin_meta_updated(self): """ Whenever the meta information is updated this function is called (if implemented). :return: """ # dplugin_info = self.dplugin_info pass