forked from DarkSouL11/ImageCompressor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
initialize.py
34 lines (32 loc) · 916 Bytes
/
initialize.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
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from interface import interface
from compressor import Compressor
from loginUi import authInterface
import sys, os
def run():
if not os.path.isfile('.apikey'):
open('.apikey', 'w')
key = open('.apikey')
API_KEY = key.readline()[:-1]
key.close()
try:
c = Compressor(API_KEY)
except Exception:
try:
window = authInterface()
window.connect("delete-event", Gtk.main_quit)
window.show_all()
Gtk.main()
key = open('.apikey')
API_KEY = key.readline()[:-1]
key.close()
c = Compressor(API_KEY)
except Exception:
print("Sorry something went wrong!")
sys.exit(1)
window = interface(c)
window.connect("delete-event", Gtk.main_quit)
window.show_all()
Gtk.main()