示例#1
0
        def pulizia_lottotemp():
            ltemp = setconf("Documenti", "lotto_temp")
            if not ltemp:
                return
            from promogest.dao.NumeroLottoTemp import NumeroLottoTemp
            from promogest.dao.RigaMovimentoFornitura import RigaMovimentoFornitura
            from promogest.dao.Fornitura import Fornitura
            print "Avvio pulizia lotti temp..."
            lt = NumeroLottoTemp().select(batchSize=None)
            n = len(lt)
            g = 0
            for l in lt:
                print "RESIDUI DA ELABORARE", n-lt.index(l)
                rmf =  RigaMovimentoFornitura().select(idRigaMovimentoVendita=l.id_riga_movimento_vendita_temp)
                if not rmf:
                    #cerchiamo una fornitura precisa
                    daoForn = Fornitura().select(idArticolo=l.rigamovventemp.id_articolo,
                                            numeroLotto = l.lotto_temp,
                                            batchSize = None)

                    if daoForn:
                        a = RigaMovimentoFornitura()
                        a.id_articolo = l.rigamovventemp.id_articolo
                        a.id_riga_movimento_vendita = l.id_riga_movimento_vendita_temp
                        a.id_fornitura = daoForn[0].id
                        Environment.params["session"].add(a)
                        Environment.params["session"].delete(l)
                        g += 1
                        if g == 2000:
                            Environment.params["session"].commit()
                            g = 0
                else:
                    Environment.params["session"].delete(l)
            Environment.params["session"].commit()
示例#2
0
    def __init__(self, str1=None, str2=None, int1=None, int2=None):
        CustomEntryField.__init__(self)

        self._lunghezza = 10
        self._precisione = int(setconf(key="decimals", section="Numbers"))
        self._default = str1
        self.acceptedKeys = self.controlKeys + self.numberKeys + self.delimiterKeys
示例#3
0
def getNuovoCodiceCliente():
    """
    Restituisce il codice progressivo per un nuovo cliente
    """
    lunghezzaCodice = 8
    prefissoCodice = 'CL'
    codice = ''
    listacodici= []
    try:
        n = 1
        clienti = session.query(Cliente.codice).order_by(desc(Cliente.id)).all()
        for q in clienti:
            codice = codeIncrement(q[0])
            if not codice or (codice,) in clienti:
                continue
            else:
                if (codice,) not in clienti:
                    return codice

    except:
        pass
    try:
        if not codice:
            from promogest.lib.utils import setconf
            dd = setconf("Clienti", "cliente_struttura_codice")
            codice = codeIncrement(dd)
    except Exception:
        pass
    return codice
示例#4
0
def getNuovoCodiceArticolo(idFamiglia=None):
    """ Restituisce il codice progressivo per un nuovo t_articolo
        05/03/2011: rivista e semplificata, forse troppo però adesso
        è velocissima
    """
    codice = ''
    try:
        art = session.query(Articolo.codice).order_by(desc(Articolo.id)).all()
        for q in art:
            codice = codeIncrement(q[0])
            if not codice or (codice,) in art:
                continue
            else:
                if (codice,) not in art:
                    return codice
    except:
        pass
    try:
        if not codice:
            from promogest.lib.utils import setconf
            dd = setconf("Articoli", "articolo_struttura_codice")
            codice = codeIncrement(dd)
    except:
        pass
    return codice
