46 |
("Schleswig-Holstein", 9), |
("Schleswig-Holstein", 9), |
47 |
("Th�ringen", 9)] |
("Th�ringen", 9)] |
48 |
|
|
|
root.title("Lohnrechner 2005 - v%s" % _release_version) |
|
|
root.resizable(NO, NO) |
|
49 |
self.root = root |
self.root = root |
50 |
|
|
51 |
|
self.root.title("Lohnrechner 2005 - v%s" % _release_version) |
52 |
|
|
53 |
|
self.SetupUI() |
54 |
|
self.ResetInput() |
55 |
|
|
56 |
|
def SetupUI(self): |
57 |
|
self.root.resizable(NO, NO) |
58 |
|
|
59 |
frame = Frame(root) |
frame = Frame(root) |
60 |
frame.grid(padx=10, pady=10) |
frame.grid(padx=10, pady=10) |
61 |
|
|
62 |
|
# Steuern Ein/Ausgabe |
63 |
Label(frame, text="Lohn:").grid(row=0, sticky=E) |
Label(frame, text="Lohn:").grid(row=0, sticky=E) |
64 |
self.lohn = Entry(frame) |
self.lohn = Entry(frame) |
65 |
self.lohn.bind("<Return>", self.NewInput) |
self.lohn.bind("<Return>", self.NewInput) |
76 |
("V", 5), |
("V", 5), |
77 |
("VI", 6)]: |
("VI", 6)]: |
78 |
stklradio = Radiobutton(stklframe, text=text, value=val, |
stklradio = Radiobutton(stklframe, text=text, value=val, |
79 |
indicatoron=0, command=self.CalcOutput, |
indicatoron=0, command=self.NewInput, |
80 |
variable=self.stkl) |
variable=self.stkl) |
81 |
if text == "I": |
if text == "I": |
82 |
stklradio.select() |
stklradio.select() |
85 |
Label(frame, text="Kirchensteuer:").grid(row=2, sticky=E) |
Label(frame, text="Kirchensteuer:").grid(row=2, sticky=E) |
86 |
self.kirche = IntVar() |
self.kirche = IntVar() |
87 |
kircheradio = Checkbutton(frame, onvalue=1, offvalue=0, |
kircheradio = Checkbutton(frame, onvalue=1, offvalue=0, |
88 |
command=self.CalcOutput, |
command=self.NewInput, |
89 |
variable=self.kirche).grid(row=2, column=1, sticky=W) |
variable=self.kirche).grid(row=2, column=1, |
90 |
|
sticky=W) |
91 |
|
|
92 |
Label(frame, text="Kinderfreibetrag:").grid(row=3, sticky=E) |
Label(frame, text="Kinderfreibetrag:").grid(row=3, sticky=E) |
93 |
self.kfb = Entry(frame) |
self.kfb = Entry(frame) |
97 |
Label(frame, text="Bundesland:").grid(row=4, sticky=E) |
Label(frame, text="Bundesland:").grid(row=4, sticky=E) |
98 |
landframe = Frame(frame) |
landframe = Frame(frame) |
99 |
scrollbar = Scrollbar(landframe, orient=VERTICAL) |
scrollbar = Scrollbar(landframe, orient=VERTICAL) |
100 |
self.land = Listbox(landframe, height=4, selectmode=SINGLE, |
self.landbox = Listbox(landframe, height=4, selectmode=SINGLE, |
101 |
yscrollcommand=scrollbar.set) |
yscrollcommand=scrollbar.set) |
102 |
for land in self.laender: |
for land in self.laender: |
103 |
self.land.insert(END, land[0]) |
self.landbox.insert(END, land[0]) |
104 |
self.land.select_set(0) |
self.landbox.select_set(0) |
105 |
self.land.bind("<<ListboxSelect>>", self.NewInput) |
self.landbox.bind("<<ListboxSelect>>", self.NewLandSel) |
106 |
self.land.pack(side=RIGHT, fill=Y) |
self.landbox.pack(side=RIGHT, fill=Y) |
107 |
scrollbar.config(command=self.land.yview) |
scrollbar.config(command=self.landbox.yview) |
108 |
scrollbar.pack(side=LEFT, fill=BOTH, expand=1) |
scrollbar.pack(side=LEFT, fill=BOTH, expand=1) |
109 |
landframe.grid(row=4, column=1, sticky=W) |
landframe.grid(row=4, column=1, sticky=W) |
110 |
|
|
|
self.ResetInput() |
|
|
|
|
111 |
Label(frame, text="Lohnsteuer:").grid(row=0, column=2, sticky=E) |
Label(frame, text="Lohnsteuer:").grid(row=0, column=2, sticky=E) |
112 |
self.lst = Entry(frame) |
self.lst = Entry(frame) |
113 |
self.lst.grid(row=0, column=3, sticky=W) |
self.lst.grid(row=0, column=3, sticky=W) |
120 |
self.kist = Entry(frame) |
self.kist = Entry(frame) |
121 |
self.kist.grid(row=2, column=3, sticky=W) |
self.kist.grid(row=2, column=3, sticky=W) |
122 |
|
|
123 |
|
Label(frame, text="Lohn nach Steuern:").grid(row=3, column=2, sticky=E) |
124 |
|
self.netto = Entry(frame) |
125 |
|
self.netto.grid(row=3, column=3, sticky=W) |
126 |
|
|
127 |
|
# Allgemeine UI Elemente |
128 |
buttons = Frame(frame) |
buttons = Frame(frame) |
129 |
buttons.grid(row=4, column=2, columnspan=2) |
buttons.grid(row=4, column=2, columnspan=2) |
130 |
Button(buttons, text="Quit", command=root.quit).pack(side=LEFT) |
Button(buttons, text="Quit", command=root.quit).pack(side=LEFT) |
131 |
Button(buttons, text="Info", command=self.Info).pack(side=LEFT) |
Button(buttons, text="Info", command=self.Info).pack(side=LEFT) |
132 |
Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT) |
Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT) |
133 |
|
|
134 |
|
def NewInput(self, event=0): |
135 |
|
# Es ist m�glich alle Eintr�ge in der Listbox zu deselektieren, |
136 |
|
# es ist aber immer genau ein Eintrag aktuell, darum wird er ggf. |
137 |
|
# zwangsselektiert: |
138 |
|
# FIX ME: eigendlich w�re das ein Fall f�r ein custom widget! |
139 |
|
if len(self.landbox.curselection()) == 0: |
140 |
|
self.landbox.select_set(self.land) |
141 |
self.CalcOutput() |
self.CalcOutput() |
142 |
|
|
143 |
def NewInput(self, event): |
def UpdateLand(self): |
144 |
|
self.land = int(self.landbox.curselection()[0]) |
145 |
|
|
146 |
|
def NewLandSel(self, event=0): |
147 |
|
self.UpdateLand() |
148 |
self.CalcOutput() |
self.CalcOutput() |
149 |
|
|
150 |
def ResetInput(self): |
def ResetInput(self): |
151 |
self.ResetInputLohn() |
self.ResetInputLohn() |
152 |
self.ResetInputKfb() |
self.ResetInputKfb() |
153 |
|
self.NewLandSel() |
154 |
|
|
155 |
def ResetInputLohn(self): |
def ResetInputLohn(self): |
156 |
self.lohn.delete(0, END) |
self.lohn.delete(0, END) |
172 |
self.ResetInputKfb() |
self.ResetInputKfb() |
173 |
|
|
174 |
self.SetSteuerklasse(self.stkl.get()) |
self.SetSteuerklasse(self.stkl.get()) |
175 |
self.SetKirchensteuer(self.kirche.get() * |
self.SetKirchensteuerProzent(self.kirche.get() * |
176 |
self.laender[int(self.land.curselection()[0])][1]) |
self.laender[self.land][1]) |
177 |
|
|
178 |
def CalcOutput(self): |
def CalcOutput(self): |
179 |
self.InitCalc() |
self.InitCalc() |
180 |
self.Calc() |
self.Calc() |
181 |
self.lst.delete(0, END) |
self.lst.delete(0, END) |
182 |
self.lst.insert(0, "%.2f" % self.GetLohnsteuer()) |
self.lst.insert(0, "%.2f" % self.GetLohnsteuer()) |
183 |
self.soli.delete(0, END) |
self.soli.delete(0, END) |
184 |
self.soli.insert(0, "%.2f" % self.GetSoli()) |
self.soli.insert(0, "%.2f" % self.GetSoli()) |
185 |
self.kist.delete(0, END) |
self.kist.delete(0, END) |
186 |
self.kist.insert(0, "%.2f" % self.GetKirchensteuer()) |
self.kist.insert(0, "%.2f" % self.GetKirchensteuer()) |
187 |
|
self.netto.delete(0, END) |
188 |
|
self.netto.insert(0, "%.2f" % |
189 |
|
(self.GetLohn() - self.GetLohnsteuer() |
190 |
|
- self.GetSoli() - self.GetKirchensteuer())) |
191 |
|
|
192 |
def Info(self): |
def Info(self): |
193 |
infowin = Toplevel(self.root) |
infowin = Toplevel(self.root) |
208 |
root = Tk() |
root = Tk() |
209 |
lr = Lohnrechner(root) |
lr = Lohnrechner(root) |
210 |
root.mainloop() |
root.mainloop() |
|
|
|