| 2561 | |
| 2562 | |
| 2563 | class ManageAttributesDialog(QDialog): # attribute manager button for cross section |
| 2564 | def __init__(self, data, initial_attributes=None, parent=None): |
| 2565 | super().__init__(parent) |
| 2566 | self.setWindowTitle("Manage Attributes") |
| 2567 | |
| 2568 | self.data = data |
| 2569 | self.attributes = initial_attributes or {} |
| 2570 | self.attributes_dict = {} |
| 2571 | |
| 2572 | self.column_combo_box = QComboBox() |
| 2573 | self.column_combo_box.addItem("-- Select a Column --") |
| 2574 | self.column_combo_box.addItems([col for col in self.data.columns if col not in ['x', 'y', 'z', 'hole_id']]) |
| 2575 | |
| 2576 | self.save_button = QPushButton("Save") |
| 2577 | self.save_button.setEnabled(False) |
| 2578 | |
| 2579 | main_content = QWidget() |
| 2580 | self.main_layout = QVBoxLayout(main_content) # Set layout for main content |
| 2581 | |
| 2582 | self.main_layout.addWidget(self.column_combo_box) |
| 2583 | self.main_layout.addWidget(self.save_button) |
| 2584 | |
| 2585 | scroll = QScrollArea(self) # Create a QScrollArea |
| 2586 | scroll.setWidget(main_content) # Add the main content to the scroll area |
| 2587 | scroll.setWidgetResizable(True) # Make the scroll area content resizable |
| 2588 | |
| 2589 | layout = QVBoxLayout(self) # Main dialog layout |
| 2590 | layout.addWidget(scroll) # Add the scroll area to the main dialog |
| 2591 | self.setLayout(layout) |
| 2592 | |
| 2593 | self.column_combo_box.currentTextChanged.connect(self.update_values_widget) |
| 2594 | self.save_button.clicked.connect(self.save) |
| 2595 | |
| 2596 | self.values_widget = None |
| 2597 | |
| 2598 | def update_values_widget(self, column): # Update based on user input |
| 2599 | if self.values_widget is not None: |
| 2600 | self.main_layout.removeWidget(self.values_widget) |
| 2601 | sip.delete(self.values_widget) |
| 2602 | |
| 2603 | if column != "-- Select a Column --": |
| 2604 | unique_values = self.data[column].unique() |
| 2605 | self.values_widget = QGroupBox("Unique Values") |
| 2606 | |
| 2607 | layout = QVBoxLayout() |
| 2608 | self.values_widget.setLayout(layout) |
| 2609 | self.value_widgets = {} |
| 2610 | |
| 2611 | for value in unique_values: |
| 2612 | sub_widget = QWidget() |
| 2613 | sub_layout = QHBoxLayout() |
| 2614 | sub_widget.setLayout(sub_layout) |
| 2615 | |
| 2616 | color_button = QPushButton("Choose color") |
| 2617 | line_width_spin_box = QDoubleSpinBox() |
| 2618 | line_width_spin_box.setValue(3.0) |
| 2619 | |
| 2620 | sub_layout.addWidget(QLabel(str(value))) |
no outgoing calls
no test coverage detected