def __initialize(self, settings: Dict[str, Dict[str, SettingsType]]): for box_name in settings: box = gui.vBox(self.main_box, box=box_name) form = QFormLayout() form.setFormAlignment(Qt.AlignLeft | Qt.AlignTop) form.setLabelAlignment(Qt.AlignLeft) box.layout().addLayout(form) for label, values in settings[box_name].items(): self.__add_row(form, box_name, label, values) self.main_box.adjustSize()
def add_main_layout(self): form = QFormLayout() form.setFieldGrowthPolicy(form.AllNonFixedFieldsGrow) form.setVerticalSpacing(25) form.setLabelAlignment(Qt.AlignLeft) gui.widgetBox(self.controlArea, True, orientation=form) form.addRow( "Neurons in hidden layers:", gui.lineEdit( None, self, "hidden_layers_input", orientation=Qt.Horizontal, callback=self.settings_changed, tooltip="A list of integers defining neurons. Length of list " "defines the number of layers. E.g. 4, 2, 2, 3.", placeholderText="e.g. 10,")) form.addRow( "Activation:", gui.comboBox( None, self, "activation_index", orientation=Qt.Horizontal, label="Activation:", items=[i for i in self.act_lbl], callback=self.settings_changed)) form.addRow(" ", gui.separator(None, 16)) form.addRow( "Solver:", gui.comboBox( None, self, "solver_index", orientation=Qt.Horizontal, label="Solver:", items=[i for i in self.solv_lbl], callback=self.settings_changed)) self.reg_label = QLabel() slider = gui.hSlider( None, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=lambda: (self.set_alpha(), self.settings_changed()), createLabel=False) form.addRow(self.reg_label, slider) self.set_alpha() form.addRow( "Maximal number of iterations:", gui.spin( None, self, "max_iterations", 10, 10000, step=10, label="Max iterations:", orientation=Qt.Horizontal, alignment=Qt.AlignRight, callback=self.settings_changed)) form.addRow(gui.separator(None)) form.addRow( gui.checkBox( None, self, "replicable", label="Replicable training", callback=self.settings_changed), )
def add_main_layout(self): # this is part of init, pylint: disable=attribute-defined-outside-init form = QFormLayout() form.setFieldGrowthPolicy(form.AllNonFixedFieldsGrow) form.setLabelAlignment(Qt.AlignLeft) gui.widgetBox(self.controlArea, True, orientation=form) form.addRow( "隐藏层中的神经元:", gui.lineEdit(None, self, "hidden_layers_input", orientation=Qt.Horizontal, callback=self.settings_changed, tooltip="定义神经元的整数列表。列表长度定义层数。例如4、2、2、3。", placeholderText="e.g. 10,")) form.addRow( "激活:", gui.comboBox(None, self, "activation_index", orientation=Qt.Horizontal, label="Activation:", items=[i for i in self.chinese_act_lbl], callback=self.settings_changed)) form.addRow( "求解器(Solver):", gui.comboBox(None, self, "solver_index", orientation=Qt.Horizontal, label="Solver:", items=[i for i in self.solv_lbl], callback=self.settings_changed)) self.reg_label = QLabel() slider = gui.hSlider(None, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=lambda: (self.set_alpha(), self.settings_changed()), createLabel=False) form.addRow(self.reg_label, slider) self.set_alpha() form.addRow( "最大迭代次数:", gui.spin(None, self, "max_iterations", 10, 1000000, step=10, label="Max iterations:", orientation=Qt.Horizontal, alignment=Qt.AlignRight, callback=self.settings_changed)) form.addRow( gui.checkBox(None, self, "replicable", label="可重复训练", callback=self.settings_changed, attribute=Qt.WA_LayoutUsesWidgetRect))