def createNominalInfo(self): self.infoFrame = Frame(self.window) self.infoFrame.grid(row=1, column=1, sticky="s,w,e") Label(self.infoFrame, text="overall nominal / delta:").grid(row=0, column=0) Label(self.infoFrame, text="Displayed:").grid(row=0, column=1) Label(self.infoFrame, textvariable=self.totalNomDisplayed).grid(row=0, column=2) i = 3 for type in itemTypes: var = StringVar() deltaStart = StringVar() self.startNominals.append(dao.getNominalByType(type)) var.set(dao.getNominalByType(type)) self.nomVars.append(var) deltaStart.set(0) self.deltaNom.append(deltaStart) Label(self.infoFrame, text=type.capitalize() + ":").grid(row=0, column=i) Label(self.infoFrame, textvariable=var).grid(row=0, column=i + 1) Label(self.infoFrame, text="/").grid(row=0, column=i + 2) Label(self.infoFrame, textvariable=deltaStart).grid(row=0, column=i + 3) i += 4
def testDB(self): self.passParams() try: dao.getNominalByType("gun") windows.connectionSuccess(self.window) except Exception as e: windows.showError(self.window, "Error", "Failed to connect:\n" + str(e)) windows.deleteParams()
def checkForDatabase(self): try: dao.getNominalByType("weapon") self.connectionOK = True except Exception: self.window.withdraw() self.openConnectionWindow() self.window.deiconify() try: dao.getSubtypes() except Exception: windows.showUpgradeError(self.window) if windows.askUser("Upgrade", "Do you want to upgrade your Database?"): self.upgradeDB()
def updateNominalInfo(self): for i in range(len(self.nomVars)): nominal = dao.getNominalByType(itemTypes[i]) self.nomVars[i].set(nominal) try: self.deltaNom[i].set(nominal - self.startNominals[i]) except TypeError: self.deltaNom[i].set(nominal)
def createDistibutionBlock(self): self.distribution = LabelFrame(self.buttons, text="Rarity Distribution") self.distribution.grid(row=5, column=0, padx=20, pady=20) Label(self.distribution, text="By Displayed Items").grid(row=0, columnspan=2) Label(self.distribution, text="Target Nominal").grid(row=1, columnspan=2) self.desiredNomEntry = Entry(self.distribution, textvariable=self.totalNomDisplayed, width=14) \ .grid(row=2, columnspan=2, pady=7) self.inclAmmo = IntVar() Checkbutton(self.distribution, text='Ammo', variable=self.inclAmmo).grid(row=3, sticky=W) self.inclMags = IntVar() Checkbutton(self.distribution, text='Mags', variable=self.inclMags).grid(row=4, sticky=W) self.targetAmmo = StringVar() self.targetAmmo.set(str(dao.getNominalByType("ammo"))) self.targetAmmoEntry = Entry(self.distribution, textvariable=self.targetAmmo, width=5) self.targetAmmoEntry.grid(row=3, column=1, sticky=W) self.targetMag = StringVar() self.targetMag.set(str(dao.getNominalByType("mag"))) self.targetMagEntry = Entry(self.distribution, textvariable=self.targetMag, width=5) self.targetMagEntry.grid(row=4, column=1, sticky=W) Button(self.distribution, text="Distribute", width=12, command=self.distribute).grid(row=7, columnspan=2, pady=10)
def updateDistribution(self): self.targetMag.set(str(dao.getNominalByType("mag")))