Ejemplo n.º 1
0
 def initMonnaie(self):
     print "initMonnaie"
     monnaies = getFromConfig('monnaie', 'monnaies')
     sorted_monnaies = sorted(monnaies, key = lambda m: m['code'])
     for m in sorted_monnaies:
         self.ui.cb_monnaie.addItem(m['sym'].encode('utf8'), userData=m['code'])
     self.ui.cb_monnaie.setCurrentIndex(0)
     
     unites = getFromConfig('unite', 'unites')
     for u in unites:
         self.ui.cb_unite.addItem(u['nom'].encode('utf8').title(), userData=u['sym'].lower())
     self.ui.cb_unite.setCurrentIndex(0)
Ejemplo n.º 2
0
 def openPdfContract(self):
     contract_selected = self.getSelectedContract()
     if contract_selected is not None:
         ctr_path = QtCore.QFileInfo(getFromConfig(
             "path", "words_contract")).absoluteFilePath()
         file_name = contract_selected.n_contrat + ".pdf"
         ctr_pdf = ""
         for f in listdir(ctr_path):
             if f.endswith(file_name):
                 ctr_pdf = join(ctr_path, file_name)
                 break
         if ctr_pdf == "":
             self.popupMessage("Contrat introuvable ou non édité...")
         else:
             startfile(ctr_pdf)
     else:
         self.popupMessage("Pb avec le contrat...")
Ejemplo n.º 3
0
    def __init__(self, parent=None):
        super(PDFCreator, self).__init__(parent)
        self.ui = Ui_printer()
        self.ui.setupUi(self)
        self.setWindowTitle('Édition du document')
        self.oil_market = Market()

        self.lang_list = getFromConfig("langages", 'lang_list')
        for lang in self.lang_list:
            rb = langueRB(parent=self.ui.layout_langues,
                          text=lang['nom'],
                          data=lang)
            self.ui.layout_langues.addWidget(rb)

        for i in range(0, self.ui.layout_langues.count(), 1):
            w = self.ui.layout_langues.itemAt(i)
            if w is not None:
                w.widget().setChecked(True)
                break

        self.setAttribute(QtCore.Qt.WA_StyledBackground)
        self.ui.b_print.clicked.connect(self.createPDF)
        self.ui.b_close.clicked.connect(self.close)
        self.hide()
