示例#1
0
    def checkForChanges(self):
        gm = InstanceObject(**self.attributes)
        self.gmEditor.applyChanges(gm)
        changed = False

        for attr in self.attributes:
            if getattr(gm, attr) != self.attributes[attr]:
                if str(getattr(gm, attr)) != str(self.attributes[attr]):
                    changed = True
                    break

        #check if continents or ratios changed
        if not changed and hasattr(self.gmEditor, 'continents'):
            if self.continents is None:
                if self.gmEditor.continents.currentIndex() != 0:
                    changed = True
            elif self.continents != self.gmEditor.continents.currentIndex(
            ) + 1:
                changed = True

            if self.ratio is None:
                if self.gmEditor.getAspectRatio() != 'autot':
                    changed = True
            elif self.ratio != self.gmEditor.getAspectRatio():
                changed = True

        return changed
示例#2
0
    def getFunctionUpdates(self):
        functions = []
        gm = InstanceObject(**self.attributes)
        self.gmEditor.applyChanges(gm)

        for attr in self.attributes:
            newval = getattr(gm, attr)
            if newval != self.attributes[attr]:
                functions.append((attr, [str(getattr(gm, attr))]))
                self.attributes[attr] = newval

        # FIXME why can't these be rolled in with self.attributes?
        #continents
        if hasattr(self.gmEditor, 'continents'):
            gui_continent = self.gmEditor.continents.currentIndex() + 1
            if self.continents is None or gui_continent != self.continents:
                functions.append(('continents', [str(gui_continent)]))
                self.continents = gui_continent

        # aspect ratio
        gui_ratio = self.gmEditor.getAspectRatio()
        if self.ratio is None or gui_ratio != self.ratio:
            functions.append(('ratio', [str(gui_ratio)]))
            self.ratio = gui_ratio

        return functions
示例#3
0
    def updateVistrail(self):
        functions = []
        gm = InstanceObject(**self.attributes)
        self.gmEditor.applyChanges(gm)
        pipeline = self.controller.vistrail.getPipeline(
            self.controller.current_version)
        # maybe this module was just added by the user in the gui and it was not
        # added to the pipeline yet. So we need to add it before updating the
        # functions
        action1 = None
        if self.module.id not in pipeline.modules:
            ops = [('add', self.module)]
            action1 = core.db.action.create_action(ops)
            self.controller.add_new_action(action1)
            self.controller.perform_action(action1)
        for attr in self.attributes:
            newval = getattr(gm, attr)
            if newval != self.attributes[attr]:
                functions.append((attr, [str(getattr(gm, attr))]))
                self.attributes[attr] = newval

        #continents
        if hasattr(self.gmEditor, 'continents'):
            gui_continent = self.gmEditor.continents.currentIndex() + 1
            if self.continents is None:
                func_obj = self.controller.create_function(
                    self.module, 'continents', [str(gui_continent)])
                action1 = self.controller.add_function_action(
                    self.module, func_obj)
                self.continents = gui_continent
            elif gui_continent != self.continents:
                functions.append(('continents', [str(gui_continent)]))
                self.continents = gui_continent

        # aspect ratio
        gui_ratio = self.gmEditor.getAspectRatio()
        if self.ratio is None:
            func_obj = self.controller.create_function(self.module, 'ratio',
                                                       [str(gui_ratio)])
            action1 = self.controller.add_function_action(
                self.module, func_obj)
            self.ratio = gui_ratio
        elif gui_ratio != self.ratio:
            functions.append(('ratio', [str(gui_ratio)]))
            self.ratio = gui_ratio

        action = self.controller.update_functions(self.module, functions)

        if action is None:
            action = action1
        return (action, True)
