def __init__(self, filename, name, icon):
     QTreeWidgetItem.__init__(self)
     self.name = name
     self.filename = filename
     self.setText(0, name)
     self.setIcon(0, icon)
     self.setCheckState(0, Qt.Unchecked)
Example #2
0
    def __init__(self, parent, canvasLayer):
        QTreeWidgetItem.__init__(self)
        self.legend = parent
        self.canvasLayer = canvasLayer
        self.canvasLayer.layer().setLayerName( self.legend.normalizeLayerName( unicode( self.canvasLayer.layer().name() ) ) )
        self.setText(0, self.canvasLayer.layer().name())
        self.isVect = (self.canvasLayer.layer().type() == 0) # 0: Vector, 1: Raster
        self.layerId = self.canvasLayer.layer().id()
        self.setSizeHint(0, QSize(24, 24))
        self.setCheckState(0, Qt.Checked)

        pm = QPixmap(22, 22)
        icon = QIcon()

        if self.isVect:
            renderer = self.canvasLayer.layer().rendererV2() 
            sym = renderer.symbols()[0]
            img = QImage(sym.asImage(QSize(22, 22)))
            pix = pm.fromImage(img)
            icon.addPixmap(pix, QIcon.Normal, QIcon.On)
            self.vectorLayerSymbology(self.canvasLayer.layer())
        else:
            pm = self.canvasLayer.layer().previewAsPixmap(QSize(22, 22))
            icon.addPixmap(pm)
            self.rasterLayerSymbology(self.canvasLayer.layer())

        self.setIcon(0, icon)
        self.setToolTip(0, self.canvasLayer.layer().attribution())
        layerFont = QFont()
        layerFont.setBold(True)
        self.setFont(0, layerFont)
Example #3
0
 def __init__(self, parent, name, node):
     QTreeWidgetItem.__init__(self, parent)
     self.setText(0, name)
     self._node = node
     value = node.get("value") and node.get("value") or ""
     self.setText(1, value)
     self._recurse_children()
    def __init__( self, parentItem, exceptionType, exceptionMessage,
                  stackTrace ):
        QTreeWidgetItem.__init__( self, parentItem )
        self.__count = 1
        self.__exceptionType = exceptionType
        self.__exceptionMessage = exceptionMessage

        if exceptionMessage == "" or exceptionMessage is None:
            self.setText( 0, str( exceptionType ) )
            self.setToolTip( 0, "Type: " + str( exceptionType ) )
        else:
            self.setText( 0, str( exceptionType ) + ", " +
                             getDisplayValue( exceptionMessage ) )
            tooltip = "Type: " + str( exceptionType ) + "\n" + \
                      "Message: "
            tooltipMessage = getTooltipValue( exceptionMessage )
            if '\r' in tooltipMessage or '\n' in tooltipMessage:
                tooltip += "\n" + tooltipMessage
            else:
                tooltip += tooltipMessage
            self.setToolTip( 0, tooltip )

        if stackTrace:
            for fileName, lineNumber in stackTrace:
                StackFrameItem( self, fileName, lineNumber )
        return
Example #5
0
    def __init__( self, pluginManager, cdmPlugin, active, category ):
        self.plugin = cdmPlugin
        self.active = active
        self.category = category

        name = self.plugin.getName()
        ver = self.plugin.getVersion()
        QTreeWidgetItem.__init__( self, [ "", "", "", name, ver ] )

        if not self.plugin.conflictType in [ pluginManager.NO_CONFLICT,
                                             pluginManager.USER_DISABLED ]:
            self.setIcon( CONFLICT_COL, PixmapCache().getIcon( 'pluginconflict.png' ) )
            self.setToolTip( CONFLICT_COL, self.plugin.conflictMessage )

        self.setToolTip( STATE_COL, "Enable / disable" )
        self.setToolTip( CONFLICT_COL, "Conflict" )

        if self.plugin.isUser():
            self.setIcon( TYPE_COL, PixmapCache().getIcon( 'pluginuser.png' ) )
            self.setToolTip( TYPE_COL, "User plugin" )
        else:
            self.setIcon( TYPE_COL, PixmapCache().getIcon( 'pluginsystem.png' ) )
            self.setToolTip( TYPE_COL, "System wide plugin" )

        self.setFlags( self.flags() | Qt.ItemIsUserCheckable )
        if active:
            self.setCheckState( STATE_COL, Qt.Checked )
        else:
            self.setCheckState( STATE_COL, Qt.Unchecked )
        return