Ejemplo n.º 4
0
    def createPDF(self, is_fourniss=False, filedir=None, tpl_path=None):

        self.hide()

        base_tpl_path = getFromConfig('path', 'templates_contract')
        words_path = getFromConfig('path', 'words_contract')

        for i in range(0, self.ui.layout_langues.count()):
            widget = self.ui.layout_langues.itemAt(i).widget()
            if widget != 0 and isinstance(widget, langueRB):
                if widget.isChecked():
                    langue_data = widget.data

        if tpl_path is None:
            filters = "MS Word Documents (*" + langue_data["code"] + ".docx)"
            #            selected_filter = "MS Word Documents (*"+langue_data["code"]+".docx)"
            options = QtGui.QFileDialog.DontResolveSymlinks
            fileDialog = QtGui.QFileDialog(
                self, "Selectionnez un modèle de contrat")
            fileDialog.setFilter(filters)
            fileDialog.setOptions(options)
            fileDialog.setDirectory(base_tpl_path)
            tpl_path = fileDialog.getOpenFileName()[0]
            #            tpl_path = QtGui.QFileDialog.getOpenFileName(self, "Selectionnez un template", base_tpl_path, filters, selected_filter, options)[0]
            #            tpl_path = fileDialog.getOpenFileName(self, "Selectionnez un template", dir=base_tpl_path, filter = filters, selected_filter, options)[0]
            if tpl_path is None or tpl_path == "":
                return

        filename = self.ctr.n_contrat

        #################################################
        ##             NUMERO de CONTRAT             ##
        #################################################
        n_ctr = self.ctr.n_contrat

        #################################################
        ##               DATE CONTRAT                  ##
        #################################################
        date_ctr = self.ctr.date_contrat

        #################################################
        ##             VILLE DE LVR/CHARG              ##
        #################################################

        ville = self.ctr.getVilleCible()
        if len(ville) < 1:
            ville = "<VILLE>"

        #################################################
        ##             ADRESSE  FACTURATION            ##
        #################################################
        if is_fourniss is True:
            adr_fact = self.ctr.getFactFourniss()
        else:
            adr_fact = self.ctr.getFactClient()

        if isinstance(adr_fact, list):
            adr_fact = adr_fact[FacturationSelection.getFacturationAdress(
                self, adr_fact)]
        tab_adr_fact = '\t\t\t\t\t\t\t\t'
        adr_fact = adr_fact.replace('\n', '\n' + tab_adr_fact)

        #################################################
        ##             ADRESSE  CLIENT                 ##
        #################################################
        adr_client = self.ctr.getAdr_uClient()
        if langue_data['code'] != 'fr' and len(
                re.findall("\\n\w+$", adr_client)) > 0:
            print "ETRANGER, ", adr_client
            pays = re.findall("\\n\w+$", adr_client)[0]
            print "PAYS, ", pays
            adr_client = adr_client.replace(pays, pays.replace("\n", "\t\t\t"))
            print "NEW adr, ", adr_client
        tab_adr_client = '\t\t\t'
        adr_client = adr_client.replace('\n', '\n' + tab_adr_client)

        #################################################
        ##                 TVA  CLIENT                 ##
        #################################################
        tva_client = self.ctr.getTVA_uClient()

        #################################################
        ##             ADRESSE  FOURNISSEUR            ##
        #################################################
        adr_fourniss = self.ctr.getAdr_uFourniss()
        if langue_data['code'] != 'fr' and len(
                re.findall("\\n\w+$", adr_fourniss)) > 0:
            pays = re.findall("\\n\w+$", adr_fourniss)[0]
            adr_fourniss = adr_fourniss.replace(pays,
                                                pays.replace("\n", "\t\t\t"))
        tab_adr_fourniss = '\t\t\t'
        adr_fourniss = adr_fourniss.replace('\n', '\n' + tab_adr_fourniss)

        #################################################
        ##                 TVA  FOURNISSEUR            ##
        #################################################
        tva_fourniss = self.ctr.getTVA_U_Fourniss()

        #################################################
        ##                MARCHANDISE                  ##
        #################################################
        #        m_nom = self.ctr.marchandise.decode('utf-8')
        m_nom = self.oil_market.getMarchandiseFullName(self.ctr.marchandise,
                                                       langue_data['code'])
        #        marchandise_list = self.oil_market.marchandises_list[langue_data['code']]
        #        m_nom = marchandise_list[self.ctr.marchandise]#.decode('utf-8')
        m_quantite = self.ctr.quantite

        if self.ctr.unite == 'kg':
            if langue_data['code'] == 'fr':
                m_unite = 'le '
            elif langue_data['code'] == 'en':
                m_unite = 'per '
            elif langue_data['code'] == 'es':
                m_unite = 'el '
            m_unite += langue_data['kg_unite']
        elif self.ctr.unite == 't':
            if langue_data['code'] == 'fr':
                m_unite = 'la '
            elif langue_data['code'] == 'en':
                m_unite = 'per '
            elif langue_data['code'] == 'es':
                m_unite = 'la '
            m_unite += langue_data['t_unite']

        #################################################
        ##                  PAIEMENT                   ##
        #################################################

        str_prix = self.ctr.prix
        matches = re.findall(r"[-+]?\d*\.*\d+", str_prix.replace(',', '.'))
        if len(matches) > 0:
            prix_num = matches[0]
            prix_words = num2words(float(prix_num), lang=langue_data['code'])
        else:
            prix_num = str_prix
            prix_words = ""

        if self.ctr.monnaie == 0:
            monnaie = u'\u20ac'.encode('utf8')
            prix_words += ' euros'
        elif self.ctr.monnaie == 1:
            monnaie = u'\u00a3'.encode('utf8')
            prix_words += ' dollars'
        elif self.ctr.monnaie == 2:
            monnaie = u'\u0024'.encode('utf8')
            prix_words += ' livres'
        else:
            monnaie = ""

        if len(self.ctr.paiement) > 0:
            index = self.oil_market.paiements["fr"].index(self.ctr.paiement)
            paiement = self.oil_market.paiements[langue_data['code']][index]
            courtage = self.ctr.courtage
        else:
            paiement = ""
            courtage = ""

        #################################################
        ##                 LIVRAISON                   ##
        #################################################
