프로젝트

일반

사용자정보

개정판 b0034990

IDb0034990ff4feb582752f768aa597f35a1252b9b
상위 6a2a7457
하위 3f15a2b0

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

implementing issue #640:

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
1189 1189
        ret = []
1190 1190

  
1191 1191
        try:
1192
            dbPath = self.getCurrentProject().getDbFilePath() + "/ITI_PID.db"
1192
            dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), 'ITI_PID.db')
1193 1193
            conn = sqlite3.connect(dbPath)
1194 1194
            cursor = conn.cursor()
1195 1195
            if fieldName is not None and param is not None:
......
1521 1521
        return result
1522 1522

  
1523 1523
    '''
1524
        @brief      save symbol attributes
1525
        @author     humkyung
1526
        @date       2018.08.14
1527
    '''
1528
    def saveSymbolAttributes(self, type, attrs):
1529
        try:
1530
            # Creates or opens a file called mydb with a SQLite3 DB
1531
            dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), 'ITI_PID.db')
1532
            conn = sqlite3.connect(dbPath)
1533
            # Get a cursor object
1534
            cursor = conn.cursor()
1535

  
1536
            sql = 'delete from SymbolAttribute where SymbolType = ?'
1537
            param = (type,)
1538
            cursor.execute(sql, param)
1539

  
1540
            for attr in attrs:
1541
                sql = 'insert into SymbolAttribute(SymbolType, Attribute) values(?,?)'
1542
                param = (type, attr)
1543
                cursor.execute(sql, param)
1544

  
1545
            conn.commit()
1546
            # Catch the exception
1547
        except Exception as ex:
1548
            # Roll back any change if something goes wrong
1549
            conn.rollback()
1550
            
1551
            from App import App 
1552
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
1553
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1554
        finally:
1555
            # Close the db connection
1556
            conn.close()
1557

  
1558
    '''
1524 1559
        @brief      get Code Table Data
1525 1560
        @author     kyouho
1526 1561
        @date       2018.07.10
......
1834 1869
        symbolTypeList = []
1835 1870

  
1836 1871
        try:
1837
            dbPath = self.getCurrentProject().getDbFilePath() + "/ITI_PID.db"
1872
            dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), 'ITI_PID.db')
1838 1873

  
1839 1874
            conn = sqlite3.connect(dbPath)
1840 1875
            cursor = conn.cursor()
......
1843 1878
                cursor.execute(sql)
1844 1879
                rows = cursor.fetchall()
1845 1880
                for row in rows:
1846
                    symbolTypeList.append(row[2]) # Type String
1881
                    symbolTypeList.append((row[0], row[1], row[2])) # UID, category, type
1847 1882
            except Exception as ex:
1848
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
1883
                from App import App
1884

  
1885
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
1886
                App.mainWin().addMessage(MessageType.Error, message)
1849 1887
        finally:
1850 1888
            conn.close()
1851 1889

  
......
1891 1929
    '''
1892 1930
    def getSymbolTypeComboBoxItems(self):
1893 1931
        symbolTypeList = self.getSymbolTypeList()
1894
        symbolTypeList.insert(0, "None")
1932
        symbolTypeList.insert(0, ('None', 'None', 'None'))
1895 1933

  
1896 1934
        return symbolTypeList
1897 1935

  

내보내기 Unified diff

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