Exemplo n.º 1
0
Arquivo: bill.py Projeto: nano13/nvcli
 def generate(self, c, a):
     self.Struct.toname = self.ui_form.to_name.text()#.toUtf8()
     self.Struct.tostreet = self.ui_form.to_street.text()
     self.Struct.tolocation = self.ui_form.to_village.text()
     self.Struct.id = self.ui_form.bill_id.text()
     self.Struct.toanrede = self.ui_form.to_header.text()
     
     tablewidget = self.ui_form.table
     
     tableIO = TableIO()
     table = tableIO.getTableContentsWithoutEmptyLines(tablewidget)
     
     filename = self.getFilename()
     self.createDataFile(filename, table)
     texfilepath = self.createTexFile(filename, table)
     self.compileTexFile(texfilepath)
     self.openPDFFile(filename)
     
     ret_string = "Rechnung mit Nummer \n" + self.Struct.id + "\n" + "erstellt an \n \n"+ self.Struct.toname +"\n"+ self.Struct.tostreet +"\n"+ self.Struct.tolocation +"\n \n"#+ "im Gesamtwert von " + str(sum) + "€"
     self.ResultObject.Payload.String = ret_string
     return self.ResultObject
Exemplo n.º 2
0
Arquivo: bill.py Projeto: nano13/nvcli
 def load(self, c, a):
     try:
         filename = a[0]
     except IndexError:
         self.ResultObject.Error.Message = "Keine Datei angegeben"
     else:
          # load dat-file:
         filepath = self.Struct.datafolder + "/" + filename + ".dat"
         fobj = open(filepath, "r")
         
         file = []
         for line in fobj:
             file.append(unicode(line.strip()))
         
         self.Struct.toname = file[0]
         self.Struct.tostreet = file[1]
         self.Struct.tolocation = file[2]
         self.Struct.id = file[3]
         self.Struct.toanrede = file[4]
         
         fobj.close()
         
         ###############################################
         self.ui_form = Ui_Form(self.Struct)
         ###############################################
         # load csv-file:
         filepath = self.Struct.datafolder + "/" + filename + ".csv"
         
         csvParser = CSVParser()
         table_data = csvParser.parseCSV(filepath)
         
         tableIO = TableIO()
         tableIO.populateTable(self.ui_form.table, table_data)
         
         self.ResultObject.Payload.Widget = self.ui_form.getGui()
         return self.ResultObject