예제 #1
0
 def __init__(self, parent, curvalue, allow_enter=False):
     QLineEdit.__init__(self, parent)
     self.setText(cache_dump(curvalue))
     self.textChanged.connect(lambda txt: self.valueModified.emit())
     if allow_enter:
         self.returnPressed.connect(
             lambda: self.valueChosen.emit(cache_load(self.text())))
예제 #2
0
 def __init__(self,
              parent,
              typ,
              curvalue,
              fmtstr='%.4g',
              minmax=None,
              allow_enter=False):
     QLineEdit.__init__(self, parent)
     self._typ = typ
     if typ is float:
         val = DoubleValidator(self)
         if minmax:
             # setRange doesn't work correctly in some Qt versions...
             val.setBottom(minmax[0])
             if minmax[1] is not None:
                 val.setTop(minmax[1])
         self.setValidator(val)
         self.setText(fmtstr % curvalue)
     elif typ is int:
         val = QIntValidator(self)
         if minmax:
             val.setRange(minmax[0], minmax[1])
         self.setValidator(val)
         self.setText(str(curvalue))
     else:
         self.setText(str(curvalue))
     self.textChanged.connect(lambda txt: self.valueModified.emit())
     if allow_enter:
         self.returnPressed.connect(
             lambda: self.valueChosen.emit(self._typ(self.text())))
예제 #3
0
 def __init__(self, parent, history=None):
     QLineEdit.__init__(self, parent)
     self.run_color = QColor('#ffdddd')
     self.idle_color = self.palette().color(QPalette.Base)
     self.active_fgcolor = QColor('#000000')
     self.inactive_fgcolor = QColor('#c9c9c9')
     self.error_fgcolor = QColor("#ff0000")
     self.history = history or []
     self.scrollWidget = None
     self.completion_callback = lambda text: []
     self._start_text = ''
     self._current = -1
     self._completer = QCompleter([], self)
     self.setCompleter(self._completer)
예제 #4
0
 def __init__(self, client, parent=None):
     QLineEdit.__init__(self, parent)
     self.setReadOnly(True)
     self.setDisabled(True)
     self.setSource(client)
예제 #5
0
 def __init__(self, client, parent=None):
     QLineEdit.__init__(self, parent)
     self.setReadOnly(True)
     self.setValidator(QIntValidator(0, 99999, self))
     self._client = client
     self.setSource(self._client)
예제 #6
0
 def __init__(self, *args):
     QLineEdit.__init__(self, *args)
     self._textcolor = self.palette().color(QPalette.Text)
     self._shadowcolor = self.palette().color(QPalette.Dark)
     self._shadowed = True
     self.setShadowText('')