示例#4
0
    def setupEditors(self):
        gm = InstanceObject(**self.attributes)
        self.gmEditor.initValues(gm)

        #set continent
        self.continents = self.getValueFromFunction('continents')
        if self.continents:
            self.gmEditor.continents.setCurrentIndex(self.continents - 1)

        #set aspect ratio
        self.ratio = self.getValueFromFunction('ratio')

        #taylor diagram does not have aspectAuto
        if hasattr(self.gmEditor, 'aspectAuto'):
            if self.ratio is None or self.ratio == 'autot':
                self.gmEditor.aspectAuto.setCheckState(Qt.Checked)
            else:
                #if the ratio cannot cast to float, check auto in gui
                try:
                    self.gmEditor.aspectRatio.setText(str(float(self.ratio)))
                    self.gmEditor.aspectAuto.setCheckState(Qt.Unchecked)
                except ValueError:
                    self.gmEditor.aspectAuto.setCheckState(Qt.Checked)
示例#5
0
def initialize():
    """ initialize() -> None
    Package-entry to initialize the package
    
    """
    # Check VTK version
    v = vtksnl.vtkVersion()
    version = [v.GetVTKMajorVersion(),
               v.GetVTKMinorVersion(),
               v.GetVTKBuildVersion()]
    if version < [5, 0, 0]:
        raise Exception("You need to upgrade your VTK install to version \
        > >= 5.0.0")
    inheritanceGraph = ClassTree(vtksnl)
    inheritanceGraph.create()

    # Transfer Function constant
    tf_widget.initialize()

    delayed = InstanceObject(add_input_port=[])
    # Add VTK modules
    registry = get_module_registry()
    registry.add_module(vtkBaseModule)
    createAllModules(inheritanceGraph)
    setAllPorts(registry.get_descriptor_by_name(identifier,
                                                'vtkObjectBase'),
                delayed)

    # Register the VTKCell and VTKHandler type if the spreadsheet is up
    if registry.has_module('edu.utah.sci.vistrails.spreadsheet',
                           'SpreadsheetCell'):
        import vtkhandler
        import vtkcell
        import vtkviewcell
        vtkhandler.registerSelf()
        vtkcell.registerSelf()
        vtkviewcell.registerSelf()

    # register offscreen rendering module
    offscreen.register_self()

    # Now add all "delayed" ports - see comment on addSetGetPorts
    for args in delayed.add_input_port:
        
        registry.add_input_port(*args)

    # register Transfer Function adjustment
    # This can't be reordered -- TransferFunction needs to go before
    # vtkVolumeProperty, but vtkScaledTransferFunction needs
    # to go after vtkAlgorithmOutput
    
    getter = registry.get_descriptor_by_name
    registry.add_module(tf_widget.vtkScaledTransferFunction)
    registry.add_input_port(tf_widget.vtkScaledTransferFunction,
                            'Input', getter('edu.utah.sci.vistrails.vtksnl',
                                            'vtkAlgorithmOutput').module)
    registry.add_input_port(tf_widget.vtkScaledTransferFunction,
                            'Dataset', getter ('edu.utah.sci.vistrails.vtksnl',
                                               'vtkDataObject').module)
    registry.add_input_port(tf_widget.vtkScaledTransferFunction,
                            'Range', [Float, Float])
    registry.add_input_port(tf_widget.vtkScaledTransferFunction,
                            'TransferFunction',
                            tf_widget.TransferFunctionConstant)
    registry.add_output_port(tf_widget.vtkScaledTransferFunction,
                             'TransferFunction',
                             tf_widget.TransferFunctionConstant)
    inspectors.initialize()
