@@ -90,6 +90,8 @@ def __init__(self, parent=None):
90
90
QWidget .__init__ (self , parent )
91
91
self .setWindowTitle (QCoreApplication .translate ("PythonConsole" , "Python Console" ))
92
92
93
+ self .settings = QSettings ()
94
+
93
95
self .options = optionsDialog (self )
94
96
self .helpDlg = HelpDialog (self )
95
97
@@ -242,7 +244,8 @@ def __init__(self, parent=None):
242
244
objList = QCoreApplication .translate ("PythonConsole" , "Object Inspector" )
243
245
self .objectListButton = QAction (self )
244
246
self .objectListButton .setCheckable (True )
245
- self .objectListButton .setEnabled (True )
247
+ self .objectListButton .setEnabled (self .settings .value ("pythonConsole/enableObjectInsp" ,
248
+ False ).toBool ())
246
249
self .objectListButton .setIcon (QgsApplication .getThemeIcon ("console/iconClassBrowserConsole.png" ))
247
250
self .objectListButton .setMenuRole (QAction .PreferencesRole )
248
251
self .objectListButton .setIconVisibleInMenu (True )
@@ -467,7 +470,7 @@ def __init__(self, parent=None):
467
470
self .layoutFind .setContentsMargins (0 , 0 , 0 , 0 )
468
471
self .lineEditFind = QgsFilterLineEdit ()
469
472
placeHolderTxt = QCoreApplication .translate ("PythonConsole" , "Enter text to find..." )
470
-
473
+
471
474
if pyqtconfig .Configuration ().qt_version >= 0x40700 :
472
475
self .lineEditFind .setPlaceholderText (placeHolderTxt )
473
476
else :
@@ -596,8 +599,7 @@ def uncommentCode(self):
596
599
self .tabEditorWidget .currentWidget ().newEditor .commentEditorCode (False )
597
600
598
601
def openScriptFile (self ):
599
- settings = QSettings ()
600
- lastDirPath = settings .value ("pythonConsole/lastDirPath" ).toString ()
602
+ lastDirPath = self .settings .value ("pythonConsole/lastDirPath" ).toString ()
601
603
openFileTr = QCoreApplication .translate ("PythonConsole" , "Open File" )
602
604
filename = QFileDialog .getOpenFileName (
603
605
self , openFileTr , lastDirPath , "Script file (*.py)" )
@@ -612,7 +614,7 @@ def openScriptFile(self):
612
614
self .tabEditorWidget .newTabEditor (tabName , filename )
613
615
614
616
lastDirPath = QFileInfo (filename ).path ()
615
- settings .setValue ("pythonConsole/lastDirPath" , QVariant (filename ))
617
+ self . settings .setValue ("pythonConsole/lastDirPath" , QVariant (filename ))
616
618
self .updateTabListScript (filename , action = 'append' )
617
619
618
620
def saveScriptFile (self ):
@@ -678,33 +680,27 @@ def callWidgetMessageBarEditor(self, text, level, timed):
678
680
self .tabEditorWidget .widgetMessageBar (iface , text , level , timed )
679
681
680
682
def updateTabListScript (self , script , action = None ):
681
- settings = QSettings ()
682
683
if action == 'remove' :
683
684
self .tabListScript .remove (script )
684
685
elif action == 'append' :
685
686
if script not in self .tabListScript :
686
687
self .tabListScript .append (script )
687
688
else :
688
689
self .tabListScript = []
689
- settings .setValue ("pythonConsole/tabScripts" ,
690
+ self . settings .setValue ("pythonConsole/tabScripts" ,
690
691
QVariant (self .tabListScript ))
691
692
692
693
def saveSettingsConsole (self ):
693
- settings = QSettings ()
694
- #settings.setValue("pythonConsole/geometry", self.saveGeometry())
695
- settings .setValue ("pythonConsole/splitterObj" , self .splitterObj .saveState ())
696
- settings .setValue ("pythonConsole/splitterEditor" , self .splitterEditor .saveState ())
694
+ self .settings .setValue ("pythonConsole/splitterObj" , self .splitterObj .saveState ())
695
+ self .settings .setValue ("pythonConsole/splitterEditor" , self .splitterEditor .saveState ())
697
696
698
697
self .shell .writeHistoryFile ()
699
698
700
699
def restoreSettingsConsole (self ):
701
- # List for tab script
702
- settings = QSettings ()
703
- storedTabScripts = settings .value ("pythonConsole/tabScripts" )
700
+ storedTabScripts = self .settings .value ("pythonConsole/tabScripts" )
704
701
self .tabListScript = storedTabScripts .toList ()
705
- #self.restoreGeometry(settings.value("pythonConsole/geometry").toByteArray())
706
- self .splitterEditor .restoreState (settings .value ("pythonConsole/splitterEditor" ).toByteArray ())
707
- self .splitterObj .restoreState (settings .value ("pythonConsole/splitterObj" ).toByteArray ())
702
+ self .splitterEditor .restoreState (self .settings .value ("pythonConsole/splitterEditor" ).toByteArray ())
703
+ self .splitterObj .restoreState (self .settings .value ("pythonConsole/splitterObj" ).toByteArray ())
708
704
709
705
if __name__ == '__main__' :
710
706
a = QApplication (sys .argv )
0 commit comments