diff --git a/plugins/export_to/main.py b/plugins/export_to/main.py index 26604ac..6acb584 100644 --- a/plugins/export_to/main.py +++ b/plugins/export_to/main.py @@ -8,7 +8,10 @@ from PyQt5.QtGui import QIcon from PyQt5.QtCore import Qt class ExportDialog(QDialog): - def __init__(self, parent=None): + TXT='*.txt' + TIF='*.tif' + + def __init__(self, parent=None, out_type = TXT): super().__init__(parent) self.setWindowTitle('Export') @@ -38,7 +41,7 @@ class ExportDialog(QDialog): out_path_text.setPlaceholderText('选择输出路径') def on_out_path_btn(): - select_file = QFileDialog.getSaveFileName(self, '选择输出路径', '', '*.txt') + select_file = QFileDialog.getSaveFileName(self, '选择输出路径', '', out_type) if select_file[0]: out_path_text.setText(select_file[0]) self.out_path = select_file[0] @@ -88,17 +91,21 @@ class ExportPlugin(BasicPlugin): self.export_bin = QAction(IconInstance().DOCUMENT, '导出栅格二值变化检测结果') self.export_bin.triggered.connect(self.export_bin_action) ActionManager().export_menu.addAction(self.export_txt) + ActionManager().export_menu.addAction(self.export_bin) # self.ctx['toolbar'].addAction(self.export_txt) def export_bin_action(self): - dialog = ExportDialog(self.mainwindow) + dialog = ExportDialog(self.mainwindow, ExportDialog.TIF) if dialog.exec_(): - result = dialog.result_layer + result:ResultPointLayer = dialog.result_layer out = dialog.out_path + if result: + shutil.copy(result.result_path['path'], out) + self.message_box.info('导出成功') def export_txt_action(self): - dialog = ExportDialog(self.mainwindow) + dialog = ExportDialog(self.mainwindow, ExportDialog.TXT) if dialog.exec_(): result = dialog.result_layer out = dialog.out_path