Example #6
0
 def __init__(self, song, pos):
     QTreeWidgetItem.__init__(self)
     self.song = song
     self.pos = pos
     self.setText(0,mpdlibrary.songArtist(song))
     self.setText(1,mpdlibrary.songTitle(song))
     self.setText(2,mpdlibrary.songAlbum(song))
Example #7
0
 def __init__(self, parent, _name, path):
     QTreeWidgetItem.__init__(self, parent)
     self._parent = parent
     self.setText(0, _name)
     self.path = path
     self.isFolder = True
     self.setForeground(0, QBrush(QColor(255, 165, 0)))
     project = json_manager.read_ninja_project(path)
     self.name = project.get('name', '')
     if self.name == '':
         self.name = _name
     self.setText(0, self.name)
     self.projectType = project.get('project-type', '')
     self.description = project.get('description', '')
     self.url = project.get('url', '')
     self.license = project.get('license', '')
     self.mainFile = project.get('mainFile', '')
     self.preExecScript = project.get('preExecScript', '')
     self.postExecScript = project.get('postExecScript', '')
     self.indentation = project.get('indentation', settings.INDENT)
     self.useTabs = project.get('use-tabs', settings.USE_TABS)
     self.extensions = project.get('supported-extensions',
         settings.SUPPORTED_EXTENSIONS)
     self.pythonPath = project.get('pythonPath', settings.PYTHON_PATH)
     self.PYTHONPATH = project.get('PYTHONPATH', '')
     self.programParams = project.get('programParams', '')
     self.venv = project.get('venv', '')
     self.related_projects = project.get('relatedProjects', [])
     self.update_paths()
     self.addedToConsole = False
Example #8
0
 def __init__(self, action, collection, name):
     QTreeWidgetItem.__init__(self)
     self.collection = collection
     self.name = name
     self.setIcon(0, action.icon())
     self.setText(0, qutil.removeAccelelator(action.text()))
     self._shortcuts = {}
Example #9
0
 def __init__(self, parent, _name, path):
     QTreeWidgetItem.__init__(self, parent)
     self._parent = parent
     self.setText(0, _name)
     self.path = path
     self.isFolder = True
     self.setForeground(0, QBrush(Qt.darkGray))
     project = json_manager.read_ninja_project(path)
     self.name = project.get('name', '')
     if self.name == '':
         self.name = _name
     self.setText(0, self.name)
     self.projectType = project.get('project-type', '')
     self.description = project.get('description', '')
     self.url = project.get('url', '')
     self.license = project.get('license', '')
     self.mainFile = project.get('mainFile', '')
     self.preExecScript = project.get('preExecScript', '')
     self.postExecScript = project.get('postExecScript', '')
     self.extensions = project.get('supported-extensions',
         settings.SUPPORTED_EXTENSIONS)
     self.pythonPath = project.get('pythonPath', settings.PYTHON_PATH)
     self.programParams = project.get('programParams', '')
     self.venv = project.get('venv', '')
     self.addedToConsole = False
Example #10
0
    def __init__( self, logInfo ):
        self.logInfo = logInfo

        message = ""
        if logInfo.message:
            message = str( logInfo.message )
        authorTooltip = ""
        author = ""
        if logInfo.author:
            authorTooltip = str( logInfo.author )
            author = authorTooltip.split( "@", 1 )[ 0 ]
        revision = ""
        if logInfo.revision:
            if logInfo.revision.number:
                revision = str( logInfo.revision.number )
        date = ""
        if logInfo.date:
            date = timestampToString( logInfo.date )

        QTreeWidgetItem.__init__( self, [ "", "", revision, date,
                                          author, message ] )

        self.setCheckState( SELECT_COL, Qt.Unchecked )
        self.setToolTip( REVISION_COL, revision )
        self.setToolTip( DATE_COL, date )
        self.setToolTip( AUTHOR_COL, authorTooltip )
        self.setToolTip( MESSAGE_COL, message )
        return
 def __init__(self, parent, name, lineno=None):
     QTreeWidgetItem.__init__(self, parent, name)
     self.lineno = lineno
     self.isClickable = True
     self.isAttribute = False
     self.isClass = False
     self.isMethod = False
