-
Notifications
You must be signed in to change notification settings - Fork 0
/
maingtk.py
executable file
·55 lines (42 loc) · 1.12 KB
/
maingtk.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/python3
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import Business
from Data.Document import Document
from GUIGTK.MainWindow import MainWindow
import os
from pathlib import Path
__author__ = 'mamj'
# This is a test
def except_hook(cls, exception, traceback):
sys.__excepthook__(cls, exception, traceback)
def load_language(a):
pass
# locale = QLocale()
# translator = QTranslator(a)
# fname = "translate/%s.qm" % locale.name()
# if not os.path.isfile(fname):
# if "_" in locale.name():
# index = locale.name().index('_')
# fname = "translate/%s.qm" % locale.name()[:index]
# if os.path.isfile(fname):
# if translator.load(fname):
# a.installTranslator(translator)
def main():
load_language(1)
if len(sys.argv) > 1:
my_file = Path(sys.argv[1])
if my_file.is_file():
document = Business.load_document(sys.argv[1])
else:
document = Document()
else:
document = Document()
main_window = MainWindow(document)
main_window.show_all()
main_window.connect("destroy", Gtk.main_quit)
Gtk.main()
sys.excepthook = except_hook
main()