当前位置: 首页>>代码示例>>Python>>正文


Python gtk2reactor.install函数代码示例

本文整理汇总了Python中twisted.internet.gtk2reactor.install函数的典型用法代码示例。如果您正苦于以下问题:Python install函数的具体用法?Python install怎么用?Python install使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了install函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: client

def client():
    from twisted.internet import gtk2reactor
    gtk2reactor.install()
    from twisted.internet import reactor
#    import gobject
#    reactor.callWhenRunning(gobject.threads_init)
#    gobject.threads_init()

    options = ClientOptions()
    options.parseOptions()

    from afm.ui.app import Application
    app = Application(options)

    reactor.addSystemEventTrigger('before', 'shutdown',
                                  logging.getLogger(__name__).info,
                                  'Stopping AFM Client')

    logging.getLogger(__name__).info("AFM Client Started")
    try:
        reactor.run()
    except KeyboardInterrupt:
        reactor.stop()
    except:
        raise
        from twisted.python import log
        log.err()
开发者ID:UfSoft,项目名称:afm,代码行数:27,代码来源:service.py

示例2: activate

 def activate(self, shell):
     from twisted.internet import gtk2reactor
     try:
         gtk2reactor.install()
     except AssertionError, e:
         # sometimes it's already installed
         print e
开发者ID:dignan,项目名称:control,代码行数:7,代码来源:__init__.py

示例3: main

def main():
    from twisted.internet import gtk2reactor
    try:
        gtk2reactor.install()
    except:
        pass
    from twisted.internet import reactor
    con = pynaoqi.getDefaultConnection()
    notes = NotesMain(con)
    notes._w.show_all()
    reactor.run()
开发者ID:alon,项目名称:burst,代码行数:11,代码来源:widgets.py

示例4: installDbusReactor

def installDbusReactor():
    try:
        from twisted.internet import glib2reactor
        glib2reactor.install()
        return True
    except:
        try:
            from twisted.internet import gtk2reactor
            gtk2reactor.install()
            return True
        except:
            return False
开发者ID:braams,项目名称:shtoom,代码行数:12,代码来源:dbus.py

示例5: installgtkreactor

def installgtkreactor():
    import pynaoqi
    options = pynaoqi.getDefaultOptions()
    using_gtk = False
    if options.twisted and not options.nogtk:
        # Try to throw in gtk support
        try:
            from twisted.internet import gtk2reactor
            gtk2reactor.install()
            using_gtk = True
        except AssertionError, e:
            using_gtk = True
        except:
开发者ID:burst,项目名称:burst,代码行数:13,代码来源:shell.py

示例6: main

def main(clazz=Joints):
    global con
    con = pynaoqi.getDefaultConnection(with_twisted=True)
    class Main(clazz):

        def _onDestroy(self, *args):
            super(Main, self)._onDestroy(*args)
            print "quitting.."
            reactor.stop()

    from twisted.internet import gtk2reactor
    try:
        gtk2reactor.install()
    except:
        pass
    window = Main(con)
    reactor.run()
开发者ID:alon,项目名称:burst,代码行数:17,代码来源:gui.py

示例7: main

def main():   
    """Launch the client.

    This is the main entry point. This will first initialise the GUI, then
    load the main module specified on the command line.
    """
    
    options = parser.parse_args()
    if options.module_directory != "":
        directory = options.module_directory
        import sys
        sys.path.append(directory)
    if options.gui == 'gtk':
        from twisted.internet import gtk2reactor
        gtk2reactor.install()
    
    from twisted.internet import reactor    
    modclass = load_file(options.modulename)
    factory = TelnetClientFactory(modclass.name, modclass.encoding, 
                                  options.modulename, reactor)

    if options.gui == 'gtk':
        from pymudclient.gui.gtkgui import configure
        factory.realm.gui = ImperianGui(factory.realm)

    configure(factory)
    factory.realm.module_settings_dir=options.settings_directory
    modinstance = factory.realm.load_module(modclass)
    factory.realm.gmcp_handler = modinstance.gmcp_handler
    

    modinstance.is_main(factory.realm)

    from twisted.internet import reactor

    #pylint kicks up a major fuss about these lines, but that's because 
    #Twisted does some hackery with the reactor namespace.
    #pylint: disable-msg=E1101

    reactor.connectTCP(modclass.host, modclass.port, factory)
    if not options.profile:
        reactor.run()
    else:
        import cProfile
        cProfile.runctx("reactor.run()", globals(), locals(),
                        filename = "pymudclient.prof")
开发者ID:dmoggles,项目名称:pymudclient,代码行数:46,代码来源:mudconnect.py

示例8: main

def main():
    from twisted.internet import gtk2reactor
    reactor = gtk2reactor.install()

    from fbuploader.main_window import MainWindow
    log.info('Starting Main Window')
    main_window = MainWindow()
    main_window.show()

    reactor.run()