#        dlv_dic = self.ctr.periode_livraison
        try:
            periode_livraison = self.ctr.descr_livraison
        except:
            periode_livraison = ""

#        month_names = langue_data['months']
#        ordered_years = sorted(dlv_dic.keys())
#        for i in range(0, len(ordered_years), 1):
#            if len(periode_livraison) > 0 :
#                periode_livraison += '\n'
#            y = ordered_years[i]
#            for j in range(0, 12):
#                m = month_names[j]
#                total = int(float(dlv_dic[y][str(j+1).zfill(2)]["total"]))
#                if total == 0: continue
#                if len(periode_livraison) > 0 :
#                    periode_livraison += ', '+m
#                else:
#                    periode_livraison += m
#            periode_livraison += ' - '+str(y)

        if len(self.ctr.logement) > 0:
            index = self.oil_market.logements["fr"].index(self.ctr.logement)
            format_livraison = self.oil_market.logements[
                langue_data['code']][index]
        else:
            format_livraison = ""

        if self.ctr.is_franco is True:
            if langue_data['code'] == "fr":
                ville = "usine acheteur à ".decode('utf8') + ville.decode(
                    'utf8')
            if langue_data['type_deliv'][1] == "":
                type_deliv = langue_data['type_deliv'][0].lower()
            else:
                type_deliv = langue_data['type_deliv'][1].lower()
        else:
            if langue_data['code'] == "fr":
                ville = "usine vendeur à ".decode('utf8') + ville.decode(
                    'utf8')

            if langue_data['type_deliv'][3] == "":
                type_deliv = langue_data['type_deliv'][2].lower()
            else:
                type_deliv = langue_data['type_deliv'][3].lower()

        has_tva_client = False
        if len(tva_client) > 0:
            tva_client += '\n'
            has_tva_client = True

        has_tva_fourniss = False
        if len(tva_fourniss) > 0:
            tva_fourniss += '\n'
            has_tva_fourniss = True

        context = {
            'is_fourniss': is_fourniss,
            'date_ctr': R(date_ctr, size=24),
            'n_ctr': R(n_ctr, size=24),
            'adr_fact': R(adr_fact, size=24),
            'adr_fourniss': R(adr_fourniss, size=24),
            'tva_fourniss': R(tva_fourniss, size=24),
            'has_tva_fourniss': has_tva_fourniss,
            'adr_client': R(adr_client, size=24),
            'tva_client': R(tva_client, size=24),
            'has_tva_client': has_tva_client,
            'm_nom': R(m_nom, size=24),
            'm_quantite': R(m_quantite, size=24),
            'm_unite': R(m_unite, size=24),
            'format_livraison': R(format_livraison, size=24),
            'date_livraison': R(periode_livraison, size=24),
            'type_delivery': R(type_deliv, size=24),
            'ville': R(ville, size=24),
            'monnaie': R(monnaie, size=24),
            'prix_num': R(prix_num, size=24),
            'prix_words': R(prix_words, size=24),
            'paiement': R(paiement, size=24),
            'courtage': R(courtage, size=24)
        }

        if filedir is None:
            #            filedir = QtCore.QDir.absoluteFilePath(words_path)
            filedir = QtCore.QFileInfo(words_path).absoluteFilePath()


