def calculate(self,event): for child in self.GetParent().GetParent().GetParent().bottomwindow.GetChildren(): child.Destroy() a = storage.loadSAccts() b = storage.loadLoans() nameS = BeautifulSoup(self.combo_box_1.GetValue()) nameL = BeautifulSoup(self.combo_box_2.GetValue()) text = "" monthly = self.inputTxt3.GetValue() M = self.inputTxt2.GetValue() for i in a: if BeautifulSoup(i.n) == nameS: for j in b: if BeautifulSoup(j.name) == nameL: val = Calculator.compareLS(j, i,float(monthly), int(M)) if isinstance(val, Savings.Savings): text = BeautifulSoup(i.n) else: text = BeautifulSoup(j.name) #text = "Hagstaedara er fyrir notanda ad greida upphaed \n" + monthly + " inn a "+ BeautifulSoup(j.name).encode('ascii') +" i" + M +" manudi,\n\'hagstaedara\' telst vera meiri eignir ad "+M + " manudum loknum" if text != "": first= unicode(BeautifulSoup("Hagstæðara er að greiða upphæð ")) M1 = unicode(BeautifulSoup(M)) amount = locale.currency(int(monthly), grouping = True) monthly1 = unicode(BeautifulSoup(amount)) second = unicode(BeautifulSoup("\ninn á ")) third = unicode(BeautifulSoup(" í ")) fourth = unicode(BeautifulSoup(" mánuði.")) text = unicode(text) someInfo = wx.StaticText(self.GetParent().GetParent().GetParent().bottomwindow,-1,first+monthly1+second+text+third+M1+fourth,pos=(15,10),size=(800,200)) someInfo.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, "PT Sans")) someInfo.SetForegroundColour("blue")
def valuesL(self,event): b = storage.loadLoans() if dictLoansL.get(BeautifulSoup(b[-1].name))==None: dictLoansL[BeautifulSoup(b[-1].name)]=str(b[-1]) someInfo = wx.StaticText(self.GetParent().GetParent().GetParent().bottomwindow, -1,dictLoansL[BeautifulSoup(self.combo_box_2.GetValue())],pos=(15,10),size=(800,200)) someInfo.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, "PT Sans")) someInfo.SetForegroundColour("black")
def populateComboBoxLoans(self): b = storage.loadLoans() self.combo_box_2.Clear() self.combo_box_2.Insert("Velja lán",0) self.combo_box_2.SetSelection(0) k = 1 for i in b: self.combo_box_2.Insert(i.name,k) k += 1
def refreshList(self): a = storage.loadSAccts() dictLoansS = {} for i in a: dictLoansS[BeautifulSoup(i.n)]=str(i) b = storage.loadLoans() dictLoansL = {} for i in b: dictLoansL[BeautifulSoup(i.name)]=str(i) populateComboBoxLoans(self) populateComboBoxSavings(self)
def plot(self,event): a = storage.loadSAccts() b = storage.loadLoans() nameS = BeautifulSoup(self.combo_box_1.GetValue()) nameL = BeautifulSoup(self.combo_box_2.GetValue()) monthly = self.inputTxt3.GetValue() M = self.inputTxt2.GetValue() for i in a: if BeautifulSoup(i.n) == nameS: for j in b: if BeautifulSoup(j.name) == nameL: plot.plotLS(j,i,int(monthly),int(M))
def refreshList(self): self.list.DeleteAllItems() a = storage.loadLoans() dictLoans = {} index = 1 for i in a: vtr = '' if i.dex: vtr = 'Já' else: vtr = 'Nei' dictLoans[index]=(str(i.name),str(i.amount),str(i.interest),str(i.m),vtr) index += 1 items = dictLoans.items() for key, data in items: index = self.list.InsertStringItem(sys.maxint, data[0]) self.list.SetStringItem(index, 1, data[1]) self.list.SetStringItem(index, 2, data[2]) self.list.SetStringItem(index, 3, data[3]) self.list.SetStringItem(index, 4, data[4]) self.list.SetItemData(index, long(key))
import Savings import storage import Calculator import gettext import plot from bs4 import BeautifulSoup import locale locale.setlocale( locale.LC_ALL, 'icelandic') a = storage.loadSAccts() dictLoansS = {} for i in a: dictLoansS[BeautifulSoup(i.n)]=str(i) b = storage.loadLoans() dictLoansL = {} for i in b: dictLoansL[BeautifulSoup(i.name)]=str(i) class TabPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY) self.SetFont(wx.Font(10, family=wx.FONTFAMILY_SWISS, style=wx.FONTSTYLE_NORMAL,faceName= "PT Sans", weight=wx.NORMAL,encoding=wx.FONTENCODING_SYSTEM)) sizer = wx.BoxSizer(wx.VERTICAL) title1 = wx.StaticText(self,-1,'Niðurgreiðslur lána',pos=(28,10)) title1.SetFont(wx.Font(24, family=wx.FONTFAMILY_SWISS, style=wx.FONTSTYLE_NORMAL,
def populateComboBox(self): a = storage.loadLoans() k = 1 for i in a: self.combo_box_2.Insert(i.name,k) k += 1