프로젝트

일반

사용자정보

개정판 217af533

ID217af533c8292c67adb262c7734931c11cea84d5
상위 5c6db40e
하위 64e17792

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

issue #49: custom code setting finished and testing, function on going

Change-Id: Ib464974dcdf0363724ac92cb9c534546907e2bbf

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
2049 2049
                # Get a cursor object
2050 2050
                cursor = conn.cursor()
2051 2051

  
2052
                sql = self.project.database.to_sql('select UID, Name, Desciption from CustomTables')
2052
                sql = self.project.database.to_sql('select UID, Name, Description from CustomTables')
2053 2053
                cursor.execute(sql)
2054 2054
                rows = cursor.fetchall()
2055 2055
                for row in rows:
......
2057 2057
                    table.append(uuid.UUID(row[0]))
2058 2058
                    table.append(row[1])
2059 2059
                    table.append(row[2])
2060
                    table.append(CodeTable.instance('CustomTables', custom_table_uid=row[0]))
2060
                    table.append(CodeTable.instance('CustomCodes', custom_table_uid=row[0]))
2061 2061
                    result.append(table)
2062 2062
            # Catch the exception
2063 2063
            except Exception as ex:
DTI_PID/DTI_PID/CodeTables.py
80 80
                values = appDocData.getCodeTable(_table_name, False, symbol_attribute_uid=symbol_attribute_uid)
81 81
                CodeTable.TABLES[symbol_attribute_uid] = CodeTable(symbol_attribute_uid, values)
82 82
                return CodeTable.TABLES[symbol_attribute_uid]
83
        elif _table_name == 'CUSTOMTABLES' and custom_table_uid:
83
        elif _table_name == 'CUSTOMCODES' and custom_table_uid:
84 84
            if custom_table_uid in CodeTable.TABLES:
85 85
                return CodeTable.TABLES[custom_table_uid]
86 86
            else:
DTI_PID/DTI_PID/CustomCodeTablesDialog.py
23 23
        self.ui.tableWidgetCustomCodeTable.setColumnCount(4)
24 24
        self.ui.tableWidgetCustomCodeTable.setHorizontalHeaderLabels(['UID', 'Name', 'Description', 'Table'])
25 25
        self.ui.tableWidgetCustomCodeTable.hideColumn(0)
26
        self.ui.tableWidgetCustomCodeTable.horizontalHeader().setStretchLastSection(True)
26 27

  
27 28
        self.isAccepted = False
28 29

  
......
32 33
        self.ui.pushButtonDelete.clicked.connect(self.delTable)
33 34
        self.ui.tableWidgetCustomCodeTable.cellDoubleClicked.connect(self.cell_double_clicked)
34 35

  
36
        self.loadData()
37

  
38
    def loadData(self):
39
        """ load custom code tables """
40

  
41
        appDocData = AppDocData.instance()
42

  
43
        tables = appDocData.getCustomTables()
44
        self.ui.tableWidgetCustomCodeTable.setRowCount(len(tables))
45

  
46
        row = 0
47
        for table in tables:
48
            item = QTableWidgetItem(str(table[0]))              # UID
49
            self.ui.tableWidgetCustomCodeTable.setItem(row, 0, item)
50

  
51
            item = QTableWidgetItem(table[1])             # Name
52
            self.ui.tableWidgetCustomCodeTable.setItem(row, 1, item)
53

  
54
            item = QTableWidgetItem(table[2])      # Description
55
            self.ui.tableWidgetCustomCodeTable.setItem(row, 2, item)
56

  
57
            item = QTableWidgetItem('...')          # Codes
58
            item.tag = table[3].values
59
            item.setTextAlignment(Qt.AlignHCenter)
60
            item.setFlags(Qt.ItemIsEnabled)
61
            self.ui.tableWidgetCustomCodeTable.setItem(row, 3, item)
62

  
63
            row = row + 1
64

  
35 65
    def cell_double_clicked(self, row, column):
