Example #1
0
    def _mark_selected(self, project):
        """
        Set the project passed as parameter as the selected project.
        """
        previous_project = common.get_current_project()
        # Update project stored in selection, with latest Project entity from DB.
        members = self.user_service.get_users_for_project("", project.id)[1]
        project.members = members

        if previous_project is None or previous_project.id != project.id:
            # Clean Burst selection from session in case of a different project.
            SimulatorContext().clean_project_data_from_session()
            # Store in DB new project selection
            user = common.get_from_session(common.KEY_USER)
            if user is not None:
                self.user_service.save_project_to_user(user.id, project.id)
            # Display info message about project change
            self.logger.debug("Selected project is now " + project.name)
            common.set_info_message("Your current working project is: " +
                                    str(project.name))
            linked_dt = self.project_service.get_linked_datatypes_storage_path(
                project)
            storage_interface = StorageInterface()
            storage_interface.set_project_active(project, linked_dt)
            if previous_project is not None:
                storage_interface.set_project_inactive(previous_project)

        # Add the project entity to session every time, as it might be changed (e.g. after edit)
        common.add2session(common.KEY_PROJECT, project)
Example #2
0
 def __init__(self):
     BurstBaseController.__init__(self)
     self.range_parameters = SimulatorRangeParameters()
     self.burst_service = BurstService()
     self.simulator_service = SimulatorService()
     self.cached_simulator_algorithm = self.algorithm_service.get_algorithm_by_module_and_class(
         IntrospectionRegistry.SIMULATOR_MODULE, IntrospectionRegistry.SIMULATOR_CLASS)
     self.context = SimulatorContext()
     self.monitors_handler = MonitorsWizardHandler()
Example #3
0
 def _remove_project(self, project_id):
     """Private method for removing project."""
     try:
         self.project_service.remove_project(project_id)
     except ServicesBaseException as exc:
         self.logger.error("Could not delete project!")
         self.logger.exception(exc)
         common.set_error_message(exc.message)
     prj = common.get_current_project()
     if prj is not None and prj.id == int(project_id):
         SimulatorContext().clean_project_data_from_session()
Example #4
0
    def logout(self):
        """
        Logging out user and clean session
        """
        user = common.remove_from_session(common.KEY_USER)
        if user is not None:
            self.logger.debug("User " + user.username + " is just logging out!")
        current_project = common.get_current_project()
        if current_project is not None and encryption_handler.encryption_enabled():
            encryption_handler.set_project_inactive(current_project)
        SimulatorContext().clean_project_data_from_session()
        common.set_info_message("Thank you for using The Virtual Brain!")

        common.expire_session()
        raise cherrypy.HTTPRedirect("/user")
Example #5
0
 def __init__(self):
     super(NoiseConfigurationController, self).__init__()
     self.simulator_context = SimulatorContext()
Example #6
0
 def __init__(self):
     super(SurfaceModelParametersController, self).__init__()
     self.simulator_context = SimulatorContext()