Esempio n. 1
0
    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)
Esempio n. 2
0
 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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    def getFormatIcon(self, _format):
        """Return icon associated with specified format
        @param _format: sc-node that designate format
        @type _format: sc_addr
        
        @return: Name of texture that contains icon associated to _format, if there are no any
                icons, then return None
        """
        import suit.core.sc_utils as sc_utils
        import sc_core.constants as sc_constants
        import sc_core.pm as sc
        import ogre.renderer.OGRE as ogre

        session = core.Kernel.session()

        icon = None
        idtf_set = sc_utils.searchOneShotBinPairAttrToNode(
            session, _format, keynodes.common.nrel_identification, sc.SC_CONST
        )
        if idtf_set is not None:

            it1 = session.create_iterator(
                session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a, idtf_set, sc.SC_A_CONST, sc.SC_N_CONST), True
            )
            while not it1.is_over():
                if sc_utils.checkIncToSets(session, it1.value(2), [keynodes.common.group_image], sc.SC_CONST):
                    icon = it1.value(2)
                    break
                it1.next()

            if icon is None:
                return None

            _fmt = sc_utils.getContentFormat(session, icon)
            assert _fmt is not None

            _cont = session.get_content_const(icon)
            assert _cont is not None

            _cont_data = _cont.convertToCont()

            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))
            except:
                import sys, traceback

                print "Error:", sys.exc_info()[0]
                traceback.print_exc(file=sys.stdout)

            icon_name = "icon_%s" % str(_format)
            ogre.TextureManager.getSingleton().loadImage(icon_name, "General", img)
            return icon_name

        return None
Esempio n. 5
0
def build_node(_session, _el, _type):
    """Builds SCgNode based on sc-element
    """
    
    # check if it isn't content node
    _cnt_type = sc_utils.getContentFormat(_session, _el)
    
    
    if _cnt_type is not None:
        obj = objects.ObjectSheet()
        obj.hideContent()
        obj._setScAddr(_el)
        
        # creating viewer
        try:
            logic = core.Kernel.getSingleton().createViewer(_cnt_type)
            obj.setLogic(logic)
        except exceptions.UnsupportedFormatError:
            core.Kernel.getSingleton().logManager.logWarning("Format %s not supported for viewing" % (_session.get_idtf(_cnt_type)))
        
        return obj
    else:
        type_name = "node/const/elem"
        
        # creating type name based on element type    
        _const = getConstStr(_type)
                
        _stype = "elem"
        if sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_sheaf], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "sheaf"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_ext_obj_abstract], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "abstract"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_bin_orient_norole_rel], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "binary"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_ext_obj_real], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "real"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_bin_orient_role_rel], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "role"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_struct], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "struct"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_concept_norel], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "term"
        
        if _const is not None:
            type_name = "node/%s/%s" % (_const, _stype)
        else:
            type_name = "node/elem"
        
        obj = scg_alphabet.createSCgNode(type_name)
        obj._setScAddr(_el)
        return obj
    
    return None
Esempio n. 6
0
def build_node(_session, _el, _type):
    """Builds SCgNode based on sc-element
    """
    
    # check if it isn't content node
    _cnt_type = sc_utils.getContentFormat(_session, _el)
    
    
    if _cnt_type is not None:
        obj = objects.ObjectSheet()
        obj.hideContent()
        obj._setScAddr(_el)
        
        # creating viewer
        try:
            logic = core.Kernel.getSingleton().createViewer(_cnt_type)
            obj.setLogic(logic)
        except exceptions.UnsupportedFormatError:
            core.Kernel.getSingleton().logManager.logWarning("Format %s not supported for viewing" % (_session.get_idtf(_cnt_type)))
        
        return obj
    else:
        type_name = "node/const/elem"
        
        # creating type name based on element type    
        _const = getConstStr(_type)
                
        _stype = "elem"
        if sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_sheaf], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "sheaf"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_ext_obj_abstract], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "abstract"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_bin_orient_norole_rel], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "binary"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_ext_obj_real], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "real"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_bin_orient_role_rel], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "role"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_struct], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "struct"
        elif sc_utils.checkIncToSets(_session, _el, [keynodes.info.stype_concept_norel], sc.SC_A_CONST | sc.SC_POS | sc.SC_PERMANENT):
            _stype = "term"
        
        if _const is not None:
            type_name = "node/%s/%s" % (_const, _stype)
        else:
            type_name = "node/elem"
        
        obj = scg_alphabet.createSCgNode(type_name)
        obj._setScAddr(_el)
        return obj
    
    return None
