File: project_view.py

package info (click to toggle)
gnat-gps 4.3-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 49,096 kB
  • ctags: 20,461
  • sloc: ada: 274,120; ansic: 154,849; python: 9,890; tcl: 9,812; sh: 8,192; xml: 7,970; cpp: 4,737; yacc: 3,520; makefile: 2,136; lex: 2,043; java: 1,638; perl: 302; awk: 265; sed: 161; asm: 14; fortran: 2; lisp: 1
file content (18 lines) | stat: -rw-r--r-- 542 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
## This script changes the label of the project view and set it to the current
## project file path. Upon a project changed, the title is properly updated.

from GPS import *

def update_project_view_title (t):
   new_name = Project.root().file().name()
   new_short_name = Project.root().name()
   view = MDI.get ("Project View")

   if view != None:
      view.rename (new_name, new_short_name)
      t.remove()

def on_project_changed (h):
   t = Timeout (100, update_project_view_title)

Hook ("project_changed").add (on_project_changed)