Skip to content
Snippets Groups Projects
Unverified Commit 364363e1 authored by Varac's avatar Varac
Browse files

Lint

parent 566a2b58
No related branches found
No related tags found
No related merge requests found
......@@ -12,15 +12,14 @@ from threading import Thread
import plac
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('AppIndicator3', '0.1')
#pylint: disable=wrong-import-position
from gi.repository import Gtk, AppIndicator3, GLib
import yaml
from gi.repository import Gtk, AppIndicator3, GLib # type: ignore
from query_alertmanager import get_alerts
#pylint: enable=wrong-import-position
gi.require_version('Gtk', '3.0')
gi.require_version('AppIndicator3', '0.1')
# pylint: disable=too-many-instance-attributes
class Indicator():
"""Main class."""
......@@ -29,7 +28,8 @@ class Indicator():
"""Initialize idicator."""
# Load config
config_file = open(Path.expanduser(config))
config_file = open(Path.expanduser(config),
encoding="UTF8") # type:ignore
opts = yaml.load(config_file, Loader=yaml.FullLoader)
self.url = opts.get('url')
self.port = opts.get('port', 443)
......@@ -48,6 +48,7 @@ class Indicator():
# the thread:
self.update = Thread(target=self.show_alerts)
# daemonize the thread to make the indicator stopable
# pylint: disable=deprecated-method
self.update.setDaemon(True)
self.update.start()
......@@ -90,7 +91,7 @@ class Indicator():
GLib.idle_add(self.indicator.set_icon, icon)
time.sleep(30)
def alert_details(self, source):
def alert_details(self):
"""Open browser with alertmanager URL."""
# alerts = get_alerts()
# alert_count = len(alerts)
......@@ -100,8 +101,7 @@ class Indicator():
# self.menu.append(alerts_item)
os.system(f"xdg-open {self.url}:{self.port}")
def stop(self, source):
def stop(self):
"""Exit indicator."""
Gtk.main_quit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment