개정판 a58c59f7
issue #1124: text area can be changed
Change-Id: I1f511444fe59bd0d25d8829ce354f7ee1ece1e59
DTI_PID/DTI_PID/Area.py | ||
---|---|---|
6 | 6 |
import os |
7 | 7 |
|
8 | 8 |
class Area: |
9 |
def __init__(self, name): |
|
9 |
def __init__(self, name, uid=None):
|
|
10 | 10 |
self._name = name |
11 | 11 |
self._ocr_data = 'eng' # default value |
12 |
if uid: |
|
13 |
self.uid = uid |
|
14 |
else: |
|
15 |
self.uid = name |
|
12 | 16 |
self.x = None |
13 | 17 |
self.y = None |
14 | 18 |
self.width = None |
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
371 | 371 |
self.setRowCount(1) |
372 | 372 |
self.setItem(0, 1, QTableWidgetItem(self.tr("UID"))) |
373 | 373 |
else: |
374 |
from Area import Area |
|
374 | 375 |
app_doc_data = AppDocData.instance() |
375 | 376 |
area_list = app_doc_data.getAreaList() |
376 | 377 |
title_area_list = app_doc_data.getTitleBlockProperties() |
... | ... | |
385 | 386 |
self._areaComboBox = QComboBox(self) |
386 | 387 |
self._areaComboBox.tag = widgetItem |
387 | 388 |
self._areaComboBox.addItem('None') |
389 |
title_list = [] |
|
388 | 390 |
for title_area in title_area_list: |
389 |
self._areaComboBox.addItem(title_area[1]) |
|
390 |
for area in area_list: |
|
391 |
area = Area(title_area[1], title_area[0]) |
|
392 |
title_list.append(area) |
|
393 |
for area in area_list + title_list: |
|
391 | 394 |
self._areaComboBox.addItem(area.name) |
392 | 395 |
self.setCellWidget(4, 3, self._areaComboBox) |
393 |
self._areaComboBox.setCurrentText(item.area) |
|
396 |
name = [area.name for area in area_list + title_list if item.area == area.uid] |
|
397 |
self._areaComboBox.setCurrentText(name[0] if name else 'None') |
|
394 | 398 |
self._areaComboBox.currentIndexChanged.connect(self.onAreaChanged) |
395 | 399 |
|
396 | 400 |
for index in range(self.rowCount()): |
... | ... | |
416 | 420 |
self.changeConnectedLineType(data, lineType) |
417 | 421 |
|
418 | 422 |
def onAreaChanged(self, param): |
419 |
area = self._areaComboBox.itemText(param) |
|
423 |
from Area import Area |
|
424 |
app_doc_data = AppDocData.instance() |
|
425 |
area_list = app_doc_data.getAreaList() |
|
426 |
title_area_list = app_doc_data.getTitleBlockProperties() |
|
427 |
title_list = [] |
|
428 |
for title_area in title_area_list: |
|
429 |
area = Area(title_area[1], title_area[0]) |
|
430 |
title_list.append(area) |
|
431 |
|
|
432 |
name = self._areaComboBox.itemText(param) |
|
433 |
name = [area.uid for area in area_list + title_list if name == area.name] |
|
420 | 434 |
data = self._areaComboBox.tag.data(Qt.UserRole) |
421 | 435 |
if type(data) is QEngineeringTextItem: |
422 |
data.area = area
|
|
436 |
data.area = name[0] if name else 'None'
|
|
423 | 437 |
|
424 | 438 |
def changeConnectedLineType(self, line, lineType): |
425 | 439 |
line.lineType = lineType |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1144 | 1144 |
area_list = app_doc_data.getAreaList() |
1145 | 1145 |
title_area_list = app_doc_data.getTitleBlockProperties() |
1146 | 1146 |
for title_area in title_area_list: |
1147 |
area = Area(title_area[1])
|
|
1147 |
area = Area(title_area[0])
|
|
1148 | 1148 |
area.parse(title_area[2]) |
1149 | 1149 |
area_list.append(area) |
1150 | 1150 |
for area in area_list: |
내보내기 Unified diff