windows: use a better systray default icon

Draw a blue circle as default icon in the systray. Use the same
blue color as the one shown in ogCP for an ogClient Windows instance.
master
Alejandro Sirgo Rica 2024-11-12 11:53:04 +01:00
parent 525958ae85
commit bc7fe848ac
1 changed files with 13 additions and 10 deletions

View File

@ -23,20 +23,23 @@ from src.ogRest import ThreadState
def _create_default_image(): def _create_default_image():
""" """
Creates a default image for the tray icon. Use in case Creates a default image for the tray icon. Use in case
no favicon.ico is found. no favicon.ico is found. The image will be a blue circle.
""" """
width = height = 250 width = height = 250
color1 = (255, 255, 255) circle_color = (45, 158, 251)
color2 = (255, 0, 255)
image = Image.new('RGB', (width, height), color1) # Create a new image with a transparent background
image = Image.new('RGBA', (width, height), (0, 0, 0, 0))
dc = ImageDraw.Draw(image) dc = ImageDraw.Draw(image)
dc.rectangle(
(width // 2, 0, width, height // 2), # Draw circle
fill=color2) circle_radius = min(width, height) // 2 - 10
dc.rectangle( circle_center = (width // 2, height // 2)
(0, height // 2, width // 2, height), dc.ellipse(
fill=color2) (circle_center[0] - circle_radius, circle_center[1] - circle_radius,
circle_center[0] + circle_radius, circle_center[1] + circle_radius),
fill=circle_color
)
return image return image