|
21 | 21 | from pugdebug.models.documents import PugdebugDocuments |
22 | 22 | from pugdebug.models.file_browser import PugdebugFileBrowser |
23 | 23 | from pugdebug.models.projects import PugdebugProjects |
24 | | -from pugdebug.models.settings import get_setting, set_setting, save_settings |
| 24 | +from pugdebug.models.settings import (get_setting, set_setting, |
| 25 | + save_settings, has_setting) |
25 | 26 |
|
26 | 27 |
|
27 | 28 | class Pugdebug(QObject): |
@@ -257,10 +258,10 @@ def handle_new_project_created(self, project_name): |
257 | 258 | """ |
258 | 259 | self.projects_browser.load_projects() |
259 | 260 |
|
260 | | - item = self.projects_browser.model().findItems(project_name)[0] |
261 | | - project = self.projects_browser.model().get_project_by_item(item) |
| 261 | + project = self.projects_browser.load_project_by_name(project_name) |
262 | 262 |
|
263 | | - self.load_project(project) |
| 263 | + if project is not None: |
| 264 | + self.load_project(project) |
264 | 265 |
|
265 | 266 | def projects_browser_item_activated(self, index): |
266 | 267 | """Handle when a projects browser item gets activated |
@@ -418,14 +419,26 @@ def handle_settings_changed(self, changed_settings): |
418 | 419 |
|
419 | 420 | Given argument is a set of settings's names which have been changed. |
420 | 421 | """ |
421 | | - if 'path/project_root' in changed_settings: |
| 422 | + |
| 423 | + if has_setting('current_project'): |
| 424 | + project_name = get_setting('current_project') |
| 425 | + |
| 426 | + project = self.projects_browser.load_project_by_name(project_name) |
| 427 | + |
| 428 | + if project is not None: |
| 429 | + project.set_settings(changed_settings) |
| 430 | + |
| 431 | + changed_setting_keys = changed_settings.keys() |
| 432 | + |
| 433 | + if 'path/project_root' in changed_setting_keys: |
422 | 434 | self.handle_project_root_changed() |
423 | 435 |
|
424 | 436 | features = ['debugger/max_depth', |
425 | 437 | 'debugger/max_children', |
426 | 438 | 'debugger/max_data'] |
427 | 439 |
|
428 | | - if any(True for feature in features if feature in changed_settings): |
| 440 | + if any(True for feature in features |
| 441 | + if feature in changed_setting_keys): |
429 | 442 | self.handle_debugger_features_changed() |
430 | 443 |
|
431 | 444 | def handle_project_root_changed(self): |
|
0 commit comments