示例#5
0
def checkPan(main):
    print "TIPO PG", Environment.tipo_pg, Environment.modulesList
    for a in Environment.modulesList:
        if a:
            if ("FULL" in a) or ("STANDARD" in a) or ("PRO" in a):
                text = "OPZIONE: <b>%s</b>" %(Environment.tipo_pg)
                main.pan_label_info.set_markup(text)
                Environment.pg2log.info(text)
                if "+S" in a:
                    print "ATTIVARE SHOP"
                    if not setconf("VenditaDettaglio","mod_enable",value="yes"):
                        a = SetConf()
                        a.section = "VenditaDettaglio"
                        a.tipo_section ="Modulo"
                        a.description = "Modulo Vendita Dettaglio"
                        a.tipo = "bool"
                        a.key = "mod_enable"
                        a.value = "yes"
                        a.persist()

                        a = SetConf()
                        a.section = "VenditaDettaglio"
                        a.tipo_section ="Modulo"
                        a.description = "Nome del movimento generato"
                        a.tipo = "str"
                        a.key = "operazione"
                        a.value = "Scarico venduto da cassa"
                        a.persist()

                        a = SetConf()
                        a.section = "VenditaDettaglio"
                        a.tipo_section ="Modulo"
                        a.description = "disabilita_stampa"
                        a.tipo = "bool"
                        a.key = "disabilita_stampa"
                        a.value = "True"
                        a.active = True
                        a.persist()
                return
    if  Environment.tipodb!="postgresql":
        #pp = PanUi(main).draw()
        #a = gtk.Label()
        #a.set_text("OPZIONI MODULI")
        #main.main_notebook.prepend_page(pp.pan_frame, a)
        #main.main_notebook.set_current_page(0)
        text = "OPZIONE: <b>%s!</b>" %("ONE BASIC")
        main.pan_label_info.set_markup(text)
        #return pp
    else:
        text = "OPZIONE: <b>%s</b>" %(Environment.tipo_pg)
        main.pan_label_info.set_markup(text)
    Environment.pg2log.info(text)
示例#6
0
 def scontiStringRefresh(self, listSconti):
     stringSconti = ''
     for s in listSconti:
         decimals = '2'
         tipo = s["tipo"]
         if tipo == 'percentuale':
             tipo = '%'
         elif tipo == 'valore':
             tipo = ''
             decimals = int(setconf(key="decimals", section="Numbers"))
         valore = ('%10.' + str(decimals) + 'f') % float(s["valore"])
         stringSconti = stringSconti + valore + tipo + '; '
     return stringSconti
示例#7
0
def _on_navigation_requested(view, frame, req, data=None):
    uri = req.get_uri()
    if uri.startswith("program:/"):
        agg = uri.split("/")[1]
        if "articoloId" in agg:
            exec(agg)
            apriAnagraficaArticoliEdit(articoloId)
        elif "newPromemoria" in agg:
            data = agg.split("=")[1].replace("-","/")
            dta = data.split("/")
            datadef = dta[2]+"/"+dta[1]+"/"+dta[0]
            selectedData = datadef+" 09:00"
            apriAnagraficaPromemoriaNew(selectedData=selectedData)
        elif "promemoriaId" in agg:
            exec(agg)
            apriAnagraficaPromemoriaEdit(promemoriaId)
        elif "testataDocumentoId" in agg:
            try:
                exec(agg)
                apriTestataDocumentoEdit(testataDocumentoId)
            except:
                return
        elif "testataMovimentoId" in agg:
            try:
                exec(agg)
                apriTestataMovimentoEdit(testataMovimentoId)
            except:
                return
        elif "recuperafeed" in agg:
            #try:
            if utils.setconf("Feed", "feed"):
                feedAll = Environment.feedAll
                feedToHtml = Environment.feedCache
                if feedAll != "" and feedAll and feedToHtml:
                    renderPage(feedToHtml)
                else:
                    #try:
                    gobject.idle_add(getfeedFromSite)
                    #except:
                        #Environment.pg2log.info("LEGGERO RITARDO NEL RECUPERO DEI FEED")
            #except:
                #return
    elif "ads" in uri or "cdn" in uri:
        return False
    elif "http" in uri:
        linkOpen(uri)
    else:
        return False
    return True
    def build(self):
        """ reindirizza alcuni campi e metodi dal filterWidget """
        self.bodyWidget = self._anagrafica.bodyWidget
        #Environment.windowGroup.append(self.bodyWidget)
        self._changeOrderBy = self.bodyWidget._changeOrderBy
        self.orderBy = self.bodyWidget.orderBy = None
        self.join = self.bodyWidget.join = None
        self.batchSize = setconf("Numbers", "batch_size")
        model = self._anagrafica.batchsize_combo.get_model()
        for r in model:
            if r[0] == int(self.batchSize):
                self._anagrafica.batchsize_combo.set_active_iter(r.iter)

        self.offset = self.bodyWidget.offset = 0
        self.numRecords = self.bodyWidget.numRecords = 0
示例#9
0
    def __init__(self, owner, filtersElement=None, resultsElement="grid"):
        GladeWidget.__init__(self, root="filter_vbox", path="_filter_elements.glade")
        self._owner = owner
        self.filtersElement = None
        self.resultsElement = None
        self.join = None
        self.orderBy = False
        self.flag = False
        self.batchSize = int(setconf("Numbers", "batch_size"))
        self.offset = 0
        self.numRecords = 0
        self._treeViewModel = None
        self._htmlTemplate = None
        self._firstFocusWidget = None
        if self._owner.__class__.__name__ != "GestioneScontrini":
            self.filter_info_hbox.destroy()  # c'è una label dentro ...ma serve al momento solo in gestione scontrini
        # self.filter_current_page_entry.set_alignment(xalign=1)
        self.filter_current_page_entry.connect("key_press_event", self.on_filter_current_page_entry_key_event)

        #        batchSize =  setconf("Numbers", "batch_size")
        #        model = self._owner.batchsize_combo.get_model()
        #        for r in model:
        #            if r[0] == int(batchSize):
        #                self._owner.batchsize_combo.set_active_iter(r.iter)

        if filtersElement is None:
            self.filter_frame.set_no_show_all(True)
            self.filter_frame.set_property("visible", False)
        else:
            self.filter_frame.set_property("visible", True)
            self._setFiltersElement(filtersElement)

        if resultsElement is None:
            self.filter_scrolledwindow.set_no_show_all(True)
            self.filter_scrolledwindow.set_property("visible", False)
        else:
            self.filter_scrolledwindow.set_property("visible", True)
            self._setResultsElement(resultsElement)
        if self._owner.__class__.__name__ not in [
            "AnagraficaDocumentiFilter",
            "AnagraficaArticoliFilter",
            "AnagraficaClientiFilter",
        ]:
            self.altri_filtri_togglebutton.destroy()

        self.setFocus()
示例#10
0
 def on_test_promowear_button_clicked(self, button):
     msg = _( """PROVIAMO IL MODULO DI TAGLIA E COLORE o PROMOWEAR, Procedo? """ )
     if not YesNoDialog(msg=msg, transient=self.getTopLevel()):
         return
     from data.createSchemaDb import orderedInstallPromoWear
     if orderedInstallPromoWear():
         if not setconf("PromoWear","mod_enable",value="yes"):
             a = SetConf()
             a.section = "PromoWear"
             a.tipo_section ="Modulo"
             a.description = "Modulo Taglia e colore"
             a.tipo = "bool"
             a.key = "mod_enable"
             a.value = "yes"
             a.persist()
     messageInfo(msg=_("RIAVVIA IL PROMOGEST"))
     Environment.delete_pickle()
     Environment.restart_program()
示例#11
0
    def on_test_promoshop_button_clicked(self, button):
        from promogest.dao.Setconf import SetConf
        msg = _(""" PROVIAMO IL MODULO VENDITA DETTAGLIO o PROMOSHOP, Procedo? """)
        if not YesNoDialog(msg=msg, transient=self.getTopLevel()):
            return
        if not setconf("VenditaDettaglio","mod_enable",value="yes"):
            a = SetConf()
            a.section = "VenditaDettaglio"
            a.tipo_section ="Modulo"
            a.description = "Modulo Vendita Dettaglio"
            a.tipo = "bool"
            a.key = "mod_enable"
            a.value = "yes"
            a.persist()

            a = SetConf()
            a.section = "VenditaDettaglio"
            a.tipo_section ="Modulo"
            a.description = "Nome del movimento generato"
            a.tipo = "str"
            a.key = "operazione"
            a.value = "Scarico venduto da cassa"
            a.persist()

            a = SetConf()
            a.section = "VenditaDettaglio"
            a.tipo_section ="Modulo"
            a.description = "disabilita_stampa"
            a.tipo = "bool"
            a.key = "disabilita_stampa"
            a.value = "True"
            a.active = True
            a.persist()
            from data.createSchemaDb import orderedInstallVenditaDettaglio
            orderedInstallVenditaDettaglio()
            messageInfo(msg=_("RIAVVIA IL PROMOGEST"))
            Environment.delete_pickle()
            Environment.restart_program()

        else:
            messageInfo(msg=_("RISULTA GIA' ATTIVATO"))