示例#6
0
    def displayCell(self, res30, row, column, sheet="Sheet 1", dropInfo=True):
        """Display result into one cell defined by row/col args"""
        import pdb
        projectController = self.parent().get_current_project_controller()
        if dropInfo:
            projectController.get_sheet_widget(sheet).deleteCell(row, column)
        projectController.enable_animation = False  # I (JfP) don't know why I need this, it didn't
        # used to be necessary.
        if res30 is None:
            return
        if not hasattr(
                res30, 'presentation'
        ) or res30.presentation is None or res30.presentation is "text":
            return
        pvars = res30.vars
        labels = res30.labels
        title = res30.title
        presentation = res30.presentation
        Gtype = res30.type
        if Gtype == "Taylor":
            Gtype = "Taylordiagram"

        pm = projectController.plot_manager
        VCS_LIST = pm._plot_list["VCS"]
        gm = res30.presentation
        from packages.uvcdat_cdms.init import get_canvas, get_gm_attributes, original_gm_attributes
        from gui.uvcdat.uvcdatCommons import gmInfos

        if False:  # standard diagnostics prints:
            print "pvars:", [p.id for p in pvars]
            print "labels:", labels
            print "title:", title
            print "presentation:", presentation
            print "x min,max:", getattr(presentation, 'datawc_x1',
                                        None), getattr(presentation,
                                                       'datawc_x2', None)
            print "y min,max:", getattr(presentation, 'datawc_y1',
                                        None), getattr(presentation,
                                                       'datawc_y2', None)
            print "res", res30.type

        #define where to drag and drop
        import cdms2
        from packages.uvcdat_cdms.init import CDMSVariable
        from core.utils import InstanceObject
        from metrics.frontend.uvcdat import diagnostics_template
        tm = diagnostics_template()  # template name is 'diagnostic'
        if dropInfo:
            tmplDropInfo = ('diagnostic', sheet, row, column)
            projectController.template_was_dropped(tmplDropInfo)

        if Gtype == 'Vector':
            pvars = pvars[0]
        for varindex, V in enumerate(pvars):
            if Gtype != 'Vector':
                V.title = title  # VCS looks the title of the variable, not the plot.
                V.long_name = V.title  # VCS overrides title with long_name!

            # Until I know better storing vars in tempfile....
            f = tempfile.NamedTemporaryFile()
            filename = f.name
            f.close()
            value = 0
            cdms2.setNetcdfShuffleFlag(value)  ## where value is either 0 or 1
            cdms2.setNetcdfDeflateFlag(value)  ## where value is either 0 or 1
            cdms2.setNetcdfDeflateLevelFlag(
                value)  ## where value is a integer between 0 and 9 included
            fd = cdms2.open(filename, "w")
            fd.write(V)
            fd.close()
            cdmsFile = cdms2.open(filename)
            #define name of variable to appear in var widget
            if Gtype == 'Vector':
                name_in_var_widget = V[0].id
            else:
                name_in_var_widget = V.id
            #get uri if exists
            url = None
            if hasattr(cdmsFile, 'uri'):
                url = cdmsFile.uri
            #create vistrails module
            cdmsVar = CDMSVariable(filename=cdmsFile.id,
                                   url=url,
                                   name=name_in_var_widget,
                                   varNameInFile=name_in_var_widget)  #V.id)
            #get variable widget and project controller
            definedVariableWidget = self.parent().dockVariable.widget()
            #add variable to display widget and controller
            definedVariableWidget.addVariable(V)
            projectController.add_defined_variable(cdmsVar)

            # simulate drop variable
            varDropInfo = (name_in_var_widget, sheet, row, column)
            projectController.variable_was_dropped(varDropInfo)

            # Trying to add method to plot list....
            #from gui.application import get_vistrails_application
            #_app = get_vistrails_application()
            #d = _app.uvcdatWindow.dockPlot
            # simulate drop plot

            G = VCS_LIST[Gtype]
            if not gm.name in G.keys():
                G[gm.name] = pm._registry.add_plot(gm.name, "VCS", None, None,
                                                   Gtype)
                G[gm.name].varnum = int(gmInfos[Gtype]["nSlabs"])

            #add initial attributes to global dict
            canvas = get_canvas()
            method_name = "get" + Gtype.lower()
            attributes = get_gm_attributes(Gtype)

            attrs = {}
            for attr in attributes:
                attrs[attr] = getattr(gm, attr)
            original_gm_attributes[Gtype][gm.name] = InstanceObject(**attrs)

            if Gtype in ["Scatter", "Vector"] and varindex == 0:
                #to plot a scatter plot or vector plot, requires both axes passed to plotspec.
                #so dont plot the 1st one until the 2nd variable is processed.
                pass
            else:
                # simulate drop plot
                plot = projectController.plot_manager.new_plot(
                    'VCS', Gtype, gm.name)
                #plot = projectController.plot_manager.new_plot('VCS', Gtype, "default" )
                plotDropInfo = (plot, sheet, row, column)
                projectController.plot_was_dropped(plotDropInfo)
