프로젝트

일반

사용자정보

개정판 0e455b69

ID0e455b694ff831ebe5efab59125d063b50ca8e29
상위 8a68ced4
하위 8804d0d9

gaqhf 이(가) 6년 이상 전에 추가함

dev issue #627: edit equipment data list

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
1816 1816
        @author     humkyung
1817 1817
        @date       2018.05.03
1818 1818
    '''
1819
    def getEquipmentItemNo(self):
1820
        from EquipmentData import EquipmentData
1821

  
1822
        if not self.equipmentDataList:
1823
            try:
1824
                # Creates or opens a file called mydb with a SQLite3 DB
1825
                dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), 'ITI_PID.db')
1826
                conn = sqlite3.connect(dbPath)
1827
                # Get a cursor object
1828
                cursor = conn.cursor()
1829

  
1830
                sql = 'select ITEM_NO from EQUIPMENT_DATA_LIST'
1831
                cursor.execute(sql)
1832
                rows = cursor.fetchall()
1833
                for row in rows:
1834
                    data = EquipmentData(row[0])
1835
                    self.equipmentDataList.append(data)
1836
            # Catch the exception
1837
            except Exception as ex:
1838
                # Roll back any change if something goes wrong
1839
                conn.rollback()
1840
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
1841
            finally:
1842
                # Close the db connection
1843
                conn.close()
1844

  
1845
        return self.equipmentDataList 
1846

  
1847
    '''
1848
        @brief      get equipment data list
1849
        @author     humkyung
1850
        @date       2018.05.03
1851
    '''
1852 1819
    def getEquipmentDataList(self, docName = None):
1853 1820
        if not self.equipmentDataList:
1854 1821
            try:
......
1865 1832
                cursor.execute(sql)
1866 1833
                rows = cursor.fetchall()
1867 1834
                for row in rows:
1868
                    self.equipmentDataList.append(row[0])
1835
                    data = []
1836
                    for index in range(len(cursor.description)): 
1837
                        data.append(row[index])
1838
                    self.equipmentDataList.append(data)
1869 1839
            # Catch the exception
1870 1840
            except Exception as ex:
1871 1841
                # Roll back any change if something goes wrong
DTI_PID/DTI_PID/MainWindow.py
36 36
from QEngineeringNoteItem import QEngineeringNoteItem
37 37
from QEngineeringSizeTextItem import QEngineeringSizeTextItem
38 38
from EngineeringUnknownItem import QEngineeringUnknownItem
39
from QEngineeringEquipmentItem import QEngineeringEquipmentItem
39 40
from AppDocData import *
40 41
import SymbolTreeWidget, SymbolPropertyTableWidget
41 42
import SymbolEditorDialog
......
904 905
                    item.angle = angle
905 906
                    item.setPen(QPen(Qt.red, 5, Qt.SolidLine))
906 907
                    self.graphicsView.scene.addItem(item)
908

  
909
                # Equipment Item 경우 저장
910
                if type(item) is QEngineeringEquipmentItem:
911
                    item.saveEquipData()
907 912
            # up to here
908 913
        except Exception as ex:
909 914
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
DTI_PID/DTI_PID/Shapes/QEngineeringEquipmentItem.py
115 115
                dataList.append('')
116 116

  
117 117
            dataList[0] = self.uid
118
            dataList[1] = self.name
119 118
            dataList[14] = docData.imgName
120 119

  
121 120
            for attr in attrs:
DTI_PID/DTI_PID/TextItemFactory.py
291 291
    '''
292 292
    def isTagNoText(self, text):
293 293
        docData = AppDocData.instance()
294
        dataList = docData.getEquipmentItemNo()
295
        matches = [data for data in dataList if data == text]
294
        dataList = docData.getEquipmentDataList()
295
        matches = [data for data in dataList if data[1] == text]
296 296
        return (len(matches) > 0)
297 297

  

내보내기 Unified diff