예제 #1
0
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.gridlayout import GridLayout
from kivy.animation import Animation
from kivy.properties import NumericProperty
from kivy.uix.label import Label
from kivy.uix.screenmanager import ScreenManager, Screen
from os import listdir
from Connexion import Connexion
import json
kv_path = './kv/'
for kv in listdir(kv_path):
    Builder.load_file(kv_path + kv)

client = Connexion()


class ObjectButton(GridLayout):
    def find_object(self, button):
        client.send(json.dumps({'object': button.text}))
        # sm.current = 'detail'


class TitleLabel(Label):
    pass


class ObjectLabel(Label):
    pass
예제 #2
0
if __name__ == '__main__':

    if len(sys.argv) <= 2:
        print(
            "Ce client nécessite le port et le format de message transmis, sois xml ou Json."
        )
        sys.exit(1)

    host = '138.197.156.251'
    port = int(sys.argv[1])

    fileManager = FileManager()

    if (sys.argv[2] == "xml"):
        protocole = Protocole_xml(fileManager)
    elif (sys.argv[2] == "json"):
        protocole = Protocole_json(fileManager)
    else:
        print("Protocole invalide")
        sys.exit(1)

    connexion = Connexion(host, port)

    client = Client(connexion, protocole, fileManager)
    try:
        if (sys.argv[3] == "prompt"):
            prompt = Prompt(client)
    except:
        client.automatedSyncronisation()