Example #12
0
    def __init__( self, parent, isGlobal,
                        displayName, displayValue, displayType ):
        self.__isGlobal = isGlobal
        self.__value = displayValue
        self.__name = displayName
        self.__type = displayType

        # Decide about the display value
        displayValue = getDisplayValue( displayValue )

        # Decide about the tooltip
        self.__tooltip = "Name: " + displayName + "\n" + \
                         "Type: " + displayType + "\n" + \
                         "Value: "

        tooltipDisplayValue = getTooltipValue( self.__value )
        if '\r' in tooltipDisplayValue or '\n' in tooltipDisplayValue:
            self.__tooltip += "\n" + tooltipDisplayValue
        else:
            self.__tooltip += tooltipDisplayValue

        QTreeWidgetItem.__init__( self, parent, [ displayName, displayValue,
                                                  displayType ] )

        self.populated = True
        return
Example #13
0
 def __init__(self, song, pos):
     QTreeWidgetItem.__init__(self)
     self.song = song
     self.pos = pos
     self.setText(0,song.artist)
     self.setText(1,song.title)
     self.setText(2,song.album)
Example #14
0
 def __init__(self, song):
     QTreeWidgetItem.__init__(self)
     self.song = song
     self.setText(0,mpdlibrary.songTrack(song))
     self.setText(1,mpdlibrary.songTitle(song))
     self.setText(2,mpdlibrary.songTime(song))
     self.setToolTip(1, "Artist:\t %s\nAlbum:\t %s\nFile:\t %s"\
             % (mpdlibrary.songArtist(song), mpdlibrary.songAlbum(song), song['file']))
Example #15
0
 def __init__(self, alg):
     QTreeWidgetItem.__init__(self)
     self.alg = alg
     icon = alg.getIcon()
     name = AlgorithmClassification.getDisplayName(alg)
     self.setIcon(0, icon)
     self.setToolTip(0, name)
     self.setText(0, name)
Example #16
0
 def __init__(self, dev):
     QTreeWidgetItem.__init__(self, None)
     # self._dev = dev # this produces cascaded instance duplication somehow
     # don't want to copy the complete Device incl. sublists
     self._dev = [dev]
     self._overallChildCount = 0
     self._visibleChildCount = 0
     self.configure()
Example #17
0
 def __init__(self, sockType, name, _id=0, icon=None):
     QTreeWidgetItem.__init__(self)
     self.sockType = sockType
     self.name = name
     self._id = _id
     self.setText(0, name)
     if icon:
         self.setIcon(0, QIcon(icon))
Example #18
0
 def __init__(self, providerName, tree, toolbox):
     QTreeWidgetItem.__init__(self, tree)
     self.tree = tree
     self.toolbox = toolbox
     self.providerName = providerName
     self.provider = Processing.getProviderFromName(providerName)
     self.setIcon(0, self.provider.getIcon())
     self.populate()
Example #19
0
    def __init__( self, parentItem, fileName, lineNumber ):
        QTreeWidgetItem.__init__( self, parentItem )

        self.__fileName = fileName
        self.__lineNumber = lineNumber
        self.setText( 0, os.path.basename( fileName ) + ":" + str( lineNumber ) )
        self.setToolTip( 0, fileName + ":" + str( lineNumber ) )
        return
Example #20
0
 def __init__(self, staff, parent):
     self.staff = staff
     QTreeWidgetItem.__init__(self, parent)
     self.setText(0, self.name())
     self.setIcon(0, staff.symbolIcon(self.symbol()))
     self.setExpanded(True)
     self.widget = self.createWidget()
     staff.stack.addWidget(self.widget)