示例#12
0
def getNuovoCodiceVettore():
    """
        Restituisce il codice progressivo per un nuovo vettore
    """
    codice = ''
    listacodici= []
    if hasattr(conf,'Vettori'):
        try:
            codicesel  = session.query(Vettore).all()[-3:]
            for cod in codicesel:
                listacodici.append(cod.codice)
                codice = codeIncrement(str(max(listacodici)))
        except:
            pass
        try:
            if codice == "":
                from promogest.lib.utils import setconf
                codice = codeIncrement(setconf("Vettori", "vettore_struttura_codice"))
        except:
            pass
    return codice
    def __init__(self):
        from promogest.lib.utils import setconf
        gtk.Box.__init__(self)
        self.combobox = gtk.ComboBox()
        self.combobox.set_property("can-focus", True)
        self.button = gtk.ToggleButton()
        self.button.set_property("can-focus", True)
        image = gtk.Image()
        pbuf = GDK_PIXBUF_NEW_FROM_FILE(Environment.guiDir + 'modifica16x16.png')
        image.set_from_pixbuf(pbuf)
        self.button.add(image)
        self.pack_start(self.combobox, True, True, 0)
        self.pack_start(self.button, False, False, 0)
        self.set_property("can-focus", True)
        self.button.connect('clicked',
                            self.do_button_clicked)
        self.combobox.connect('key_press_event',
                              self.do_combobox_key_press_event)

        self.combobox.set_wrap_width(int(setconf("Numbers", "combo_column")) or 3)
        renderer = gtk.CellRendererText()
        self.combobox.pack_start(renderer, True)
        self.combobox.add_attribute(renderer, 'text', 0)
        self.connect("show", self.on_show)
示例#14
0
    def _refresh(self):
        try:
            self.zeri_in_riga_check.set_active(int(setconf("Stampa", "zeri_in_riga")))
        except:
            self.zeri_in_riga_check.set_active(0)
        try:
            self.turbo_check.set_active(int(setconf("General", "turbo")))
        except:
            self.turbo_check.set_active(0)
        try:
            self.zeri_in_totali_check.set_active(int(setconf("Stampa", "zeri_in_totali")))
        except:
            self.zeri_in_totali_check.set_active(0)
        try:
            self.feed_check.set_active(int(setconf("Feed", "feed")))
        except:
            self.feed_check.set_active(1)

        try:
            curr = setconf("Valuta", "valuta_curr")
            if curr =="€":
                self.euro_radio.set_active(1)
            elif curr =="$":
                self.dollaro_radio.set_active(1)
            elif curr =="£":
                self.sterlina_radio.set_active(1)
            elif curr =="CHF":
                self.francosvizzero_radio.set_active(1)
        except:
            self.euro_radio.set_active(1)
        try:
            self.mercatino_check.set_active(int(setconf("General", "gestione_totali_mercatino")))
        except:
            self.mercatino_check.set_active(0)

        try:
            self.gestione_lotti_check.set_active(int(setconf("General", "gestione_lotti")))
        except:
            self.gestione_lotti_check.set_active(0)


        try:
            self.vettore_codice_upper_check.set_active(int(setconf("Vettori", "vettore_codice_upper")))
        except:
            self.vettore_codice_upper_check.set_active(1)

        self.vettore_struttura_codice_entry.set_text(str(setconf("Vettori", "vettore_struttura_codice")))
        self.altezza_logo_entry.set_text(str(setconf("Documenti", "altezza_logo")))
        self.larghezza_logo_entry.set_text(str(setconf("Documenti", "larghezza_logo")))
        self.combo_column_entry.set_text(str(setconf("Numbers", "combo_column")))
        self.decimals_entry.set_text(str(setconf("Numbers","decimals")))
        self.separatore_entry.set_text(str(setconf("Documenti","separatore_numerazione") or ""))
        self.batch_size_entry.set_text(str(setconf("Numbers","batch_size")))
        self.documenti_setup_page._refresh()
        self.articoli_setup_page._refresh()
        self.clienti_setup_page._refresh()
        self.fornitori_setup_page._refresh()
        self.primanota_setup_page._refresh()
        self.label_setup_page._refresh()
        if posso("VD"):
            self.vendita_dettaglio_setup_page._refresh()

        if setconf("Stampa", "singolo_ori") == "orizzontale":
            self.singolo_land_radio.set_active(True)
        elif setconf("Stampa", "singolo_ori") == "verticale":
            self.singolo_vert_radio.set_active(True)
        else:
            self.singolo_vert_radio.set_active(True)

        self.singolo_margine_alto_entry.set_text(
            str(setconf("Stampa", "singolo_margine_alto") or "4.3"))
        self.singolo_margine_destro_entry.set_text(
            str(setconf("Stampa", "singolo_margine_destro") or "4.3"))
        self.singolo_margine_basso_entry.set_text(
            str(setconf("Stampa", "singolo_margine_basso") or "4.3"))
        self.singolo_margine_sinistro_entry.set_text(
            str(setconf("Stampa", "singolo_margine_sinistro") or "4.3"))

        if setconf("Stampa", "report_ori") == "orizzontale":
            self.report_land_radio.set_active(True)
        elif setconf("Stampa", "report_ori") == "verticale":
            self.report_vert_radio.set_active(True)
        else:
            self.report_land_radio.set_active(True)

        self.report_margine_alto_entry.set_text(
            str(setconf("Stampa", "report_margine_alto") or "4.3"))
        self.report_margine_destro_entry.set_text(
            str(setconf("Stampa", "report_margine_destro") or "4.3"))
        self.report_margine_basso_entry.set_text(
            str(setconf("Stampa", "report_margine_basso") or "4.3"))
        self.report_margine_sinistro_entry.set_text(
            str(setconf("Stampa", "report_margine_sinistro") or "4.3"))
