개정판 b609078e
add line freeze context
Change-Id: I42b16ff5f97989125ac661d15400f01da831c146
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
2095 | 2095 |
showAction.triggered.connect(self.contextShow) |
2096 | 2096 |
menu.addAction(showAction) |
2097 | 2097 | |
2098 |
mergeAction = QAction('Merge(M)', None) |
|
2099 |
mergeAction.triggered.connect(self.contextMerge) |
|
2100 |
menu.addAction(mergeAction) |
|
2098 |
isFreezed = False |
|
2099 |
for prop, value in self.properties.items(): |
|
2100 |
if prop.Attribute == 'Freeze': |
|
2101 |
if value and str(value) == 'True': |
|
2102 |
isFreezed = True |
|
2103 |
break |
|
2104 | ||
2105 |
freezeAction = QAction('Set Freeze', None) if not isFreezed else QAction('Unset Freeze', None) |
|
2106 |
freezeAction.triggered.connect(self.contextFreeze) |
|
2107 |
menu.addAction(freezeAction) |
|
2108 | ||
2109 |
if len(items) > 1: |
|
2110 |
mergeAction = QAction('Merge(M)', None) |
|
2111 |
mergeAction.triggered.connect(self.contextMerge) |
|
2112 |
menu.addAction(mergeAction) |
|
2101 | 2113 | |
2102 | 2114 |
reverseAction = QAction('Reverse(C)', None) |
2103 | 2115 |
reverseAction.triggered.connect(self.contextReverse) |
... | ... | |
2143 | 2155 |
if type(self.owner) is QEngineeringLineNoTextItem: |
2144 | 2156 |
self.owner.contextHighlight(self.owner) |
2145 | 2157 | |
2158 |
def contextFreeze(self): |
|
2159 |
from App import App |
|
2160 | ||
2161 |
isFreezed = False |
|
2162 |
for prop, value in self.properties.items(): |
|
2163 |
if prop.Attribute == 'Freeze': |
|
2164 |
if value and str(value) == 'True': |
|
2165 |
isFreezed = True |
|
2166 |
break |
|
2167 | ||
2168 |
scene = self.scene() |
|
2169 |
if scene: |
|
2170 |
lineItems = [symbol for symbol in scene.selectedItems() if type(symbol) is QEngineeringLineItem] |
|
2171 | ||
2172 |
for line in lineItems: |
|
2173 |
for prop, value in line.properties.items(): |
|
2174 |
if prop.Attribute == 'Freeze': |
|
2175 |
line.set_property(prop.Attribute, not isFreezed) |
|
2176 | ||
2177 |
App.mainWnd().resultPropertyTableWidget.onSuccessSelectAttribute(self) |
|
2178 | ||
2146 | 2179 |
def contextDelete(self): |
2147 | 2180 |
event = QKeyEvent(QEvent.KeyPress, Qt.Key_Delete, Qt.NoModifier) |
2148 | 2181 |
self.scene().keyPressEvent(event) |
내보내기 Unified diff