Exemplo n.º 1
0
    def update(self):
        """overwrite superclass's method
        updates this window and property window
        Returns None
        """
        if self.theSession.theSession is not self.theAssociatedSession:
            self.reconstructSystemTree()
            self.theQueue = FullPNQueue(
                (self["backbutton"], self["forwardbutton"]))
            self.theQueue.registerCallback(self.doSelection)
            self.theQueue.pushFullPNList(
                [convertFullIDToFullPN(createFullID('System::/'))])
            self.updateButtons()

        # updates this window
        if not self.exists():
            return
        OsogoWindow.update(self)

        # updates property window
        self.thePropertyWindow.update()

        # update PluginInstanceSelectionWindow
        if self.thePluginInstanceSelection != None:
            self.thePluginInstanceSelection.update()

        self.updateLists()
        self.theAssociatedSession = self.theSession.theSession
Exemplo n.º 2
0
    def update(self):
        aFullID = None
        aFullPN = None
        fullUpdate = False

        if self.theSession.theSession is not self.theAssociatedSession:
            self.theRawFullPNList = []
            if self.theSession.theSession is not None:
                if self.theParent != None:
                    if self.theParent.__class__.__name__ == "EntityListWindow":
                        self.theQueue = self.theParent.getQueue()
                    else:
                        self['navigation'].visible = True
                        self.theQueue = FullPNQueue(
                            (self['backbutton'], self['forwardbutton']),
                            self.theRawFullPNList)
                else:
                    self['navigation'].visible = True
                    self.theQueue = FullPNQueue(
                        (self['backbutton'], self['forwardbutton']),
                        self.theRawFullPNList)
                self.theAssociatedSession = self.theSession.theSession
                self.theQueue.registerCallback(self.setRawFullPNList)
            else:
                self.theQueue = None
        else:
            aFullPN = self.getFullPN()
            if aFullPN is not None:
                aFullID, _ = convertFullPNToFullID(self.getFullPN())
        if self.thePreFullID != aFullID:
            fullUpdate = True

        # ----------------------------------------------------
        # updates widgets
        # ----------------------------------------------------
        # creates EntityStub
        if aFullID is not None:
            anEntityStub = self.theSession.createEntityStub(
                createFullIDString(aFullID))
        else:
            anEntityStub = None
            fullUpdate = True

        if not fullUpdate:
            # gets propery values for thePreProperyMap in case value is not tuple
            for aPropertyName in self.thePrePropertyMap.keys():
                aProperty = self.thePrePropertyMap[aPropertyName]
                if type(aProperty[0]) not in (tuple, list):
                    aProperty[0] = anEntityStub.getProperty(aPropertyName)
            if self.theVarrefEditor != None:
                self.theVarrefEditor.update()
        else:
            self.theSelectedFullPN = ''

            # -----------------------------------------------
            # updates each widget
            # Type, ID, Path, Classname
            # -----------------------------------------------
            if anEntityStub is not None:
                anEntityType = ENTITYTYPE_STRING_LIST[aFullPN[TYPE]]
                anID = aFullPN[ID]
                aSystemPath = str(aFullPN[SYSTEMPATH])

                self['entryClassName'].set_text(anEntityStub.getClassname())
                self['entryFullID'].set_text(':'.join(
                    [anEntityType, aSystemPath, anID]))
                # saves properties to buffer
                self.thePrePropertyMap = {}
                for aProperty in anEntityStub.getPropertyList():
                    self.thePrePropertyMap[str(aProperty)] = [None, None]
                    self.thePrePropertyMap[str(aProperty)][0] =\
                            anEntityStub.getProperty(aProperty)
                    self.thePrePropertyMap[str(aProperty)][1] =\
                            anEntityStub.getPropertyAttributes(aProperty)

                self['entryName'].set_text(
                    str(self.thePrePropertyMap['Name'][0]))

                # save current full id to previous full id.
                self.thePreFullID = aFullID
                self.setSelectedFullPN(aFullPN)
            else:
                self['entryClassName'].set_text("")
                self['entryClassName'].set_max_length(0)
                self['entryFullID'].set_text("")
                self['entryName'].set_text("")

            # update Summary tab for unique fields of each entity type
            # update the respective Entity's PropertyList
            if aFullPN is not None:
                self.__setDiscardList()
                if aFullPN[TYPE] == PROCESS:
                    self.__createVariableReferenceListTab()
                    self.__updateProcess()
                elif aFullPN[TYPE] == VARIABLE:
                    self.__deleteVariableReferenceListTab()
                    self.__updateVariable()
                elif aFullPN[TYPE] == SYSTEM:
                    self.__deleteVariableReferenceListTab()
                    self.__updateSystem()

        # updates status bar
        if self['statusbar'] != None:
            self['statusbar'].push(1, '')