프로젝트

일반

사용자정보

개정판 5397f65f

ID5397f65f6412a956cc2eada92130a497de40736a
상위 e57bdb6e
하위 206eb105

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

issue #1047: 도면 저장 오류 수정

Change-Id: I8fe21546a467b895a56bf3e73f164aeede5aa859

차이점 보기:

HYTOS/HYTOS/AppDocData.py
867 867
                # Roll back any change if something goes wrong
868 868
                conn.rollback()
869 869

  
870
                message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
870
                message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
871 871
                App.mainWnd().addMessage.emit(MessageType.Error, message)                
872 872

  
873 873
   
HYTOS/HYTOS/Shapes/EngineeringConnectorItem.py
486 486
        """ generate sql string to save connectors to database """
487 487
        res = []
488 488

  
489
        cols = ['UID', 'Components_UID', '[Index]', 'X', 'Y']
490
        values = ['?', '?', '?', '?', '?']
491
       
492
        param = [str(self.uid), str(self.parent.uid), index, self.center()[0], self.center()[1]]        
493
        sql = 'insert or replace into Points({}) values({})'.format(','.join(cols), ','.join(values))
494
        res.append((sql, tuple(param)))
495

  
496
        cols = ['Points_UID', 'Pressure', 'Pressure_Drop', 'Elevation', 'Over_Design_CV']
497
        values = ['?', '?', '?', '?', '?']
498
        if self.data:
499

  
500
            pressure = self.data.pressure
501
            if pressure is None:
502
                pressure = None
503
            else:
504
                pressure = float(pressure)
489
        try:
490
            cols = ['UID', 'Components_UID', '[Index]', 'X', 'Y']
491
            values = ['?', '?', '?', '?', '?']
505 492

  
506
            pressure_drop = self.data.pressure_drop
507
            if pressure_drop is None:
508
                pressure_drop = None
509
            else:
510
                pressure_drop = float(pressure_drop)
493
            param = [str(self.uid), str(self.parent.uid), index, self.center()[0], self.center()[1]]
494
            sql = 'insert or replace into Points({}) values({})'.format(','.join(cols), ','.join(values))
495
            res.append((sql, tuple(param)))
511 496

  
512
            elevation = self.data.elevation
513
            if elevation is None:
514
                elevation = None
515
            else:
516
                elevation = float(elevation)
497
            cols = ['Points_UID', 'Pressure', 'Pressure_Drop', 'Elevation', 'Over_Design_CV']
498
            values = ['?', '?', '?', '?', '?']
499
            if self.data:
517 500

  
518
            over_design_cv = self.data.over_design_cv
519
            if over_design_cv is None:
520
                over_design_cv = None
521
            else:
522
                over_design_cv = float(over_design_cv)
501
                pressure = self.data.pressure
502
                if pressure is None:
503
                    pressure = None
504
                else:
505
                    pressure = float(pressure)
523 506

  
507
                pressure_drop = self.data.pressure_drop
508
                if pressure_drop is None:
509
                    pressure_drop = None
510
                else:
511
                    pressure_drop = float(pressure_drop)
524 512

  
525
            param = [str(self.uid), pressure, pressure_drop, elevation, over_design_cv]
526
            sql = 'insert or replace into Nozzles({}) values({})'.format(','.join(cols), ','.join(values))
527
            res.append((sql, tuple(param)))
513
                elevation = self.data.elevation
514
                if elevation is None:
515
                    elevation = None
516
                else:
517
                    elevation = float(elevation)
518

  
519
                over_design_cv = self.data.over_design_cv
520
                if over_design_cv is None:
521
                    over_design_cv = None
522
                else:
523
                    over_design_cv = float(over_design_cv)
524

  
525

  
526
                param = [str(self.uid), pressure, pressure_drop, elevation, over_design_cv]
527
                sql = 'insert or replace into Nozzles({}) values({})'.format(','.join(cols), ','.join(values))
528
                res.append((sql, tuple(param)))
529

  
530
        except Exception as ex:
531
            from App import App
532
            from AppDocData import MessageType
533

  
534
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
535
                                                          sys.exc_info()[-1].tb_lineno)
536
            App.mainWnd().addMessage.emit(MessageType.Error, message)
528 537

  
529 538
        return res
530 539

  
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py
739 739
        from AppDocData import AppDocData
740 740

  
741 741
        res = []
742
        appDocData = AppDocData.instance()
743

  
744
        symbolInfo = appDocData.getSymbolByQuery('name', 'Stream Line')
745
        dbUid = symbolInfo.uid
746
        uid = self.uid
