Skip to content
This repository was archived by the owner on Aug 28, 2020. It is now read-only.

Commit c545536

Browse files
committed
Merge pull request #147 from robertbasic/feature/display-current-project-name
Feature/display current project name. Resolves #127
2 parents d396a30 + 3ba27ff commit c545536

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [Unreleased][unrealeased]
44
### Added
5+
- Display current project name in window title
56

67
### Changed
78
- Use mono fonts in sub-windows

pugdebug/gui/main_window.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ def __init__(self):
5656
if has_setting("window/state"):
5757
self.restoreState(get_setting("window/state"))
5858

59+
if has_setting("current_project"):
60+
self.set_window_title(get_setting("current_project"))
61+
5962
def closeEvent(self, event):
6063
set_setting("window/geometry", self.saveGeometry())
6164
set_setting("window/state", self.saveState())
@@ -295,6 +298,10 @@ def get_breakpoint_viewer(self):
295298
def get_expression_viewer(self):
296299
return self.expression_viewer
297300

301+
def set_window_title(self, project_name):
302+
title = "pugdebug / %s " % project_name
303+
self.setWindowTitle(title)
304+
298305
def set_debugging_status(self, status):
299306
self.permanent_statusbar.set_debugging_status(status)
300307

pugdebug/pugdebug.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from pugdebug.models.documents import PugdebugDocuments
2222
from pugdebug.models.file_browser import PugdebugFileBrowser
2323
from pugdebug.models.projects import PugdebugProjects
24-
from pugdebug.models.settings import get_setting, save_settings
24+
from pugdebug.models.settings import get_setting, set_setting, save_settings
2525

2626

2727
class Pugdebug(QObject):
@@ -275,13 +275,23 @@ def load_project(self, project):
275275
276276
Get the settings for the project and load them as the current
277277
application settings.
278+
279+
Set the current project name in the window title.
280+
281+
Set the current project name setting in application settings.
278282
"""
279283
project_settings = project.get_settings()
280284

281285
changed_settings = save_settings(project_settings)
282286

283287
self.handle_settings_changed(changed_settings)
284288

289+
project_name = project.get_project_name()
290+
291+
self.main_window.set_window_title(project_name)
292+
293+
set_setting('current_project', project_name)
294+
285295
def file_browser_item_activated(self, index):
286296
"""Handle when file browser item gets activated
287297

0 commit comments

Comments
 (0)