Beispiel #1
0
def main():
    global config, config_file, output_file, output_name, output_desc
    global connection
    if len(sys.argv) <= 4:
        print "Syntax: keyeditor <config-filename> <output-filename> <name> <desc>"
        print "The specified config file will be created if it doesn't exist."
        print "The output file will be written when the generate button is"
        print "clicked. It can then be copied into /usr/share/X11/XKB/symbols."
        return
    config_file = sys.argv[1]
    output_file = sys.argv[2]
    output_name = sys.argv[3]
    output_desc = sys.argv[4]
    config = RawConfigParser()
    config.read(config_file)
    client_protocol = librtk.protocols.LinkedProtocol()
    server_protocol = librtk.protocols.LinkedProtocol(client_protocol)
    connection = librtk.Connection(server_protocol, start_app)
    connection.start()
    client_connection, master = librtkinter.start_connection(client_protocol)
    print "Started up!"
    try:
        master.mainloop()
    except KeyboardInterrupt:
        print "Interrupted, shutting down"
        client_connection.close()
        connection.close()
    print "Terminated."
Beispiel #2
0
from utils import print_exceptions
from functools import partial


def main():
    if len(sys.argv) <= 1:
        print "You need to specify the url of the application to display."
        return
    scheme, location = urlparse(sys.argv[1])[0:2]
    if scheme != "rtk":
        print ("Only rtk:// urls are supported for now. I might add an HTTP " "transport at some point in the future.")
    if ":" not in location:
        location += ":" + str(DEFAULT_PORT)
    host, port = location.split(":")
    port = int(port)
    socket = Socket()
    try:
        socket.connect((host, port))
    except SocketError, e:
        print "Error while connecting: " + str(e)
        return
    protocol = ThreadedProtocol(socket)
    connection, tk = librtkinter.start_connection(protocol)
    print "Started up!"
    try:
        tk.mainloop()
    except KeyboardInterrupt:
        print "Interrupted, shutting down"
        connection.close()
    print "Terminated."