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

Commit ed45e94

Browse files
committed
save settings when project is loaded
1 parent 010660d commit ed45e94

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

pugdebug/models/projects.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from PyQt5.QtCore import QCoreApplication, QSettings
1313
from PyQt5.QtGui import QStandardItemModel, QStandardItem
1414

15-
from pugdebug.models.settings import get_projects
15+
from pugdebug.models.settings import get_projects, save_settings, has_setting
1616

1717

1818
class PugdebugProject(QSettings):
@@ -36,6 +36,15 @@ def __init__(self, project_name):
3636
def get_project_name(self):
3737
return self.project_name
3838

39+
def get_settings(self):
40+
project_settings = {}
41+
42+
for key in self.allKeys():
43+
if has_setting(key):
44+
project_settings[key] = self.value(key)
45+
46+
return project_settings
47+
3948

4049
class PugdebugProjects(QStandardItemModel):
4150

pugdebug/pugdebug.py

Lines changed: 6 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
24+
from pugdebug.models.settings import get_setting, save_settings
2525

2626

2727
class Pugdebug(QObject):
@@ -227,6 +227,11 @@ def connect_breakpoint_viewer_signals(self):
227227

228228
def projects_browser_item_activated(self, index):
229229
project = self.projects_browser.model().get_project_by_index(index)
230+
project_settings = project.get_settings()
231+
232+
changed_settings = save_settings(project_settings)
233+
234+
self.handle_settings_changed(changed_settings)
230235

231236
def file_browser_item_activated(self, index):
232237
"""Handle when file browser item gets activated

0 commit comments

Comments
 (0)