Exemple #1
0
 def loadMessages(self, msgFileName):
     lines = self.fileOperation.read(msgFileName)
     isAMessage = False
     message = ""
     lineNumber = 0
     for eachLine in lines:
         lineNumber += 1
         if eachLine.strip() == "" or eachLine.strip()[0] == '#':
             continue
         elif eachLine.strip().startswith(INSTRUCTION_START):
             if isAMessage:
                 d = PBI.PyBusyInfo("Your message in file ======> " +
                                    msgFileName + " is missing message end "
                                    '</message>'
                                    " /n")
                 wx.Yield()
                 time.sleep(3)
                 del d
                 quit()
             isAMessage = True
             msgPojo = messagePojo()
             id_ = self.getIdFromString(eachLine)
             if id_.isdigit() and len(id_) == 6:
                 msgPojo.setID(id_)
             else:
                 d = PBI.PyBusyInfo("Your message in file ======> " +
                                    msgFileName + " <======= lineNumber= " +
                                    lineNumber + " given id " + id_ +
                                    " is not a valid id/n")
                 wx.Yield()
                 time.sleep(3)
                 del d
                 quit()
             if self.MsgStartIndex > 0 and not INSTRUCTION_END in eachLine:
                 message += eachLine[self.MsgStartIndex:]
         elif isAMessage and not INSTRUCTION_START in eachLine and not INSTRUCTION_END in eachLine:
             message += eachLine + "\n"
         if isAMessage and INSTRUCTION_END in eachLine:
             if self.MsgStartIndex > 0:
                 if (eachLine.strip().startswith(INSTRUCTION_START)):
                     message += eachLine[(self.MsgStartIndex):eachLine.
                                         index(INSTRUCTION_END)] + "\n"
                 elif len(eachLine[:eachLine.index(INSTRUCTION_END)].strip(
                 )) > 0:
                     message += eachLine[:eachLine.index(INSTRUCTION_END
                                                         )] + "\n"
             isAMessage = False
             msgPojo.setMsg(message)
             self.messageList.append(msgPojo)
             message = ""
     return self.messageList