示例#7
0
 def translate_to_python(x):
     return InstanceObject(
         tuple=tuple([float(a) for a in x.split(',')]))
示例#8
0
class Color(Constant):
    # We set the value of a color object to be an InstanceObject that
    # contains a tuple because a tuple would be interpreted as a
    # type(tuple) which messes with the interpreter

    def __init__(self):
        Constant.__init__(self)
    
    default_value = InstanceObject(tuple=(1,1,1))
        
    @staticmethod
    def translate_to_python(x):
        return InstanceObject(
            tuple=tuple([float(a) for a in x.split(',')]))

    @staticmethod
    def translate_to_string(v):
        return str(v.tuple)[1:-1]

    @staticmethod
    def validate(x):
        return type(x) == InstanceObject and hasattr(x, 'tuple')

    @staticmethod
    def to_string(r, g, b):
        return "%s,%s,%s" % (r,g,b)

    @staticmethod
    def get_widget_class():
        return ("gui.modules.constant_configuration", "ColorWidget")
        
    @staticmethod
    def get_query_widget_class():
        return ("gui.modules.query_configuration", "ColorQueryWidget")

    @staticmethod
    def get_param_explore_widget_list():
        return [('gui.modules.paramexplore', 'RGBExploreWidget'),
                ('gui.modules.paramexplore', 'HSVExploreWidget')]

    @staticmethod
    def query_compute(value_a, value_b, query_method):
        # SOURCE: http://www.easyrgb.com/index.php?X=MATH
        def rgb_to_xyz(r, g, b):
            # r,g,b \in [0,1]

            if r > 0.04045: 
                r = ( ( r + 0.055 ) / 1.055 ) ** 2.4
            else:
                r = r / 12.92
            if g > 0.04045:
                g = ( ( g + 0.055 ) / 1.055 ) ** 2.4
            else:
                g = g / 12.92
            if b > 0.04045: 
                b = ( ( b + 0.055 ) / 1.055 ) ** 2.4
            else:
                b = b / 12.92

            r *= 100
            g *= 100
            b *= 100

            # Observer. = 2 deg, Illuminant = D65
            x = r * 0.4124 + g * 0.3576 + b * 0.1805
            y = r * 0.2126 + g * 0.7152 + b * 0.0722
            z = r * 0.0193 + g * 0.1192 + b * 0.9505
            return (x,y,z)

        def xyz_to_cielab(x,y,z):
            # Observer= 2 deg, Illuminant= D65
            ref_x, ref_y, ref_z = (95.047, 100.000, 108.883)
            x /= ref_x
            y /= ref_y
            z /= ref_z

            if x > 0.008856:
                x = x ** ( 1/3.0 )
            else:                    
                x = ( 7.787 * x ) + ( 16 / 116.0 )
            if y > 0.008856:
                y = y ** ( 1/3.0 )
            else:
                y = ( 7.787 * y ) + ( 16 / 116.0 )
            if z > 0.008856: 
                z = z ** ( 1/3.0 )
            else:
                z = ( 7.787 * z ) + ( 16 / 116.0 )

            L = ( 116 * y ) - 16
            a = 500 * ( x - y )
            b = 200 * ( y - z )
            return (L, a, b)

        def rgb_to_cielab(r,g,b):
            return xyz_to_cielab(*rgb_to_xyz(r,g,b))
        
        value_a_rgb = (float(a) for a in value_a.split(','))
        value_b_rgb = (float(b) for b in value_b.split(','))
        value_a_lab = rgb_to_cielab(*value_a_rgb)
        value_b_lab = rgb_to_cielab(*value_b_rgb)
        
        # cie76 difference
        diff = sum((v_1 - v_2) ** 2 
                   for v_1, v_2 in izip(value_a_lab, value_b_lab)) ** (0.5)

        # print "CIE 76 DIFFERENCE:", diff
        if query_method is None:
            query_method = '2.3'
        return diff < float(query_method)
 def __init__(self, *args, **kwargs):
     InstanceObject.__init__(self, *args, **kwargs)
     self.__subscribers__ = {}