Esempio n. 7
0
    def getContent(self):
        import suit.core.sc_utils as sc_utils
        import suit.core.keynodes as keynodes
        session = core.Kernel.session()
        _addr = self._getSheet()._getScAddr()
        if _addr is not None:
            fmt = sc_utils.getContentFormat(session, _addr)

            if fmt.this == keynodes.ui.format_string.this or fmt.this == keynodes.ui.format_term.this:
                value = session.get_content_str(_addr)
            elif fmt.this == keynodes.ui.format_int.this or fmt.this == keynodes.ui.format_real.this:
                value = str(session.get_content_real(_addr))

            return value

        return None
Esempio n. 8
0
def translate_node(_session, _el, _type):
    """Translate sc-node into SCs
    """

    # Check have node content or not
    _cnt_type = sc_utils.getContentFormat(_session, _el)

    if _cnt_type is not None:
        # I don't find any info about view content of nodes in scs
        pass
    else:
        _const = getConstStr(_type)
        if _const == "var":
            return "$_%s" % (sc_utils.getLocalizedIdentifier(_session, _el))
        elif _const == "meta":
            return "$__%s" % (sc_utils.getLocalizedIdentifier(_session, _el))
        return "$%s" % (sc_utils.getLocalizedIdentifier(_session, _el))
Esempio n. 9
0
    def getContent(self):        
        import suit.core.sc_utils as sc_utils
        import suit.core.keynodes as keynodes
        session = core.Kernel.session()
        _addr = self._getSheet()._getScAddr()
        if _addr is not None:
            fmt = sc_utils.getContentFormat(session, _addr)
            
            if fmt.this == keynodes.ui.format_string.this or fmt.this == keynodes.ui.format_term.this:
                value = session.get_content_str(_addr)
            elif fmt.this == keynodes.ui.format_int.this or fmt.this == keynodes.ui.format_real.this:
                value = str(session.get_content_real(_addr))
            
            if value is None:
                return ""
            
            return value            
			
        return ""
Esempio n. 10
0
    def getContent(self):
        import suit.core.sc_utils as sc_utils
        import suit.core.keynodes as keynodes
        session = core.Kernel.session()
        _addr = self._getSheet()._getScAddr()
        if _addr is not None:
            fmt = sc_utils.getContentFormat(session, _addr)

            if fmt.this == keynodes.ui.format_scsx.this or fmt.this == keynodes.ui.format_string.this:
                value = session.get_content_str(_addr)

            if value is None:
                return ""

            else:
             return self._setContentHighlighting(value)
        #self._setContentHighlighting(self.newvalue)

        return ""
Esempio n. 11
0
    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)
Esempio n. 12
0
    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)
Esempio n. 13
0
    def getContent(self):
        import suit.core.sc_utils as sc_utils
        import suit.core.keynodes as keynodes
        session = core.Kernel.session()
        _addr = self._getSheet()._getScAddr()
        if _addr is not None:
            fmt = sc_utils.getContentFormat(session, _addr)

            if fmt.this == keynodes.ui.format_string.this or fmt.this == keynodes.ui.format_term.this:
                value = session.get_content_str(_addr)
            elif fmt.this == keynodes.ui.format_int.this or fmt.this == keynodes.ui.format_real.this:
                value = str(session.get_content_real(_addr))

            if value is None:
                return ""

            return value
        ob = table.table("information")

        return ob.makeTextTable()  #"Text\nAnd Text"
Esempio n. 14
0
    def getContent(self):        
        import suit.core.sc_utils as sc_utils
        import suit.core.keynodes as keynodes
        session = core.Kernel.session()
        _addr = self._getSheet()._getScAddr()
        if _addr is not None:
            fmt = sc_utils.getContentFormat(session, _addr)
            
            if fmt.this == keynodes.ui.format_string.this or fmt.this == keynodes.ui.format_term.this:
                value = session.get_content_str(_addr)
            elif fmt.this == keynodes.ui.format_int.this or fmt.this == keynodes.ui.format_real.this:
                value = str(session.get_content_real(_addr))
            
            if value is None:
                return ""
            
            return value
        #return self.textArea.getText()

        ob = table.table("information")
        return ob.makeTextTable() #"Text\nAnd Text"