示例#15
0
    def duplicateElementLabel(self):
        """
        Funzione base per la gestione delle frontaline:
        La gestione frontaline ha problematiche differenti rispetto ai report ed
        alle stampe singole. Il template contiene una frontalina di base che deve essere
        replicata enne volte quante dovuto uguale a se stessa per poi gestirne i tag
        rendendoli "iteranti". La parte meno complessa è quella della traduzione in
        pdf in quanto lo sla finito non rappresenta complessità particolari
        """
        numPages = self.slaPage()
        document = self.slaDocumentTag()
        self.pageProperties = Sla2pdfUtils.pageProFunc(document)
        group = self.tablesProperties[0].keys()[0]
        self.tablesPropertie = self.tablesProperties[0][group]

        widths = [float(x.get("WIDTH")) for x in self.tablesPropertie['cells']]
        heights = [float(x.get("HEIGHT")) for x in self.tablesPropertie['cells']]
        cells = int(self.tablesPropertie['n_cells'])
        columns = int(self.tablesPropertie['columns'])
        rows = int(self.tablesPropertie['rows'])

        sumRows = reduce(operator.add, heights[:rows])
        sumColumns = reduce(operator.add, widths[:columns])
        otherColumn = sumColumns + (int(setconf("Label", "sistemacolonnafrontaline") or 0))
        otherRows = sumRows + (int(setconf("Label", "sistemarigafrontaline") or 0 ))

        pageYpos = float(numPages[0].get('PAGEYPOS'))
        pageXpos = float(numPages[0].get('PAGEXPOS'))
        pageHeight = float(numPages[0].get('PAGEHEIGHT'))
        borderTop = float(numPages[0].get('BORDERTOP'))
        borderBottom = float(numPages[0].get('BORDERBOTTOM'))
        borderLeft = float(numPages[0].get('BORDERLEFT'))
        borderRight = float(numPages[0].get('BORDERRIGHT'))
        pageWidth = float(numPages[0].get('PAGEWIDTH'))

        realHeightPage = pageHeight - (borderTop + borderBottom)
        realWidthPage = pageWidth - (borderLeft + borderRight)
        NumMaxRowLabelForPage = int(realHeightPage/otherRows)
        NumMaxColumnLabelForPage = int(realWidthPage /otherColumn)
        NumMaxLabelForPageTotal = NumMaxRowLabelForPage*NumMaxColumnLabelForPage
        NumLabelInDao = len(self.objects)
        pagesNumber = int((NumLabelInDao/NumMaxLabelForPageTotal)) +1

        self.createPageTag(pagesNumber)
        labelObj = self.slaPageObjects()
        for j in range(1, NumLabelInDao):
            for pageObject in labelObj:
                ## Creating dictionary attributes pageobject
                attributes = pageObject.items()
                dictionary = {}
                for k in range(0, len(attributes)):
                    dictionary[attributes[k][0]] = attributes[k][1]
                ## Applying attributes
                app = pageObject.makeelement('PAGEOBJECT', dictionary)
                ## Creating dictionary attributes itext of the pageobject
                itexts = pageObject.findall('ITEXT')
                for itext in itexts:
                    attributes = itext.items()
                    dictionary = {}
                    for kk in range(0, len(attributes)):
                        dictionary[attributes[kk][0]] = attributes[kk][1]
                    ## Applying attributes
                    ElementTree.SubElement(app, 'ITEXT', dictionary)

                trails = pageObject.findall('trail')
                for trai in trails:
                    attributes = trai.items()
                    dictTrai = {}
                    for attrrr in attributes:
                        dictTrai[attrrr[0]] = attrrr[1]
                    ElementTree.SubElement(app, 'trail', dictTrai)

                paras = pageObject.findall('para')
                for para in paras:
                    attributes = para.items()
                    dictPara = {}
                    for kkk in range(0, len(attributes)):
                        dictPara[attributes[kkk][0]] = attributes[kkk][1]
                    ## Applying attributes
                    ElementTree.SubElement(app, 'para', dictPara)
                pageItemAttributes = pageObject.findall('pageItemAttributes')
                ElementTree.SubElement(app, 'pageItemAttributes')
                ## Number page
                inigroup = str(pageObject.get('GROUPS')).strip()
                x = str(j+int(inigroup))+ " "
                app.set('GROUPS', x)
                app.set('OwnPage', str(j))
                ## Coordinates
                ypos = pageObject.get('YPOS')
                height = pageObject.get('HEIGHT')
                xpos = pageObject.get('XPOS')
                if (j/NumMaxLabelForPageTotal) >= 1:
                    page = int(j/NumMaxLabelForPageTotal)
                else:
                    page = 0
                colonna = NumMaxColumnLabelForPage- ((NumMaxLabelForPageTotal*(page+1) - (j+1)) / NumMaxRowLabelForPage)-1
                riga = j- (NumMaxRowLabelForPage * (j/NumMaxRowLabelForPage))
                if not j%NumMaxRowLabelForPage:
                    app.set('YPOS',str(float(ypos)+((float(pageHeight)+float(borderTop))*page)))
                else:
                    app.set('YPOS',str(float(ypos)+((float(pageHeight)+float(borderTop))*page)+ (otherRows* riga)))
                app.set('XPOS',str(float(xpos) + otherColumn* (colonna)))
                self.slaDocumentTag().append(app)
                app = {}