示例#10
0
    def init(self, optionsDict=None):
        """ VistrailsApplicationSingleton(optionDict: dict)
                                          -> VistrailsApplicationSingleton
        Create the application with a dict of settings
        
        """
        # gui.theme.initializeCurrentTheme()
        # self.connect(self, QtCore.SIGNAL("aboutToQuit()"), self.finishSession)

        # This is the persistent configuration
        # Setup configuration to default
        self.configuration = core.configuration.default()

        self.keyChain = keychain.KeyChain()
        self.setupOptions()

        # self.temp_configuration is the configuration that will be updated
        # with the command line and custom options dictionary.
        # We have to do this because we don't want to make these settings
        # persistent. This is the actual VisTrails current configuration
        self.temp_configuration = copy.copy(self.configuration)

        core.interpreter.default.connect_to_configuration(
            self.temp_configuration)

        # now we want to open vistrails and point to a specific version
        # we will store the version in temp options as it doesn't
        # need to be persistent. We will do the same to database
        # information passed in the command line
        self.temp_db_options = InstanceObject(host=None,
                                              port=None,
                                              db=None,
                                              user=None,
                                              vt_id=None,
                                              parameters=None)

        # Read only new .vistrails folder option if passed in the command line
        # or in the optionsDict because this may affect the configuration file
        # VistrailsStartup will load. This updates self.temp_configuration
        self.read_dotvistrails_option()

        if optionsDict and 'dotVistrails' in optionsDict.keys():
            self.temp_configuration.dotVistrails = optionsDict['dotVistrails']

        # the problem here is that if the user pointed to a new .vistrails
        # folder, the persistent configuration will always point to the
        # default ~/.vistrails. So we will copy whatever it's on
        # temp_configuration to the persistent one. In case the configuration
        # that is on disk is different, it will overwrite this one
        self.configuration.dotVistrails = self.temp_configuration.dotVistrails

        # During this initialization, VistrailsStartup will load the
        # configuration from disk and update both configurations
        self.vistrailsStartup = \
            core.startup.VistrailsStartup(self.configuration,
                                          self.temp_configuration)

        # Starting in version 1.2.1 logging is enabled by default.
        # Users have to explicitly disable it through the command-line
        self.configuration.nologger = False
        self.temp_configuration.nologger = False

        if optionsDict:
            for (k, v) in optionsDict.iteritems():
                setattr(self.temp_configuration, k, v)

        # Command line options override temp_configuration
        self.readOptions()

        # Redirect console output
        if self.temp_configuration.output != "":
            #place in dotVistrails dir if no path detected
            if os.path.split(self.temp_configuration.output)[0] == '':
                self.temp_configuration.output = os.path.join(
                    self.configuration.dotVistrails,
                    self.temp_configuration.output)
            try:
                sys.stdout = sys.stderr = open(self.temp_configuration.output,
                                               "w")
            except (Exception):
                print "Failed to redirect output to file: %s" % self.temp_configuration.output
                print Exception.message

        if self.temp_configuration.check('staticRegistry'):
            reg = self.temp_configuration.staticRegistry
        else:
            reg = None
        self.vistrailsStartup.set_registry(reg)
