-
-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Fix mappings of instance method and slot alias (PyQt6 and PySide6) #308
Conversation
My tests using QApplication abort with (maybe) SIGSEGV.
Is there test examples using QApplication ?
|
The test seems to stall. ref: |
Thanks @kumattau for taking the initiative to fix this!
My guess is that to instantiate stuff we can guide us from the test done in Spyder. For example: https://github.com/spyder-ide/spyder/blob/master/spyder/widgets/tests/test_browser.py . Also I think we will need to add to the tests requirements Maybe @ccordoba12 or @CAM-Gerlach know better
I think you need to have write rights in the repo for that but I can stop them/cancel the worflow 👍 |
Thank you very much for stopping job @dalthviz ! I will study https://github.com/spyder-ide/spyder/blob/master/spyder/widgets/tests/test_browser.py. |
I think the problem is fixed by changing all exec_ s like as follows, QDialog.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) |
Is it possible to set a timeout for job? https://stackoverflow.com/questions/59073731/set-default-timeout-on-github-action-pipeline I think it is reasonable to set 10 min timeout for job from recent action's result. |
Sure, I think that 10 min should be enough 👍 Edit; Not totally sure if that can be done in this same PR, but you want to check @kumattau ? It will be to add the |
I will send ci-timeout PR in a minute. |
a11e492
to
8d75572
Compare
This problem ( But, maybe, the current following mapping is no good. QApplication.exec_ = QApplication.exec Because Subclass methods are not called properly. class QApplication:
def exec(self):
print("QApplication exec")
class SubQApplication(QApplication):
def exec(self):
print("SubQApplication exec")
QApplication.exec_ = QApplication.exec
app = SubQApplication()
app.exec_()
# => QApplication exec (no good)
QApplication.exec_ = lambda self: QApplication.exec(self)
app = SubQApplication()
app.exec_()
# => QApplication exec (no good)
QApplication.exec_ = lambda self: self.exec()
app = SubQApplication()
app.exec_()
# => SubQApplication exec (good) |
Hi again @kumattau , maybe we could merge this as it is and I could give it a try to add tests in a following PR, what do you think? Let us know! |
Sorry for the delay.
I think so, too. I may not study qtbot and create test codes right away because of busy my jobs. These commits replace all method assignments with lambdas in PyQt6 and PySide6. I rebased these commits onto master branch but python3.6 tests were failed. |
Awesome, and no problem thank you so much for checking into this 👍
Sounds good to me
Yep, I did a fix for that at #313 . When that one gets merged a new rebase will be needed here to fix the tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe, the change of QLibraryInfo.location mapping is not needed because this is static method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe, the change of QPrintPreviewWidget.print_ is not needed because this is public slot.
https://doc.qt.io/qt-6/qprintpreviewwidget.html
(update)
slot seems to be handled same as instance method.
(ref. QDialog.exec)
Sorry, I had understood it wrongly. https://doc.qt.io/qt-6/qapplication.html I am checking all mappings again to fix instance method only. |
I pushed the commit.
list
# static functions or class methods
QtCore.py: QLibraryInfo.location = QLibraryInfo.path
QtCore.py: Qt.mightBeRichText = guiQt.mightBeRichText
QtCore.py: QCoreApplication.exec_ = QCoreApplication.exec
QtGui.py: QGuiApplication.exec_ = QGuiApplication.exec
QtWidgets.py: QApplication.exec_ = QApplication.exec
# instance methods or slots
QtCore.py: QEventLoop.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtCore.py: QDateTime.toPython = lambda self, *args, **kwargs: self.toPyDateTime(*args, **kwargs)
QtCore.py: QTextStreamManipulator.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtCore.py: QThread.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtGui.py: QDrag.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtGui.py: QFontMetrics.width = lambda self, *args, **kwargs: self.horizontalAdvance(*args, **kwargs)
QtGui.py: QTextDocument.print_ = lambda self, *args, **kwargs: self.print(*args, **kwargs)
QtPrintSupport.py: QPrintPreviewWidget.print_ = lambda self, *args, **kwargs: self.print(*args, **kwargs) # slot
QtPrintSupport.py: QPageSetupDialog.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtPrintSupport.py: QPrintDialog.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtSql.py: QSqlDatabase.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtSql.py: QSqlQuery.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtSql.py: QSqlResult.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtWidgets.py: QDialog.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) # slot
QtWidgets.py: QMenu.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
QtWidgets.py: QPlainTextEdit.print_ = lambda self, *args, **kwargs: self.print(*args, **kwargs)
QtWidgets.py: QPlainTextEdit.setTabStopWidth = lambda self, *args, **kwargs: self.setTabStopDistance(*args, **kwargs)
QtWidgets.py: QPlainTextEdit.tabStopWidth = lambda self, *args, **kwargs: self.tabStopDistance(*args, **kwargs)
QtWidgets.py: QTextEdit.print_ = lambda self, *args, **kwargs: self.print(*args, **kwargs)
QtWidgets.py: QTextEdit.setTabStopWidth = lambda self, *args, **kwargs: self.setTabStopDistance(*args, **kwargs)
QtWidgets.py: QTextEdit.tabStopWidth = lambda self, *args, **kwargs: self.tabStopDistance(*args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kumattau for all the help with this one! LGTM 👍
I'm sorry, #305 is caused by my PR: #287.
I'm trying to fix and add tests.
(I sent a pull request to see if tests using QApplication would work with CI.)
NOTE: This PR can be closed without merging when more appropriate fixes and tests are provided.
Fixes #305