#            selected_filter = "MS Word Documents (*"+langue_data["code"]+".docx)"
#            fileDialog2 = QtGui.QFileDialog(self, "Où enregistrer ?")
#            options2 = QtGui.QFileDialog.DontResolveSymlinks
#            fileDialog2.setOptions(options2)
#            fileDialog2.setDirectory(words_path)
#            filedir = fileDialog2.getExistingDirectory()

#            filedir = QtGui.QFileDialog.getExistingDirectory(self, "Où enregistrer ?", words_path, QtGui.QFileDialog.ShowDirsOnly)# | QtGui.QFileDialog.DontResolveSymlinks)

        if filedir is None:
            return

        if not filedir.endswith('/'):
            filedir += '/'

        ctr = DocxTemplate(tpl_path)
        ctr.render(context)
        if is_fourniss is False:
            ctr_doc = filedir + filename + "_client.docx"
            ctr.save(ctr_doc)
        else:
            ctr_doc = filedir + filename + ".docx"
            ctr.save(ctr_doc)

        startfile(ctr_doc)

        if is_fourniss is False:
            return self.createPDF(is_fourniss=True,
                                  filedir=filedir,
                                  tpl_path=tpl_path)
Ejemplo n.º 5
0
 def updateStyle(self):
     with open(getFromConfig("path", "stylesheet_file"), 'r') as f:
         style = f.read()
     self.setStyleSheet(style)
Ejemplo n.º 6
0
def ExecutionParser(delivery=None, action=0):

    progressDialog = QtGui.QProgressDialog()
    progressDialog.setAutoClose(False)
    progressDialog.setAutoReset(False)
    label = progressDialog.findChildren(QtGui.QLabel)[0]
    label.setFont(QtGui.QFont("Calibri", 12))
    button = progressDialog.findChildren(QtGui.QPushButton)[0]
    button.hide()
    progressBar = progressDialog.findChildren(QtGui.QProgressBar)[0]
    progressBar.hide()

    path = getFromConfig("path", "exec")
    tmp = makeTMP(path)
    #    try:
    try:
        wb = pyxl.load_workbook(path, read_only=False)
    except:
        return -1

    test = 1
    cpt = 0
    while test == 1 and cpt != 3:
        try:
            wb.save(path)
        except:
            message = 'Fermez le fichier "' + path + '" pour pouvoir poursuivre.'
            QtGui.QMessageBox.question(None, 'Attention !', message,
                                       QtGui.QMessageBox.Yes)
            cpt += 1
            sleep(0.5)
        else:
            cpt += 1
            test = 0
            wb = pyxl.load_workbook(path, read_only=False)
    if cpt == 3:
        try:
            wb.close()
        except:
            pass
        else:
            raise ValueError

    progressDialog.setWindowTitle(u"Édition en cours...")
    text = u"\n\nÉdition du document \n" + path
    progressDialog.setLabelText(text)
    progressDialog.show()
    QtGui.QApplication.processEvents()

    sheet = wb.get_sheet_by_name("Planning")

    i = 0
    if action == 0:
        # on va a la derniere ligne
        i = GetLineIndex(sheet, action)

#            for i in range(1, sheet.max_row+1, 1):
#                cell_value = _format(sheet.cell(row=i, column=2).value)
#                if cell_value == '':
#    #                print i
#                    break
    elif action == 1 or action == 2:
        #on cherche le num de livraison
        if isinstance(delivery, list):
            i = GetLineIndex(sheet, action, delivery[-1].n_livr)
        else:
            i = GetLineIndex(sheet, action, delivery.n_livr)