Example #21
0
    def __init__(self, connection):
        self.connIcon = QIcon(os.path.dirname(__file__) + '/../images/postgis.png')
        self.schemaIcon = QIcon(os.path.dirname(__file__) + '/../images/namespace.png')

        QTreeWidgetItem.__init__(self)
        self.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
        self.connection = connection
        self.setText(0, connection)
        self.setIcon(0, self.connIcon)
 def __init__(self, item, overlayPathName):
     """
     item:            OverlayTreeWidgetItem
     overlayPathName: string
                      full name of the overlay, for example 'File Overlays/My Data'
     """
     self.overlayPathName = overlayPathName
     QTreeWidgetItem.__init__(self, [item.name])
     self.item = item
    def __init__( self, fileName ):

        # full file name is expected
        basename = os.path.basename( fileName )
        QTreeWidgetItem.__init__( self, [ "", basename + "   ", fileName ] )

        self.__isValid = True
        self.updateIconAndTooltip()
        return
Example #24
0
 def __init__(self, text, attr, library):
     self.library = library
     QTreeWidgetItem.__init__(self)
     self.setText(0, text)
     if attr == 'file':
         self.setIcon(0, auxilia.PIcon('audio-x-generic'))
     else:
         self.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
         self.setIcon(0, auxilia.PIcon('folder-sound'))
Example #25
0
	def __init__(self, parent, jid, con):
		QTreeWidgetItem.__init__(self, parent, [jid], QTreeWidgetItem.UserType+1)

		# QTreeWidgetItem configuration
		self.setFlags(Qt.ItemIsDragEnabled | Qt.ItemIsEnabled) # we can move a contact
		self.parent = parent
		self.jid = jid
		self.name = jid
		self.setStatus(STATUS.unavailable)
		self.connectionThread = con
    def __init__( self, fileName ):

        # full file name is expected
        projectName = os.path.basename( fileName ).replace( '.cdm', '' )
        QTreeWidgetItem.__init__( self, [ "", projectName + "   ", fileName ] )

        self.__isValid = True
        self.__isCurrent = False
        self.updateTooltip()
        return
Example #27
0
    def __init__(self, name):
        """A new QTreeWidgetItem with the QGis layer information added.

        :param name: The name of the field in the attribute table
        :type name: string"""
        
        QTreeWidgetItem.__init__(self)
        self.setText(0, name)
        self.setIcon(0, self.fieldIcon)
        self.setCheckState(0, Qt.Unchecked)
Example #28
0
    def __init__(self, parent, package):
        QTreeWidgetItem.__init__(self, parent)
        self.package = package
        self.required = False

        self.setCheckState(0, Qt.Unchecked)
        self.setText(0, package.name)
        self.setText(1, "%.3f" % (package.size / 1024.0 / 1024.0))
        self.setText(2, package.version)
        self.setText(3, package.release)
Example #29
0
    def __init__(self, parent, project):
        QTreeWidgetItem.__init__(self, parent)
        self._parent = parent
        self._project = project
        self.setText(0, self._project.name)
        self.path = self._project.path
        self.isFolder = True
        self.setForeground(0, QBrush(QColor(255, 165, 0)))

        self.update_paths()
Example #30
0
	def __init__(self, parent, jid, show, con, nick = None, muc = None):
		QTreeWidgetItem.__init__(self, parent, jid, QTreeWidgetItem.UserType + 1)

		# QTreeWidgetItem configuration
		#self.setFlags(Qt.ItemIsDragEnabled | Qt.ItemIsEnabled) # we can move a contact
		self.parent = parent
		self.jid = jid
		self.name = jid
		self.connection = con
		self.nick = nick
		self.muc = muc
Example #31
0
 def __init__(self, name, layers, tree):
     QTreeWidgetItem.__init__(self)
     self.layers = layers
     self.name = name
     self.setText(0, name)
     self.setIcon(0, self.groupIcon)
     self.setCheckState(0, Qt.Checked)
     self.visibleItem = QTreeWidgetItem(self)
     self.visibleCheck = QCheckBox()
     self.visibleCheck.setChecked(True)
     self.visibleItem.setText(0, "Layers visibility")
     self.addChild(self.visibleItem)
     tree.setItemWidget(self.visibleItem, 1, self.visibleCheck)
