diff options
author | Clayton Smith <argilo@gmail.com> | 2020-10-03 12:34:28 -0400 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2020-10-05 09:36:11 +0200 |
commit | b360284d9b40799f1920929453e2db6e6384ae4e (patch) | |
tree | d0b6a4a9195c2cf62fd4a13c69deb52b6b14c631 /grc/gui | |
parent | 5f618c67a9f8790337ca6b8b80575d02385e8ae9 (diff) |
grc: remove six
Diffstat (limited to 'grc/gui')
-rw-r--r-- | grc/gui/Actions.py | 1 | ||||
-rw-r--r-- | grc/gui/BlockTreeWindow.py | 6 | ||||
-rw-r--r-- | grc/gui/Config.py | 3 | ||||
-rw-r--r-- | grc/gui/ParserErrorsDialog.py | 4 | ||||
-rw-r--r-- | grc/gui/PropsDialog.py | 3 | ||||
-rw-r--r-- | grc/gui/Utils.py | 12 | ||||
-rw-r--r-- | grc/gui/canvas/block.py | 12 | ||||
-rw-r--r-- | grc/gui/canvas/drawable.py | 2 | ||||
-rw-r--r-- | grc/gui/canvas/flowgraph.py | 2 |
9 files changed, 11 insertions, 34 deletions
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py index 9f9049c711..452a8d0428 100644 --- a/grc/gui/Actions.py +++ b/grc/gui/Actions.py @@ -7,7 +7,6 @@ SPDX-License-Identifier: GPL-2.0-or-later """ -import six import logging from gi.repository import Gtk, Gdk, Gio, GLib, GObject diff --git a/grc/gui/BlockTreeWindow.py b/grc/gui/BlockTreeWindow.py index 397c4ceee9..a52739e0e8 100644 --- a/grc/gui/BlockTreeWindow.py +++ b/grc/gui/BlockTreeWindow.py @@ -6,8 +6,6 @@ SPDX-License-Identifier: GPL-2.0-or-later """ -import six - from gi.repository import Gtk, Gdk, GObject from . import Actions, Utils, Constants @@ -20,7 +18,7 @@ def _format_doc(doc): docs = [] if doc.get(''): docs += doc.get('').splitlines() + [''] - for block_name, docstring in six.iteritems(doc): + for block_name, docstring in doc.items(): docs.append('--- {0} ---'.format(block_name)) docs += docstring.splitlines() docs.append('') @@ -121,7 +119,7 @@ class BlockTreeWindow(Gtk.VBox): def repopulate(self): self.clear() - for block in six.itervalues(self.platform.blocks): + for block in self.platform.blocks.values(): if block.category: self.add_block(block) self.expand_module_in_tree() diff --git a/grc/gui/Config.py b/grc/gui/Config.py index 01f687a7d0..ee354ba54d 100644 --- a/grc/gui/Config.py +++ b/grc/gui/Config.py @@ -9,12 +9,11 @@ SPDX-License-Identifier: GPL-2.0-or-later import sys import os +import configparser from ..core.Config import Config as CoreConfig from . import Constants -from six.moves import configparser - HEADER = """\ # This contains only GUI settings for GRC and is not meant for users to edit. # diff --git a/grc/gui/ParserErrorsDialog.py b/grc/gui/ParserErrorsDialog.py index 9e539852ce..12f6f4c7a7 100644 --- a/grc/gui/ParserErrorsDialog.py +++ b/grc/gui/ParserErrorsDialog.py @@ -7,8 +7,6 @@ SPDX-License-Identifier: GPL-2.0-or-later """ -import six - from gi.repository import Gtk, GObject from .Constants import MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT @@ -61,7 +59,7 @@ class ParserErrorsDialog(Gtk.Dialog): """set up data model""" self.tree_store.clear() self._error_logs = error_logs - for filename, errors in six.iteritems(error_logs): + for filename, errors in error_logs.items(): parent = self.tree_store.append(None, [str(filename)]) try: with open(filename, 'r') as fp: diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py index 74e302ab90..634d6f9d45 100644 --- a/grc/gui/PropsDialog.py +++ b/grc/gui/PropsDialog.py @@ -10,7 +10,6 @@ from gi.repository import Gtk, Gdk, GObject, Pango from . import Actions, Utils, Constants from .Dialogs import SimpleTextDisplay -import six class PropsDialog(Gtk.Dialog): @@ -232,7 +231,7 @@ class PropsDialog(Gtk.Dialog): docstrings = {block_class: docstrings[block_class]} # show docstring(s) extracted from python sources - for cls_name, docstring in six.iteritems(docstrings): + for cls_name, docstring in docstrings.items(): buf.insert_with_tags_by_name(pos, cls_name + '\n', 'b') buf.insert(pos, docstring + '\n\n') pos.backward_chars(2) diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py index bf80147a62..165537c383 100644 --- a/grc/gui/Utils.py +++ b/grc/gui/Utils.py @@ -13,7 +13,6 @@ import numbers from gi.repository import GLib import cairo -import six from .canvas.colors import FLOWGRAPH_BACKGROUND_COLOR from . import Constants @@ -95,16 +94,7 @@ def num_to_str(num): def encode(value): - """Make sure that we pass only valid utf-8 strings into markup_escape_text. - - Older versions of glib seg fault if the last byte starts a multi-byte - character. - """ - if six.PY2: - valid_utf8 = value.decode('utf-8', errors='replace').encode('utf-8') - else: - valid_utf8 = value - return GLib.markup_escape_text(valid_utf8) + return GLib.markup_escape_text(value) def make_screenshot(flow_graph, file_path, transparent_bg=False): diff --git a/grc/gui/canvas/block.py b/grc/gui/canvas/block.py index 869e6f4f6f..af7f2ba9ad 100644 --- a/grc/gui/canvas/block.py +++ b/grc/gui/canvas/block.py @@ -9,7 +9,6 @@ SPDX-License-Identifier: GPL-2.0-or-later import math -import six from gi.repository import Gtk, Pango, PangoCairo from . import colors @@ -123,7 +122,7 @@ class Block(CoreBlock, Drawable): port_separation = PORT_SEPARATION if not has_busses else ports[0].height + PORT_SPACING offset = (self.height - (len(ports) - 1) * port_separation - ports[0].height) / 2 for port in ports: - port.create_shapes() + port.create_shapes() port.coordinate = { 0: (+self.width, offset), 90: (offset, -port.width), @@ -153,7 +152,7 @@ class Block(CoreBlock, Drawable): ) ) title_width, title_height = title_layout.get_size() - + force_show_id = Actions.TOGGLE_SHOW_BLOCK_IDS.get_active() # update the params layout @@ -186,7 +185,7 @@ class Block(CoreBlock, Drawable): min_height = 2 * PORT_BORDER_SEPARATION + sum( port.height + PORT_SPACING for port in ports if port.dtype == 'bus' ) - PORT_SPACING - + else: if ports: min_height -= ports[-1].height @@ -344,7 +343,7 @@ class Block(CoreBlock, Drawable): type_templates = ' '.join(p.dtype for p in self.params.values()) + ' ' type_templates += ' '.join(p.get_raw('dtype') for p in (self.sinks + self.sources)) type_param = None - for key, param in six.iteritems(self.params): + for key, param in self.params.items(): if not param.is_enum(): continue # Priority to the type controller @@ -381,7 +380,7 @@ class Block(CoreBlock, Drawable): # Concat the nports string from the private nports settings of all ports nports_str = ' '.join(str(port.get_raw('multiplicity')) for port in self.ports()) # Modify all params whose keys appear in the nports string - for key, param in six.iteritems(self.params): + for key, param in self.params.items(): if param.is_enum() or param.key not in nports_str: continue # Try to increment the port controller by direction @@ -394,4 +393,3 @@ class Block(CoreBlock, Drawable): # Should we be logging something here pass return changed - diff --git a/grc/gui/canvas/drawable.py b/grc/gui/canvas/drawable.py index 18c3391978..a586a7edc6 100644 --- a/grc/gui/canvas/drawable.py +++ b/grc/gui/canvas/drawable.py @@ -8,8 +8,6 @@ SPDX-License-Identifier: GPL-2.0-or-later from ..Constants import LINE_SELECT_SENSITIVITY -from six.moves import zip - class Drawable(object): """ diff --git a/grc/gui/canvas/flowgraph.py b/grc/gui/canvas/flowgraph.py index 6d278df589..0f4b32a942 100644 --- a/grc/gui/canvas/flowgraph.py +++ b/grc/gui/canvas/flowgraph.py @@ -13,9 +13,7 @@ import random from distutils.spawn import find_executable from itertools import count -import six from gi.repository import GLib, Gtk -from six.moves import filter from . import colors from .drawable import Drawable |