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


Python reactor.registerWxApp函数代码示例

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


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

示例1: run

 def run(self, gui=None):
     reactor.registerWxApp(gui)  # @UndefinedVariable
     bindPort = self.portOpen()
     p = reactor.listenTCP(bindPort, self.server)  # @UndefinedVariable
     self.tryConnect(DUMMY_PUBLIC_IP, DUMMY_SVPORT)
     reactor.callInThread(self.test, p.getHost().port)  # @UndefinedVariable
     reactor.run()  # @UndefinedVariable
开发者ID:NecromancerLev0001,项目名称:LightingFury,代码行数:7,代码来源:usercomm.py

示例2: StartServer

def StartServer(log=None):
    if IMPORT_TWISTED == False :
        log.EcritLog(_(u"Erreur : Problème d'importation de Twisted"))
        return
    
    try :
        factory = protocol.ServerFactory()
        factory.protocol = Echo
        factory.protocol.log = log
        reactor.registerWxApp(wx.GetApp())
        port = int(UTILS_Config.GetParametre("synchro_serveur_port", defaut=PORT_DEFAUT))
        reactor.listenTCP(port, factory)
        
        # IP locale
        #ip_local = socket.gethostbyname(socket.gethostname())
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(('jsonip.com', 80))
        ip_local = s.getsockname()[0]
        s.close()
        log.EcritLog(_(u"IP locale : %s") % ip_local)
        
        # IP internet
        ip_internet = json.loads(urlopen("http://jsonip.com").read())["ip"]
        log.EcritLog(_(u"IP internet : %s") % ip_internet)
        
        # Port
        log.EcritLog(_(u"Serveur prêt sur le port %d") % port)
        
        log.SetImage("on")
        reactor.run()
    except Exception, err :
        print ("Erreur lancement serveur nomade :", err)
        log.EcritLog(_(u"Erreur dans le lancement du serveur Nomadhys :") )
        log.EcritLog(err) 
开发者ID:jeromelebleu,项目名称:Noethys,代码行数:34,代码来源:CTRL_Serveur_nomade.py

示例3: main

def main():
    log.startLogging(sys.stdout)

    app = MedicalookApp()
    reactor.registerWxApp(app)

    reactor.run()
开发者ID:wuzhe,项目名称:medicalook,代码行数:7,代码来源:main.py

示例4: OnInit

    def OnInit(self):
        self.SetAppName("rss_downloader")

        # For debugging
        self.SetAssertMode(wx.PYAPP_ASSERT_DIALOG)

        # initialize config before anything else
        self.Config = ConfigManager()

        reactor.registerWxApp(self)

        self.Bind(EVT_NEW_TORRENT_SEEN, self.OnNewTorrentSeen)
        self.Bind(EVT_TORRENT_DOWNLOADED, self.OnTorrentDownloaded)

        self.growler = growler.Growler()

        self.db_engine = db.Database()
        self.db_engine.connect()
        self.db_engine.init()

        self.db = db.DBSession()

        self.icon = wx.IconFromBitmap(self.load_app_image('16-rss-square.png').ConvertToBitmap())

        self.feed_checker = FeedChecker()
        self.download_queue = DownloadQueue()

        self.download_queue.run()
        self.feed_checker.run()

        self.mainwindow = mainwin.MainWindow()

        self.mainwindow.Bind(wx.EVT_CLOSE, self.Shutdown)

        return True
开发者ID:bobbyrward,项目名称:Granary,代码行数:35,代码来源:rss_downloader.py

示例5: main

def main():
    """main entry point into MicroView"""

    # Run the main application
    app = MicroViewApp(False)
    reactor.registerWxApp(app)
    reactor.run()
开发者ID:andyTsing,项目名称:MicroView,代码行数:7,代码来源:MicroView.py

示例6: runClient

def runClient():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '-s', '--server'
    )
    parser.add_argument(
        '-t', '--teamname'
    )
    args = parser.parse_args()
    if args.server is None:
        args.server = 'localhost'

    log.msg('Client start')

    npc_factory = NPCServer()
    app = wx.App()
    frame_1 = MyFrame(
        None, -1, "", size=(1000, 1000),
        factory = npc_factory,
        teamname=args.teamname
    )
    app.SetTopWindow(frame_1)
    frame_1.Show()

    reactor.registerWxApp(app)
    reactor.connectTCP(args.server, 22517, npc_factory)
    reactor.run()
    log.msg('end client')
开发者ID:kasworld,项目名称:wxgame2,代码行数:28,代码来源:twclient.py

示例7: main

def main(cmd_args=None):
	parser =optparse.OptionParser()
	parser.add_option('-s','--service', action='store_true', dest='serviceOnly', default=False, help='Start dMilo with only the web service.')
	parser.add_option('-n','--new', action='store_true', dest='newdb', default=False, help='Initialize a new Database')
	if cmd_args:
		(options, args) = parser.parse_args()
	else:
		(options, args) = parser.parse_args(cmd_args)
	#: Set the Preferences.
	if not os.path.exists(dotDmiloPath):
		os.makedirs(dotDmiloPath)
	if options.newdb or not os.path.exists( os.path.join(dotDmiloPath, 'dmilo.db')):
		ModelStore(os.path.join(dotDmiloPath, 'dmilo.db')).newStore()
	ModelStore(os.path.join(dotDmiloPath, 'dmilo.db'))
	#: Start the Application
	if options.serviceOnly:
		app = serviceOnlyApp( False )
	else:
		app = xrcApp(False)
	
	#: Add the Application to the Event Loop.
	reactor.registerWxApp(app)

	#: Start the Event Loop.
	reactor.run()
