本文整理汇总了Python中EventDispatcher.EventDispatcher.clear方法的典型用法代码示例。如果您正苦于以下问题:Python EventDispatcher.clear方法的具体用法?Python EventDispatcher.clear怎么用?Python EventDispatcher.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventDispatcher.EventDispatcher
的用法示例。
在下文中一共展示了EventDispatcher.clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from EventDispatcher import EventDispatcher [as 别名]
# 或者: from EventDispatcher.EventDispatcher import clear [as 别名]
class Device:
def __init__(self):
self.model = loader.loadModel('Ipod.egg')
self.model.reparentTo(render)
self.base = self.model.find("**/Cubierta")
self.base.reparentTo(render)
#self.base.setHpr(0, 0, 0)
#base.camera.setPos(0, -5, 0)
self.events = EventDispatcher(self, "Ipod Shuffle")
alight = AmbientLight('alight')
alight.setColor(VBase4(1, 1, 1, 1))
alnp = render.attachNewNode(alight)
render.setLight(alnp)
self.apps = {}
self.apps["Reproductor de Audio"] = MusicApp(self)
self.launch("Reproductor de Audio")
def run(self):
print "I'm in a race and I'm winning"
run()
def get_model(self):
return self.model
def get_base(self):
return self.base
def launch(self, app_name):
if app_name in self.apps:
self.events.clear()
self.apps[app_name].activate(self.events)
else:
print "unknown command: " + app_name
示例2: Device
# 需要导入模块: from EventDispatcher import EventDispatcher [as 别名]
# 或者: from EventDispatcher.EventDispatcher import clear [as 别名]
#.........这里部分代码省略.........
def list_lost_calls(self, arg = None):
manager = GestorRegistros()
self.list_app.set_options(manager.get_logs_by_state("PERDIDA"))
return self.list_app
def list_answered_calls(self, arg = None):
manager = GestorRegistros()
self.list_app.set_options(manager.get_logs_by_state("RECIBIDA"))
return self.list_app
def list_done_calls(self, arg = None):
manager = GestorRegistros()
self.list_app.set_options(manager.get_logs_by_state("REALIZADA"))
return self.list_app
def dial_contact(self, arg = None):
cntct = self.list_app.get_selected_option()[2]
self.dial_app.write_number(cntct[1])
return self.dial_app
def list_contacts(self, arg = None):
manager = GestorContactos()
self.list_app.set_options(manager.get_contactos())
return self.list_app
def display_dial_screen(self, arg = None):
self.dial_app.write_number(self.apps["init"].get_number())
return self.dial_app
def display_list(self, option):
temp_list = OptionManager.get_option_subtree(option)
self.list_app.set_options(temp_list)
return self.list_app
def list_albums(self, arg = None):
manager = GestorMusica()
temp_list = manager.get_albums()
self.list_app.set_options(temp_list)
return self.list_app
def list_artists(self, arg = None):
manager = GestorMusica()
temp_list = manager.get_artists()
self.list_app.set_options(temp_list)
return self.list_app
def play(self, arg = None):
args = self.list_app.get_selected_option()
print "args:" + str(args)
if args:
print args
manager = GestorMusica()
temp_list = None
if args[2] == "all":
temp_list = manager.get_tracks()
if args[2] == "artist":
temp_list = manager.get_tracks_by_artist(args[0])
if args[2] == "album":
temp_list = manager.get_tracks_by_album(args[0])
if temp_list:
self.music_app.set_track_list(temp_list)
print "Music loading succesfull"
return self.music_app
return None
def run(self):
self.base.run()
def get_model(self):
return self.model
def get_base(self):
return self.base
def get_screen(self):
return self.screen
def repaint(self):
self.screen.getTexture().reload()
def launch(self, app_name):
if app_name in self.apps:
self.events.clear()
self.screen.setTexture(loader.loadTexture(
OptionManager.get_texture_filename()), 1)
if "instancemethod" in str(type(self.apps[app_name])):
app = self.apps[app_name](app_name)
if app:
app.renderer.set_title(app_name)
app.activate(self.events)
else:
print "Launching " + app_name
self.apps[app_name].activate(self.events)
self.repaint()
else:
print "unknown command: " + app_name