2017-06-23 14:46:24 +02:00
|
|
|
# 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.
|
2007-05-04 15:36:35 +00:00
|
|
|
|
2017-06-23 14:46:24 +02:00
|
|
|
from GPS import Project, MDI, Timeout, Hook
|
2007-05-04 15:36:35 +00:00
|
|
|
|
|
|
|
|
|
2017-06-23 14:46:24 +02:00
|
|
|
def update_project_view_title(t):
|
|
|
|
|
new_name = Project.root().file().name()
|
|
|
|
|
new_short_name = Project.root().name()
|
|
|
|
|
view = MDI.get("Project View")
|
2007-05-04 15:36:35 +00:00
|
|
|
|
2017-06-23 14:46:24 +02:00
|
|
|
if view is not None:
|
|
|
|
|
view.rename(new_name, new_short_name)
|
|
|
|
|
t.remove()
|
2007-05-04 15:36:35 +00:00
|
|
|
|
2017-06-23 14:46:24 +02:00
|
|
|
|
|
|
|
|
def on_project_changed(h):
|
|
|
|
|
Timeout(100, update_project_view_title)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Hook("project_changed").add(on_project_changed)
|