프로젝트

일반

사용자정보

개정판 1cee8954

ID1cee8954ba2e8aa76b2f4415887d2a7ccc20ed85
상위 9eef2495
하위 7fecca7b

백흠경이(가) 약 2년 전에 추가함

작업 내용이 현재 파일에도 반영되는 오류 수정

Change-Id: Ibfa91848b2ae49751fa573acf770721c285ffcab

차이점 보기:

HYTOS/HYTOS/AppDocData.py
330 330

  
331 331
    def getAppDbPath(self):
332 332
        """
333
        @brief      Get application DB file path in ProgramData
333
        @brief      Get application DB file path in local app data folder
334 334
        @author     humkyung
335 335
        @date       2018.10.01
336 336
        """
HYTOS/HYTOS/MainWindow.py
4 4
import sys
5 5
import os
6 6
import subprocess
7
import tempfile
7 8
from functools import partial
8 9

  
9 10
# from openpyxl.drawing import colors
......
1009 1010
                    self.progress.setWindowTitle(self.tr("Save"))
1010 1011
                    self.progress.show()
1011 1012

  
1012
                    self.save_drawing_data()
1013
                    self.save_drawing_data(False)
1013 1014
                finally:
1014 1015
                    self.load_drawing_list()
1015 1016
                    self.progress.setValue(self.progress.maximum())
......
1046 1047

  
1047 1048
        file_name = os.path.join(workspace, 'copy of ' + app_doc_data.activeDrawing.name + '.hytos')
1048 1049
        options = QFileDialog.Options()
1049
        #options |= QFileDialog.DontUseNativeDialog
1050 1050
        name, _ = QFileDialog.getSaveFileName(self, self.tr('Save As'), file_name, 'HYTOS(*.hytos)', options=options)
1051 1051
        if name:
1052 1052
            try:
1053 1053
                if os.path.splitext(name)[1] != '.hytos': name += '.hytos'
1054 1054

  
1055
                self.actionSaveCliked()  # save current drawing
1056

  
1057 1055
                app_doc_data = AppDocData.instance()
1056
                # save working data to a temporary file
1057
                self.save_drawing_data(True)  # save current drawing to temporary file
1058

  
1058 1059
                # copy current drawing file to new drawing file
1059 1060
                copyfile(app_doc_data.activeDrawing.path, name)
1060 1061
                app_doc_data.activeDrawing.path = name
......
1087 1088
        """redo"""
1088 1089
        self.graphicsView.scene.undo_stack.redo()
1089 1090

  
1090
    def save_drawing_data(self):
1091
    def save_drawing_data(self, save_as: bool = True):
1091 1092
        """ save drawing data """
1092 1093

  
1093 1094
        from datetime import datetime
......
1131 1132
            self.setMainWindowTitle(f"{app_doc_data.activeDrawing.path}")
1132 1133

  
1133 1134
            shutil.copyfile(app_doc_data.activeDrawing.org_path, app_doc_data.activeDrawing.org_path + ".bak")
1134
            shutil.copyfile(app_doc_data.activeDrawing.path, app_doc_data.activeDrawing.org_path)
1135
            if not save_as: shutil.copyfile(app_doc_data.activeDrawing.path, app_doc_data.activeDrawing.org_path)
1135 1136
        except Exception as ex:
1136 1137
            message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
1137 1138
                      f"{sys.exc_info()[-1].tb_lineno}"
......
2792 2793
                      f'{sys.exc_info()[-1].tb_lineno}'
2793 2794
            self.addMessage.emit(MessageType.Error, message)
2794 2795

  
2795
    def saveAs_drawing(self, sourceDb):
2796
    def saveAs_drawing(self, sourceDb:str):
2797
        """작업 도면을 다른 이름으로 저장합니다."""
2796 2798
        import uuid
2797 2799
        from shutil import copyfile
2798 2800
        from datetime import datetime
......
2801 2803
        workspace = self.get_work_space()
2802 2804

  
2803 2805
        options = QFileDialog.Options()
2804
        #options |= QFileDialog.DontUseNativeDialog
2805 2806
        name, _ = QFileDialog.getSaveFileName(self, self.tr('Save As'), workspace, 'HYTOS Files (*.hytos)',
2806 2807
                                              options=options)
2807 2808
        if name:

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)