示例#11
0
    def readOptions(self):
        """ readOptions() -> None
        Read arguments from the command line
        
        """
        #print self
        #print self.__class__
        get = command_line.CommandLineParser().get_option
        self.uvcdatLoadFileStart = get('uvcdat_filename')
        self.uvcdatLoadVariableStart = get('uvcdat_var')
        if get('nosplash') != None:
            self.temp_configuration.showSplash = bool(get('nosplash'))
        if get('debugsignals') != None:
            self.temp_configuration.debugSignals = bool(get('debugsignals'))
        if get('dotVistrails') != None:
            self.temp_configuration.dotVistrails = get('dotVistrails')
        #in theory this should never happen because core.configuration.default()
        #should have done this already
        #if not self.configuration.check('dotVistrails'):
        #    self.configuration.dotVistrails = system.default_dot_vistrails()
        #    self.temp_configuration.dotVistrails = system.default_dot_vistrails()
        if get('multiheads') != None:
            self.temp_configuration.multiHeads = bool(get('multiheads'))
        if get('maximized') != None:
            self.temp_configuration.maximizeWindows = bool(get('maximized'))
        if get('movies') != None:
            self.temp_configuration.showMovies = bool(get('movies'))
        if get('cache') != None:
            self.temp_configuration.useCache = bool(get('cache'))
        if get('verbose') != None:
            self.temp_configuration.verbosenessLevel = get('verbose')
        if get('fixedcells') != None:
            self.temp_configuration.fixedSpreadsheetCells = str(
                get('fixedcells'))
        if get('noninteractive') != None:
            self.temp_configuration.interactiveMode = \
                                                  not bool(get('noninteractive'))
            if get('workflowinfo') != None:
                self.temp_configuration.workflowInfo = str(get('workflowinfo'))
            if get('dumpcells') != None:
                self.temp_configuration.spreadsheetDumpCells = get('dumpcells')
            if get('pdf') != None:
                self.temp_configuration.spreadsheetDumpPDF = get('pdf')
            if get('workflowgraph') != None:
                self.temp_configuration.workflowGraph = str(
                    get('workflowgraph'))
            if get('evolutiongraph') != None:
                self.temp_configuration.evolutionGraph = str(
                    get('evolutiongraph'))
        if get('executeworkflows') != None:
            self.temp_configuration.executeWorkflows = \
                                            bool(get('executeworkflows'))
        if get('showspreadsheetonly') != None:
            self.temp_configuration.showSpreadsheetOnly = \
                                            bool(get('showspreadsheetonly'))
            # asking to show only the spreadsheet will force the workflows to
            # be executed
            if get('reviewmode') != None:
                self.temp_configuration.reviewMode = bool(get('reviewmode'))

            if self.temp_configuration.showSpreadsheetOnly and not self.temp_configuration.reviewMode:
                self.temp_configuration.executeWorkflows = True

        self.temp_db_options = InstanceObject(host=get('host'),
                                              port=get('port'),
                                              db=get('db'),
                                              user=get('user'),
                                              parameters=get('parameters'))
        if get('nologger') != None:
            self.temp_configuration.nologger = bool(get('nologger'))
        if get('quickstart') != None:
            self.temp_configuration.staticRegistry = str(get('quickstart'))
        if get('detachHistoryView') != None:
            self.temp_configuration.detachHistoryView = bool(
                get('detachHistoryView'))
        if get('noSingleInstance') != None:
            self.temp_configuration.singleInstance = not bool(
                get('noSingleInstance'))
        if get('noDebugPopups') != None:
            self.temp_configuration.noDebugPopups = bool(get('noDebugPopups'))
        if get('time') != None:
            self.temp_configuration.time = get("time")
        if get('testUVCDAT') != None:
            self.temp_configuration.testUVCDAT = bool(get("testUVCDAT"))
        if get('cdatSourceDir') != None:
            self.temp_configuration.cdatSourceDir = get("cdatSourceDir")
        self.temp_configuration.specificTest = get("specificTest")
        if get('output') != None:
            self.temp_configuration.output = get("output")
        if get('noErrorReporting') != None:
            self.temp_configuration.noErrorReporting = bool(
                get('noErrorReporting'))
        self.input = command_line.CommandLineParser().positional_arguments()
示例#12
0
    def updateFromPipeline(self, pipeline):
        """ updateFromPipeline(pipeline: Pipeline) -> None
        Read the list of aliases and parameters from the pipeline
        
        """
        self.clear()
        if not pipeline:
            return

        # Update the aliases


#        if len(pipeline.aliases)>0:
#            aliasRoot = QParameterTreeWidgetItem(None, self,
#                                                 QtCore.QStringList('Aliases'))
#            aliasRoot.setFlags(QtCore.Qt.ItemIsEnabled,
#                               )
#            for (alias, info) in pipeline.aliases.iteritems():
#                ptype, pId, parentType, parentId, _ = info
#                parameter = pipeline.db_get_object(ptype, pId)
#                v = parameter.strValue
#                aType = parameter.type
#                aIdentifier = parameter.identifier
#                aNamespace = parameter.namespace
#                label = QtCore.QStringList('%s = %s' % (alias, v))
#                pInfo = InstanceObject(type=aType,
#                                      identifier=aIdentifier,
#                                      namespace=aNamespace,
#                                      value=v,
#                                      id=pId,
#                                      dbtype=ptype,
#                                      parent_dbtype=parentType,
#                                      parent_id=parentId,
#                                      is_alias=True)
#                aliasItem = QParameterTreeWidgetItem((alias, [pInfo]),
#                                                     aliasRoot, label)
#            aliasRoot.setExpanded(True)

# Now go through all modules and functions
        self.aliasNames = pipeline.aliases.keys()
        inspector = PipelineInspector()
        inspector.inspect_ambiguous_modules(pipeline)
        sortedModules = sorted(pipeline.modules.iteritems(),
                               key=lambda item: item[1].name)
        for mId, module in sortedModules:
            if len(module.functions) > 0:
                mLabel = QtCore.QStringList(module.name)
                moduleItem = None
                for fId in xrange(len(module.functions)):
                    function = module.functions[fId]
                    if len(function.params) == 0: continue
                    if moduleItem == None:
                        if inspector.annotated_modules.has_key(mId):
                            annotatedId = inspector.annotated_modules[mId]
                            moduleItem = QAliasParameterTreeWidgetItem(
                                annotatedId, self, mLabel)
                        else:
                            moduleItem = QAliasParameterTreeWidgetItem(
                                None, self, mLabel)
                    #v = ', '.join([p.strValue for p in function.params])
                    label = QtCore.QStringList('%s' % function.name)

                    pList = [
                        InstanceObject(
                            type=function.params[pId].type,
                            identifier=function.params[pId].identifier,
                            namespace=function.params[pId].namespace,
                            value=function.params[pId].strValue,
                            id=function.params[pId].real_id,
                            dbtype=ModuleParam.vtType,
                            parent_dbtype=function.vtType,
                            parent_id=function.real_id,
                            alias=function.params[pId].alias,
                            mId=mId) for pId in xrange(len(function.params))
                    ]
                    mName = module.name
                    if moduleItem.parameter != None:
                        mName += '(%d)' % moduleItem.parameter
                    fName = '%s :: %s' % (mName, function.name)
                    mItem = QAliasParameterTreeWidgetItem((fName, pList),
                                                          moduleItem, label)
                if moduleItem:
                    moduleItem.setExpanded(True)