Example #32
0
 def __init__(self, alg):
     settings = QSettings()
     useCategories = settings.value(ProcessingToolbox.USE_CATEGORIES,
                                    type=bool)
     QTreeWidgetItem.__init__(self)
     self.alg = alg
     icon = alg.getIcon()
     if useCategories:
         icon = GeoAlgorithm.getDefaultIcon()
     name = AlgorithmClassification.getDisplayName(alg)
     self.setIcon(0, icon)
     self.setToolTip(0, name)
     self.setText(0, name)
Example #33
0
    def __init__(self, fileName, lineNumber, funcName, frameNumber):

        shortened = os.path.basename(fileName) + ":" + str(lineNumber)
        full = fileName + ":" + str(lineNumber)

        self.__lineNumber = lineNumber
        QTreeWidgetItem.__init__(self, ["", shortened, funcName, fileName])

        self.__isCurrent = False
        self.__frameNumber = frameNumber

        for index in xrange(4):
            self.setToolTip(index, full)
        return
Example #34
0
 def __init__(self, alg):
     settings = QSettings()
     useCategories = settings.value(ProcessingToolbox.USE_CATEGORIES,
                                    type=bool)
     QTreeWidgetItem.__init__(self)
     self.alg = alg
     icon = alg.getIcon()
     name = alg.name
     if useCategories:
         icon = GeoAlgorithm.getDefaultIcon()
         (group, subgroup, name) = AlgorithmDecorator.getGroupsAndName(alg)
     self.setIcon(0, icon)
     self.setToolTip(0, name)
     self.setText(0, name)
Example #35
0
    def __init__(self, vector):
        """A new QTreeWidgetItem with the QGis layer information added.

        :param isVisible: Is the layer visible within the legend.
        :type isVisible: bool

        :param vector: Vector object from the mapModel
        :type vector: model.vector"""

        QTreeWidgetItem.__init__(self)
        self.setText(0, vector.name)
        self.setIcon(0, self.layerIcon)
        if vector.isVisible:
            self.setCheckState(0, Qt.Checked)
        else:
            self.setCheckState(0, Qt.Unchecked)
Example #36
0
    def __init__(self, text, parent = None, icon=None):
        """
        Constructs TaskItem widget item

        @param task: 
        @type task: list

        @param parent: 
        @type parent:
        """
        QTreeWidgetItem.__init__(self, parent)

        self.setText(COL_RUNNING_ID, text )
        self.setIcon(COL_RUNNING_ID, QIcon(":/processes.png") )
        if icon is not None:
            self.setIcon(COL_RUNNING_ID, icon )
Example #37
0
 def __init__(self, parent, _name, path):
     QTreeWidgetItem.__init__(self, parent, _name)
     Project.__init__(self)
     self._parent = parent
     self.path = path
     self.isFolder = False
     self.setForeground(0, QBrush(Qt.darkGray))
     project = loader.read_ninja_project(path)
     self.name = project.get('name', '')
     if self.name != '':
         self.setText(0, self.name)
     self.projectType = project.get('project-type', '')
     self.description = project.get('description', '')
     self.url = project.get('url', '')
     self.license = project.get('license', '')
     self.mainFile = project.get('mainFile', '')
     self.extensions = project.get('supported-extensions', manage_files.supported_extensions)
     self.pythonPath = project.get('pythonPath', resources.python_path)
Example #38
0
    def __init__(self, agent, parent = None):
        """
        Constructs AgentInstalledItem widget item

        @param Agent: {'type': 'textual', 'description': 'This Agent enables to retrieve file logs on real time.'}
        @type Agent: dict

        @param parent: 
        @type parent:

        @param root: 
        @type root: boolean
        """
        QTreeWidgetItem.__init__(self, parent)
        #
        self.dataAgent = agent
        self.setText(0, str(agent['type']) )
        self.setIcon(0, QIcon(":/agent.png") )
