프로젝트

일반

사용자정보

개정판 d6d52487

IDd6d5248718a6be5637f6afff52df01a983c3833f
상위 c558ebde
하위 78b05425, 6d5ea555, c77eb176

백흠경이(가) 4년 이상 전에 추가함

issue #622: 도면 저장 시 현재 작업 영역을 저장하여 도면을 열때 저장한 작업 영역을 복원한다

Change-Id: I9ce43ba30908e4058fee7fdca2701989d7d05d00

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
378 378
        self.settings.setValue('geometry', self.saveGeometry())
379 379
        self.settings.setValue('windowState', self.saveState())
380 380
        # TODO: need to modify
381

  
382
        """save current view region"""
383
        app_doc_data = AppDocData.instance()
384
        if app_doc_data.activeDrawing:
385
            rect = self.graphicsView.viewport().rect()
386
            app_doc_data.activeDrawing.view_rect = self.graphicsView.mapToScene(rect).boundingRect()
387
            app_doc_data.update_view_region(app_doc_data.activeDrawing)
388
        """up to here"""
389

  
381 390
        # self.save_drawing_if_necessary()
382 391
        AppDocData.instance().clear()
383 392
        event.accept()
......
817 826
                return False
818 827
            return True
819 828

  
820
    '''
821
        @brief      action save click event
822
        @author     kyouho
823
        @date       2018.08.09
824
        @history    2018.11.02      euisung     add line data list db update
825
                    humkyung save saved time to database
826
                    2018.11.05      euisung     add note data list db update
827
                    2018.11.05      euisung     add db delete process before save
828
                    2018.11.12      euisung     db part move new method to dbUpdate
829
    '''
830

  
831 829
    def actionSaveCliked(self):
830
        """save current drawing"""
832 831
        from EngineeringAbstractItem import QEngineeringAbstractItem
833 832
        from SaveWorkCommand import SaveWorkCommand
834 833

  
......
849 848

  
850 849
            items = self.graphicsView.scene().items()
851 850

  
852
            '''
853
            # for check line disappear bug
854
            disappear_lines = [line for line in app_doc_data.lines if line not in items]
855
            '''
856

  
857
            '''
858
            for item in items:
859
                if issubclass(type(item), QEngineeringAbstractItem):
860
                    app_doc_data.allItems.append(item)
861
                    if issubclass(type(item), QEngineeringTextItem):
862
                        app_doc_data.texts.append(item)
863
            '''
864

  
865
            '''
866
            # for check line disappear bug
867
            if disappear_lines:
868
                app_doc_data.allItems.extend(disappear_lines)
869
                for dis_line in disappear_lines:
870
                    self.addMessage.emit(MessageType.Check, f"disapper line from scene : {str(dis_line)}")
871
            '''
872

  
873
            '''
874
            itemTypes = []
875
            for item in items:
876
                typeExist = False
877
                for itemType in itemTypes:
878
                    if type(item) is itemType:
879
                        typeExist = True
880
                        break
881
                if not typeExist:
882
                    itemTypes.append(type(item))
883
            '''
884

  
885 851
            self._save_work_cmd = SaveWorkCommand(self.graphicsView.scene())
886 852
            self._save_work_cmd.show_progress.connect(self.progress_bar.setValue)
887 853
            self._save_work_cmd.display_message.connect(self.onAddMessage)
......
889 855

  
890 856
            self._save_work_cmd.start()
891 857
        except Exception as ex:
892
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
893
                                                           sys.exc_info()[-1].tb_lineno)
858
            message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
859
                      f"{sys.exc_info()[-1].tb_lineno}"
894 860
            self.addMessage.emit(MessageType.Error, message)
895 861

  
896 862
    def save_finished(self):
......
1013 979
            self.graphicsView.scene().removeItem(self.actionVendor.tag._polyline)
1014 980
            self.actionVendor.tag.reset()
1015 981

  
1016
    '''
1017
        @brief      Fit Window
1018
        @author     Jeongwoo
1019
        @date       2018.06.27
1020
        @history    2018.06.27  Jeongwoo    Chnage method to initialize command [Set None → DefaultCommand]
1021
    '''
1022

  
1023
    def fitWindow(self, action):
982
    def fitWindow(self, view_rect: QRectF = QRectF()):
983
        """Fit Window"""
1024 984
        self.graphicsView.useDefaultCommand()
1025 985
        self.graphicsView.zoomImageInit()
1026 986

  
987
        if view_rect:
988
            self.graphicsView.zoom_rect(view_rect)
989

  
1027 990
    def scene_changed(self):
1028 991
        """update modified flag"""
1029 992

  
......
1596 1559

  
1597 1560
                self.changeViewCheckedState(True)
1598 1561
                self.setWindowTitle(self.title)
1562
                self.fitWindow(drawing.view_rect)
1599 1563

  
1600 1564
                # save alarm
1601 1565
                self.save_alarm_enable(True, True)
1602 1566
        except Exception as ex:
1603
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1604
                                                           sys.exc_info()[-1].tb_lineno)
1567
            message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
1568
                      f"{sys.exc_info()[-1].tb_lineno}"
1605 1569
            self.addMessage.emit(MessageType.Error, message)
1606 1570

  
1607 1571
        return self.path

내보내기 Unified diff

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