当前位置: 首页>>代码示例>>Python>>正文


Python Model.saveTestMemoryFile方法代码示例

本文整理汇总了Python中model.Model.saveTestMemoryFile方法的典型用法代码示例。如果您正苦于以下问题:Python Model.saveTestMemoryFile方法的具体用法?Python Model.saveTestMemoryFile怎么用?Python Model.saveTestMemoryFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.Model的用法示例。


在下文中一共展示了Model.saveTestMemoryFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createTestWin

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import saveTestMemoryFile [as 别名]
 def createTestWin(self, item):
     TRACE('createTestWin')
     # Create a window with this resource
     node = view.tree.GetPyData(item)
     # Close old window, remember where it was
     comp = Manager.getNodeComp(node)
     # Create memory XML file
     elem = node.cloneNode(True)
     if not node.hasAttribute('name'):
         name = 'noname'
     else:
         name = node.getAttribute('name')
     elem.setAttribute('name', STD_NAME)
     Model.setTestElem(elem)
     Model.saveTestMemoryFile()
     xmlFlags = 0
     if not g.conf.useSubclassing:
         xmlFlags |= xrc.XRC_NO_SUBCLASSING
     # Use translations if encoding is not specified
     if not Model.dom.encoding:
         xmlFlags |= xrc.XRC_USE_LOCALE
     res = xrc.EmptyXmlResource(xmlFlags)
     xrc.XmlResource.Set(res)        # set as global
     # Init other handlers
     Manager.addXmlHandlers(res)
     Manager.preload(res)
     # Same module list
     res.Load('memory:test.xrc')
     object = None
     testWin = view.testWin
     try:
         try:
             frame, object = comp.makeTestWin(res, name)
             if not object:  # skip the rest
                 raise EOFError
             # Reset previous tree item and locate tool
             if testWin.item:
                 view.tree.SetItemBold(testWin.item, False)
             testWin.SetView(frame, object, item)
             testWin.Show()
             view.tree.SetItemBold(item, True)
         except EOFError:
             pass
         except NotImplementedError:
             wx.LogError('Test window not implemented for %s' % node.getAttribute('class'))
             logger.exception('error creating test view')
         except:
             logger.exception('error creating test view')
             wx.LogError('Error creating test view')
             if get_debug(): raise
     finally:
         # Cleanup
         res.Unload(TEST_FILE)
         xrc.XmlResource.Set(None)
         wx.MemoryFSHandler.RemoveFile(TEST_FILE)
开发者ID:blitzmann,项目名称:Pyfa-skel,代码行数:57,代码来源:presenter.py

示例2: createTestWin

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import saveTestMemoryFile [as 别名]
 def createTestWin(self, item):
     TRACE('createTestWin')
     # Create a window with this resource
     node = view.tree.GetPyData(item)
     # Execute "pragma" comment node
     if node.nodeType == node.COMMENT_NODE:
         if node.data and node.data[0] == '%' and g.conf.allowExec != 'no':
             say = wx.NO
             if g.conf.allowExec == 'ask' and Model.allowExec is None:
                 say = wx.MessageBox('Execute comment directive?', 'Warning', 
                                     wx.ICON_EXCLAMATION | wx.YES_NO)
             if g.conf.allowExec == 'yes' or say == wx.YES:
                 code = node.data[1:] # skip '%'
                 view.tree.ExecCode(code)
         return
     # Close old window, remember where it was
     comp = Manager.getNodeComp(node)
     # Create memory XML file
     elem = node.cloneNode(True)
     if not node.hasAttribute('name'):
         name = 'noname'
     else:
         name = node.getAttribute('name')
     elem.setAttribute('name', STD_NAME)
     Model.setTestElem(elem)
     Model.saveTestMemoryFile()
     xmlFlags = 0
     if not g.conf.useSubclassing:
         xmlFlags |= xrc.XRC_NO_SUBCLASSING
     # Use translations if encoding is not specified
     if not Model.dom.encoding:
         xmlFlags |= xrc.XRC_USE_LOCALE
     res = xrc.EmptyXmlResource(xmlFlags)
     xrc.XmlResource.Set(res)        # set as global
     # Init other handlers
     Manager.addXmlHandlers(res)
     Manager.preload(res)
     # Same module list
     res.Load('memory:test.xrc')
     object = None
     testWin = view.testWin
     try:
         try:
             frame, object = comp.makeTestWin(res, name)
             if not object:  # skip the rest
                 raise EOFError
             # Reset previous tree item and locate tool
             if testWin.item:
                 view.tree.SetItemBold(testWin.item, False)
             testWin.SetView(frame, object, item)
             testWin.Show()
             view.tree.SetItemBold(item, True)
         except EOFError:
             pass
         except NotImplementedError:
             wx.LogError('Test window not implemented for %s' % node.getAttribute('class'))
             logger.exception('error creating test view')
         except:
             logger.exception('error creating test view')
             wx.LogError('Error creating test view')
             if get_debug(): raise
     finally:
         # Cleanup
         res.Unload(TEST_FILE)
         xrc.XmlResource.Set(None)
         wx.MemoryFSHandler.RemoveFile(TEST_FILE)
