Beispiel #1
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from minitel.Minitel import Minitel
from minitel.ImageMinitel import ImageMinitel
from PIL import Image
from time import sleep
from math import *

minitel = Minitel()

minitel.deviner_vitesse()
minitel.identifier()
minitel.definir_vitesse(4800)
minitel.definir_mode('VIDEOTEX')
minitel.configurer_clavier(etendu = True, curseur = False, minuscule = True)
minitel.echo(False)
minitel.efface()
minitel.curseur(False)
with open("abon.txt", "r") as abon:
 abonne = abon.read()

txtepais = 2

if len(abonne) < 20:
	abocent = 2*(10-floor(len(abonne)/2))+1
elif len(abonne) >= 20 and len(abonne) < 40:
	abocent = 20-floor(len(abonne)/2)+1
	txtepais = 1
else:
	abocent = 7
Beispiel #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from minitel.Minitel import Minitel
from minitel.ui.ChampTexte import ChampTexte
from minitel.ui.Conteneur import Conteneur
from minitel.ui.Label import Label
from minitel.ui.Menu import Menu

# Initialisation du Minitel
minitel = Minitel()

minitel.deviner_vitesse()
minitel.identifier()
minitel.definir_vitesse(9600)
minitel.definir_mode('VIDEOTEX')
minitel.configurer_clavier(etendu = True, curseur = False, minuscule = True)
minitel.echo(False)
minitel.efface()
minitel.curseur(False)

# Création des widgets
conteneur = Conteneur(minitel, 1, 1, 32, 17, 'blanc', 'noir')