Esempio n. 15
0
    def _onRoot(self, _isRoot):
        """Notification on sheet root state changing
        """
        if _isRoot:
            render_engine.SceneNode.addChild(self._getSheet().sceneNodeChilds, self.sceneNodeRect)
            render_engine.SceneManager.setBackMaterial("Back/Spaces")
            
            # get data from sheet node content
            
            # trying to get data for showing
            import suit.core.sc_utils as sc_utils
            session = core.Kernel.session()
            _addr = self._getSheet()._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 = str(_cont_data.d.ptr)

            file_addr = self.file_addr.decode('cp1251')        
            
            dataToPaste = {'title': "Test", 'api_key': env.api_key, 'file_address': file_addr}
            
            #get template
            template = self._fileToStr()
            #put data into placeholders
            webPageText = template.format(**dataToPaste)
            #show to user in default browser
            self._browseLocal(webPageText)
        else:
            render_engine.SceneNode.removeChild(self._getSheet().sceneNodeChilds, self.sceneNodeRect)
            render_engine.SceneManager.setDefaultBackMaterial() 
Esempio n. 16
0
def generate_output_windows_set(_session, _segment, _parent_window):
    """Generates output windows set
    @param _session:    session to work with sc-memory
    @type _session:    MThreadSession
    @param _segment:    segment in sc-memory to work in
    @type _segment:    sc_segment
    @param _parent_window:    parent window object
    @type _parent_window:    ObjectSheet
    
    @return: output windows set
    @rtype: sc_global_addr
    """
    import srs_engine.sc_utils as sc_utils
    # preparing for sc-machine working (translating it to SC-code)
    output_windows_set = sc_utils.createNodeElement(_session, _segment, sc.SC_CONST)
    
    kernel = core.Kernel.getSingleton()
    
    output_windows = kernel.getOutputWindows()
    import srs_engine.objects as objects
    
    for _addr, _exists, _edit in output_windows:
        window_node = _addr
        if not _exists:
            # creating new window
            window = objects.ObjectSheet()
            window.hideContent()
            
            if _edit:
                try:
					window.setLogic(kernel.createEditor(_addr))
                except:
					print "There are no editor for addr %s" % (str(_addr))
					window.setLogic(kernel.createViewer(_addr))
            else:
                window.setLogic(kernel.createViewer(_addr))
            
            kernel.mainWindow.addChild(window)
            sc_utils.createPairPosPerm(_session, _segment, _addr, window._getScAddr(), sc.SC_CONST)
            window_node = window._getScAddr()
            
            # test
            if _addr.this == keynodes.ui.format_scgx.this:
                import srs_engine.layout.LayoutGroupForceDirected as layout
                window.setLayoutGroup(layout.LayoutGroupForceSimple())
        else:
            # test
            fmt = sc_utils.getContentFormat(_session, _addr)
            if fmt and fmt.this == keynodes.ui.format_scgx.this:
                import srs_engine.layout.LayoutGroupForceDirected as layout
                
                # FIXME:    thinking about multiply objects for sc_addr
                windows = objects.ScObject._sc2Objects(_addr)
                assert len(windows) > 0
                window = windows[0]
                
                if window.getLayoutGroup() is None:
                    window.setLayoutGroup(layout.LayoutGroupForceSimple())
                
    
        sc_utils.createPairPosPerm(_session, _segment, output_windows_set, window_node, sc.SC_CONST)
#    # test
#    import srs_engine.objects as objects
#    sheet = objects.ObjectSheet()
#    sheet.hideContent()
#    
#    sheet.setLogic(kernel.createEditor(keynodes.ui.format_scgx))
#    kernel.rootSheet.addChild(sheet)
#    sc_utils.createPair(_session, kernel.segment(), keynodes.ui.format_scgx, sheet._getScAddr(), sc.SC_A_CONST | sc.SC_POS)
#    kernel.setRootSheet(sheet)
#    
#    import srs_engine.layout.LayoutGroupForceDirected as layout
#    sheet.setLayoutGroup(layout.LayoutGroupForceSimple())
#    # test
#    
#    sc_utils.createPairPosPerm(_session, _segment, output_windows_set, sheet._getScAddr(), sc.SC_CONST)
    
    return output_windows_set
Esempio n. 17
0
    def getFormatIcon(self, _format):
        """Return icon associated with specified format
        @param _format: sc-node that designate format
        @type _format: sc_addr
        
        @return: Name of texture that contains icon associated to _format, if there are no any
                icons, then return None
        """
        import suit.core.sc_utils as sc_utils
        import sc_core.constants as sc_constants
        import sc_core.pm as sc
        import ogre.renderer.OGRE as ogre

        session = core.Kernel.session()

        icon = None
        idtf_set = sc_utils.searchOneShotBinPairAttrToNode(
            session, _format, keynodes.common.nrel_identification, sc.SC_CONST)
        if idtf_set is not None:

            it1 = session.create_iterator(
                session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a,
                                          idtf_set, sc.SC_A_CONST,
                                          sc.SC_N_CONST), True)
            while not it1.is_over():
                if sc_utils.checkIncToSets(session, it1.value(2),
                                           [keynodes.common.group_image],
                                           sc.SC_CONST):
                    icon = it1.value(2)
                    break
                it1.next()

            if icon is None:
                return None

            _fmt = sc_utils.getContentFormat(session, icon)
            assert _fmt is not None

            _cont = session.get_content_const(icon)
            assert _cont is not None

            _cont_data = _cont.convertToCont()

            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))
            except:
                import sys, traceback
                print "Error:", sys.exc_info()[0]
                traceback.print_exc(file=sys.stdout)

            icon_name = "icon_%s" % str(_format)
            ogre.TextureManager.getSingleton().loadImage(
                icon_name, "General", img)
            return icon_name

        return None
Esempio n. 18
0
def generate_output_windows_set(_session, _segment, _parent_window):
    """Generates output windows set
    @param _session:    session to work with sc-memory
    @type _session:    MThreadSession
    @param _segment:    segment in sc-memory to work in
    @type _segment:    sc_segment
    @param _parent_window:    parent window object
    @type _parent_window:    ObjectSheet
    
    @return: output windows set
    @rtype: sc_global_addr
    """
    import srs_engine.sc_utils as sc_utils
    # preparing for sc-machine working (translating it to SC-code)
    output_windows_set = sc_utils.createNodeElement(_session, _segment,
                                                    sc.SC_CONST)

    kernel = core.Kernel.getSingleton()

    output_windows = kernel.getOutputWindows()
    import srs_engine.objects as objects

    for _addr, _exists, _edit in output_windows:
        window_node = _addr
        if not _exists:
            # creating new window
            window = objects.ObjectSheet()
            window.hideContent()

            if _edit:
                try:
                    window.setLogic(kernel.createEditor(_addr))
                except:
                    print "There are no editor for addr %s" % (str(_addr))
                    window.setLogic(kernel.createViewer(_addr))
            else:
                window.setLogic(kernel.createViewer(_addr))

            kernel.mainWindow.addChild(window)
            sc_utils.createPairPosPerm(_session, _segment, _addr,
                                       window._getScAddr(), sc.SC_CONST)
            window_node = window._getScAddr()

            # test
            if _addr.this == keynodes.ui.format_scgx.this:
                import srs_engine.layout.LayoutGroupForceDirected as layout
                window.setLayoutGroup(layout.LayoutGroupForceSimple())
        else:
            # test
            fmt = sc_utils.getContentFormat(_session, _addr)
            if fmt and fmt.this == keynodes.ui.format_scgx.this:
                import srs_engine.layout.LayoutGroupForceDirected as layout

                # FIXME:    thinking about multiply objects for sc_addr
                windows = objects.ScObject._sc2Objects(_addr)
                assert len(windows) > 0
                window = windows[0]

                if window.getLayoutGroup() is None:
                    window.setLayoutGroup(layout.LayoutGroupForceSimple())

        sc_utils.createPairPosPerm(_session, _segment, output_windows_set,
                                   window_node, sc.SC_CONST)
#    # test
#    import srs_engine.objects as objects
#    sheet = objects.ObjectSheet()
#    sheet.hideContent()
#
#    sheet.setLogic(kernel.createEditor(keynodes.ui.format_scgx))
#    kernel.rootSheet.addChild(sheet)
#    sc_utils.createPair(_session, kernel.segment(), keynodes.ui.format_scgx, sheet._getScAddr(), sc.SC_A_CONST | sc.SC_POS)
#    kernel.setRootSheet(sheet)
#
#    import srs_engine.layout.LayoutGroupForceDirected as layout
#    sheet.setLayoutGroup(layout.LayoutGroupForceSimple())
#    # test
#
#    sc_utils.createPairPosPerm(_session, _segment, output_windows_set, sheet._getScAddr(), sc.SC_CONST)

    return output_windows_set
Esempio n. 19
0
 def getIconAddr(self):
     return sc_utils.getContentFormat(core.Kernel.session(), self._getScAddr())