Example #39
0
    def __init__(self, key, parent = None, type = None ):
        """
        Constructs KeyItem widget item

        @param key:
        @type key: 

        @param parent:
        @type parent: 

        @param type:
        @type type: 
        """
        QTreeWidgetItem.__init__(self, parent)
        
        self.siz = len(key)
        self.setText( 0, unicode(key, "utf8") ) # wrap to str to support python3
        self.setKeyFont( type = type )
Example #40
0
    def __init__(self, probe, parent = None):
        """
        Constructs ProbeInstalledItem widget item

        @param probe: {'type': 'textual', 'description': 'This probe enables to retrieve file logs on real time.'}
        @type probe: dict

        @param parent: 
        @type parent:

        @param root: 
        @type root: boolean
        """
        QTreeWidgetItem.__init__(self, parent)
        #
        self.dataProbe = probe
        self.setText(0, str(probe['type']) )
        self.setIcon(0, QIcon(":/probe.png") )
Example #41
0
    def __init__(self, items):
        QTreeWidgetItem.__init__(self, items)
        self.__intColumn = len(items) - 1

        complexityValue = int(items[self.__intColumn])
        if complexityValue > PymetricsViewer.HighRiskLimit:
            self.setIcon(0, PixmapCache().getIcon('highriskcmpx.png'))
            self.setToolTip(0, 'Untestable, very high risk')
        elif complexityValue > PymetricsViewer.ModerateRiskLimit:
            self.setIcon(0, PixmapCache().getIcon('moderateriskcmpx.png'))
            self.setToolTip(0, 'Moderate risk')
        elif complexityValue > PymetricsViewer.LittleRiskLimit:
            self.setIcon(0, PixmapCache().getIcon('littleriskcmpx.png'))
            self.setToolTip(0, 'Little risk')
        else:
            self.setIcon(0, PixmapCache().getIcon('noriskcmpx.png'))
            self.setToolTip(0, 'No risk')
        return
Example #42
0
    def __init__(self, parent, csv_path):
        QTreeWidgetItem.__init__(self, parent)

        self._csv_path = csv_path
        self.widget = QWidget()
        self.widget.setLayout(QHBoxLayout())
        self.cb_enabled = QCheckBox()
        self.le_label = QLineEdit("")
        self.cb_graph_type = QComboBox()
        self.cb_graph_type.addItems(["NORMAL", "RATE", "DELTA"])

        self.widget.layout().addWidget(self.cb_enabled)
        self.widget.layout().addWidget(QLabel(os.path.basename(csv_path)))
        self.widget.layout().addWidget(QLabel("Label:"))
        self.widget.layout().addWidget(self.le_label)
        self.widget.layout().addWidget(QLabel("Type:"))
        self.widget.layout().addWidget(self.cb_graph_type)

        self.treeWidget().setItemWidget(self, 0, self.widget)
Example #43
0
    def __init__(self, agent, parent = None, root = False):
        """
        Constructs AgentItem widget item

        @param Agent: 
        @type Agent: dict

        @param parent: 
        @type parent:

        @param root: 
        @type root: boolean
        """
        QTreeWidgetItem.__init__(self, parent)
        
        self.dataAgent = agent
        self.setText(   COL_DEF_ENABLED         , str( bool(eval(agent['enable'])))             )
        self.setText(   COL_DEF_NAME            , str(agent['name'])                )
        self.setText(   COL_DEF_TYPE            , str(agent['type'])                )
        self.setText(   COL_DEF_DESCRIPTION     , str(agent['description'])         )
Example #44
0
    def __init__(self, probe, parent = None, root = False):
        """
        Constructs ProbeItem widget item

        @param probe: 
        @type probe: dict

        @param parent: 
        @type parent:

        @param root: 
        @type root: boolean
        """
        QTreeWidgetItem.__init__(self, parent)
        
        self.dataProbe = probe
        self.setText(   COL_DEF_ENABLED         , str( bool(eval(probe['enable'])))             )
        self.setText(   COL_DEF_NAME            , str(probe['name'])                )
        self.setText(   COL_DEF_TYPE            , str(probe['type'])                )
        self.setText(   COL_DEF_DESCRIPTION     , str(probe['description'])         )
