프로젝트

일반

사용자정보

개정판 a5003140

IDa500314050af4225e4e9c95900b1ca6b46e7c354
상위 fbf468d4
하위 cf3634ce

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

revised #577: Equipment Desc. 영역 설정

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
56 56
        self.height = None
57 57
    
58 58
    '''
59
        @brief  parse area
60
        @author humkyung
61
        @date   2018.06.29
62
    '''
63
    def parse(self, strArea):
64
        import re
65

  
66
        found = re.findall('\d+', strArea)
67
        if len(found) == 4:
68
            self.x = int(found[0])
69
            self.y = int(found[1])
70
            self.width = int(found[2])
71
            self.height = int(found[3])
72
        
73
    '''
59 74
        @brief  clone an object
60 75
    '''
61 76
    def clone(self):
......
495 510
        # Catch the exception
496 511
        except Exception as ex:
497 512
            # Roll back any change if something goes wrong
498
            conn.rollback()
499 513
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
500 514
        finally:
501
            # Close the db connection
502
            '''DO NOTHING'''
515
            pass
503 516

  
504 517
    '''
505 518
        @brief      Make Directory
......
785 798
                for row in rows:
786 799
                    area = Area()
787 800
                    area.name = row[1]
788
                    tokens = row[2].split(',')
789
                    area.x = round(float(tokens[0]))
790
                    area.y = round(float(tokens[1]))
791
                    area.width = round(float(tokens[2]))
792
                    area.height = round(float(tokens[3]))
801
                    area.parse(row[2])
793 802
                    self._areas.append(area)
794 803
            # Catch the exception
795 804
            except Exception as ex:
......
921 930

  
922 931
        try:
923 932
            # Creates or opens a file called mydb with a SQLite3 DB
924
            dbPath = self.getCurrentProject().getDbFilePath() + "/ITI_PID.db"
933
            dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), "ITI_PID.db")
925 934
            conn = sqlite3.connect(dbPath)
926 935
            # Get a cursor object
927 936
            cursor = conn.cursor()
928 937

  
929 938
            for area in self._areas:
930
                sql = "insert or replace into configuration values('Area','{}','{},{},{},{}')".format(area.name, round(area.x), round(area.y), round(area.width), round(area.height))
939
                sql = "insert or replace into configuration values('Area','{}','({},{}),({},{})')".format(area.name, round(area.x), round(area.y), round(area.width), round(area.height))
931 940
                cursor.execute(sql)
932 941

  
933 942
            conn.commit()

내보내기 Unified diff

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