grc: added url to wiki page for each block in docs tab

This commit is contained in:
Marc L 2019-07-15 15:46:27 -04:00 committed by Marcus Müller
parent 914cacfebd
commit c65ce732df
4 changed files with 26 additions and 1 deletions

4
00-grc-docs.conf.in Normal file
View File

@ -0,0 +1,4 @@
# This should link to the wiki page-per-block documentation, when the block label (e.g., FFT) is appended to the end of the string
[grc-docs]
wiki_block_docs_url_prefix = @GRC_DOCS_URL_PREFIX@

View File

@ -101,7 +101,7 @@ GR_REGISTER_COMPONENT("gnuradio-companion" ENABLE_GRC
if(ENABLE_GRC)
########################################################################
# Create and install the grc conf file
# Create and install the grc and grc-docs conf file
########################################################################
file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${GRC_BLOCKS_DIR} blocksdir)
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
@ -132,6 +132,16 @@ install(
DESTINATION ${GR_PREFSDIR}
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/00-grc-docs.conf.in
${CMAKE_CURRENT_BINARY_DIR}/00-grc-docs.conf
@ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/00-grc-docs.conf
DESTINATION ${GR_PREFSDIR}
)
########################################################################
# Install (+ compile) python sources and data files
########################################################################

View File

@ -96,6 +96,10 @@ class Config(CoreConfig):
def xterm_executable(self):
return self._gr_prefs.get_string('grc', 'xterm_executable', 'xterm')
@property
def wiki_block_docs_url_prefix(self):
return self._gr_prefs.get_string('grc-docs', 'wiki_block_docs_url_prefix', '')
@property
def default_canvas_size(self):
try: # ugly, but matches current code style

View File

@ -57,6 +57,7 @@ class PropsDialog(Gtk.Dialog):
self._block = block
self._hash = 0
self._config = parent.config
vpaned = Gtk.VPaned()
self.vbox.pack_start(vpaned, True, True, 0)
@ -211,6 +212,12 @@ class PropsDialog(Gtk.Dialog):
buf.delete(buf.get_start_iter(), buf.get_end_iter())
pos = buf.get_end_iter()
# Add link to wiki page for this block, at the top
note = "Wiki Page for this Block: "
prefix = self._config.wiki_block_docs_url_prefix
suffix = self._block.label.replace(" ", "_")
buf.insert(pos, note + prefix + suffix + '\n\n')
docstrings = self._block.documentation.copy()
if not docstrings:
return