summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grc/core/FlowGraph.py4
-rw-r--r--grc/core/blocks/block.py6
-rw-r--r--grc/core/blocks/dummy.py2
-rw-r--r--grc/core/blocks/embedded_python.py4
-rw-r--r--grc/core/generator/cpp_hier_block.py2
-rw-r--r--grc/core/generator/cpp_top_block.py2
-rw-r--r--grc/core/generator/top_block.py2
-rw-r--r--grc/core/params/param.py4
-rw-r--r--grc/gui/Application.py14
-rw-r--r--grc/gui/Dialogs.py6
-rw-r--r--grc/gui/MainWindow.py2
-rw-r--r--grc/gui/ParamWidgets.py14
-rw-r--r--grc/gui/VariableEditor.py4
-rw-r--r--grc/gui/canvas/flowgraph.py4
-rw-r--r--grc/gui/canvas/param.py2
-rw-r--r--grc/gui/canvas/port.py2
16 files changed, 37 insertions, 37 deletions
diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py
index d7a2bfeeee..f4984d608e 100644
--- a/grc/core/FlowGraph.py
+++ b/grc/core/FlowGraph.py
@@ -105,7 +105,7 @@ class FlowGraph(Element):
output = []
for snip in snippets:
- d ={}
+ d = {}
sect = snip.params['section'].value
d['section'] = sect
d['priority'] = snip.params['priority'].value
@@ -455,7 +455,7 @@ class FlowGraph(Element):
had_connect_errors = True
for block in self.blocks:
- if block.is_dummy_block :
+ if block.is_dummy_block:
block.rewrite() # Make ports visible
# Flowgraph errors depending on disabled blocks are not displayed
# in the error dialog box
diff --git a/grc/core/blocks/block.py b/grc/core/blocks/block.py
index d3c0ad833e..ba4eb6a8f6 100644
--- a/grc/core/blocks/block.py
+++ b/grc/core/blocks/block.py
@@ -78,7 +78,7 @@ class Block(Element):
if Flags.HAS_CPP in self.flags and self.enabled and not (self.is_virtual_source() or self.is_virtual_sink()):
# This is a workaround to allow embedded python blocks/modules to load as there is
# currently 'cpp' in the flags by default caused by the other built-in blocks
- if hasattr(self,'cpp_templates'):
+ if hasattr(self, 'cpp_templates'):
self.orig_cpp_templates = self.cpp_templates # The original template, in case we have to edit it when transpiling to C++
self.current_bus_structure = {'source': None, 'sink': None}
@@ -147,7 +147,7 @@ class Block(Element):
## Bus Logic
###############################
- for direc in {'source','sink'}:
+ for direc in {'source', 'sink'}:
if direc == 'source':
ports = self.sources
ports_gui = self.filter_bus_port(self.sources)
@@ -185,7 +185,7 @@ class Block(Element):
# Add the Bus Ports to the list of ports
for i in range(len(struct)):
# self.sinks = [port_factory(parent=self, **params) for params in self.inputs_data]
- port = self.parent.parent.make_port(self,direction=direc,id=str(len(ports)),label='bus',dtype='bus',bus_struct=struct[i])
+ port = self.parent.parent.make_port(self, direction=direc, id=str(len(ports)), label='bus', dtype='bus', bus_struct=struct[i])
ports.append(port)
for (saved_port, connection) in zip(removed_bus_ports, removed_bus_connections):
diff --git a/grc/core/blocks/dummy.py b/grc/core/blocks/dummy.py
index 75514fc235..5cdc05a9df 100644
--- a/grc/core/blocks/dummy.py
+++ b/grc/core/blocks/dummy.py
@@ -19,7 +19,7 @@ class DummyBlock(Block):
def __init__(self, parent, missing_block_id, parameters, **_):
self.key = missing_block_id
- self.parameters_data = build_params([],False, False,self.flags, self.key)
+ self.parameters_data = build_params([], False, False, self.flags, self.key)
super(DummyBlock, self).__init__(parent=parent)
param_factory = self.parent_platform.make_param
diff --git a/grc/core/blocks/embedded_python.py b/grc/core/blocks/embedded_python.py
index fe364f9559..f7bd2b39b6 100644
--- a/grc/core/blocks/embedded_python.py
+++ b/grc/core/blocks/embedded_python.py
@@ -150,7 +150,7 @@ class EPyBlock(Block):
param.default = str(value)
except KeyError: # need to make a new param
param = param_factory(
- parent=self, id=id_, dtype='raw', value=value,
+ parent=self, id=id_, dtype='raw', value=value,
name=id_.replace('_', ' ').title(),
)
setattr(param, '__epy_param__', True)
@@ -218,7 +218,7 @@ class EPyModule(Block):
to set parameters of other blocks in your flowgraph.
""")}
- epy_flags=Block.flags
+ epy_flags = Block.flags
epy_flags.set(epy_flags.SHOW_ID)
parameters_data = build_params(
diff --git a/grc/core/generator/cpp_hier_block.py b/grc/core/generator/cpp_hier_block.py
index 9eef19cc1e..c4d98e854b 100644
--- a/grc/core/generator/cpp_hier_block.py
+++ b/grc/core/generator/cpp_hier_block.py
@@ -80,7 +80,7 @@ class CppHierBlockGenerator(CppTopBlockGenerator):
self._flow_graph.get_option('id').replace('_', ' ').title()
)
data['category'] = self._flow_graph.get_option('category')
- data['flags'] = [ 'cpp' ]
+ data['flags'] = ['cpp']
# Parameters
data['parameters'] = []
diff --git a/grc/core/generator/cpp_top_block.py b/grc/core/generator/cpp_top_block.py
index c2e31a55b0..b886736b0c 100644
--- a/grc/core/generator/cpp_top_block.py
+++ b/grc/core/generator/cpp_top_block.py
@@ -250,7 +250,7 @@ class CppTopBlockGenerator(TopBlockGenerator):
{r"gr\.sizeof_([\w_]+)": r"sizeof(\1)"}
)
for key in translations:
- make = re.sub(key.replace("\\\\", "\\"), translations[key],make)
+ make = re.sub(key.replace("\\\\", "\\"), translations[key], make)
declarations = declarations.replace(key, translations[key])
if make:
blocks_make.append((block, make, declarations))
diff --git a/grc/core/generator/top_block.py b/grc/core/generator/top_block.py
index a8a9914108..d3ad3135ab 100644
--- a/grc/core/generator/top_block.py
+++ b/grc/core/generator/top_block.py
@@ -312,7 +312,7 @@ class TopBlockGenerator(object):
if porta.dtype == 'bus' and portb.dtype == 'bus':
# which bus port is this relative to the bus structure
if len(porta.bus_structure) == len(portb.bus_structure):
- for port_num_a,port_num_b in zip(porta.bus_structure,portb.bus_structure):
+ for port_num_a, port_num_b in zip(porta.bus_structure, portb.bus_structure):
hidden_porta = porta.parent.sources[port_num_a]
hidden_portb = portb.parent.sinks[port_num_b]
connection = fg.parent_platform.Connection(
diff --git a/grc/core/params/param.py b/grc/core/params/param.py
index 841a290b5d..f753683090 100644
--- a/grc/core/params/param.py
+++ b/grc/core/params/param.py
@@ -193,7 +193,7 @@ class Param(Element):
#########################
# ID and Enum types (not evaled)
#########################
- if dtype in ('id', 'stream_id','name') or self.is_enum():
+ if dtype in ('id', 'stream_id', 'name') or self.is_enum():
if self.options.attributes:
expr = attributed_str(expr)
for key, value in self.options.attributes[expr].items():
@@ -242,7 +242,7 @@ class Param(Element):
# Do not check if file/directory exists, that is a runtime issue
try:
# Do not evaluate multiline strings (code snippets or comments)
- if dtype not in ['_multiline','_multiline_python_external']:
+ if dtype not in ['_multiline', '_multiline_python_external']:
value = self.parent_flowgraph.evaluate(expr)
if not isinstance(value, str):
raise Exception()
diff --git a/grc/gui/Application.py b/grc/gui/Application.py
index ed31b1103a..e512ee565f 100644
--- a/grc/gui/Application.py
+++ b/grc/gui/Application.py
@@ -311,24 +311,24 @@ class Application(Gtk.Application):
main.new_page()
flow_graph = main.current_page.flow_graph
Actions.BLOCK_PASTE()
- coords = (x_min,y_min)
+ coords = (x_min, y_min)
flow_graph.move_selected(coords)
# Set flow graph to heir block type
- top_block = flow_graph.get_block("top_block")
+ top_block = flow_graph.get_block("top_block")
top_block.params['generate_options'].set_value('hb')
# this needs to be a unique name
top_block.params['id'].set_value('new_hier')
# Remove the default samp_rate variable block that is created
- remove_me = flow_graph.get_block("samp_rate")
+ remove_me = flow_graph.get_block("samp_rate")
flow_graph.remove_element(remove_me)
# Add the param blocks along the top of the window
x_pos = 150
for param in params:
- param_id = flow_graph.add_new_block('parameter',(x_pos,10))
+ param_id = flow_graph.add_new_block('parameter', (x_pos, 10))
param_block = flow_graph.get_block(param_id)
param_block.params['id'].set_value(param)
x_pos = x_pos + 100
@@ -356,7 +356,7 @@ class Application(Gtk.Application):
pad_sink.dtype = source.dtype
# connect the pad to the proper sinks
- new_connection = flow_graph.connect(source,pad_sink)
+ new_connection = flow_graph.connect(source, pad_sink)
elif pad['direction'] == 'source':
pad_id = flow_graph.add_new_block('pad_source', pad['coord'])
@@ -610,8 +610,8 @@ class Application(Gtk.Application):
elif action == Actions.FLOW_GRAPH_OPEN:
file_paths = args[0] if args[0] else FileDialogs.OpenFlowGraph(main, page.file_path).run()
if file_paths: # Open a new page for each file, show only the first
- for i,file_path in enumerate(file_paths):
- main.new_page(file_path, show=(i==0))
+ for i, file_path in enumerate(file_paths):
+ main.new_page(file_path, show=(i == 0))
self.config.add_recent_file(file_path)
main.tool_bar.refresh_submenus()
#main.menu_bar.refresh_submenus()
diff --git a/grc/gui/Dialogs.py b/grc/gui/Dialogs.py
index d77a32651e..eedd724e00 100644
--- a/grc/gui/Dialogs.py
+++ b/grc/gui/Dialogs.py
@@ -129,16 +129,16 @@ class TextDisplay(SimpleTextDisplay):
"""Create a popup menu for the scroll lock and clear functions"""
menu.append(Gtk.SeparatorMenuItem())
- lock = Gtk.CheckMenuItem(label = "Scroll Lock")
+ lock = Gtk.CheckMenuItem(label="Scroll Lock")
menu.append(lock)
lock.set_active(self.scroll_lock)
lock.connect('activate', self.scroll_back_cb, view)
- save = Gtk.ImageMenuItem(label = "Save Console")
+ save = Gtk.ImageMenuItem(label="Save Console")
menu.append(save)
save.connect('activate', self.save_cb, view)
- clear = Gtk.ImageMenuItem(label = "Clear Console")
+ clear = Gtk.ImageMenuItem(label="Clear Console")
menu.append(clear)
clear.connect('activate', self.clear_cb, view)
menu.show_all()
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py
index e55346afbe..70e5e41c08 100644
--- a/grc/gui/MainWindow.py
+++ b/grc/gui/MainWindow.py
@@ -64,7 +64,7 @@ class MainWindow(Gtk.ApplicationWindow):
if not icon:
# Set default window icon
self.set_icon_from_file(os.path.dirname(os.path.abspath(__file__)) + "/icon.png")
- else :
+ else:
# Use gnuradio icon
self.set_icon(icon.load_icon())
diff --git a/grc/gui/ParamWidgets.py b/grc/gui/ParamWidgets.py
index 4e3ac5f8f1..f5425bc10e 100644
--- a/grc/gui/ParamWidgets.py
+++ b/grc/gui/ParamWidgets.py
@@ -310,16 +310,16 @@ class FileParam(EntryParam):
# build the dialog
if self.param.dtype == 'file_open':
file_dialog = Gtk.FileChooserDialog(
- title = 'Open a Data File...',action = Gtk.FileChooserAction.OPEN,
+ title='Open a Data File...', action=Gtk.FileChooserAction.OPEN,
transient_for=self._transient_for,
)
- file_dialog.add_buttons( 'gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-open' , Gtk.ResponseType.OK )
+ file_dialog.add_buttons('gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-open', Gtk.ResponseType.OK)
elif self.param.dtype == 'file_save':
file_dialog = Gtk.FileChooserDialog(
- title = 'Save a Data File...',action = Gtk.FileChooserAction.SAVE,
+ title='Save a Data File...', action=Gtk.FileChooserAction.SAVE,
transient_for=self._transient_for,
)
- file_dialog.add_buttons( 'gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-save', Gtk.ResponseType.OK )
+ file_dialog.add_buttons('gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-save', Gtk.ResponseType.OK)
file_dialog.set_do_overwrite_confirmation(True)
file_dialog.set_current_name(basename) # show the current filename
else:
@@ -349,14 +349,14 @@ class DirectoryParam(FileParam):
if self.param.dtype == "dir_select": # Setup directory selection dialog, and fail for unexpected dtype
dir_dialog = Gtk.FileChooserDialog(
- title = 'Select a Directory...', action = Gtk.FileChooserAction.SELECT_FOLDER,
- transient_for = self._transient_for
+ title='Select a Directory...', action=Gtk.FileChooserAction.SELECT_FOLDER,
+ transient_for=self._transient_for
)
else:
raise ValueError("Can't open directory chooser dialog for type " + repr(self.param.dtype))
# Set dialog properties
- dir_dialog.add_buttons( 'gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-open', Gtk.ResponseType.OK )
+ dir_dialog.add_buttons('gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-open', Gtk.ResponseType.OK)
dir_dialog.set_current_folder(dirname)
dir_dialog.set_local_only(True)
dir_dialog.set_select_multiple(False)
diff --git a/grc/gui/VariableEditor.py b/grc/gui/VariableEditor.py
index 611b096e52..b243829197 100644
--- a/grc/gui/VariableEditor.py
+++ b/grc/gui/VariableEditor.py
@@ -181,13 +181,13 @@ class VariableEditor(Gtk.VBox):
# Evaluate and show the value (if it is a variable)
if block.is_variable:
# Evaluate the params
- for key in block.params :
+ for key in block.params:
evaluated = str(block.params[key].evaluate())
self.set_tooltip_text(evaluated)
# Evaluate the block value
try:
- evaluated = str( eval(block.value,block.parent.namespace,block.namespace))
+ evaluated = str(eval(block.value, block.parent.namespace, block.namespace))
self.set_tooltip_text(evaluated)
except Exception as error:
self.set_tooltip_text(str(error))
diff --git a/grc/gui/canvas/flowgraph.py b/grc/gui/canvas/flowgraph.py
index 0f4b32a942..65db00eaff 100644
--- a/grc/gui/canvas/flowgraph.py
+++ b/grc/gui/canvas/flowgraph.py
@@ -35,7 +35,7 @@ class _ContextMenu(object):
# In GTK 3.22 Menu.popup was deprecated, we want to popup at the
# pointer, so use that new function instead if we can.
- if Gtk.check_version(3,22,0) is None:
+ if Gtk.check_version(3, 22, 0) is None:
self.popup = self._menu.popup_at_pointer
def popup(self, event):
@@ -484,7 +484,7 @@ class FlowGraph(CoreFlowgraph, Drawable):
#TODO - this is a workaround for bus ports not having a proper coordinate
# until the shape is drawn. The workaround is to draw blocks before connections
- for element in filter(lambda x: x.is_block, self._elements_to_draw) :
+ for element in filter(lambda x: x.is_block, self._elements_to_draw):
element.create_shapes()
for element in filter(lambda x: not x.is_block, self._elements_to_draw):
diff --git a/grc/gui/canvas/param.py b/grc/gui/canvas/param.py
index 26a3090153..2d472e1142 100644
--- a/grc/gui/canvas/param.py
+++ b/grc/gui/canvas/param.py
@@ -70,7 +70,7 @@ class Param(CoreParam):
tooltip_lines = ['Key: ' + self.key, 'Type: ' + self.dtype]
if self.is_valid():
value = self.get_evaluated()
- if hasattr(value,"__len__"):
+ if hasattr(value, "__len__"):
tooltip_lines.append('Length: {}'.format(len(value)))
value = str(value)
if len(value) > 100:
diff --git a/grc/gui/canvas/port.py b/grc/gui/canvas/port.py
index a4566bd91f..d963964cdc 100644
--- a/grc/gui/canvas/port.py
+++ b/grc/gui/canvas/port.py
@@ -112,7 +112,7 @@ class Port(CorePort, Drawable):
label_width, label_height = self.label_layout.get_size()
self.width = 2 * Constants.PORT_LABEL_PADDING + label_width / Pango.SCALE
- self.height = (2 * Constants.PORT_LABEL_PADDING + label_height*(3 if self.dtype == 'bus' else 1) ) / Pango.SCALE
+ self.height = (2 * Constants.PORT_LABEL_PADDING + label_height*(3 if self.dtype == 'bus' else 1)) / Pango.SCALE
self._label_layout_offsets = [0, Constants.PORT_LABEL_PADDING]
self.height += self.height % 2 # uneven height