本文整理汇总了Python中pynebula.lookup函数的典型用法代码示例。如果您正苦于以下问题:Python lookup函数的具体用法?Python lookup怎么用?Python lookup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lookup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, infoPanel, shdPanel):
wx.Panel.__init__(self, parent, size = (800, 600))
nebula.lookup('/sys/env/parent_hwnd').seti(self.GetHandle())
self.infoPanel = infoPanel
self.shdPanel = shdPanel
self.infoPopup = None
self.waiting = False
开发者ID:Teivaz,项目名称:nebula2,代码行数:7,代码来源:shdctrls.py
示例2: __on_change_type
def __on_change_type(self, event):
if self.transition_path != None and not self.skip_change_type_event:
# Remove transition from state
transition = self.__get_transition()
state = self.__get_state()
state.removetransition( transition )
# Get free conditions for the selected transition type
state_path = fsm.get_state_of_transition( self.transition_path )
conds_paths = get_free_conditions( event.GetSelection(), state_path )
# Delete condition if it's an event condition with filter
cond_path = fsm.get_filteredcondition_of_transition( self.transition_path )
try:
pynebula.lookup( cond_path )
pynebula.delete( cond_path )
except:
pass
# Set first free condition for the selected transition type
transition.setcondition( pynebula.lookup(conds_paths[0]) )
# Add transition to state
state.addtransition( transition )
# Refresh condition parameters panel
if self.GetSelection() == 0:
self.panel_event.set_transition( self.transition_path )
else:
self.panel_script.set_transition( self.transition_path )
# Signal change
fsmevents.signal_fsm_change( self, self.transition_path )
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:27,代码来源:fsmtransitiontype.py
示例3: __on_delete_state
def __on_delete_state(self, event):
"""Ask to confirm the state deletion and delete it if so"""
state_name = self.list_states.GetStringSelection()
if state_name != "":
msg = "Deleting a state cannot be undone.\n"
msg = msg + "Are you sure that you want to delete the "
msg = msg + "'" + state_name + "' state?"
result = cjr.warn_yes_no(self, msg)
if result == wx.ID_YES:
# Delete all transition targets pointing to the state to be deleted
state = self.__get_current_state()
fsm_ = fsm.get_fsm_of_state( state.getfullname() )
states = fsm.get_states( fsm_ )
for s in states:
transitions = fsm.get_transitions(s)
for t in transitions:
t_obj = pynebula.lookup(t)
t_obj.removetarget(state)
# Delete the transition if it's emmpty after deleting the target
if t_obj.gettargetsnumber() == 0:
s_obj = pynebula.lookup(s)
s_obj.deletetransition(t_obj)
t_obj = None
# Delete the state
self.__get_fsm().deletestate( state )
state = None
self.list_states.Delete( self.list_states.GetSelection() )
self.__on_select_state(None)
fsmevents.signal_fsm_change(self)
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:30,代码来源:fsmstates.py
示例4: get_free_event_conditions
def get_free_event_conditions(state, allowed_condition=None):
"""
Return a paths list of those event conditions which the given state doesn't
already have a transition for.
\param state State (path) to gather the free event conditions for
\param allowed_condition Condition (path) allowed as a free condition, even if it's already taken
\return List of event conditions paths not found in any transition of the given state
"""
allowed_event = None
if allowed_condition != None:
cond = pynebula.lookup( allowed_condition )
if cond.isa('neventcondition'):
allowed_event = cond.getevent()
conds_paths = fsm.get_event_conditions()
## conds_paths = []
## cond = pynebula.lookup( fsm.get_event_conditions_lib() ).gethead()
## while cond is not None:
## if cond.getname().startswith( "event" ):
## conds_paths.append( cond.getfullname() )
## cond = cond.getsucc()
trans_paths = fsm.get_transitions( state )
for trans_path in trans_paths:
trans_obj = pynebula.lookup( trans_path )
cond_obj = trans_obj.getcondition()
if cond_obj.isa('neventcondition'):
if cond_obj.getevent() != allowed_event:
cond_path = get_event_condition( cond_obj.getevent() )
## if cond_path == fsm.get_filteredcondition_of_transition( trans_path ):
## conds_paths.remove( get_event_condition( cond_obj.getevent() ) )
## else:
conds_paths.remove( cond_path )
return conds_paths
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:33,代码来源:fsmtransitiontype.py
示例5: on_duplicate
def on_duplicate(self, event):
"""Ask for a name and clone the selected object it if it's a non existing name"""
source_name = self.list.GetStringSelection()
if source_name != "":
dlg = wx.TextEntryDialog(
None,
"Enter the " + self.caption + "'s name:",
"Duplicate " + self.caption,
source_name
)
if dlg.ShowModal() == wx.ID_OK:
# Clone the object only if there isn't another object with the same name yet
target_name = dlg.GetValue()
target_path = format.append_to_path( self.lib_path, target_name )
try:
# Lookup will fail if it's a new name (name not found)
pynebula.lookup( target_path )
msg = "Another " + self.caption + " named '" + dlg.GetValue() + "' already exists."
cjr.show_error_message(msg)
except:
# Clone object, save it to disk and add it to list
source_path = format.append_to_path( self.lib_path, source_name )
source_obj = pynebula.lookup( source_path )
target_obj = source_obj.clone( str(target_path) )
self.save_object( target_obj )
self.list.Append( target_name )
dlg.Destroy()
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:27,代码来源:fsmlibs.py
示例6: __on_select_script
def __on_select_script(self, event):
transition = pynebula.lookup( self.transition_path )
state_path = fsm.get_state_of_transition( self.transition_path )
state = pynebula.lookup( state_path )
state.removetransition( transition )
condition = servers.get_fsm_server().getscriptcondition(
str(self.choice_script.GetStringSelection()) )
transition.setcondition( condition )
state.addtransition( transition )
fsmevents.signal_fsm_change( self, self.transition_path )
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:10,代码来源:fsmtransitiontype.py
示例7: on_change_type
def on_change_type(self, event):
# replace old action with a new one for the new action type
if self.action_path != None and not self.skip_change_type_event:
state_path = fsm.get_state_of_behaction( self.action_path )
state = pynebula.lookup( state_path )
action = pynebula.lookup( str(self.action_path) )
## action_panel = self.GetPage( event.GetSelection() )
## action.setactiontype( action_panel.action_id )
## action_panel.update_action( action )
action.setactionclass( str( self.choice.GetStringSelection() ) )
self.__update_propgrid()
fsmevents.signal_fsm_change( self )
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:12,代码来源:fsmaction.py
示例8: __on_change_type
def __on_change_type(self, event):
if self.state_path != None and not self.skip_change_type_event:
# Rename the old state to keep it while building the new one
old_state = self.__get_state()
old_state.setname("_tmp")
# Create new state for the new state type
if self.GetSelection() == self.ID_NodeStatePanel:
new_state = create_default_state(self.state_path, "nnodestate")
elif self.GetSelection() == self.ID_LeafStatePanel:
new_state = create_default_state(self.state_path, "nleafstate")
else:
new_state = create_default_state(self.state_path, "nendstate")
if new_state == None:
# If creating a default state fails abort and restore old state
old_state.setname(str(format.get_name(self.state_path)))
self.skip_change_type_event = True
self.SetSelection(event.GetOldSelection())
self.skip_change_type_event = False
return
fsm_ = self.__get_fsm()
fsm_.addstate(new_state)
# Copy info that's independent of the state type
old_trans_path = fsm.get_transitions_dir_of_state(old_state.getfullname())
new_trans_path = fsm.get_transitions_dir_of_state(new_state.getfullname(), False)
pynebula.lookup(str(old_trans_path)).clone(str(new_trans_path))
transitions = fsm.get_transitions(new_state.getfullname())
for t in transitions:
t_obj = pynebula.lookup(t)
new_state.addtransition(t_obj)
if fsm_.getinitialstate() == old_state:
fsm_.setinitialstate(new_state)
# Update all transitions to point to the new state if pointing the old one
states = fsm.get_states(fsm_.getfullname())
for s in states:
transitions = fsm.get_transitions(s)
for t in transitions:
t_obj = pynebula.lookup(t)
for i in range(t_obj.gettargetsnumber()):
if t_obj.gettargetstatebyindex(i) == old_state:
t_obj.settargetstatebyindex(i, new_state)
# Delete old state
fsm_.deletestate(old_state)
old_state = None # Python, release that #$%&/)?! reference NOW!
# Update type specific controls
self.__update_controls()
# Signal change
fsmevents.signal_fsm_change(self, self.state_path)
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:53,代码来源:fsmstatetype.py
示例9: validate_fsm_name
def validate_fsm_name(name):
path = format.append_to_path( fsm.get_fsms_lib(), name )
try:
# Lookup will fail if it's a new name (name not found)
pynebula.lookup( path )
msg = "Another finite state machine called '%s' already exists." % name
cjr.show_error_message(msg)
return False
except:
msg = "Renaming this FSM will invalidate any references to it that " \
"any agent has.\nAre you sure that you want to rename it?"
result = cjr.confirm_yes_no(None, msg)
return result == wx.ID_YES
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:13,代码来源:fsmeditpanel.py
示例10: get_free_name
def get_free_name(dir_path, prefix):
"""
Get a free name for an object to be placed in the given path and begining with the given prefix.
Names are got by appending an index to the prefix.
"""
i = 0
while True:
obj_path = get_path( dir_path, prefix, str(i) )
try:
pynebula.lookup( obj_path )
i = i + 1
except:
return obj_path
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:14,代码来源:fsm.py
示例11: __copy
def __copy(source_dir, target_dir):
"""Copy all objects from a directory to another directory (not recursive)"""
obj = pynebula.lookup( source_dir ).gethead()
while obj != None:
path = format.append_to_path( target_dir, obj.getname() )
obj.clone( path )
obj = obj.getsucc()
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:7,代码来源:fsm.py
示例12: __get_object
def __get_object(self):
"""
Return a reference to the object for my object id.
If no object is found None will be returned.
For objects in NOH use absolute paths as their object id,
for entities use the id given by the entity server.
"""
if self.object_id is None:
return None
if isinstance(self.object_id, int):
# integer -> nEntity -> Get object from entity server
return self.__get_entity_object_with_id(
self.object_id
)
elif self.object_id.startswith('/'):
# NOH path -> nRoot -> Get object from NOH
try:
return pynebula.lookup( self.object_id )
except:
return None
else:
# name -> nEntity -> Get object from entity server
entity_id = app.get_level().findentity( self.object_id )
if entity_id == 0:
return None
else:
return self.__get_entity_object_with_id(
entity_id
)
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:30,代码来源:objdlg.py
示例13: CreateClass
def CreateClass( name, libraryPath, textureName = 'home:export/textures/materials/rauch.dds' ):
name = name.capitalize() # valid name for a class
entityServer = servers.get_entity_class_server()
neBrushClass = entityServer.getentityclass( 'nebrush' )
if not entityServer.checkclassname(name):
wx.MessageBox("\"%s\" is invalid name for a class" %(name), "Conjurer", wx.ICON_ERROR)
return None
if None != entityServer.getentityclass( name ):
wx.MessageBox("the class \"%s\" already exists" %(name), "Conjurer", wx.ICON_ERROR)
return None
particleNode, assetPath = CreateAsset( name , textureName )
if particleNode == None:
return None
newClass = entityServer.newentityclass( neBrushClass, name )
newClass.setasseteditable(True)
newClass.setresourcefile( assetPath )
newClass.setbbox( 0.0, 0.5 , 0.0, 0.500000, 0.5, 0.500000)
library = pynebula.lookup( libraryPath )
library.appendstring( name )
# Mark the library as dirty
app.get_libraries().setobjectdirty( True )
return particleNode
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:28,代码来源:particle.py
示例14: get_layer_manager
def get_layer_manager():
try:
return pynebula.lookup(
'/usr/terrain/geomipmap/layermanager'
)
except:
return None
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:7,代码来源:trn.py
示例15: get_event_condition
def get_event_condition(event):
cond = pynebula.lookup( fsm.get_event_conditions_lib() ).gethead()
while cond is not None:
if cond.getevent() == event:
return cond.getfullname()
cond = cond.getsucc()
raise "Error: shared event " + str(event) + " not found"
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:7,代码来源:fsmtransitiontype.py
示例16: __safe_new
def __safe_new(path, type='nroot'):
"""Create an object if it doesn't exist yet"""
try:
return pynebula.lookup(path)
except:
obj = pynebula.new(type, path)
return obj
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:7,代码来源:triggerlib.py
示例17: get_states
def get_states(fsm_path):
"""Return a sequence with all the states paths of the given fsm"""
paths = []
state = pynebula.lookup( fsm_path ).gethead()
while state != None:
paths.append( state.getfullname() )
state = state.getsucc()
return paths
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:8,代码来源:fsm.py
示例18: get_fsms
def get_fsms():
"""Return a sequence with all the FSM paths"""
paths = []
fsm = pynebula.lookup( get_fsms_lib() ).gethead()
while fsm != None:
paths.append( fsm.getfullname() )
fsm = fsm.getsucc()
return paths
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:8,代码来源:fsm.py
示例19: ontranslateobject
def ontranslateobject(self):
# Set label names
self.__init_labels( toolscmds.ID_TranslateObjTool,
["Start:", "End:", "Distance:"] )
# Set new info values
tool = pynebula.lookup( self.tool_paths[toolscmds.ID_TranslateObjTool] )
self.__set_common_values(tool)
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:8,代码来源:infodlg.py
示例20: on_new
def on_new(self, event):
"""Ask for a name and create a new object it if it's a non existing name"""
dlg = wx.TextEntryDialog( None, "Enter the " + self.caption + "'s name:", "New " + self.caption )
if dlg.ShowModal() == wx.ID_OK:
# Add the object only if there isn't another object with the same name yet
obj_path = format.append_to_path( self.lib_path, dlg.GetValue() )
try:
# Lookup will fail if it's a new name (name not found)
pynebula.lookup( obj_path )
msg = "Another " + self.caption + " named '" + dlg.GetValue() + "' already exists."
cjr.show_error_message(msg)
except:
# Create object, save it to disk and add it to list
obj = pynebula.new( str(self.class_name), str(obj_path) )
self.save_object( obj )
self.list.Append( dlg.GetValue() )
dlg.Destroy()
开发者ID:xuebai5,项目名称:TheZombieEngine,代码行数:17,代码来源:fsmlibs.py
注:本文中的pynebula.lookup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论