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 +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1414from PyQt5 .QtCore import QCoreApplication , QSettings
1515from PyQt5 .QtGui import QStandardItemModel , QStandardItem
1616
17- from pugdebug .models .settings import get_projects , has_setting , delete_project
17+ from pugdebug .models .settings import (get_projects , delete_project ,
18+ get_setting , has_setting ,
19+ remove_setting )
1820
1921
2022class PugdebugProject (QSettings ):
@@ -52,6 +54,14 @@ def set_settings(self, new_settings):
5254 self .setValue (key , value )
5355
5456 def delete (self ):
57+ project_name = self .get_project_name ()
58+
59+ if has_setting ('current_project' ):
60+ current_project = get_setting ('current_project' )
61+
62+ if project_name == current_project :
63+ remove_setting ('current_project' )
64+
5565 delete_project (self .get_project_name ())
5666
5767 filename = self .fileName ()
Original file line number Diff line number Diff line change @@ -63,6 +63,9 @@ def has(self, key):
6363 def set (self , key , value ):
6464 return self .application_settings .setValue (key , value )
6565
66+ def remove (self , key ):
67+ return self .application_settings .remove (key )
68+
6669 def add_project (self , project ):
6770 index = self .__get_next_index (project )
6871
@@ -161,6 +164,10 @@ def set_setting(key, value):
161164 settings .set (key , value )
162165
163166
167+ def remove_setting (key ):
168+ settings .remove (key )
169+
170+
164171def save_settings (new_settings ):
165172 changed_settings = {}
166173
You can’t perform that action at this time.
0 commit comments