diff --git a/pyface/ui/qt4/about_dialog.py b/pyface/ui/qt4/about_dialog.py index 3aae26e89..e9ccc0982 100644 --- a/pyface/ui/qt4/about_dialog.py +++ b/pyface/ui/qt4/about_dialog.py @@ -86,7 +86,7 @@ def destroy(self): signal, handler = self._connections_to_remove.pop() signal.disconnect(handler) - super(AboutDialog, self).destroy() + super().destroy() # ------------------------------------------------------------------------ # Protected 'IDialog' interface. diff --git a/pyface/ui/qt4/action/action_item.py b/pyface/ui/qt4/action/action_item.py index e6fdcc379..b5ed8bfa7 100644 --- a/pyface/ui/qt4/action/action_item.py +++ b/pyface/ui/qt4/action/action_item.py @@ -26,7 +26,7 @@ class PyfaceWidgetAction(QtGui.QWidgetAction): def __init__(self, parent, action): - super(PyfaceWidgetAction, self).__init__(parent) + super().__init__(parent) self.action = action def createWidget(self, parent): diff --git a/pyface/ui/qt4/action/menu_manager.py b/pyface/ui/qt4/action/menu_manager.py index 6b5cb7e4a..f483d32a2 100644 --- a/pyface/ui/qt4/action/menu_manager.py +++ b/pyface/ui/qt4/action/menu_manager.py @@ -75,7 +75,7 @@ def destroy(self): menu = self._menus.pop() menu.dispose() - super(MenuManager, self).destroy() + super().destroy() # ------------------------------------------------------------------------ # 'ActionManagerItem' interface. @@ -171,7 +171,7 @@ def clear(self): self.menu_items = [] - super(_Menu, self).clear() + super().clear() def is_empty(self): """ Is the menu empty? """ diff --git a/pyface/ui/qt4/action/tool_bar_manager.py b/pyface/ui/qt4/action/tool_bar_manager.py index 685ba5bca..a9b30d6b8 100644 --- a/pyface/ui/qt4/action/tool_bar_manager.py +++ b/pyface/ui/qt4/action/tool_bar_manager.py @@ -66,7 +66,7 @@ def __init__(self, *args, **traits): """ Creates a new tool bar manager. """ # Base class constructor. - super(ToolBarManager, self).__init__(*args, **traits) + super().__init__(*args, **traits) # An image cache to make sure that we only load each image used in the # tool bar exactly once. @@ -121,7 +121,7 @@ def destroy(self): toolbar = self._toolbars.pop() toolbar.dispose() - super(ToolBarManager, self).destroy() + super().destroy() # ------------------------------------------------------------------------ # Private interface. diff --git a/pyface/ui/qt4/application_window.py b/pyface/ui/qt4/application_window.py index fdab9917e..8af5b6fd1 100644 --- a/pyface/ui/qt4/application_window.py +++ b/pyface/ui/qt4/application_window.py @@ -129,7 +129,7 @@ def _size_default(self): # ------------------------------------------------------------------------ def _create(self): - super(ApplicationWindow, self)._create() + super()._create() contents = self._create_contents(self.control) self.control.setCentralWidget(contents) @@ -137,7 +137,7 @@ def _create(self): self._create_trim_widgets(self.control) def _create_control(self, parent): - control = super(ApplicationWindow, self)._create_control(parent) + control = super()._create_control(parent) control.setObjectName("ApplicationWindow") control.setAnimated(False) diff --git a/pyface/ui/qt4/code_editor/code_widget.py b/pyface/ui/qt4/code_editor/code_widget.py index 1ab23177a..c2e99b393 100644 --- a/pyface/ui/qt4/code_editor/code_widget.py +++ b/pyface/ui/qt4/code_editor/code_widget.py @@ -33,7 +33,7 @@ class CodeWidget(QtGui.QPlainTextEdit): def __init__( self, parent, should_highlight_current_line=True, font=None, lexer=None ): - super(CodeWidget, self).__init__(parent) + super().__init__(parent) self.highlighter = PygmentsHighlighter(self.document(), lexer) self.line_number_widget = LineNumberWidget(self) @@ -387,7 +387,7 @@ def keyPressEvent_action(self, event): def keyPressEvent(self, event): if self.isReadOnly(): - return super(CodeWidget, self).keyPressEvent(event) + return super().keyPressEvent(event) key_sequence = QtGui.QKeySequence(event.key() + int(event.modifiers())) @@ -432,7 +432,7 @@ def keyPressEvent(self, event): event.accept() return self.block_unindent() - return super(CodeWidget, self).keyPressEvent(event) + return super().keyPressEvent(event) def resizeEvent(self, event): QtGui.QPlainTextEdit.resizeEvent(self, event) @@ -558,7 +558,7 @@ class AdvancedCodeWidget(QtGui.QWidget): # ------------------------------------------------------------------------ def __init__(self, parent, font=None, lexer=None): - super(AdvancedCodeWidget, self).__init__(parent) + super().__init__(parent) self.code = CodeWidget(self, font=font, lexer=lexer) self.find = FindWidget(self) @@ -804,7 +804,7 @@ def keyPressEvent(self, event): self.previous_find_widget = self.active_find_widget self.active_find_widget = None - return super(AdvancedCodeWidget, self).keyPressEvent(event) + return super().keyPressEvent(event) # ------------------------------------------------------------------------ # Private methods diff --git a/pyface/ui/qt4/code_editor/find_widget.py b/pyface/ui/qt4/code_editor/find_widget.py index e8961b8f4..d8383805c 100644 --- a/pyface/ui/qt4/code_editor/find_widget.py +++ b/pyface/ui/qt4/code_editor/find_widget.py @@ -16,7 +16,7 @@ class FindWidget(QtGui.QWidget): def __init__(self, parent): - super(FindWidget, self).__init__(parent) + super().__init__(parent) self.adv_code_widget = weakref.ref(parent) # QFontMetrics.width() is deprecated and Qt docs suggest using diff --git a/pyface/ui/qt4/code_editor/gutters.py b/pyface/ui/qt4/code_editor/gutters.py index 27c958b9a..a64bfa9c3 100644 --- a/pyface/ui/qt4/code_editor/gutters.py +++ b/pyface/ui/qt4/code_editor/gutters.py @@ -39,7 +39,7 @@ class StatusGutterWidget(GutterWidget): """ def __init__(self, *args, **kw): - super(StatusGutterWidget, self).__init__(*args, **kw) + super().__init__(*args, **kw) self.error_lines = [] self.warn_lines = [] diff --git a/pyface/ui/qt4/code_editor/pygments_highlighter.py b/pyface/ui/qt4/code_editor/pygments_highlighter.py index f6ade3690..e6c1cdc89 100644 --- a/pyface/ui/qt4/code_editor/pygments_highlighter.py +++ b/pyface/ui/qt4/code_editor/pygments_highlighter.py @@ -138,7 +138,7 @@ class PygmentsHighlighter(QtGui.QSyntaxHighlighter): """ Syntax highlighter that uses Pygments for parsing. """ def __init__(self, parent, lexer=None): - super(PygmentsHighlighter, self).__init__(parent) + super().__init__(parent) try: self._lexer = get_lexer_by_name(lexer) diff --git a/pyface/ui/qt4/code_editor/replace_widget.py b/pyface/ui/qt4/code_editor/replace_widget.py index 85cb4bc3f..05b205184 100644 --- a/pyface/ui/qt4/code_editor/replace_widget.py +++ b/pyface/ui/qt4/code_editor/replace_widget.py @@ -18,6 +18,8 @@ class ReplaceWidget(FindWidget): def __init__(self, parent): + # We explicitly call __init__ on the classes which FindWidget inherits from + # instead of calling FindWidget.__init__. super(FindWidget, self).__init__(parent) self.adv_code_widget = weakref.ref(parent) diff --git a/pyface/ui/qt4/console/bracket_matcher.py b/pyface/ui/qt4/console/bracket_matcher.py index 28a632bc2..ea0a5d72e 100644 --- a/pyface/ui/qt4/console/bracket_matcher.py +++ b/pyface/ui/qt4/console/bracket_matcher.py @@ -32,7 +32,7 @@ def __init__(self, text_edit): text edit widget. """ assert isinstance(text_edit, (QtGui.QTextEdit, QtGui.QPlainTextEdit)) - super(BracketMatcher, self).__init__() + super().__init__() # The format to apply to matching brackets. self.format = QtGui.QTextCharFormat() diff --git a/pyface/ui/qt4/console/call_tip_widget.py b/pyface/ui/qt4/console/call_tip_widget.py index cec290f08..93329ccae 100644 --- a/pyface/ui/qt4/console/call_tip_widget.py +++ b/pyface/ui/qt4/console/call_tip_widget.py @@ -28,7 +28,7 @@ def __init__(self, text_edit): text edit widget. """ assert isinstance(text_edit, (QtGui.QTextEdit, QtGui.QPlainTextEdit)) - super(CallTipWidget, self).__init__(None, QtCore.Qt.ToolTip) + super().__init__(None, QtCore.Qt.ToolTip) self._hide_timer = QtCore.QBasicTimer() self._text_edit = text_edit @@ -78,7 +78,7 @@ def eventFilter(self, obj, event): elif etype == QtCore.QEvent.Leave: self._leave_event_hide() - return super(CallTipWidget, self).eventFilter(obj, event) + return super().eventFilter(obj, event) def timerEvent(self, event): """ Reimplemented to hide the widget when the hide timer fires. @@ -94,13 +94,13 @@ def timerEvent(self, event): def enterEvent(self, event): """ Reimplemented to cancel the hide timer. """ - super(CallTipWidget, self).enterEvent(event) + super().enterEvent(event) self._hide_timer.stop() def hideEvent(self, event): """ Reimplemented to disconnect signal handlers and event filter. """ - super(CallTipWidget, self).hideEvent(event) + super().hideEvent(event) self._text_edit.cursorPositionChanged.disconnect( self._cursor_position_changed ) @@ -109,7 +109,7 @@ def hideEvent(self, event): def leaveEvent(self, event): """ Reimplemented to start the hide timer. """ - super(CallTipWidget, self).leaveEvent(event) + super().leaveEvent(event) self._leave_event_hide() def paintEvent(self, event): @@ -121,17 +121,17 @@ def paintEvent(self, event): painter.drawPrimitive(QtGui.QStyle.PE_PanelTipLabel, option) painter.end() - super(CallTipWidget, self).paintEvent(event) + super().paintEvent(event) def setFont(self, font): """ Reimplemented to allow use of this method as a slot. """ - super(CallTipWidget, self).setFont(font) + super().setFont(font) def showEvent(self, event): """ Reimplemented to connect signal handlers and event filter. """ - super(CallTipWidget, self).showEvent(event) + super().showEvent(event) self._text_edit.cursorPositionChanged.connect( self._cursor_position_changed ) diff --git a/pyface/ui/qt4/console/console_widget.py b/pyface/ui/qt4/console/console_widget.py index 61b2f6ecf..5023660df 100644 --- a/pyface/ui/qt4/console/console_widget.py +++ b/pyface/ui/qt4/console/console_widget.py @@ -134,7 +134,7 @@ def __init__(self, parent=None): parent : QWidget, optional [default None] The parent for this widget. """ - super(ConsoleWidget, self).__init__(parent) + super().__init__(parent) # A list of connected Qt signals to be removed before destruction. # First item in the tuple is the Qt signal. The second item is the @@ -310,7 +310,7 @@ def eventFilter(self, obj, event): QtGui.QApplication.sendEvent(obj, QtGui.QDragLeaveEvent()) return True - return super(ConsoleWidget, self).eventFilter(obj, event) + return super().eventFilter(obj, event) def _remove_event_listeners(self): while self._connections_to_remove: diff --git a/pyface/ui/qt4/console/history_console_widget.py b/pyface/ui/qt4/console/history_console_widget.py index b5436422c..ec08a9d47 100644 --- a/pyface/ui/qt4/console/history_console_widget.py +++ b/pyface/ui/qt4/console/history_console_widget.py @@ -25,7 +25,7 @@ class HistoryConsoleWidget(ConsoleWidget): # --------------------------------------------------------------------------- def __init__(self, *args, **kw): - super(HistoryConsoleWidget, self).__init__(*args, **kw) + super().__init__(*args, **kw) # HistoryConsoleWidget protected variables. self._history = [] @@ -42,9 +42,7 @@ def execute(self, source=None, hidden=False, interactive=False): if not hidden: history = self.input_buffer if source is None else source - executed = super(HistoryConsoleWidget, self).execute( - source, hidden, interactive - ) + executed = super().execute(source, hidden, interactive) if executed and not hidden: # Save the command unless it was an empty string or was identical diff --git a/pyface/ui/qt4/dialog.py b/pyface/ui/qt4/dialog.py index 4c0b70b59..c65645029 100644 --- a/pyface/ui/qt4/dialog.py +++ b/pyface/ui/qt4/dialog.py @@ -157,7 +157,7 @@ def destroy(self): signal, handler = self._connections_to_remove.pop() signal.disconnect(handler) - super(Dialog, self).destroy() + super().destroy() # ------------------------------------------------------------------------ # Protected 'IWidget' interface. diff --git a/pyface/ui/qt4/directory_dialog.py b/pyface/ui/qt4/directory_dialog.py index c8cb387d8..3fcade61c 100644 --- a/pyface/ui/qt4/directory_dialog.py +++ b/pyface/ui/qt4/directory_dialog.py @@ -60,7 +60,7 @@ def close(self): self.path = "" # Let the window close as normal. - super(DirectoryDialog, self).close() + super().close() # ------------------------------------------------------------------------ # Protected 'IWidget' interface. diff --git a/pyface/ui/qt4/file_dialog.py b/pyface/ui/qt4/file_dialog.py index 22f158ac8..1587a73b9 100644 --- a/pyface/ui/qt4/file_dialog.py +++ b/pyface/ui/qt4/file_dialog.py @@ -104,7 +104,7 @@ def close(self): ) # Let the window close as normal. - super(FileDialog, self).close() + super().close() # ------------------------------------------------------------------------ # Protected 'IWidget' interface. diff --git a/pyface/ui/qt4/gui.py b/pyface/ui/qt4/gui.py index 39911de0d..9749ad627 100644 --- a/pyface/ui/qt4/gui.py +++ b/pyface/ui/qt4/gui.py @@ -142,7 +142,7 @@ class _FutureCall(QtCore.QObject): _pyface_event = QtCore.QEvent.Type(QtCore.QEvent.registerEventType()) def __init__(self, ms, callable, *args, **kw): - super(_FutureCall, self).__init__() + super().__init__() # Save the arguments. self._ms = ms @@ -184,7 +184,7 @@ def event(self, event): QtCore.QTimer.singleShot(self._ms, self._dispatch) return True - return super(_FutureCall, self).event(event) + return super().event(event) def _dispatch(self): """ Invoke the callable. diff --git a/pyface/ui/qt4/heading_text.py b/pyface/ui/qt4/heading_text.py index a8fe725ec..227594578 100644 --- a/pyface/ui/qt4/heading_text.py +++ b/pyface/ui/qt4/heading_text.py @@ -42,7 +42,7 @@ def __init__(self, parent, **traits): """ Creates the panel. """ # Base class constructor. - super(HeadingText, self).__init__(**traits) + super().__init__(**traits) # Create the toolkit-specific control that represents the widget. self._create_control(parent) diff --git a/pyface/ui/qt4/progress_dialog.py b/pyface/ui/qt4/progress_dialog.py index 283078545..8d1e1c737 100644 --- a/pyface/ui/qt4/progress_dialog.py +++ b/pyface/ui/qt4/progress_dialog.py @@ -96,7 +96,7 @@ class ProgressDialog(MProgressDialog, Window): def open(self): """ Opens the window. """ - super(ProgressDialog, self).open() + super().open() self._start_time = time.time() def close(self): @@ -104,7 +104,7 @@ def close(self): self.progress_bar.destroy() self.progress_bar = None - super(ProgressDialog, self).close() + super().close() # ------------------------------------------------------------------------- # 'IWidget' interface. @@ -115,7 +115,7 @@ def destroy(self): signal, handler = self._connections_to_remove.pop() signal.disconnect(handler) - super(ProgressDialog, self).destroy() + super().destroy() # ------------------------------------------------------------------------- # IProgressDialog Interface @@ -273,7 +273,7 @@ def _create_control(self, parent): return QtGui.QDialog(parent) def _create(self): - super(ProgressDialog, self)._create() + super()._create() self._create_contents(self.control) def _create_contents(self, parent): diff --git a/pyface/ui/qt4/python_editor.py b/pyface/ui/qt4/python_editor.py index 70a1ed9f7..dec9bf6a0 100644 --- a/pyface/ui/qt4/python_editor.py +++ b/pyface/ui/qt4/python_editor.py @@ -47,7 +47,7 @@ class PythonEditor(MPythonEditor, Widget): # ------------------------------------------------------------------------ def __init__(self, parent, **traits): - super(PythonEditor, self).__init__(parent=parent, **traits) + super().__init__(parent=parent, **traits) self._create() # ------------------------------------------------------------------------ @@ -96,7 +96,7 @@ def select_line(self, lineno): # ------------------------------------------------------------------------ def _add_event_listeners(self): - super(PythonEditor, self)._add_event_listeners() + super()._add_event_listeners() self.control.code.installEventFilter(self._event_filter) # Connect signals for text changes. @@ -116,7 +116,7 @@ def _remove_event_listeners(self): if self._event_filter is not None: self.control.code.removeEventFilter(self._event_filter) - super(PythonEditor, self)._remove_event_listeners() + super()._remove_event_listeners() def __event_filter_default(self): return PythonEditorEventFilter(self, self.control) @@ -168,7 +168,7 @@ class PythonEditorEventFilter(QtCore.QObject): """ def __init__(self, editor, parent): - super(PythonEditorEventFilter, self).__init__(parent) + super().__init__(parent) self.__editor = editor def eventFilter(self, obj, event): @@ -211,4 +211,4 @@ def eventFilter(self, obj, event): event=event, ) - return super(PythonEditorEventFilter, self).eventFilter(obj, event) + return super().eventFilter(obj, event) diff --git a/pyface/ui/qt4/python_shell.py b/pyface/ui/qt4/python_shell.py index 1b06bd78f..e3728be6f 100644 --- a/pyface/ui/qt4/python_shell.py +++ b/pyface/ui/qt4/python_shell.py @@ -57,7 +57,7 @@ class PythonShell(MPythonShell, Widget): # FIXME v3: Either make this API consistent with other Widget sub-classes # or make it a sub-class of HasTraits. def __init__(self, parent, **traits): - super(PythonShell, self).__init__(parent=parent, **traits) + super().__init__(parent=parent, **traits) # Create the toolkit-specific control that represents the widget. self._create() @@ -109,7 +109,7 @@ def _create_control(self, parent): return PyfacePythonWidget(self, parent) def _add_event_listeners(self): - super(PythonShell, self)._add_event_listeners() + super()._add_event_listeners() # Connect signals for events. self.control.executed.connect(self._on_command_executed) @@ -123,7 +123,7 @@ def _remove_event_listeners(self): self.control._remove_event_listeners() - super(PythonShell, self)._remove_event_listeners() + super()._remove_event_listeners() def __event_filter_default(self): return _DropEventEmitter(self.control) @@ -169,7 +169,7 @@ class PythonWidget(HistoryConsoleWidget): # -------------------------------------------------------------------------- def __init__(self, parent=None): - super(PythonWidget, self).__init__(parent) + super().__init__(parent) # PythonWidget attributes. self.locals = dict(__name__="__console__", __doc__=None) @@ -209,7 +209,7 @@ def _remove_event_listeners(self): self._bracket_matcher._remove_event_listeners() - super(PythonWidget, self)._remove_event_listeners() + super()._remove_event_listeners() # -------------------------------------------------------------------------- # file-like object interface @@ -352,12 +352,12 @@ def _event_filter_console_keypress(self, event): cursor.removeSelectedText() return True - return super(PythonWidget, self)._event_filter_console_keypress(event) + return super()._event_filter_console_keypress(event) def _insert_continuation_prompt(self, cursor): """ Reimplemented for auto-indentation. """ - super(PythonWidget, self)._insert_continuation_prompt(cursor) + super()._insert_continuation_prompt(cursor) source = self.input_buffer space = 0 for c in source.splitlines()[-1]: @@ -514,9 +514,7 @@ class PythonWidgetHighlighter(PygmentsHighlighter): """ def __init__(self, python_widget): - super(PythonWidgetHighlighter, self).__init__( - python_widget._control.document() - ) + super().__init__(python_widget._control.document()) self._current_offset = 0 self._python_widget = python_widget self.highlighting_on = False @@ -546,21 +544,21 @@ def highlightBlock(self, string): else: self._current_offset = 0 - super(PythonWidgetHighlighter, self).highlightBlock(string) + super().highlightBlock(string) def rehighlightBlock(self, block): """ Reimplemented to temporarily enable highlighting if disabled. """ old = self.highlighting_on self.highlighting_on = True - super(PythonWidgetHighlighter, self).rehighlightBlock(block) + super().rehighlightBlock(block) self.highlighting_on = old def setFormat(self, start, count, format): """ Reimplemented to highlight selectively. """ start += self._current_offset - super(PythonWidgetHighlighter, self).setFormat(start, count, format) + super().setFormat(start, count, format) # ------------------------------------------------------------------------------- @@ -582,7 +580,7 @@ def __init__(self, pyface_widget, *args, **kw): """ self._pyface_widget = pyface_widget - super(PyfacePythonWidget, self).__init__(*args, **kw) + super().__init__(*args, **kw) # --------------------------------------------------------------------------- # 'QWidget' interface @@ -612,7 +610,7 @@ def keyPressEvent(self, event): event=event, ) - super(PyfacePythonWidget, self).keyPressEvent(event) + super().keyPressEvent(event) class _DropEventEmitter(QtCore.QObject): diff --git a/pyface/ui/qt4/single_choice_dialog.py b/pyface/ui/qt4/single_choice_dialog.py index 6740eec3b..220ff337d 100644 --- a/pyface/ui/qt4/single_choice_dialog.py +++ b/pyface/ui/qt4/single_choice_dialog.py @@ -86,7 +86,7 @@ def close(self): self.choice = None # Let the window close as normal. - super(SingleChoiceDialog, self).close() + super().close() # ------------------------------------------------------------------------ # Protected 'IWidget' interface. diff --git a/pyface/ui/qt4/tasks/advanced_editor_area_pane.py b/pyface/ui/qt4/tasks/advanced_editor_area_pane.py index 716881249..e8dcf6184 100644 --- a/pyface/ui/qt4/tasks/advanced_editor_area_pane.py +++ b/pyface/ui/qt4/tasks/advanced_editor_area_pane.py @@ -110,7 +110,7 @@ def destroy(self): signal, handler = self._connections_to_remove.pop() signal.disconnect(handler) - super(AdvancedEditorAreaPane, self).destroy() + super().destroy() # ------------------------------------------------------------------------ # 'IEditorAreaPane' interface. @@ -267,7 +267,7 @@ class EditorAreaWidget(QtGui.QMainWindow): # ------------------------------------------------------------------------ def __init__(self, editor_area, parent=None): - super(EditorAreaWidget, self).__init__(parent) + super().__init__(parent) self.editor_area = editor_area self.reset_drag() @@ -451,7 +451,7 @@ def set_hover_widget(self, widget): def childEvent(self, event): """ Reimplemented to gain access to the tab bars as they are created. """ - super(EditorAreaWidget, self).childEvent(event) + super().childEvent(event) if event.polished(): child = event.child() if isinstance(child, QtGui.QTabBar): @@ -608,7 +608,7 @@ class EditorWidget(QtGui.QDockWidget): """ def __init__(self, editor, parent=None): - super(EditorWidget, self).__init__(parent) + super().__init__(parent) self.editor = editor self.editor.create(self) self.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea) @@ -672,7 +672,7 @@ class EditorTitleBarWidget(QtGui.QTabBar): """ def __init__(self, editor_widget): - super(EditorTitleBarWidget, self).__init__(editor_widget) + super().__init__(editor_widget) self.addTab(editor_widget.windowTitle()) self.setTabToolTip(0, editor_widget.editor.tooltip) self.setDocumentMode(True) diff --git a/pyface/ui/qt4/tasks/dock_pane.py b/pyface/ui/qt4/tasks/dock_pane.py index 91e53f6ea..7b6f5dfe5 100644 --- a/pyface/ui/qt4/tasks/dock_pane.py +++ b/pyface/ui/qt4/tasks/dock_pane.py @@ -98,7 +98,7 @@ def destroy(self): control.topLevelChanged.disconnect(self._receive_floating) control.visibilityChanged.disconnect(self._receive_visible) - super(DockPane, self).destroy() + super().destroy() def set_focus(self): """ Gives focus to the control that represents the pane. diff --git a/pyface/ui/qt4/tasks/editor_area_pane.py b/pyface/ui/qt4/tasks/editor_area_pane.py index 08c5c5abb..3f9af8730 100644 --- a/pyface/ui/qt4/tasks/editor_area_pane.py +++ b/pyface/ui/qt4/tasks/editor_area_pane.py @@ -110,7 +110,7 @@ def destroy(self): signal, handler = self._connections_to_remove.pop() signal.disconnect(handler) - super(EditorAreaPane, self).destroy() + super().destroy() # ------------------------------------------------------------------------ # 'IEditorAreaPane' interface. @@ -223,7 +223,7 @@ class EditorAreaWidget(QtGui.QTabWidget): """ def __init__(self, editor_area, parent=None): - super(EditorAreaWidget, self).__init__(parent) + super().__init__(parent) self.editor_area = editor_area # Configure the QTabWidget. @@ -248,7 +248,7 @@ class EditorAreaDropFilter(QtCore.QObject): """ def __init__(self, editor_area): - super(EditorAreaDropFilter, self).__init__() + super().__init__() self.editor_area = editor_area def eventFilter(self, object, event): @@ -275,4 +275,4 @@ def eventFilter(self, object, event): return True - return super(EditorAreaDropFilter, self).eventFilter(object, event) + return super().eventFilter(object, event) diff --git a/pyface/ui/qt4/tasks/split_editor_area_pane.py b/pyface/ui/qt4/tasks/split_editor_area_pane.py index bffc01a30..68c6effa6 100644 --- a/pyface/ui/qt4/tasks/split_editor_area_pane.py +++ b/pyface/ui/qt4/tasks/split_editor_area_pane.py @@ -142,7 +142,7 @@ def destroy(self): # together with the main control self.active_tabwidget = None - super(SplitEditorAreaPane, self).destroy() + super().destroy() # ------------------------------------------------------------------------ # 'IEditorAreaPane' interface. @@ -460,7 +460,7 @@ def __init__(self, editor_area, parent=None, tabwidget=None): tabwidget : tabwidget object contained by this splitter """ - super(EditorAreaWidget, self).__init__(parent=parent) + super().__init__(parent=parent) self.editor_area = editor_area if not tabwidget: @@ -745,7 +745,7 @@ def __init__(self, editor_area, parent): editor_area : global SplitEditorAreaPane instance parent : parent of the tabwidget """ - super(DraggableTabWidget, self).__init__(parent) + super().__init__(parent) self.editor_area = editor_area # configure QTabWidget @@ -948,7 +948,7 @@ def dragEnterEvent(self, event): event.acceptProposedAction() return - super(DraggableTabWidget, self).dragEnterEvent(event) + super().dragEnterEvent(event) def dropEvent(self, event): """ Re-implemented to handle drop events @@ -964,7 +964,7 @@ def dragLeaveEvent(self, event): """ Clear widget highlight on leaving """ self.setBackgroundRole(QtGui.QPalette.Window) - return super(DraggableTabWidget, self).dragLeaveEvent(event) + return super().dragLeaveEvent(event) class DraggableTabBar(QtGui.QTabBar): @@ -972,7 +972,7 @@ class DraggableTabBar(QtGui.QTabBar): """ def __init__(self, editor_area, parent): - super(DraggableTabBar, self).__init__(parent) + super().__init__(parent) self.editor_area = editor_area self.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) self.drag_obj = None @@ -987,7 +987,7 @@ def mousePressEvent(self, event): self.drag_obj = TabDragObject( start_pos=event.pos(), tabBar=self ) - return super(DraggableTabBar, self).mousePressEvent(event) + return super().mousePressEvent(event) def mouseMoveEvent(self, event): """ Re-implemented to create a drag event when the mouse is moved for a @@ -1013,14 +1013,14 @@ def mouseMoveEvent(self, event): drag.exec_() self.drag_obj = None # deactivate the drag_obj again return - return super(DraggableTabBar, self).mouseMoveEvent(event) + return super().mouseMoveEvent(event) def mouseReleaseEvent(self, event): """ Re-implemented to deactivate the drag when mouse button is released """ self.drag_obj = None - return super(DraggableTabBar, self).mouseReleaseEvent(event) + return super().mouseReleaseEvent(event) class TabDragObject(object): diff --git a/pyface/ui/qt4/tasks/task_window_backend.py b/pyface/ui/qt4/tasks/task_window_backend.py index 66ed54955..6db052195 100644 --- a/pyface/ui/qt4/tasks/task_window_backend.py +++ b/pyface/ui/qt4/tasks/task_window_backend.py @@ -166,7 +166,7 @@ def set_layout(self, layout): """ Applies a DockLayout to the window. """ self.consumed = [] - super(TaskWindowLayout, self).set_layout(layout) + super().set_layout(layout) # ------------------------------------------------------------------------ # 'MainWindowLayout' abstract interface. diff --git a/pyface/ui/qt4/tests/test_gui.py b/pyface/ui/qt4/tests/test_gui.py index a415eb4a2..979572966 100644 --- a/pyface/ui/qt4/tests/test_gui.py +++ b/pyface/ui/qt4/tests/test_gui.py @@ -35,7 +35,7 @@ class SimpleApplication(HasStrictTraits): application_running = Event() def __init__(self): - super(HasStrictTraits, self).__init__() + super().__init__() self.gui = GUI() def start(self): diff --git a/pyface/ui/qt4/timer/timer.py b/pyface/ui/qt4/timer/timer.py index cc27c8221..03e86b911 100644 --- a/pyface/ui/qt4/timer/timer.py +++ b/pyface/ui/qt4/timer/timer.py @@ -23,7 +23,7 @@ class PyfaceTimer(BaseTimer): def __init__(self, **traits): traits.setdefault("_timer", QTimer()) - super(PyfaceTimer, self).__init__(**traits) + super().__init__(**traits) self._timer.timeout.connect(self.perform) def _start(self): diff --git a/pyface/ui/qt4/window.py b/pyface/ui/qt4/window.py index 161f59487..304484e7c 100644 --- a/pyface/ui/qt4/window.py +++ b/pyface/ui/qt4/window.py @@ -125,7 +125,7 @@ def destroy(self): # hides it), but the close may trigger an application shutdown, # which can take a long time and may also attempt to recursively # destroy the window again. - super(Window, self).destroy() + super().destroy() control.close() # -------------------------------------------------------------------------