프로젝트

일반

사용자정보

개정판 d19f939f

IDd19f939ff333a264ec31b4ae075379953ae7c6dc
상위 ca6cd684
하위 fcec743e

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

issue #622: save component to Components table

Change-Id: Ie47884e48e6f1c8eda6185395e8ddec07b39b270

차이점 보기:

DTI_PID/DTI_PID/Drawing.py
1 1
# coding: utf-8
2
import os
3
import uuid
4
from AppDocData import AppDocData
2 5

  
3 6
class Drawing:
4 7
    '''
5
        @brief  constructo
8
        @brief  construction
6 9
        @author humkyung
7 10
        @date   2018.07.07
8 11
    '''
9 12
    def __init__(self, name):
13
        app_doc_data = AppDocData.instance()
14

  
10 15
        self.name = name
11 16
        self._attrs = [['Drawing No', ''], ['Rev No', ''], ['Unit', '']] # attributes
12 17

  
18
        ''' set drawing uid '''
19
        drawings = app_doc_data.getDrawings()
20
        drawing = [drawing for drawing in drawings if self.name == os.path.splitext(drawing[1])[0]]
21
        self.UID = drawing[0][0] if drawing else uuid.uuid4()
22
        ''' up to here '''
23

  
13 24
    '''
14 25
        @brief  getter of attrs
15 26
        @author humkyung
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
375 375
        sql = 'insert or replace into VALVE_DATA_LIST({}) values({})'.format(','.join(cols), ','.join(values))
376 376
        res.append((sql, tuple(param)))
377 377

  
378
        cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation']
379
        values = ['?','?','?', '?', '?', '?', '?', '?']
380
        param = [str(self.uid), str(appDocData.activeDrawing.UID), str(self.dbUid), self.loc[0], self.loc[1], self.size[0], self.size[1], str(self.angle)]
381
        sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values))
382
        res.append((sql, tuple(param)))
383

  
378 384
        _attrs = self.getAttributes()
379 385
        for key in _attrs.keys():
380 386
            cols = ['UID', 'Components_UID', 'SymbolAttribute_UID', 'Value']

내보내기 Unified diff

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