개정판 1d0e0e1c
issue #1655: callout 항목의 폰트 크기 및 설정 오류
Change-Id: Ibf6cd79a2ab9386ca14a696a14f3b38150451cdc
HYTOS/HYTOS/Shapes/EngineeringCalloutTextItem.py | ||
---|---|---|
136 | 136 |
from EngineeringStreamNoTextItem import QEngineeringStreamNoTextItem |
137 | 137 |
|
138 | 138 |
app_doc_data = AppDocData.instance() |
139 |
font_size = None |
|
140 | 139 |
configs = app_doc_data.getAppConfigs('option', 'CalloutFontSize') |
141 | 140 |
if configs and len(configs) == 1: |
142 | 141 |
_font = self.font() |
... | ... | |
147 | 146 |
if configs and len(configs) == 1: |
148 | 147 |
self.setDefaultTextColor(QColor(configs[0].value)) |
149 | 148 |
|
150 |
''' |
|
151 |
@brief override paint(draw connection points) |
|
152 |
@author humkyung |
|
153 |
@date 2018.07.08 |
|
154 |
''' |
|
149 |
'''setHtml해줘야 폰트와 색상이 적용됨''' |
|
150 |
self.setHtml(self.toPlainText().replace('\n', '<br>')) |
|
155 | 151 |
|
156 | 152 |
def paint(self, painter, options=None, widget=None): |
153 |
"""override paint""" |
|
157 | 154 |
super(QEngineeringCalloutTextItem, self).paint(painter, options, widget) |
158 | 155 |
|
159 | 156 |
if self.isSelected(): |
... | ... | |
195 | 192 |
pt = QPointF(float(x), float(y)) |
196 | 193 |
item = PlaceCalloutCommand.create_item(pt) |
197 | 194 |
item.setHtml(tag_no) |
195 |
'''force to call to apply font and text color''' |
|
196 |
item.update_label_contents() |
|
198 | 197 |
except Exception as ex: |
199 | 198 |
from App import App |
200 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
201 |
sys.exc_info()[-1].tb_lineno)
|
|
199 |
message = f'error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:' \
|
|
200 |
f'{sys.exc_info()[-1].tb_lineno}'
|
|
202 | 201 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
203 | 202 |
|
204 | 203 |
return item |
... | ... | |
233 | 232 |
|
234 | 233 |
return res |
235 | 234 |
|
235 |
def contextMenuEvent(self, event: 'QGraphicsSceneContextMenuEvent') -> None: |
|
236 |
"""ignore context menu""" |
|
237 |
event.ignore() |
|
238 |
|
|
236 | 239 |
''' |
237 | 240 |
@brief The class transfer pyqtSignal Event. Cause Subclass of QGraphicsRectItem can't use pyqtSignal |
238 | 241 |
@author Jeongwoo |
내보내기 Unified diff