개정판 a10d7f23
issue #366: paint() 함수가 반복적으로 호출되는 현상 수정
Change-Id: I7f9a95fb4b6e246b256392dcd8b335b5c9ccf981
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
1452 | 1452 |
stroke.setWidth(15) |
1453 | 1453 |
return stroke.createStroke(path) |
1454 | 1454 |
|
1455 |
def paint(self, painter, options=None, widget=None):
|
|
1456 |
"""override paint method"""
|
|
1455 |
def paint(self, painter, option, widget):
|
|
1456 |
# override paint method
|
|
1457 | 1457 |
color = self.getColor() |
1458 | 1458 |
self.setColor(color) |
1459 | 1459 |
|
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
940 | 940 |
sys.exc_info()[-1].tb_lineno) |
941 | 941 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
942 | 942 |
|
943 |
''' |
|
944 |
@brief Set Color. Override QEngineeringAbstractItem's |
|
945 |
@author Jeongwoo |
|
946 |
@date 2018.05.11 |
|
947 |
@history humkyung 2018.05.13 update after change color |
|
948 |
''' |
|
949 |
|
|
950 | 943 |
def setColor(self, color): |
951 |
if QColor.isValidColor(color): |
|
944 |
"""change text color with given color""" |
|
945 |
if QColor.isValidColor(color) and color.upper() != self.defaultTextColor().name().upper(): |
|
952 | 946 |
c = QColor() |
953 | 947 |
c.setNamedColor(color) |
954 | 948 |
self.setDefaultTextColor(c) |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
109 | 109 |
except Exception as ex: |
110 | 110 |
from App import App |
111 | 111 |
|
112 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
113 |
sys.exc_info()[-1].tb_lineno)
|
|
112 |
message = f'error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:' \
|
|
113 |
f'{sys.exc_info()[-1].tb_lineno}'
|
|
114 | 114 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
115 | 115 |
|
116 | 116 |
self.setZValue(SymbolSvgItem.ZVALUE) |
... | ... | |
119 | 119 |
configs = app_doc_data.getConfigs('Symbol Style', 'Opacity') |
120 | 120 |
self.setOpacity(float(configs[0].value) / 100 if configs else 0.5) |
121 | 121 |
|
122 |
self.__color = None # svg item's color |
|
123 |
|
|
122 | 124 |
@property |
123 | 125 |
def converted(self): |
124 | 126 |
"""return whethere symbol is converted or not""" |
... | ... | |
1726 | 1728 |
|
1727 | 1729 |
return item |
1728 | 1730 |
|
1729 |
''' |
|
1730 |
@brief change svg's color |
|
1731 |
@author humkyung |
|
1732 |
@date 2018.05.10 |
|
1733 |
@history 2018.05.11 Jeongwoo Override QEngineeringAbstractItem's |
|
1734 |
humkyung 2018.05.13 update after change color |
|
1735 |
''' |
|
1736 |
|
|
1737 | 1731 |
def setColor(self, color): |
1738 |
if self._document: |
|
1732 |
"""change svg item's color""" |
|
1733 |
if self._document and color != self.__color: |
|
1739 | 1734 |
self.changeAttributes('fill', color) |
1740 | 1735 |
self.changeAttributes('stroke', color) |
1741 | 1736 |
self.renderer().load(self._document.toByteArray()) |
1737 |
self.__color = color |
|
1742 | 1738 |
self.update() |
1743 | 1739 |
|
1744 | 1740 |
''' |
내보내기 Unified diff