File: application_runner.py

package info (click to toggle)
fs-uae-arcade 3.1.63-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 24,456 kB
  • sloc: python: 56,011; makefile: 170
file content (41 lines) | stat: -rw-r--r-- 1,230 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import signal
import sys

from fsui import Application
from fsui.qt import QFont
from fsui.qt import QFontDatabase
from workspace.ui import Font


class ApplicationRunner:
    def __init__(self, name):
        self._app = Application(name)

        stream = Font.stream("NotoSans-Regular.ttf")
        # noinspection PyArgumentList
        QFontDatabase.addApplicationFontFromData(stream.read())

        stream = Font.stream("Roboto-Regular.ttf")
        # noinspection PyArgumentList
        QFontDatabase.addApplicationFontFromData(stream.read())

        stream = Font.stream("RobotoMono-Regular.ttf")
        # noinspection PyArgumentList
        QFontDatabase.addApplicationFontFromData(stream.read())

        font = Font("Roboto", 14)
        font.qfont().setPointSizeF(10.5)
        font.qfont().setHintingPreference(QFont.PreferNoHinting)
        self._app.qapplication.setFont(font.qfont())

    def run(self, application):
        # FIXME: Find a nicer way to make PyQT cooperate with Ctrl+C?
        signal.signal(signal.SIGINT, signal.SIG_DFL)

        args = sys.argv[1:]
        application.init(args)
        # if args:
        #     print(args)
        #     application.arguments(args)

        self._app.run()