Recreating History p4
This commit is contained in:
parent
c5002b6055
commit
9c6c6c749a
1 changed files with 84 additions and 102 deletions
186
SpellBurner.py
186
SpellBurner.py
|
|
@ -1,7 +1,7 @@
|
|||
# Burning Wheel - Spell Burner
|
||||
# By 2Shirt (Alan Mason)
|
||||
#
|
||||
# Version 0.04a
|
||||
# Version 0.05a
|
||||
from tkinter import *
|
||||
from tkinter import ttk
|
||||
from math import floor
|
||||
|
|
@ -87,7 +87,7 @@ def roundDown(x):
|
|||
def roundUp(x):
|
||||
return ceil(x)
|
||||
|
||||
class Facet(ttk.Frame):
|
||||
class Facet():
|
||||
def updateOptions(self, *args):
|
||||
try:
|
||||
self.optionSelect['values'] = sorted(facets[self.type.get()].keys())
|
||||
|
|
@ -104,8 +104,8 @@ class Facet(ttk.Frame):
|
|||
self.obCombobox = ttk.Combobox(self.obFrame, textvariable=self.ob, width=2)
|
||||
self.obCombobox['values'] = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||
self.obCombobox.state(['readonly'])
|
||||
self.obCombobox.bind('<<ComboboxSelected>>', self.parent.updateAll)
|
||||
self.obCombobox.grid(column=1, row=1, sticky=W)
|
||||
self.obCombobox.bind('<<ComboboxSelected>>', self.frame.updateAll)
|
||||
self.obCombobox.grid(column=1, row=1, sticky=(W, E))
|
||||
else:
|
||||
try:
|
||||
self.obCombobox.destroy()
|
||||
|
|
@ -113,31 +113,31 @@ class Facet(ttk.Frame):
|
|||
pass
|
||||
self.ob.set(facets[self.type.get()][self.option.get()]['Ob'])
|
||||
self.obLabel = ttk.Label(self.obFrame, textvariable=self.ob)
|
||||
self.obLabel.grid(column=1, row=1, sticky=W)
|
||||
self.obLabel.grid(column=1, row=1, sticky=(W, E))
|
||||
self.actions.set(facets[self.type.get()][self.option.get()]['Actions'])
|
||||
self.parent.updateAll()
|
||||
self.frame.updateAll()
|
||||
|
||||
def createWidgets(self):
|
||||
self.typeSelect = ttk.Combobox(self, textvariable=self.type)
|
||||
self.typeSelect = ttk.Combobox(self.frame, textvariable=self.type)
|
||||
self.typeSelect['values'] = sorted(facets.keys())
|
||||
self.typeSelect.state(['readonly'])
|
||||
self.typeSelect.bind('<<ComboboxSelected>>', self.updateOptions)
|
||||
self.typeSelect.grid(column=1, row=1, sticky=W)
|
||||
self.typeSelect.grid(column=1, row=self.row, columnspan=2, sticky=(W, E))
|
||||
|
||||
self.optionSelect = ttk.Combobox(self, textvariable=self.option)
|
||||
self.optionSelect = ttk.Combobox(self.frame, textvariable=self.option)
|
||||
self.optionSelect.state(['readonly'])
|
||||
self.optionSelect.bind('<<ComboboxSelected>>', self.updateStats)
|
||||
self.optionSelect.grid(column=2, row=1, sticky=W)
|
||||
self.optionSelect.grid(column=3, row=self.row, columnspan=2, sticky=(W, E))
|
||||
|
||||
self.obFrame = ttk.Labelframe(self, text='Ob', width=30)
|
||||
self.obFrame.grid(column=3, row=1, sticky=W)
|
||||
self.obFrame = ttk.Labelframe(self.frame, text='Ob')
|
||||
self.obFrame.grid(column=5, row=self.row, sticky=(W, E))
|
||||
self.obLabel = ttk.Label(self.obFrame, textvariable=self.ob)
|
||||
self.obLabel.grid(column=1, row=1, sticky=W)
|
||||
self.obLabel.grid(column=1, row=1, sticky=(W, E))
|
||||
|
||||
self.actionsFrame = ttk.Labelframe(self, text='Actions')
|
||||
self.actionsFrame.grid(column=4, row=1, sticky=W)
|
||||
self.actionsFrame = ttk.Labelframe(self.frame, text='Actions')
|
||||
self.actionsFrame.grid(column=6, row=self.row, sticky=(W, E))
|
||||
self.actionsLabel = ttk.Label(self.actionsFrame, textvariable=self.actions)
|
||||
self.actionsLabel.grid(column=1, row=1, sticky=W)
|
||||
self.actionsLabel.grid(column=1, row=self.row, sticky=(W, E))
|
||||
|
||||
def getActions(self):
|
||||
return float(self.actions.get())
|
||||
|
|
@ -145,9 +145,9 @@ class Facet(ttk.Frame):
|
|||
def getOb(self):
|
||||
return float(self.ob.get())
|
||||
|
||||
def __init__(self, master, default=''):
|
||||
Frame.__init__(self, master)
|
||||
self.parent = master
|
||||
def __init__(self, frame, row, default=''):
|
||||
self.frame = frame
|
||||
self.row = row
|
||||
self.actions = StringVar()
|
||||
self.actions.set('0')
|
||||
self.ob = StringVar()
|
||||
|
|
@ -157,9 +157,8 @@ class Facet(ttk.Frame):
|
|||
self.type.set(default)
|
||||
self.createWidgets()
|
||||
self.updateOptions()
|
||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=0)
|
||||
|
||||
class Distiller(ttk.Frame):
|
||||
class Distiller():
|
||||
def updateStats(self, *args):
|
||||
self.obTmp = 0
|
||||
self.actionsTmp = 0
|
||||
|
|
@ -174,18 +173,22 @@ class Distiller(ttk.Frame):
|
|||
self.actions.set(str(self.actionsTmp/2))
|
||||
|
||||
def createWidgets(self):
|
||||
self.titleLabel = ttk.Label(self, text=self.title, justify='right')
|
||||
self.titleLabel.grid(column=1, row=1, columnspan=2, sticky=W)
|
||||
ttk.Separator(self.frame, orient=HORIZONTAL).grid(column=1, row=self.row, columnspan=6, sticky=(W, E))
|
||||
|
||||
self.obFrame = ttk.Labelframe(self, text='Ob')
|
||||
self.obFrame.grid(column=3, row=1, sticky=W)
|
||||
self.titleLabel = ttk.Label(self.frame, text=self.title, justify='right')
|
||||
self.titleLabel.grid(column=4, row=self.row + 1, sticky=(W, E))
|
||||
|
||||
self.obFrame = ttk.Labelframe(self.frame, text='Ob')
|
||||
self.obFrame.grid(column=5, row=self.row + 1, sticky=(W, E))
|
||||
self.obLabel = ttk.Label(self.obFrame, textvariable=self.ob)
|
||||
self.obLabel.grid(column=1, row=1, sticky=W)
|
||||
self.obLabel.grid(column=1, row=self.row + 1, sticky=(W, E))
|
||||
|
||||
self.actionsFrame = ttk.Labelframe(self, text='Actions')
|
||||
self.actionsFrame.grid(column=4, row=1, sticky=W)
|
||||
self.actionsFrame = ttk.Labelframe(self.frame, text='Actions')
|
||||
self.actionsFrame.grid(column=6, row=self.row + 1, sticky=(W, E))
|
||||
self.actionsLabel = ttk.Label(self.actionsFrame, textvariable=self.actions)
|
||||
self.actionsLabel.grid(column=1, row=1, sticky=W)
|
||||
self.actionsLabel.grid(column=1, row=self.row + 1, sticky=(W, E))
|
||||
|
||||
ttk.Separator(self.frame, orient=HORIZONTAL).grid(column=1, row=self.row + 2, columnspan=6, sticky=(W, E))
|
||||
|
||||
def getActions(self):
|
||||
return float(self.actions.get())
|
||||
|
|
@ -193,9 +196,9 @@ class Distiller(ttk.Frame):
|
|||
def getOb(self):
|
||||
return float(self.ob.get())
|
||||
|
||||
def __init__(self, master, title, tobedistilled, round='false', *args):
|
||||
Frame.__init__(self, master)
|
||||
self.parent = master
|
||||
def __init__(self, frame, row, title, tobedistilled, round='false', *args):
|
||||
self.frame = frame
|
||||
self.row = row
|
||||
self.title = title
|
||||
self.tobedistilled = tobedistilled
|
||||
self.round = round
|
||||
|
|
@ -203,13 +206,12 @@ class Distiller(ttk.Frame):
|
|||
self.ob = StringVar()
|
||||
self.createWidgets()
|
||||
self.updateStats()
|
||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=0)
|
||||
|
||||
class MajorisSigil(ttk.Frame):
|
||||
class MajorisSigil():
|
||||
|
||||
def addSigil(self, *args):
|
||||
self.addButton.destroy()
|
||||
self.parent.addSigil()
|
||||
self.frame.addSigil()
|
||||
|
||||
def toggleSigil(self, *args):
|
||||
self.ob.set('1')
|
||||
|
|
@ -239,24 +241,27 @@ class MajorisSigil(ttk.Frame):
|
|||
pass
|
||||
|
||||
def createWidgets(self):
|
||||
self.toggle = Checkbutton(self, text='Majoris Sigil', command=self.toggleSigil,
|
||||
self.toggle = Checkbutton(self.frame, text='Majoris Sigil', command=self.toggleSigil,
|
||||
variable=self.enabled, onvalue='1', offvalue='0')
|
||||
self.toggle.grid(column=1, row=1, sticky=W)
|
||||
self.toggle.grid(column=1, row=self.row, sticky=W)
|
||||
|
||||
self.obCombobox = ttk.Combobox(self, textvariable=self.ob)
|
||||
self.obCombobox = ttk.Combobox(self.frame, textvariable=self.ob, width=2)
|
||||
self.obCombobox.state(['readonly'])
|
||||
self.obCombobox['values'] = ('')
|
||||
self.obCombobox.bind('<<ComboboxSelected>>', self.parent.updateAll)
|
||||
self.obCombobox.grid(column=2, row=1, sticky=W)
|
||||
self.obCombobox.bind('<<ComboboxSelected>>', self.frame.updateAll)
|
||||
self.obCombobox.grid(column=2, row=self.row, sticky=W)
|
||||
self.obCombobox.state(['disabled'])
|
||||
|
||||
self.actionsEntry = ttk.Entry(self, validate='focusout',
|
||||
self.actionsLabel = ttk.Label(self.frame, text='Multiplier')
|
||||
self.actionsLabel.grid(column=3, row=self.row, sticky=W)
|
||||
|
||||
self.actionsEntry = ttk.Entry(self.frame, validate='focusout',
|
||||
validatecommand=self.validateMultiplier, width=4)
|
||||
self.actionsEntry.grid(column=3, row=1, sticky=W)
|
||||
self.actionsEntry.grid(column=4, row=self.row, sticky=(W, E))
|
||||
self.actionsEntry.state(['disabled'])
|
||||
|
||||
self.addButton = ttk.Button(self, text='+', command=self.addSigil)
|
||||
self.addButton.grid(column=4, row=1, sticky=W)
|
||||
self.addButton = ttk.Button(self.frame, text='+', command=self.addSigil, width=6)
|
||||
self.addButton.grid(column=5, row=self.row, sticky=(W, E))
|
||||
|
||||
def getMultiplier(self):
|
||||
if self.enabled == '1':
|
||||
|
|
@ -271,23 +276,22 @@ class MajorisSigil(ttk.Frame):
|
|||
return 0
|
||||
|
||||
|
||||
def __init__(self, master, *args):
|
||||
Frame.__init__(self, master)
|
||||
self.parent = master
|
||||
def __init__(self, frame, row, *args):
|
||||
self.frame = frame
|
||||
self.row = row
|
||||
self.multiplier = StringVar()
|
||||
self.enabled = StringVar()
|
||||
self.enabled.set('0')
|
||||
self.ob = StringVar()
|
||||
self.createWidgets()
|
||||
# self.updateStats()
|
||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=0)
|
||||
|
||||
class App(ttk.Frame):
|
||||
def addSigil(self, *args):
|
||||
self.i = self.i + 1
|
||||
if self.i < 17:
|
||||
self.sigils.append(MajorisSigil(self))
|
||||
self.sigils[-1].grid(column=1, row=self.i, sticky=W)
|
||||
if self.i < 35:
|
||||
self.sigils.append(MajorisSigil(self, self.i))
|
||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=2)
|
||||
|
||||
def updateAll(self, *args):
|
||||
#Distillations
|
||||
|
|
@ -301,101 +305,79 @@ class App(ttk.Frame):
|
|||
|
||||
def createWidgets(self):
|
||||
# 1st Distillation
|
||||
self.facet1 = Facet(self, 'Element')
|
||||
self.facet1.grid(column=1, row=1, sticky=W)
|
||||
self.facet2 = Facet(self, 'Impetus')
|
||||
self.facet2.grid(column=1, row=2, sticky=W)
|
||||
self.facet1 = Facet(self, 0, 'Element')
|
||||
self.facet2 = Facet(self, 1, 'Impetus')
|
||||
|
||||
self.distiller1 = Distiller(self, '1st Distillation',
|
||||
self.distiller1 = Distiller(self, 2, '1st Distillation',
|
||||
(self.facet1, self.facet2)
|
||||
)
|
||||
self.distiller1.grid(column=1, row=3, sticky=W)
|
||||
|
||||
# 2nd Distillation
|
||||
self.facet3 = Facet(self, 'Origin')
|
||||
self.facet3.grid(column=1, row=4, sticky=W)
|
||||
self.facet4 = Facet(self, 'Duration')
|
||||
self.facet4.grid(column=1, row=5, sticky=W)
|
||||
self.facet3 = Facet(self, 5, 'Origin')
|
||||
self.facet4 = Facet(self, 6, 'Duration')
|
||||
|
||||
self.distiller2 = Distiller(self, '2nd Distillation',
|
||||
self.distiller2 = Distiller(self, 7, '2nd Distillation',
|
||||
(self.facet3, self.facet4)
|
||||
)
|
||||
self.distiller2.grid(column=1, row=6, sticky=W)
|
||||
|
||||
# 3rd Distillation
|
||||
self.facet5 = Facet(self, 'Area of Effect')
|
||||
self.facet5.grid(column=1, row=7, sticky=W)
|
||||
self.facet6 = Facet(self)
|
||||
self.facet6.grid(column=1, row=8, sticky=W)
|
||||
self.facet7 = Facet(self)
|
||||
self.facet7.grid(column=1, row=9, sticky=W)
|
||||
self.facet5 = Facet(self, 10, 'Area of Effect')
|
||||
self.facet6 = Facet(self, 11)
|
||||
self.facet7 = Facet(self, 12)
|
||||
|
||||
self.distiller3 = Distiller(self, 'Final Distillation',
|
||||
self.distiller3 = Distiller(self, 20, 'Final Distillation',
|
||||
(self.distiller1, self.distiller2, self.facet5, self.facet6, self.facet7),
|
||||
round='true'
|
||||
)
|
||||
self.distiller3.grid(column=1, row=10, sticky=W)
|
||||
|
||||
# Adjustments - Cap & Minoris Sigil(S)
|
||||
self.frameCapMinoris = ttk.Frame(self)
|
||||
self.frameCapMinoris.grid(column=1, row=11, sticky=(N, W, E, S))
|
||||
self.frameCapMinoris.columnconfigure(0, weight=1)
|
||||
self.frameCapMinoris.rowconfigure(0, weight=1)
|
||||
|
||||
self.capCheckbutton = Checkbutton(self.frameCapMinoris, text='Cap', command=self.updateAll,
|
||||
# Adjustments - Cap & Minoris Sigil(S)
|
||||
self.capCheckbutton = Checkbutton(self, text='Cap', command=self.updateAll,
|
||||
variable=self.capValue, onvalue='1', offvalue='0')
|
||||
self.capCheckbutton.grid(column=1, row=1, sticky=W)
|
||||
self.capCheckbutton.grid(column=1, row=24, sticky=W)
|
||||
|
||||
self.minorisLabel = ttk.Label(self.frameCapMinoris, text='Minoris Sigils')
|
||||
self.minorisLabel.grid(column=3, row=1, sticky=E)
|
||||
self.minorisLabel = ttk.Label(self, text='Minoris Sigils')
|
||||
self.minorisLabel.grid(column=3, row=24, sticky=E)
|
||||
|
||||
self.minorisCombobox = ttk.Combobox(self.frameCapMinoris, textvariable=self.minorisValue)
|
||||
self.minorisCombobox = ttk.Combobox(self, textvariable=self.minorisValue, width=2)
|
||||
self.minorisCombobox.state(['readonly'])
|
||||
self.minorisCombobox['values'] = ('0')
|
||||
# self.minorisCombobox.bind('<<ComboboxSelected>>', self.updateStats)
|
||||
self.minorisCombobox.grid(column=4, row=1, sticky=E)
|
||||
self.minorisCombobox.grid(column=4, row=24, sticky=W)
|
||||
|
||||
# Adjustments - Majoris Sigil(S)
|
||||
self.i = self.i + 1
|
||||
self.sigils.append(MajorisSigil(self))
|
||||
self.sigils[-1].grid(column=1, row=self.i, sticky=W)
|
||||
self.sigils.append(MajorisSigil(self, self.i))
|
||||
|
||||
# Adjustments - Compress & Extend
|
||||
self.frameCompressExtend = ttk.Frame(self)
|
||||
self.frameCompressExtend.grid(column=1, row=17, sticky=(N, W, E, S))
|
||||
self.frameCompressExtend.columnconfigure(0, weight=1)
|
||||
self.frameCompressExtend.rowconfigure(0, weight=1)
|
||||
# Adjustments - Compress & Extend
|
||||
self.compressLabel = ttk.Label(self, text='Compressions')
|
||||
self.compressLabel.grid(column=1, row=35, sticky=W)
|
||||
|
||||
self.compressLabel = ttk.Label(self.frameCompressExtend, text='Compressions')
|
||||
self.compressLabel.grid(column=1, row=1, sticky=W)
|
||||
|
||||
self.compressCombobox = ttk.Combobox(self.frameCompressExtend, textvariable=self.compressValue)
|
||||
self.compressCombobox = ttk.Combobox(self, textvariable=self.compressValue, width=2)
|
||||
self.compressCombobox.state(['readonly'])
|
||||
self.compressCombobox['values'] = ('0')
|
||||
# self.compressCombobox.bind('<<ComboboxSelected>>', self.updateStats)
|
||||
self.compressCombobox.grid(column=2, row=1, sticky=W)
|
||||
self.compressCombobox.grid(column=2, row=35, sticky=W)
|
||||
|
||||
self.extendLabel = ttk.Label(self.frameCompressExtend, text='Extentions')
|
||||
self.extendLabel.grid(column=3, row=1, sticky=W)
|
||||
self.extendLabel = ttk.Label(self, text='Extentions')
|
||||
self.extendLabel.grid(column=3, row=35, sticky=W)
|
||||
|
||||
self.extendCombobox = ttk.Combobox(self.frameCompressExtend, textvariable=self.extendValue)
|
||||
self.extendCombobox = ttk.Combobox(self, textvariable=self.extendValue, width=2)
|
||||
self.extendCombobox.state(['readonly'])
|
||||
self.extendCombobox['values'] = ('0')
|
||||
# self.extendCombobox.bind('<<ComboboxSelected>>', self.updateStats)
|
||||
self.extendCombobox.grid(column=4, row=1, sticky=W)
|
||||
self.extendCombobox.grid(column=4, row=35, sticky=W)
|
||||
|
||||
# Final Spell Results
|
||||
# ToDO
|
||||
|
||||
def __init__(self, master):
|
||||
Frame.__init__(self, master)
|
||||
self.parent = master
|
||||
self.frame = master
|
||||
self.capValue = StringVar()
|
||||
self.capValue.set('0')
|
||||
self.compressValue = StringVar()
|
||||
self.extendValue = StringVar()
|
||||
self.minorisValue = StringVar()
|
||||
self.i = 11
|
||||
self.i = 25
|
||||
self.sigils = []
|
||||
self.createWidgets()
|
||||
self.updateAll()
|
||||
|
|
|
|||
Loading…
Reference in a new issue