Example #45
0
    def __init__(self, parent, tree, name, value, action=None):
        QTreeWidgetItem.__init__(self, parent)
        self.parent = parent
        self.tree = tree
        self.name = name
        self._value = value
        self.combo = None
        self.setText(0, name)
        widget = None

        if isinstance(value, bool):
            if value:
                self.setCheckState(1, Qt.Checked)
            else:
                self.setCheckState(1, Qt.Unchecked)
        elif isinstance(value, tuple):
            self.combo = QComboBox()
            self.combo.setSizeAdjustPolicy(0)
            for option in value:
                self.combo.addItem(option)
            widget = self.combo
        else:
            self.setText(1, unicode(value))

        if action:
            layout = QHBoxLayout()
            layout.setMargin(0)
            if widget:
                layout.addWidget(widget)
            button = QToolButton()
            button.setDefaultAction(action)
            button.setText(action.text())
            layout.addWidget(button)
            layout.addStretch(1)
            widget = QWidget()
            widget.setLayout(layout)

        if widget:
            self.tree.setItemWidget(self, 1, widget)
Example #46
0
    def __init__(self, param, parent=None):
        """
        Constructs ParamItem widget item

        @param param: 
        @type param: dict

        @param parent: 
        @type parent:
        """
        QTreeWidgetItem.__init__(self, parent)
        if 'network' in param:
            self.parseNetworkKey(param)
        elif 'test-environment' in param:
            self.parseTestEnvironment(param)
        elif 'projects' in param:
            self.parseProjects(param)
        else:
            self.setText(0, str(list(
                param.keys())[0].title()))  # wrap to list for python3 support
            self.setText(1, str(list(
                param.values())[0]))  # wrap to list for python3 support
Example #47
0
 def __init__(self, parent, _name, path):
     QTreeWidgetItem.__init__(self, parent)
     self._parent = parent
     self.setText(0, _name)
     self.path = path
     self.isFolder = True
     self.setForeground(0, QBrush(Qt.darkGray))
     project = json_manager.read_ninja_project(path)
     self.name = project.get('name', '')
     if self.name == '':
         self.name = _name
     self.setText(0, self.name)
     self.projectType = project.get('project-type', '')
     self.description = project.get('description', '')
     self.url = project.get('url', '')
     self.license = project.get('license', '')
     self.mainFile = project.get('mainFile', '')
     self.extensions = project.get('supported-extensions',
         settings.SUPPORTED_EXTENSIONS)
     self.pythonPath = project.get('pythonPath', settings.PYTHON_PATH)
     self.programParams = project.get('programParams', '')
     self.venv = project.get('venv', '')
     self.addedToConsole = False
Example #48
0
    def __init__(self,
                 description,
                 fileName="",
                 lineNumber=0,
                 completed=False,
                 isFixme=False):

        self.__completed = completed
        self.__description = description
        self.__filename = fileName
        self.__lineno = lineNumber
        self.__isfixme = isFixme

        QTreeWidgetItem.__init__(self, [
            "", self.__filename,
            (self.__lineno and "%6d" % self.__lineno or ""), self.__description
        ])

        self.setCompleted(completed)
        self.colorizeTask()

        # Alignment for the line number column
        self.setTextAlignment(2, Qt.AlignRight)
        return
Example #49
0
    def __init__( self, items, isOutside, funcIDs ):
        QTreeWidgetItem.__init__( self, items )

        self.__isOutside = isOutside
        self.__funcIDs = funcIDs

        # Set the first column icon
        if isOutside:
            self.setIcon( OUTSIDE_COL_INDEX,
                          PixmapCache().getIcon( 'nonprojectentry.png' ) )
            self.setToolTip( OUTSIDE_COL_INDEX,
                             'Record of an outside function' )
        else:
            self.setIcon( OUTSIDE_COL_INDEX,
                          PixmapCache().getIcon( 'empty.png' ) )
            self.setToolTip( OUTSIDE_COL_INDEX, '' )

        # Set the function name tooltip
        fileName = self.getFileName()
        lineNumber = self.getLineNumber()
        if fileName != "" and lineNumber != 0:
            self.setToolTip( NAME_COL_INDEX,
                             GlobalData().getFileLineDocstring( fileName,
                                                                lineNumber ) )


        # Sets the location/name columns
        self.updateLocation( False )
        self.setText( NAME_COL_INDEX, self.getFunctionName() )

        for column in [ CALLS_COL_INDEX, TOTALPERCALL_COL_INDEX,
                        CUM_COL_INDEX, CUMPERCALL_COL_INDEX,
                        CALLERS_COL_INDEX, CALLEES_COL_INDEX ]:
            self.setTextAlignment( column, Qt.AlignRight )
        self.setTextAlignment( TOTAL_COL_INDEX, Qt.AlignLeft )
        return