options = [
  'Nouveau',
  'Ouvrir',
  '-',
  'Enregistrer',
  'Enreg. sous...',
  'Rétablir',
Beispiel #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from minitel.Minitel import Minitel
from minitel.ui.ChampTexte import ChampTexte
from minitel.ui.Conteneur import Conteneur
from minitel.ui.Label import Label

minitel = Minitel()

minitel.deviner_vitesse()
minitel.identifier()
minitel.definir_vitesse(1200)
minitel.definir_mode("VIDEOTEX")
minitel.configurer_clavier(etendu=True, curseur=False, minuscule=True)
minitel.echo(False)
minitel.efface()
minitel.curseur(False)

conteneur = Conteneur(minitel, 1, 1, 40, 24)

labelNom = Label(minitel, 1, 10, u"Nom")
champNom = ChampTexte(minitel, 16, 10, 20, 60)
labelPrenom = Label(minitel, 1, 12, u"Prénom")
champPrenom = ChampTexte(minitel, 16, 12, 20, 60)
labelpass = Label(minitel, 1, 14, u"Mot de passe")
champpass = ChampTexte(minitel, 16, 14, 20, 60, champ_cache=True)

conteneur.ajoute(labelNom)
conteneur.ajoute(champNom)
conteneur.ajoute(labelPrenom)
Beispiel #4
0
class PageAccueil:
    def __init__(self, titre, version, auteur):
        self.minitel = Minitel()
        self.minitel.deviner_vitesse()
        self.minitel.identifier()
        self.minitel.definir_vitesse(9600)
        self.minitel.definir_mode('VIDEOTEX')
        self.minitel.configurer_clavier(etendu=True,
                                        curseur=False,
                                        minuscule=True)
        self.minitel.echo(False)
        self.minitel.curseur(False)
        self.services = []
        self.titre = titre
        self.version = version
        self.auteur = auteur

    def ajouter_service(self, service):
        self.services += [service]

    def executer(self):
        self.effacer()
        self.afficher()

    def effacer(self):
        self.minitel.effacer('vraimenttout')

    def afficher(self):
        message = []

        for k in range(len(self.services)):
            message += ['%d. %s' % (k + 1, self.services[k].nom)]

        self.label1 = Label(self.minitel, 0.1, 0.0, [
            self.titre, '-------------',
            'v%s - %s' % (self.version, self.auteur)
        ], 0.7, 0.22, True, 'centre')
        self.label2 = Label(self.minitel, 0.1, 0.4, message, 0.7, 0.0, True,
                            'gauche')
        self.ligne1 = Ligne(self.minitel, 0.0, 0.95, 1.0, 'h', 'blanc')
        self.bouton1 = Bouton(self.minitel, 0.9, 0.99, 0.1, 'ENVOI')
        self.label3 = Label(self.minitel, 0.0, 0.99, ['Choix :'])
        self.champ1 = ChampTexte(self.minitel, 0.2, 0.99, 2, 2, '')
        self.elements = Conteneur(self.minitel, 0.0, 0.0, 1.0, 1.0, 'blanc',
                                  'noir')
        self.elements.ajouter(self.label1)
        self.elements.ajouter(self.label2)
        self.elements.ajouter(self.ligne1)
        self.elements.ajouter(self.bouton1)
        self.elements.ajouter(self.label3)
        self.elements.ajouter(self.champ1)
        self.elements.afficher()
        self.elements.executer({'ENVOI': self.valider})

    def valider(self):
        if not is_a_number(self.champ1.valeur):
            self.minitel.bip()
            return

        choix = int(self.champ1.valeur)

        if choix < 1 or choix > len(self.services):
            self.minitel.bip()
            return

        self.services[choix - 1].executer()

    def __del__(self):
        self.minitel.stopper()
Beispiel #5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from minitel.Minitel import Minitel
from minitel.ImageMinitel import ImageMinitel
from PIL import Image
from time import sleep

minitel = Minitel()

minitel.deviner_vitesse()
minitel.identifier()
minitel.definir_vitesse(4800)
minitel.definir_mode('VIDEOTEX')
minitel.configurer_clavier(etendu = True, curseur = False, minuscule = True)
minitel.echo(False)
minitel.efface()
minitel.curseur(False)

minitel.position(1, 0)
minitel.envoyer("PyMinitel v0.2.0 - Frédéric Bisson")
minitel.efface(portee = 'finligne')

image = Image.open('testimage2.jpg')
image = image.resize((36, 72), Image.ANTIALIAS)
image_minitel = ImageMinitel(minitel)
image_minitel.importer(image)
image_minitel.envoyer(23, 1)

minitel.position(3, 8)
minitel.taille(largeur = 2, hauteur = 2)
Beispiel #6
0
class MinYLPG:
    def __init__(self):
        self.mode = 'MIXTE'
        self.minitel = Minitel()
        self.minitel.deviner_vitesse()
        self.minitel.identifier()
        self.minitel.definir_vitesse(4800)
        self.minitel.definir_mode(self.mode)
        self.minitel.configurer_clavier(etendu=True,
                                        curseur=False,
                                        minuscule=True)
        self.minitel.echo(False)
        self.minitel.efface()
        self.minitel.curseur(False)

    def clean_screen(self):
        self.minitel.position(0, 0)
        self.minitel.efface(portee='vraimenttout')
        self.minitel.position(1, 1)
        self.minitel.taille(largeur=2, hauteur=2)

    def close(self):
        self.minitel.sortie.join()
        self.minitel.close()

    def message(self, message):
        message_sans_accent = unidecode.unidecode(message)
        self.minitel.envoyer(message_sans_accent)
        # self.minitel.envoyer(10)
        self.minitel.envoyer(13)

    def switch_mode(self):
        if self.mode == 'MIXTE':
            self.mode = 'VIDEOTEX'
        else:
            self.mode = 'MIXTE'
        self.minitel.definir_mode(self.mode)
        self.clean_screen()

    def follower_alert(self, abonne):
        self.switch_mode()

        if len(abonne) < 20:
            abocent = 2 * (10 - floor(len(abonne) / 2)) + 1
            epaisseur_texte = 2
        elif len(abonne) >= 20 and len(abonne) < 40:
            abocent = 20 - floor(len(abonne) / 2) + 1
            epaisseur_texte = 1
        else:
            abocent = 7
            epaisseur_texte = 1
            abonne = "Achète-toi un nom moins long"

        self.minitel.position(0, 0)
        self.minitel.efface(portee='vraimenttout')
        self.minitel.position(0, 0)
        image = Image.open('minylpg/images/ylpg.png')
        image = image.resize((80, 72), Image.NEAREST)
        image_minitel = ImageMinitel(self.minitel)
        image_minitel.importer(image)
        image_minitel.envoyer(0, 0)

        self.minitel.position(10, 2)
        self.minitel.taille(largeur=2, hauteur=2)
        self.minitel.couleur(caractere=0, fond=7)
        self.minitel.envoyer("YOU LOOK")
        self.minitel.position(8, 4)
        self.minitel.taille(largeur=2, hauteur=2)
        self.minitel.couleur(caractere=0, fond=7)
        self.minitel.envoyer("PRETTY GOOD")
        self.minitel.position(abocent, 22)
        self.minitel.taille(largeur=epaisseur_texte, hauteur=2)
        self.minitel.couleur(caractere=0, fond=7)
        self.minitel.envoyer(abonne)

        self.minitel.bip()

        sleep(5)

        image = Image.open('minylpg/images/ylpgwink1.png')
        image = image.resize((20, 15), Image.NEAREST)
        image_minitel = ImageMinitel(self.minitel)
        image_minitel.importer(image)
        image_minitel.envoyer(20, 9)

        sleep(1.5)

        image = Image.open('minylpg/images/ylpgwink0.png')
        image = image.resize((20, 15), Image.NEAREST)
        image_minitel = ImageMinitel(self.minitel)
        image_minitel.importer(image)
        image_minitel.envoyer(20, 9)
        sleep(3)

        self.switch_mode()
Beispiel #7
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from minitel.Minitel import Minitel
from minitel.ui.ChampTexte import ChampTexte
from minitel.ui.Conteneur import Conteneur
from minitel.ui.Label import Label

minitel = Minitel()

minitel.deviner_vitesse()
minitel.identifier()
minitel.definir_vitesse(1200)
minitel.definir_mode('VIDEOTEX')
minitel.configurer_clavier(etendu=True, curseur=False, minuscule=True)
minitel.echo(False)
minitel.efface()
minitel.curseur(False)

conteneur = Conteneur(minitel, 1, 1, 40, 24)

labelNom = Label(minitel, 1, 10, "Nom")
champNom = ChampTexte(minitel, 16, 10, 20, 60)
labelPrenom = Label(minitel, 1, 12, "Prénom")
champPrenom = ChampTexte(minitel, 16, 12, 20, 60)
labelpass = Label(minitel, 1, 14, "Mot de passe")
champpass = ChampTexte(minitel, 16, 14, 20, 60, champ_cache=True)

conteneur.ajoute(labelNom)
conteneur.ajoute(champNom)
conteneur.ajoute(labelPrenom)
Beispiel #8
0
class Wrapper:  # To get linked with the system that communicate directly with the Minitel
    minitel = None

    def __init__(self):  # Constructor
        self = self

    def Connect(self):
        self.minitel = Minitel()
        if (self.minitel.deviner_vitesse() == -1):
            if (self.minitel.definir_vitesse(300) == False):
                return (1)
        self.minitel.identifier()
        while (self.minitel.capacite['nom'] == "Minitel inconnu"):
            time.sleep(2)
            self.minitel.identifier()

        self.minitel.definir_mode("VIDEOTEX")
        print("{} - {}".format(self.minitel.capacite['nom'],
                               self.minitel.capacite['vitesse']))
        self.minitel.efface()
        self.minitel.debut_ligne()

    def DisplayImageList(self, file_list):
        largeur = 80
        hauteur = 72
        colonne = 1
        ligne = 1
        self.minitel.efface()
        for fichier in file_list:
            image = Image.open(fichier)
            image = image.resize((largeur, hauteur), Image.ANTIALIAS)

            image_minitel = ImageMinitel(self.minitel)
            image_minitel.importer(image)
            image_minitel.envoyer(colonne, ligne)

            self.minitel.sortie.join()
            sleep(3)
            self.minitel.efface()

    def ReadString(self,
                   end=ENVOI
                   ):  #TODO: faire un while plus propre while(valeurs != end)
        content = ""

        while True:
            received = self.minitel.recevoir_sequence(True, None)
            if (received.valeurs == end):
                content += '\0'
                break
            if (received.valeurs == ANNULATION
                ):  # Delete this condition after VivaTech event
                return None
            if (len(content) +
                    10) > 140:  # Delete this condition after VivaTech event
                continue
            content += chr(received.valeurs[0])
            self.minitel.envoyer(received.valeurs[0])
        return content

    def DisplayCursor(self, display=True):
        self.minitel.curseur(display)

    def WaitForAnyInput(self):
        self.minitel.recevoir_sequence(True, None)

    def WriteString(self, text="default"):
        nb_column = 40
        nb_line = 24
        if (self.minitel.capacite['80colonnes'] == True):
            if (self.minitel.mode == 'MIXTE'):
                nb_column = 80
        text = text[0:nb_column * nb_line]
        s_send = Sequence()
        s_send.ajoute(text)
        self.minitel.envoyer(s_send)

    def GetModel(self):
        return self.minitel.capacite['nom']

    def WriteLnString(self, text=""):
        nb_column = 40
        nb_line = 24
        if (self.minitel.capacite['80colonnes'] == True):
            if (self.minitel.mode == 'MIXTE'):
                nb_column = 80
        space_to_add = nb_column - (len(text) % nb_column)
        for i in range(space_to_add):
            text += " "
        text = text[0:nb_column * nb_line]
        s_send = Sequence()
        s_send.ajoute(text)
        self.minitel.envoyer(s_send)

    def ClearScreen(self):
        self.minitel.efface()

    def GetMinitel(self):
        return (self.minitel)

    def Disconnect(self):
        self.minitel.close()
Beispiel #9
0
class Wrapper: # To get linked with the system that communicate directly with the Minitel
    minitel = None
    
    def __init__(self): # Constructor
        self = self
        
    def Connect(self):  
        self.minitel = Minitel()
        if (self.minitel.deviner_vitesse() == -1):
            if (self.minitel.definir_vitesse(300) == False):
                return (1)
        self.minitel.identifier()
        while (self.minitel.capacite['nom'] == "Minitel inconnu"):
            time.sleep(2)
            self.minitel.identifier()

        self.minitel.definir_mode("VIDEOTEX")
        print("{} - {}".format(self.minitel.capacite['nom'], self.minitel.capacite['vitesse']))
        self.minitel.efface()
        self.minitel.debut_ligne()

    def DisplayImageList(self, file_list):
        largeur = 80
        hauteur = 72
        colonne = 1
        ligne = 1
        self.minitel.efface()
        for fichier in file_list:
                image = Image.open(fichier)
                image = image.resize((largeur, hauteur), Image.ANTIALIAS)

                image_minitel = ImageMinitel(self.minitel)
                image_minitel.importer(image)
                image_minitel.envoyer(colonne, ligne)

                self.minitel.sortie.join()
                sleep(3)
                self.minitel.efface()

    def ReadString(self, end = ENVOI): #TODO: faire un while plus propre while(valeurs != end)
        content = ""

        while True:
            received = self.minitel.recevoir_sequence(True, None)
            if (received.valeurs == end):
                content += '\0'
                break
            if (received.valeurs == ANNULATION): # Delete this condition after VivaTech event
                return None
            if (len(content) + 10) > 140: # Delete this condition after VivaTech event
                continue
            content += chr(received.valeurs[0])
            self.minitel.envoyer(received.valeurs[0]) 
        return content

    def DisplayCursor(self, display = True):
        self.minitel.curseur(display)

    def WaitForAnyInput(self):
        self.minitel.recevoir_sequence(True, None)    

    def WriteString(self, text = "default"):
        nb_column = 40
        nb_line = 24
        if (self.minitel.capacite['80colonnes'] == True):
            if (self.minitel.mode == 'MIXTE'):
                nb_column = 80
        text = text[0:nb_column * nb_line]
        s_send = Sequence()
        s_send.ajoute(text)
        self.minitel.envoyer(s_send)

    def GetModel(self):
        return self.minitel.capacite['nom']

    def WriteLnString(self, text = ""):
        nb_column = 40
        nb_line = 24
        if (self.minitel.capacite['80colonnes'] == True):
            if (self.minitel.mode == 'MIXTE'):
                nb_column = 80
        space_to_add = nb_column - (len(text) % nb_column)
        for i in range(space_to_add):
            text += " "
        text = text[0:nb_column * nb_line]
        s_send = Sequence()
        s_send.ajoute(text)
        self.minitel.envoyer(s_send)

    def ClearScreen(self):
        self.minitel.efface()

    def GetMinitel(self):
        return (self.minitel)

    def Disconnect(self):
        self.minitel.close()