• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python reactor.registerWxApp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: run_main_view_wx

def run_main_view_wx(config):
    """ Runs main UI view based on wx framework. """
    # imports
    import wx
    import socket
    # might be some cross platform (windows) issues reported with wxReactor
    from twisted.internet import wxreactor
    # add twisted / wx interaction support
    wxreactor.install()
    # add logging observer
    from twisted.python.log import PythonLoggingObserver
    observer = PythonLoggingObserver()
    observer.start()

    # then can do normal reactor imports
    from twisted.internet import reactor
    # and wx specific implementations
    from ui.view_model_wx import MainViewController
    from ui.view_model_wx import MainViewModel
    from ui.main_view_wx import MainWindow

    # ip address *much* faster than by device name
    ipaddr = socket.gethostbyname(config.server_name)
    logging.debug("RPC:\tServer name %s resolved to IP address %s" % (config.server_name, ipaddr))

    # create rpc client
    from web.webclient import RPCClient, RPCClientFactory
    rpc_client = RPCClient()
    
    # create view model
    view_model = MainViewModel()
    
    # create view controller
    controller = MainViewController(rpc_client, view_model, config)
    
    # create wxApp and main window
    wxApp = wx.App(False)
    frame = MainWindow(None, "fishpi - Proof Of Concept Vehicle control", controller, ipaddr, config.rpc_port, config.camera_port)
    frame.Show()
    
    # run reactor rather than usual 'wxApp.MainLoop()'
    reactor.registerWxApp(wxApp)
    logging.debug("RPC:\tconnecting to %s (%s) on port %s" % (config.server_name, ipaddr, config.rpc_port))
    reactor.connectTCP(ipaddr, config.rpc_port, RPCClientFactory(controller))
    #reactor.callLater(5, update_callback)
    reactor.run()
开发者ID:FishPi,项目名称:FishPi-POCV---Command---Control,代码行数:46,代码来源:controller.py


示例17: run

def run():
    app = wx.App(False)

    app.path = os.path.dirname(sys.argv[0])

    from window.main import Main
    import prefs
    import worlds

    prefs.Initialize()
    worlds.Initialize()

    frame = Main(None, "wxpymoo")
    frame.Show(True)

    reactor.registerWxApp(app)
    reactor.run()


    app.MainLoop()
开发者ID:emersonrp,项目名称:wxpymoo,代码行数:20,代码来源:wxpymoo.py


示例18: run_main_view_wx

def run_main_view_wx(server, rpc_port, camera_port):
    """ Runs main UI view based on wx framework. """
    # imports
    import wx
    import socket
    # might be some cross platform (windows) issues reported with wxReactor
    from twisted.internet import wxreactor
    # add twisted / wx interaction support
    wxreactor.install()
    # add logging observer
    from twisted.python.log import PythonLoggingObserver
    observer = PythonLoggingObserver()
    observer.start()
    # add some extra logging (temp - merge later)
    #from sys import stdout
    #from twisted.python.log import startLogging, err
    #startLogging(stdout)

    # then can do normal reactor imports
    from twisted.internet import reactor
    from ui.main_view_wx import MainWindow

    # ip address *much* faster than by device name
    ipaddr = socket.gethostbyname(server)

    # create rpc client
    from web.webclient import RPCClient, RPCClientFactory
    rpc_client = RPCClient()
    
    # create wxApp and main window
    wxApp = wx.App(False)
    frame = MainWindow(None, "fishpi - Proof Of Concept Vehicle control", ipaddr, rpc_port, camera_port)
    frame.Show()
    
    # run reactor rather than usual 'wxApp.MainLoop()'
    reactor.registerWxApp(wxApp)
    logging.debug("RPC:\tconnecting to %s (%s) on port %s" % (server, ipaddr, rpc_port))
    reactor.connectTCP(ipaddr, rpc_port, RPCClientFactory(frame))
    #reactor.callLater(5, update_callback)
    reactor.run()
开发者ID:hasbiestheim,项目名称:FishPi-POCV---Command---Control,代码行数:40,代码来源:controller.py