#            for i in range(1, sheet.max_row+1, 1):
#                cell_value = _format(sheet.cell(row=i, column=17).value)
#                if cell_value == delivery.n_livr:
#    #                print i
#                    break

    if action != 2 and delivery is not None:
        sheet.cell(row=i, column=2).value = delivery.date_appel
        sheet.cell(row=i, column=3).value = delivery.client_name
        sheet.cell(row=i, column=4).value = delivery.fournisseur_name
        if delivery.is_franco: type_livr = "Franco"
        else: type_livr = "Départ"
        sheet.cell(row=i, column=5).value = type_livr
        sheet.cell(row=i, column=6).value = delivery.ville
        sheet.cell(row=i, column=7).value = delivery.date_charg_livr
        sheet.cell(row=i, column=8).value = delivery.horaire_charg_livr
        sheet.cell(row=i, column=9).value = delivery.quantite
        sheet.cell(row=i, column=10).value = delivery.marchandise
        sheet.cell(row=i, column=11).value = delivery.n_ctr
        sheet.cell(row=i, column=12).value = delivery.ref_fourniss
        sheet.cell(row=i, column=13).value = delivery.ref_client
        sheet.cell(row=i, column=14).value = delivery.ref_chargement
        if delivery.is_confirmed: confirmation = "Oui"
        else: confirmation = "Non"
        sheet.cell(row=i, column=15).value = confirmation
        if delivery.is_paid is True: paiement = "Payé"
        else: paiement = ""
        sheet.cell(row=i, column=16).value = paiement
        sheet.cell(row=i, column=17).value = delivery.n_livr
    elif action == 2 and delivery is not None:
        if isinstance(delivery, list):
            for dlv in delivery:
                i = GetLineIndex(sheet, action, dlv.n_livr)
                if i is None: continue
                for j in range(2, 18, 1):
                    sheet.cell(row=i, column=j).value = ""
        else:
            for j in range(2, 18, 1):
                print i, j
                sheet.cell(row=i, column=j).value = ""

    wb.save(path)

    progressDialog.close()
    QtGui.QApplication.processEvents()

    if action == 0:
        message = 'Souhaitez vous ouvrir le fichier Execution ?'
        res = QtGui.QMessageBox.question(
            None, 'Attention !', message,
            QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)
        if res == QtGui.QMessageBox.Yes:
            while True:
                try:
                    openWorkSheet(path, "Planning", readOnly=False)
                except:
                    message = "Le fichier Execution est en cours d'utilisation : fermez le avant !"
                    QtGui.QMessageBox.question(
                        None, 'Attention !', message,
                        QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok)
                    if res == QtGui.QMessageBox.Cancel:
                        break
                else:
                    break


#    except:
#        try:
#            wb.close()
#        except:pass
#        try:
#            os.remove(path)
#            os.rename(tmp, path)
#        except:pass
#
#        return -1
#    else:
#        os.remove(tmp)
#        return 0
    return 0
