Python PyQt5.QtCore.Qt.green() Examples
The following are 11
code examples of PyQt5.QtCore.Qt.green().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: diff_result.py From vorta with GNU General Public License v3.0 | 6 votes |
def data(self, index, role): if not index.isValid(): return None item = index.internalPointer() if role == Qt.ForegroundRole: if item.itemData[1] == 'removed': return QVariant(QColor(Qt.red)) elif item.itemData[1] == 'added': return QVariant(QColor(Qt.green)) elif item.itemData[1] == 'modified' or item.itemData[1].startswith('['): return QVariant(QColor(Qt.darkYellow)) if role == Qt.DisplayRole: return item.data(index.column()) else: return None
Example #2
Source File: landUnit.py From imperialism-remake with GNU General Public License v3.0 | 5 votes |
def draw(self, defending, status, scene, size): """function draw :param defending: bool :param status: str {'Charge', 'Shoot', 'Stand'} :param scene: QGraphicsScene :param size: QSize no return """ if not isinstance(defending, bool): raise ValueError('defending must be a boolean') if not isinstance(status, str) or (status != 'Charge' and status != 'Shoot' and status != 'Stand'): raise ValueError('status must be a str in {\'Charge\', \'Shoot\', \'Stand\'}') self.unitType.draw(defending, status, scene, size) flag_width = self.nation.flag.width() * 10 / self.nation.flag.height() item = scene.addPixmap(self.nation.flag.scaled(flag_width, 10)) item.setPos(size.width() - 5 - flag_width, 0) # life bar item1 = QGraphicsRectItem(0, size.height() - 10, size.width() - 5, 5) item1.setBrush(QBrush(Qt.white)) item2 = QGraphicsRectItem(0, size.height() - 10, self.unitStrength / 100 * (size.width() - 5), 5) item2.setBrush(QBrush(Qt.green)) # moral bar item3 = QGraphicsRectItem(0, size.height() - 15, size.width() - 5, 5) item3.setBrush(QBrush(Qt.white)) item4 = QGraphicsRectItem(0, size.height() - 15, self.moral / 100 * (size.width() - 5), 5) item4.setBrush(QBrush(Qt.blue)) scene.addItem(item1) scene.addItem(item2) scene.addItem(item3) scene.addItem(item4)
Example #3
Source File: sparrow-wifi.py From sparrow-wifi with GNU General Public License v3.0 | 5 votes |
def setBlackoutColors(self): global colors global orange colors = [Qt.red, Qt.yellow, Qt.darkYellow, Qt.green, Qt.darkGreen, orange, Qt.blue,Qt.cyan, Qt.darkCyan, Qt.magenta, Qt.darkMagenta, Qt.gray] # return # self.setStyleSheet("background-color: black") #self.Plot24.setBackgroundBrush(Qt.black) mainTitleBrush = QBrush(Qt.red) self.chart24.setTitleBrush(mainTitleBrush) self.chart5.setTitleBrush(mainTitleBrush) self.chart24.setBackgroundBrush(QBrush(Qt.black)) self.chart24.axisX().setLabelsColor(Qt.white) self.chart24.axisY().setLabelsColor(Qt.white) titleBrush = QBrush(Qt.white) self.chart24.axisX().setTitleBrush(titleBrush) self.chart24.axisY().setTitleBrush(titleBrush) #self.Plot5.setBackgroundBrush(Qt.black) self.chart5.setBackgroundBrush(QBrush(Qt.black)) self.chart5.axisX().setLabelsColor(Qt.white) self.chart5.axisY().setLabelsColor(Qt.white) self.chart5.axisX().setTitleBrush(titleBrush) self.chart5.axisY().setTitleBrush(titleBrush) #$ self.networkTable.setStyleSheet("QTableCornerButton::section{background-color: white;}") # self.networkTable.cornerWidget().setStylesheet("background-color: black") self.networkTable.setStyleSheet("QTableView {background-color: black;gridline-color: white;color: white} QTableCornerButton::section{background-color: white;}") headerStyle = "QHeaderView::section{background-color: white;border: 1px solid black;color: black;} QHeaderView::down-arrow,QHeaderView::up-arrow {background: none;}" self.networkTable.horizontalHeader().setStyleSheet(headerStyle) self.networkTable.verticalHeader().setStyleSheet(headerStyle)
Example #4
Source File: snake_app.py From SnakeAI with MIT License | 5 votes |
def draw_apple(self, painter: QtGui.QPainter) -> None: apple_location = self.snake.apple_location if apple_location: painter.setRenderHints(QtGui.QPainter.HighQualityAntialiasing) painter.setPen(QtGui.QPen(Qt.black)) painter.setBrush(QtGui.QBrush(Qt.green)) painter.drawRect(apple_location.x * SQUARE_SIZE[0], apple_location.y * SQUARE_SIZE[1], SQUARE_SIZE[0], SQUARE_SIZE[1])
Example #5
Source File: MWTrackerViewer.py From tierpsy-tracker with MIT License | 5 votes |
def __init__(self, ui): super().__init__(ui) self.food_coordinates = None self.wlabC = { WLAB['U']: Qt.white, WLAB['WORM']: Qt.green, WLAB['WORMS']: Qt.blue, WLAB['BAD']: Qt.darkRed, WLAB['GOOD_SKE']: Qt.darkCyan } self.ui.checkBox_showFood.stateChanged.connect(self.updateImage) self.ui.checkBox_showFood.setEnabled(False) self.ui.checkBox_showFood.setChecked(True)
Example #6
Source File: SignalsExample.py From PyQt with GNU General Public License v3.0 | 5 votes |
def onCurrentRowChanged(self, currentRow): self.resultView.appendHtml( '{0}: {1}'.format( formatColor('currentRowChanged', QColor(Qt.green)), currentRow))
Example #7
Source File: CalendarQssStyle.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(CalendarWidget, self).__init__(*args, **kwargs) # 隐藏左边的序号 self.setVerticalHeaderFormat(self.NoVerticalHeader) # 修改周六周日颜色 fmtGreen = QTextCharFormat() fmtGreen.setForeground(QBrush(Qt.green)) self.setWeekdayTextFormat(Qt.Saturday, fmtGreen) fmtOrange = QTextCharFormat() fmtOrange.setForeground(QBrush(QColor(252, 140, 28))) self.setWeekdayTextFormat(Qt.Sunday, fmtOrange)
Example #8
Source File: dbg.py From IDACyber with MIT License | 5 votes |
def on_get_annotations(self, address, size, mouse_offs): ann = [] ip = get_ip_val() sp = get_sp_val() if ip is not None and sp is not None: ann.append((ip, Qt.red, "%X (IP)" % ip, Qt.red)) ann.append((sp, Qt.green, "%X (SP)" % sp, Qt.green)) return ann
Example #9
Source File: sparrow-wifi.py From sparrow-wifi with GNU General Public License v3.0 | 4 votes |
def onGPSStatus(self, updateStatusBar=True): if (not self.remoteAgentUp): # Checking local GPS if GPSEngine.GPSDRunning(): if self.gpsEngine.gpsValid(): self.gpsSynchronized = True self.btnGPSStatus.setStyleSheet("background-color: green; border: 1px;") if updateStatusBar: self.statusBar().showMessage('Local gpsd service is running and satellites are synchronized.') else: self.gpsSynchronized = False self.btnGPSStatus.setStyleSheet("background-color: yellow; border: 1px;") if updateStatusBar: self.statusBar().showMessage("Local gpsd service is running but it's not synchronized with the satellites yet.") else: self.gpsSynchronized = False if updateStatusBar: self.statusBar().showMessage('No local gpsd running.') self.btnGPSStatus.setStyleSheet("background-color: red; border: 1px;") else: # Checking remote errCode, errMsg, gpsStatus = requestRemoteGPS(self.remoteAgentIP, self.remoteAgentPort) if errCode == 0: self.missedAgentCycles = 0 if (gpsStatus.isValid): self.gpsSynchronized = True self.btnGPSStatus.setStyleSheet("background-color: green; border: 1px;") self.statusBar().showMessage("Remote GPS is running and synchronized.") elif (gpsStatus.gpsRunning): self.gpsSynchronized = False self.btnGPSStatus.setStyleSheet("background-color: yellow; border: 1px;") self.statusBar().showMessage("Remote GPS is running but it has not synchronized with the satellites yet.") else: self.gpsSynchronized = False self.statusBar().showMessage("Remote GPS service is not running.") self.btnGPSStatus.setStyleSheet("background-color: red; border: 1px;") else: agentUp = portOpen(self.remoteAgentIP, self.remoteAgentPort) # Agent may be up but just taking a while to respond. if (not agentUp) or errCode == -1: self.missedAgentCycles += 1 if (not agentUp) or (self.missedAgentCycles > self.allowedMissedAgentCycles): # We may let it miss a cycle or two just as a good practice # Agent disconnected. # Stop any active scan and transition local self.agentDisconnected() self.statusBar().showMessage("Error connecting to remote agent. Agent disconnected.") QMessageBox.question(self, 'Error',"Error connecting to remote agent. Agent disconnected.", QMessageBox.Ok) else: self.statusBar().showMessage("Remote GPS Error: " + errMsg) self.btnGPSStatus.setStyleSheet("background-color: red; border: 1px;")
Example #10
Source File: TestCFontIcon.py From CustomWidgets with GNU General Public License v3.0 | 4 votes |
def __init__(self, *args, **kwargs): super(ButtonsWidget, self).__init__(*args, **kwargs) layout = QGridLayout(self) loader = CIconLoader.fontMaterial() # 创建一个多态的icon icon = loader.icon('mdi-qqchat') icon.add('mdi-access-point', Qt.red, QIcon.Normal, QIcon.On) icon.add('mdi-camera-metering-matrix', Qt.green, QIcon.Disabled, QIcon.Off) icon.add('mdi-file-document-box-check', Qt.blue, QIcon.Disabled, QIcon.On) icon.add('mdi-magnify-minus', Qt.cyan, QIcon.Active, QIcon.Off) icon.add('mdi-account', Qt.magenta, QIcon.Active, QIcon.On) icon.add('mdi-camera-off', Qt.yellow, QIcon.Selected, QIcon.Off) icon.add('mdi-set-center', Qt.white, QIcon.Selected, QIcon.On) layout.addWidget(QLabel('Normal', self), 0, 0) layout.addWidget(QPushButton(self, icon=icon, text=loader.value( 'mdi-qqchat'), font=loader.font, iconSize=QSize(36, 36)), 0, 1) layout.addWidget(QLabel('Disabled', self), 1, 0) layout.addWidget(QPushButton(self, icon=icon, text=loader.value( 'mdi-qqchat'), enabled=False, font=loader.font, iconSize=QSize(48, 48)), 1, 1) layout.addWidget(QLabel('Active', self), 2, 0) layout.addWidget(QPushButton(self, icon=icon, text=loader.value( 'mdi-qqchat'), font=loader.font, iconSize=QSize(64, 64)), 2, 1) layout.addWidget(QLabel('Selected', self), 3, 0) layout.addWidget(QPushButton(self, icon=icon, text=loader.value( 'mdi-qqchat'), font=loader.font, checkable=True, checked=True), 3, 1) # 旋转动画 aniButton = QPushButton(self, iconSize=QSize(48, 48)) loader = CIconLoader.fontAwesome() icon = loader.icon( 'fa-spinner', animation=CIconAnimationSpin(aniButton, 10, 4)) aniButton.setIcon(icon) layout.addWidget(QLabel('动画', self), 4, 0) layout.addWidget(aniButton, 4, 1)
Example #11
Source File: snake_app.py From SnakeAI with MIT License | 4 votes |
def draw_snake(self, painter: QtGui.QPainter) -> None: painter.setRenderHints(QtGui.QPainter.HighQualityAntialiasing) pen = QtGui.QPen() pen.setColor(QtGui.QColor(0, 0, 0)) # painter.setPen(QtGui.QPen(Qt.black)) painter.setPen(pen) brush = QtGui.QBrush() brush.setColor(Qt.red) painter.setBrush(QtGui.QBrush(QtGui.QColor(198, 5, 20))) # painter.setBrush(brush) def _draw_line_to_apple(painter: QtGui.QPainter, start_x: int, start_y: int, drawable_vision: DrawableVision) -> Tuple[int, int]: painter.setPen(QtGui.QPen(Qt.green)) end_x = drawable_vision.apple_location.x * SQUARE_SIZE[0] + SQUARE_SIZE[0]/2 end_y = drawable_vision.apple_location.y * SQUARE_SIZE[1] + SQUARE_SIZE[1]/2 painter.drawLine(start_x, start_y, end_x, end_y) return end_x, end_y def _draw_line_to_self(painter: QtGui.QPainter, start_x: int, start_y: int, drawable_vision: DrawableVision) -> Tuple[int, int]: painter.setPen(QtGui.QPen(Qt.red)) end_x = drawable_vision.self_location.x * SQUARE_SIZE[0] + SQUARE_SIZE[0]/2 end_y = drawable_vision.self_location.y * SQUARE_SIZE[1] + SQUARE_SIZE[1]/2 painter.drawLine(start_x, start_y, end_x, end_y) return end_x, end_y for point in self.snake.snake_array: painter.drawRect(point.x * SQUARE_SIZE[0], # Upper left x-coord point.y * SQUARE_SIZE[1], # Upper left y-coord SQUARE_SIZE[0], # Width SQUARE_SIZE[1]) # Height if self.draw_vision: start = self.snake.snake_array[0] if self.snake._drawable_vision[0]: for drawable_vision in self.snake._drawable_vision: start_x = start.x * SQUARE_SIZE[0] + SQUARE_SIZE[0]/2 start_y = start.y * SQUARE_SIZE[1] + SQUARE_SIZE[1]/2 if drawable_vision.apple_location and drawable_vision.self_location: apple_dist = self._calc_distance(start.x, drawable_vision.apple_location.x, start.y, drawable_vision.apple_location.y) self_dist = self._calc_distance(start.x, drawable_vision.self_location.x, start.y, drawable_vision.self_location.y) if apple_dist <= self_dist: start_x, start_y = _draw_line_to_apple(painter, start_x, start_y, drawable_vision) start_x, start_y = _draw_line_to_self(painter, start_x, start_y, drawable_vision) else: start_x, start_y = _draw_line_to_self(painter, start_x, start_y, drawable_vision) start_x, start_y = _draw_line_to_apple(painter, start_x, start_y, drawable_vision) elif drawable_vision.apple_location: start_x, start_y = _draw_line_to_apple(painter, start_x, start_y, drawable_vision) elif drawable_vision.self_location: start_x, start_y = _draw_line_to_self(painter, start_x, start_y, drawable_vision) if drawable_vision.wall_location: painter.setPen(QtGui.QPen(Qt.black)) end_x = drawable_vision.wall_location.x * SQUARE_SIZE[0] + SQUARE_SIZE[0]/2 end_y = drawable_vision.wall_location.y * SQUARE_SIZE[1] + SQUARE_SIZE[1]/2 painter.drawLine(start_x, start_y, end_x, end_y)