프로젝트

일반

사용자정보

개정판 2dd894e3

ID2dd894e38244ddba74197f6e013a41b5feac1e8b
상위 d787e537
하위 1d33681d

함의성이(가) 약 6년 전에 추가함

issue #503: set ui

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
109 109
        self._lineTypeConfigs = None
110 110
        self._activeDrawing = None
111 111
        self._hmbTable = None
112
        self._titleBlockProperties = None
112 113

  
113 114
    '''
114 115
        @brief      clear
......
134 135
        self._lineTypeConfigs = None
135 136
        self._activeDrawing = None
136 137
        self._hmbTable = None
138
        self._titleBlockProperties = None
137 139

  
138 140
    '''
139 141
        @brief      Get drawing file list
......
733 735
        return prjDatabaseFilePath
734 736

  
735 737
    '''
738
        @brief  return title block properties
739
        @author euisung
740
        @date   2018.11.09
741
    '''
742
    def getTitleBlockProperties(self):
743
        res = None
744
        if self._titleBlockProperties is None:
745
            try:
746
                self._titleBlockProperties = []
747

  
748
                # Creates or opens a file called mydb with a SQLite3 DB
749
                dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), 'ITI_PID.db')
750
                db = sqlite3.connect(dbPath)
751
                # Get a cursor object
752
                cursor = db.cursor()
753

  
754
                sql = "select UID, Name, AREA from TitleBlockProperties" 
755
                cursor.execute(sql)
756
                rows = cursor.fetchall()
757
                for row in rows:
758
                    attr = []
759
                    attr[0] = row[0] # uid
760
                    attr[1] = row[1] # name
761
                    attr[2] = row[2] # area
762
                    self._titleBlockProperties.append(attr)
763
                
764
                res = self._titleBlockProperties
765
            # Catch the exception
766
            except Exception as ex:
767
                # Roll back any change if something goes wrong
768
                db.rollback()
769
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
770
            finally:
771
                # Close the db connection
772
                db.close()
773
        else:
774
            res = self._titleBlockProperties
775

  
776
        return res
777

  
778
    '''
736 779
        @brief  return line properties
737 780
        @author humkyung
738 781
        @date   2018.04.09
DTI_PID/DTI_PID/ConfigurationAreaDialog.py
31 31
        self.ui.setupUi(self)
32 32
        self.ui.tableWidgetEquipmentDescArea.setColumnCount(2)
33 33
        self.ui.tableWidgetEquipmentDescArea.setHorizontalHeaderLabels(['Drawing Name', 'Area'])
34
        self.ui.tableWidgetEquipmentDescArea.horizontalHeaderItem(0).setSizeHint(QSize(25, 25))
34
        for index in range(self.ui.tableWidgetEquipmentDescArea.columnCount()):
35
            self.ui.tableWidgetEquipmentDescArea.horizontalHeaderItem(0).setSizeHint(QSize(25, 25))
36
            self.ui.tableWidgetEquipmentDescArea.setColumnWidth(index, len(self.ui.tableWidgetEquipmentDescArea.horizontalHeaderItem(index).text()) * 8 + 10)
37
        self.ui.tableWidgetTitleBlockArea.setColumnCount(2)
38
        self.ui.tableWidgetTitleBlockArea.setHorizontalHeaderLabels(['Name', 'Area'])
39
        for index in range(self.ui.tableWidgetTitleBlockArea.columnCount()):
40
            self.ui.tableWidgetTitleBlockArea.horizontalHeaderItem(0).setSizeHint(QSize(25, 25))
41
            self.ui.tableWidgetTitleBlockArea.setColumnWidth(index, len(self.ui.tableWidgetTitleBlockArea.horizontalHeaderItem(index).text()) * 8 + 10)
35 42
        self.isAccepted = False
36 43
        self._cmd = FenceCommand.FenceCommand(self.parent().graphicsView)
37 44
        self._cmd.onSuccess.connect(self.onAreaCreated)
......
96 103

  
97 104
        # up to here
98 105

  
99
        self.ui.pushButtonAdd.setStyleSheet('background-color: darkGray')
106
        titleBlockProps = docData.getTitleBlockProperties()
107
        self.ui.tableWidgetTitleBlockArea.setRowCount(len(titleBlockProps))
108
        row = 0
109
        for titleBlockProp in titleBlockProps:
110
            area = Area('')
111
            area.parse(titleBlockProp[2])
112

  
113
            boundingBox = QGraphicsBoundingBoxItem(area.x, area.y, area.width, area.height)
114
            boundingBox.transfer.onSizeChanged.connect(self.onBoundingBoxChanged)
115
            boundingBox.setPen(QPen(Qt.darkCyan, THICKNESS, Qt.SolidLine))
116
            self.parent().graphicsView.scene.addItem(boundingBox)
117

  
118
            item = QTableWidgetItem(docData.imgName)
119
            item.setFlags(Qt.ItemIsEnabled)
120
            self.ui.tableWidgetTitleBlockArea.setItem(row, 0, item)
121
            item = QTableWidgetItem('({},{}),({},{})'.format(area.x, area.y, area.width, area.height))
122
            item.setFlags(Qt.ItemIsEnabled)
123
            item.tag = boundingBox
124
            self.ui.tableWidgetTitleBlockArea.setItem(row, 1, item)
125
            row += 1
126

  
127
        #self.ui.pushButtonAdd.setStyleSheet('background-color: darkGray')
100 128

  
101 129
        section = '{} Equipment Desc Area'.format(docData.imgName)
102 130
        configs = docData.getConfigs(section)
......
120 148
            self.ui.tableWidgetEquipmentDescArea.setItem(row, 1, item)
121 149

  
122 150
            row += 1
123
        self.ui.tableWidgetEquipmentDescArea.resizeColumnsToContents()
151
        
152
        if self.ui.tableWidgetEquipmentDescArea.rowCount() is not 0: 
153
            self.ui.tableWidgetEquipmentDescArea.resizeColumnsToContents()
154
        if self.ui.tableWidgetTitleBlockArea.rowCount() is not 0: 
155
            self.ui.tableWidgetTitleBlockArea.resizeColumnsToContents()
124 156

  
125 157
        self.ui.pushButtonDrawingArea.clicked.connect(self.selectDrawingArea)
126 158
        self.ui.pushButtonNoteArea.clicked.connect(self.selectNoteArea)

내보내기 Unified diff

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