Example #1
0
def main(argv):
    msg_arg = 3.141592654

    matecomponent.activate()

    app = matecomponent.Application("Libmatecomponent-Test-Uniqapp")

    app.register_message(CLOSURE_MESSAGE, "This is a test message", float,
                         (int, float), closure_message_cb, "user-data")

    client = app.register_unique(app.create_serverinfo(("LANG", )))
    if client is not None:
        print "I am an application client."
        app.unref()
        del app

        msgdescs = client.msg_list()
        for msgdesc in msgdescs:
            print "Application supports message:", msgdesc

        print "Sending message string '%s' with argument %f" % (TEST_MESSAGE,
                                                                msg_arg)
        retval = client.msg_send(TEST_MESSAGE, (msg_arg, "this is a string"))
        print "Return value:", retval

        print "Sending message string '%s' with arguments %i and %f" % (
            CLOSURE_MESSAGE, 10, 3.141592654)
        retval = client.msg_send(CLOSURE_MESSAGE, (10, 3.141592654))
        print "Return value: ", retval

        print "Sending new-instance, with argv"
        i = client.new_instance(argv)
        print "new-instance returned ", i

        print "Asking the server to quit"
        client.msg_send("quit", ())
        return
    else:
        print "I am an application server"
        app.connect("message::test-message", message_cb)
        app.connect("new-instance", new_instance_cb)
        app.new_instance(argv)
        app.connect("message::quit", message_quit_cb)

        matecomponent.main()
        app.unref()
def main(argv):
    msg_arg = 3.141592654

    matecomponent.activate()

    app = matecomponent.Application("Libmatecomponent-Test-Uniqapp")

    app.register_message(
        CLOSURE_MESSAGE, "This is a test message", float, (int, float), closure_message_cb, "user-data"
    )

    client = app.register_unique(app.create_serverinfo(("LANG",)))
    if client is not None:
        print "I am an application client."
        app.unref()
        del app

        msgdescs = client.msg_list()
        for msgdesc in msgdescs:
            print "Application supports message:", msgdesc

        print "Sending message string '%s' with argument %f" % (TEST_MESSAGE, msg_arg)
        retval = client.msg_send(TEST_MESSAGE, (msg_arg, "this is a string"))
        print "Return value:", retval

        print "Sending message string '%s' with arguments %i and %f" % (CLOSURE_MESSAGE, 10, 3.141592654)
        retval = client.msg_send(CLOSURE_MESSAGE, (10, 3.141592654))
        print "Return value: ", retval

        print "Sending new-instance, with argv"
        i = client.new_instance(argv)
        print "new-instance returned ", i

        print "Asking the server to quit"
        client.msg_send("quit", ())
        return
    else:
        print "I am an application server"
        app.connect("message::test-message", message_cb)
        app.connect("new-instance", new_instance_cb)
        app.new_instance(argv)
        app.connect("message::quit", message_quit_cb)

        matecomponent.main()
        app.unref()
Example #3
0
def hello_new ():
    win = hello_create_main_window ()
    
    button = gtk.Button ()
    button.set_border_width (10)
    
    label = gtk.Label ('Hello World')
    button.add (label)
    button.connect ('clicked', hello_on_button_click, label)
    
    win.set_size_request (250, 350)
    win.set_resizable (gtk.TRUE)
    win.set_property ('allow-shrink', gtk.FALSE)
    
    frame = gtk.Frame ()
    frame.set_shadow_type (gtk.SHADOW_IN)
    frame.add (button)
    win.set_contents (frame)
    
    win.connect ('delete_event', delete_event_cb)
    
    app_list.append (win)
    
    return win

if __name__ == '__main__':
    app = hello_new ()
    app.show_all ()
    matecomponent.main ()