#        self.doc.write(self.pdfFolder+"_tempppPrima.sla")
        self.labelSla()
示例#16
0
    def duplicateElementLabel(self):
        """
        Funzione base per la gestione delle frontaline:
        La gestione frontaline ha problematiche differenti rispetto ai report ed
        alle stampe singole. Il template contiene una frontalina di base che deve essere
        replicata enne volte quante dovuto uguale a se stessa per poi gestirne i tag
        rendendoli "iteranti". La parte meno complessa è quella della traduzione in
        pdf in quanto lo sla finito non rappresenta complessità particolari
        """
        numPages = self.slaPage()
        document = self.slaDocumentTag()
        self.pageProperties = Sla2pdfUtils.pageProFunc(document)
        group = self.tablesProperties[0].keys()[0]
        self.tablesPropertie = self.tablesProperties[0][group]
        widths = self.tablesPropertie['widths']
        heights = self.tablesPropertie['heights']
        cells = int(self.tablesPropertie['cells'])
        columns = int(self.tablesPropertie['columns'])
        rows = int(self.tablesPropertie['rows'])
        sumRows = Sla2pdfUtils.sumRowsFunc(heights,rows)
        sumColumns = Sla2pdfUtils.sumColumnsFunc(widths,columns)

        otherColumn = sumColumns +(int(setconf("Label", "sistemacolonnafrontaline")) or 0)
        sumRows = sumRows + (int(setconf("Label", "sistemarigafrontaline")) or 0)

        self.pageYpos = float(numPages[0].get('PAGEYPOS'))
        self.pageXpos = float(numPages[0].get('PAGEXPOS'))
        self.pageHeight = float(numPages[0].get('PAGEHEIGHT'))
        self.borderTop = float(numPages[0].get('BORDERTOP'))
        self.borderBottom = float(numPages[0].get('BORDERBOTTOM'))
        self.borderLeft = float(numPages[0].get('BORDERLEFT'))
        self.borderRight = float(numPages[0].get('BORDERRIGHT'))
        self.pageWidth = float(numPages[0].get('PAGEWIDTH'))

        realHeightPage = self.pageHeight - self.borderTop - self.borderBottom
        realWidthPage = self.pageWidth - self.borderLeft - self.borderRight
        NumMaxRowLabelForPage = int(realHeightPage/sumRows)
        NumMaxColumnLabelForPage = int(realWidthPage /otherColumn)
        NumMaxLabelForPageTotal = NumMaxRowLabelForPage*NumMaxColumnLabelForPage
        NumLabelInDao = len(self.objects)
        pagesNumber = int((NumLabelInDao/NumMaxLabelForPageTotal)) +1
        self.createPageTag(pagesNumber)
        self.labelObj = self.slaPageObjects()
        op = True
        col = True
        for j in range(1, NumLabelInDao):
            p=r=c = 1
            for pageObject in self.labelObj:
                ## Creating dictionary attributes pageobject
                attributes = pageObject.items()
                dictionary = {}
                for k in range(0, len(attributes)):
                    dictionary[attributes[k][0]] = attributes[k][1]
                ## Applying attributes
                app = pageObject.makeelement('PAGEOBJECT', dictionary)
                ## Creating dictionary attributes itext of the pageobject
                itexts = pageObject.findall('ITEXT')
                for itext in itexts:
                    attributes = itext.items()
                    dictionary = {}
                    for kk in range(0, len(attributes)):
                        dictionary[attributes[kk][0]] = attributes[kk][1]
                    ## Applying attributes
                    ElementTree.SubElement(app, 'ITEXT', dictionary)

                paras = pageObject.findall('para')
                for para in paras:
                    attributes = para.items()
                    dictPara = {}
                    for kkk in range(0, len(attributes)):
                        dictPara[attributes[kkk][0]] = attributes[kkk][1]
                    ## Applying attributes
                    ElementTree.SubElement(app, 'para', dictPara)
                pageItemAttributes = pageObject.findall('pageItemAttributes')
                ElementTree.SubElement(app, 'pageItemAttributes')
                ## Number page
                #inigroup = str(app.get('GROUPS')).strip()
                x = str(10 +j)+ " "
                app.set('GROUPS', str(x))
                #app.set('OwnPage', str(j))
                ## Coordinates
                ypos = app.get('YPOS')
                height = app.get('HEIGHT')
                xpos = app.get('XPOS')
                if (j/NumMaxLabelForPageTotal) >= 1:
                    page = int(j/NumMaxLabelForPageTotal)
                else:
                    page = 0
                if j < NumMaxRowLabelForPage:
                    app.set('YPOS',str(float(ypos)+ sumRows*j))
                elif (j >= NumMaxRowLabelForPage) and (j < NumMaxLabelForPageTotal):
                    app.set('XPOS',str(float(xpos) + float(otherColumn)))
                    app.set('YPOS',str(float(ypos)+(sumRows*(j-NumMaxRowLabelForPage))))
                elif page != 0 and j < ((NumMaxLabelForPageTotal * page) + NumMaxRowLabelForPage):
                    app.set('YPOS',str(float(ypos)+\
                        ((float(self.pageHeight)+float(self.borderTop))*page)+\
                        sumRows*(j-(NumMaxLabelForPageTotal*page))))
                elif page !=0 and j >= (NumMaxLabelForPageTotal * page) +NumMaxRowLabelForPage and j < NumMaxLabelForPageTotal * page +NumMaxLabelForPageTotal:
                    app.set('XPOS',str(float(xpos) + float(otherColumn)))
                    app.set('YPOS',str(float(ypos)+\
                        ((float(self.pageHeight)+float(self.borderTop))*page)+\
                        sumRows*(j-(NumMaxLabelForPageTotal*page)-NumMaxRowLabelForPage)))
                else:
                    print "attenzione oggetto che non ha trovato collocazione"
                self.slaDocumentTag().append(app)
                app = {}
        self.labelSla()
        self.findTablesProperties()
