Пример #1
0
def main(application):
    import qt
    from twisted.internet import qtreactor
    app=qt.QApplication([])
    qtreactor.install(app)

    import sys
    from twisted.internet import reactor

    from shtoom.ui.qtui import ShtoomMainWindow
    UI = ShtoomMainWindow()
    UI.connectApplication(application)
    UI.show()

    from shtoom import log
    if application.getPref('stdout'):
        import sys
        log.startLogging(sys.stdout, setStdout=False)
    else:
        log.startLogging(UI.getLogger(), setStdout=False)

    reactor.addSystemEventTrigger('after', 'shutdown', app.quit )
    app.connect(app, qt.SIGNAL("lastWindowClosed()"), reactor.stop)

    return UI
Пример #2
0
def main(application):
    import qt
    from twisted.internet import qtreactor
    app = qt.QApplication([])
    qtreactor.install(app)

    import sys
    from twisted.internet import reactor

    from shtoom.ui.qtui import ShtoomMainWindow
    UI = ShtoomMainWindow()
    UI.connectApplication(application)
    UI.show()

    from shtoom import log
    if application.getPref('stdout'):
        import sys
        log.startLogging(sys.stdout, setStdout=False)
    else:
        log.startLogging(UI.getLogger(), setStdout=False)

    reactor.addSystemEventTrigger('after', 'shutdown', app.quit)
    app.connect(app, qt.SIGNAL("lastWindowClosed()"), reactor.stop)

    return UI
Пример #3
0
def main(application):
    import sys

    from shtoom.ui.util import maybeInstallDBus
    maybeInstallDBus()

    from twisted.internet import reactor
    from __main__ import app

    from shtoom.ui.textui import ShtoomMain
    UI = ShtoomMain()
    UI.connectApplication(application)
    # see twisted.conch.stdio for an example of readline-y sort of things.
    stdio.StandardIO(UI)
    if not app.getPref('logfile'):
        from shtoom import log
        log.startLogging(sys.stdout, setStdout=False)
    return UI
Пример #4
0
def main(application):
    import sys

    from shtoom.ui.util import maybeInstallDBus
    maybeInstallDBus()

    from twisted.internet import reactor
    from __main__ import app

    from shtoom.ui.textui import ShtoomMain
    UI = ShtoomMain()
    UI.connectApplication(application)
    # see twisted.conch.stdio for an example of readline-y sort of things.
    stdio.StandardIO(UI)
    if not app.getPref('logfile'):
        from shtoom import log
        log.startLogging(sys.stdout, setStdout=False)
    return UI
Пример #5
0
def main(application):
    import sys
    from shtoom.ui.util import maybeInstallDBus
    maybeInstallDBus()

    from twisted.internet import reactor
    from twisted.internet import tksupport

    from shtoom.ui.tkui import ShtoomMainWindow
    UI = ShtoomMainWindow()
    tksupport.install(UI.getMain())
    UI.connectApplication(application)
    from shtoom import log
    if application.getPref('stdout'):
        import sys
        log.startLogging(sys.stdout, setStdout=False)
    else:
        log.startLogging(UI.getLogger(), setStdout=False)
    return UI
Пример #6
0
def main(application):
    import gnome
    global gnomeProgram
    gnomeProgram = gnome.init("Shtoom", "Whatever Version")

    from twisted.internet import gtk2reactor
    gtk2reactor.install()

    from shtoom.ui.gnomeui.main import ShtoomWindow

    UI = ShtoomWindow()
    UI.connectApplication(application)

    from shtoom import log
    if application.getPref('stdout'):
        import sys
        log.startLogging(sys.stdout, setStdout=False)
    else:
        log.startLogging(UI.getLogger(), setStdout=False)

    return UI