Ejemplo n.º 7
0
def ReverseExecutionParser():

    from classes import ContractsDatabase
    cDB = ContractsDatabase()
    path = getFromConfig("path", "exec")

    tmp = makeTMP(path)
    try:
        wb = pyxl.load_workbook(path, read_only=True)
        test = 1
        while test == 1:
            try:
                wb.save(path)
            except:
                message = 'Fermez le fichier "' + path + '" pour pouvoir poursuivre.'
                res = QtGui.QMessageBox.question(
                    None, 'Attention !', message,
                    QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Yes)
                if res == QtGui.QMessageBox.Cancel:
                    try:
                        wb.close()
                    except:
                        pass
                    return 1
            else:
                wb.close()
                wb = pyxl.load_workbook(path, read_only=True)
                test = 0

        sheet = wb.get_sheet_by_name("Planning")
        # on va a la derniere ligne puis on de décalle sur la colonne des num de livraison

        last_line = 0
        # on va a la derniere ligne
        for last_line in range(1, sheet.max_row + 1, 1):
            cell_value = _format(sheet.cell(row=last_line, column=2).value)
            if cell_value == '':
                break
        #• puis on de décalle sur la colonne des num de livraison pour chercher le dernier ajout
        for last_registered in range(last_line, 0, -1):
            cell_value = _format(
                sheet.cell(row=last_registered, column=17).value)
            if cell_value != "":
                break

        for i in range(last_registered + 1, last_line, 1):
            dic = {}

            dic["date_appel"] = sheet.cell(row=i, column=2).value
            dic["client_name"] = sheet.cell(row=i, column=3).value
            dic["fournisseur_name"] = sheet.cell(row=i, column=4).value
            cell = sheet.cell(row=i, column=5).value.lower()
            if 'franco' in cell or 'fr' in cell:
                dic["is_franco"] = True
            else:
                dic["is_franco"] = False

            dic["ville"] = sheet.cell(row=i, column=6).value
            dic["date_charg_livr"] = sheet.cell(row=i, column=7).value
            dic["horaire_charg_livr"] = sheet.cell(row=i, column=8).value
            dic["quantite"] = sheet.cell(row=i, column=9).value
            dic["marchandise"] = sheet.cell(row=i, column=10).value
            dic["n_ctr"] = sheet.cell(row=i, column=11).value
            dic["ref_fourniss"] = sheet.cell(row=i, column=12).value
            dic["ref_client"] = sheet.cell(row=i, column=13).value
            dic["ref_chargement"] = sheet.cell(row=i, column=14).value
            cell = sheet.cell(row=i, column=15).value or ""
            if "oui" in cell:
                dic["is_confirmed"] = True
            else:
                dic["is_confirmed"] = False

            cell = sheet.cell(row=i, column=16).value
            cell = _format(cell, set_lower=True, clear=True)
            if "paye" in cell or "p" in cell:
                dic["is_paid"] = True
            else:
                dic["is_paid"] = False

            if dic["n_ctr"] != "":
                num = dic["n_ctr"]
                type_num = NUM_CTR
                ctr_list = cDB.getContractsByNum(num, type_num)
            elif dic["ref_client"] != "" and len(ctr_list) < 1:
                num = dic["ref_client"]
                type_num = NUM_CTR_C
                ctr_list = cDB.getContractsByNum(num, type_num)
            elif dic["ref_fourniss"] != "" and len(ctr_list) < 1:
                num = dic["ref_fourniss"]
                type_num = NUM_CTR_F
                ctr_list = cDB.getContractsByNum(num, type_num)
            if len(ctr_list) < 1:
                message = "Aucun contrat trouvé sous la réf. " + str(num) + "."
                QtGui.QMessageBox.question(None, 'Attention', message,
                                           QtGui.QMessageBox.Yes)
                continue
            else:
                ctr = ctr_list[0]

            dic["n_livr"] = ctr.n_contrat + "-" + str(
                len(ctr.livraisons.keys())).zfill(2)
            sheet.cell(row=i, column=17).value = dic["n_livr"]
            ctr.addDelivery(dic)
            if cDB.updateContract(ctr) < 0:
                raise ValueError

        wb.save(path)
        wb.close()
    except:
        try:
            wb.close()
            return -1
        except:
            pass
        os.remove(path)
        os.rename(tmp, path)
        return -1
    else:
        os.remove(tmp)
    return 0