示例#17
0
 def draw(self):
     folder = setconf("General", "cartella_predefinita") or ""
     self.cartella_predefinita_filechooserbutton.set_current_folder(folder)
     self.path_label.set_text(folder)
示例#18
0
import os
import math
from decimal import *
import operator
import xml.etree.cElementTree as ElementTree
from promogest import Environment
from promogest.lib.utils import setconf, uu
import Sla2pdfUtils
from SlaParser import SlaParser
SHOWZERORIGA = False
SHOWZEROTOTALI = False

try:
    from promogest.lib.utils import pbar, setconf
    SHOWZEROTOTALI = setconf("Stampa", "zeri_in_totali")
    SHOWZERORIGA = setconf("Stampa", "zeri_in_riga")
except:
    pass

class SlaTpl2Sla(SlaParser):
    """
    Build a template object based on the specified file-like
    object and sequence of objects
    """

    def __init__(self, slafile=None, label=None, report=None, objects=None,
                 daos=None, slaFileName=None, pdfFolder=None, classic=None,
                 template_file=None, pbar=None):

示例#19
0
    def _refresh(self):
        try:
            self.zeri_in_riga_check.set_active(int(setconf("Stampa", "zeri_in_riga")))
        except:
            self.zeri_in_riga_check.set_active(0)
        try:
            self.zeri_in_totali_check.set_active(int(setconf("Stampa", "zeri_in_totali")))
        except:
            self.zeri_in_totali_check.set_active(0)
        try:
            self.feed_check.set_active(int(setconf("Feed", "feed")))
        except:
            self.feed_check.set_active(1)
        try:
            findComboboxRowFromId(self.timer_combobox, str(setconf("General", "updates_timeout")))
        except:
            findComboboxRowFromId(self.timer_combobox, '300')

        try:
            curr = setconf("Valuta", "valuta_curr")
            if curr =="€":
                self.euro_radio.set_active(1)
            elif curr =="$":
                self.dollaro_radio.set_active(1)
            elif curr =="£":
                self.sterlina_radio.set_active(1)
            elif curr =="CHF":
                self.francosvizzero_radio.set_active(1)
        except:
            self.euro_radio.set_active(1)
        try:
            self.mercatino_check.set_active(int(setconf("General", "gestione_totali_mercatino")))
        except:
            self.mercatino_check.set_active(0)

        try:
            self.gestione_lotti_check.set_active(int(setconf("General", "gestione_lotti")))
        except:
            self.gestione_lotti_check.set_active(0)


        try:
            self.vettore_codice_upper_check.set_active(int(setconf("Vettori", "vettore_codice_upper")))
        except:
            self.vettore_codice_upper_check.set_active(1)

        self.vettore_struttura_codice_entry.set_text(str(setconf("Vettori", "vettore_struttura_codice")))
        self.altezza_logo_entry.set_text(str(setconf("Documenti", "altezza_logo")))
        self.larghezza_logo_entry.set_text(str(setconf("Documenti", "larghezza_logo")))
        self.combo_column_entry.set_text(str(setconf("Numbers", "combo_column")))
        self.decimals_entry.set_text(str(setconf("Numbers","decimals")))
        self.separatore_entry.set_text(str(setconf("Documenti","separatore_numerazione") or ""))
        self.batch_size_entry.set_text(str(setconf("Numbers","batch_size")))
        self.documenti_setup_page._refresh()
        self.articoli_setup_page._refresh()
        self.clienti_setup_page._refresh()
        self.fornitori_setup_page._refresh()
        self.primanota_setup_page._refresh()
        self.label_setup_page._refresh()
        if posso("VD"):
            self.vendita_dettaglio_setup_page._refresh()