Пример #1
0
 def setStatus(self, status):
     """Update with the daemon status."""
     self.current_status = status
     if status != 'idle':
         setBackgroundColor(self, self.run_color)
         if not self.error_status:
             setForegroundColor(self, self.inactive_fgcolor)
     else:
         setBackgroundColor(self, self.idle_color)
         if not self.error_status:
             setForegroundColor(self, self.active_fgcolor)
     self.update()
     self.setEnabled(status != 'disconnected')
Пример #2
0
 def on_textChanged(self):
     setForegroundColor(self, self.active_fgcolor)
     try:
         script = self.text()
         if not script or script.strip().startswith('#'):
             return
         compile(script + '\n', 'script', 'single')
     except Exception:
         self.error_status = True
         setForegroundColor(self, self.error_fgcolor)
         self.update()
     else:
         self.error_status = False
         setForegroundColor(self, self.active_fgcolor)
Пример #3
0
 def on_devValueChange(self, dev, value, strvalue, unitvalue, expired):
     if expired:
         setForegroundColor(self, QColor('grey'))
     else:
         setForegroundColor(self, QColor('black'))
         self.setText(self._callback(value, strvalue))
Пример #4
0
 def _setShadow(self):
     self._shadowed = True
     QLineEdit.setText(self, self.shadowText)
     setForegroundColor(self, self._shadowcolor)
Пример #5
0
 def setText(self, text):
     self._shadowed = False
     QLineEdit.setText(self, text)
     setForegroundColor(self, self._textcolor)