def populate_account_frame(self, event=None): if event: self.account_frame.destroy() self.account_frame = ttk.Frame(self.account_tab, style="TNotebook", borderwidth=0) self.account_frame.grid(column=1, row=1) ttk.Label(self.account_frame, text="Softcore").grid(column=1, row=1, sticky='E', padx=128) ttk.Label(self.account_frame, text="Hardcore").grid(column=2, row=1, sticky='W') ttk.Label(self.account_frame, text="Paragon Level").grid(column=0, row=1, sticky='W') ttk.Label(self.account_frame, text="Rift Level").grid(column=0, row=2, sticky='W') currency_list = db.get_currency_list() for ids, currency in currency_list: ttk.Label(self.account_frame, text=currency).grid(column=0, row=(int(ids) + 5), sticky='W') offset = 0 if self.active_partition.get() == "Season": offset = 2 for m in (0, 1): coffset = str(offset + m) column = (1 + m) cp = self.part_textvars[coffset] ttk.Entry(self.account_frame, textvariable=cp['plvl']).grid(column=column, row=1, sticky='E') ttk.Entry(self.account_frame, textvariable=cp['rift']).grid(column=column, row=2, sticky='E') cc = cp['currencies'] for ids in cc.keys(): idi = int(ids) ttk.Entry(self.account_frame, textvariable=cc[ids]).grid(column=column, row=(idi + 5), sticky='E')
from pb2_resources import Hero_pb2, Account_pb2 import db import glob from os.path import dirname, basename from save_manager import save_handler from save_manager import item_handler from struct import pack currency_list = {str(k): v for (k, v) in db.get_currency_list()} class SaveData(object): def __init__(self, account_file, output_file=None): self.account_file = account_file self.save_folder = dirname(self.account_file) self.hero_files = glob.glob('{}/heroes/*.dat'.format(self.save_folder)) self.output_file = output_file self.account_file = account_file # load encrypted save data self.account_enc = save_handler.load_encrypted_file(self.account_file) self.account_dec = save_handler.decrypt_save(self.account_enc) # load saved definition self.asd = Account_pb2.SavedDefinition() # parse decrypted save definitions self.asd.ParseFromString(self.account_dec) # load currency information self.currency_names = self.load_currencies() self.last_played_hero_id = save_handler.hexlify( pack(">Q", self.asd.digest.last_played_hero_id.id_low)) # load last played hero