def updateStatus(self, status, exception=False): self._status = status isconnected = status != 'disconnected' self.actionBreak.setEnabled(isconnected and status != 'idle') self.actionBreak2.setEnabled(isconnected and status != 'idle') self.actionBreak2.setVisible(status != 'paused') self.actionBreakCount.setEnabled(isconnected and status != 'idle') self.actionContinue.setVisible(status == 'paused') self.actionStop.setEnabled(isconnected and status != 'idle') self.actionStop2.setEnabled(isconnected and status != 'idle') self.actionFinish.setEnabled(isconnected and status != 'idle') self.actionFinishEarly.setEnabled(isconnected and status != 'idle') self.actionFinishEarlyAndStop.setEnabled(isconnected and status != 'idle') self.actionEmergencyStop.setEnabled(isconnected) if status == 'paused': self.statusLabel.setText('Script is paused.') self.statusLabel.show() setBackgroundColor(self.traceView, self.pause_color) else: self.statusLabel.hide() setBackgroundColor(self.traceView, self.idle_color) self.traceView.update() if status == 'idle': self.etaWidget.hide()
def _applystatuscolor(self): if self._expired: setBothColors(self.valuelabel, (self._colorscheme['fore'][UNKNOWN], self._colorscheme['expired'])) else: setBothColors(self.valuelabel, self._statuscolors) if self._labelcolor: self.namelabel.setAutoFillBackground(True) setBackgroundColor(self.namelabel, self._labelcolor) else: self.namelabel.setAutoFillBackground(False)
def markValid(self, ctl, condition): """Return boolean condition, and also mark the offending widget. For use in isValid(). """ if condition: setBackgroundColor(ctl, Qt.white) else: setBackgroundColor(ctl, invalid) if isinstance(ctl, QAbstractSpinBox): # also mark the inner line-edit return self.markValid(ctl.lineEdit(), condition) return condition
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')
def __init__(self, cacheclient, parent=None): QMainWindow.__init__(self) self.client = cacheclient self._treeitems = {} uic.loadUi(join(path.dirname(path.abspath(__file__)), 'ui', 'mainwindow.ui'), self) self.watcherWindow = WatcherWindow(self) self.setupEvents() self.ipAddress = '127.0.0.1' self.port = 14869 self.showTimeStamp = True self.showTTL = True setBackgroundColor(self.labelDemoTTL, ttlColor) setBackgroundColor(self.labelDemoExpired, expiredColor)
def _updateStyle(self, editor): if self.custom_font is None: return bold = QFont(self.custom_font) bold.setBold(True) if has_scintilla: lexer = editor.lexer() lexer.setDefaultFont(self.custom_font) for i in range(16): lexer.setFont(self.custom_font, i) # make keywords bold lexer.setFont(bold, 5) else: editor.setFont(self.custom_font) if has_scintilla: lexer.setPaper(self.custom_back) else: setBackgroundColor(editor, self.custom_back)
def updateValues(self): entry = self.entry if entry.expired: setBackgroundColor(self, expiredColor) elif entry.ttl: setBackgroundColor(self, ttlColor) if isinstance(self.widgetValue, ReadOnlyCheckBox): self.widgetValue.setChecked(entry.value == 'True') else: self.widgetValue.setText(entry.value) self.labelTTL.setText(str(entry.ttl or '')) self.labelTime.setText(entry.convertTime()) if entry.ttl: # automatically refresh the value if the entry has a ttl (we don't # get timestamp updates from the server unless the value changes) time_to_update = max((entry.time + entry.ttl) - time.time(), 0) self.updateTimer.start(time_to_update * 1000)
def setCustomStyle(self, font, back): self.commandInput.idle_color = back self.commandInput.setFont(font) setBackgroundColor(self.commandInput, back)
def setCustomStyle(self, font, back): self.watchView.setFont(font) setBackgroundColor(self.watchView, back)
def setCustomStyle(self, font, back): self.idle_color = back for widget in (self.traceView, self.queueView): widget.setFont(font) setBackgroundColor(widget, back)
def updateStatus(self, status, exception=False): self.current_status = status setBackgroundColor(self.curstatus, self._idle if status == 'idle' else self._busy)
def setCustomStyle(self, font, back): self.commandInput.idle_color = back for widget in (self.outView, self.commandInput): widget.setFont(font) setBackgroundColor(widget, back) self.promptLabel.setFont(font)