36 66
        from SymbolAttrCodeTableDialog import SymbolAttrCodeTableDialog
37 67
        from App import App
DTI_PID/DTI_PID/CustomCodeTables_UI.py
11 11
class Ui_CustomCodeTables(object):
12 12
    def setupUi(self, CustomCodeTables):
13 13
        CustomCodeTables.setObjectName("CustomCodeTables")
14
        CustomCodeTables.resize(496, 341)
14
        CustomCodeTables.resize(549, 589)
15 15
        font = QtGui.QFont()
16 16
        font.setFamily("맑은 고딕")
17 17
        CustomCodeTables.setFont(font)
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql
2099 2099
	FOREIGN KEY(SymbolAttribute_UID) REFERENCES SymbolAttribute (UID)
2100 2100
);
2101 2101

  
2102
CREATE TABLE IF NOT EXISTS CustomCodes ( 
2102
CREATE TABLE CustomCodes ( 
2103 2103
	UID VARCHAR ( 37 ) NOT NULL,
2104 2104
	Table_UID VARCHAR ( 37 ) NOT NULL,
2105 2105
	[Name] VARCHAR ( 32 ) NOT NULL,
......
2108 2108
	Allowables TEXT,
2109 2109
	CONSTRAINT CustomCodes_PK PRIMARY KEY(UID)
2110 2110
);
2111

  
2112
CREATE TABLE `CustomTables` (
2113
	`UID`	VARCHAR ( 37 ) NOT NULL,
2114
	`Name`	TEXT NOT NULL UNIQUE,
2115
	`Description`	TEXT,
2116
	CONSTRAINT `CustomCodes_PK` PRIMARY KEY(`UID`)
2117
);
2118

  
2119
CREATE TABLE `CustomCodes` (
2120
	`UID`	VARCHAR ( 37 ) NOT NULL,
2121
	`Table_UID`	VARCHAR ( 37 ) NOT NULL,
2122
	`Code`	VARCHAR ( 32 ) NOT NULL,
2123
	`Description`	TEXT,
2124
	`Allowables`	TEXT,
2125
	CONSTRAINT `CustomCodes_PK` PRIMARY KEY(`UID`),
2126
	FOREIGN KEY(`Table_UID`) REFERENCES `CustomTables`(`UID`)
2127
);
DTI_PID/DTI_PID/Scripts/SQLite_Project.tables.sql
23 23
	`Description` TEXT, 
24 24
	`Allowables` TEXT,
25 25
	CONSTRAINT `CustomCodes_PK` PRIMARY KEY(`UID`)
26
);
27

  
28
CREATE TABLE IF NOT EXISTS `CustomTables` (
29
	`UID`	VARCHAR ( 37 ) NOT NULL,
30
	`Name`	TEXT NOT NULL UNIQUE,
31
	`Description`	TEXT,
32
	CONSTRAINT `CustomCodes_PK` PRIMARY KEY(`UID`)
33
);
34

  
35
CREATE TABLE IF NOT EXISTS `CustomCodes` (
36
	`UID`	VARCHAR ( 37 ) NOT NULL,
37
	`Table_UID`	VARCHAR ( 37 ) NOT NULL,
38
	`Code`	VARCHAR ( 32 ) NOT NULL,
39
	`Description`	TEXT,
40
	`Allowables`	TEXT,
41
	CONSTRAINT `CustomCodes_PK` PRIMARY KEY(`UID`),
42
	FOREIGN KEY(`Table_UID`) REFERENCES `CustomTables`(`UID`)
26 43
);
DTI_PID/DTI_PID/UI/CustomCodeTables.ui
6 6
   <rect>
7 7
    <x>0</x>
8 8
    <y>0</y>
9
    <width>496</width>
10
    <height>341</height>
9
    <width>549</width>
10
    <height>589</height>
11 11
   </rect>
12 12
  </property>
13 13
  <property name="font">

내보내기 Unified diff

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