프로젝트

일반

사용자정보

개정판 7066ba11

ID7066ba113743e0a1eb1db51400449dbe8012a1d6
상위 4ced36d5
하위 8f6f5a47

김연진이(가) 5년 이상 전에 추가함

issue #1118 : 도면생성 - Template.db 파일을 복사 하여 도면이름으로 db 파일을 생성

Change-Id: Ifaf422826a7cb5ac4f045cf07c7c001d4e639c29

차이점 보기:

HYTOS/HYTOS/MainWindow.py
820 820
    '''
821 821
    def new_drawing(self):
822 822
        import uuid
823
        from shutil import copyfile
823 824
        from datetime import datetime 
824 825
        from Drawing import Drawing
825 826

  
......
827 828
        options |= QFileDialog.DontUseNativeDialog
828 829
        name , _ = QFileDialog.getSaveFileName(self, self.tr('New Drawing'), '', 'HYTOS Files (*.hytos)', options=options)
829 830
        if name:
830
            if not os.path.splitext(name)[1]: name += '.hytos'
831
            if os.path.splitext(name)[1] != '.hytos': name += '.hytos'
831 832

  
832 833
            app_doc_data = AppDocData.instance()
833
            matches = [drawing for drawing in app_doc_data.getDrawings() if os.path.samefile(drawing.path, name)]
834
            # copy template.db to name
835
            copyfile(app_doc_data.getTemplateDbPath(), name)
836
            matches = [drawing for drawing in app_doc_data.getDrawings() if os.path.exists(drawing.path) and os.path.samefile(drawing.path, name)]
834 837
            if not matches:
835 838
                drawing = Drawing(str(uuid.uuid4()), name, str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
836 839
                app_doc_data.saveDrawing(drawing)
......
840 843

  
841 844
            self.load_drawing_list()
842 845
            self.open_border_file()
843
            self.load_data(name)
846
            self.load_data(drawing)
844 847
    
845 848
    def on_open_drawing(self):
846 849
        """ open selected drawing by user """

내보내기 Unified diff

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