Exemple #1
0
def contentContext(request, project):
    from pyworkflow.gui.tree import ProjectRunsTreeProvider

    projectName = project.getShortName()
    print "ProjectName: ", projectName
    project_settings = project.getSettings()
    request.session['projectPath'] = project.getPath()
    request.session['projectName'] = projectName

    provider = ProjectRunsTreeProvider(project)
    runs = formatProvider(provider, "runs")
    request.session['runs'] = runs

    # Get the selected runs stored in BD
    selectedRuns = project_settings.runSelection

    # Get the run mode view (0:list / 1:graph / 2:small graph) stored in BD
    runsView = project_settings.runsView.get()

    # load the protocol tree current active
    htmlTree = loadProtTree(project)

    # get the choices to load protocol trees
    choices = project.getProtocolViews()

    # get the choice current
    choiceSelected = choices.index(project.getCurrentProtocolView().text.get())

    # show the project name in the header.html
    projectNameHeader = 'Project ' + str(projectName)

    context = {
        'projectName': projectName,
        'view': 'protocols',
        'editTool': getResourceIcon('edit_toolbar'),
        'copyTool': getResourceIcon('copy_toolbar'),
        'deleteTool': getResourceIcon('delete_toolbar'),
        'browseTool': getResourceIcon('browse_toolbar'),
        'stopTool': getResourceIcon('stop_toolbar'),
        'analyzeTool': getResourceIcon('analyze_toolbar'),
        'treeTool': getResourceIcon('tree_toolbar'),
        'listTool': getResourceIcon('list_toolbar'),
        'graph_utils': getResourceJs('graph_utils'),
        'project_content_utils': getResourceJs('project_content_utils'),
        'jquery_cookie': getResourceJs('jquery_cookie'),
        'jquery_treeview': getResourceJs('jquery_treeview'),
        'project_content_css': getResourceCss('project_content'),
        'protTreeHtml': htmlTree,
        'choices': choices,
        'choiceSelected': choiceSelected,
        'runs': runs,
        'columns': provider.getColumns(),
        'projectNameHeader': projectNameHeader,
        'runsView': runsView,
        'selectedRuns': selectedRuns
    }

    context = base_flex(request, context)

    return context
Exemple #2
0
def contentContext(request, project):
    from pyworkflow.gui.tree import ProjectRunsTreeProvider
    
    projectName = project.getShortName()
    print "ProjectName: ", projectName
    project_settings = project.getSettings()
    request.session['projectPath'] = project.getPath()
    request.session['projectName'] = projectName
    
    provider = ProjectRunsTreeProvider(project)
    runs = formatProvider(provider, "runs")
    request.session['runs'] = runs

    # Get the selected runs stored in BD    
    selectedRuns = project_settings.runSelection

    # Get the run mode view (0:list / 1:graph / 2:small graph) stored in BD
    runsView = project_settings.runsView.get()
        
    # load the protocol tree current active
    htmlTree = loadProtTree(project)
    
    # get the choices to load protocol trees
    choices = project.getProtocolViews()

    # get the choice current 
    choiceSelected =  choices.index(project.getCurrentProtocolView().text.get())
    
    # show the project name in the header.html
    projectNameHeader = 'Project '+ str(projectName)
    
    context = {'projectName': projectName,
               'view':'protocols',
               'editTool': getResourceIcon('edit_toolbar'),
               'copyTool': getResourceIcon('copy_toolbar'),
               'deleteTool': getResourceIcon('delete_toolbar'),
               'browseTool': getResourceIcon('browse_toolbar'),
               'stopTool': getResourceIcon('stop_toolbar'),
               'analyzeTool': getResourceIcon('analyze_toolbar'),
               'treeTool': getResourceIcon('tree_toolbar'),
               'listTool': getResourceIcon('list_toolbar'),
               'graph_utils': getResourceJs('graph_utils'),
               'project_content_utils': getResourceJs('project_content_utils'),
               'jquery_cookie': getResourceJs('jquery_cookie'),
               'jquery_treeview': getResourceJs('jquery_treeview'),
               'project_content_css':getResourceCss('project_content'),
               'protTreeHtml': htmlTree,
               'choices':choices,
               'choiceSelected': choiceSelected,
               'runs': runs,
               'columns': provider.getColumns(),
               'projectNameHeader': projectNameHeader, 
               'runsView': runsView,
               'selectedRuns': selectedRuns
               }

    context = base_flex(request, context)
    
    return context
