summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClayton Smith <argilo@gmail.com>2024-01-10 15:03:02 -0500
committerJeff Long <willcode4@gmail.com>2024-01-11 10:46:00 -0500
commitec7b2c403abdfd5cffbe7eaca74749d3a23305b5 (patch)
treed47aa71082f89d7420a501720da2922e340690a2
parentgrc: fix C++ gen with busports (diff)
downloadgnuradio-ec7b2c403abdfd5cffbe7eaca74749d3a23305b5.tar.xz
gnuradio-ec7b2c403abdfd5cffbe7eaca74749d3a23305b5.zip
grc: Only bussify blocks that have ports
Signed-off-by: Clayton Smith <argilo@gmail.com> (cherry picked from commit 26d8c762516b92cbe6470167280bb2ef5d9741f3) Signed-off-by: Jeff Long <willcode4@gmail.com>
-rw-r--r--grc/core/blocks/block.py14
-rw-r--r--grc/gui/Application.py4
2 files changed, 10 insertions, 8 deletions
diff --git a/grc/core/blocks/block.py b/grc/core/blocks/block.py
index 12923888a..46c5c30a3 100644
--- a/grc/core/blocks/block.py
+++ b/grc/core/blocks/block.py
@@ -750,14 +750,16 @@ class Block(Element):
def bussify(self, direc):
if direc == 'source':
ports = self.sources
- ports_gui = self.filter_bus_port(self.sources)
- self.bus_structure = self.get_bus_structure('source')
- self.bus_source = not self.bus_source
+ if ports:
+ ports_gui = self.filter_bus_port(self.sources)
+ self.bus_structure = self.get_bus_structure('source')
+ self.bus_source = not self.bus_source
else:
ports = self.sinks
- ports_gui = self.filter_bus_port(self.sinks)
- self.bus_structure = self.get_bus_structure('sink')
- self.bus_sink = not self.bus_sink
+ if ports:
+ ports_gui = self.filter_bus_port(self.sinks)
+ self.bus_structure = self.get_bus_structure('sink')
+ self.bus_sink = not self.bus_sink
# Disconnect all the connections when toggling the bus state
for port in ports:
diff --git a/grc/gui/Application.py b/grc/gui/Application.py
index feadd0e43..98fc80607 100644
--- a/grc/gui/Application.py
+++ b/grc/gui/Application.py
@@ -869,8 +869,8 @@ class Application(Gtk.Application):
Actions.BLOCK_CREATE_HIER.set_enabled(bool(selected_blocks))
Actions.OPEN_HIER.set_enabled(bool(selected_blocks))
- Actions.BUSSIFY_SOURCES.set_enabled(bool(selected_blocks))
- Actions.BUSSIFY_SINKS.set_enabled(bool(selected_blocks))
+ Actions.BUSSIFY_SOURCES.set_enabled(any(block.sources for block in selected_blocks))
+ Actions.BUSSIFY_SINKS.set_enabled(any(block.sinks for block in selected_blocks))
Actions.RELOAD_BLOCKS.enable()
Actions.FIND_BLOCKS.enable()