Esempio n. 1
0
 def SetItems(parentItem, fictiveObjects, level):
     level += 1
     for object in fictiveObjects:
         type = object.type
         if not type in showTypes:
             continue
         # Construct text
         if type=='cell':
             type = '##'
         elif type=='attribute':
             type = 'attr'
         #
         if type == 'import':                   
             text = "%s (%s)" % (object.name, object.text)
         elif type=='todo':
             text = object.name
         else:
             text = "%s %s" % (type, object.name)
         # Create item
         thisItem = QtGui.QTreeWidgetItem(parentItem, [text])
         color = QtGui.QColor(colours[object.type])
         thisItem.setForeground(0, QtGui.QBrush(color))
         font = thisItem.font(0)
         font.setBold(True)
         thisItem.setFont(0, font)
         thisItem.linenr = object.linenr
         # Is this the current item?
         if ln and object.linenr <= ln and object.linenr2 > ln:
             selectedItem[0] = thisItem 
         # Any children that we should display?
         if object.children:
             SetItems(thisItem, object.children, level)
         # Set visibility 
         thisItem.setExpanded( bool(level < showLevel) )
Esempio n. 2
0
    def fillWorkspace(self):
        """ fillWorkspace()
        Update the workspace tree.
        """

        # Clear first
        self.clear()

        # Set name
        line = self.parent()._line
        line.setText(self._proxy._name)

        # Add elements
        for des in self._proxy._variables:

            # Get parts
            parts = des.split(',', 4)
            if len(parts) < 4:
                continue

            # Pop the 'kind' element
            kind = parts.pop(2)

            # Create item
            item = QtGui.QTreeWidgetItem(parts, 0)
            self.addTopLevelItem(item)

            # Set tooltip
            tt = '%s: %s' % (parts[0], parts[-1])
            item.setToolTip(0, tt)
            item.setToolTip(1, tt)
            item.setToolTip(2, tt)
Esempio n. 3
0
 def onEditorsCurrentChanged(self):
     """ Notify that the file is being parsed and make
     sure that not the structure of a previously selected
     file is shown. """
     
     # Get editor and clear list
     editor = iep.editors.getCurrentEditor()        
     self._tree.clear()
     
     if editor is None:
         # Set editor id
         self._currentEditorId = 0
     
     if editor is not None:
         # Set editor id
         self._currentEditorId = id(editor)
         
         # Notify
         text = 'Parsing ' + editor._name + ' ...'
         thisItem = QtGui.QTreeWidgetItem(self._tree, [text])
         
         # Try getting the  structure right now
         self.updateStructure()