我正在使用设想的工作,我想在Handler中获得服务。
在_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" )
答案 0 :(得分:1)
我只是猜测,但是从documentation接缝开始,就像你必须首先注册一项服务一样。也许向我们展示更多代码,以便我们可以提供更好的帮助。
答案 1 :(得分:1)
类MyHandler(处理程序):
def __init__(self, application, **traits):
Handler.__init__(self, **traits)
self.application = application
...