diff --git a/docs/changelog.md b/docs/changelog.md index 638ed8dc..4e89620c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,15 @@ # Changelog +## Version 21.10 + +**Features**: + ++ Enhance "Copy Curve Data" options. + +**Development**: + ++ None. + ## Version 21.09 **Features**: diff --git a/pyslvs_ui/synthesis/dimensional_synthesis/__init__.py b/pyslvs_ui/synthesis/dimensional_synthesis/__init__.py index 40861e89..b51b2f54 100644 --- a/pyslvs_ui/synthesis/dimensional_synthesis/__init__.py +++ b/pyslvs_ui/synthesis/dimensional_synthesis/__init__.py @@ -193,9 +193,13 @@ def clear_path(self, *, ask: bool = True) -> None: @Slot(name='on_path_copy_clicked') def __copy_path(self) -> None: """Copy the current path coordinates to clipboard.""" - QApplication.clipboard().setText('\n'.join( - f"[{x}, {y}]," for x, y in self.current_path() - )) + if self.copy_as_csv.isChecked(): + text = '\n'.join(f"{x},{y}" for x, y in self.current_path()) + elif self.copy_as_array.isChecked(): + text = '\n'.join(f"[{x}, {y}]," for x, y in self.current_path()) + else: + raise ValueError("invalid option") + QApplication.clipboard().setText(text) @Slot(name='on_path_paste_clicked') def __paste_path(self) -> None: diff --git a/pyslvs_ui/synthesis/dimensional_synthesis/dimension_widget.ui b/pyslvs_ui/synthesis/dimensional_synthesis/dimension_widget.ui index 65933f24..168c625f 100644 --- a/pyslvs_ui/synthesis/dimensional_synthesis/dimension_widget.ui +++ b/pyslvs_ui/synthesis/dimensional_synthesis/dimension_widget.ui @@ -6,7 +6,7 @@ 0 0 - 430 + 457 714 @@ -256,7 +256,7 @@ Target path - + @@ -280,6 +280,46 @@ + + + + Copy + + + + + + Comma-Separated Values + + + true + + + + + + + Array-like + + + + + + + Copy the path data as a string. + + + Copy Curve Data + + + + icons:copy.pngicons:copy.png + + + + + + @@ -316,17 +356,6 @@ - - - - Copy the path data as a string. - - - - icons:copy.pngicons:copy.png - - - @@ -656,5 +685,6 @@ + diff --git a/pyslvs_ui/synthesis/dimensional_synthesis/dimension_widget_ui.py b/pyslvs_ui/synthesis/dimensional_synthesis/dimension_widget_ui.py index 6deeca32..7f9a6261 100644 --- a/pyslvs_ui/synthesis/dimensional_synthesis/dimension_widget_ui.py +++ b/pyslvs_ui/synthesis/dimensional_synthesis/dimension_widget_ui.py @@ -14,7 +14,7 @@ class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") - Form.resize(430, 714) + Form.resize(457, 714) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("icons:dimensional_synthesis.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) Form.setWindowIcon(icon) @@ -144,8 +144,8 @@ def setupUi(self, Form): self.options_tab.addTab(self.structure, icon8, "") self.target_path = QtWidgets.QWidget() self.target_path.setObjectName("target_path") - self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.target_path) - self.verticalLayout_2.setObjectName("verticalLayout_2") + self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.target_path) + self.verticalLayout_5.setObjectName("verticalLayout_5") self.down_splitter = QtWidgets.QSplitter(self.target_path) self.down_splitter.setOrientation(QtCore.Qt.Horizontal) self.down_splitter.setObjectName("down_splitter") @@ -167,6 +167,22 @@ def setupUi(self, Form): self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.verticalLayout_8 = QtWidgets.QVBoxLayout() self.verticalLayout_8.setObjectName("verticalLayout_8") + self.copy_format_groupbox = QtWidgets.QGroupBox(self.layoutWidget) + self.copy_format_groupbox.setObjectName("copy_format_groupbox") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.copy_format_groupbox) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.copy_as_csv = QtWidgets.QRadioButton(self.copy_format_groupbox) + self.copy_as_csv.setChecked(True) + self.copy_as_csv.setObjectName("copy_as_csv") + self.verticalLayout_2.addWidget(self.copy_as_csv) + self.copy_as_array = QtWidgets.QRadioButton(self.copy_format_groupbox) + self.copy_as_array.setObjectName("copy_as_array") + self.verticalLayout_2.addWidget(self.copy_as_array) + self.path_copy = QtWidgets.QPushButton(self.copy_format_groupbox) + self.path_copy.setIcon(icon2) + self.path_copy.setObjectName("path_copy") + self.verticalLayout_2.addWidget(self.path_copy) + self.verticalLayout_8.addWidget(self.copy_format_groupbox) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.point_num = QtWidgets.QLabel(self.layoutWidget) @@ -181,10 +197,6 @@ def setupUi(self, Form): self.path_paste.setIcon(icon9) self.path_paste.setObjectName("path_paste") self.horizontalLayout_2.addWidget(self.path_paste) - self.path_copy = QtWidgets.QPushButton(self.layoutWidget) - self.path_copy.setIcon(icon2) - self.path_copy.setObjectName("path_copy") - self.horizontalLayout_2.addWidget(self.path_copy) self.path_clear = QtWidgets.QPushButton(self.layoutWidget) self.path_clear.setIcon(icon7) self.path_clear.setAutoDefault(False) @@ -276,7 +288,7 @@ def setupUi(self, Form): spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem3) self.horizontalLayout_5.addLayout(self.verticalLayout_3) - self.verticalLayout_2.addWidget(self.down_splitter) + self.verticalLayout_5.addWidget(self.down_splitter) self.options_tab.addTab(self.target_path, icon, "") self.algorithm = QtWidgets.QWidget() self.algorithm.setObjectName("algorithm") @@ -343,9 +355,13 @@ def retranslateUi(self, Form): item.setText(_translate("Form", "Range")) self.options_tab.setTabText(self.options_tab.indexOf(self.structure), _translate("Form", "Structure")) self.shape_only_option.setText(_translate("Form", "Compare shape only")) + self.copy_format_groupbox.setTitle(_translate("Form", "Copy")) + self.copy_as_csv.setText(_translate("Form", "Comma-Separated Values")) + self.copy_as_array.setText(_translate("Form", "Array-like")) + self.path_copy.setStatusTip(_translate("Form", "Copy the path data as a string.")) + self.path_copy.setText(_translate("Form", "Copy Curve Data")) self.point_num.setText(_translate("Form", "

0

")) self.path_paste.setStatusTip(_translate("Form", "Past path data from string format.")) - self.path_copy.setStatusTip(_translate("Form", "Copy the path data as a string.")) self.path_clear.setStatusTip(_translate("Form", "Clear all points.")) self.point_up.setStatusTip(_translate("Form", "Move the point up.")) self.point_down.setStatusTip(_translate("Form", "Move the point down."))