개정판 dcd90366
issue #1167: OPC 연계 설정 - opc를 연계하여 데이타베이스에 저장한다
Change-Id: Ice000958c90883b1568872c6355265c27d8cea1d
DTI_PID/DTI_PID/App.py | ||
---|---|---|
17 | 17 |
from AppDocData import AppDocData |
18 | 18 |
|
19 | 19 |
class App(QApplication): |
20 |
""" |
|
21 |
This is App class inherits from QApplication |
|
22 |
""" |
|
20 |
""" This is App class inherits from QApplication """ |
|
23 | 21 |
def __init__(self, args): |
24 | 22 |
import locale |
25 | 23 |
|
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
1993 | 1993 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
1994 | 1994 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1995 | 1995 |
|
1996 |
def get_opcs(self): |
|
1997 |
""" get opc in project """ |
|
1998 |
conn = self.project.database.connect() |
|
1999 |
with conn: |
|
2000 |
try: |
|
2001 |
# Get a cursor object |
|
2002 |
cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True) |
|
2003 |
|
|
2004 |
sql = "select (select Name from Drawings where UID=a.Drawings_UID) as Drawing,\ |
|
2005 |
(select Value from Components where UID=a.Owner) as [Line No],\ |
|
2006 |
UID as OPC from Components a \ |
|
2007 |
where Symbol_UID in (select UID from Symbol where SymbolType_UID in (select UID from SymbolType where Type='Instrument OPC''s' or Type='Piping OPC''s'))" |
|
2008 |
cursor.execute(sql) |
|
2009 |
return cursor.fetchall() |
|
2010 |
# Catch the exception |
|
2011 |
except Exception as ex: |
|
2012 |
from App import App |
|
2013 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
2014 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
2015 |
|
|
2016 |
def get_opc_relations(self): |
|
2017 |
""" get opc relations """ |
|
2018 |
conn = self.project.database.connect() |
|
2019 |
with conn: |
|
2020 |
try: |
|
2021 |
# Get a cursor object |
|
2022 |
cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True) |
|
2023 |
|
|
2024 |
sql = "select (select Name from Drawings where UID=a.From_Drawings_UID) as From_Drawing,\ |
|
2025 |
(select Value from Components where UID=a.From_LineNo_UID) as From_LineNo,\ |
|
2026 |
a.From_OPC_UID,\ |
|
2027 |
(select Name from Drawings where UID=a.To_Drawings_UID) as To_Drawing,\ |
|
2028 |
(select Value from Components where UID=a.To_LineNo_UID) as To_LineNo,\ |
|
2029 |
a.To_OPC_UID \ |
|
2030 |
from OPCRelations a" |
|
2031 |
cursor.execute(sql) |
|
2032 |
return cursor.fetchall() |
|
2033 |
# Catch the exception |
|
2034 |
except Exception as ex: |
|
2035 |
from App import App |
|
2036 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
2037 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
2038 |
|
|
2039 |
def save_opc_relations(self, opcs): |
|
2040 |
""" save opc relations """ |
|
2041 |
conn = self.project.database.connect() |
|
2042 |
with conn: |
|
2043 |
try: |
|
2044 |
# Get a cursor object |
|
2045 |
cursor = conn.cursor() |
|
2046 |
sql = 'delete from OPCRelations' |
|
2047 |
cursor.execute(sql) |
|
2048 |
|
|
2049 |
for opc in opcs: |
|
2050 |
sql = 'insert into OPCRelations(From_Drawings_UID,From_LineNo_UID,From_OPC_UID,To_Drawings_UID,To_LineNo_UID,To_OPC_UID) \ |
|
2051 |
values({},{},{},{},{},{})'.format( |
|
2052 |
"(select UID from Drawings where Name='{}')".format(opc[0]), |
|
2053 |
"(select UID from Components where Value='{}')".format(opc[1]) if opc[1] else 'null', |
|
2054 |
"'{}'".format(opc[2]) if opc[2] else 'null', |
|
2055 |
"(select UID from Drawings where Name='{}')".format(opc[3]) if opc[3] else 'null', |
|
2056 |
"(select UID from Components where Value='{}')".format(opc[4]) if opc[4] else 'null', |
|
2057 |
"'{}'".format(opc[5]) if opc[5] else 'null') |
|
2058 |
cursor.execute(sql) |
|
2059 |
|
|
2060 |
conn.commit() |
|
2061 |
# Catch the exception |
|
2062 |
except Exception as ex: |
|
2063 |
conn.rollback() |
|
2064 |
|
|
2065 |
from App import App |
|
2066 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
2067 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
2068 |
|
|
1996 | 2069 |
def get_component_connectors(self, component): |
1997 | 2070 |
""" get connectors of given component """ |
1998 | 2071 |
conn = self.project.database.connect() |
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
79 | 79 |
item = self.table.item(self.row, 3) |
80 | 80 |
if item: |
81 | 81 |
item.setFlags(Qt.ItemIsEnabled) if state else item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsEditable|Qt.ItemIsSelectable) |
82 |
item.setBackground(Qt.lightGray) if state else item.setBackground(Qt.white) |
|
82 |
#item.setBackground(Qt.lightGray) if state else item.setBackground(Qt.white)
|
|
83 | 83 |
elif self.col == 3: |
84 | 84 |
cell = self.table.item(self.row, 1) |
85 | 85 |
if cell: |
... | ... | |
186 | 186 |
name = attr[0] |
187 | 187 |
item = QTableWidgetItem(name) |
188 | 188 |
item.setFlags(Qt.ItemIsEnabled) |
189 |
item.setBackground(Qt.lightGray) |
|
189 |
#item.setBackground(Qt.lightGray)
|
|
190 | 190 |
self.setItem(row, 0, item) |
191 | 191 |
|
192 | 192 |
value = attr[1] |
... | ... | |
379 | 379 |
item = self.item(index, 1) |
380 | 380 |
if item is not None: |
381 | 381 |
item.setFlags(Qt.ItemIsEnabled) |
382 |
item.setBackground(Qt.lightGray) |
|
382 |
#item.setBackground(Qt.lightGray)
|
|
383 | 383 |
except Exception as ex: |
384 | 384 |
from App import App |
385 | 385 |
|
... | ... | |
449 | 449 |
""" show property name """ |
450 | 450 |
key_item = QTableWidgetItem(prop.DisplayAttribute if prop.DisplayAttribute else prop.Attribute) |
451 | 451 |
key_item.setFlags(Qt.ItemIsEnabled) |
452 |
key_item.setBackground(Qt.lightGray) |
|
452 |
#key_item.setBackground(Qt.lightGray)
|
|
453 | 453 |
key_item.setData(Qt.UserRole, prop) |
454 | 454 |
self.setItem(row, 1, key_item) |
455 | 455 |
|
... | ... | |
503 | 503 |
|
504 | 504 |
""" show property name """ |
505 | 505 |
key_item = QTableWidgetItem(key.DisplayAttribute if key.DisplayAttribute else key.Attribute) |
506 |
key_item.setBackground(Qt.lightGray) |
|
506 |
#key_item.setBackground(Qt.lightGray)
|
|
507 | 507 |
key_item.setData(Qt.UserRole, key) |
508 | 508 |
self.setItem(row, 1, key_item) |
509 | 509 |
|
... | ... | |
543 | 543 |
for connector in item.connectors: |
544 | 544 |
connector_item = QTableWidgetItem('CONN{}'.format(count)) |
545 | 545 |
connector_item.setFlags(Qt.ItemIsEnabled) |
546 |
connector_item.setBackground(Qt.lightGray) |
|
546 |
#connector_item.setBackground(Qt.lightGray)
|
|
547 | 547 |
self.setItem(row, 1, connector_item) |
548 | 548 |
|
549 | 549 |
attr = SymbolAttr() |
... | ... | |
641 | 641 |
pt = self._item.startPoint() |
642 | 642 |
key_item = QTableWidgetItem(self.tr("Start")) |
643 | 643 |
key_item.setFlags(Qt.ItemIsEnabled) |
644 |
key_item.setBackground(Qt.lightGray) |
|
644 |
#key_item.setBackground(Qt.lightGray)
|
|
645 | 645 |
self.setItem(3, 1, key_item) |
646 | 646 |
self.setItem(3, 3, QTableWidgetItem('({},{})'.format(pt[0], pt[1]))) |
647 | 647 |
pt = self._item.endPoint() |
648 | 648 |
key_item = QTableWidgetItem(self.tr("End")) |
649 | 649 |
key_item.setFlags(Qt.ItemIsEnabled) |
650 |
key_item.setBackground(Qt.lightGray) |
|
650 |
#key_item.setBackground(Qt.lightGray)
|
|
651 | 651 |
self.setItem(4, 1, key_item) |
652 | 652 |
self.setItem(4, 3, QTableWidgetItem('({},{})'.format(pt[0], pt[1]))) |
653 | 653 |
|
... | ... | |
718 | 718 |
item = self.item(index, 1) |
719 | 719 |
if item is not None: |
720 | 720 |
item.setFlags(Qt.ItemIsEnabled) |
721 |
item.setBackground(Qt.lightGray) |
|
721 |
#item.setBackground(Qt.lightGray)
|
|
722 | 722 |
|
723 | 723 |
''' |
724 | 724 |
@brief Initialize Line No Contents Cell |
... | ... | |
744 | 744 |
for key in attrs.keys(): |
745 | 745 |
item = QTableWidgetItem(key.DisplayAttribute if key.DisplayAttribute else key.Attribute) |
746 | 746 |
item.setFlags(Qt.ItemIsEnabled) |
747 |
item.setBackground(Qt.lightGray) |
|
747 |
#item.setBackground(Qt.lightGray)
|
|
748 | 748 |
item.tag = key |
749 | 749 |
self.setItem(row, 1, item) |
750 | 750 |
|
... | ... | |
804 | 804 |
self.setRowCount(1) |
805 | 805 |
|
806 | 806 |
lineTypeItem = QTableWidgetItem(self.tr("Line Type")) |
807 |
lineTypeItem.setBackground(Qt.lightGray) |
|
807 |
#lineTypeItem.setBackground(Qt.lightGray)
|
|
808 | 808 |
lineTypeItem.setFlags(Qt.ItemIsEnabled) |
809 | 809 |
self.setItem(0, 1, lineTypeItem) |
810 | 810 |
|
DTI_PID/DTI_PID/OPCRelationDialog.py | ||
---|---|---|
17 | 17 |
def __init__(self, parent): |
18 | 18 |
QDialog.__init__(self, parent) |
19 | 19 |
|
20 |
self._opcs = None |
|
21 |
|
|
20 | 22 |
self.ui = OPCRelation_UI.Ui_OPCRelationDialog() |
21 | 23 |
self.ui.setupUi(self) |
24 |
self.ui.tableWidgetSource.installEventFilter(self) |
|
25 |
self.ui.tableWidgetTarget.itemDoubleClicked.connect(self.on_target_item_double_clicked) |
|
26 |
self.ui.pushButtonAutoFill.clicked.connect(self.on_auto_fill_clicked) |
|
27 |
self.init_table_widget() |
|
28 |
|
|
29 |
def init_table_widget(self): |
|
30 |
""" initialize table widget """ |
|
31 |
from AppDocData import AppDocData |
|
32 |
|
|
33 |
self.ui.tableWidgetSource.setColumnCount(6) |
|
34 |
self.ui.tableWidgetSource.setHorizontalHeaderLabels([self.tr('Drawing'), self.tr('Line No'), self.tr('OPC'), self.tr('Drawing'), self.tr('Line No'), self.tr('OPC')]) |
|
35 |
self.ui.tableWidgetSource.horizontalHeaderItem(0).setSizeHint(QSize(25, 25)) |
|
36 |
self.ui.tableWidgetSource.verticalHeader().hide() |
|
37 |
self.ui.tableWidgetSource.horizontalHeader().setStretchLastSection(True) |
|
38 |
self.ui.tableWidgetSource.currentItemChanged.connect(self.on_source_opc_changed) |
|
39 |
|
|
40 |
app_doc_data = AppDocData.instance() |
|
41 |
self._opcs = app_doc_data.get_opcs() |
|
42 |
self._opc_relations = app_doc_data.get_opc_relations() |
|
43 |
self.ui.tableWidgetSource.setRowCount(len(self._opcs)) |
|
44 |
row = 0 |
|
45 |
for opc in self._opcs: |
|
46 |
item = QTableWidgetItem(opc['Drawing']) |
|
47 |
item.setFlags(Qt.ItemIsEnabled) |
|
48 |
self.ui.tableWidgetSource.setItem(row, 0, item) |
|
49 |
item = QTableWidgetItem(opc['Line No']) |
|
50 |
item.setFlags(Qt.ItemIsEnabled) |
|
51 |
self.ui.tableWidgetSource.setItem(row, 1, item) |
|
52 |
item = QTableWidgetItem(opc['OPC']) |
|
53 |
item.setFlags(Qt.ItemIsEnabled) |
|
54 |
self.ui.tableWidgetSource.setItem(row, 2, item) |
|
55 |
|
|
56 |
matches = [relation for relation in self._opc_relations if relation['From_OPC_UID'] == opc['OPC']] |
|
57 |
item = QTableWidgetItem(matches[0]['To_Drawing'] if matches else '') |
|
58 |
item.setFlags(Qt.ItemIsEnabled) |
|
59 |
self.ui.tableWidgetSource.setItem(row, 3, item) |
|
60 |
item = QTableWidgetItem(matches[0]['To_LineNo'] if matches else '') |
|
61 |
item.setFlags(Qt.ItemIsEnabled) |
|
62 |
self.ui.tableWidgetSource.setItem(row, 4, item) |
|
63 |
item = QTableWidgetItem(matches[0]['To_OPC_UID'] if matches else '') |
|
64 |
item.setFlags(Qt.ItemIsEnabled) |
|
65 |
self.ui.tableWidgetSource.setItem(row, 5, item) |
|
66 |
row += 1 |
|
67 |
|
|
68 |
self.ui.tableWidgetTarget.setColumnCount(3) |
|
69 |
self.ui.tableWidgetTarget.setHorizontalHeaderLabels([self.tr('Drawing'), self.tr('Line No'), self.tr('OPC')]) |
|
70 |
self.ui.tableWidgetTarget.horizontalHeaderItem(0).setSizeHint(QSize(25, 25)) |
|
71 |
self.ui.tableWidgetTarget.verticalHeader().hide() |
|
72 |
self.ui.tableWidgetTarget.horizontalHeader().setStretchLastSection(True) |
|
73 |
|
|
74 |
def on_source_opc_changed(self, current, previous): |
|
75 |
""" list up target opc list """ |
|
76 |
drawing = self.ui.tableWidgetSource.item(current.row(), 0).text() |
|
77 |
line_no = self.ui.tableWidgetSource.item(current.row(), 1).text() |
|
78 |
item = self.ui.tableWidgetSource.item(current.row(), 5) |
|
79 |
target_opc = item.text() if item else None |
|
80 |
self.ui.tableWidgetTarget.setRowCount(0) |
|
81 |
if self._opcs: |
|
82 |
opcs = [opc for opc in self._opcs if opc['Drawing'] != drawing and opc['Line No'] == line_no and opc['OPC'] != target_opc] |
|
83 |
self.ui.tableWidgetTarget.setRowCount(len(opcs)) |
|
84 |
row = 0 |
|
85 |
for opc in opcs: |
|
86 |
item = QTableWidgetItem(opc['Drawing']) |
|
87 |
item.setFlags(Qt.ItemIsEnabled) |
|
88 |
self.ui.tableWidgetTarget.setItem(row, 0, item) |
|
89 |
item = QTableWidgetItem(opc['Line No']) |
|
90 |
item.setFlags(Qt.ItemIsEnabled) |
|
91 |
self.ui.tableWidgetTarget.setItem(row, 1, item) |
|
92 |
item = QTableWidgetItem(opc['OPC']) |
|
93 |
item.setFlags(Qt.ItemIsEnabled) |
|
94 |
self.ui.tableWidgetTarget.setItem(row, 2, item) |
|
95 |
row += 1 |
|
96 |
|
|
97 |
def on_auto_fill_clicked(self): |
|
98 |
""" fill target opc if only one line no exists """ |
|
99 |
for row in range(self.ui.tableWidgetSource.rowCount()): |
|
100 |
drawing = self.ui.tableWidgetSource.item(row, 0).text() |
|
101 |
line_no = self.ui.tableWidgetSource.item(row, 1).text() |
|
102 |
opcs = [opc for opc in self._opcs if opc['Drawing'] != drawing and opc['Line No'] == line_no] |
|
103 |
if not opcs: |
|
104 |
item = self.ui.tableWidgetSource.item(row, 3) |
|
105 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 3, QTableWidgetItem('')) |
|
106 |
item = self.ui.tableWidgetSource.item(row, 4) |
|
107 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 4, QTableWidgetItem('')) |
|
108 |
item = self.ui.tableWidgetSource.item(row, 5) |
|
109 |
item.setText('') if item else self.ui.tableWidgetSource.setItem(row, 5, QTableWidgetItem('')) |
|
110 |
elif len(opcs) == 1: |
|
111 |
item = QTableWidgetItem(opcs[0]['Drawing']) |
|
112 |
item.setFlags(Qt.ItemIsEnabled) |
|
113 |
self.ui.tableWidgetSource.setItem(row, 3, item) |
|
114 |
item = QTableWidgetItem(opcs[0]['Line No']) |
|
115 |
item.setFlags(Qt.ItemIsEnabled) |
|
116 |
self.ui.tableWidgetSource.setItem(row, 4, item) |
|
117 |
item = QTableWidgetItem(opcs[0]['OPC']) |
|
118 |
item.setFlags(Qt.ItemIsEnabled) |
|
119 |
self.ui.tableWidgetSource.setItem(row, 5, item) |
|
120 |
|
|
121 |
def on_target_item_double_clicked(self, item): |
|
122 |
""" assign target opc with double clicked item """ |
|
123 |
current = self.tableWidgetSource.currentItem() |
|
124 |
if current: |
|
125 |
self.tableWidgetSource.item(current.row(), 3).setText(self.tableWidgetTarget.item(item.row(), 0).text()) |
|
126 |
self.tableWidgetSource.item(current.row(), 4).setText(self.tableWidgetTarget.item(item.row(), 1).text()) |
|
127 |
self.tableWidgetSource.item(current.row(), 5).setText(self.tableWidgetTarget.item(item.row(), 2).text()) |
|
128 |
|
|
129 |
def eventFilter(self, source, event): |
|
130 |
""" display mouse position of graphics view """ |
|
131 |
if (event.type() == QKeyEvent.KeyPress): |
|
132 |
pass |
|
133 |
return QDialog.eventFilter(self, source, event) |
|
134 |
|
|
135 |
def keyPressEvent(self, e): |
|
136 |
""" clear target opc information when user press delete key """ |
|
137 |
try: |
|
138 |
if (e.key() == Qt.Key_Delete) and self.ui.tableWidgetSource.hasFocus(): |
|
139 |
current = self.ui.tableWidgetSource.currentItem() |
|
140 |
if current: |
|
141 |
self.ui.tableWidgetSource.item(current.row(), 3).setText('') |
|
142 |
self.ui.tableWidgetSource.item(current.row(), 4).setText('') |
|
143 |
self.ui.tableWidgetSource.item(current.row(), 5).setText('') |
|
144 |
|
|
145 |
except Exception as ex: |
|
146 |
from App import App |
|
147 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
148 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
22 | 149 |
|
23 | 150 |
def accept(self): |
24 | 151 |
""" save sql information to database """ |
152 |
from AppDocData import AppDocData |
|
153 |
|
|
25 | 154 |
try: |
155 |
QApplication.setOverrideCursor(Qt.WaitCursor) |
|
156 |
|
|
157 |
app_doc_data = AppDocData.instance() |
|
158 |
|
|
159 |
opcs = [] |
|
160 |
for row in range(self.ui.tableWidgetSource.rowCount()): |
|
161 |
from_drawing = self.ui.tableWidgetSource.item(row, 0).text() |
|
162 |
from_line_no = self.ui.tableWidgetSource.item(row, 1).text() |
|
163 |
from_opc = self.ui.tableWidgetSource.item(row, 2).text() |
|
164 |
to_drawing = self.ui.tableWidgetSource.item(row, 3).text() |
|
165 |
to_line_no = self.ui.tableWidgetSource.item(row, 4).text() |
|
166 |
to_opc = self.ui.tableWidgetSource.item(row, 5).text() |
|
167 |
opcs.append([from_drawing, from_line_no, from_opc, to_drawing, to_line_no, to_opc]) |
|
168 |
|
|
169 |
app_doc_data.save_opc_relations(opcs) |
|
170 |
|
|
26 | 171 |
QDialog.accept(self) |
27 | 172 |
except Exception as ex: |
28 | 173 |
from App import App |
29 | 174 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
30 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
175 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
176 |
finally: |
|
177 |
QApplication.restoreOverrideCursor() |
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql | ||
---|---|---|
4094 | 4094 |
); |
4095 | 4095 |
|
4096 | 4096 |
CREATE TABLE OPCRelations ( |
4097 |
UID VARCHAR (37) PRIMARY KEY |
|
4098 |
NOT NULL, |
|
4099 | 4097 |
From_Drawings_UID VARCHAR (37) REFERENCES Drawings (UID), |
4100 | 4098 |
From_LineNo_UID VARCHAR (37) REFERENCES Components (UID), |
4101 |
From_OPC_UID VARCHAR (37) REFERENCES Components (UID), |
|
4099 |
From_OPC_UID VARCHAR (37) REFERENCES Components (UID) PRIMARY KEY,
|
|
4102 | 4100 |
To_Drawings_UID VARCHAR (37) REFERENCES Drawings (UID), |
4103 | 4101 |
To_LineNo_UID VARCHAR (37) REFERENCES Components (UID), |
4104 | 4102 |
To_OPC_UID VARCHAR (37) REFERENCES Components (UID) |
DTI_PID/DTI_PID/SymbolPropertyTableWidget.py | ||
---|---|---|
14 | 14 |
import symbol |
15 | 15 |
|
16 | 16 |
class QSymbolPropertyTableWidget(QTableWidget): |
17 |
""" |
|
18 |
This is symbol property tablewidget |
|
19 |
""" |
|
17 |
""" This is symbol property tablewidget """ |
|
20 | 18 |
|
21 | 19 |
def __init__(self): |
22 | 20 |
QTableWidget.__init__(self) |
... | ... | |
33 | 31 |
|
34 | 32 |
def initPropertyTableWidget(self): |
35 | 33 |
self.setColumnCount(2) |
36 |
self.setHorizontalHeaderLabels(['Name', 'Value'])
|
|
34 |
self.setHorizontalHeaderLabels([self.tr('Name'), self.tr('Value')])
|
|
37 | 35 |
self.horizontalHeaderItem(0).setSizeHint(QSize(25, 25)) |
38 | 36 |
self.setRowCount(12) |
39 | 37 |
self.verticalHeader().hide() |
... | ... | |
129 | 127 |
item12.setFlags(Qt.ItemIsEnabled) |
130 | 128 |
self.setItem(11, 0, item12) |
131 | 129 |
|
132 |
for index in range(self.rowCount()): |
|
133 |
self.item(index, 0).setBackground(QColor(220, 220, 220)) |
|
134 |
|
|
135 | 130 |
def retranslateUi(self): |
136 |
""" |
|
137 |
retranslate ui |
|
138 |
""" |
|
131 |
""" retranslate ui """ |
|
139 | 132 |
self.item(0,0).setText(self.tr("Symbol Name")) |
140 | 133 |
self.item(1,0).setText(self.tr("Threshold(%)")) |
141 | 134 |
self.item(2,0).setText(self.tr("Min Feature Count")) |
DTI_PID/DTI_PID/UI/MainWindow.ui | ||
---|---|---|
10 | 10 |
<height>888</height> |
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 |
<property name="baseSize"> |
|
14 |
<size> |
|
15 |
<width>0</width> |
|
16 |
<height>300</height> |
|
17 |
</size> |
|
18 |
</property> |
|
13 | 19 |
<property name="font"> |
14 | 20 |
<font> |
15 | 21 |
<family>맑은 고딕</family> |
... | ... | |
380 | 386 |
<addaction name="separator"/> |
381 | 387 |
</widget> |
382 | 388 |
<widget class="QDockWidget" name="dockWidgetOutputWnd"> |
389 |
<property name="minimumSize"> |
|
390 |
<size> |
|
391 |
<width>145</width> |
|
392 |
<height>202</height> |
|
393 |
</size> |
|
394 |
</property> |
|
395 |
<property name="baseSize"> |
|
396 |
<size> |
|
397 |
<width>0</width> |
|
398 |
<height>150</height> |
|
399 |
</size> |
|
400 |
</property> |
|
383 | 401 |
<property name="features"> |
384 | 402 |
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set> |
385 | 403 |
</property> |
DTI_PID/DTI_PID/UI/OPCRelation.ui | ||
---|---|---|
6 | 6 |
<rect> |
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 |
<width>766</width>
|
|
10 |
<height>410</height>
|
|
9 |
<width>1076</width>
|
|
10 |
<height>680</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="windowTitle"> |
14 | 14 |
<string>OPC Relation</string> |
15 | 15 |
</property> |
16 | 16 |
<layout class="QGridLayout" name="gridLayout"> |
17 |
<item row="2" column="0">
|
|
18 |
<widget class="QDialogButtonBox" name="buttonBox">
|
|
17 |
<item row="1" column="0">
|
|
18 |
<widget class="QSplitter" name="splitter">
|
|
19 | 19 |
<property name="orientation"> |
20 | 20 |
<enum>Qt::Horizontal</enum> |
21 | 21 |
</property> |
22 |
<property name="standardButtons"> |
|
23 |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|
24 |
</property> |
|
22 |
<widget class="QTableWidget" name="tableWidgetSource"> |
|
23 |
<property name="selectionMode"> |
|
24 |
<enum>QAbstractItemView::SingleSelection</enum> |
|
25 |
</property> |
|
26 |
<property name="selectionBehavior"> |
|
27 |
<enum>QAbstractItemView::SelectRows</enum> |
|
28 |
</property> |
|
29 |
<property name="sortingEnabled"> |
|
30 |
<bool>true</bool> |
|
31 |
</property> |
|
32 |
<attribute name="horizontalHeaderShowSortIndicator" stdset="0"> |
|
33 |
<bool>true</bool> |
|
34 |
</attribute> |
|
35 |
<attribute name="horizontalHeaderStretchLastSection"> |
|
36 |
<bool>true</bool> |
|
37 |
</attribute> |
|
38 |
</widget> |
|
39 |
<widget class="QTableWidget" name="tableWidgetTarget"> |
|
40 |
<property name="maximumSize"> |
|
41 |
<size> |
|
42 |
<width>400</width> |
|
43 |
<height>16777215</height> |
|
44 |
</size> |
|
45 |
</property> |
|
46 |
<property name="baseSize"> |
|
47 |
<size> |
|
48 |
<width>400</width> |
|
49 |
<height>0</height> |
|
50 |
</size> |
|
51 |
</property> |
|
52 |
<property name="sortingEnabled"> |
|
53 |
<bool>true</bool> |
|
54 |
</property> |
|
55 |
</widget> |
|
25 | 56 |
</widget> |
26 | 57 |
</item> |
27 | 58 |
<item row="0" column="0"> |
28 |
<widget class="QSplitter" name="splitter"> |
|
59 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
|
60 |
<property name="sizeConstraint"> |
|
61 |
<enum>QLayout::SetFixedSize</enum> |
|
62 |
</property> |
|
63 |
<item> |
|
64 |
<widget class="QPushButton" name="pushButtonAutoFill"> |
|
65 |
<property name="maximumSize"> |
|
66 |
<size> |
|
67 |
<width>16777215</width> |
|
68 |
<height>20</height> |
|
69 |
</size> |
|
70 |
</property> |
|
71 |
<property name="text"> |
|
72 |
<string>Auto Fill</string> |
|
73 |
</property> |
|
74 |
</widget> |
|
75 |
</item> |
|
76 |
<item> |
|
77 |
<spacer name="horizontalSpacer"> |
|
78 |
<property name="orientation"> |
|
79 |
<enum>Qt::Horizontal</enum> |
|
80 |
</property> |
|
81 |
<property name="sizeHint" stdset="0"> |
|
82 |
<size> |
|
83 |
<width>40</width> |
|
84 |
<height>20</height> |
|
85 |
</size> |
|
86 |
</property> |
|
87 |
</spacer> |
|
88 |
</item> |
|
89 |
</layout> |
|
90 |
</item> |
|
91 |
<item row="3" column="0"> |
|
92 |
<widget class="QDialogButtonBox" name="buttonBox"> |
|
29 | 93 |
<property name="orientation"> |
30 | 94 |
<enum>Qt::Horizontal</enum> |
31 | 95 |
</property> |
32 |
<widget class="QTableWidget" name="tableWidgetSource"/> |
|
33 |
<widget class="QTableWidget" name="tableWidgetTarget"/> |
|
96 |
<property name="standardButtons"> |
|
97 |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|
98 |
</property> |
|
34 | 99 |
</widget> |
35 | 100 |
</item> |
36 | 101 |
</layout> |
DTI_PID/DTI_PID/UI/OPCRelation_UI.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 |
# Form implementation generated from reading ui file '.\ui\OPCRelation.ui'
|
|
3 |
# Form implementation generated from reading ui file '.\UI\OPCRelation.ui'
|
|
4 | 4 |
# |
5 | 5 |
# Created by: PyQt5 UI code generator 5.13.0 |
6 | 6 |
# |
... | ... | |
13 | 13 |
class Ui_OPCRelationDialog(object): |
14 | 14 |
def setupUi(self, OPCRelationDialog): |
15 | 15 |
OPCRelationDialog.setObjectName("OPCRelationDialog") |
16 |
OPCRelationDialog.resize(766, 410)
|
|
16 |
OPCRelationDialog.resize(1076, 680)
|
|
17 | 17 |
self.gridLayout = QtWidgets.QGridLayout(OPCRelationDialog) |
18 | 18 |
self.gridLayout.setObjectName("gridLayout") |
19 |
self.buttonBox = QtWidgets.QDialogButtonBox(OPCRelationDialog) |
|
20 |
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) |
|
21 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) |
|
22 |
self.buttonBox.setObjectName("buttonBox") |
|
23 |
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1) |
|
24 | 19 |
self.splitter = QtWidgets.QSplitter(OPCRelationDialog) |
25 | 20 |
self.splitter.setOrientation(QtCore.Qt.Horizontal) |
26 | 21 |
self.splitter.setObjectName("splitter") |
27 | 22 |
self.tableWidgetSource = QtWidgets.QTableWidget(self.splitter) |
23 |
self.tableWidgetSource.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) |
|
24 |
self.tableWidgetSource.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) |
|
28 | 25 |
self.tableWidgetSource.setObjectName("tableWidgetSource") |
29 | 26 |
self.tableWidgetSource.setColumnCount(0) |
30 | 27 |
self.tableWidgetSource.setRowCount(0) |
28 |
self.tableWidgetSource.horizontalHeader().setSortIndicatorShown(True) |
|
29 |
self.tableWidgetSource.horizontalHeader().setStretchLastSection(True) |
|
31 | 30 |
self.tableWidgetTarget = QtWidgets.QTableWidget(self.splitter) |
31 |
self.tableWidgetTarget.setMaximumSize(QtCore.QSize(400, 16777215)) |
|
32 |
self.tableWidgetTarget.setBaseSize(QtCore.QSize(400, 0)) |
|
32 | 33 |
self.tableWidgetTarget.setObjectName("tableWidgetTarget") |
33 | 34 |
self.tableWidgetTarget.setColumnCount(0) |
34 | 35 |
self.tableWidgetTarget.setRowCount(0) |
35 |
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) |
|
36 |
self.gridLayout.addWidget(self.splitter, 1, 0, 1, 1) |
|
37 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
|
38 |
self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) |
|
39 |
self.horizontalLayout.setObjectName("horizontalLayout") |
|
40 |
self.pushButtonAutoFill = QtWidgets.QPushButton(OPCRelationDialog) |
|
41 |
self.pushButtonAutoFill.setMaximumSize(QtCore.QSize(16777215, 20)) |
|
42 |
self.pushButtonAutoFill.setObjectName("pushButtonAutoFill") |
|
43 |
self.horizontalLayout.addWidget(self.pushButtonAutoFill) |
|
44 |
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) |
|
45 |
self.horizontalLayout.addItem(spacerItem) |
|
46 |
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) |
|
47 |
self.buttonBox = QtWidgets.QDialogButtonBox(OPCRelationDialog) |
|
48 |
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) |
|
49 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) |
|
50 |
self.buttonBox.setObjectName("buttonBox") |
|
51 |
self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 1) |
|
36 | 52 |
|
37 | 53 |
self.retranslateUi(OPCRelationDialog) |
38 | 54 |
self.buttonBox.accepted.connect(OPCRelationDialog.accept) |
... | ... | |
42 | 58 |
def retranslateUi(self, OPCRelationDialog): |
43 | 59 |
_translate = QtCore.QCoreApplication.translate |
44 | 60 |
OPCRelationDialog.setWindowTitle(_translate("OPCRelationDialog", "OPC Relation")) |
61 |
self.tableWidgetSource.setSortingEnabled(True) |
|
62 |
self.tableWidgetTarget.setSortingEnabled(True) |
|
63 |
self.pushButtonAutoFill.setText(_translate("OPCRelationDialog", "Auto Fill")) |
내보내기 Unified diff