Пример #7
0
def main(application):
    import gnome
    global gnomeProgram
    gnomeProgram = gnome.init("Shtoom", "Whatever Version")

    from twisted.internet import gtk2reactor
    gtk2reactor.install()

    from shtoom.ui.gnomeui.main import ShtoomWindow

    UI = ShtoomWindow()
    UI.connectApplication(application)

    from shtoom import log
    if application.getPref('stdout'):
        import sys
        log.startLogging(sys.stdout, setStdout=False)
    else:
        log.startLogging(UI.getLogger(), setStdout=False)

    return UI
Пример #8
0
def main(shtoomapp):
    from twisted.python import threadable

    # wxreactor sucks generally.
    # wxsupport sucks on windows.
    # lets give threading a go

    threadable.init(1)
    wxapp = WxShtoomApplication()
    wxproxy = WxProxy(shtoomapp, wxapp)
    appproxy = ShtoomProxy(wxproxy)
    wxapp.frame.connectApplication(appproxy)

    from shtoom import log
    import sys
    # TODO: This style of logging isn't thread safe. Need to plugin
    # the logging into the WxInjector. i.e. the logger targets the
    # WxInjector.evtlist
    #log.startLogging(wxapp.frame.getLogger(), setStdout=False)
    log.startLogging(sys.stdout)

    return wxproxy
Пример #9
0
def main(shtoomapp):
    from twisted.python import threadable

    # wxreactor sucks generally.
    # wxsupport sucks on windows.
    # lets give threading a go

    threadable.init(1)
    wxapp = WxShtoomApplication()
    wxproxy = WxProxy(shtoomapp, wxapp)
    appproxy = ShtoomProxy(wxproxy)
    wxapp.frame.connectApplication(appproxy)

    from shtoom import log
    import sys
    # TODO: This style of logging isn't thread safe. Need to plugin
    # the logging into the WxInjector. i.e. the logger targets the
    # WxInjector.evtlist
    #log.startLogging(wxapp.frame.getLogger(), setStdout=False)
    log.startLogging(sys.stdout)

    return wxproxy
Пример #10
0
    if upnp:
        manuf = upnp.upnpInfo.get('manufacturer', 'unknown')
        model = upnp.upnpInfo.get('friendlyName', 'unknown')
        print "UPnP discovered a %s (%s) device"%(model, manuf)
        print "UPnP controlURL:", upnp.controlURL
    else:
        print "No UPnP-capable device discovered"
    if sres:
        print "STUN says NAT type: %s"%(stun.name)
        if not upnp:
            if stun.blocked:
                print "You will be unable to make calls to the internet"
            elif not stun.useful:
                print "You will need to use an outbound proxy to make calls to the internet"
    else:
        print "STUN was unable to get a result. This is bad"
    print "And the mapper we'd use is: %r"%(mapper)
    reactor.stop()


if __name__ == "__main__":
    from twisted.internet import reactor
    import sys
    from shtoom import log
    if len(sys.argv) > 1 and sys.argv[1] == "-v":
        import shtoom.stun
        shtoom.stun.STUNVERBOSE = True
        log.startLogging(sys.stdout)
    reactor.callLater(0, main)
    reactor.run()
Пример #11
0
    if upnp:
        manuf = upnp.upnpInfo.get('manufacturer', 'unknown')
        model = upnp.upnpInfo.get('friendlyName', 'unknown')
        print "UPnP discovered a %s (%s) device" % (model, manuf)
        print "UPnP controlURL:", upnp.controlURL
    else:
        print "No UPnP-capable device discovered"
    if sres:
        print "STUN says NAT type: %s" % (stun.name)
        if not upnp:
            if stun.blocked:
                print "You will be unable to make calls to the internet"
            elif not stun.useful:
                print "You will need to use an outbound proxy to make calls to the internet"
    else:
        print "STUN was unable to get a result. This is bad"
    print "And the mapper we'd use is: %r" % (mapper)
    reactor.stop()


if __name__ == "__main__":
    from twisted.internet import reactor
    import sys
    from shtoom import log
    if len(sys.argv) > 1 and sys.argv[1] == "-v":
        import shtoom.stun
        shtoom.stun.STUNVERBOSE = True
        log.startLogging(sys.stdout)
    reactor.callLater(0, main)
    reactor.run()