--- trunk/RCS/lohnrechner.py 2005/01/13 11:39:49 12 +++ trunk/RCS/lohnrechner.py 2005/01/13 15:51:34 17 @@ -27,6 +27,8 @@ LST2005.LStRechner2005.__init__(self) root.title("Lohnrechner 2005 - v%s" % _release_version) + root.resizable(NO, NO) + self.root = root Label(root, text="Lohn:").grid(row=0, sticky=E) self.lohn = Entry(root) @@ -51,9 +53,18 @@ stklradio.pack(side=LEFT) Label(root, text="Kirchensteuer (%):").grid(row=2, sticky=E) - self.kirche = Entry(root) - self.kirche.bind("", self.NewInput) - self.kirche.grid(row=2, column=1, sticky=W) + self.kirche = StringVar() + kircheframe = Frame(root) + kircheframe.grid(row=2, column=1, sticky=W) + for text, val in [("keine", "0"), + ("8 %", "8"), + ("9 %", "9")]: + kircheradio = Radiobutton(kircheframe, text=text, value=val, + indicatoron=0, command=self.CalcOutput, + variable=self.kirche) + if val == "0": + kircheradio.select() + kircheradio.pack(side=LEFT) self.ResetInput() @@ -66,11 +77,14 @@ self.soli.grid(row=1, column=3, sticky=W) Label(root, text="Kirchensteuer:").grid(row=2, column=2, sticky=E) - self.kirchest = Entry(root) - self.kirchest.grid(row=2, column=3, sticky=W) + self.kist = Entry(root) + self.kist.grid(row=2, column=3, sticky=W) - self.calcbutton = Button(root, text="Berechnen", command=self.CalcOutput) - self.calcbutton.grid(row=3, columnspan=4) + buttons = Frame() + buttons.grid(row=3, columnspan=4) + Button(buttons, text="Quit", command=root.quit).pack(side=LEFT) + Button(buttons, text="Info", command=self.Info).pack(side=LEFT) + Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT) self.CalcOutput() @@ -79,28 +93,19 @@ def ResetInput(self): self.ResetInputLohn() - self.ResetInputKirche() def ResetInputLohn(self): self.lohn.delete(0, END) self.lohn.insert(0, "0") - def ResetInputKirche(self): - self.kirche.delete(0, END) - self.kirche.insert(0, "0") - def InitCalc(self): try: self.SetLohn(float(self.lohn.get())) except: self.ResetInputLohn() - try: - self.SetKirchensteuer(float(self.kirche.get())) - except: - self.ResetInputKirche() - self.SetSteuerklasse(int(self.stkl.get())) + self.SetKirchensteuer(int(self.kirche.get())) def CalcOutput(self): self.InitCalc() @@ -109,8 +114,22 @@ self.lst.insert(0, "%.2f" % self.GetLohnsteuer()) self.soli.delete(0, END) self.soli.insert(0, "%.2f" % self.GetSoli()) - self.kirchest.delete(0, END) - self.kirchest.insert(0, "%.2f" % self.GetKirchensteuer()) + self.kist.delete(0, END) + self.kist.insert(0, "%.2f" % self.GetKirchensteuer()) + + def Info(self): + infowin = Toplevel(self.root) + infowin.title("Info") + Label(infowin, text="Lohnrechner 2005 %s" % _release_version, + font=("Times", 14, "bold italic")).grid(row=0, pady=20) + Label(infowin, text= + "Copyright (C) 2005 Intevation GmbH \n\n\ +Lohnrechner 2005 comes with ABSOLUTELY NO WARRANTY.\n\ +This is free software, and you are welcome to redistribute it\n\ +under the terms of the GNU General Public License.\n\ +For more information about these matters, see the file named COPYING.\n\n\ +Dieses Programm verwendet LST2005 %s" % LST2005._ModulVersion()).grid(row=1, padx=10) + Button(infowin, text="Ok", command=infowin.destroy).grid(row=2, pady=10) if __name__ == "__main__":