747

  
748
        cols = ['UID', 'Symbols_UID', 'Name']
749
        values = ['?','?', '?']
750
        param = [str(uid), str(dbUid), str(self.stream_no)]
751
        sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values))
752
        res.append((sql, tuple(param)))
753

  
754
        # save vertices to database
755
        index = 1
756
        for vertex in self._vertices:                                    
757
            if index == 1 and self.connectors[0].connectedItem is not None:
758
                cols = ['UID', 'Components_UID', '[Index]', 'X', 'Y', 'ConnectedItem_UID']
759
                values = ['?', '?', '?', '?', '?', '?']
760
                param = [str(uuid.uuid4()), str(uid), index, vertex[0], vertex[1],
761
                         str(self.connectors[0].connectedItem.uid)]
762
            elif index == 4 and self.connectors[1].connectedItem is not None:
763
                cols = ['UID', 'Components_UID', '[Index]', 'X', 'Y', 'ConnectedItem_UID']
764
                values = ['?', '?', '?', '?', '?', '?']
765
                param = [str(uuid.uuid4()), str(uid), index, vertex[0], vertex[1],
766
                         str(self.connectors[1].connectedItem.uid)]
767
            else:
768
                cols = ['UID', 'Components_UID', '[Index]', 'X', 'Y']
769
                values = ['?', '?', '?', '?', '?']
770
                param = [str(uuid.uuid4()), str(uid), index, vertex[0], vertex[1]]
771
        
772
            sql = 'insert or replace into Points({}) values({})'.format(','.join(cols), ','.join(values))
742
        app_doc_data = AppDocData.instance()
773 743

  
744
        try:
745
            symbolInfo = app_doc_data.getSymbolByQuery('name', 'Stream Line')
746
            dbUid = symbolInfo.uid
747
            uid = self.uid
748

  
749
            cols = ['UID', 'Symbols_UID', 'Name']
750
            values = ['?', '?', '?']
751
            param = [str(uid), str(dbUid), str(self.stream_no)]
752
            sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values))
774 753
            res.append((sql, tuple(param)))
775
            index += 1
776
        # up to here
754

  
755
            # save vertices to database
756
            index = 1
757
            for vertex in self._vertices:
758
                if index == 1 and self.connectors[0].connectedItem is not None:
759
                    cols = ['UID', 'Components_UID', '[Index]', 'X', 'Y', 'ConnectedItem_UID']
760
                    values = ['?', '?', '?', '?', '?', '?']
761
                    param = [str(uuid.uuid4()), str(uid), index, vertex[0], vertex[1],
762
                             str(self.connectors[0].connectedItem.uid)]
763
                elif index == len(self._vertices) and self.connectors[1].connectedItem is not None:
764
                    cols = ['UID', 'Components_UID', '[Index]', 'X', 'Y', 'ConnectedItem_UID']
765
                    values = ['?', '?', '?', '?', '?', '?']
766
                    param = [str(uuid.uuid4()), str(uid), index, vertex[0], vertex[1],
767
                             str(self.connectors[1].connectedItem.uid)]
768
                else:
769
                    cols = ['UID', 'Components_UID', '[Index]', 'X', 'Y']
770
                    values = ['?', '?', '?', '?', '?']
771
                    param = [str(uuid.uuid4()), str(uid), index, vertex[0], vertex[1]]
772

  
773
                sql = 'insert or replace into Points({}) values({})'.format(','.join(cols), ','.join(values))
774

  
775
                res.append((sql, tuple(param)))
776
                index += 1
777
            # up to here
778
        except Exception as ex:
779
            from App import App
780
            from AppDocData import MessageType
781

  
782
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
783
                                                          sys.exc_info()[-1].tb_lineno)
784
            App.mainWnd().addMessage.emit(MessageType.Error, message)
777 785

  
778 786
        return res
779 787

  
HYTOS/HYTOS/Shapes/SymbolSvgItem.py
215 215
        from AppDocData import AppDocData
216 216

  
217 217
        res = []
218
        appDocData = AppDocData.instance()
219 218

  
220
        rect = self.sceneBoundingRect()
219
        try:
220
            rect = self.sceneBoundingRect()
221 221

  
222
        cols = ['UID', 'Symbols_UID', 'X', 'Y', 'Rotation', 'Scale']
223
        values = ['?', '?', '?', '?', '?', '?']
224
        param = [str(self.uid), str(self.dbUid), rect.left(), rect.top(), str(self.angle), self.transform().m11()]
225
        sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values))
226
        res.append((sql, tuple(param)))
