def interpret_template_spin(self, template, widg_dex): try: double = template.doubles[widg_dex][0] except AttributeError: double = False try: min_val = template.minimum_values[widg_dex][0] except AttributeError: min_val = 0 try: max_val = template.maximum_values[widg_dex][0] except AttributeError: max_val = 50 try: sing_step = template.single_steps[widg_dex][0] except AttributeError: sing_step = 1 try: initial = template.initials[widg_dex][0] except AttributeError: initial = 1 try: instance = template.instances[widg_dex][0] except AttributeError: instance = None try: key = template.keys[widg_dex][0] except AttributeError: key = None widgs = [lgb.create_spin_box(double = double, min_val = min_val, max_val = max_val, sing_step = sing_step, initial = initial, instance = instance, key = key)] p_sp_template = template.parameter_space_templates[widg_dex] if not p_sp_template is None: widgs.append(self.interpret_template_p_sp(p_sp_template)) try: title = template.box_labels[widg_dex] group = QtGui.QGroupBox(title = title) layout = lgb.create_vert_box(widgs) group.setLayout(layout) return [group] except AttributeError: return widgs
def interpret_template_spin(self, template, widg_dex): try: parent = template.parents[widg_dex][0] except AttributeError: parent = None try: double = template.doubles[widg_dex][0] except AttributeError: double = False try: min_val = template.minimum_values[widg_dex][0] except AttributeError: min_val = None try: max_val = template.maximum_values[widg_dex][0] except AttributeError: max_val = None try: sing_step = template.single_steps[widg_dex][0] except AttributeError: sing_step = None try: initial = template.initials[widg_dex][0] except AttributeError: initial = None try: instance = template.instances[widg_dex][0] except AttributeError: instance = None try: key = template.keys[widg_dex][0] except AttributeError: key = None try: rewidget = template.rewidget[widg_dex][0] except AttributeError: rewidget = True try: callback = template.callbacks[widg_dex][0] except AttributeError: callback = None spin_widget = [lgb.create_spin_box(parent = parent, double = double, min_val = min_val, max_val = max_val, sing_step = sing_step, initial = initial, instance = instance, key = key, rewidget = rewidget, callback = callback)] try: title = template.box_labels[widg_dex] group = QtGui.QGroupBox(title = title) layout = lgb.create_vert_box(spin_widget) group.setLayout(layout) return [group] except AttributeError: return spin_widget