Пример #1
0
    def __init__(self, name, parent=None, designMode=False):
        # self.newValue - is used as a flag to indicate whether a controlUp controlDown actions are used to iterate existing element or put new one
        # self.disableEditMode - flag, used to disable edition, when user enters name of the macro which is not valid (not allowed to edit in the yellow line)
        #                   switches off validation
        # disableSpockCommandUpdate - flag, it disables updates of the model
        # when macro is edited by macroEditor

        Qt.QLineEdit.__init__(self, parent)
        TaurusBaseContainer.__init__(self, name, parent, designMode)

        self._model = None
        self.setFont(Qt.QFont("Courier", 9))
        palette = Qt.QPalette()
        palette.setColor(Qt.QPalette.Base, Qt.QColor('yellow'))
        self.setPalette(palette)
        self.currentIndex = Qt.QModelIndex()
        self.newValue = False
        self.disableSpockCommandUpdate = False
        self.disableEditMode = True
        self.setEnabled(False)

        self.setActions()
        self.connect(self, Qt.SIGNAL("textChanged(const QString &)"),
                     self.textChanged)
        self.connect(self, Qt.SIGNAL("returnPressed()"), self.returnPressed)
Пример #2
0
 def setModel(self, model):
     if isinstance(model, Qt.QAbstractItemModel):
         enable = bool(model)
         self.disableEditMode = not enable
         self.setEnabled(enable)
         self._model = model
         self._model.dataChanged.connect(self.onDataChanged)
         self._model.modelReset.connect(self.setCommand)
     else:
         TaurusBaseContainer.setModel(self, model)
Пример #3
0
 def setModel(self, model):
     self.info('DictionaryEditor.setModel(%s(%s))' % (type(model), model))
     if isString(model):
         try:
             self.dctmodel = list(eval(model)) if any(
                 c in model for c in ('{', '[', '(')) else [model]
         except:
             self.dctmodel = [model]
     else:
         self.dctmodel = model
     # self.updateStyle() called from the property setter
     TaurusBaseContainer.setModel(self, model)
Пример #4
0
    def __init__(self, name, parent=None, designMode=False):
        #self.newValue - is used as a flag to indicate whether a controlUp controlDown actions are used to iterate existing element or put new one
        #self.disableEditMode - flag, used to disable edition, when user enters name of the macro which is not valid (not allowed to edit in the yellow line)
        #                   switches off validation
        #disableSpockCommandUpdate - flag, it disables updates of the model when macro is edited by macroEditor

        Qt.QLineEdit.__init__(self, parent)
        TaurusBaseContainer.__init__(self, name, parent, designMode)

        self._model = None
        self.setFont(Qt.QFont("Courier", 9))
        palette = Qt.QPalette()
        palette.setColor(Qt.QPalette.Base, Qt.QColor('yellow'))
        self.setPalette(palette)
        self.currentIndex = Qt.QModelIndex()
        self.newValue = False
        self.disableSpockCommandUpdate = False
        self.disableEditMode = True
        self.setEnabled(False)

        self.setActions()
        self.connect(self, Qt.SIGNAL("textChanged(const QString &)"), self.textChanged)
        self.connect(self, Qt.SIGNAL("returnPressed()"), self.returnPressed)
Пример #5
0
 def setModel(self, model):
     self.info('DictionaryEditor.setModel(%s(%s))' % (type(model), model))
     self.dctmodel = eval(model) if isString(model) else model
     # self.updateStyle() called from the property setter
     TaurusBaseContainer.setModel(self, model)