
if __name__ == '__main__':
    from twisted.internet import glib2reactor
    glib2reactor.install()

    from elisa.plugins.hal.hal_resource import HALResource
    from elisa.core.media_uri import MediaUri

    from twisted.internet import reactor

    hal = None
    model = None
    dfr = None

    def setup_done(resource):
        global hal, model, hal
        hal = resource
        print """

        You are now in the interactive tests. You have the HalResource at 'hal'. and
        the Dummybus at common.application.bus. A first request for everything
        is done at model, dfr.

        """
        model, dfr = hal.get(MediaUri('volumes://localhost/?filter=dvd,cdda,removable'), None)

    class Dummy(object):pass

    class DummyBus(object):
        def __init__(self):
            self.messages = []
        def register(*args):
            pass
        def send_message(self, msg, sender):
            self.messages.append( msg )

    from elisa.core import common

    common.application = Dummy()
    common.application.bus = DummyBus()

    def setup():
        HALResource.create({}).addCallback(setup_done)

    reactor.callWhenRunning(setup)
    reactor.simulate()
    reactor.startRunning()
    import IPython
    IPython.Shell.IPShellGTK([], locals()).mainloop()
