GWinWrap/src/GWinWrap/__init__.py

42 lines
1.1 KiB
Python
Raw Normal View History

#!/usr/bin/python3
2019-05-05 09:02:35 +00:00
# Gtk imports
import gi, faulthandler, signal
2019-05-05 09:02:35 +00:00
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GLib
# Python imports
import inspect
2019-05-05 09:02:35 +00:00
from setproctitle import setproctitle
2019-05-05 09:02:35 +00:00
# Application imports
from utils import Settings
from signal_classes import CrossClassSignals
2019-05-05 09:02:35 +00:00
class Main:
2019-05-05 09:02:35 +00:00
def __init__(self):
setproctitle('GWinWrap')
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, gtk.main_quit)
faulthandler.enable() # For better debug info
settings = Settings()
builder = settings.returnBuilder()
# Gets the methods from the classes and sets to handler.
# Then, builder connects to any signals it needs.
classes = [CrossClassSignals(settings)]
2020-07-06 00:28:47 +00:00
handlers = {}
for c in classes:
methods = inspect.getmembers(c, predicate=inspect.ismethod)
handlers.update(methods)
builder.connect_signals(handlers)
window = settings.createWindow()
2019-06-19 03:29:29 +00:00
window.show()