11#! python3.4-32
2- import globals
2+ import shared
33__author__ = "Fabian Dill"
44__credits__ = ["Ijwu" , "7UR7L3" , "Fabian Dill" ]
55__maintainer__ = "Fabian Dill"
2020os .environ ["PYGAME_FREETYPE" ] = "1"
2121
2222
23- for p in (globals .appdata , ):
23+ for p in (shared .appdata , ):
2424 if not os .path .isdir (p ):
2525 os .mkdir (p )
2626
2727import zlib
2828import pickle
2929
3030try :
31- with open (globals .cachepath , "rb" ) as f :
31+ with open (shared .cachepath , "rb" ) as f :
3232 cache = pickle .loads (zlib .decompress (f .read ()))
3333except IOError as e :
3434 print ("Unable to load cache (" + e .__class__ .__name__ + "), creating new cache" )
3535
3636 cache = {"worlds" : {}, "backup" : {}}
37- with open (globals .cachepath , "wb" ) as f :
37+ with open (shared .cachepath , "wb" ) as f :
3838 f .write (zlib .compress (pickle .dumps (cache , 2 ), 9 ))
3939except Exception as e :
4040 print ("Unable to load cache (" + e .__class__ .__name__ + "), creating new cache" )
4141
4242 cache = {"worlds" : {}, "backup" : {}}
43- with open (globals .cachepath , "wb" ) as f :
43+ with open (shared .cachepath , "wb" ) as f :
4444 f .write (zlib .compress (pickle .dumps (cache , 2 ), 9 ))
4545
4646if "reset" in sys .argv :
6464if "lang" not in cache :
6565 cache ["lang" ] = "english"
6666if "version" not in cache :
67- cache ["version" ] = globals .__version__
67+ cache ["version" ] = shared .__version__
6868 cache ["worlds" ] = {}
69- elif cache ["version" ] < globals .__version__ :
69+ elif cache ["version" ] < shared .__version__ :
7070 print ("Newer Omnitool version, resetting world image cache." )
71- cache ["version" ] = globals .__version__
71+ cache ["version" ] = shared .__version__
7272 cache ["worlds" ] = {}
7373if os .path .isfile ("custom.py" ):
7474 sys .path .append ("." )
8181if False :
8282 import Language .english as lang #IDE hook
8383
84- globals .lang = lang
85- globals .cache = cache
84+ shared .lang = lang
85+ shared .cache = cache
8686
8787
8888if __name__ == "__main__" :
107107import threading
108108import time
109109import pgu_override
110- globals .theme = pgu_override .MyTheme (themename )
110+ shared .theme = pgu_override .MyTheme (themename )
111111import subprocess
112112import shutil
113113import sys
139139def save_cache ():
140140 cache_lock .acquire ()
141141 d = zlib .compress (pickle .dumps (cache ), 9 )
142- with open (globals .cachepath , "wb" ) as f :
142+ with open (shared .cachepath , "wb" ) as f :
143143 f .write (d )
144144 cache_lock .release ()
145145
@@ -207,7 +207,7 @@ def exit_prog(p):
207207 import sys
208208 sys .exit ()
209209
210- globals .exit_prog = exit_prog
210+ shared .exit_prog = exit_prog
211211
212212
213213def nothing (p ):
@@ -713,8 +713,8 @@ def run(self):
713713
714714
715715class Updater (threading .Thread ):
716- ziploc = os .path .join (globals .appdata , "tImages.zip" )
717- verloc = os .path .join (globals .appdata , "tImages.json" )
716+ ziploc = os .path .join (shared .appdata , "tImages.zip" )
717+ verloc = os .path .join (shared .appdata , "tImages.json" )
718718 def __init__ (self , update ):
719719 threading .Thread .__init__ (self )
720720 self .name = "Updater"
@@ -726,7 +726,7 @@ def run(self):
726726 f = urllib .request .urlopen ("http://dl.dropbox.com/u/44766482/ot_updater/ot_version.json" ).read ()
727727 js = json .loads (f .decode ())
728728 verint = js ["omnitool" ]
729- if verint > globals .__version__ :
729+ if verint > shared .__version__ :
730730 from version import Version
731731 text = gui .Label ("Version " + Version (verint ).__repr__ () + lang .available , color = (255 , 0 , 0 ))
732732 self .update .td (text , align = - 1 )
@@ -841,7 +841,7 @@ def run():
841841 "appAuthor" : __author__ + " (Berserker66)" ,
842842 "appName" : "Omnitool" ,
843843 "appPath" : os .path .abspath (sys .argv [0 ]),
844- "appVersion" : globals .__version__ .__repr__ ()
844+ "appVersion" : shared .__version__ .__repr__ ()
845845 }
846846 with loc .open ("wt" ) as f :
847847 f .write (json .dumps (data , indent = 4 ))
@@ -859,10 +859,10 @@ def run():
859859
860860 use_override = True
861861 if use_override :
862- app = pgu_override .MyApp (theme = globals .theme )
862+ app = pgu_override .MyApp (theme = shared .theme )
863863 else :
864864 import pgu
865- app = pgu .gui .App (theme = globals .theme )
865+ app = pgu .gui .App (theme = shared .theme )
866866 worlds = []
867867 ts = [threading .Thread (target = get_world , args = (world , worlds )) for world in worldnames ]
868868 tuple (t .start () for t in ts )
@@ -994,7 +994,7 @@ def display_worlds(optionchange = False):
994994 print ("GUI Matrix created, initializing.." )
995995 pygame .display .quit ()
996996 pygame .display .init ()
997- pygame .display .set_caption ("Terraria Omnitool V%s | %d Bit" % (globals .__version__ .__repr__ (), bit ))
997+ pygame .display .set_caption ("Terraria Omnitool V%s | %d Bit" % (shared .__version__ .__repr__ (), bit ))
998998
999999 def make_resize (worlds , app , main ):
10001000 def resize (self , ev ):
0 commit comments