code
stringlengths
3
6.57k
self.button_group.addButton(self.point_selector, GraphicsScene.Mode.Draw_point.value)
self.button_group.addButton(self.line_selector, GraphicsScene.Mode.Draw_line.value)
self.button_group.addButton(self.area_selector, GraphicsScene.Mode.Draw_area.value)
selector_layout.addWidget(self.object_selector)
selector_layout.addWidget(self.point_selector)
selector_layout.addWidget(self.line_selector)
selector_layout.addWidget(self.area_selector)
selector_layout.addStretch(1)
self.createLineToolWidget()
self.createAreaToolWidget()
layout.addLayout(selector_layout)
layout.addWidget(self.line_tool_widget)
layout.addWidget(self.area_tool_widget)
layout.addStretch(1)
QtWidgets.QWidget()
select_tab.setLayout(layout)
self.tabs.addTab(create_scroll_area(select_tab)
createGridOptionsTab(self)
QtWidgets.QVBoxLayout()
QtWidgets.QCheckBox('Show Grid')
self.show_grid_checkbox.stateChanged.connect(self.showGrid)
QtWidgets.QCheckBox('Snap Selection to Grid')
self.snap_to_grid_checkbox.stateChanged.connect(self.snapToGrid)
self.snap_to_grid_checkbox.setEnabled(self.view.show_grid)
layout.addWidget(self.show_grid_checkbox)
layout.addWidget(self.snap_to_grid_checkbox)
self.createGridWidget()
layout.addWidget(self.grid_widget)
layout.addStretch(1)
QtWidgets.QWidget()
grid_tab.setLayout(layout)
self.tabs.addTab(create_scroll_area(grid_tab)
createCustomPlaneBox(self)
QtWidgets.QWidget(self)
QtWidgets.QVBoxLayout()
FormGroup(FormGroup.Layout.Horizontal)
FormControl('X', 1.0, required=True, number=True)
self.x_axis.range(-1.0, 1.0)
FormControl('Y', 0.0, required=True, number=True)
self.y_axis.range(-1.0, 1.0)
FormControl('Z', 0.0, required=True, number=True)
self.z_axis.range(-1.0, 1.0)
self.form_group.addControl(self.x_axis)
self.form_group.addControl(self.y_axis)
self.form_group.addControl(self.z_axis)
self.form_group.groupValidation.connect(self.setCustomPlane)
layout.addWidget(self.form_group)
self.custom_plane_widget.setLayout(layout)
createLineToolWidget(self)
QtWidgets.QWidget(self)
QtWidgets.QHBoxLayout()
layout.setContentsMargins(0, 20, 0, 0)
layout.addWidget(QtWidgets.QLabel('Number of Points: ')
QtWidgets.QSpinBox()
self.line_point_count_spinbox.setValue(self.scene.line_tool_size)
self.line_point_count_spinbox.setRange(2, 100)
self.line_point_count_spinbox.valueChanged.connect(self.scene.setLineToolSize)
layout.addWidget(self.line_point_count_spinbox)
self.line_tool_widget.setVisible(False)
self.line_tool_widget.setLayout(layout)
createAreaToolWidget(self)
QtWidgets.QWidget(self)
QtWidgets.QHBoxLayout()
layout.setContentsMargins(0, 20, 0, 0)
layout.addWidget(QtWidgets.QLabel('Number of Points: ')
QtWidgets.QSpinBox()
self.area_x_spinbox.setValue(self.scene.area_tool_size[0])
self.area_x_spinbox.setRange(2, 100)
QtWidgets.QSpinBox()
self.area_y_spinbox.setValue(self.scene.area_tool_size[1])
self.area_y_spinbox.setRange(2, 100)
layout.addStretch(1)
layout.addWidget(QtWidgets.QLabel('X: ')
self.area_x_spinbox.valueChanged.connect(lambda: self.scene.setAreaToolSize(self.area_x_spinbox.value()
self.area_y_spinbox.value()
layout.addWidget(self.area_x_spinbox, stretch_factor)
layout.addStretch(1)
layout.addWidget(QtWidgets.QLabel('Y: ')
self.area_y_spinbox.valueChanged.connect(lambda: self.scene.setAreaToolSize(self.area_x_spinbox.value()
self.area_y_spinbox.value()
layout.addWidget(self.area_y_spinbox, stretch_factor)
self.area_tool_widget.setVisible(False)
self.area_tool_widget.setLayout(layout)
createGridWidget(self)
QtWidgets.QWidget(self)
QtWidgets.QVBoxLayout()
main_layout.setContentsMargins(0, 20, 0, 0)
QtWidgets.QHBoxLayout()
layout.addWidget(QtWidgets.QLabel('Grid Type: ')
QtWidgets.QComboBox()
grid_combobox.setView(QtWidgets.QListView()
grid_combobox.addItems([g.value for g in Grid.Type])
grid_combobox.currentTextChanged.connect(lambda value: self.setGridType(Grid.Type(value)
layout.addWidget(grid_combobox)
main_layout.addLayout(layout)
main_layout.addSpacing(20)
QtWidgets.QHBoxLayout()
layout.addWidget(QtWidgets.QLabel('Grid Size: ')
QtWidgets.QLabel('')
QtWidgets.QDoubleSpinBox()