Next: , Previous: Project View, Up: Project Handling


7.6 Disabling Project Edition Features

The project files should generally be considered as part of the sources, and thus be put under control of a version control system. As such, you might want to prevent accidental editing of the project files, either by you or some other person using the same GPS installation.

The main thing to do to prevent such accidental edition is to change the write permissions on the project files themselves. On Unix systems, you could also change the owner of the file. When GPS cannot write a project file, it will report an error to the user.

However, the above doesn't prevent a user from trying to do some modifications at the GUI level, since the error message only occurs when trying to save the project (this is by design, so that temporary modification can be done in memory).

You can disable all the project editing related menus in GPS by adding special startup switches. The recommended way is to create a small batch script that spawns GPS with these switches. You should use the following command line:

        gps --traceoff=MODULE.PROJECT_VIEWER --traceoff=MODULE.PROJECT_PROPERTIES

What these do it prevent the loading of the two GPS modules that are responsible for project edition. However, this also has an impact on the python functions that are exported by GPS, and thus could break some plug-ins. Another solution which might apply in your case is simply to hide the corresponding project-editing menus and contextual menus. This could be done by creating a small python plugin for GPS (see Customizing through XML and Python files, which contains the following code:

     import GPS
     GPS.Menu.get  ("/Project/Edit Project Properties").hide()
     GPS.Contextual ('Edit project properties').hide()
     GPS.Contextual ('Save project').hide()
     GPS.Contextual ('Add configuration variable').hide()