From 50bea8f10c3b9d42a953ccd24807fbd67df03ab8 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 29 Apr 2015 09:57:12 +0200 Subject: [PATCH] Small Fixes Roundup -Force-Added colorsys module to frozen exe -Fixed outdated tedit name -Added Tool Interlinking Feedback -Fixed delayed zipbuilder output --- omnisetup.py | 2 +- omnitool.py | 24 +++++++++++++++++------- plugins/worldify.py | 32 +++----------------------------- setup.iss | 2 +- setup64.iss | 2 +- zipbuilder.py | 2 ++ 6 files changed, 25 insertions(+), 39 deletions(-) diff --git a/omnisetup.py b/omnisetup.py index cc6e9cf..f2fb3d1 100644 --- a/omnisetup.py +++ b/omnisetup.py @@ -22,7 +22,7 @@ executables=[EXE], options={"build_exe": {"excludes": ["OpenGL", "tkinter", "tcl"], "packages": ["multiprocessing"], - "includes" : ("loadbar",)} + "includes" : ("loadbar","colorsys")} } ) not_needed = ("pygame.movie.pyd", "pygame.mixer_music.pyd", "pygame.mixer.pyd", diff --git a/omnitool.py b/omnitool.py index 278cbd5..019ebdf 100644 --- a/omnitool.py +++ b/omnitool.py @@ -1,6 +1,6 @@ #! python3.4-32 from version import Version -__version__ = Version(170300) +__version__ = Version(170400) __author__ = "Fabian Dill" __credits__ = ["Ijwu", "7UR7L3", "Fabian Dill"] __maintainer__ = "Fabian Dill" @@ -202,18 +202,28 @@ def save_cache(): cmod = False if len(sys.argv) > 1: #user wants something - if sys.argv[1].split("\\")[-1] == "TEdit.exe": #install tedit - cache["tedit"] = sys.argv[1] - print("Learned TEdit path: " + sys.argv[1]) + def savequit(): + import time + time.sleep(3) save_cache() pygame.quit() sys.exit() + + if sys.argv[1].split("\\")[-1] == "TEditXna.exe": #install tedit + cache["tedit"] = sys.argv[1] + print("Learned TEdit path: " + sys.argv[1]) + savequit() + elif sys.argv[1].split("\\")[-1] == "Terrafirma.exe": #install tedit cache["terrafirma"] = sys.argv[1] print("Learned terrafirma path: " + sys.argv[1]) - save_cache() - pygame.quit() - sys.exit() + savequit() + +if getattr(sys, 'frozen', False): + os.chdir(os.path.dirname(sys.executable)) +else: + os.chdir(os.path.dirname(os.path.realpath(__file__))) + myterraria = get_myterraria() #mygames-terraria path images = os.path.join(myterraria, "WorldImages") if __name__ == "__main__": diff --git a/plugins/worldify.py b/plugins/worldify.py index 2ce2ad2..576fb4b 100644 --- a/plugins/worldify.py +++ b/plugins/worldify.py @@ -15,12 +15,9 @@ import database as db import colorlib from tlib import * -from tinterface import get_next_world -from binarysplit import join -from random import randint from time import sleep -from os.path import join as osjoin import tempfile +import colorsys from pgu_override import MyFileDialog @@ -236,9 +233,6 @@ def update(slider, label): 'ID': 1394008880, 'moonphase': 0, 'name': name, 'is_a_shadow_orb_broken': 0, 'time': 13500, "hardmode": 0, "altars_broken": 0, } - #with open(osjoin(temp, "0.part"), "wb") as f:#write the header - # set_header(f, header) - #print ("done writing header") #sounds cool import time @@ -302,7 +296,7 @@ def rgb(a, surface, rcolors, weight=None): def hsv(a, surface, rcolors, weight=(2, 3, 1)): #hue saturation value/brightness - import colorsys + hcolors = {} for color in rcolors: @@ -337,7 +331,7 @@ def hsv(a, surface, rcolors, weight=(2, 3, 1)): start = time.clock() self.tiles = tempfile.TemporaryFile() - #with open(osjoin(temp, "1.part") , "wb") as a:#write the tile data + if func == "RGB": print("Finding closest match via euclidian RGB distance") rgb(self.tiles, surface, rcolors) @@ -348,30 +342,10 @@ def hsv(a, surface, rcolors, weight=(2, 3, 1)): n = (t, t / (w * h)) print("%5f seconds taken, that is %0.10f seconds per pixel" % n) self.chests = [None] * 1000 - #with open(osjoin(temp, "2.part"), "wb") as a:#write chestdata - # set_chests(a,[None]*1000) - #print ("done writing chests") - #with open(osjoin(temp, "3.part"), "wb") as f: - # for sign in [None]*1000: - # set_sign(f, sign) self.signs = [None] * 1000 - #print ("done writing signs") - #with open(osjoin(temp, "4.part"), "wb") as f: - # set_npc(f, ('Guide', (header["spawn"][0]*16, (header["spawn"][1]-3)*16), 1, (header["spawn"][0], header["spawn"][1]-3))) - # set_npc(f, None) - # set_npc_names(f, db.names) self.names = db.names self.npcs = [('Guide', (self.header["spawn"][0] * 16, (self.header["spawn"][1] - 3) * 16), 1, (self.header["spawn"][0], self.header["spawn"][1] - 3))] - #print ("done writing npcs") - #with open(osjoin(temp, "5.part"), "wb") as f: - # set_trail(f, (1, header["name"], header["ID"])) - #print ("done writing trail") - #name = get_next_world(db.cmod) - #join(name, True, path = temp)#this just puts all the binary parts into one world file - #print ("done joining world "+name)#yay! - #print ("A world has been created!") - #sleep(3) if __name__ == "__main__": diff --git a/setup.iss b/setup.iss index fba363e..36b6b09 100644 --- a/setup.iss +++ b/setup.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "Omnitool" -#define MyAppVersion "17.3.0" +#define MyAppVersion "17.4.0" #define MyAppPublisher "Fabian Dill" #define MyAppURL "http://www.terrariaonline.com/threads/omnitool-world-mapping-backups-creation-and-more-released.61654/" #define MyAppExeName "omnitool.exe" diff --git a/setup64.iss b/setup64.iss index d3b9b50..052b3e3 100644 --- a/setup64.iss +++ b/setup64.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "Omnitool" -#define MyAppVersion "17.3.0" +#define MyAppVersion "17.4.0" #define MyAppPublisher "Fabian Dill" #define MyAppURL "http://www.terrariaonline.com/threads/omnitool-world-mapping-backups-creation-and-more-released.61654/" #define MyAppExeName "omnitool.exe" diff --git a/zipbuilder.py b/zipbuilder.py index 7015e9f..76694c7 100644 --- a/zipbuilder.py +++ b/zipbuilder.py @@ -3,6 +3,8 @@ import os print("Zipping content files...", end="") +import sys +sys.stdout.flush() with ZipFile(os.path.join("build", "content.lzma"), "w", ZIP_LZMA) as Z: for file in os.listdir("tImages"):