Ejemplo n.º 8
0
    def updateCtrList(self, ctr_list=None):
        curframe = inspect.currentframe()
        calframe = inspect.getouterframes(curframe, 2)
        print "updateCtrList called by ", calframe[1][3]

        self.t_ctr_list.clear()
        if ctr_list is None or isinstance(ctr_list, list) == False:
            ctr_list = self.sortContractList()

        font = ImageFont.truetype('times.ttf', 12)
        itemlist = []
        for ctr in ctr_list:
            if ctr is None:
                continue
                itemlist = [
                    ' - ', ' - ', ' - ', ' - ', ' - ', ' - ', ' - ', ' - ',
                    ' - ', ' - ', ' - '
                ]
            else:

                if not hasattr(ctr, "descr_livraison"):
                    setattr(ctr, "descr_livraison", "")
                    self.cDB.updateContract(ctr)

                full_marchandise = self.oil_market.getMarchandiseFullName(
                    ctr.marchandise)
                string = ""
                current_size = 0
                for word in full_marchandise.split(' '):
                    current_size += font.getsize(word)[0]
                    if current_size > 80:
                        string += "<br/>"
                        current_size = 0
                    string += word + ' '
                full_marchandise = string
                monnaie = ' ' + getFromConfig(
                    'monnaie', 'monnaies')[ctr.monnaie]['sym'].encode('utf8')

                nom_client = ctr.getClientName(shortest=True).upper(
                ) + "<br/>" + "<i>" + ctr.get_uVilleAcheteur() + "</i>"
                nom_fourniss = ctr.getFournissName(shortest=True).upper(
                ) + "<br/>" + "<i>" + ctr.get_uVilleVendeur() + "</i>"

                if ctr.is_franco:
                    modalite = "Franco <br/>"
                else:
                    modalite = "Départ <br/>"
                modalite += ctr.getVilleCible()

                itemlist = []
                itemlist.append(ctr.date_contrat)
                itemlist.append(ctr.n_contrat)
                itemlist.append(ctr.n_fourniss)
                itemlist.append(nom_client)
                itemlist.append(nom_fourniss)
                itemlist.append(modalite)
                itemlist.append(full_marchandise)
                itemlist.append(format_num(ctr.prix) + monnaie)
                itemlist.append(format_num(ctr.qte_total))
                itemlist.append("")
                itemlist.append(format_num(ctr.reste_livraison))
                itemlist.append(ctr.n_client)
                if '%' in ctr.courtage:
                    itemlist.append(format_num(ctr.courtage) + ' %')
                else:
                    itemlist.append(format_num(ctr.courtage) + ' €')
                itemlist.append(format_num(ctr.reste_paiement) + monnaie)

            blankItemlist = list(
                re.sub(r"<[^>]*>", r'', s.replace("<br/>", '\n'))
                for s in itemlist)

            newLine = TreeWidgetContract(self.t_ctr_list, ctr, blankItemlist)
            for i in range(0, len(itemlist)):
                item = itemlist[i]
                self.t_ctr_list.setItemWidget(newLine, i,
                                              TreeWidgetItemLabel(self, item))

            self.t_ctr_list.setItemWidget(newLine, 9,
                                          DeliveriesViewer(self, ctr))
#
        self.t_ctr_list.header().setResizeMode(
            QtGui.QHeaderView.ResizeToContents)
        self.t_ctr_list.header().setResizeMode(QtGui.QHeaderView.Interactive)
        for i in range(0, len(itemlist), 1):
            self.t_ctr_list.resizeColumnToContents(i)
        self.t_ctr_list.header().setResizeMode(
            self.t_ctr_list.columnCount() - 3, QtGui.QHeaderView.Stretch)
        #        self.repaint()
        self.updateTotal(ctr_list)
Ejemplo n.º 9
0
                handler.close()
                stderr_logger.removeFilter(handler)
        except:
            pass
    #########################################

    # INITIALIZATION ##
    Market()

    # EXECUTE
    setup = Ui_manager(version)
    setup.show()
    splash.finish(setup)

    sys.exit(app.exec_())

if __name__ == '__main__':

    app = QApplication(sys.argv)
    with open(getFromConfig("path", "stylesheet_file"), 'r') as f:
        style = f.read()
    app.setStyleSheet(style)

    pixmap = QPixmap("./data/lancement.png")
    pixmap = pixmap.scaledToHeight(150, Qt.SmoothTransformation)
    splash = QSplashScreen(pixmap, Qt.WindowStaysOnTopHint)
    splash.show()
    app.processEvents()

    main()