Exemple #3
0
def contentContext(request, project, serviceName=None):
    from pyworkflow.gui.tree import ProjectRunsTreeProvider

    projectName = project.getShortName()
    if serviceName is None:
        serviceName = getVarFromRequest(request, SERVICE_NAME)

    project_settings = project.getSettings()
    request.session[CTX_PROJECT_PATH] = project.getPath()
    request.session[PROJECT_NAME] = projectName

    provider = ProjectRunsTreeProvider(project)
    runs = formatProvider(provider, "runs")
    request.session['runs'] = runs

    # Get the selected runs stored in BD
    selectedRuns = project_settings.runSelection

    # Get the run mode view (0:list / 1:graph / 2:small graph) stored in BD
    runsView = project_settings.runsView.get()

    # load the protocol tree current active
    htmlTree = loadProtTree(project, serviceName)

    # get the choices to load protocol trees
    choices = project.getProtocolViews()

    # get the choice current
    choiceSelected = choices.index(project.getCurrentProtocolView().text.get())

    context = {
        CTX_PROJECT_NAME: projectName,
        'view': 'protocols',
        'editTool': getResourceIcon('edit_toolbar'),
        'copyTool': getResourceIcon('copy_toolbar'),
        'deleteTool': getResourceIcon('delete_toolbar'),
        'browseTool': getResourceIcon('browse_toolbar'),
        'stopTool': getResourceIcon('stop_toolbar'),
        'analyzeTool': getResourceIcon('analyze_toolbar'),
        'treeTool': getResourceIcon('tree_toolbar'),
        'listTool': getResourceIcon('list_toolbar'),
        'graph_utils': getResourceJs('graph_utils'),
        'project_content_utils': getResourceJs('project_content_utils'),
        'jquery_cookie': getResourceJs('jquery_cookie'),
        'jquery_treeview': getResourceJs('jquery_treeview'),
        'project_content_css': getResourceCss('project_content'),
        'protTreeHtml': htmlTree,
        'choices': choices,
        'choiceSelected': choiceSelected,
        'runs': runs,
        'columns': provider.getColumns(),
        'runsView': runsView,
        'selectedRuns': selectedRuns,
        SERVICE_NAME: serviceName
    }

    context = base_flex(request, context)

    return context
Exemple #4
0
def run_table_graph(request):
    from pyworkflow.gui.tree import ProjectRunsTreeProvider

    try:
        projectName = request.session['projectName']
        project = loadProject(request)
        project_settings = project.getSettings()
        provider = ProjectRunsTreeProvider(project)

        runs = request.session['runs']
        runsNew = formatProvider(provider, "runs")

        refresh = False
        listNewElm = []

        if len(runs) != len(runsNew):
            print 'Change detected, different size'
            refresh = True
        else:
            for kx, vx in runs:
                for ky, vy in runsNew:
                    if kx == ky and vx != vy:
                        print 'Change detected', vx, vy
                        #                   refresh = True
                        listNewElm.append(vy)
        if refresh:
            request.session['runs'] = runsNew

            # Get the selected runs stored in BD
            selectedRuns = project_settings.runSelection

            # Get the run mode view (0:list / 1:graph / 2:small graph) stored in BD
            runsView = project_settings.runsView.get()

            context = {
                'runs': runsNew,
                'columns': provider.getColumns(),
                'runsView': runsView,
                'selectedRuns': selectedRuns
            }

            return render_to_response('project_content/run_table_graph.html',
                                      context)

        elif listNewElm:
            request.session['runs'] = runsNew
            jsonStr = json.dumps(listNewElm, ensure_ascii=False)
            return HttpResponse(jsonStr, mimetype='application/json')

        else:
            print "No changes detected"
            return HttpResponse("ok", mimetype='text/plain')

    except Exception:
        print "Stopped script"
        return HttpResponse("stop", mimetype='text/plain')
Exemple #5
0
def run_table_graph(request):
    from pyworkflow.gui.tree import ProjectRunsTreeProvider
    
    try:
        projectName = request.session['projectName']
        project = loadProject(request)
        project_settings = project.getSettings()
        provider = ProjectRunsTreeProvider(project)
        
        runs = request.session['runs']
        runsNew = formatProvider(provider, "runs")
        
        refresh = False
        listNewElm = []
        
        if len(runs) != len(runsNew):
            print 'Change detected, different size'
            refresh = True
        else:
            for kx, vx in runs:
                for ky, vy in runsNew:
                    if kx == ky and vx != vy:
                        print 'Change detected', vx, vy
    #                   refresh = True
                        listNewElm.append(vy)
        if refresh:
            request.session['runs'] = runsNew
            
            # Get the selected runs stored in BD    
            selectedRuns = project_settings.runSelection
            
            # Get the run mode view (0:list / 1:graph / 2:small graph) stored in BD
            runsView = project_settings.runsView.get()
            
            context = {'runs': runsNew,
                       'columns': provider.getColumns(),
                       'runsView': runsView,
                       'selectedRuns' : selectedRuns}
            
            return render_to_response('project_content/run_table_graph.html', context)
        
        elif listNewElm:
            request.session['runs'] = runsNew
            jsonStr = json.dumps(listNewElm, ensure_ascii=False)
            return HttpResponse(jsonStr, mimetype='application/json')
        
        else:
            print "No changes detected"
            return HttpResponse("ok", mimetype='text/plain')
        
    except Exception:
        print "Stopped script"
        return HttpResponse("stop", mimetype='text/plain')