222
            cols = ['UID', 'Symbols_UID', 'X', 'Y', 'Rotation', 'Scale']
223
            values = ['?', '?', '?', '?', '?', '?']
224
            param = [str(self.uid), str(self.dbUid), rect.left(), rect.top(), str(self.angle), self.transform().m11()]
225
            sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values))
226
            res.append((sql, tuple(param)))
227 227

  
228
        # save connectors to database
229
        index = 1
230
        for connector in self.connectors:
231
            res.extend(connector.toSql(index))
232
            index += 1
233
        # up to here
228
            # save connectors to database
229
            index = 1
230
            for connector in self.connectors:
231
                res.extend(connector.toSql(index))
232
                index += 1
233
            # up to here
234

  
235
        except Exception as ex:
236
            from App import App
237

  
238
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
239
                                                          sys.exc_info()[-1].tb_lineno)
240
            App.mainWnd().addMessage.emit(MessageType.Error, message)
234 241

  
235 242
        return res
236 243

  
......
761 768
        from AirFinCooler import QAirFinCooler
762 769

  
763 770
        dialog = QAirFinCooler()
764
        dialog.showDialog(self)
771
        if dialog.showDialog(self):
772
            self.build_label()
765 773

  
766 774
    def show_Filter(self):
767 775
        from Filter import QFilter
768 776

  
769 777
        dialog = QFilter()
770
        dialog.showDialog(self)
778
        if dialog.showDialog(self):
779
            self.build_label()
771 780

  
772 781
    def show_Coil(self):
773 782
        from Coil import QCoil
774 783

  
775 784
        dialog = QCoil()
776
        dialog.showDialog(self)
785
        if dialog.showDialog(self):
786
            self.build_label()
777 787

  
778 788
    def show_DP_Equipment(self):
779 789
        from DP_Equipment import QDP_Equipment
780 790

  
781 791
        dialog = QDP_Equipment()
782
        dialog.showDialog(self)
792
        if dialog.showDialog(self):
793
            self.build_label()
783 794

  
784 795
    def show_Reactor(self):
785 796
        from Reactor import QReactor
786 797

  
787 798
        dialog = QReactor()
788
        dialog.showDialog(self)
799
        if dialog.showDialog(self):
800
            self.build_label()
789 801

  
790 802
    def show_Strainer_T(self):
791 803
        from Strainer_T import QStrainer_T
792 804

  
793 805
        dialog = QStrainer_T()
794
        dialog.showDialog(self)
806
        if dialog.showDialog(self):
807
            self.build_label()
795 808

  
796 809
    def show_Strainer_Y(self):
797 810
        from Strainer_Y import QStrainer_Y
798 811

  
799 812
        dialog = QStrainer_Y()
800
        dialog.showDialog(self)
813
        if dialog.showDialog(self):
814
            self.build_label()
801 815

  
802 816
    def show_BatteryLimit(self):
803 817
        from BatteryLimit import QBatteryLimit
804 818

  
805 819
        dialog = QBatteryLimit()
806
        dialog.showDialog(self)
820
        if dialog.showDialog(self):
821
            self.build_label()
807 822

  
808 823
    def show_Tray(self):
809 824
        from Tray import QTray
810 825

  
811 826
        dialog = QTray()
812
        dialog.showDialog(self)
827
        if dialog.showDialog(self):
828
            self.build_label()
813 829

  
814 830
    def show_SinglePacked(self):
815 831
        from SinglePacked import QSinglePacked
816 832

  
817 833
        dialog = QSinglePacked()
818
        dialog.showDialog(self)
834
        if dialog.showDialog(self):
835
            self.build_label()
819 836

  
820 837
    def show_DualPacked(self):
821 838
        from DualPacked import QDualPacked
822 839

  
823 840
        dialog = QDualPacked()
824
        dialog.showDialog(self)
841
        if dialog.showDialog(self):
842
            self.build_label()
825 843

  
826 844
    def show_Drum_Horizontal(self):
827 845
        from Drum_Horizontal import QDrum_Horizontal
828 846

  
829 847
        dialog = QDrum_Horizontal()
830
        dialog.showDialog(self)
848
        if dialog.showDialog(self):
849
            self.build_label()
831 850

  
832 851
    def show_Drum_Vertical(self):
833 852
        from Drum_Vertical import QDrum_Vertical
834 853

  
835 854
        dialog = QDrum_Vertical()
836
        dialog.showDialog(self)
855
        if dialog.showDialog(self):
856
            self.build_label()
837 857

  
838 858
    def show_PlateHeatExchanger(self):