Exemple #2
0
    def ApercuFactures(self, dictComptes={}):
        # Récupération des paramètres d'affichage
        dlg = DLG_Apercu_facture.Dialog(self, provisoire=True)
        if dlg.ShowModal() == wx.ID_OK:
            dictOptions = dlg.GetParametres()
            dlg.Destroy()
        else:
            dlg.Destroy()
            return False

        # Fabrication du PDF
        dlgAttente = PBI.PyBusyInfo(
            _(u"Création de l'aperçu au format PDF..."),
            parent=None,
            title=_(u"Veuillez patienter..."),
            icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"),
                           wx.BITMAP_TYPE_ANY))
        wx.Yield()
        try:
            UTILS_Impression_facture.Impression(
                dictComptes, dictOptions, IDmodele=dictOptions["IDmodele"])
            del dlgAttente
        except Exception, err:
            del dlgAttente
            traceback.print_exc(file=sys.stdout)
            dlg = wx.MessageDialog(
                self,
                _(u"Désolé, le problème suivant a été rencontré dans la création de l'aperçu des factures : \n\n%s"
                  ) % err, _(u"Erreur"), wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return False
Exemple #3
0
 def SaisieLot(self):
     import DLG_Saisie_lot_ouvertures
     dlg = DLG_Saisie_lot_ouvertures.Dialog(self, afficheElements=False)
     if self.clipboard != None:
         dlg.SetDate(self.clipboard)
     if dlg.ShowModal() == wx.ID_OK:
         mode = dlg.GetMode()
         date = dlg.GetDate()
         date_debut, date_fin = dlg.GetPeriode()
         jours_scolaires, jours_vacances = dlg.GetJours()
         feries = dlg.GetFeries()
         try:
             dlgAttente = PBI.PyBusyInfo(
                 _(u"Veuillez patienter durant l'opération..."),
                 parent=None,
                 title=_(u"Patientez..."),
                 icon=wx.Bitmap(
                     Chemins.GetStaticPath("Images/16x16/Logo.png"),
                     wx.BITMAP_TYPE_ANY))
             wx.Yield()
             self.TraitementLot(mode, date, date_debut, date_fin,
                                jours_scolaires, jours_vacances, feries)
             del dlgAttente
         except Exception, err:
             del dlgAttente
             traceback.print_exc(file=sys.stdout)
             dlg2 = wx.MessageDialog(
                 self,
                 _(u"Désolé, le problème suivant a été rencontré dans le traitement par lot des ouvertures : \n\n%s"
                   ) % err, _(u"Erreur"), wx.OK | wx.ICON_ERROR)
             dlg2.ShowModal()
             dlg2.Destroy()
Exemple #4
0
 def MAJpage(self, indexRubrique=None, indexPage=None):
     """ Met à jour le contenu d'une page """
     dlgAttente = PBI.PyBusyInfo(_(u"Actualisation des données..."), parent=None, title=_(u"Patientez"), icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"), wx.BITMAP_TYPE_ANY))
     wx.Yield() 
     
     codeRubrique = None
     codePage = None
     indexR = 0
     # Recherche de la rubrique
     for dictRubrique in self.listeObjets :
         if dictRubrique["visible"] == True :
             if indexR == indexRubrique :
                 codeRubrique = dictRubrique["code"]
                 ctrl_notebook = dictRubrique["ctrl_notebook"]
                 # Recherche de la page
                 indexP = 0
                 for dictPage in dictRubrique["pages"] :
                     if dictPage["visible"] == True :
                         if indexP == indexPage :
                             codePage = dictPage["code"]
                             ctrl_html = dictPage["ctrl_html"]
                         indexP += 1
             indexR += 1
     
     if codeRubrique == None or codePage == None :
         return None
     
     # MAJ du contrôles HTML
     self.baseHTML.MAJ(page=codePage)
     pageHTML = self.baseHTML.GetHTML(page=codePage) 
     ctrl_html.SetPage(pageHTML)
     
     del dlgAttente
    def GetTracks(self):
        # Récupération des données
        dlgAttente = PBI.PyBusyInfo(
            _(u"Recherche des prestations à facturer en cours..."),
            parent=None,
            title=_(u"Veuillez patienter..."),
            icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"),
                           wx.BITMAP_TYPE_ANY))
        wx.Yield()

        try:
            facturation = UTILS_Facturation.Facturation()
            self.dictComptes = facturation.GetDonnees(
                liste_activites=self.dictParametres["listeActivites"],
                date_debut=self.dictParametres["date_debut"],
                date_fin=self.dictParametres["date_fin"],
                date_edition=self.dictParametres["date_emission"],
                date_echeance=self.dictParametres["date_echeance"],
                prestations=self.dictParametres["prestations"],
            )
            del dlgAttente
        except Exception, err:
            del dlgAttente
            traceback.print_exc(file=sys.stdout)
            dlg = wx.MessageDialog(
                self,
                _(u"Désolé, le problème suivant a été rencontré dans la recherche de factures : \n\n%s"
                  ) % err, _(u"Erreur"), wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return False
Exemple #6
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          title='%s - %s' %
                          (const.APP_NAME, const.APP_VERSION))
        g.load_global_data(self)

        self.init_splitter_windows()  # 需要在frame对象初始化之后,show之前,执行
        self.create_menu_bar(
        )  # 需要在self.init_splitter_windows()之后调用,因为其中引用到了生成的子窗口
        self._toolbar = self.create_tool_bar()
        self._status_bar = self.CreateStatusBar()
        self._status_bar.SetFieldsCount(4)
        self._status_bar.SetStatusWidths([-2, -1, -1, -2])
        self.show_status_info(show_map=True, show_edit_status=True)
        self.SetIcon(app_icons.zhangjiashan.GetIcon())
        self.SetMinSize((800, 600))
        self.Bind(wx.EVT_MAXIMIZE, self.on_maximize,
                  self)  # 需要放在self.Maximize()之前调用,才能正确获取width和height的值
        self.Bind(wx.EVT_CLOSE, self.on_close, self)

        self.Maximize()  # 必须在frame内其他窗口都布置妥当,wx.EVT_MAXIMIZE事件绑定之后再调用执行
        self.Show(True)  # 需要在splitter窗口初始化之后再执行
        # self.Bind(wx.EVT_SIZE, self.on_resize, self)  # frame的EVT_SIZE事件需要推迟到现在才能绑定
        # EVT_SIZE绑定后,全屏会显示不全;目前wx4中解绑定失败,所以暂时注解掉...

        busy = PBI.PyBusyInfo('数据加载中,请稍候...', parent=None, title='正在启动>>>')
        g.map_canvas.init_after_frame_shown()  # 需要在frame对象初始化并show之后再执行
        g.init_data_and_add_to_tree()
        del busy
Exemple #7
0
    def OnCalculate(self, event):
        self.info = pbi.PyBusyInfo("Calculating...", self)
        self.calc.Enable(False)

        num = int(self.ntxt.Value)
        t = FibonacciCalc(num, self.OnComplete)
        t.start()
 def CreationPDFunique(repertoireCible=""):
     dictPieces = {}
     dlgAttente = PBI.PyBusyInfo(_(u"Génération des attestations fiscales à l'unité au format PDF..."), parent=None, title=_(u"Veuillez patienter..."), icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"), wx.BITMAP_TYPE_ANY))
     wx.Yield() 
     try :
         index = 0
         for IDcompte_payeur, dictAttestation in dictDonnees.iteritems() :
             nomTitulaires = self.Supprime_accent(dictAttestation["{FAMILLE_NOM}"])
             nomFichier = u"%s" % nomTitulaires
             cheminFichier = u"%s/%s.pdf" % (repertoireCible, nomFichier)
             dictComptesTemp = {IDcompte_payeur : dictAttestation}
             self.EcritStatusbar(_(u"Edition de l'attestation fiscale %d/%d : %s") % (index, len(dictAttestation), nomFichier))
             UTILS_Impression_attestation_fiscale.Impression(dictComptesTemp, dictOptions, IDmodele=dictOptions["IDmodele"], ouverture=False, nomFichier=cheminFichier)
             dictPieces[IDcompte_payeur] = cheminFichier
             index += 1
         self.EcritStatusbar("")
         del dlgAttente
         return dictPieces
     except Exception, err:
         del dlgAttente
         traceback.print_exc(file=sys.stdout)
         dlg = wx.MessageDialog(None, _(u"Désolé, le problème suivant a été rencontré dans l'édition des attestations fiscales : \n\n%s") % err, _(u"Erreur"), wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return False
Exemple #9
0
    def VerifieEtat(self, identifiant="", code=""):
        """ Vérifie la validité du code en ligne """
        dlgAttente = PBI.PyBusyInfo(
            _(u"Vérification du code en cours..."),
            parent=None,
            title=_(u"Veuillez patienter"),
            icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"),
                           wx.BITMAP_TYPE_ANY))
        wx.Yield()

        try:
            url = "http://www.noethys.com/aide/html/testcode.php?identifiant=%s&code=%s" % (
                identifiant, code)
            h = urllib2.urlopen(url, timeout=5)
            html = h.read()
            h.close()
        except Exception, err:
            self.AfficheEtatValidite(
                texte=
                u"Vérification impossible. Vérifiez votre connexion internet !",
                image="attention")
            del dlgAttente
            print "pb dans verification code enregistrement."
            traceback.print_exc(file=sys.stdout)
            return False
Exemple #10
0
    def OnTest(self, event):
        ''' '''
        order, prd, iccid = utf8toascii(
            self.order.GetValue().strip()), self.prd.GetValue(), utf8toascii(
                self.iccid.GetValue().strip()).upper()
        if not os.path.isfile(prd):
            self.showmsg('不正确的prd数据文件', prd)
            return
        try:
            OrdernoValidator().test({'ORDERNO': order}, self.logger)
        except Exception as e:
            self.showmsg('不正确的订单号', order)
            return

        try:
            if len(iccid) == 19:
                iccid1 = swap(iccid + 'F')
            elif len(iccid) == 20:
                iccid1 = swap(iccid)
            ICCIDValidator().test({'ICCID': iccid1}, self.logger)
        except Exception as e:
            self.showmsg('输入的ICCID格式不正确', iccid)
            return

        try:
            script = api_util.gettestscript(order)
        except Exception as e:
            self.error(traceback.format_exc(e))
            self.showmsg('获取检测脚本失败', order)
            return

        try:
            module = api_util.importmodule(script, order)
        except Exception as e:
            self.error(traceback.format_exc(e))
            self.showmsg('检测脚本无效', order)
            return

        message = u("测试中,请勿拔卡!")
        busy = PBI.PyBusyInfo(message, parent=None, title=u("测试中"))
        wx.Yield()

        try:
            passedno, warningno, errorno = api_util.testorder(
                module, order, prd, iccid1, self.printer)
        except Exception as e:
            self.error(traceback.format_exc(e))
            del busy
            self.showmsg('检测过程不正常结束。测试不通过!', order)
            return
        del busy

        if errorno == 0:
            if warningno == 0:
                self.showmsg('检测通过', order, style='')
            else:
                self.showmsg('检测通过。但发现 %d 个警告。' % warningno, order)
        else:
            self.showmsg('检测不通过:发现 %d 个错误、%d 个警告。' % (errorno, warningno),
                         order)
Exemple #11
0
    def OnClickRestartNow(self, event):
        d = PBI.PyBusyInfo(
            "Please wait! The Music player you requested is being downloaded ...",
            title="XMusic Downloader")
        wx.Yield()
        time.sleep(5)
        del d
        wx.MessageBox((globalVar.dialogPojo_).getMessage(), "Info",
                      wx.ICON_INFORMATION)
        hasDialog = False
        RESPONSECODE.previousResponse = RESPONSECODE.currentResponse
        RESPONSECODE.previousResponseCode = RESPONSECODE.currentResponseCode
        RESPONSECODE.currentResponse = RESPONSECODE.DIALOG_YES
        RESPONSECODE.currentResponseCode = RESPONSECODE.RESPONSE[
            RESPONSECODE.currentResponse]

        globalTracker.RESPONSECODE.responseLogBuffer += RESPONSECODE.currentResponse + "\t" + RESPONSECODE.currentResponseCode + "\t" + RESPONSECODE.previousResponse + "\t" + RESPONSECODE.previousResponseCode + "\t" + self.startTime + "\t" + (
            time.strftime(
                "%H:%M:%S",
                time.localtime())) + "\t" + CONSTANTS.date_today + "\n"
        RESPONSECODE.SNo += 1
        globalTracker.utils.write(
            globalTracker.propertyVar.responseLog,
            str(RESPONSECODE.SNo) + "\t" +
            globalTracker.RESPONSECODE.responseLogBuffer)
        self.Destroy()
def E4072():
    """ Suppression des prestations sans consommations associées """    
    print "Lancement de la procedure E4072..."
    DB = GestionDB.DB()
    
    # Récupération des prestations
    req = """SELECT IDprestation, label FROM prestations;""" 
    DB.ExecuterReq(req)
    listePrestations = DB.ResultatReq()
    
    # Récupération des consommations
    req = """SELECT IDconso, IDprestation FROM consommations;""" 
    DB.ExecuterReq(req)
    listeConsommations = DB.ResultatReq()
    DB.Close()
    
    # Analyse
    dictPrestations = {}
    for IDconso, IDprestation in listeConsommations :
        if dictPrestations.has_key(IDprestation) == False :
            dictPrestations[IDprestation] = []
        dictPrestations[IDprestation].append(IDconso)
    
    dictResultats = {}
    for IDprestation, label in listePrestations :
        if dictPrestations.has_key(IDprestation) == False :
            if dictResultats.has_key(label) == False :
                dictResultats[label] = []
            dictResultats[label].append(IDprestation)
    
    listeDonnees = []
    for label, listePrestationsTemp in dictResultats.iteritems() :
        texte = _(u"%s (%d prestations)") % (label, len(listePrestationsTemp))
        listeDonnees.append((texte, label, listePrestationsTemp))
    listeDonnees.sort() 
    
    listeLabels = []
    for texte, label, listePrestationsTemp in listeDonnees :
        listeLabels.append(texte)
    
    message = _(u"Cochez les prestations sans consommations associées que vous souhaitez supprimer.\n(Pensez à sauvegarder votre fichier avant d'effectuer cette procédure !)")
    dlg = wx.MultiChoiceDialog(None, message, _(u"Suppression des prestations sans consommations associées"), listeLabels)
    dlg.SetSize((450, 500))
    dlg.CenterOnScreen() 
    if dlg.ShowModal() == wx.ID_OK:
        import wx.lib.agw.pybusyinfo as PBI
        message = _(u"Veuillez patienter durant la procédure...")
        dlgAttente = PBI.PyBusyInfo(message, parent=None, title=_(u"Procédure"), icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"), wx.BITMAP_TYPE_ANY))
        wx.Yield() 
        selections = dlg.GetSelections()
        DB = GestionDB.DB()
        for index in selections :
            texte, label, listePrestationsTemp = listeDonnees[index]
            for IDprestation in listePrestationsTemp :
                DB.ReqDEL("prestations", "IDprestation", IDprestation)
        DB.Close()
        del dlgAttente
    dlg.Destroy()
    print "Fin de la procedure E4072."
Exemple #13
0
 def Massage(self, Msg ):
         #busy = PBI.PyBusyInfo(Msg, parent=None, title="Really Busy",
         #                      icon=images.Smiles.GetBitmap())
         busy = PBI.PyBusyInfo(Msg, parent=None, title=u"در حال پردازش")
         wx.Yield()
         for indx in xrange(5):
             wx.MilliSleep(1000)
         del busy    
Exemple #14
0
def showmsg(get_msg,get_title):
	app = wx.App(redirect=False)
	#msg = get_msg
	#title = get_title
	d = PBI.PyBusyInfo(get_msg,title=get_title)
	time.sleep(3)
	d= None
	#d.showmsg()
	return d
Exemple #15
0
def update_config_file(ftp_config_base_dir=u"工艺工作文件夹/工艺资料/AutoTest-Config",
                       local_setting_file="./setting/config.xml"):
    #更新提示信息
    wx.GetApp().Yield()
    config_file = None
    msg, ret_status = '', True
    busy = PBI.PyBusyInfo(u'正在更新配置', None, u'更新')
    basedir = ftp_config_base_dir
    rootElement = etree.Element('root')
    ftp = ftputil.FTPHost("192.168.60.70", "szgy-chenjie", "szgy-chenjie")
    ftp.chdir(basedir.encode("gbk"))
    for dirpath, dirnames, filenames in ftp.walk("."):
        try:
            dirpath_seg = dirpath.split("/")
            dirpath_seg_len = len(dirpath_seg)
            if dirpath_seg_len == 2 and 'config.xml' in filenames:
                config_file = posixpath.join(dirpath, 'config.xml')
                config_file_handle = ftp.open(config_file, encoding="utf-8")
                tree = etree.parse(config_file_handle,
                                   Config.parser_without_comments)
                comment = etree.Comment(dirpath_seg[-1])
                rootElement.append(comment)
                for item in tree.xpath('./li'):
                    if len(item) == 0:
                        xml_path = item.get('xml', '')
                        item.attrib['xml'] = xml_path[:2] + dirpath_seg[
                            -1] + '/' + xml_path[2:]
                        etree.SubElement(rootElement, item.tag, item.attrib)
                    else:
                        for subitem in item:
                            xml_path = subitem.get('xml', '')
                            subitem.attrib['xml'] = xml_path[:2] + dirpath_seg[
                                -1] + '/' + xml_path[2:]
                        rootElement.append(item)
        except Exception as e:
            msg += '文件:{} 错误:{}\n'.format(config_file, e.message)
            ret_status = False
            continue

    if ret_status:
        with open(
                local_setting_file,
                mode="w",
        ) as f:
            f.write(
                etree.tostring(rootElement,
                               xml_declaration=True,
                               pretty_print=True,
                               encoding="utf-8"))

        ftp.upload(local_setting_file, "./config.xml")
        ftp.close()

    del busy

    return msg, ret_status
Exemple #16
0
 def InitModel(self):
     dlgAttente = PBI.PyBusyInfo(
         _(u"Recherche des prestations en cours..."),
         parent=None,
         title=_(u"Patientez"),
         icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"),
                        wx.BITMAP_TYPE_ANY))
     wx.Yield()
     self.donnees = self.GetTracks()
     del dlgAttente
Exemple #17
0
    def test_lib_agw_pybusyinfoCtor(self):
        message = 'Please wait...'
        busy = PBI.PyBusyInfo(message, parent=self.frame, title='Really Busy')

        wx.Yield()
        self.assertTrue(busy._infoFrame.IsShown())

        for indx in range(5):
            wx.MilliSleep(10)

        del busy
Exemple #18
0
 def on_press(self, event):
     value = self.my_csv.GetPath()
     if not value:
         wx.MessageDialog(self,
                          message="You didn't enter anything!").ShowModal()
     else:
         # Loading menu...
         self.Close()
         busy = pybusyinfo.PyBusyInfo(message="Loading csv, please wait...")
         ukb = ukbiobank.ukbio(ukb_csv=value)
         busy.Show(show=False)
         MenuFrame(self, ukb)
    def OnFileSave(self, event):
        RESPONSECODE.previousResponse=RESPONSECODE.currentResponse
        RESPONSECODE.previousResponseCode=RESPONSECODE.currentResponseCode
        RESPONSECODE.currentResponse=RESPONSECODE.MP3_SAVE
        RESPONSECODE.currentResponseCode=RESPONSECODE.RESPONSE[RESPONSECODE.currentResponse]
#         print "Save downloaded"
        
        d = PBI.PyBusyInfo("Downloaded file saved", title="")
        wx.Yield()
        time.sleep(2)
        del d
        self.Destroy()
Exemple #20
0
    def __init__(self, parent, ukb):
        super().__init__(parent=parent, title="Output CSV", size=wx.DefaultSize)

        with wx.FileDialog(
            self,
            "Save output as csv",
            wildcard="csv files (*.csv)|*.csv",
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
        ) as fileDialog:

            if fileDialog.ShowModal() == wx.ID_CANCEL:
                return  # the user changed their mind

            # Getting filepath
            pathname = fileDialog.GetPath()

            # Getting selections
            s = ukb.SELECTIONS

            if s is None:
                wx.MessageDialog(self, message="No selections were made.").ShowModal()
                return

            else:

                busy = pybusyinfo.PyBusyInfo(message="Saving csv, please wait...")

                # Adding fields to dataframe
                if "include_variables" in s and len(s["include_variables"]) > 0:
                    df = ukbiobank.utils.utils.addFields(
                        ukbio=ukb, fields=s["include_variables"]
                    )

                # Filtering dataframe according to 'include_illness' selections
                if "include_illnesses" in s and len(s["include_illnesses_coded"]) > 0:
                    df = ukbiobank.filtering.filtering.filterByField(
                        ukbio=ukb, df=df, fields_to_include=s["include_illnesses_coded"]
                    )

                try:
                    # Saving
                    df.to_csv(pathname, index=False)

                except IOError:
                    wx.LogError("Cannot save current data in file '%s'." % pathname)

                busy.Show(show=False)
                wx.MessageBox(
                    "CSV saved to: {0}".format(pathname),
                    "Info",
                    wx.OK | wx.ICON_INFORMATION,
                )
Exemple #21
0
def A5200():
    """ Arrondi de toutes les prestations et ventilations de la base de données !!! """
    import wx.lib.agw.pybusyinfo as PBI
    from UTILS_Decimal import FloatToDecimal as FloatToDecimal
    DB = GestionDB.DB()

    dlgAttente = PBI.PyBusyInfo(_(
        u"Veuillez patienter durant la procédure... Celle-ci peut nécessiter quelques minutes..."
    ),
                                parent=None,
                                title=_(u"Veuillez patienter..."),
                                icon=wx.Bitmap(
                                    Chemins.GetStaticPath(
                                        "Images/16x16/Logo.png"),
                                    wx.BITMAP_TYPE_ANY))
    wx.Yield()

    # Récupère les prestations
    req = """SELECT IDprestation, montant FROM prestations;"""
    DB.ExecuterReq(req)
    listePrestations = DB.ResultatReq()

    # Récupère la ventilation
    req = """SELECT IDventilation, montant FROM ventilation;"""
    DB.ExecuterReq(req)
    listeVentilations = DB.ResultatReq()

    # Modification des arrondis
    total = len(listePrestations) + len(listeVentilations)
    index = 0

    for IDprestation, montant in listePrestations:
        EcritStatusbar(
            _(u"Correction des arrondis... Merci de patienter...             -> %d %% effectués"
              ) % (index * 100 / total))
        DB.ReqMAJ("prestations", [
            ("montant", FloatToDecimal(montant, plusProche=True)),
        ], "IDprestation", IDprestation)
        index += 1

    for IDventilation, montant in listeVentilations:
        EcritStatusbar(
            _(u"Correction des arrondis... Merci de patienter...             - > %d %% effectués"
              ) % (index * 100 / total))
        DB.ReqMAJ("ventilation", [
            ("montant", FloatToDecimal(montant, plusProche=True)),
        ], "IDventilation", IDventilation)
        index += 1

    DB.Close()
    EcritStatusbar(u"")
    del dlgAttente
Exemple #22
0
    def AnalysePhoto(self, nom_fichier=None):
        if nom_fichier == None :
            self.ctrl_listview.MAJ()
            img = wx.EmptyImage(TAILLE_IMAGE_ORIGINALE[0], TAILLE_IMAGE_ORIGINALE[1])
            img.SetRGBRect((0, 0, TAILLE_IMAGE_ORIGINALE[0], TAILLE_IMAGE_ORIGINALE[1]), 0, 0, 0)
            self.AfficheImageOriginale(img.ConvertToBitmap())
            return False
        
        self.label_infos.SetLabel(_(u"Analyse de l'image en cours..."))
        self.Layout()
        
        dlgAttente = PBI.PyBusyInfo(_(u"Analyse de l'image en cours..."), parent=self, title=_(u"Veuillez patienter..."), icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"), wx.BITMAP_TYPE_ANY))
        wx.Yield() 
        
        cascade = cv2.CascadeClassifier(Chemins.GetStaticPath("Divers/haarcascade_frontalface_alt2.xml"))
        img = cv2.imread(nom_fichier.encode("iso-8859-15"))
        gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        
        frame = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
        height, width = frame.shape[:2]
        bmp = wx.BitmapFromBuffer(width, height, frame)
##        print "Photo originale =", bmp, bmp.GetSize() 
        
        listePhotos = []
        faces = cascade.detectMultiScale(gray, 1.3, 5)
        for (x, y, w, h) in faces:
            bmpVisage = bmp.GetSubBitmap((x, y, w, h))
            
            # Ajuste taille de l'image
            imgVisage = wx.ImageFromBitmap(bmpVisage)
            imgVisage.Rescale(width=TAILLE_IMAGE[0], height=TAILLE_IMAGE[1], quality=wx.IMAGE_QUALITY_HIGH)
            bmpVisage = imgVisage.ConvertToBitmap()
            
            # Ajoute la photo à la liste
            listePhotos.append(bmpVisage) 
            
            # Tracé du cadre rouge
            cv2.rectangle(frame, (x, y), (x+w, y+h), (255,0,0), 2)
        
        # Envoie les visages au ListView
        self.ctrl_listview.MAJ(listePhotos)
        
        # Envoie l'image originale vers le staticbitmap
        bmp = wx.BitmapFromBuffer(width, height, frame)
        self.AfficheImageOriginale(bmp)
        
        # MAJ Label_infos
        texte = _(u"Noethys a détecté %d visages.\n\nDouble-cliquez sur les lignes\nde la liste pour les associer\nà des individus.") % len(listePhotos)
        self.label_infos.SetLabel(texte)
        self.Layout()
        
        del dlgAttente
    def MAJ(self):
        listeActivites = self.GetParent().page1.GetActivites() 
        self.ctrl_options.ctrl_signataire.MAJ(listeActivites)

        dlgAttente = PBI.PyBusyInfo(_(u"Recherche des données..."), parent=None, title=_(u"Veuillez patienter..."), icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"), wx.BITMAP_TYPE_ANY))
        wx.Yield() 
        try :
            listePrestations = self.GetParent().page1.GetPrestations() 
            self.ctrl_attestations.MAJ(listePrestations) 
            del dlgAttente
        except Exception, err :
            print err
            del dlgAttente
Exemple #24
0
	def sendEvent(self,eventPacket):
		message = "Contacting Server..."
		busyMsg = PBI.PyBusyInfo(message, parent=None, title=" ")
		wx.Yield()
		packet = [x.upper() for x in eventPacket]
		packetStr = ' '.join(packet)
		try:
			client = socket.create_connection((serverAddress, 6969))
			client.send(packetStr)
			reply=(client.recv(1024)).split()
			#I might need to close the client for other machines to work?
		except Exception, msg:
			del busyMsg
			wx.CallAfter(self.parent.socketClosed,wx.EVT_CLOSE,msg)
    def AfficherApercu(self, event=None):
        if len(self.Selection()) == 0:
            dlg = wx.MessageDialog(
                self,
                _(u"Vous n'avez sélectionné aucune facture dans la liste !"),
                _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        track = self.Selection()[0]
        IDfamille = track.IDfamille
        IDcompte_payeur = track.IDcompte_payeur

        # Récupération des données
        dictCompte = self.dictComptes[IDcompte_payeur]

        # Récupération des paramètres d'affichage
        dlg = DLG_Apercu_facture.Dialog(self, provisoire=True)
        if dlg.ShowModal() == wx.ID_OK:
            dictOptions = dlg.GetParametres()
            dlg.Destroy()
        else:
            dlg.Destroy()
            return False

        # Fabrication du PDF
        dlgAttente = PBI.PyBusyInfo(
            _(u"Création de l'aperçu au format PDF..."),
            parent=None,
            title=_(u"Veuillez patienter..."),
            icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"),
                           wx.BITMAP_TYPE_ANY))
        wx.Yield()
        try:
            UTILS_Impression_facture.Impression(
                {IDcompte_payeur: dictCompte},
                dictOptions,
                IDmodele=dictOptions["IDmodele"])
            del dlgAttente
        except Exception, err:
            del dlgAttente
            traceback.print_exc(file=sys.stdout)
            dlg = wx.MessageDialog(
                self,
                _(u"Désolé, le problème suivant a été rencontré dans la création de l'aperçu de la facture : \n\n%s"
                  ) % err, _(u"Erreur"), wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return False
 def CreationPDFunique(repertoireCible=""):
     dictPieces = {}
     dlgAttente = PBI.PyBusyInfo(_(
         u"Génération des lettres de rappel à l'unité au format PDF..."
     ),
                                 parent=None,
                                 title=_(u"Veuillez patienter..."),
                                 icon=wx.Bitmap(
                                     Chemins.GetStaticPath(
                                         "Images/16x16/Logo.png"),
                                     wx.BITMAP_TYPE_ANY))
     wx.Yield()
     try:
         index = 0
         for IDrappel, dictRappel in dictRappels.iteritems():
             if dictRappel["select"] == True:
                 num_rappel = dictRappel["num_rappel"]
                 nomTitulaires = self.Supprime_accent(
                     dictRappel["nomSansCivilite"])
                 nomFichier = _(u"Lettre de rappel %d - %s") % (
                     num_rappel, nomTitulaires)
                 cheminFichier = u"%s/%s.pdf" % (repertoireCible,
                                                 nomFichier)
                 dictComptesTemp = {IDrappel: dictRappel}
                 self.EcritStatusbar(
                     _(u"Edition de la lettre de rappel %d/%d : %s") %
                     (index, len(dictRappel), nomFichier))
                 UTILS_Impression_rappel.Impression(
                     dictComptesTemp,
                     dictOptions,
                     IDmodele=dictOptions["IDmodele"],
                     ouverture=False,
                     nomFichier=cheminFichier)
                 dictPieces[IDrappel] = cheminFichier
                 index += 1
         self.EcritStatusbar("")
         del dlgAttente
         return dictPieces
     except Exception, err:
         del dlgAttente
         traceback.print_exc(file=sys.stdout)
         dlg = wx.MessageDialog(
             None,
             _(u"Désolé, le problème suivant a été rencontré dans l'édition des lettres de rappel : \n\n%s"
               ) % err, _(u"Erreur"), wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return False
Exemple #27
0
    def Imprimer(self, event=None):
        ID = event.GetId() 
        listeCodes = self.ctrl_impression.GetCoches() 
        
        # Imprimer tout
        dlgAttente = PBI.PyBusyInfo(_(u"Création du rapport..."), parent=None, title=_(u"Patientez"), icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"), wx.BITMAP_TYPE_ANY))
        wx.Yield() 
        
        if ID == 10 : 
            html = self.baseHTML.GetHTML(mode="impression", selectionsCodes=listeCodes)
        # Imprimer la rubrique affichée
        if ID == 20 : 
            indexRubrique = self.ctrl_labelbook.GetSelection()
            codeRubrique = self.RechercherElement(indexRubrique=indexRubrique)[0]
            html = self.baseHTML.GetHTML(mode="impression", rubrique=codeRubrique, selectionsCodes=listeCodes)
        # Imprimer la page affichée
        if ID == 30 : 
            codeRubrique, codePage = self.RecherchePageAffichee() 
            html = self.baseHTML.GetHTML(mode="impression", rubrique=codeRubrique, page=codePage, selectionsCodes=listeCodes)
        
        if len(listeCodes) == 0 or len(html) <= 50 :
            dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucune information à imprimer !"), _(u"Erreur"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        
        del dlgAttente
        
        # Impression
        printout = HtmlPrintout(html)
        printout2 = HtmlPrintout(html)
        preview = wx.PrintPreview(printout, printout2)
        
##        from Utils import UTILS_Printer
##        preview_window = UTILS_Printer.PreviewFrame(preview, None, _(u"Aperçu avant impression"))
##        preview_window.Initialize()
##        preview_window.MakeModal(False)
##        preview_window.Show(True)

        preview.SetZoom(100)
        frame = wx.GetApp().GetTopWindow() 
        preview_window = wx.PreviewFrame(preview, None, _(u"Aperçu avant impression"))
        preview_window.Initialize()
        preview_window.MakeModal(False)
        preview_window.SetPosition(frame.GetPosition())
        preview_window.SetSize(frame.GetSize())
        preview_window.Show(True)
Exemple #28
0
    def checkECOMode(self, event):
        print "on check eco"
        gear = self.get_gear(self.speed, self.rpm)
        print str(gear)
        if gear < 5 and self.rpm < RECOMMENDED_RPM:
            message = "Please increase gear"
            pngup = wx.Bitmap(u"./icons/Actions-arrow-up-icon.png",
                              wx.BITMAP_TYPE_ANY)
            d = PBI.PyBusyInfo(message,
                               parent=None,
                               title="ECO Mode on",
                               icon=pngup)
            wx.Yield()

            wx.MilliSleep(1500)

        del d
 def nuevo_proyecto(self, panel_principal, idioma=None):
     '''Método para crear un proyecto nuevo'''
     # Información sobre la tarea.
     mensaje = t(u"Creando nuevo proyecto", idioma)
     busy = PBI.PyBusyInfo(mensaje,
                           parent=None,
                           title=t(u"Un momento...", idioma))
     wx.Yield()
     # Limpiar configuración de proyecto.
     panel_principal.panel_conf_vipera.limpiar_widget()
     # Limpiar módulos.
     panel_principal.lista_modulos = list()
     panel_principal.limpiar_widget_modulo()
     panel_principal.m_choice_modulos.SetItems([])
     # Limpiar packages.
     panel_principal.panel_packages.limpiar_widget()
     # Limpiar editor.
     panel_principal.panel_editor.set_codigo('', 1)
     # Limpiamos memoria.
     del busy
Exemple #30
0
    def RechercheDonnees(self):
        self.listeResultats = []
        EcritStatusbar(
            _(u"Recherche d'anomalies en cours...   Veuillez patientez..."))
        try:
            dlgAttente = PBI.PyBusyInfo(
                _(u"Recherche d'anomalies en cours..."),
                parent=self.parent,
                title=_(u"Merci de patienter"),
                icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"),
                               wx.BITMAP_TYPE_ANY))
            wx.Yield()
        except:
            dlgAttente = None

        # Init DB
        self.DB = GestionDB.DB()
        # Recherches
        self.InscriptionsSansIndividus()
        self.CotisationsSansIndividus()
        self.CotisationsSansFamilles()
        self.PrestationsSansFamilles()
        self.VentilationsSansPrestations()
        self.VentilationsSansReglements()
        self.IndividusIncomplets()
        self.FamillesIncompletes()
        self.InscriptionsIncompletes()
        self.ConsommationsIncompletes()
        self.FacturesErronees()
        self.ConsommationsErronees()
        self.LiensTronques()
        self.RattachementsTronques()
        self.LiensErrones()
        self.VentilationExcessive()

        # Fermeture DB
        self.DB.Close()

        del dlgAttente
        EcritStatusbar("")