def __init__(self, name): """Initialize the class. Parameters ---------- name : str Tab name for the configuration view. """ BaseController.__init__(self, name) self.model = ScienceModel() self.widget = ScienceWidget(name) self.extra_props = None self.extra_props_dir = None self.widget.create_tabs(self.model.general_params) self.widget.set_information(self.model.general_params) self.widget.create_tabs(self.model.sequence_params) self.widget.set_information(self.model.sequence_params) for i in range(self.widget.count()): tab = self.widget.widget(i) tab.checkProperty.connect(self.check_property) tab.getProperty.connect(self.get_property) tab.saveConfiguration.connect(self.save_configuration)
def __init__(self, name): """Initialize the class. Parameters ---------- name : str The tab name for the configuration view. """ BaseController.__init__(self, name) self.model = DowntimeModel() self.widget = DowntimeWidget(name) for key, value in self.model.params.items(): self.widget.set_information(key, value) self.widget.checkProperty.connect(self.check_property) self.widget.getProperty.connect(self.get_property) self.widget.saveConfiguration.connect(self.save_configuration)
def get_property(self, param_name, position): """Get the property value for the requested name. Parameters ---------- param_name : str The parameter name to retrieve the stored value of. position : list(int) The widget position that requested this check. """ pname = str(param_name) if "general_proposals" in pname or "sequence_proposals" in pname: prop_name = pname.split('/')[-1] is_active = self.model.is_proposal_active(prop_name) self.widget.reset_field(position, str(is_active)) else: BaseController.get_property(self, param_name, position)
def __init__(self, name): """Initialize the class. Parameters ---------- name : str The tab name for the configuration view. """ BaseController.__init__(self, name) self.model = SurveyModel() self.widget = SurveyWidget(name, self.model.proposals) self.widget.set_information(self.model.params) self.widget.checkProperty.connect(self.check_property) self.widget.getProperty.connect(self.get_property) self.widget.saveConfiguration.connect(self.save_configuration)
def get_property(self, param_name, position): """Get the property value for the requested name. Parameters ---------- param_name : str The parameter name to retrieve the stored value of. position : list(int) The widget position that requested this check. """ pname = str(param_name) if "general_proposals" in pname: prop_name = pname.split('/')[-1] is_active = self.model.is_proposal_active(prop_name) self.widget.reset_field(position, str(is_active)) else: BaseController.get_property(self, param_name, position)
def __init__(self, name): """Initialize the class. Parameters ---------- name : str The tab name for the configuration view. """ BaseController.__init__(self, name) self.model = SchedulerDriverModel() self.widget = SchedulerDriverWidget(name) for key, value in self.model.params.items(): self.widget.set_information(key, value) self.widget.checkProperty.connect(self.check_property) self.widget.getProperty.connect(self.get_property) self.widget.saveConfiguration.connect(self.save_configuration)
def __init__(self, name): """Initialize the class. Parameters ---------- name : str Tab name for the configuration view. """ BaseController.__init__(self, name) self.model = ObservatoryModel() self.widget = ObservatoryWidget(name) self.widget.create_tabs(self.model.params) self.widget.set_information(self.model.params) for i in xrange(self.widget.count()): tab = self.widget.widget(i) tab.checkProperty.connect(self.check_property) tab.getProperty.connect(self.get_property) tab.saveConfiguration.connect(self.save_configuration)
def __init__(self, name): """Initialize the class. Parameters ---------- name : str Tab name for the configuration view. """ BaseController.__init__(self, name) self.model = ObservatoryModel() self.widget = ObservatoryWidget(name) self.widget.create_tabs(self.model.params) self.widget.set_information(self.model.params) for i in range(self.widget.count()): tab = self.widget.widget(i) tab.checkProperty.connect(self.check_property) tab.getProperty.connect(self.get_property) tab.saveConfiguration.connect(self.save_configuration)
def save_configuration(self, save_dir, name, changed_params): """Delegate configuration saving to model. Parameters ---------- save_dir : str The directory to save the configuration information to. name : str Name of the configuration to save. changed_params : dict The set of changed information. """ if len(changed_params) and self.extra_props_dir is not None: prop_file = os.path.join(self.extra_props_dir, filename_from_proposal_name(name)) if os.path.exists(prop_file): copy_loc = os.path.join(save_dir, NEW_PROPS_DIR) if not os.path.exists(copy_loc): os.makedirs(copy_loc) shutil.copy(prop_file, copy_loc) BaseController.save_configuration(self, save_dir, name, changed_params)
def check_property(self, param_name, param_value, position): """Check the stored value of the parameter name against input. Parameters ---------- param_name : str The parameter name to retrieve the stored value of. param_value : any The value of the parameter to check against the stored one. position : list(int) The widget position that requested this check. """ pname = str(param_name) pvalue = str(param_value) if "general_proposals" in pname: prop_name = pname.split('/')[-1] if pvalue == "True": is_changed = False else: is_changed = self.model.is_proposal_active(prop_name) self.widget.is_changed(position, is_changed) else: BaseController.check_property(self, param_name, param_value, position)
def check_property(self, param_name, param_value, position): """Check the stored value of the parameter name against input. Parameters ---------- param_name : str The parameter name to retrieve the stored value of. param_value : any The value of the parameter to check against the stored one. position : list(int) The widget position that requested this check. """ pname = str(param_name) pvalue = str(param_value) if "general_proposals" in pname or "sequence_proposals" in pname: prop_name = pname.split('/')[-1] if pvalue == "True": is_changed = False else: is_changed = self.model.is_proposal_active(prop_name) self.widget.is_changed(position, is_changed) else: BaseController.check_property(self, param_name, param_value, position)