Example #1
0
 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)
Example #2
0
    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"):
            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()
Example #3
0
 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
Example #4
0
    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()
Example #5
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',
Example #6
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
Example #7
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()
Example #8
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('vraimenttout')
minitel.curseur(False)

n = 5

minitel.envoyer('Ce texte sera effacé dans {} secondes'.format(n))
minitel.sortie.join()

for i in range(n):
    minitel.position(1, i + 2)
    minitel.envoyer(str(n - i))
    sleep(1)

minitel.efface('vraimenttout')
minitel.envoyer('Hello world !')
Example #9
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)
Example #10
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)
Example #11
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()
Example #12
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()
Example #13
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()
Example #14
0
from minitel.ImageMinitel import ImageMinitel
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from time import sleep

# Crée une image avec un texte
fonte = ImageFont.truetype("/home/fred/.fonts/OdaBalloon.ttf", 60)
#fonte.fontmode = 1
largeur, hauteur = fonte.getsize("PyMinitel")
image = Image.new("1", (largeur, hauteur))
draw = ImageDraw.Draw(image)
draw.text((0, 0),"PyMinitel", 255, font = fonte)
image = image.resize((largeur / 3, int(hauteur * 1.35 / 3)), Image.NEAREST)

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)

# Met à jour la ligne de contrôle
minitel.position(1, 0)
minitel.envoyer(u"PyMinitel v0.1.2 - Frédéric Bisson")
minitel.efface(portee = 'finligne')
Example #15
0
from minitel.ImageMinitel import ImageMinitel
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from time import sleep

# Crée une image avec un texte
fonte = ImageFont.truetype("/home/fred/.fonts/OdaBalloon.ttf", 60)
#fonte.fontmode = 1
largeur, hauteur = fonte.getsize("PyMinitel")
image = Image.new("1", (largeur, hauteur))
draw = ImageDraw.Draw(image)
draw.text((0, 0),"PyMinitel", 255, font = fonte)
image = image.resize((largeur / 3, int(hauteur * 1.35 / 3)), Image.NEAREST)

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)

# Met à jour la ligne de contrôle
minitel.position(1, 0)
minitel.envoyer("PyMinitel v0.1.2 - Frédéric Bisson")
minitel.efface(portee = 'finligne')
Example #16
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('vraimenttout')
minitel.curseur(False)

n = 5 

minitel.envoyer('Ce texte sera effacé dans {} secondes'.format(n) )
minitel.sortie.join()

for i in range(n) :
	minitel.position(1,i+2)
	minitel.envoyer( str(n-i) ) 
	sleep(1)

minitel.efface('vraimenttout')
minitel.envoyer('Hello world !')