Example #50
0
    def __init__(self, task, parent = None):
        """
        Constructs TaskItem widget item

        @param task: 
        @type task: list

        @param parent: 
        @type parent:
        """
        QTreeWidgetItem.__init__(self, parent)
        
        self.taskData = task
        self.taskId = task['id']
        self.taskState = None
        
        self.setText(COL_RUNNING_ID, str( task['id'] ) )
        self.setText(COL_RUNNING_PROJECT, instance().getProjectName(task['project-id']) )
        self.setText(COL_RUNNING_NAME, str(task['name']) )
        self.setText(COL_RUNNING_START, formatTimestamp( task['start-at'] )  ) 
        self.setText(COL_RUNNING_AUTHOR, str( task['user'] ) )
        self.setText(COL_RUNNING_RECURSIVE, str( task['recursive'] ) )
        
        self.setStateIcon( state=str(task['state']) )
Example #51
0
 def __init__(self, name, line, parent, preceding):
     if preceding is None:
         QTreeWidgetItem.__init__(self, parent, QTreeWidgetItem.Type)
     else:
         if preceding is not parent:
             # Preceding must be either the same as item's parent
             # or have the same parent as item
             while preceding.parent() is not parent:
                 preceding = preceding.parent()
                 if preceding is None:
                     break
         if preceding is None:
             QTreeWidgetItem.__init__(self, parent, QTreeWidgetItem.Type)
         else:
             QTreeWidgetItem.__init__(self, parent, preceding,
                                      QTreeWidgetItem.Type)
     self.setText(0, name)
     parent_text = from_qvariant(parent.data(0, Qt.UserRole), unicode)
     set_item_user_text(self, parent_text + '/' + name)
     self.line = line
Example #52
0
 def __init__(self, action):
     QTreeWidgetItem.__init__(self)
     self.action = action
     self.setText(0, action.name)
     self.setIcon(0, action.getIcon())
Example #53
0
 def __init__(self, parent=None):
     """initialize a node"""
     QTreeWidgetItem.__init__(self, parent)
     self.__item = None
Example #54
0
    def __init__(self, item):
        QTreeWidgetItem.__init__(self, type=QTreeWidgetItem.UserType)

        self.item = None
        self.setUpdateItem(item)
Example #55
0
 def __init__(self, description, name):
     QTreeWidgetItem.__init__(self)
     self.name = name
     self.description = description
     self.setText(0, description)
Example #56
0
 def __init__(self, parent, names, dir_name_root):
     QTreeWidgetItem.__init__(self, parent, names)
     self.dir_name_root = dir_name_root
Example #57
0
 def __init__(self, parent, *args):
     QTreeWidgetItem.__init__(self, parent, *args)
     self.par = parent
Example #58
0
 def __init__(self, parent, name, path):
     QTreeWidgetItem.__init__(self, parent)
     self.setText(0, name)
     self.path = path
     self.isFolder = False
Example #59
0
    def __init__(self, parent, component):
        QTreeWidgetItem.__init__(self, parent)
        self.component = component

        self.setCheckState(0, Qt.Unchecked)
        self.setText(0, component)
Example #60
0
 def __init__(self, providerName):
     QTreeWidgetItem.__init__(self)
     self.providerName = providerName
     self.provider = Processing.getProviderFromName(providerName)
     self.setIcon(0, self.provider.getIcon())
     self.populate()