def refreshList(self):
     self.list.DeleteAllItems()
     a = storage.loadSAccts()
     dictSavings = {}
     index = 1
     for i in a:
         if i.dex == 1:
             j = "Já"
         else:
             j = "Nei"
             
         bound = ""
         if(i.b%12 != i.b):
             years = int(i.b/12-i.b%12)
             rest = i.b-years*12
             months = int(math.floor(rest))
             days = int((rest-months)*30)
             bound = '%d ár, %d mánuðir, %d dagar' %(years, months, days)
         elif(math.floor(i.b) != 0):
             months = int(math.floor(i.b))
             days = int((i.b-months)*30)
             bound = '%d mánuðir, %d dagar' %(months, days)
         else: 
             days = int(i.b*30)
             bound = str(days)+' dagar'
         dictSavings[index]=(str(i.n),str(i.a),str(i.p*100),j,bound)
         index += 1
     items = dictSavings.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))     
Beispiel #2
0
    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")
Beispiel #3
0
 def valuesS(self,event):
     a = storage.loadSAccts()
     if dictLoansS.get(BeautifulSoup(a[-1].n))==None:
         dictLoansS[BeautifulSoup(a[-1].n)]=str(a[-1])
     someInfo = wx.StaticText(self.GetParent().GetParent().GetParent().bottomwindow,
                              -1,dictLoansS[BeautifulSoup(self.combo_box_1.GetValue())],pos=(15,10),size=(800,200))
     someInfo.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, "PT Sans"))
     someInfo.SetForegroundColour("black")
Beispiel #4
0
def populateComboBoxSavings(self):
    a = storage.loadSAccts()
    self.combo_box_1.Clear()
    self.combo_box_1.Insert("Velja reikning",0)
    self.combo_box_1.SetSelection(0)
    k = 1
    for i in a:
        self.combo_box_1.Insert(i.n,k)
        k += 1
Beispiel #5
0
 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)
Beispiel #6
0
    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))
Beispiel #7
0
 def calculate(self,event):
     for child in self.GetParent().GetParent().GetParent().bottomwindow.GetChildren():
         child.Destroy()
     savings = storage.loadSAccts()
     text = "Hagstæðasti sparnaðarreikningur af öllum reikningum:\n"
     monthly = self.inputTxt1.GetValue()
     m = self.inputTxt2.GetValue()
     M = self.inputTxt3.GetValue()
     S = Calculator.compareAllSavings(savings,float(monthly),int(m),int(M))
     someInfo1 = wx.StaticText(self.GetParent().GetParent().GetParent().bottomwindow,
                              -1,text,pos=(15,10),size=(800,20))
     someInfo2 = wx.StaticText(self.GetParent().GetParent().GetParent().bottomwindow,
                              -1,str(S),pos=(15,29),size=(800,200))
     someInfo1.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.BOLD))
     someInfo2.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL))
     someInfo1.SetForegroundColour("black")
     someInfo2.SetForegroundColour("blue")
Beispiel #8
0
 def calculate(self,event):
     for child in self.GetParent().GetParent().GetParent().bottomwindow.GetChildren():
         child.Destroy()
     name = self.combo_box_1.GetValue()
     savings = storage.loadSAccts()
     text = ""
     monthly = self.inputTxt1.GetValue()
     M = self.inputTxt2.GetValue()
     for i in savings:
         if unicode(BeautifulSoup(i.n)) == name:
             acct = i
             val = acct.saveforM(float(monthly),int(M))
             amount = locale.currency(val, grouping = True)
             text = amount+ unicode(BeautifulSoup(" er sú upphæð sem tekist hefur að safna á "))+ self.inputTxt2.GetValue()+unicode(BeautifulSoup(" mánuðum \nog má taka út strax."))
     if text != "":
         someInfo = wx.StaticText(self.GetParent().GetParent().GetParent().bottomwindow,
                              -1,text,pos=(15,10),size=(800,200))
         someInfo.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, "PT Sans"))
         someInfo.SetForegroundColour("blue")
Beispiel #9
0
 def calculate(self,event):
     for child in self.GetParent().GetParent().GetParent().bottomwindow.GetChildren():
         child.Destroy()
     name = self.combo_box_1.GetValue()
     savings = storage.loadSAccts()
     monthly = self.inputTxt2.GetValue()
     X = self.inputTxt1.GetValue()
     #Eftir: m er fjöldi mánaða sem það tekur að safna upp X pening a reikning þ.a. það megi taka hann út strax.
     text = ""
     for i in savings:
         if unicode(BeautifulSoup(i.n)) == name:
             acct = i
             val = acct.saveuptoX(float(monthly),float(X))
             amount = locale.currency(int(X), grouping=True)
             text = unicode(BeautifulSoup("Eftir "))+str(val)+ unicode(BeautifulSoup(" mánuði verður innistæða á reikningnum orðin meiri en \n"))+amount+unicode(BeautifulSoup(" og upphæðina má taka út strax út strax."))
     if text != "":
         someInfo = wx.StaticText(self.GetParent().GetParent().GetParent().bottomwindow,
                              -1,text,pos=(15,10),size=(800,200))
         someInfo.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, "PT Sans"))
         someInfo.SetForegroundColour("blue")
Beispiel #10
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#ATTENTION! YOU NEED TO DOWNLOAD THE BEAUTIFULSOUP LIBRARY BEFORE RUNNING THIS CODE

import wx
import Loan
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)
Beispiel #11
0
    def refreshList(self):
		a = storage.loadSAccts()
		dictS = {}
		for i in a:
			dictS[BeautifulSoup(i.n)]=str(i)
		populateComboBox(self)