version 0.0.1
This commit is contained in:
10
subprojects/catch2.wrap
Normal file
10
subprojects/catch2.wrap
Normal file
@@ -0,0 +1,10 @@
|
||||
[wrap-file]
|
||||
directory = Catch2-2.11.1
|
||||
|
||||
source_url = https://github.com/catchorg/Catch2/archive/v2.11.1.zip
|
||||
source_filename = Catch2-2.11.1.zip
|
||||
source_hash = da97f7acd94ea6e1f26aae4a6edf5d10d020666efaec22781f6ac42371569d2c
|
||||
|
||||
patch_url = https://wrapdb.mesonbuild.com/v1/projects/catch2/2.11.1/1/get_zip
|
||||
patch_filename = catch2-2.11.1-1-wrap.zip
|
||||
patch_hash = b7b46c5dd5092d5bce6fa9e88c7ae29e089adaba2f972288c9ed665e7a589650
|
||||
67
subprojects/gui/gui.py
Normal file
67
subprojects/gui/gui.py
Normal file
@@ -0,0 +1,67 @@
|
||||
import sys
|
||||
from os import path
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
|
||||
from PyQt5.QtCore import QTimer
|
||||
from PyQt5.QtGui import QPixmap
|
||||
|
||||
WINDOW_TITLE = "Attack Status"
|
||||
POSITION = [0, 0]
|
||||
SIZE = [912, 513]
|
||||
|
||||
FOLDER = ""
|
||||
if not path.isfile(FOLDER + "gui.py"):
|
||||
FOLDER = "subprojects/gui/"
|
||||
PATH_ATTACK_FILE = "/home/guru/is_attacking/attacking" # Location of 'attacking'-file (interface)
|
||||
PATH_SMILEY = FOLDER + "img/smiley.png"
|
||||
PATH_SKULL = [FOLDER + "img/skull_black.png", FOLDER + "img/skull_orange.png"]
|
||||
|
||||
DELTA_TIME = 300
|
||||
GREEN = "#7cb342"
|
||||
ORANGE = "#e65100"
|
||||
BLACK = "#000000"
|
||||
|
||||
class Window(QWidget):
|
||||
run = True # Run/stop loop
|
||||
inverted = True # Use inverted colors
|
||||
|
||||
def __init__(self):
|
||||
# Initialize window
|
||||
super().__init__()
|
||||
self.setWindowTitle(WINDOW_TITLE)
|
||||
self.setGeometry(POSITION[0], POSITION[1], SIZE[0], SIZE[1])
|
||||
|
||||
# Show image
|
||||
self.image = QLabel(self)
|
||||
self.loop()
|
||||
self.show()
|
||||
|
||||
def loop(self):
|
||||
# Start timer
|
||||
if self.run:
|
||||
QTimer.singleShot(DELTA_TIME, self.loop)
|
||||
|
||||
# Update image
|
||||
if path.isfile(PATH_ATTACK_FILE):
|
||||
self.inverted = not self.inverted
|
||||
if self.inverted:
|
||||
self.update_image(PATH_SKULL[1], BLACK)
|
||||
else:
|
||||
self.update_image(PATH_SKULL[0], ORANGE)
|
||||
else:
|
||||
self.update_image(PATH_SMILEY, GREEN)
|
||||
|
||||
def update_image(self, image_path, background_color):
|
||||
self.image.setPixmap(QPixmap(image_path))
|
||||
self.setStyleSheet("background-color: " + background_color)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Run app until closed
|
||||
app = QApplication(sys.argv)
|
||||
window = Window()
|
||||
app.exec_()
|
||||
|
||||
# Terminate
|
||||
window.run = False
|
||||
sys.exit()
|
||||
|
||||
BIN
subprojects/gui/img/skull_black.png
Normal file
BIN
subprojects/gui/img/skull_black.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
BIN
subprojects/gui/img/skull_orange.png
Normal file
BIN
subprojects/gui/img/skull_orange.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
BIN
subprojects/gui/img/smiley.png
Normal file
BIN
subprojects/gui/img/smiley.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
BIN
subprojects/packagecache/Catch2-2.11.1.zip
Normal file
BIN
subprojects/packagecache/Catch2-2.11.1.zip
Normal file
Binary file not shown.
BIN
subprojects/packagecache/catch2-2.11.1-1-wrap.zip
Normal file
BIN
subprojects/packagecache/catch2-2.11.1-1-wrap.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user