开发者ID:Bottersnike,项目名称:Everbot,代码行数:68,代码来源:presenter.py

示例3: createTestWin

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import saveTestMemoryFile [as 别名]
 def createTestWin(self, item):
     TRACE("createTestWin")
     # Create a window with this resource
     node = view.tree.GetPyData(item)
     # Execute "pragma" comment node
     if node.nodeType == node.COMMENT_NODE:
         if node.data and node.data[0] == "%" and g.conf.allowExec != "no":
             say = wx.NO
             if g.conf.allowExec == "ask" and Model.allowExec is None:
                 say = wx.MessageBox("Execute comment directive?", "Warning", wx.ICON_EXCLAMATION | wx.YES_NO)
             if g.conf.allowExec == "yes" or say == wx.YES:
                 code = node.data[1:]  # skip '%'
                 view.tree.ExecCode(code)
         return
     # Close old window, remember where it was
     comp = Manager.getNodeComp(node)
     # Use parent object if the current one does not support test view
     testWinItem = item
     while not comp.isTestable:
         testWinItem = view.tree.GetItemParent(testWinItem)
         node = view.tree.GetPyData(testWinItem)
         comp = Manager.getNodeComp(node)
     # Create memory XML file
     elem = node.cloneNode(True)
     if not node.hasAttribute("name"):
         name = "noname"
     else:
         name = node.getAttribute("name")
     elem.setAttribute("name", STD_NAME)
     Model.setTestElem(elem)
     Model.saveTestMemoryFile()
     xmlFlags = 0
     if not g.conf.useSubclassing:
         xmlFlags |= xrc.XRC_NO_SUBCLASSING
     # Use translations if encoding is not specified
     if not Model.dom.encoding:
         xmlFlags |= xrc.XRC_USE_LOCALE
     res = xrc.EmptyXmlResource(xmlFlags)
     xrc.XmlResource.Set(res)  # set as global
     # Init other handlers
     Manager.addXmlHandlers(res)
     Manager.preload(res)
     # Same module list
     res.Load("memory:test.xrc")
     testWin = view.testWin
     try:
         try:
             frame, object = comp.makeTestWin(res, name)
             if not object:  # skip the rest
                 raise EOFError
             # Reset previous tree item and locate tool
             if testWin.item:
                 view.tree.SetItemBold(testWin.item, False)
             testWin.SetView(frame, object, testWinItem)
             testWin.Show()
             view.tree.SetItemBold(testWinItem, True)
             # For reused frame, object is not positioned immediately
             wx.CallAfter(self.highlight, item)
         except EOFError:
             pass
         except TestWinError:
             wx.LogError("Test window could not be created for %s" % node.getAttribute("class"))
             logger.exception("error creating test view")
         except:
             wx.LogError("Error creating test view")
             logger.exception("error creating test view")
             if get_debug():
                 raise
     finally:
         # Cleanup
         res.Unload(TEST_FILE)
         xrc.XmlResource.Set(None)
         wx.MemoryFSHandler.RemoveFile(TEST_FILE)
开发者ID:czxxjtu,项目名称:wxPython,代码行数:75,代码来源:presenter.py


注:本文中的model.Model.saveTestMemoryFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。