| Summary: | Doesn't actually work with Qt 6 | ||
|---|---|---|---|
| Product: | [Applications] kajongg | Reporter: | Antonio Rojas <arojas> |
| Component: | general | Assignee: | Wolfgang Rohdewald <wolfgang> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | aacid, asturm, kde-games-bugs-null, wolfgang |
| Priority: | NOR | ||
| Version First Reported In: | 24.02.2 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/games/kajongg/-/commit/077da95547d4af35bc4fa6737654d15442c2768f | Version Fixed/Implemented In: | 24.05 |
| Sentry Crash Report: | |||
| Attachments: | Patch for running with Pyside | ||
Others wanting to test this might have to set the shell variable QT_API=pyqt6 before starting kajongg because PyQt5 will be used if installed, see https://github.com/spyder-ide/qtpy Please double check if you are using the unmodified 24.02.2. The line numbers in the Traceback do not match that version. One possible problem is the kajonggserver.py process. Even if you finish kajongg, the server process will wait for some time for new clients before exiting. So maybe your kajonggserver.py process was not running the version you thought it does. So - please always kill all kajongg processes after changing source code. One strange thing is that nobody ever reported a bug like 'int' object has no attribute 'split' in clientVersion.split('.'), this only seems to happen to me. So I cherrypicked a fix about this from master to 24.02 so I am actually able to run 24.02.2 - which works fine for me with Qt6. Your bug should have been fixed with this commit which is part of 24.02.2: commit 3af0e1c6944695d5bdaf1bd7490cb4ad6ad98665 Author: Wolfgang Rohdewald <wolfgang@rohdewald.de> Date: Sat Sep 16 19:10:26 2023 +0200 Qt6: QApplication.desktop() is deprecated, introduce KApplication.desktopSize() Yes, I was using unmodified 24.02.2. Which like line of the backtrace doesn't match according to you?
Anyway, I just upgraded to 24.04.80 and there's a new error
Traceback (most recent call last):
File "/usr/bin/kajongg", line 20, in <module>
from kde import KApplication
File "/usr/share/kajongg/kde.py", line 12, in <module>
from kdestub import * # pylint: disable=wildcard-import,unused-wildcard-import
^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/kajongg/kdestub.py", line 241, in <module>
class KDialog(CaptionMixin, QDialog):
File "/usr/share/kajongg/kdestub.py", line 262, in KDialog
def setButtons(self, buttonMask:QDialogButtonBox.StandardButtons) ->None:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'QDialogButtonBox' has no attribute 'StandardButtons'. Did you mean: 'standardButtons'?
After fixing this following the suggestion, I get a slightly different variant of the previous error
Traceback (most recent call last):
File "/usr/bin/kajongg", line 189, in <module>
from mainwindow import MainWindow
File "/usr/share/kajongg/mainwindow.py", line 88, in <module>
logError("\n".join(f" * {s}" for s in NOTFOUND), showStack=False)
File "/usr/share/kajongg/log.py", line 146, in logError
return logMessage(msg, logging.ERROR, True, showStack=showStack, withGamePrefix=withGamePrefix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/kajongg/log.py", line 135, in logMessage
return Information(msg) if prio == logging.INFO else Sorry(msg, always=True)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/kajongg/dialogs.py", line 199, in __init__
dialog = Prompt(msg, icon=QMessageBox.Information,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/kajongg/dialogs.py", line 81, in __init__
KMessageBox.createKMessageBox(
File "/usr/share/kajongg/kdestub.py", line 216, in createKMessageBox
desktop = KApplication.desktopSize()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/kajongg/kdestub.py", line 116, in desktopSize
assert Internal.mainWindow
^^^^^^^^^^^^^^^^^^^
AssertionError
Git commit 077da95547d4af35bc4fa6737654d15442c2768f by Wolfgang Rohdewald. Committed on 30/04/2024 at 07:59. Pushed by wrohdewald into branch 'release/24.02'. Qt6 only worked when Qt5 was installed too FIXED-IN: 24.02.3 M +2 -15 src/common.py M +0 -1 src/kdestub.py M +2 -6 src/modeltest.py M +31 -1 src/qt.py https://invent.kde.org/games/kajongg/-/commit/077da95547d4af35bc4fa6737654d15442c2768f Wolfgang we won't be having a 24.02.3 release, please make sure these commits are in master and release/24.05 (subscribe to kde-devel mailing list if you aren't to get emails about when the branches are created) (In reply to Albert Astals Cid from comment #4) > (subscribe to kde-devel mailing list if you aren't to get emails about when the branches are created) Done, thank you! I don't think this was supposed to make kajongg PyQt[56]-only? We got the following report: https://bugs.gentoo.org/939423 (In reply to Andreas Sturmlechner from comment #6) > I don't think this was supposed to make kajongg PyQt[56]-only? We got the > following report: https://bugs.gentoo.org/939423 (the gist: > Will trigger error when PyQt api disabled > > err: No module named 'PyQt6' ) I don't have a gentoo account. How did he start kajongg? Value of environment variable QT_API must be pyside6. His statement about sip being required is wrong and makes me think he did not set QT_API. See https://github.com/spyder-ide/qtpy?tab=readme-ov-file#requirements The kajongg source code he points to sets HAVE_SIP to False if neither PyQt6 nor PyQt5 is found. Is there no traceback? Where does that message appear? Kajongg does not generate it, so it must be Python. So I'd expect a traceback. > The kajongg source code he points to sets HAVE_SIP to False if neither PyQt6
> nor PyQt5 is found.
No, it sets it to false if both QT5 and QT6 are false (which should never happen). You probably want 'if PYQT5' and 'elif PYQT6' instead.
Created attachment 173534 [details]
Patch for running with Pyside
You are right. Does the patch I just added fix it? (In reply to Wolfgang Rohdewald from comment #11) > You are right. Does the patch I just added fix it? Testing this myself right now, it does get further than before, but ends up with: > C: * Kajongg is not correctly installed: modules: cannot import name 'sip_cast' from 'qt' (/usr/share/kajongg/qt.py) > Traceback (most recent call last): > File "/usr/share/kajongg/kdestub.py", line 115, in desktopSize > result = Internal.app.desktop().availableGeometry() > ^^^^^^^^^^^^^^^^^^^^ > AttributeError: 'KApplication' object has no attribute 'desktop' > > During handling of the above exception, another exception occurred: > > Traceback (most recent call last): > File "/usr/bin/kajongg", line 189, in <module> > from mainwindow import MainWindow > File "/usr/share/kajongg/mainwindow.py", line 88, in <module> > logError("\n".join(f" * {s}" for s in NOTFOUND), showStack=False) > File "/usr/share/kajongg/log.py", line 146, in logError > return logMessage(msg, logging.ERROR, True, showStack=showStack, withGamePrefix=withGamePrefix) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/share/kajongg/log.py", line 135, in logMessage > return Information(msg) if prio == logging.INFO else Sorry(msg, always=True) > ^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/share/kajongg/dialogs.py", line 193, in __init__ > dialog = Prompt(msg, icon=QMessageBox.Icon.Information, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/share/kajongg/dialogs.py", line 81, in __init__ > KMessageBox.createKMessageBox( > File "/usr/share/kajongg/kdestub.py", line 216, in createKMessageBox > desktop = KApplication.desktopSize() > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/share/kajongg/kdestub.py", line 117, in desktopSize > assert Internal.mainWindow > ^^^^^^^^^^^^^^^^^^^ > AssertionError And just to make sure: no problems as soon as QtPy was built with PyQt6 support Before the patch, it works for me (with PySide6) if PyQt6-sip is installed (no need to have PyQt6 itself). After the patch, I get the same backtrace as Andreas with or without PyQt6-sip Change from downstream reporter: https://bugs.gentoo.org/939423#c6 > Not sure if this correct but I added sip_cast to `else` block too > --- > else: > def sip_cast(obj, _type): > """hide not so nice things in qt.py""" > return False > HAVE_SIP = False > --- > It launched and About dialog shows PySide6 api in use. I committed a possible fix. But without seeing the backtrace I can only guess. If you ask me, keeping Qt5 support is adding complexity for no gain. I doubt any distribution is going to package kajongg-24.08 as Qt5-based. (In reply to Wolfgang Rohdewald from comment #16) > I committed a possible fix. But without seeing the backtrace I can only > guess. Your original fix (attached patch in this bug) is still missing. Right. That patch is not needed. (In reply to Wolfgang Rohdewald from comment #19) > Right. That patch is not needed. It is. Otherwise we're back to: $ kajongg Traceback (most recent call last): File "/usr/bin/kajongg", line 19, in <module> from qt import QObject, QCommandLineParser, QCommandLineOption, Qt, QGuiApplication File "/usr/share/kajongg/qt.py", line 147, in <module> from PyQt6 import sip # type:ignore[no-redef] ^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'PyQt6' |
kajongg claims to support Qt6, and in fact depends on it at build time, but it doesn't actually work with it Traceback (most recent call last): File "/usr/share/kajongg/kdestub.py", line 100, in desktopSize result = Internal.app.desktop().availableGeometry() ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'KApplication' object has no attribute 'desktop' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/bin/kajongg", line 185, in <module> from mainwindow import MainWindow File "/usr/share/kajongg/mainwindow.py", line 89, in <module> logError("\n".join(" * %s" % s for s in NOTFOUND), showStack=False) File "/usr/share/kajongg/log.py", line 213, in logError return logMessage(msg, logging.ERROR, True, showStack=showStack, withGamePrefix=withGamePrefix) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/kajongg/log.py", line 202, in logMessage return Information(msg) if prio == logging.INFO else Sorry(msg, always=True) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/kajongg/dialogs.py", line 201, in __init__ dialog = Prompt(msg, icon=QMessageBox.Information, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/kajongg/dialogs.py", line 85, in __init__ KMessageBox.createKMessageBox( File "/usr/share/kajongg/kdestub.py", line 209, in createKMessageBox desktop = KApplication.desktopSize() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/kajongg/kdestub.py", line 103, in desktopSize result = Internal.mainWindow.screen().availableGeometry() ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'screen'