0

我正在使用设想工作,我想在处理程序中获得服务。在_tcp_send_changed功能中我如何获得服务。在插件中有self.application.get_service(....)但是在这里我怎样才能找到它们?


更新

这是我的看法

class MCLidarGUIView( HasTraits ):         
    traits_ui_view = View( 
        VGroup( 
            HGroup( 
                Item( 'lidar_list',
                    show_label = False,
                    editor = TabularEditor( 
                        show_titles = False,
                        selected = 'selected',
                        editable = False,
                        multi_select = True,
                        adapter = LidarAdapter()                    
                    ),
                ),
            ),
            Item( 
                 "lidars_command"
            ),
            HGroup( 
                   Item( 'handler.tcp_send',
                        show_label = False,
                        editor = ButtonEditor( label = "TCP:Send" )                        
                ),
            )
        ),

        id = 'forwind.lidarapi.giuview',
        resizable = True,
        handler = MCLidarActions()

    )    

    lidar_list = [LidarObject( lidar_name = "No Connected Lidar" )]
    lidars_command = '' 

这是我的处理程序:

class MCLidarActions( Handler ):

    tcp_send = Event 

    def object__updated_changed( self, info ):
        print info;
        pass;   

    def _tcp_send_changed( self ):
        print( " info" ) 
4

2 回答 2

1

我只是在猜测,但从文档看来,您必须先注册一项服务。也许向我们展示更多代码,以便我们提供更好的帮助。

于 2011-09-19T13:40:08.537 回答
1

类 MyHandler(处理程序):

def __init__(self, application, **traits):
     Handler.__init__(self, **traits)
     self.application = application

...

于 2011-09-20T14:53:57.663 回答