summaryrefslogtreecommitdiff
path: root/grc/gui
diff options
context:
space:
mode:
Diffstat (limited to 'grc/gui')
-rw-r--r--grc/gui/Block.py2
-rw-r--r--grc/gui/CMakeLists.txt1
-rw-r--r--grc/gui/Executor.py41
-rw-r--r--grc/gui/FlowGraph.py2
-rw-r--r--grc/gui/ParserErrorsDialog.py2
-rw-r--r--grc/gui/PropsDialog.py2
-rw-r--r--grc/gui/Utils.py2
-rw-r--r--grc/gui/VariableEditor.py2
8 files changed, 14 insertions, 40 deletions
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 39c6993a37..b90ea485ee 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -273,7 +273,7 @@ class Block(Element, _Block):
# Show the flowgraph complexity on the top block if enabled
if Actions.TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY.get_active() and self.get_key() == "options":
complexity = calculate_flowgraph_complexity(self.get_parent())
- complexity = "Complexity: {0}bal".format(num_to_str(complexity))
+ complexity = "Complexity: {}bal".format(num_to_str(complexity))
layout = gtk.DrawingArea().create_pango_layout('')
layout.set_markup(Utils.parse_template(COMMENT_COMPLEXITY_MARKUP_TMPL,
diff --git a/grc/gui/CMakeLists.txt b/grc/gui/CMakeLists.txt
index aa9592b351..12be4a8151 100644
--- a/grc/gui/CMakeLists.txt
+++ b/grc/gui/CMakeLists.txt
@@ -22,5 +22,4 @@ file(GLOB py_files "*.py")
GR_PYTHON_INSTALL(
FILES ${py_files}
DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/gui
- COMPONENT "grc"
)
diff --git a/grc/gui/Executor.py b/grc/gui/Executor.py
index f91a341541..f5a75ab55b 100644
--- a/grc/gui/Executor.py
+++ b/grc/gui/Executor.py
@@ -15,15 +15,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-import gobject
-import os
-import threading
-import shlex
import subprocess
-import sys
-import re
+import threading
from distutils.spawn import find_executable
+import gobject
+import os
+
+from ..core.utils import shlex
from ..core import Messages
@@ -40,6 +39,7 @@ class ExecFlowGraphThread(threading.Thread):
threading.Thread.__init__(self)
self.page = flow_graph_page # store page and dont use main window calls in run
+ self.flow_graph = self.page.get_flow_graph()
self.xterm_executable = xterm_executable
self.update_callback = callback
@@ -56,16 +56,9 @@ class ExecFlowGraphThread(threading.Thread):
"""
Execute this python flow graph.
"""
- run_command = self.page.get_flow_graph().get_option('run_command')
generator = self.page.get_generator()
-
- try:
- run_command = run_command.format(
- python=shlex_quote(sys.executable),
- filename=shlex_quote(generator.file_path))
- run_command_args = shlex.split(run_command)
- except Exception as e:
- raise ValueError("Can't parse run command {!r}: {0}".format(run_command, e))
+ run_command = self.flow_graph.get_run_command(generator.file_path)
+ run_command_args = shlex.split(run_command)
# When in no gui mode on linux, use a graphical terminal (looks nice)
xterm_executable = find_executable(self.xterm_executable)
@@ -101,21 +94,3 @@ class ExecFlowGraphThread(threading.Thread):
Messages.send_end_exec(self.process.returncode)
self.page.set_proc(None)
self.update_callback()
-
-
-###########################################################
-# back-port from python3
-###########################################################
-_find_unsafe = re.compile(r'[^\w@%+=:,./-]').search
-
-
-def shlex_quote(s):
- """Return a shell-escaped version of the string *s*."""
- if not s:
- return "''"
- if _find_unsafe(s) is None:
- return s
-
- # use single quotes, and put single quotes into double quotes
- # the string $'b is then quoted as '$'"'"'b'
- return "'" + s.replace("'", "'\"'\"'") + "'"
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index e0cd7d1441..5bcf018120 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -77,7 +77,7 @@ class FlowGraph(Element, _Flowgraph):
a unique id
"""
for index in count():
- block_id = '{0}_{1}'.format(base_id, index)
+ block_id = '{}_{}'.format(base_id, index)
if block_id not in (b.get_id() for b in self.blocks):
break
return block_id
diff --git a/grc/gui/ParserErrorsDialog.py b/grc/gui/ParserErrorsDialog.py
index 57485eda93..68ee459414 100644
--- a/grc/gui/ParserErrorsDialog.py
+++ b/grc/gui/ParserErrorsDialog.py
@@ -83,7 +83,7 @@ class ParserErrorsDialog(gtk.Dialog):
em = self.tree_store.append(parent, ["Line {e.line}: {e.message}".format(e=error)])
if code:
self.tree_store.append(em, ["\n".join(
- "{0} {1}{2}".format(line, code[line - 1].replace("\t", " ").strip("\n"),
+ "{} {}{}".format(line, code[line - 1].replace("\t", " ").strip("\n"),
" " * 20 + "<!-- ERROR -->" if line == error.line else "")
for line in range(error.line - 2, error.line + 3) if 0 < line <= len(code)
)])
diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py
index cfea13e1a8..a5b46cbbac 100644
--- a/grc/gui/PropsDialog.py
+++ b/grc/gui/PropsDialog.py
@@ -267,7 +267,7 @@ class PropsDialog(gtk.Dialog):
insert('\n\n# Variables\n', block.get_var_make())
insert('\n\n# Blocks\n', block.get_make())
if src:
- insert('\n\n# External Code ({0}.py)\n'.format(block.get_id()), src)
+ insert('\n\n# External Code ({}.py)\n'.format(block.get_id()), src)
def _handle_key_press(self, widget, event):
"""
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
index d85b846b3a..7d15d47142 100644
--- a/grc/gui/Utils.py
+++ b/grc/gui/Utils.py
@@ -97,7 +97,7 @@ def encode(value):
character.
"""
- valid_utf8 = value.decode('utf-8', 'replace').encode('utf-8')
+ valid_utf8 = value.decode('utf-8', errors='replace').encode('utf-8')
return gobject.markup_escape_text(valid_utf8)
diff --git a/grc/gui/VariableEditor.py b/grc/gui/VariableEditor.py
index 362a7f687d..7721f3bda6 100644
--- a/grc/gui/VariableEditor.py
+++ b/grc/gui/VariableEditor.py
@@ -270,7 +270,7 @@ class VariableEditor(gtk.VBox):
# Create a context menu to confirm the delete operation
confirmation_menu = gtk.Menu()
block_id = self._block.get_param('id').get_value().replace("_", "__")
- confirm = gtk.MenuItem("Delete {0}".format(block_id))
+ confirm = gtk.MenuItem("Delete {}".format(block_id))
confirm.connect('activate', self.handle_action, self.DELETE_BLOCK)
confirmation_menu.add(confirm)
confirmation_menu.show_all()