本文整理汇总了Python中suit.cf.BaseModeLogic._setSheet方法的典型用法代码示例。如果您正苦于以下问题:Python BaseModeLogic._setSheet方法的具体用法?Python BaseModeLogic._setSheet怎么用?Python BaseModeLogic._setSheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类suit.cf.BaseModeLogic
的用法示例。
在下文中一共展示了BaseModeLogic._setSheet方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
"""Sets sheet for a logic
"""
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
_sheet.eventUpdate = self._onUpdate
# getting data from content and save to temporary file
import os
import suit.core.sc_utils as sc_utils
_addr = _sheet._getScAddr()
if _addr is None: return
kernel = Kernel.getSingleton()
session = kernel.session()
fmt = sc_utils.getContentFormat(session, _addr)
assert fmt is not None
file_name = "%s.%s" %(str(_addr.this), session.get_idtf(fmt).lower())
# saving data to file
_cont = session.get_content_const(_addr)
assert _cont is not None
_cont_data = _cont.convertToCont()
data = _cont.get_data(_cont_data.d.size)
path = os.path.join(kernel.cache_path, 'video')
out_file = os.path.join(path, file_name)
file(out_file, "wb").write(data)
ogre.ResourceGroupManager.getSingleton().initialiseResourceGroup("video")
self.setVideo(file_name)
示例2: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRoot
_sheet.eventContentUpdate = self._onContentUpdate
# trying to get data for showing
import suit.core.sc_utils as sc_utils
session = core.Kernel.session()
_addr = _sheet._getScAddr()
_fmt = sc_utils.getContentFormat(session, _addr)
assert _fmt is not None
_cont = session.get_content_const(_addr)
assert _cont is not None
_cont_data = _cont.convertToCont()
self.file_addr = _cont_data
_type = session.get_idtf(_fmt).lower()
global count
count += 1
# import os, pm.pm
# self.imageName = os.path.join(env.res_tmp_dir, "%s.jpg" % str(_addr.this))
# pm.pm.saveContentToFile(self.imageName + "%d.jpg" % count, _cont)
# file(self.imageName + "_", "wb").write(_cont.get_data(_cont_data.d.size))
"""data = _cont.get_data(_cont_data.d.size)
示例3: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
_sheet.eventContentUpdate = self._onContentUpdate
import suit.core.layout.LayoutGroupForceDirected as layout
_sheet.setLayoutGroup(layout.LayoutGroupForceSimple())
示例4: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
"""Sets sheet that controls by this logic
"""
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventContentUpdate = self._onContentUpdate
self.createTextureAndMaterialNames()
示例5: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
_sheet.eventUpdate = self._onUpdate
_sheet.eventObjectUnderMouse = self._getObjectsUnderMouse
_sheet.eventContentUpdate = self._onContentUpdate
_sheet.eventHaveChild = self._haveChild
示例6: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRoot
self._createFieldFromContent()
self._createMaterial()
self.rect.setMaterial(self.getMaterialName())
self._redraw()
示例7: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
# process event to viewer
self._viewer._setSheet(_sheet)
BaseModeLogic._setSheet(self, _sheet)
#subscribe events
_sheet.eventRootChanged = self._onRootChanged
_sheet.eventUpdate = self._onUpdate
示例8: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
"""Notification on sheet changed
@param _sheet: new sheet controlled by logic
@type _sheet: objects.ObjectSheet
"""
self._viewer._setSheet(_sheet)
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
示例9: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
_sheet.eventUpdate = self._onUpdate
# go to 3d mode
#_sheet.changeMode(render_engine.Mode_Perspective)
import suit.core.layout.LayoutGroupForceDirected as layout
_sheet.setLayoutGroup(layout.LayoutGroupForceSimple(_gravity = 0.1,
_repulsion = 3.5,
_length = 2.0,
_rigidity = 10.0,
_step_max = 0.05,
_step_min = 0.001))
示例10: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
"""Notification about sheet changed for logic
@param _sheet: sheet object logic sets to
@type _sheet: ObjectSheet
@attention: this method only for internal usage and calls by
ObhectSheet automatically when you set logic for it
"""
self.__viewer._setSheet(_sheet)
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventUpdateView = self._onUpdateView
_sheet.eventUpdate = self._onUpdate
_sheet.eventRootChanged = self._onRootChanged
_sheet.eventSelectionChanged = self._modes[ois.KC_E]._handlerSelChanged
示例11: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRoot
# trying to get data for showing
import suit.core.sc_utils as sc_utils
session = core.Kernel.session()
_addr = _sheet._getScAddr()
_fmt = sc_utils.getContentFormat(session, _addr)
assert _fmt is not None
_cont = session.get_content_const(_addr)
assert _cont is not None
_cont_data = _cont.convertToCont()
_type = session.get_idtf(_fmt).lower()
global count
count += 1
# import os, pm.pm
# self.imageName = os.path.join(env.res_tmp_dir, "%s.jpg" % str(_addr.this))
# pm.pm.saveContentToFile(self.imageName + "%d.jpg" % count, _cont)
# file(self.imageName + "_", "wb").write(_cont.get_data(_cont_data.d.size))
data = _cont.get_data(_cont_data.d.size)
stream = ogre.MemoryDataStream("%s" % str(self), _cont_data.d.size, False)
stream.setData(data)
#
try:
img = ogre.Image()
img.load(stream, ogre.Image.getFileExtFromMagic(stream))
self._createTexture(img)
self._createMaterial()
self._resizeRect()
except:
import sys, traceback
print "Error:", sys.exc_info()[0]
traceback.print_exc(file=sys.stdout)
示例12: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
"""Sets sheet for a logic
"""
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
示例13: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
"""Sets sheet that controls by this logic
"""
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventContentUpdate = self._onContentUpdate
示例14: _setSheet
# 需要导入模块: from suit.cf import BaseModeLogic [as 别名]
# 或者: from suit.cf.BaseModeLogic import _setSheet [as 别名]
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged