How to use the py2app.iOSAppIconGenerator.Data.save_path function in py2app

To help you get started, we’ve selected a few py2app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dorukgezici / iOSAppIconGenerator / py2app / iOSAppIconGenerator.py View on Github external
def run():
    if Data.image_path == "":
        output_label["text"] = "Choose the image file first."
        return
    if os.access("{}/AppIcon.appiconset".format(Data.save_path), os.W_OK) == False:
        os.mkdir("{}/AppIcon.appiconset".format(Data.save_path))
    file = open("{}/AppIcon.appiconset/Contents.json".format(Data.save_path), mode="w")
    json.dump(json_data, file, indent=4, sort_keys=True, separators=(',', ':'))
    file.close()

    with open("{}/AppIcon.appiconset/Contents.json".format(Data.save_path), mode="r") as data_file:
        data = json.load(data_file)
        images = data["images"]
        try:
            im = Image.open(Data.image_path)
            output_label["text"] = "Image specs: {} {} {}\n{}\n".format(im.format, im.size, im.mode, "-"*35)
            for image in images:
                size = get_size(image)
                out = im.resize(size, Image.ANTIALIAS)
                out.save("{}/AppIcon.appiconset/{}".format(Data.save_path, image["filename"]), format="PNG")
                output_label["text"] += "Image generated: {}\n".format(size)
            open_saved_button.grid(row=1, column=0, columnspan=2, sticky=tk.W+tk.E)
        except IOError:
            output_label["text"] = "Please select a supported image file."
github dorukgezici / iOSAppIconGenerator / py2app / iOSAppIconGenerator.py View on Github external
def get_save_path():
    Data.save_path = askdirectory()
    chosen_save_path_label["text"] = Data.save_path
    return Data.save_path
github dorukgezici / iOSAppIconGenerator / py2app / iOSAppIconGenerator.py View on Github external
def clear():
    Data.image_path = ""
    Data.save_path = os.path.dirname(__file__)
    output_label["text"] = ""
    chosen_file_path_label["text"] = ""
    chosen_save_path_label["text"] = ""
    open_saved_button.grid_remove()
    if ".app" in Data.save_path:
        while not Data.save_path.endswith(".app"):
            Data.save_path = os.path.dirname(Data.save_path)
github dorukgezici / iOSAppIconGenerator / py2app / iOSAppIconGenerator.py View on Github external
def get_save_path():
    Data.save_path = askdirectory()
    chosen_save_path_label["text"] = Data.save_path
    return Data.save_path
github dorukgezici / iOSAppIconGenerator / py2app / iOSAppIconGenerator.py View on Github external
def clear():
    Data.image_path = ""
    Data.save_path = os.path.dirname(__file__)
    output_label["text"] = ""
    chosen_file_path_label["text"] = ""
    chosen_save_path_label["text"] = ""
    open_saved_button.grid_remove()
    if ".app" in Data.save_path:
        while not Data.save_path.endswith(".app"):
            Data.save_path = os.path.dirname(Data.save_path)
github dorukgezici / iOSAppIconGenerator / py2app / iOSAppIconGenerator.py View on Github external
def get_save_path():
    Data.save_path = askdirectory()
    chosen_save_path_label["text"] = Data.save_path
    return Data.save_path
github dorukgezici / iOSAppIconGenerator / py2app / iOSAppIconGenerator.py View on Github external
def clear():
    Data.image_path = ""
    Data.save_path = os.path.dirname(__file__)
    output_label["text"] = ""
    chosen_file_path_label["text"] = ""
    chosen_save_path_label["text"] = ""
    open_saved_button.grid_remove()
    if ".app" in Data.save_path:
        while not Data.save_path.endswith(".app"):
            Data.save_path = os.path.dirname(Data.save_path)