This repository was archived by the owner on Aug 28, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 1010__author__ = "robertbasic"
1111
1212from PyQt5 .QtCore import QCoreApplication , QSettings
13- from PyQt5 .QtGui import QStandardItemModel
13+ from PyQt5 .QtGui import QStandardItemModel , QStandardItem
14+
15+ from pugdebug .models .settings import get_projects
1416
1517
1618class PugdebugProject (QSettings ):
@@ -39,3 +41,12 @@ class PugdebugProjects(QStandardItemModel):
3941
4042 def __init__ (self , parent ):
4143 super (PugdebugProjects , self ).__init__ (parent )
44+
45+ self .setHorizontalHeaderLabels (['Name' ])
46+
47+ self .load_projects ()
48+
49+ def load_projects (self ):
50+ for project in get_projects ():
51+ item = QStandardItem (project )
52+ self .appendRow (item )
Original file line number Diff line number Diff line change @@ -72,6 +72,18 @@ def add_project(self, project):
7272 self .application_settings .setValue ('projects' , project )
7373 self .application_settings .endArray ()
7474
75+ def get_projects (self ):
76+ size = self .application_settings .beginReadArray ('projects' )
77+
78+ projects = []
79+ for i in range (0 , size ):
80+ self .application_settings .setArrayIndex (i )
81+ projects .append (self .application_settings .value ('projects' ))
82+
83+ self .application_settings .endArray ()
84+
85+ return projects
86+
7587 def __get_next_index (self , project ):
7688 size = self .application_settings .beginReadArray ('projects' )
7789
@@ -111,3 +123,7 @@ def set_setting(key, value):
111123
112124def add_project (project ):
113125 settings .add_project (project )
126+
127+
128+ def get_projects ():
129+ return settings .get_projects ()
You can’t perform that action at this time.
0 commit comments