コード例 #1
0
ファイル: ossbrowser.py プロジェクト: winningalong/OSSTools
def OnEditAclOK(event):
    global selected_bucket
    global edit_bucket_acl_option
    global edit_bucket_acl_frame
    global operation_listctrl
    global log
    if not edit_bucket_acl_option:
        dlg = wx.MessageDialog(oss_frame, u'请选中一个ACL值!',
                               u'提示信息',
                               wx.OK | wx.ICON_INFORMATION
                               #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                               )
        dlg.ShowModal()
        dlg.Destroy()
    else:
        if oss:
            if edit_bucket_acl_option == acl_options[1]:
                new_buc_res = put_bucket(oss, selected_bucket, acl_values[1], headers={})
            elif edit_bucket_acl_option == acl_options[2]:
                new_buc_res = put_bucket(oss, selected_bucket, acl_values[2], headers={})
            else:
                new_buc_res = put_bucket(oss, selected_bucket, acl_values[0], headers={})
            if new_buc_res:
                dlg = wx.MessageDialog(edit_bucket_acl_frame, u'Bucket [ '+ unicodise(selected_bucket) +u' ] ACL值修改成功!',
                            u'提示信息',
                            wx.OK | wx.ICON_INFORMATION
                            #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                            )
                dlg.ShowModal()
                dlg.Destroy()
                if log.closed:
                    log = open('log.txt', 'a+')
                log.write((u'[' + unicodise(time.asctime()) + u']  修改Bucket [ ' + unicodise(selected_bucket) + u' ] ACL值成功。  [OK]\n').encode('utf-8'))
                log.flush()
                edit_bucket_acl_frame.Close()
                ## update operation_listctrl
                operation_listctrl.Append([u'[' + unicodise(time.asctime()) + u']  修改Bucket [ ' + unicodise(selected_bucket) + u' ] ACL值成功。  [OK]\n'])
            else:
                dlg = wx.MessageDialog(edit_bucket_acl_frame, u'Bucket [ '+ unicodise(selected_bucket) +u' ] ACL值修改失败!',
                            u'错误提示',
                            wx.OK | wx.ICON_INFORMATION
                            #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                            )
                dlg.ShowModal()
                dlg.Destroy()
                if log.closed:
                    log = open('log.txt', 'a+')
                log.write((u'[' + unicodise(time.asctime()) + u']  修改Bucket [ ' + unicodise(selected_bucket) + u' ] ACL值失败。  [Failure]\n').encode('utf-8'))
                log.flush()
                edit_bucket_acl_frame.Close()
                ## update operation_listctrl
                operation_listctrl.Append([u'[' + unicodise(time.asctime()) + u']  修改Bucket [ ' + unicodise(selected_bucket) + u' ] ACL值失败。  [Failure]\n'])
        else:
            dlg = wx.MessageDialog(edit_bucket_acl_frame, u'OSS用户验证信息错误!',
                            u'错误提示',
                            wx.OK | wx.ICON_INFORMATION
                            #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                            )
            dlg.ShowModal()
            dlg.Destroy()
            if log.closed:
                log = open('log.txt', 'a+')
            log.write((u'[' + unicodise(time.asctime()) + u']  修改Bucket [ ' + unicodise(selected_bucket) + u' ] ACL值失败,错误提示:OSS验证信息失败。  [Failure]\n').encode('utf-8'))
            log.flush()
            edit_bucket_acl_frame.Close()
            ## update operation_listctrl
            operation_listctrl.Append([u'[' + unicodise(time.asctime()) + u']  修改Bucket [ ' + unicodise(selected_bucket) + u' ] ACL值失败,错误提示:OSS验证信息失败。  [Failure]\n'])
コード例 #2
0
def Warn(parent, message, caption='Warning!'):
    import wx
    dlg = wx.MessageDialog(parent, message, caption, wx.OK | wx.ICON_WARNING)
    dlg.ShowModal()
    dlg.Destroy()
コード例 #3
0
ファイル: simpleDialog.py プロジェクト: riku22/TCV
def yesNoDialog(title, message,parent=None):
	dialog = wx.MessageDialog(parent,message,title,wx.YES_NO)
	result = dialog.ShowModal()
	dialog.Destroy()
	return result
コード例 #4
0
 def wtf(self, event):
     wtf = wx.MessageDialog(
         None,
         'This means, that UrTDSC can fail with creating list of demos.\n\nOn the left - demos that will be added to archive.\n\nOn the right - demos, that in 40 minutes range and will not be added to archive.\n\nUnder these lists - short demo information. Select demo to get it.',
         'UrTDSC - WTF IS THAT?', wx.OK | wx.ICON_INFORMATION)
     wtf.ShowModal()
コード例 #5
0
ファイル: OL_Ecoles.py プロジェクト: tarachetatete/Noethys
    def Supprimer(self, event):
        if UTILS_Utilisateurs.VerificationDroitsUtilisateurActuel(
                "parametrage_ecoles", "supprimer") == False:
            return
        if len(self.Selection()) == 0:
            dlg = wx.MessageDialog(
                self,
                _(u"Vous n'avez sélectionné aucune école dans la liste"),
                _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        IDecole = self.Selection()[0].IDecole

        # Vérifie que cette école n'a pas déjà été attribué à une classe
        DB = GestionDB.DB()
        req = """SELECT COUNT(IDclasse)
        FROM classes 
        WHERE IDecole=%d
        ;""" % IDecole
        DB.ExecuterReq(req)
        nbreClasses = int(DB.ResultatReq()[0][0])
        DB.Close()
        if nbreClasses > 0:
            dlg = wx.MessageDialog(
                self,
                _(u"Cette école a déjà été rattachée à %d classes.\nVous ne pouvez donc la supprimer."
                  ) % nbreClasses, _(u"Avertissement"),
                wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return

        # Vérifie que cette école n'a pas déjà été attribué à une scolarité
        DB = GestionDB.DB()
        req = """SELECT COUNT(IDindividu)
        FROM scolarite 
        WHERE IDecole=%d
        ;""" % IDecole
        DB.ExecuterReq(req)
        nbreIndividus = int(DB.ResultatReq()[0][0])
        DB.Close()
        if nbreIndividus > 0:
            dlg = wx.MessageDialog(
                self,
                _(u"Cette école a déjà été attribuée à %d individus.\nVous ne pouvez donc la supprimer."
                  ) % nbreIndividus, _(u"Avertissement"),
                wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return

        # Confirmation de suppression
        dlg = wx.MessageDialog(
            self, _(u"Souhaitez-vous vraiment supprimer cette école ?"),
            _(u"Suppression"),
            wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION)
        if dlg.ShowModal() == wx.ID_YES:
            DB = GestionDB.DB()
            DB.ReqDEL("ecoles", "IDecole", IDecole)
            DB.Close()
            self.MAJ()
        dlg.Destroy()
コード例 #6
0
 def ShowMessage(self, ev, message):
     dlg = wx.MessageDialog(self, message, "Info!",
                            wx.OK | wx.ICON_INFORMATION)
     dlg.ShowModal()
     dlg.Destroy()
コード例 #7
0
 def nothingfound(self):
     nf = wx.MessageDialog(
         None, 'No screenshots or demos found.\nWill now exit.',
         'UrTDSC - Error!', wx.OK | wx.ICON_EXCLAMATION)
     nf.ShowModal()
     sys.exit(255)
コード例 #8
0
    def Sauvegarde(self):
        # Vérification des données saisies
        selection = self.GetSelectionPiece()
        if selection == None:
            dlg = wx.MessageDialog(
                self, _(u"Vous n'avez sélectionné aucun type de pièce !"),
                _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return False

        # Validation de la date de début
        if self.ctrl_date_debut.FonctionValiderDate(
        ) == False or self.ctrl_date_debut.GetDate() == None:
            dlg = wx.MessageDialog(
                self, _(u"Vous devez saisir une date de début valide !"),
                _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_date_debut.SetFocus()
            return False

        if self.radio_date_fin_1.GetValue() == True:
            if self.ctrl_date_fin.FonctionValiderDate(
            ) == False or self.ctrl_date_fin.GetDate() == None:
                dlg = wx.MessageDialog(
                    self, _(u"Vous devez saisir une date de fin valide !"),
                    _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
                dlg.ShowModal()
                dlg.Destroy()
                self.ctrl_date_fin.SetFocus()
                return False

        # Vérifie que la date de fin est supérieure à la date de début
        if self.radio_date_fin_1.GetValue() == True:
            if self.ctrl_date_debut.GetDate() > self.ctrl_date_fin.GetDate():
                dlg = wx.MessageDialog(
                    self,
                    _(u"Attention, la date de début est supérieure à la date de fin !"
                      ), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
                dlg.ShowModal()
                dlg.Destroy()
                self.ctrl_date_fin.SetFocus()
                return False

        # Sauvegarde
        IDtype_piece = selection["IDtype_piece"]
        IDindividu = selection["IDindividu"]
        IDfamille = selection["IDfamille"]
        date_debut = str(self.ctrl_date_debut.GetDate())
        if self.radio_date_fin_1.GetValue() == True:
            date_fin = str(self.ctrl_date_fin.GetDate())
        else:
            date_fin = "2999-01-01"

        DB = GestionDB.DB()
        listeDonnees = [
            ("IDtype_piece", IDtype_piece),
            ("IDindividu", IDindividu),
            ("IDfamille", IDfamille),
            ("date_debut", date_debut),
            ("date_fin", date_fin),
        ]
        if self.IDpiece == None:
            nouvellePiece = True
            self.IDpiece = DB.ReqInsert("pieces", listeDonnees)
        else:
            nouvellePiece = False
            DB.ReqMAJ("pieces", listeDonnees, "IDpiece", self.IDpiece)
        DB.Close()

        # Mémorise l'action dans l'historique
        if nouvellePiece == True:
            type = _(u"Saisie")
            IDcategorie = 15
        else:
            type = _(u"Modification")
            IDcategorie = 16
        if IDindividu != None and IDfamille != None:
            texteDetail = _(u"pour l'individu ID%d et la famille ID%d") % (
                IDindividu, IDfamille)
        elif IDindividu == None and IDfamille != None:
            texteDetail = _(u"pour la famille ID%d") % IDfamille
        elif IDindividu != None and IDfamille == None:
            texteDetail = _(u"pour l'individu ID%d") % IDindividu
        else:
            texteDetail = u""
        nomPiece = selection["nomPiece"]
        UTILS_Historique.InsertActions([
            {
                "IDindividu":
                IDindividu,
                "IDfamille":
                self.IDfamille,
                "IDcategorie":
                IDcategorie,
                "action":
                _(u"%s de la pièce ID%d '%s' %s") %
                (type, self.IDpiece, nomPiece, texteDetail),
            },
        ])

        # Sauvegarde des pages scannées
        self.ctrl_pages.Sauvegarde(self.IDpiece)

        return True
コード例 #9
0
ファイル: PLCOpenEditor.py プロジェクト: amescon/beremiz
def Display_Error_Dialog(e_value):
    message = wx.MessageDialog(None, str(e_value), _("Error"), wx.OK|wx.ICON_ERROR)
    message.ShowModal()
    message.Destroy()
コード例 #10
0
 def alert(self, msg, title):
     x = wx.MessageDialog(self, msg, title)
     x.ShowModal()
コード例 #11
0
def Impression(dictDonnees={}, nomDoc=FonctionsPerso.GenerationNomDoc("RESERVATIONS", "pdf"), afficherDoc=True):
    # Création du PDF
    from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate, NextPageTemplate
    from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak
    from reportlab.platypus.flowables import ParagraphAndImage, Image
    from reportlab.platypus.frames import Frame, ShowBoundaryValue
    from reportlab.lib.pagesizes import A4
    from reportlab.lib.units import inch, cm, mm
    from reportlab.lib.utils import ImageReader
    from reportlab.lib import colors
    from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
    from reportlab.pdfgen.canvas import Canvas

    TAILLE_PAGE = A4
    LARGEUR_PAGE = TAILLE_PAGE[0]
    HAUTEUR_PAGE = TAILLE_PAGE[1]
    
    # Initialisation du document
    if sys.platform.startswith("win") : nomDoc = nomDoc.replace("/", "\\")
    doc = SimpleDocTemplate(nomDoc, topMargin=30, bottomMargin=30, pagesize=TAILLE_PAGE, showBoundary=False)
    story = []
    dictChampsFusion = {}
    
    largeurContenu = 520
    couleurFond = (0.8, 0.8, 1)
    couleurFondActivite = (0.92, 0.92, 1)
            
    # Création du titre du document
    def Header():
        dataTableau = []
        largeursColonnes = ( (420, 100) )
        dateDuJour = DateEngFr(str(datetime.date.today()))
        dataTableau.append( (_(u"Réservations"), _(u"%s\nEdité le %s") % (UTILS_Organisateur.GetNom(), dateDuJour)) )
        style = TableStyle([
                ('BOX', (0,0), (-1,-1), 0.25, colors.black), 
                ('VALIGN', (0,0), (-1,-1), 'TOP'), 
                ('ALIGN', (0,0), (0,0), 'LEFT'), 
                ('FONT',(0,0),(0,0), "Helvetica-Bold", 16), 
                ('ALIGN', (1,0), (1,0), 'RIGHT'), 
                ('FONT',(1,0),(1,0), "Helvetica", 6), 
                ])
        tableau = Table(dataTableau, largeursColonnes)
        tableau.setStyle(style)
        story.append(tableau)
        story.append(Spacer(0,20))       
    
    # Insère un header
    Header()

    # Texte si aucune réservation
    if len(dictDonnees) == 0 :
        paraStyle = ParagraphStyle(name="defaut", fontName="Helvetica", fontSize=11)
        story.append(Paragraph(" ", paraStyle))
        story.append(Paragraph(" ", paraStyle))
        story.append(Paragraph(_(u"<para align='centre'><b>Aucune réservation</b></para>"), paraStyle))
    
    # Tableau NOM INDIVIDU
    totalFacturationFamille = 0.0
    for IDindividu, dictIndividu in dictDonnees.iteritems() :
        nom = dictIndividu["nom"]
        prenom = dictIndividu["prenom"]
        date_naiss = dictIndividu["date_naiss"]
        sexe = dictIndividu["sexe"]
        if date_naiss != None :
            if sexe == "M" : 
                texteNaiss = _(u", né le %s") % DateEngFr(str(date_naiss))
            else : 
                texteNaiss = _(u", née le %s") % DateEngFr(str(date_naiss))
        else:
            texteNaiss = u""
        texteIndividu = u"%s %s%s" % (nom, prenom, texteNaiss)
        
        totalFacturationIndividu = 0.0
        
        # Insertion du nom de l'individu
        paraStyle = ParagraphStyle(name="individu",
                              fontName="Helvetica",
                              fontSize=9,
                              #leading=7,
                              spaceBefore=0,
                              spaceafter=0,
                            )
        texteIndividu = Paragraph(texteIndividu, paraStyle)
        dataTableau = []
        dataTableau.append([texteIndividu,])
        tableau = Table(dataTableau, [largeurContenu,])
        listeStyles = [
                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                ('FONT', (0, 0), (-1, -1), "Helvetica", 8), 
                ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                ('BACKGROUND', (0, 0), (-1, 0), couleurFond),
                ]
        tableau.setStyle(TableStyle(listeStyles))
        story.append(tableau)
    
        # Tableau NOM ACTIVITE
        listePrestationsUtilisees = []
        for IDactivite, dictActivite in dictIndividu["activites"].iteritems() :
            texteActivite = dictActivite["nom"]
            if dictActivite["agrement"] != None :
                texteActivite += dictActivite["agrement"]
            
            if texteActivite != None :
                dataTableau = []
                dataTableau.append([texteActivite,])
                tableau = Table(dataTableau, [largeurContenu,])
                listeStyles = [
                    ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                    ('FONT', (0, 0), (-1, -1), "Helvetica", 6),
                    ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                    ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
                    ('BACKGROUND', (0, 0), (-1, 0), couleurFondActivite),
                    ]
                tableau.setStyle(TableStyle(listeStyles))
                story.append(tableau)
            
            # Colonnes : Date, Consos, Etat, Prestations, Montant
            dataTableau = []
            largeursColonnes = [55, 165, 80, 160, 60]
            dataTableau.append([_(u"Date"), _(u"Consommations"), _(u"Etat"), _(u"Prestations"), _(u"Total")])
            
            paraStyle = ParagraphStyle(name="standard",
                      fontName="Helvetica",
                      fontSize=8,
                      leading=10,
                      #spaceBefore=8,
                      spaceAfter=0,
                    )
                            
            # lignes DATES
            listeDates = []
            for date, dictDates in dictActivite["dates"].iteritems() :
                listeDates.append(date)
            listeDates.sort() 
            
            for date in listeDates :
                dictDate = dictActivite["dates"][date]
                listeLigne = []
                
                # Insertion de la date
                texteDate = Paragraph(DateEngFr(str(date)), paraStyle)
                
                # Insertion des consommations
                listeEtats = []
                listeConso = []
                listePrestations = []
                for IDunite, dictUnite in dictDate.iteritems() :
                    nomUnite = dictUnite["nomUnite"]
                    etat = dictUnite["etat"]
                    
                    if etat != None :
                        labelUnite = nomUnite
                        if dictUnite["type"] == "Horaire" :
                            heure_debut = dictUnite["heure_debut"]
                            if heure_debut == None : heure_debut = u"?"
                            heure_debut = heure_debut.replace(":", "h")
                            heure_fin = dictUnite["heure_fin"]
                            if heure_fin == None : heure_fin = u"?"
                            heure_fin = heure_fin.replace(":", "h")
                            labelUnite += _(u" (de %s à %s)") % (heure_debut, heure_fin)
                        listeConso.append(labelUnite)
                        
                        if etat not in listeEtats :
                            listeEtats.append(etat)
                        
                        IDprestation = dictUnite["IDprestation"]
                        if dictUnite["prestation"] != None and IDprestation not in listePrestationsUtilisees :
                            listePrestations.append(dictUnite["prestation"])
                            listePrestationsUtilisees.append(IDprestation)
                    
                texteConsos = Paragraph(" + ".join(listeConso), paraStyle)
                
                # Insertion de l'état
                texteEtat = Paragraph(" / ".join(listeEtats), paraStyle)
                
                # Insertion des prestations et montants
                textePrestations = []
                texteMontants = []
                for dictPrestation in listePrestations :
                    montant = dictPrestation["montant"]
                    label = dictPrestation["label"]
                    paye = dictPrestation["paye"]
                    textePrestations.append(Paragraph(label, paraStyle))
                    texteMontants.append(Paragraph(u"<para align='right'>%.02f %s</para>" % (montant, SYMBOLE), paraStyle))
                    
                    # Pour le total par individu :
                    if montant != None :
                        totalFacturationIndividu += montant
                        totalFacturationFamille += montant
                
                if len(listeConso) > 0 :
                    dataTableau.append([texteDate, texteConsos, texteEtat, textePrestations, texteMontants])
            
            if len(dataTableau) == 1 :
                dlg = wx.MessageDialog(None, _(u"Il n'y a aucune consommation à imprimer !"), _(u"Erreur"), wx.OK | wx.ICON_INFORMATION)
                dlg.ShowModal()
                dlg.Destroy()
                return
                
            tableau = Table(dataTableau, largeursColonnes)
            listeStyles = [
                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                ('GRID', (0, 0), (-1,-1), 0.25, colors.black), 
                
                ('FONT', (0, 0), (-1, 0), "Helvetica", 6), 
                ('ALIGN', (0, 0), (-1, 0), 'CENTRE'),
                
                ('FONT', (0, 1), (-1, 1), "Helvetica", 8), 
                ]
            tableau.setStyle(TableStyle(listeStyles))
            story.append(tableau)

        # Insertion du total par individu
        dataTableau = []
        montantIndividu = Paragraph(u"<para align='right'>%.02f %s</para>" % (totalFacturationIndividu, SYMBOLE), paraStyle)
        dataTableau.append([Paragraph(_(u"<para align='right'>Total :</para>"), paraStyle), montantIndividu])
        
        listeStyles = [
                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                ('FONT', (0, 0), (-1, -1), "Helvetica", 8), 
                ('GRID', (-1, -1), (-1,-1), 0.25, colors.black), 
                ('ALIGN', (-1, -1), (-1, -1), 'CENTRE'),
                ('BACKGROUND', (-1, -1), (-1, -1), couleurFond), 
                ]
            
        # Création du tableau
        largeursColonnesTotal = [460, 60]
        tableau = Table(dataTableau, largeursColonnesTotal)
        tableau.setStyle(TableStyle(listeStyles))
        story.append(tableau)
        story.append(Spacer(0, 12))

    # Total facturation Famille
    nbreIndividus = len(dictDonnees)
    if nbreIndividus > 1 :
        dataTableau = []
        montantFamille = Paragraph(u"<para align='right'>%.02f %s</para>" % (totalFacturationFamille, SYMBOLE), paraStyle)
        dataTableau.append([Paragraph(_(u"<para align='right'>TOTAL :</para>"), paraStyle), montantFamille])
        largeursColonnesTotal = [460, 60]
        tableau = Table(dataTableau, largeursColonnesTotal)
        tableau.setStyle(TableStyle(listeStyles))
        story.append(tableau)
    
    # Champs pour fusion Email
    dictChampsFusion["{SOLDE}"] = u"%.02f %s" % (totalFacturationFamille, SYMBOLE)
    
    # Enregistrement et ouverture du PDF
    try :
        doc.build(story)
    except Exception, err :
        print "Erreur dans ouverture PDF :", err
        if "Permission denied" in err :
            dlg = wx.MessageDialog(None, _(u"Noethys ne peut pas créer le PDF.\n\nVeuillez vérifier qu'un autre PDF n'est pas déjà ouvert en arrière-plan..."), _(u"Erreur d'édition"), wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return False
コード例 #12
0
ファイル: tdt_magic.py プロジェクト: botaoxiongyong/PmagPy
    def on_okButton(self, event):

        outfiles = []

        for i in range(self.max_files):

            # read directiory path
            dir_path = self.dir_paths[i].GetValue()
            if not os.path.exists(dir_path):
                continue

            # get experiment
            experiment = self.protocol_infos[i].GetValue()

            # get location/user name
            user_name = self.file_info_users[i].GetValue()
            location_name = self.file_locations[i].GetValue()

            # get Blab direction
            lab_dec = self.file_info_Blab_dec[i].GetValue()
            lab_inc = self.file_info_Blab_inc[i].GetValue()

            # get Moment units
            moment_units = self.moment_units[i].GetValue()

            # get sample volume
            volume = self.volumes[i].GetValue()

            # get sample-specimen naming convention
            samp_name_con = str(self.sample_naming[i].GetValue())
            samp_name_chars = str(self.sample_naming_char[i].GetValue())

            # get site-sample naming convention
            site_name_con = str(self.site_naming[i].GetValue())
            site_name_chars = str(self.site_naming_char[i].GetValue())

            # create temporary outfile name
            meas_file = os.path.join(self.WD, 'measurements_{}.txt'.format(i))
            spec_file = os.path.join(self.WD, 'specimens_{}.txt'.format(i))
            samp_file = os.path.join(self.WD, 'samples_{}.txt'.format(i))
            site_file = os.path.join(self.WD, 'sites_{}.txt'.format(i))
            loc_file = os.path.join(self.WD, 'locations_{}.txt'.format(i))

            if dir_path:
                res, fname = convert_2_magic.tdt(dir_path,
                                                 experiment,
                                                 meas_file,
                                                 spec_file,
                                                 samp_file,
                                                 site_file,
                                                 loc_file,
                                                 user_name,
                                                 location_name,
                                                 lab_dec,
                                                 lab_inc,
                                                 moment_units,
                                                 samp_name_con,
                                                 samp_name_chars,
                                                 site_name_con,
                                                 site_name_chars,
                                                 volume,
                                                 output_dir_path=self.WD)
                outfiles.append(fname)

        # combine measurement files
        ipmag.combine_magic(outfiles,
                            self.output_file_path.GetValue(),
                            magic_table="measurements")
        for fname in outfiles:
            os.remove(os.path.join(self.WD, fname))

        # combine other types of files
        fnames = os.listdir(self.WD)
        for dtype in ['specimens', 'samples', 'sites', 'locations']:
            outfile = os.path.join(self.WD, dtype + ".txt")
            files = [f for f in fnames if dtype + "_" in f]
            ipmag.combine_magic(files, outfile, magic_table=dtype)
            for fname in files:
                os.remove(os.path.join(self.WD, fname))

        if res:
            dlg1 = wx.MessageDialog(
                None,
                caption="Message:",
                message=
                "file converted to {}\n you can try running thellier gui...\n".
                format(self.output_file_path.GetValue()),
                style=wx.OK | wx.ICON_INFORMATION)
        else:
            dlg1 = wx.MessageDialog(
                None,
                caption="Warning:",
                message=
                "No file was created.  Make sure you have selected folders that contain .tdt format files"
            )
        dlg1.ShowModal()
        dlg1.Destroy()
        self.Destroy()
コード例 #13
0
 def Message(self, qst, ttl):
     dlg = wx.MessageDialog(self, qst, ttl, wx.OK | wx.ICON_EXCLAMATION)
     if dlg.ShowModal() == wx.ID_OK:
         dlg.Destroy()
コード例 #14
0
ファイル: MainGui.py プロジェクト: YiJie0430/AM_HIVE_TCP
 def MessageBox(self,content,title,msg_type):
     dlg = wx.MessageDialog(self,content, title, msg_type)
     result = dlg.ShowModal()
     dlg.Destroy()  
     return result 
コード例 #15
0
ファイル: TextEditor.py プロジェクト: MachineAi/EMIT
    def __init__(self, parent, title):
        # based on a frame, so set up the frame
        wx.Frame.__init__(self, parent, wx.ID_ANY, title)

        # Add a text editor and a status bar
        # Each of these is within the current instance
        # so that we can refer to them later.
        self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE)
        self.CreateStatusBar()  # A Statusbar in the bottom of the window

        # Setting up the menu. filemenu is a local variable at this stage.
        filemenu = wx.Menu()
        # use ID_ for future easy reference - much better that "48", "404" etc
        # The & character indicates the short cut key
        filemenu.Append(ID_OPEN, "&Open", " Open a file to edit")
        filemenu.AppendSeparator()
        filemenu.Append(ID_SAVE, "&Save", " Save file")
        filemenu.AppendSeparator()
        filemenu.Append(ID_ABOUT, "&About", " Information about this program")
        filemenu.AppendSeparator()
        filemenu.Append(ID_EXIT, "E&xit", " Terminate the program")

        # Creating the menubar.
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,
                       "&File")  # Adding the "filemenu" to the MenuBar
        self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.
        # Note - previous line stores the whole of the menu into the current object

        # Define the code to be run when a menu option is selected
        wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)
        wx.EVT_MENU(self, ID_EXIT, self.OnExit)
        wx.EVT_MENU(self, ID_OPEN, self.OnOpen)
        wx.EVT_MENU(self, ID_SAVE, self.OnSave)
        # just "pass" in our demo

        # Set up a series of buttons arranged horizontally
        self.sizer2 = wx.BoxSizer(wx.HORIZONTAL)
        self.buttons = []
        # Note - give the buttons numbers 1 to 6, generating events 301 to 306
        # because IB_BUTTON1 is 300
        for i in range(6):
            # describe a button
            bid = i + 1
            self.buttons.append(
                wx.Button(self, ID_BUTTON1 + i, "Button &" + str(bid)))
            # add that button to the sizer2 geometry
            self.sizer2.Add(self.buttons[i], 1, wx.EXPAND)

        # Set up the overall frame verically - text edit window above buttons
        # We want to arrange the buttons vertically below the text edit window
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.control, 1, wx.EXPAND)
        self.sizer.Add(self.sizer2, 0, wx.EXPAND)

        # Tell it which sizer is to be used for main frame
        # It may lay out automatically and be altered to fit window
        self.SetSizer(self.sizer)
        self.SetAutoLayout(1)
        self.sizer.Fit(self)

        # Show it !!!
        self.Show(1)

        # Define widgets early even if they're not going to be seen
        # so that they can come up FAST when someone clicks for them!
        self.aboutme = wx.MessageDialog(self, " A sample editor \n"
                                        " in wxPython", "About Sample Editor",
                                        wx.OK)
        self.doiexit = wx.MessageDialog(self, " Exit - R U Sure? \n",
                                        "GOING away ...", wx.YES_NO)

        # dirname is an APPLICATION variable that we're choosing to store
        # in with the frame - it's the parent directory for any file we
        # choose to edit in this frame
        self.dirname = ''
コード例 #16
0
 def OnAbout(self, e):
     d = wx.MessageDialog(self, "参考:一个网络上用VC编写的开源五子棋程序。\n移植:qipengh \nEmail:[email protected]", "关于Python开源版的简易五子棋人机对弈",
                          wx.OK)
     # Create a message dialog box
     d.ShowModal()  # Shows it
     d.Destroy()  # finally destroy it when finished.
コード例 #17
0
ファイル: view.py プロジェクト: theodorcostache/pdf-protect
 def show_message_dialog(self, message, style=wx.ICON_INFORMATION):
     with wx.MessageDialog(self, message, style=style) as message_dialog:
         res = message_dialog.ShowModal()
コード例 #18
0
ファイル: ui.py プロジェクト: yevolcn/SwitchHosts
 def alert(self, title, msg):
     dlg = wx.MessageDialog(None, msg, title, wx.OK | wx.ICON_WARNING)
     dlg.ShowModal()
     dlg.Destroy()
コード例 #19
0
 def nosshotsfound(self):
     achtung = wx.MessageDialog(None, 'Screenshots not found',
                                'UrTDSC - Error!',
                                wx.OK | wx.ICON_EXCLAMATION)
     achtung.ShowModal()
コード例 #20
0
ファイル: window.py プロジェクト: augustowille/Aligascrobbler
 def _dialog(self, title, message):
     dlg = wx.MessageDialog(self, message, title, wx.OK)
     dlg.ShowModal()
     dlg.Destroy()
     return dlg
コード例 #21
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          title="UrTDSC - All Screenshots",
                          size=(700, 450))
        OtherScreens.SetSizeHints(self, 700, 450, 700, 450)
        self.panel = wx.Panel(self, -1)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        #print scraddr

        try:
            # Screenshots list
            self.screenlist = wx.ListCtrl(self.panel,
                                          size=(155, 390),
                                          style=wx.LC_REPORT)
            self.screenlist.InsertColumn(0,
                                         'Screenshot',
                                         width=155,
                                         format=wx.LIST_FORMAT_CENTER)
            self.screenlist.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelect)

            # Lonely button :-)
            cpscrs = wx.Button(self.panel,
                               -1,
                               "Copy Screenshots to\nDesktop",
                               pos=(10, 396))
            self.Bind(wx.EVT_BUTTON, self.CopyToDesktop, cpscrs)

            #Screenshot
            self.screenshot = wx.StaticBitmap(self.panel,
                                              -1,
                                              pos=(156, 0),
                                              bitmap=wx.EmptyBitmap(544, 452))
            sshot = wx.EmptyImage(544, 452).ConvertToBitmap()
            self.screenshot.SetBitmap(sshot)

            self.sslist = wx.ImageList(150, 150)
            func.log('1', '* Demo date is: %s' % timed)

            self.scrlist = func.demoscreens(func.demoname(timed))
            index = 0
            self.idx = 0
            for i in self.scrlist:
                try:
                    scr1 = wx.Image(i, wx.BITMAP_TYPE_JPEG).Scale(
                        150, 150, wx.IMAGE_QUALITY_HIGH).ConvertToBitmap()
                except:
                    scr1 = wx.Image(i, wx.BITMAP_TYPE_TGA).Scale(
                        150, 150, wx.IMAGE_QUALITY_HIGH).ConvertToBitmap()
                self.sslist.Add(scr1)
                self.index = self.screenlist.InsertStringItem(
                    self.idx, '', self.idx)
                self.screenlist.SetItemImage(1, self.index, self.index)
                self.screenlist.SetItemData(self.index, index)
                index = index + 1
                self.idx = self.idx + 1

            self.sslist1 = self.screenlist.SetImageList(
                self.sslist, wx.IMAGE_LIST_SMALL)

            self.CenterOnParent()
            self.Show(True)
            func.log('1', 'Other Screenshots Window - success')
        except:
            oops = wx.MessageDialog(
                None,
                'Demo not specified or cannot find reliable screenshots.',
                'UrTDSC - Error!', wx.OK | wx.ICON_EXCLAMATION)
            oops.ShowModal()
            # This piece of shit generates traceback required to prevent opening "Other Screenshots" window
            self.OnClose('DO NOT OPEN THIS F***ING WINDOW >.<')
            func.log(
                '1',
                '[ERR] No demo specified or cannot find reliable screenshots. Supress "Other Screenshots" window'
            )
            func.log('1', '[ERR] Other Screenshots - fail')
コード例 #22
0
    def OnBoutonOk(self, event):
        montant = self.ctrl_montant.GetMontant()
        if montant == 0.0 :
            dlg = wx.MessageDialog(self, _(u"Vous devez obligatoirement saisir un montant !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_montant.SetFocus()
            return

        if montant < 0.0 :
            dlg = wx.MessageDialog(self, _(u"Le montant doit obligatoirement être positif !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_montant.SetFocus()
            return

        if self.solde != None and FloatToDecimal(montant) > FloatToDecimal(self.solde) :
            dlg = wx.MessageDialog(self, _(u"Le montant du remboursement ne doit pas être supérieur au solde du compte !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_montant.SetFocus()
            return

        IDcompte = self.ctrl_compte.GetID()
        if IDcompte == None :
            dlg = wx.MessageDialog(self, _(u"Vous devez obligatoirement sélectionner un compte bancaire !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_compte.SetFocus()

        IDpayeur = self.ctrl_payeur.GetID()
        if IDpayeur == None :
            dlg = wx.MessageDialog(self, _(u"Vous devez obligatoirement sélectionner un payeur !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_payeur.SetFocus()

        IDmode = self.ctrl_mode.GetID()
        if IDmode == None :
            dlg = wx.MessageDialog(self, _(u"Vous devez obligatoirement sélectionner un mode de règlement !"), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            self.ctrl_mode.SetFocus()
            return


        observations = self.ctrl_observations.GetValue()

        DB = GestionDB.DB()

        # Récupère IDfamille
        req = """SELECT IDfamille
        FROM comptes_payeurs
        WHERE IDcompte_payeur=%d
        """ % self.IDcompte_payeur
        DB.ExecuterReq(req)
        IDfamille = DB.ResultatReq()[0][0]

        # Enregistrement de la prestation positive
        listeDonnees = [
            ("IDcompte_payeur", self.IDcompte_payeur),
            ("date", str(datetime.date.today())),
            ("categorie", "autre"),
            ("label", _(u"Remboursement")),
            ("montant_initial", montant),
            ("montant", montant),
            ("IDfamille", IDfamille),
            ("date_valeur", str(datetime.date.today())),
            ]
        IDprestation_positive = DB.ReqInsert("prestations", listeDonnees)

        # Ventiler la prestation positive avec l'avoir
        VentilationAuto(self.IDcompte_payeur)


        # Enregistrement de la prestation négative
        listeDonnees = [
            ("IDcompte_payeur", self.IDcompte_payeur),
            ("date", str(datetime.date.today())),
            ("categorie", "autre"),
            ("label", _(u"Remboursement")),
            ("montant_initial", -montant),
            ("montant", -montant),
            ("IDfamille", IDfamille),
            ("date_valeur", str(datetime.date.today())),
            ]
        IDprestation_negative = DB.ReqInsert("prestations", listeDonnees)

        # Enregistrement du règlement négatif
        listeDonnees = [
            ("IDcompte_payeur", self.IDcompte_payeur),
            ("date", str(datetime.date.today())),
            ("IDmode", IDmode),
            ("montant", -montant),
            ("IDpayeur", IDpayeur),
            ("observations", observations),
            ("IDcompte", IDcompte),
            ("date_saisie", str(datetime.date.today())),
            ("IDutilisateur", UTILS_Identification.GetIDutilisateur()),
            ]
        IDreglement = DB.ReqInsert("reglements", listeDonnees)

        # Ventilation de la prestation négative sur le règlement
        listeDonnees = [
            ("IDreglement", IDreglement),
            ("IDcompte_payeur", self.IDcompte_payeur),
            ("IDprestation", IDprestation_negative),
            ("montant", -montant),
            ]
        IDventilation = DB.ReqInsert("ventilation", listeDonnees)

        DB.Close()

        # Fermeture
        self.EndModal(wx.ID_OK)
コード例 #23
0
 def errorPopup(self, msg, title):
     """ Popup error message"""
     print(msg)
     dlg = wx.MessageDialog(self, msg, title, wx.OK)
     dlg.ShowModal()  # Shows it
     dlg.Destroy()  # finally destroy it when finished.
コード例 #24
0
def MessageOKCancel(parent, message, title='', iconMask=wx.ICON_QUESTION):
    dlg = wx.MessageDialog(parent, message, title,
                           wx.OK | wx.CANCEL | iconMask)
    response = dlg.ShowModal()
    dlg.Destroy()
    return True if response == wx.ID_OK else False
コード例 #25
0
def Info(parent, message, caption='Info'):
    import wx
    dlg = wx.MessageDialog(parent, message, caption,
                           wx.OK | wx.ICON_INFORMATION)
    dlg.ShowModal()
    dlg.Destroy()
コード例 #26
0
 def OnAbout(self, event):
     dialog = wx.MessageDialog(
         self, "Welcome to Events\n(C)opyright 2000 Robert Roebling",
         "About Events", wx.OK | wx.ICON_INFORMATION)
     dialog.CentreOnParent()
     dialog.ShowModal()
コード例 #27
0
def Error(parent, message, caption='Error!'):
    import wx
    dlg = wx.MessageDialog(parent, message, caption, wx.OK | wx.ICON_ERROR)
    dlg.ShowModal()
    dlg.Destroy()
コード例 #28
0
ファイル: pinotate-gui.py プロジェクト: marcaube/pinotate
 def OnAbout(self, e):
     aboutDlg = wx.MessageDialog(self, "Export iBooks highlights",
                                 "About Pinotate", wx.OK)
     aboutDlg.ShowModal()
コード例 #29
0
ファイル: simpleDialog.py プロジェクト: riku22/TCV
def errorDialog(message,parent=None):
	dialog = wx.MessageDialog(parent,message,"error",wx.OK|wx.ICON_ERROR)
	dialog.ShowModal()
	dialog.Destroy()
	return
コード例 #30
0
ファイル: ossbrowser.py プロジェクト: winningalong/OSSTools
def OnNewButtonOK(event):
    global new_bucket_name
    global log
    global operation_listctrl
    if len(new_bucket_name)<3 or len(new_bucket_name)>32:
        dlg = wx.MessageDialog(new_bucket_frame, u'Bucket名称长度为3-32个字符!',
                            u'错误提示',
                            wx.OK | wx.ICON_INFORMATION
                            #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                            )
        dlg.ShowModal()
        dlg.Destroy()
        if log.closed:
            log = open('log.txt', 'a+')
        log.write((u'[' + unicodise(time.asctime()) + u']  创建Bucket失败,错误提示:Bucket名称长度错误。  [Failure]\n').encode('utf-8'))
        log.flush()
        ## update operation_listctrl
        operation_listctrl.Append([u'[' + unicodise(time.asctime()) + u']  创建Bucket失败,错误提示:Bucket名称长度错误。  [Failure]\n'])
    elif not re.search('^([0-9]|[a-z])+$', new_bucket_name):
        dlg = wx.MessageDialog(new_bucket_frame, u'Bucket名称不合法:只能包括小写字母和数字!',
                            u'错误提示',
                            wx.OK | wx.ICON_INFORMATION
                            #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                            )
        dlg.ShowModal()
        dlg.Destroy()
        if log.closed:
            log = open('log.txt', 'a+')
        log.write((u'[' + unicodise(time.asctime()) + u']  创建Bucket失败,错误提示:Bucket名称不合法。  [Failure]\n').encode('utf-8'))
        log.flush()
        ## update operation_listctrl
        operation_listctrl.Append([u'[' + unicodise(time.asctime()) + u']  创建Bucket失败,错误提示:Bucket名称不合法。  [Failure]\n'])
    else:
        if oss:
            if new_bucket_acl == acl_choices[1]:
                new_buc_res = put_bucket(oss, new_bucket_name, acl_values[1], headers={})
            elif new_bucket_acl == acl_choices[2]:
                new_buc_res = put_bucket(oss, new_bucket_name, acl_values[2], headers={})
            else:
                new_buc_res = put_bucket(oss, new_bucket_name, acl_values[0], headers={})
            if new_buc_res:
                dlg = wx.MessageDialog(new_bucket_frame, u'Bucket创建成功!',
                            u'提示信息',
                            wx.OK | wx.ICON_INFORMATION
                            #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                            )
                dlg.ShowModal()
                dlg.Destroy()
                if log.closed:
                    log = open('log.txt', 'a+')
                log.write((u'[' + unicodise(time.asctime()) + u']  创建Bucket [' + new_bucket_name + '] 成功。  [OK]\n').encode('utf-8'))
                log.flush()
                new_bucket_frame.Close()
                ## update operation_listctrl
                operation_listctrl.Append([u'[' + unicodise(time.asctime()) + u']  创建Bucket[ ' + new_bucket_name + '] 成功。  [OK]\n'])
                
                refresh_pages()
            else:
                dlg = wx.MessageDialog(new_bucket_frame, u'Bucket创建失败!可能Bucket重名,建议更改Bucket名称重试。或者BUcket数目已经达到10个。',
                            u'错误提示',
                            wx.OK | wx.ICON_INFORMATION
                            #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                            )
                dlg.ShowModal()
                dlg.Destroy()
                if log.closed:
                    log = open('log.txt', 'a+')
                log.write((u'[' + unicodise(time.asctime()) + u']  创建Bucket[ ' + new_bucket_name + u'] 失败。  [Failure]\n').encode('utf-8'))
                log.flush()
                new_bucket_frame.Close()
                ## update operation_listctrl
                operation_listctrl.Append([u'[' + unicodise(time.asctime()) + u']  创建Bucket[ ' + new_bucket_name + u'] 失败。  [Failure]\n'])
        else:
            dlg = wx.MessageDialog(new_bucket_frame, u'OSS用户验证信息错误!请检查网络状态.',
                            u'错误提示',
                            wx.OK | wx.ICON_INFORMATION
                            #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
                            )
            dlg.ShowModal()
            dlg.Destroy()
            if log.closed:
                log = open('log.txt', 'a+')
            log.write((u'[' + unicodise(time.asctime()) + u']  创建Bucket失败,错误提示:OSS验证信息失败。  [Failure]\n').encode('utf-8'))
            log.flush()
            new_bucket_frame.Close()
            ## update operation_listctrl
            operation_listctrl.Append([u'[' + unicodise(time.asctime()) + u']  创建Bucket失败,错误提示:OSS验证信息失败。  [Failure]\n'])