示例19: uiDebug

        uiDebug( "serverManagerUi OnMenu_aboutMenuItem()")
        info = wx.AboutDialogInfo()
        info.Name = "xdIm"
        info.Version = "0.2.0"
        info.Copyright = "(C) 2008-2010 Programmers and Coders Everywhere"
        info.Description = wordwrap(
            "\n\nxdIm program is a software program \n\n",
            350, wx.ClientDC(self))
        info.WebSite = ("http://www.xdIm.org/", "xdIm home page")
        info.Developers = ["xd"]
        wx.AboutBox(info)
#!XRCED:end-block:xrcserverManagerFrame.OnMenu_aboutMenuItem        
        
          
if __name__ == '__main__':
#    app = wx.PySimpleApp()
#    frame = serverManager(None)
#    frame.Show()
#    app.MainLoop()
    
#    app = MyApp(0)
#    app.MainLoop()

    app = wx.App()
    server_twisted.frame = serverManager(None)
    server_twisted.frame.Show()
    reactor.registerWxApp(app)
    reactor.run()


        
开发者ID:xiaomdong,项目名称:xdIm,代码行数:28,代码来源:serverManager.py


示例20: init


#.........这里部分代码省略.........
        menu.AppendItem(item)
        return item

    class MyTaskBarIcon(wx.TaskBarIcon):

        def __init__(self, icons_path, current_icon_name=None):
            super(MyTaskBarIcon, self).__init__()
            self.icons_path = icons_path
            self.icons = {}
            self.popup_icons = {}
            for name, filename in icons_dict().items():
                self.icons[name] = wx.IconFromBitmap(wx.Bitmap(os.path.join(icons_path, filename)))
            for name, filename in popup_icons_dict().items():
                self.popup_icons[name] = wx.Bitmap(os.path.join(icons_path, filename))
            if len(self.icons) == 0:
                self.icons['default'] = ''
            if current_icon_name is not None and current_icon_name in self.icons.keys():
                self.current = current_icon_name
            else:
                self.current = self.icons.keys()[0]
            self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.on_left_down)
            self.select_icon(self.current)

        def CreatePopupMenu(self):
            menu = wx.Menu()
            create_menu_item(menu, 'open', self.on_show, self.popup_icons.get('open', None))
            create_menu_item(menu, 'synchronize', self.on_sync, self.popup_icons.get('sync', None))
            create_menu_item(menu, 'reconnect', self.on_reconnect, self.popup_icons.get('reconnect', None))
            create_menu_item(menu, 'restart', self.on_restart, self.popup_icons.get('restart', None))
            create_menu_item(menu, 'exit', self.on_exit, self.popup_icons.get('shutdown', None))
            self.menu = menu
            return menu

        def on_left_down(self, event):
            control('show')

        def on_show(self, event):
            control('show')

        def on_sync(self, event):
            control('sync')

        def on_hide(self, event):
            control('hide')

        def on_restart(self, event):
            control('restart')

        def on_exit(self, event):
            control('exit')

        def on_reconnect(self, event):
            control('reconnect')

        def on_toolbar(self, event):
            control('toolbar')

        def select_icon(self, icon_name):
            # print 'select_icon', icon_name, self.icons
            if icon_name in self.icons.keys():
                self.current = icon_name
                self.SetIcon(self.icons.get(self.current, self.icons.values()[0]), LABEL)

        def clear_icon(self):
            self.RemoveIcon()

    class MyApp(wx.App):

        def __init__(self, icons_path):
            self.icons_path = icons_path
            wx.App.__init__(self, False)

        def OnInit(self):
            self.trayicon = MyTaskBarIcon(self.icons_path)
            print 'OnInit'
            return True

        def OnExit(self):
            print 'OnExit'
            try:
                self.trayicon.Destroy()
            except:
                pass

        def SetIcon(self, name):
            # if self.trayicon.IsAvailable():
            print 'try'
            self.trayicon.select_icon(name)
            print 'ok'

        def Stop(self):
            self.trayicon.clear_icon()
            try:
                self.trayicon.Destroy()
            except:
                pass

    _IconObject = MyApp(icons_path)
    reactor.registerWxApp(_IconObject)
    reactor.addSystemEventTrigger('before', 'shutdown', main_porcess_stopped)
开发者ID:vesellov,项目名称:bitdust.devel,代码行数:101,代码来源:tray_icon.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python reactor.removeReader函数代码示例发布时间:2022-05-27
下一篇:
Python reactor.listenUNIX函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap