Exemplo n.º 1
0
    def updateForObject( self, keys ):
        """ called from MainWindow to update the content to the choosen object key

        Default params will be shown if there is more than 1 key"""
        _infoer.function = str(self.updateForObject)
        _infoer.write("")
        
        if isinstance( keys, int ) :
            self.__keys = [keys]
        elif isinstance( keys, list ) and len(keys)>0 :
            self.__keys = keys
        else :
            return

        if len(self.__keys) == 1 :
            params = ObjectMgr().getParamsOfObject(self.__keys[0])
            if isinstance(params, int) or isinstance(params, coDNAItemParams):
                self.__setParams( params )

        elif len(self.__keys) > 1 :
            # multi selection: show default params
            self.oldPanelParams = coDNAItemParams()
            params = CopyParams(self.oldPanelParams)
            params.name = "Multiselection"
            self.__setParams( params )
Exemplo n.º 2
0
    def updateForObject( self, keys ):
        """ called from MainWindow to update the content to the choosen object key

        Default params will be shown if there is more than 1 key"""
        _infoer.function = str(self.updateForObject)
        _infoer.write("")


        if isinstance( keys, int ) :
            self.__keys = [keys]
        elif isinstance( keys, list ) and len(keys)>0 :
            self.__keys = keys
        else :
            return

        if len(self.__keys) == 1 :
            params = ObjectMgr().getParamsOfObject(self.__keys[0])
            if isinstance(params, int) or isinstance(params, SceneObjectVisParams):
                self.__setParams( params )
        elif len(self.__keys) > 1 :
            # multi selection: show default params
            self.oldPanelParams = SceneObjectVisParams()
            params = CopyParams(self.oldPanelParams)
            params.name = "Multiselection"
            self.__setParams( params )
Exemplo n.º 3
0
    def updateForObject( self, keys ):
        if isinstance( keys, int):
            self.__keys = [keys]
        else:
            self.__keys = keys

        # set the variables
        if len(self.__keys)==1 :
            # enable the visualization and the transform tab
            self.tabWidget.setTabEnabled(0, True)
            self.tabWidget.setTabEnabled(1, True)

            scalar = ObjectMgr().getPossibleScalarVariablesForType(self.__keys[0])
            vector = ObjectMgr().getPossibleVectorVariablesForType(self.__keys[0])
            if covise.coConfigIsOn("vr-prepare.UseComposedVelocity", False):
                myObject = globalKeyHandler().getObject(self.__keys[0])
                if (myObject.typeNr == TYPE_3D_COMPOSED_PART):
                    vector.append(COMPOSED_VELOCITY)
            self._setUnsetVariable(True)        
            self._setScalarVariables(scalar)
            self._setVectorVariables(vector)
            self.setGridName(ObjectMgr().getNameOfType(self.__keys[0]) )
        else : # multi selection
            # disable the visualization and the transform tab
            self.tabWidget.setTabEnabled(0, False)
            self.tabWidget.setTabEnabled(1, False)
        # apply params
        params = ObjectMgr().getParamsOfObject(self.__keys[0])
        params.name = ObjectMgr().getNameOfType(self.__keys[0]) 
        #if self.__key in Application.vrpApp.guiKey2visuKey:
        #    params.isVisible = ObjectMgr().getParamsOfObject(Application.vrpApp.guiKey2visuKey[self.__key]).isVisible
        self.__setParams( params )
Exemplo n.º 4
0
 def emitNameChange(self, aQString=None):
     _infoer.function = str(self.emitNameChange)
     _infoer.write("")
     # only for single selection
     if len(self.__keys) == 1:
         #MainWindow.globalAccessToTreeView.setItemData(self.__keys[0], str(self.nameWidget.text()))
         # set name of type_2d_part
         params = ObjectMgr().getParamsOfObject(self.__keys[0])
         params.name = str(self.lineEditFilename.text())
         Application.vrpApp.key2params[self.__keys[0]] = params
         ObjectMgr().setParams(self.__keys[0], params)
         self.emitDataChanged()
Exemplo n.º 5
0
 def emitNameChange(self, aQString = None):
     _infoer.function = str(self.emitNameChange)
     _infoer.write("")
     # only for single selection
     if len(self.__keys)==1 :
         #MainWindow.globalAccessToTreeView.setItemData(self.__keys[0], str(self.nameWidget.text()))
         # set name of type_2d_part
         params = ObjectMgr().getParamsOfObject(self.__keys[0])
         params.name = str(self.nameWidget.text())
         Application.vrpApp.key2params[self.__keys[0]] = params
         ObjectMgr().setParams(self.__keys[0], params)
         self.emitDataChanged()
Exemplo n.º 6
0
    def updateForObject( self, keys ):
        """ called from MainWindow to update the content to the choosen object key

        Default params will be shown if there is more than 1 key"""
        _infoer.function = str(self.updateForObject)
        _infoer.write("")

        if isinstance( keys, int ) :
            self.__keys = [keys]
        elif isinstance( keys, list ) and len(keys)>0 :
            self.__keys = keys
        else :
            return
        # if a type_2d_composed_part disable the first two tabs (coloring and shader)
        if len(self.__keys)==1 :
            # enable the visualization and the transform tab
            self.TabWidgetGeneralAdvanced.setTabEnabled(0, True)
            self.TabWidgetGeneralAdvanced.setTabEnabled(1, True)
            self.TabWidgetGeneralAdvanced.setTabEnabled(2, True)
            self.TabWidgetGeneralAdvanced.setTabEnabled(3, True)

            if ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_COMPOSED_PART:
                self.TabWidgetGeneralAdvanced.setTabEnabled(0, False)
                self.TabWidgetGeneralAdvanced.setTabEnabled(1, False)
            # if not a type_2d_part disable the transform tab
            if ObjectMgr().getTypeOfObject(self.__keys[0]) != TYPE_2D_PART:
                self.TabWidgetGeneralAdvanced.setTabEnabled(3, False)
            # if not a type_2d_cutgeometry_part disable the cut tab
            if ObjectMgr().getTypeOfObject(self.__keys[0]) != TYPE_2D_CUTGEOMETRY_PART:
                self.TabWidgetGeneralAdvanced.setTabEnabled(4, False)

        elif len(self.__keys) > 1 : # multi selection
            # always show first tab
            self.TabWidgetGeneralAdvanced.setCurrentIndex(0)
            # disable the visualization and the transform tab
            self.TabWidgetGeneralAdvanced.setTabEnabled(2, False)
            self.TabWidgetGeneralAdvanced.setTabEnabled(3, False)

        # set the variables of first key
        self.__setScalarVariables(ObjectMgr().getPossibleScalarVariablesForType(self.__keys[0]))
        self.__setVectorVariables(ObjectMgr().getPossibleVectorVariablesForType(self.__keys[0]))

        # apply params
        if len(self.__keys) == 1 :
            realparams = ObjectMgr().getRealParamsOfObject(self.__keys[0])
            params = ObjectMgr().getParamsOfObject(self.__keys[0])
            params.name = realparams.name
            #params.boundingBox = realparams.boundingBox
            if isinstance(params, int) or isinstance(params, Part2DRawVisParams):
                self.__setParams( params )
            self.__setRealParams( realparams )
            # update
            Visualization2DPanel.updateForObject(self, self.__keys[0])
        elif len(self.__keys) > 1 :
            # multi selection: show default params
            self.oldPanelParams = Part2DRawVisParams()
            params = CopyParams(self.oldPanelParams)
            self.__setParams( params )
            if ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_PART:
                self.oldPanelRealParams = co2DPartMgrParams()
            if ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_COMPOSED_PART:
                self.oldPanelRealParams = co2DComposedPartMgrParams()
            if ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_CUTGEOMETRY_PART:
                self.oldPanelRealParams = co2DCutGeometryPartMgrParams()
                #self.oldPanelRealParams.name = coTranslate("Multiselection")
                self.oldPanelRealParams.name = "Multiselection"
            realparams = CopyParams(self.oldPanelRealParams)
            self.__setRealParams( realparams )
            # set ComboBoxVariable on default value
            self.vrpComboBoxVariable_2.setCurrentIndex(0)