Example #1
0
def GetValidite(identifiant="", code=""):
    try :
        url = "https://www.teamworks.ovh/aide/html/testcode.php?identifiant=%s&code=%s" % (identifiant, code)
        h = urlopen(url, timeout=5)
        html = h.read()
        h.close()
    except :
        return False

    if six.PY3:
        html = html.decode("iso-8859-15")

    # Analyse l'état
    if html.startswith("codeok") :
        try :
            date = DateEngEnDateDD(html[7:])
        except :
            date = None
    else :
        date = None

    # Affiche l'état
    if date == None :
        return False
    else :
        nbreJoursRestants =  (date - datetime.date.today()).days
        return date, nbreJoursRestants
Example #2
0
 def Go(self):
   f=open(localizePath(modPath(os.path.join("hints", "%s.html" % self.hint), self.hintModule)))
   html=f.read()
   f.close()
   for tag, value in self.args.items():
     html=html.replace("$%s" % tag.upper(), value.encode('utf-8'))
     
   self.browser.SetPage(html.decode('utf-8'))
   if not self.title:
     self.title=self.browser.GetOpenedPageTitle()
   if self.title:
     self.SetTitle(self.title)
   else:
     self.SetTitle(xlt("%s hint") % adm.appTitle)
Example #3
0
    def VerifieEtat(self, identifiant="", code=""):
        """ Vérifie la validité du code en ligne """
        dlgAttente = wx.BusyInfo(_(u"Vérification du code en cours..."), None)
        if 'phoenix' not in wx.PlatformInfo:
            wx.Yield()
        
        try :
            url = "https://www.teamworks.ovh/aide/html/testcode.php?identifiant=%s&code=%s" % (identifiant, code)
            h = urlopen(url, timeout=5)
            html = h.read()
            h.close()
        except Exception as 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

        if six.PY3:
            html = html.decode("iso-8859-15")

        # Analyse l'état
        if html.startswith("codeok") :
            try :
                date = DateEngEnDateDD(html[7:])
            except :
                date = None
        else :
            date = None
        
        # Affiche l'état
        if date == None :
            texte = _(u"Vous n'avez saisi aucun code valide")
            image = "pasok"
        else :
            nbreJoursRestants =  (date - datetime.date.today()).days
            if nbreJoursRestants < 0 :
                texte = _(u"Votre licence est périmée depuis le %s") % DateEngFr(str(date))
                image = "pasok"
            elif nbreJoursRestants <= 30 :
                texte = _(u"Votre licence est valide jusqu'au %s (%d jours restants)") % (DateEngFr(str(date)), nbreJoursRestants)
                image = "attention"
            else :
                texte = _(u"Votre licence est valide jusqu'au %s") % DateEngFr(str(date))
                image = "ok"
            
        self.AfficheEtatValidite(texte, image)
        self.derniereValidation = (identifiant, code)
        del dlgAttente
Example #4
0
 def __init__(self, parent, version_info):
     super(AboutPanel, self).__init__(parent)
     # compose ReStructuredText document
     title = version_info.name + ' ' + version_info.version
     summary = version_info.description + '\n\n' + version_info.website
     text = "\n\n".join([
         _section(0, title, summary),
         _section(1, 'Copyright', version_info.license),
         _section(1, 'Credits', version_info.credits),
     ])
     # convert to HTML and display
     html = docutils.core.publish_string(text, writer_name='html4css1')
     html = html.decode('utf-8')
     textctrl = StaticHtmlWindow(self, size=(600, 400))
     textctrl.SetPage(html)
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(textctrl, 1, flag=wx.ALL|wx.EXPAND, border=5)
     self.SetSizer(sizer)