blob: 161715e0fc00e51209b69336a785887dac9b0d6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/usr/bin/env python3
from pyUIClass.widg_editBezier import Ui_Form
import PyQt5.QtWidgets as QtWidgets
import PyQt5.QtCore as QtCore
class LockMode:
noLock = 0
angleLock = 1
angleAndScaleLock = 2
class Widg_editBezier(QtWidgets.QWidget):
def __init__(self, info: dict, enableCurveFeatures: bool=True):
super().__init__()
self.ui = Ui_Form()
self.ui.setupUi(self)
self.info = info
self.ui.chkRecompute.setChecked(self.info['autoRecompute'])
self.ui.cmbLockMode.setCurrentIndex(self.info['editBezierlockMode'])
self.ui.cmbLockMode.currentIndexChanged[int].connect(self.cmbLockIndexChange)
self.ui.chkRecompute.stateChanged.connect(self.chkRecomputeChanged)
self.disableOnAutoRecompute = {self.ui.cmbLockMode, self.ui.btnForceRecompute}
self.curveBtnsOnly = {self.ui.cmbLockMode, self.ui.btnForceRecompute, self.ui.chkRecompute}
for elem in self.curveBtnsOnly:
elem.setEnabled(enableCurveFeatures)
@property
def autoRecompute(self) -> bool:
return self.ui.chkRecompute.isChecked()
@property
def lockMode(self) -> int:
return self.ui.cmbLockMode.currentIndex()
@QtCore.pyqtSlot(int)
def cmbLockIndexChange(self, index: int):
self.info['editBezierlockMode'] = index
@QtCore.pyqtSlot(int)
def chkRecomputeChanged(self, checked: int):
isChecked = (checked == 2)
for obj in self.disableOnAutoRecompute:
obj.setEnabled(not checked)
self.info['autoRecompute'] = checked
if isChecked:
self.ui.btnForceRecompute.clicked.emit()
|