| @@ -20,8 +20,7 @@ | |||||
| # Imports (Global) | # Imports (Global) | ||||
| from PyQt4.QtCore import pyqtSlot, Qt, QTimer, SIGNAL, SLOT | from PyQt4.QtCore import pyqtSlot, Qt, QTimer, SIGNAL, SLOT | ||||
| from PyQt4.QtGui import QAbstractSpinBox, QComboBox, QCursor, QDialog, QMenu, QProgressBar | |||||
| #from PyQt4.QtGui import QStyleFactory | |||||
| from PyQt4.QtGui import QAbstractSpinBox, QApplication, QComboBox, QCursor, QDialog, QMenu, QProgressBar | |||||
| from math import isnan | from math import isnan | ||||
| # ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
| @@ -41,8 +40,6 @@ def fixValue(value, minimum, maximum): | |||||
| return maximum | return maximum | ||||
| return value | return value | ||||
| #QPlastiqueStyle = QStyleFactory.create("Plastique") | |||||
| # ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
| # Custom InputDialog with Scale Points support | # Custom InputDialog with Scale Points support | ||||
| @@ -199,9 +196,6 @@ class ParamSpinBox(QAbstractSpinBox): | |||||
| QTimer.singleShot(0, self, SLOT("slot_updateProgressBarGeometry()")) | QTimer.singleShot(0, self, SLOT("slot_updateProgressBarGeometry()")) | ||||
| #def force_plastique_style(self): | |||||
| #self.setStyle(QPlastiqueStyle) | |||||
| def setDefault(self, value): | def setDefault(self, value): | ||||
| value = fixValue(value, self.fMinimum, self.fMaximum) | value = fixValue(value, self.fMinimum, self.fMaximum) | ||||
| self.fDefault = value | self.fDefault = value | ||||
| @@ -359,12 +353,22 @@ class ParamSpinBox(QAbstractSpinBox): | |||||
| menu = QMenu(self) | menu = QMenu(self) | ||||
| actReset = menu.addAction(self.tr("Reset (%f)" % self.fDefault)) | actReset = menu.addAction(self.tr("Reset (%f)" % self.fDefault)) | ||||
| menu.addSeparator() | menu.addSeparator() | ||||
| actCopy = menu.addAction(self.tr("Copy (%f)" % self.fValue)) | |||||
| actCopy = menu.addAction(self.tr("Copy (%f)" % self.fValue)) | |||||
| clipboard = QApplication.instance().clipboard() | |||||
| pasteText = clipboard.text() | |||||
| pasteValue = None | |||||
| if True or self.fReadOnly: | |||||
| if pasteText: | |||||
| try: | |||||
| pasteValue = float(pasteText) | |||||
| except: | |||||
| pass | |||||
| if pasteValue is None: | |||||
| actPaste = menu.addAction(self.tr("Paste")) | actPaste = menu.addAction(self.tr("Paste")) | ||||
| else: | else: | ||||
| actPaste = menu.addAction(self.tr("Paste (%s)" % "TODO")) | |||||
| actPaste = menu.addAction(self.tr("Paste (%s)" % pasteValue)) | |||||
| menu.addSeparator() | menu.addSeparator() | ||||
| @@ -375,9 +379,6 @@ class ParamSpinBox(QAbstractSpinBox): | |||||
| actPaste.setEnabled(False) | actPaste.setEnabled(False) | ||||
| actSet.setEnabled(False) | actSet.setEnabled(False) | ||||
| # TODO - NOT IMPLEMENTED YET | |||||
| actCopy.setEnabled(False) | |||||
| actSel = menu.exec_(QCursor.pos()) | actSel = menu.exec_(QCursor.pos()) | ||||
| if actSel == actSet: | if actSel == actSet: | ||||
| @@ -387,10 +388,10 @@ class ParamSpinBox(QAbstractSpinBox): | |||||
| self.setValue(value) | self.setValue(value) | ||||
| elif actSel == actCopy: | elif actSel == actCopy: | ||||
| pass | |||||
| clipboard.setText("%f" % self.fValue) | |||||
| elif actSel == actPaste: | elif actSel == actPaste: | ||||
| pass | |||||
| self.setValue(pasteValue) | |||||
| elif actSel == actReset: | elif actSel == actReset: | ||||
| self.setValue(self.fDefault) | self.setValue(self.fDefault) | ||||