init python: if not renpy.android: import zipfile import _renpytfd import os def testGetDrawingCompat(): #If we're using a UNIX, check if we have a tinyfiledialog compatiable program, if we don't, return error code 2. if renpy.linux: import shutil compatiblePrograms = ["applescript", "kdialog", "yad", "xdialog", "zenity", "matedialog", "shellementary", "qarma"] newlist = [program for program in compatiblePrograms if shutil.which(program)] if not newlist: return 1 return 0 def saveDrawings(): exportloc = _renpytfd.saveFileDialog("Select A File Destination", "wani-drawings.zip", [], None) try: with zipfile.ZipFile(exportloc, 'w') as imgexport: if type(waniDemoCarryover.Chapter3Drawing) == bytes: imgexport.writestr("Chapter3Drawing.png", waniDemoCarryover.Chapter3Drawing) if type(waniDemoCarryover.Chapter19Drawing) == bytes: imgexport.writestr("Chapter19Drawing.png", waniDemoCarryover.Chapter19Drawing) imgexport.close() except: return 1 def getDrawing(): wani_demo_install = getProbableDemoInstall() fileloc = _renpytfd.openFileDialog("Select Your file", wani_demo_install, ["*.png", ""], None, False) return fileloc def getProbableDemoInstall(): # This is only for the steam install since that's the only install we can predict with some degree of accuracy rv = None demo_folder = "I Wani Hug that Gator! Demo" if renpy.windows: to_check = [ fr"C:\Program Files (x86)\Steam\steamapps\common\{demo_folder}\\", fr"C:\Program Files\Steam\steamapps\common\{demo_folder}\\", ] elif renpy.linux: to_check = [ os.path.expanduser(f"~/.steam/steam/steamapps/common/{demo_folder}/"), ] elif renpy.macintosh: to_check = [ os.path.expanduser(f"~/Library/Application Support/Steam/steamapps/common/{demo_folder}/"), ] else: return None for path in to_check: if os.path.exists(path): rv = path break return rv def saveDrawing(drawing): import shutil from os import path exportloc = _renpytfd.saveFileDialog("Select A File Destination", "My Creation.png", ["*.png", ""], None) folder = path.join(renpy.config.gamedir, drawing) if renpy.windows: # Windows dgaf folder = folder.replace("\\", "/") if not config.developer: try: shutil.copyfile(renpy.fsencode(folder), exportloc) except: return 1 else: shutil.copyfile(renpy.fsencode(folder), exportloc) return