开发者ID:netpete,项目名称:dmilo,代码行数:25,代码来源:dmilo.py

示例8: demo

def demo():
    log.startLogging(sys.stdout)

    # register the App instance with Twisted:
    app = MyApp(0)
    reactor.registerWxApp(app)

    # start the event loop:
    reactor.run()
开发者ID:wellbehavedsoftware,项目名称:wbs-graphite,代码行数:9,代码来源:wxdemo.py

示例9: serve_udp

def serve_udp(engine=None, port=9007, logto=sys.stdout):
    """Serve the `M2UDP` protocol using the given `engine` on the
    specified `port` logging messages to given `logto` which is a
    file-like object.  This function will block till the service is
    closed.  There is no need to call `mlab.show()` after or before
    this.  The Mayavi UI will be fully responsive.

    **Parameters**

     :engine: Mayavi engine to use. If this is `None`,
              `mlab.get_engine()` is used to find an appropriate engine.

     :port: int: port to serve on.

     :logto: file : File like object to log messages to.  If this is
                    `None` it disables logging.

    **Examples**

    Here is a very simple example::

        from mayavi import mlab
        from mayavi.tools import server
        mlab.test_plot3d()
        server.serve_udp()

    Test it like so::

        import socket
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.bind(('', 9008))
        s.sendto('camera.azimuth(10)', ('', 9007))

    **Warning**

    Data sent is exec'd so this is a security hole.
    """

    from mayavi import mlab
    e = engine or mlab.get_engine()
    # Setup the protocol with the right attributes.
    proto = M2UDP()
    proto.engine = e
    proto.scene = e.current_scene.scene
    proto.mlab = mlab

    if logto is not None:
        log.startLogging(logto)
    log.msg('Serving Mayavi2 UDP server on port', port)
    log.msg('Using Engine', e)

    # Register the running wxApp.
    reactor.registerWxApp(wx.GetApp())
    # Listen on port 9007 using above protocol.
    reactor.listenUDP(port, proto)
    # Run the server + app.  This will block.
    reactor.run()
开发者ID:PerryZh,项目名称:mayavi,代码行数:57,代码来源:server.py

示例10: twist

def twist(app, rpc):
    """
    This runs the (optional xml-rpc server)

    Ref: http://code.activestate.com/recipes/298985/
    """
    reactor.registerWxApp(app)
    reactor.listenTCP(RPC_PORT, server.Site(rpc))
    reactor.run()
开发者ID:sabren,项目名称:ceomatic,代码行数:9,代码来源:tstream_main.py

示例11: OnInit

    def OnInit(self):
        ''' Called by wxWindows to initialize our application

        :returns: Always True
        '''
        log.debug("application initialize event called")
        reactor.registerWxApp(self)
        frame = SimulatorFrame(None, -1, "Pymodbus Simulator")
        frame.CenterOnScreen()
        frame.Show(True)
        self.SetTopWindow(frame)
        return True
开发者ID:eastmanjoe,项目名称:python_bucket,代码行数:12,代码来源:pymodbus_modbus_simulator_wk_frontend.py

示例12: main

def main():
    app = GMApp()
    reactor.registerWxApp(app)

    setLogFunction(LogText)

    # reactor.callLater(.1,ShowLoginDialog,app.mainFrame)

    try:
        reactor.run()
    except:
        traceback.print_exc()
开发者ID:mixxit,项目名称:solinia_depreciated,代码行数:12,代码来源:gmtool.py

示例13: main

def main():
    #register the app
    app = wx.PySimpleApp()
    reactor.registerWxApp(app)

    #create the application and client
    addressBookApp = AddressBookApplication()
    factory = pb.PBClientFactory()
    reactor.connectTCP("localhost", 8789, factory)
    factory.getRootObject().addCallback(addressBookApp.connected)
    
    #start reactor
    reactor.run(True)
开发者ID:rgravina,项目名称:Pyrope,代码行数:13,代码来源:addressbook_twisted_client.py

示例14: main

def main():
    log.set_log_file("message.log")
    type_descriptor.load_xml("attributes.xml", "typedescriptors.xml")

    app = wx.App(False)

    # NOTE: frame must exist before run
    frame = MainFrame()
    frame.Show()

    reactor.registerWxApp(app)

    reactor.listenUDP(34888, DestAddressProtocol(frame))
    reactor.run()
开发者ID:smallka,项目名称:piablo,代码行数:14,代码来源:middle_man.py

示例15: initdisplay

 def initdisplay(self):
     # try a wx window control pane
     self.displayapp = wx.PySimpleApp()
     # create a window/frame, no parent, -1 is default ID, title, size
     self.displayframe = wx.Frame(None, -1, "HtmlWindow()", size=(1000, 600))
     # call the derived class, -1 is default ID
     self.display=self.HtmlPanel(self.displayframe,-1,self)
     # show the frame
     #self.displayframe.Show(True)
     myWxAppInstance = self.displayapp
     reactor.registerWxApp(myWxAppInstance)
     splash="<html><body><h2>GLab Python Manager</h2></body></html>"
     print self.xstatus()
     print self.xstatus("html")
     self.display.updateHTML(splash+self.xstatus("html"))
开发者ID:craigprice,项目名称:XTSM_1,代码行数:15,代码来源:XTSMserver_081014.py


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