Skip to content

Remove old-style signals and slots - #256

Merged
corranwebster merged 2 commits into
masterfrom
enh/remove-old-signals-slots
Jan 11, 2017
Merged

corranwebster merged 2 commits into
masterfrom
enh/remove-old-signals-slots

Conversation

@corranwebster

Copy link
Copy Markdown
Contributor

This is a fairly mechanical change. The hope is that this will help resolve #245, since old-style signals and slots has been implicated in some of the problems.

@corranwebster

Copy link
Copy Markdown
Contributor Author

A second set of eyes on this would be useful just to check for dumb typos. @mdickinson do you have time to double check this?

@codecov-io

codecov-io commented Jan 11, 2017 •

Copy link
Copy Markdown

Current coverage is 46.49% (diff: 27.27%)

Merging #256 into master will not change coverage

@@             master       #256   diff @@
==========================================
  Files           283        283          
  Lines         19090      19090          
  Methods           0          0          
  Messages          0          0          
  Branches       3064       3064          
==========================================
  Hits           8875       8875          
  Misses         9829       9829          
  Partials        386        386          

Powered by Codecov. Last update 8fdd5cc...a657b7c

@mdickinson mdickinson self-assigned this Jan 11, 2017
QtCore.QObject.connect(QtGui.QApplication.instance(),
QtCore.SIGNAL('focusChanged(QWidget *,QWidget *)'),
self._focus_changed)
QtGui.QApplication.instance().focusChanged.connect(self._focus_changed)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to worry about the return value of instance() being None here? (Just wondering whether QtCore.QObject.connect automatically ignores Nones.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it handles None values gracefully, but I think things would have to be going very wrong for there to be no QApplication at the point where the __init__ is being called.

From the point of view of testing, we should probably be a little worried about this signal handler potentially hanging around across test boundaries.

else:
nw = ntw.widget(ntidx)

self.emit(QtCore.SIGNAL('hasFocus'), nw)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably off-topic for this PR, but why SIGNAL('hasFocus') rather than SIGNAL('hasFocus()')? This seems inconsistent with the other uses of SIGNAL.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably off-topic for this PR

... though it might be worth checking that there's no behaviour change here, if there's any reasonable way to do so.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because that's what PyQt expected back in the day. Or it could have been a bug.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And no, there shouldn't be any behavior change.

self._qt4_editor_title_changed)
editor_area.focusChanged.connect(self._qt4_view_focus_changed)

editor_area.tabTextChanged.connect(self._qt4_editor_title_changed)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the object be self._qt4_editor_area rather than editor_area here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry; they're the same. So, no.

@mdickinson

Copy link
Copy Markdown
Member

LGTM

@corranwebster
corranwebster merged commit 174a66c into master Jan 11, 2017
@corranwebster
corranwebster deleted the enh/remove-old-signals-slots branch January 11, 2017 13:54
@corranwebster corranwebster mentioned this pull request Mar 10, 2017
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PyQt backend segfaults

4 participants