aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Schroer <3470424+dl1ksv@users.noreply.github.com>2024-04-07 18:24:27 +0200
committerJeff Long <willcode4@gmail.com>2024-04-18 18:09:05 -0400
commit5775975ff15c61d8b0eaffa1d8e0cb2808bf36b7 (patch)
tree4578a38482c82d207280a546923bbc3747c3e321
parentgrc-qt: AttributeError: 'GUIPort' object has no attribute 'is_sink' (diff)
downloadgnuradio-5775975ff15c61d8b0eaffa1d8e0cb2808bf36b7.tar.xz
gnuradio-5775975ff15c61d8b0eaffa1d8e0cb2808bf36b7.zip
grc_qt: save panel settings
In View-> Panels four panels can be enabled and disabled. But these settings are not saved and restored. This is done now Remove wiki option from commandline. Remove display_wiki from available preferences, use panel settings instead. Signed-off-by: Volker Schroer <3470424+dl1ksv@users.noreply.github.com> (cherry picked from commit 99755686c8f58dd56ad13d3ab56203c367a1bdb1) Signed-off-by: Jeff Long <willcode4@gmail.com>
-rw-r--r--grc/gui_qt/components/block_library.py5
-rw-r--r--grc/gui_qt/components/console.py9
-rw-r--r--grc/gui_qt/components/variable_editor.py5
-rw-r--r--grc/gui_qt/components/wiki_tab.py30
-rw-r--r--grc/gui_qt/components/window.py10
-rw-r--r--grc/gui_qt/grc.py2
-rw-r--r--grc/gui_qt/resources/available_preferences.yml4
-rwxr-xr-xgrc/main.py1
8 files changed, 35 insertions, 31 deletions
diff --git a/grc/gui_qt/components/block_library.py b/grc/gui_qt/components/block_library.py
index 8a21e696f..59f487b2a 100644
--- a/grc/gui_qt/components/block_library.py
+++ b/grc/gui_qt/components/block_library.py
@@ -106,6 +106,8 @@ class BlockLibrary(QDockWidget, base.Component):
def __init__(self):
super(BlockLibrary, self).__init__()
+ self.qsettings = self.app.qsettings
+
self.setObjectName("block_library")
self.setWindowTitle("Block Library")
@@ -205,6 +207,9 @@ class BlockLibrary(QDockWidget, base.Component):
# Dict representing which examples contain various blocks
self.examples_w_block = {}
+ if not self.qsettings.value("appearance/display_blocklibrary", True, type=bool):
+ self.hide()
+
def createActions(self, actions):
pass
diff --git a/grc/gui_qt/components/console.py b/grc/gui_qt/components/console.py
index 66dad740a..7914f3224 100644
--- a/grc/gui_qt/components/console.py
+++ b/grc/gui_qt/components/console.py
@@ -82,6 +82,8 @@ class Console(QtWidgets.QDockWidget, base.Component):
def __init__(self, level):
super(Console, self).__init__()
+ self.qsettings = self.app.qsettings
+
self.setObjectName('console')
self.setWindowTitle('Console')
self.level = level
@@ -116,8 +118,8 @@ class Console(QtWidgets.QDockWidget, base.Component):
# Translation support
- #self.setWindowTitle(_translate("", "Library", None))
- #library.headerItem().setText(0, _translate("", "Blocks", None))
+ # self.setWindowTitle(_translate("", "Library", None))
+ # library.headerItem().setText(0, _translate("", "Blocks", None))
# QtCore.QMetaObject.connectSlotsByName(blockLibraryDock)
# Setup actions
@@ -154,6 +156,9 @@ class Console(QtWidgets.QDockWidget, base.Component):
self.handler.show_level = True
self.enabled = False
+ if not self.qsettings.value("appearance/display_console", True, type=bool):
+ self.hide()
+
def enable(self):
self.enabled = True
diff --git a/grc/gui_qt/components/variable_editor.py b/grc/gui_qt/components/variable_editor.py
index 54f2297c1..ea78d5be7 100644
--- a/grc/gui_qt/components/variable_editor.py
+++ b/grc/gui_qt/components/variable_editor.py
@@ -35,6 +35,8 @@ class VariableEditor(QDockWidget, base.Component):
def __init__(self):
super(VariableEditor, self).__init__()
+ self.qsettings = self.app.qsettings
+
self.setObjectName('variable_editor')
self.setWindowTitle('Variable Editor')
@@ -74,7 +76,8 @@ class VariableEditor(QDockWidget, base.Component):
# before calling the MainWindow Controller to add the widget.
self.app.registerDockWidget(self, location=self.settings.window.VARIABLE_EDITOR_DOCK_LOCATION)
self.currently_rebuilding = False
-
+ if not self.qsettings.value("appearance/display_variable_editor", True, type=bool):
+ self.hide()
# Actions
def createActions(self, actions):
diff --git a/grc/gui_qt/components/wiki_tab.py b/grc/gui_qt/components/wiki_tab.py
index 5be73f389..3c2ca0dfa 100644
--- a/grc/gui_qt/components/wiki_tab.py
+++ b/grc/gui_qt/components/wiki_tab.py
@@ -30,7 +30,7 @@ log = logging.getLogger(f"grc.application.{__name__}")
class WikiTab(QtWidgets.QDockWidget, base.Component):
- def __init__(self, argv_enabled=False):
+ def __init__(self):
super(WikiTab, self).__init__()
self.qsettings = self.app.qsettings
@@ -40,27 +40,11 @@ class WikiTab(QtWidgets.QDockWidget, base.Component):
self.setFloating(False)
- active = None
- if argv_enabled:
- active = True
- else:
- if self.qsettings.value("appearance/display_wiki", False, type=bool) == True:
- active = True
- else:
- active = False
-
- if active:
- try:
- from qtpy.QtWebEngineWidgets import QWebEngineView
- self.hidden = False
- except ImportError:
- log.error("PyQt QWebEngine missing!")
- self.hide()
- self.hidden = True
- return
- else:
+ try:
+ from qtpy.QtWebEngineWidgets import QWebEngineView
+ except ImportError:
+ log.error("PyQt QWebEngine missing!")
self.hide()
- self.hidden = True
return
# GUI Widgets
@@ -97,9 +81,11 @@ class WikiTab(QtWidgets.QDockWidget, base.Component):
# The AppController then tries to find a saved dock location from the preferences
# before calling the MainWindow Controller to add the widget.
self.app.registerDockWidget(self, location=self.settings.window.WIKI_TAB_DOCK_LOCATION)
+ if not self.qsettings.value("appearance/display_wiki", False, type=bool):
+ self.hide()
def setURL(self, url):
- if not self.hidden:
+ if not self.isHidden():
self._text.load(url)
self._text.show()
diff --git a/grc/gui_qt/components/window.py b/grc/gui_qt/components/window.py
index d853ce11d..2e86d8080 100644
--- a/grc/gui_qt/components/window.py
+++ b/grc/gui_qt/components/window.py
@@ -1475,6 +1475,16 @@ class MainWindow(QtWidgets.QMainWindow, base.Component):
# We cancelled closing a tab. We don't want to close the application
return
+ # Save the panel settings
+ # Console
+ self.app.qsettings.setValue('appearance/display_console', not self.app.Console.isHidden())
+ # Block Library
+ self.app.qsettings.setValue('appearance/display_blocklibrary', not self.app.BlockLibrary.isHidden())
+ # Wiki
+ self.app.qsettings.setValue('appearance/display_wiki', not self.app.WikiTab.isHidden())
+ # Variable Editor
+ self.app.qsettings.setValue('appearance/display_variable_editor', not self.app.VariableEditor.isHidden())
+
# Write the leftmost tab to file first
self.app.qsettings.setValue('window/files_open', reversed(files_open))
self.app.qsettings.setValue('window/windowState', self.saveState())
diff --git a/grc/gui_qt/grc.py b/grc/gui_qt/grc.py
index 506a4e5aa..b3ba5e15b 100644
--- a/grc/gui_qt/grc.py
+++ b/grc/gui_qt/grc.py
@@ -86,7 +86,7 @@ class Application(QtWidgets.QApplication):
stopwatch.lap("blocklibrary")
# self.DocumentationTab = components.DocumentationTab()
# stopwatch.lap('documentationtab')
- self.WikiTab = components.WikiTab("--wiki" in settings.argv)
+ self.WikiTab = components.WikiTab()
stopwatch.lap("wikitab")
self.VariableEditor = components.VariableEditor()
stopwatch.lap("variable_editor")
diff --git a/grc/gui_qt/resources/available_preferences.yml b/grc/gui_qt/resources/available_preferences.yml
index 6aa5810bb..817872689 100644
--- a/grc/gui_qt/resources/available_preferences.yml
+++ b/grc/gui_qt/resources/available_preferences.yml
@@ -107,10 +107,6 @@ categories:
name: Default Qt GUI theme
dtype: str
default: ""
- - key: display_wiki
- name: Display Wiki tab
- dtype: bool
- default: False
# Runtime preferences typically end up in config.conf. They are grouped in a single tab.
runtime:
diff --git a/grc/main.py b/grc/main.py
index aaed3f9fb..5bb0d133d 100755
--- a/grc/main.py
+++ b/grc/main.py
@@ -209,7 +209,6 @@ def main():
# Logging support
parser.add_argument('--log', choices=['debug', 'info', 'warning', 'error', 'critical'], default='info')
- parser.add_argument('--wiki', action='store_true')
# TODO: parser.add_argument('--log-output')
# Graphics framework (QT or GTK)