839 859
        from PlateHeatExchanger import QPlateHeatExchanger
......
845 865
        from Equipment import QEquipment
846 866

  
847 867
        dialog = QEquipment()
848
        dialog.showDialog(self)
868
        if dialog.showDialog(self):
869
            self.build_label()
849 870

  
850 871
    def show_Ball(self):
851 872
        from Ball import QBall
852 873

  
853 874
        dialog = QBall()
854
        dialog.showDialog(self)
875
        if dialog.showDialog(self):
876
            self.build_label()
855 877

  
856 878
    def show_ShlTubHeatExchanger(self):
857 879
        from ShlTubHeatExchanger import QShlTubHeatExchanger
858 880

  
859 881
        dialog = QShlTubHeatExchanger()
860
        dialog.showDialog(self)
882
        if dialog.showDialog(self):
883
            self.build_label()
861 884

  
862 885
    def show_ConeRoof(self):
863 886
        from ConeRoof import QConeRoof
864 887

  
865 888
        dialog = QConeRoof()
866
        dialog.showDialog(self)
889
        if dialog.showDialog(self):
890
            self.build_label()
867 891

  
868 892
    def show_DomeRoof(self):
869 893
        from DomeRoof import QDomeRoof
870 894

  
871 895
        dialog = QDomeRoof()
872
        dialog.showDialog(self)
896
        if dialog.showDialog(self):
897
            self.build_label()
873 898

  
874 899
    def show_Compressor(self):
875 900
        from Compressor import QCompressor
876 901

  
877 902
        dialog = QCompressor()
878
        dialog.showDialog(self)
903
        if dialog.showDialog(self):
904
            self.build_label()
879 905

  
880 906
    def show_Pump(self):
881 907
        from Pump import QPump
882 908

  
883 909
        dialog = QPump()
884
        dialog.showDialog(self)
910
        if dialog.showDialog(self):
911
            self.build_label()
885 912

  
886 913
    def show_ValveControl(self):
887 914
        from Valve_Control import QValve_Control
888 915

  
889 916
        dialog = QValve_Control()
890
        dialog.showDialog(self)
917
        if dialog.showDialog(self):
918
            self.build_label()
891 919

  
892 920
    def show_ValveManual(self):
893 921
        from Valve_Manual import QValve_Manual
894 922

  
895 923
        dialog = QValve_Manual()
896
        dialog.showDialog(self)
924
        if dialog.showDialog(self):
925
            self.build_label()
897 926

  
898 927
    def show_LineSplitter(self):
899 928
        from LineSplitter import QLineSplitter
900 929

  
901 930
        dialog = QLineSplitter()
902
        dialog.showDialog(self)
931
        if dialog.showDialog(self):
932
            self.build_label()
903 933

  
904 934
    def show_Flowmeter(self):
905 935
        from Flowmeter import QFlowmeter
906 936

  
907 937
        dialog = QFlowmeter()
908
        dialog.showDialog(self)
938
        if dialog.showDialog(self):
939
            self.build_label()
909 940

  
910 941
    def show_Reducer(self):
911 942
        from Reducer import QReducer
912 943

  
913 944
        dialog = QReducer()
914
        dialog.showDialog(self)
945
        if dialog.showDialog(self):
946
            self.build_label()
915 947

  
916 948
    @staticmethod
917 949
    def fromDatabase(componentInfos):
HYTOS/HYTOS/Valve_Control.py
35 35
        self.set_controls(item)
36 36
        self.load_data()
37 37

  
38
        self.exec_()
38
        return self.exec_()
39 39

  
40 40
    def initialize(self):
41 41
        self.ui.label_Img.setVisible(False)
......
58 58
        matches = [connector.data for connector in self._item.connectors if connector.data]
59 59
        if matches:
60 60
            pressure_drop = matches[0].pressure_drop
61
            if pressure_drop:                
61
            if pressure_drop is not None:
62 62
                self.ui.lineEdit_Pressure_Drop.setText(str(pressure_drop))
63 63

  
64 64
            elevation = matches[0].elevation
65
            if elevation:
65
            if elevation is not None:
66 66
                self.ui.lineEdit_Elevation.setText(str(elevation))
67 67

  
68 68
            over_design_cv = matches[0].over_design_cv
69
            if over_design_cv:
69
            if over_design_cv is not None:
70 70
                self.ui.lineEdit_Overdesign.setText(str(over_design_cv))
71
            
72
                
71

  
73 72
    def accept(self):
74 73
        
75 74
        """ set tag no and nozzle data """

내보내기 Unified diff

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