33 lines
887 B
Python
Executable File
33 lines
887 B
Python
Executable File
#!/usr/bin/python
|
|
# Copyright 2021 (c) Anna Schumaker.
|
|
import lib
|
|
lib.settings.load()
|
|
|
|
import db
|
|
import scanner
|
|
import ui
|
|
from gi.repository import Gtk
|
|
|
|
class Application(Gtk.Application):
|
|
def __init__(self, *args, **kwargs):
|
|
app_id = f"org.gtk.emmental{'-debug' if __debug__ else ''}"
|
|
Gtk.Application.__init__(self, *args, application_id=app_id, **kwargs)
|
|
|
|
def do_startup(self):
|
|
Gtk.Application.do_startup(self)
|
|
self.add_window(ui.window.Window())
|
|
for i in range(db.library.Table.get_n_items()):
|
|
scanner.update_library(db.library.Table.get_item(i))
|
|
|
|
def do_activate(self):
|
|
for window in self.get_windows():
|
|
window.present()
|
|
|
|
def do_shutdown(self):
|
|
Gtk.Application.do_shutdown(self)
|
|
scanner.Queue.clear()
|
|
db.sql.optimize()
|
|
|
|
if __name__ == "__main__":
|
|
Application().run()
|