Skip to content

Commit

Permalink
Simplify systray
Browse files Browse the repository at this point in the history
  • Loading branch information
henryruhs committed Feb 25, 2023
1 parent d123f1e commit 85f0c10
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions chroma_feedback/systray.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
import webbrowser
from typing import List
from functools import partial

from PyQt6.QtCore import Qt
from PyQt6.QtGui import QAction, QBrush, QColor, QIcon, QPainter, QPixmap
Expand Down Expand Up @@ -50,7 +51,7 @@ def update_menu(producer_report : List[ProducerReport]) -> None:
item_report.setIcon(create_icon(report['status']))
item_report.setIconVisibleInMenu(True)
if 'url' in report and report['url']:
item_report.triggered.connect(lambda: open_url(report['url']))
item_report.triggered.connect(partial(webbrowser.open, report['url']))
else:
item_report.setDisabled(True)
if producer_report:
Expand All @@ -66,10 +67,6 @@ def update_menu(producer_report : List[ProducerReport]) -> None:
item_exit.triggered.connect(action_exit)


def open_url(url : str) -> bool:
return webbrowser.open(url)


def create_icon(status : Status) -> QIcon:
color_config = color.get_by_status(status)
pixmap = QPixmap(100, 100)
Expand Down

0 comments on commit 85f0c10

Please sign in to comment.