How to use the tts.SaveType.save function in TTS

To help you get started, we’ve selected a few TTS 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 cwoac / TTS-Manager / tts_cli.py View on Github external
parser_export.add_argument("id",help="ID of mod/name of savegame to export.")
    parser_export.add_argument("-o","--output",help="Location/file to export to.")
    parser_export.add_argument("-f","--force",action="store_true",help="Force creation of export file.")
    parser_export.add_argument("-d","--download",action="store_true",help="Attempt to download missing cache files. (EXPERIMENTAL)")
    parser_export.set_defaults(func=self.do_export)

    # import command
    parser_import = subparsers.add_parser('import',help="Import a mod.",description="Import an previously exported mod.")
    parser_import.add_argument("file",help="Mod pak file to import.")
    parser_import.set_defaults(func=self.do_import)

    # download command
    parser_download = subparsers.add_parser('download',help='Download mod files.',description='Attempt to download any missing files for an installed mod.')
    group_download=parser_download.add_mutually_exclusive_group()
    group_download.add_argument("-w","--workshop",action="store_const",dest='save_type',metavar='save_type',const=tts.SaveType.workshop,help="ID is of workshop file.")
    group_download.add_argument("-s","--save",action="store_const",dest='save_type',metavar='save_type',const=tts.SaveType.save,help="ID is of savegame file.")
    group_download.add_argument("-c","--chest",action="store_const",dest='save_type',metavar='save_type',const=tts.SaveType.chest,help="ID is of chest file.")
    group_download_target=parser_download.add_mutually_exclusive_group(required=True)
    group_download_target.add_argument("-a","--all",action="store_true",help="Download all.")
    group_download_target.add_argument("id",nargs='?',help="ID of mod/name of savegame to download.")
    parser_download.set_defaults(func=self.do_download)

    # cache command
    parser_cache = subparsers.add_parser('cache',help='Work with the cache.')
    subparsers_cache = parser_cache.add_subparsers(dest='parser_cache',title='cache_command',description='Valid sub-commands.')
    subparsers_cache.required = True
    parser_cache_create = subparsers_cache.add_parser('create',help='(re)create cache directory')
    parser_cache_create.set_defaults(func=self.do_cache_create)

    # config command
    parser_config = subparsers.add_parser('config',help='Configure tts manager.')
    subparsers_config = parser_config.add_subparsers(dest='parser_config',title='config_command',description='Valid sub-commands.')
github cwoac / TTS-Manager / tts / filesystem.py View on Github external
def get_json_filename_type(self,basename):
    if os.path.isfile(os.path.join(self._workshop,basename+'.json')):
      return tts.SaveType.workshop
    if os.path.isfile(os.path.join(self._saves,basename+'.json')):
      return tts.SaveType.save
    if os.path.isfile(os.path.join(self._chest,basename+'.json')):
      return tts.SaveType.chest
    # TODO: error handling here
    return None
github cwoac / TTS-Manager / tts_manager.py View on Github external
def populate_manage_frame(self,frame):
    ttk.Label(frame,text="Select list source:").grid(row=0,sticky=Tk.W)
    self.save_type=Tk.IntVar()
    self.save_type.set(int(tts.SaveType.workshop))
    ttk.Radiobutton(frame,
                   text="Workshop",
                   variable=self.save_type,
                   value=int(tts.SaveType.workshop),
                   command=self.list_command).grid(row=0,column=1)
    ttk.Radiobutton(frame,
                   text="Save",
                   variable=self.save_type,
                   value=int(tts.SaveType.save),
                   command=self.list_command).grid(row=0,column=2)
    ttk.Radiobutton(frame,
                   text="Chest",
                   variable=self.save_type,
                   value=int(tts.SaveType.chest),
                   command=self.list_command).grid(row=0,column=3)
    fl_frame=ttk.Frame(frame)
    fl_frame.grid(row=1,columnspan=4,sticky=Tk.N+Tk.S+Tk.E+Tk.W)
    ttk.Label(fl_frame,text="Files found:").pack()
    foundBar=ttk.Scrollbar(fl_frame,orient=Tk.VERTICAL)
    self.file_list_box=Tk.Listbox(fl_frame,yscrollcommand=foundBar.set)
    foundBar.config(command=self.file_list_box.yview)
    foundBar.pack(side=Tk.RIGHT,fill=Tk.Y)
    self.file_list_box.pack(side=Tk.LEFT,fill=Tk.BOTH,expand=Tk.Y)
    self.file_list_box.config(state=Tk.DISABLED)
github cwoac / TTS-Manager / tts_gui.py View on Github external
def download_all(self):
    successful=True
    save_type={1:tts.SaveType.workshop,
               2:tts.SaveType.save,
               3:tts.SaveType.chest}[self.download_sb.save_type.get()]
    for ident in self.download_sb.file_store.values():
      successful = tts.download_file(self.filesystem,ident,save_type)
      if not successful:
        break
    if successful:
      messagebox.showinfo("TTS Manager","All files downloaded successfully.")
    else:
      messagebox.showinfo("TTS Manager","Some downloads failed (see log).")
github cwoac / TTS-Manager / tts_gui.py View on Github external
self.filesystem = filesystem
    self.master=master
    srcFrame=ttk.Frame(master)
    srcFrame.pack()
    ttk.Label(srcFrame,text="Select list source:").pack()
    self.save_type=Tk.IntVar()
    self.save_type.set(int(tts.SaveType.workshop))
    ttk.Radiobutton(srcFrame,
                   text="Workshop",
                   variable=self.save_type,
                   value=int(tts.SaveType.workshop),
                   command=self.list_command).pack(side=Tk.LEFT)
    ttk.Radiobutton(srcFrame,
                   text="Save",
                   variable=self.save_type,
                   value=int(tts.SaveType.save),
                   command=self.list_command).pack(side=Tk.LEFT)
    ttk.Radiobutton(srcFrame,
                   text="Chest",
                   variable=self.save_type,
                   value=int(tts.SaveType.chest),
                   command=self.list_command).pack(side=Tk.LEFT)
    scrollFrame=ttk.Frame(master)
    scrollFrame.pack(expand=1,fill=Tk.BOTH)
    ttk.Label(scrollFrame,text="Files found:").pack()
    foundBar=ttk.Scrollbar(scrollFrame,orient=Tk.VERTICAL)
    self.file_list=Tk.Listbox(scrollFrame,yscrollcommand=foundBar.set)
    foundBar.config(command=self.file_list.yview)
    foundBar.pack(side=Tk.RIGHT,fill=Tk.Y)
    self.file_list.pack(side=Tk.LEFT,fill=Tk.BOTH,expand=Tk.Y)
    statusFrame=ttk.Frame(master)
    statusFrame.pack(expand=Tk.Y,fill=Tk.BOTH)
github cwoac / TTS-Manager / tts / filesystem.py View on Github external
def get_dir_by_type(self,save_type):
    st={
      tts.SaveType.workshop:self._workshop,
      tts.SaveType.save:self._saves,
      tts.SaveType.chest:self._chest
    }
    return st[save_type]