"Fossies" - the Fresh Open Source Software Archive

Member "asymptote-2.60/GUI/Widg_editBezier.py" (6 Nov 2019, 1665 Bytes) of package /linux/misc/asymptote-2.60.src.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "Widg_editBezier.py" see the Fossies "Dox" file reference documentation.

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