예제 #1
0
    def on_pdf_button_clicked(self, button):

        operation = Gtk.PrintOperation()
        setting = Gtk.PageSetup()
        ps = Gtk.PaperSize.new_custom("cc", "cc", 210, 297, gtk.Unit.MM)
        st = Gtk.PrintSettings()
        s = Gtk.PageSetup()
        s.set_paper_size(ps)
        margine_fondo = float(
            setconf("Stampa", "report_margine_basso") or 4.3)
        s.set_bottom_margin(margine_fondo, gtk.Unit.MM)
        margine_sinistro = float(
            setconf("Stampa", "report_margine_sinistro") or 4.3)
        s.set_left_margin(margine_sinistro, gtk.Unit.MM)
        margine_destro = float(
            setconf("Stampa", "report_margine_destro") or 4.3)
        s.set_right_margin(margine_destro, gtk.Unit.MM)
        margine_alto = float(
            setconf("Stampa", "report_margine_alto") or 4.3)
        s.set_top_margin(margine_alto, gtk.Unit.MM)
        orientamento = str(setconf("Stampa", "report_ori"))
        if not orientamento or orientamento == "orizzontale":
            s.set_orientation(Gtk.PageOrientation.LANDSCAPE)
        operation.set_default_page_setup(s)
        operation.set_export_filename(Environment.tempDir + ".temp.pdf")
        p = self.detail.get_main_frame().print_full(operation,
                                              gtk.PrintOperationAction.EXPORT)
        pbar(self.pbar, pulse=True, text="GENERAZIONE STAMPA ATTENDERE")
        pbar(self.pbar, stop=True)
        anag = PrintDialogHandler(self, self.windowTitle, tipo=self.tipo)
        anagWindow = anag.getTopLevel()
        returnWindow = self.getTopLevel().get_toplevel()
        anagWindow.set_transient_for(returnWindow)
        anagWindow.show_all()
 def on_print_button_clicked(self, button):
     nomefile = "planner"+dateToString(Environment.currentData).replace("/","_")+"_"+Environment.view
     g = file(Environment.tempDir+".temp.pdf", "wb")
     pdf = pisa.CreatePDF(str(self.hhttmmll),g)
     g.close()
     anag = PrintDialogHandler(self.mainoo.main_window, nomefile)
     anagWindow = anag.getTopLevel()
     returnWindow = self.getTopLevel().get_toplevel()
     anagWindow.set_transient_for(returnWindow)
     anagWindow.show_all()
예제 #3
0
 def on_pdf_button_clicked(self, button):
     f = self.renderHTML(pageData=self.pageData, forprint=True)
     g = file(Environment.tempDir+".temp.pdf", "wb")
     pdf = pisa.CreatePDF(str(f), g)
     g .close()
     anag = PrintDialogHandler(self, '')
     anagWindow = anag.getTopLevel()
     returnWindow = self.getTopLevel().get_toplevel()
     anagWindow.set_transient_for(returnWindow)
     anagWindow.show_all()
예제 #4
0
파일: HtmlViewer.py 프로젝트: fmarella/pg3
    def on_pdf_button_clicked(self, button):

        f = self.html
        g = file(Environment.tempDir+".temp.pdf", "wb")
        pdf = pisa.CreatePDF(str(f), g)
        g .close()
        anag = PrintDialogHandler(self, self.windowTitle)
        anagWindow = anag.getTopLevel()
        returnWindow = self.getTopLevel().get_toplevel()
        anagWindow.set_transient_for(returnWindow)
        anagWindow.show_all()
 def on_pdf_button_clicked(self, button):
     from  xhtml2pdf import pisa
     f = str(self.html)
     filename =Environment.tempDir + "acqmedcliTemp.pdf"
     g = file(filename, "wb")
     pdf = pisa.CreatePDF(f,g)
     g .close()
     anag = PrintDialogHandler(self,self.windowTitle, tempFile=Environment.tempDir + "acqmedcliTemp.pdf")
     anagWindow = anag.getTopLevel()
     returnWindow = self.getTopLevel().get_toplevel()
     anagWindow.set_transient_for(returnWindow)
     anagWindow.show_all()
예제 #6
0
 def on_stampa_button_clicked(self, button):
     from  xhtml2pdf import pisa
     if self.dao:
         f = str(self.html)
 #        f = "Hello <strong>World</strong>"
         filename =Environment.tempDir + "ristampa.pdf"
         g = file(filename, "wb")
         pdf = pisa.CreatePDF(f,g)
         g .close()
         anag = PrintDialogHandler(self,"SCONTRINO", tempFile=Environment.tempDir + "ristampa.pdf")
         anagWindow = anag.getTopLevel()
         returnWindow = self.getTopLevel().get_toplevel()
         anagWindow.set_transient_for(returnWindow)
         anagWindow.show_all()
     else:
         messageInfo(msg="Selezionare uno scontrino da stampare")
예제 #7
0
파일: KitMaster.py 프로젝트: fmarella/pg3
 def on_print_kit_clicked(self, button):
     from  xhtml2pdf import pisa
     pageData = {"file": "articolo_kit.html",
                 "dao" : self._articolo_master,
                 "sub_kit" : self.print_sub_kit_checkbutton.get_active(),
                 "articoli_kit" : self.articoli_componenti_listore,
                 }
     self.htmll = renderTemplate(pageData)
     f = str(self.htmll)
     filename =Environment.tempDir + "articolo_kit_"+str(self._articolo_master.id)+".pdf"
     g = file(filename, "wb")
     pdf = pisa.CreatePDF(f,g)
     g .close()
     anag = PrintDialogHandler(self,"Articolo kit", tempFile=filename)
     anagWindow = anag.getTopLevel()
     returnWindow = self.getTopLevel().get_toplevel()
     anagWindow.set_transient_for(returnWindow)
     anagWindow.show_all()
예제 #8
0
    def on_stampa_infopeso_button_clicked(self, button):
        from  xhtml2pdf import pisa
        # provo a prendere i dati per la stampa dalla treeview così
        #ho anche le differenze di peso
        model = self.righe_pesata_treeview.get_model()

        pageData = {"file": "infopeso.html",
                    "dao":self.dao_cliente,
                    #"infopeso_righe":self.dao_testata_infopeso.righeinfopeso
                    "infopeso_righe":model
                    }
        self.htmll = renderTemplate(pageData)


        f = str(self.htmll)
        filename =Environment.tempDir + "infopeso.pdf"
        g = file(filename, "wb")
        pdf = pisa.CreatePDF(f,g)
        g .close()
        anag = PrintDialogHandler(self,"Infopeso", tempFile=Environment.tempDir + "infopeso.pdf")
        anagWindow = anag.getTopLevel()
        returnWindow = self.getTopLevel().get_toplevel()
        anagWindow.set_transient_for(returnWindow)
        anagWindow.show_all()