32 lines
727 B
Python
32 lines
727 B
Python
import logging
|
|
import threading
|
|
|
|
import gi
|
|
|
|
from croaker.gui import GUI
|
|
from croaker.server import Controller
|
|
|
|
gi.require_version("Gtk", "4.0")
|
|
from gi.repository import GLib, GObject, Gtk # noqa E402
|
|
|
|
logger = logging.getLogger("player")
|
|
|
|
|
|
class Player(GUI):
|
|
"""
|
|
A GTK GUI application with a TCP command and control server.
|
|
"""
|
|
|
|
def __init__(self):
|
|
super().__init__()
|
|
self._controller = threading.Thread(target=self._start_controller)
|
|
self._controller.daemon = True
|
|
|
|
def do_activate(self):
|
|
self._controller.start()
|
|
super().do_activate()
|
|
self.load("session_start")
|
|
|
|
def _start_controller(self):
|
|
Controller(self).serve_forever(poll_interval=0.25)
|