개정판 d2f7bd48
Connect removed signal of text item to result tree widget
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
475 | 475 |
item.angle = angle |
476 | 476 |
item.setPlainText(text) |
477 | 477 |
item.setDefaultTextColor(Qt.blue) |
478 |
item.removed.connect(self.resultTreeWidget.itemRemoved) |
|
478 | 479 |
item.addTextItemToScene(self.graphicsView.scene) |
479 |
#sx = 1 |
|
480 |
#sy = 1 |
|
481 |
#rect = None |
|
482 |
#transform = QTransform() |
|
483 |
#if (1.57 == angle) or (4.71 == angle): |
|
484 |
# font = QFont('Arial', width*1.2) |
|
485 |
# item.setFont(font) |
|
486 |
# rect = item.boundingRect() |
|
487 |
# sx = width/rect.height() |
|
488 |
# sy = height/rect.width() |
|
489 |
|
|
490 |
# transform.translate(x + width*0.5,y + height*0.5) |
|
491 |
# transform.scale(1, sy) |
|
492 |
# transform.rotateRadians(-angle) |
|
493 |
# transform.translate(-rect.width()*0.5, -rect.height()*0.5) |
|
494 |
#elif 3.14 == angle: |
|
495 |
# font = QFont('Arial', height*1.2) |
|
496 |
# item.setFont(font) |
|
497 |
# rect = item.boundingRect() |
|
498 |
# sx = width/rect.width() |
|
499 |
# sy = height/rect.height() |
|
500 |
|
|
501 |
# transform.translate(x, y - round((rect.height()-height)*0.5)) |
|
502 |
# transform.scale(sx, 1) |
|
503 |
# transform.rotateRadians(-angle) |
|
504 |
# transform.translate(-width*0.5, -height*0.5) |
|
505 |
#else: |
|
506 |
# font = QFont('Arial', height*1.2) |
|
507 |
# item.setFont(font) |
|
508 |
# rect = item.boundingRect() |
|
509 |
# sx = width/rect.width() |
|
510 |
# sy = height/rect.height() |
|
511 |
|
|
512 |
# transform.translate(x, y - round((rect.height()-height)*0.5)) |
|
513 |
# transform.scale(sx, 1) |
|
514 |
#item.setTransform(transform) |
|
515 |
##item.setTextWidth(width) |
|
516 |
|
|
517 |
#self.graphicsView.scene.addItem(item) |
|
518 | 480 |
# up to here |
519 | 481 |
except Exception as ex: |
520 | 482 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
DTI_PID/DTI_PID/QResultTreeWidget.py | ||
---|---|---|
185 | 185 |
@author humkyung |
186 | 186 |
@date 2018.04.23 |
187 | 187 |
''' |
188 |
@pyqtSlot(SymbolSvgItem)
|
|
188 |
@pyqtSlot(QGraphicsItem)
|
|
189 | 189 |
def itemRemoved(self, item): |
190 | 190 |
foundItem = self.findItemByData(item) |
191 | 191 |
if foundItem is not None: |
DTI_PID/DTI_PID/Shapes/QEngineeringTextItem.py | ||
---|---|---|
18 | 18 |
from AppDocData import AppDocData |
19 | 19 |
|
20 | 20 |
class QEngineeringTextItem(QGraphicsTextItem): |
21 |
removed = pyqtSignal(QGraphicsTextItem)
|
|
21 |
removed = pyqtSignal(QGraphicsItem) |
|
22 | 22 |
|
23 | 23 |
def __init__(self, parent=None): |
24 | 24 |
import uuid |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
11 | 11 |
|
12 | 12 |
class SymbolSvgItem(QGraphicsSvgItem): |
13 | 13 |
clicked = pyqtSignal(QGraphicsSvgItem) |
14 |
removed = pyqtSignal(QGraphicsSvgItem)
|
|
14 |
removed = pyqtSignal(QGraphicsItem) |
|
15 | 15 |
|
16 | 16 |
''' |
17 | 17 |
@history 18.04.11 Jeongwoo Add Variable (Name, Type) |
... | ... | |
128 | 128 |
self.scene().removeItem(self) |
129 | 129 |
|
130 | 130 |
''' |
131 |
@brief generate xml code |
|
132 |
@author humkyung |
|
133 |
@date 2018.04.23 |
|
131 |
@brief generate xml code |
|
132 |
@author humkyung |
|
133 |
@date 2018.04.23 |
|
134 |
@history humkyung 2018.04.25 add angle xml node |
|
134 | 135 |
''' |
135 | 136 |
def toXml(self): |
136 | 137 |
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree |
... | ... | |
150 | 151 |
sizeNode = Element('SIZE') |
151 | 152 |
sizeNode.text = '{},{}'.format(rect.width(), rect.height()) |
152 | 153 |
|
154 |
angleNode = Element('ANGLE') |
|
155 |
angleNode.text = str(self.angle) |
|
156 |
|
|
153 | 157 |
node.append(uidNode) |
154 | 158 |
node.append(nameNode) |
155 | 159 |
node.append(locNode) |
156 | 160 |
node.append(sizeNode) |
161 |
node.append(angleNode) |
|
157 | 162 |
except Exception as ex: |
158 | 163 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
159 | 164 |
|
내보내기 Unified diff