示例#1
0
文件: Module.py 项目: melviso/beatle
 def _import(self, name, root=True):
     """Get the import (if possible)"""
     sections = name.split('.')
     if not len(sections):
         return None
     base = sections[0]
     del sections[0]
     base = self._local_import(base) or self._global_import(base)
     if base is None:
         #this import is external
         return import_dir(name)
     for _next in sections:
         base = base._local_import(_next)
         if base is None:
             return None
     return base
示例#2
0
 def OnFromChange(self, event):
     """from change method"""
     _from = self.m_textCtrl821.GetValue()
     # attempt to do the import and fill the combo
     self.m_comboBox12.Clear()
     m = self._container.inner_module
     if m is not None:
         module_dir = m.dir
     else:
         module_dir = None
     project_dir = self._container.project.dir
     s = import_dir(_from, module_dir, project_dir)
     if s:
         # avoid hidden symbols
         self._items = [x for x in s if x[0] != '_']
         self._items.sort()
         self.m_comboBox12.AppendItems(self._items)
     else:
         self._items = []