开发者ID:damoxc,项目名称:fbuploader,代码行数:10,代码来源:main.py

示例9: main

def main(argv):
    from mushin.common import log
    log.init()
    log.debug('maemo', 'main')

    from twisted.internet import gtk2reactor
    gtk2reactor.install()
    from twisted.internet import reactor

    # set paisley to non-strict since we only have simplejson on maemo
    from mushin.extern.paisley import pjson

    assert not pjson.STRICT

    log.logTwisted()

    reactor.callWhenRunning(start)

    reactor.run()
开发者ID:thomasvs,项目名称:mushin,代码行数:19,代码来源:main.py

示例10: main

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
开发者ID:braams,项目名称:shtoom,代码行数:21,代码来源:gnomeshtoom.py

示例11: main

def main(argv, reactor=None):
    """Run the client GUI.

    Typical use:
    >>> sys.exit(main(sys.argv))

    @param argv: The arguments to run it with, e.g. sys.argv.
    @param reactor: The reactor to use. Must be compatible with gtk as this
        module uses gtk API"s.
    @return exitcode: The exit code it returned, as per sys.exit.
    """
    if reactor is None:
        from twisted.internet import gtk2reactor
        gtk2reactor.install()
        from twisted.internet import reactor
    try:
        AWSStatusIcon(reactor)
        gobject.set_application_name("aws-status")
        reactor.run()
    except ValueError:
        # In this case, the user cancelled, and the exception bubbled to here.
        pass
开发者ID:lzimm,项目名称:360io,代码行数:22,代码来源:gtk.py

示例12: run_gtk2

def run_gtk2(config):
    # Put these off until after we parse options, so we know what reactor
    # to load.
    from twisted.internet import gtk2reactor
    gtk2reactor.install()

    # Put this off until after we parse options, or else gnome eats them.
    sys.argv[:] = ['manhole']
    from twisted.manhole.ui import gtk2manhole

    o = config.opts
    defaults = {
        'host': o['host'],
        'port': o['port'],
        'identityName': o['user'],
        'password': o['password'],
        'serviceName': o['service'],
        'perspectiveName': o['perspective']
        }
    w = gtk2manhole.ManholeWindow()
    w.setDefaults(defaults)
    w.login()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:22,代码来源:manhole.py

示例13: run_gtk2

def run_gtk2(config):
    # Put these off until after we parse options, so we know what reactor
    # to load.
    from twisted.internet import gtk2reactor

    gtk2reactor.install()

    # Put this off until after we parse options, or else gnome eats them.
    sys.argv[:] = ["manhole"]
    from twisted.manhole.ui import gtk2manhole

    o = config.opts
    defaults = {
        "host": o["host"],
        "port": o["port"],
        "identityName": o["user"],
        "password": o["password"],
        "serviceName": o["service"],
        "perspectiveName": o["perspective"],
    }
    w = gtk2manhole.ManholeWindow()
    w.setDefaults(defaults)
    w.login()
开发者ID:RockySteveJobs,项目名称:python-for-android,代码行数:23,代码来源:manhole.py

示例14: maybeInstallReactor

def maybeInstallReactor():
    import sys
    try:
        from twisted.internet import gtk3reactor # s/2/3 if you're using gtk3
        reactor = gtk3reactor.install()
        reactor.startRunning()
        reactor._simulate()
        return reactor
    except:
        try:
            from twisted.internet import gtk2reactor
            reactor = gtk2reactor.install()
            reactor.startRunning()
            reactor._simulate()
            return reactor
        except:
            print "This plugin requires twisted to be installed"
            exit(-1)
开发者ID:noisecapella,项目名称:rhythmbox-echonest,代码行数:18,代码来源:echonest-recommender.py

示例15: install

 def install():
   """Start up the Twisted networking support.  Returns the new, running reactor."""
   #This works fine anyway I think?  Not really sure why this is here, just keeping it how it was in Twisted
   if runtime.platform.getType() == 'posix':
     reactor = gtk2reactor.install(ProgramState.USE_GTK)
   #Windows needs this custom class
   else:
     try:
       reactor = GtkReactor()
       installReactor(reactor)
     except socket.error, e:
       #NOTE:  10022 is a bit suspect.  I saw it once (it's "invalid argument"), 
       #but it can apparently happen in cases that might be caused by a firewall...
       #10013 is "forbidden"
       #10047 is "cannot bind"
       #10049 is "Can't assign requested address"
       if e[0] not in (10013, 10047, 10049, 10022):
         raise e
       import win32api
       win32api.MessageBox(0, "You must allow incoming and outgoing connections for both BitBlinder.exe and Tor.exe in your firewall.  Otherwise, BitBlinder will not work correctly.", "Firewalled")
       sys.exit(-5)
开发者ID:clawplach,项目名称:BitBlinder,代码行数:21,代码来源:GtkReactor.py


注:本文中的twisted.internet.gtk2reactor.install函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。