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

Commit 4d821b4

Browse files
committed
initial saving of the project INI settings file
1 parent 3fafd84 commit 4d821b4

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

pugdebug/gui/projects.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
QFormLayout, QLineEdit)
1414

1515
from pugdebug.gui.forms import PugdebugSettingsForm
16+
from pugdebug.models.projects import PugdebugProject
1617
from pugdebug.models.settings import get_default_setting
1718

1819

@@ -25,6 +26,8 @@ def __init__(self, parent):
2526

2627
self.project_name = QLineEdit()
2728

29+
self.accepted.connect(self.create_new_project)
30+
2831
self.setup_layout()
2932

3033
self.load_settings()
@@ -52,6 +55,11 @@ def setup_layout(self):
5255

5356
self.setLayout(box_layout)
5457

58+
def create_new_project(self):
59+
project_name = self.project_name.text()
60+
project = PugdebugProject(project_name)
61+
project.sync()
62+
5563
def load_settings(self):
5664
"""Load default settings into the form"""
5765
for name, widget in self.form.widgets.items():

pugdebug/models/projects.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
pugdebug - a standalone PHP debugger
5+
=========================
6+
copyright: (c) 2015 Robert Basic
7+
license: GNU GPL v3, see LICENSE for more details
8+
"""
9+
10+
__author__ = "robertbasic"
11+
12+
from PyQt5.QtCore import QCoreApplication, QSettings
13+
14+
15+
class PugdebugProject(QSettings):
16+
17+
def __init__(self, project_name):
18+
project_name = project_name.lower().replace(' ', '-')
19+
super(PugdebugProject, self).__init__(
20+
QSettings.IniFormat,
21+
QSettings.UserScope,
22+
QCoreApplication.organizationName(),
23+
project_name
24+
)
25+
self.setValue('project', project_name)

0 commit comments

Comments
 (0)