Comments (16)
Changing QFontDatabase().families()
to QFontDatabase::families()
as per qt6 changes returns this error:
When loading 'Randomize Fonts':
Traceback (most recent call last):
File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/addons.py", line 239, in loadAddons
__import__(addon.dir_name)
File "/home/yaoberh/.local/share/Anki2/addons21/1603486068/__init__.py", line 212
allInstalledFonts = QFontDatabase::families()
^
SyntaxError: invalid syntax
from ankirandomfont.
It looks like it's no longer necessary to instantiate a QFontDatabase object as of Qt6:
https://doc.qt.io/archives/qt-6.0/qfontdatabase-obsolete.html
Try QFontDatabase.families()
from ankirandomfont.
That seems to have solved that line, but now I'm getting an error in the next one:
When loading 'Randomize Fonts':
Traceback (most recent call last):
File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/addons.py", line 239, in loadAddons
__import__(addon.dir_name)
File "/home/yaoberh/.local/share/Anki2/addons21/1603486068/__init__.py", line 213, in <module>
defaultFont = QFontDatabase().systemFont(QFontDatabase.GeneralFont).family()
TypeError: QFontDatabase(QFontDatabase): not enough arguments
from ankirandomfont.
Looks like we'll also need to remove the parens on that same line. So:
QFontDatabase.systemFont(QFontDatabase.GeneralFont).family()
from ankirandomfont.
File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/addons.py", line 239, in loadAddons
__import__(addon.dir_name)
File "/home/yaoberh/.local/share/Anki2/addons21/1603486068/__init__.py", line 215, in <module>
refreshConfig()
File "/home/yaoberh/.local/share/Anki2/addons21/1603486068/__init__.py", line 144, in refreshConfig
for font in QFontDatabase.families(wsValue):
TypeError: families(writingSystem: QFontDatabase.WritingSystem = QFontDatabase.Any): argument 1 has unexpected type 'int'
from ankirandomfont.
Looks like WritingSystems used to be their own special class but now they're just python built-in enums. I don't have Anki Qt6 installed so I can't test myself, but I think we would need to update the line to be:
for font in QFontDatabase.WritingSystem[wsName];
from ankirandomfont.
Getting this error now :(
File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/addons.py", line 239, in loadAddons
__import__(addon.dir_name)
File "/home/yaoberh/.local/share/Anki2/addons21/1603486068/__init__.py", line 215, in <module>
refreshConfig()
File "/home/yaoberh/.local/share/Anki2/addons21/1603486068/__init__.py", line 144, in refreshConfig
for font in QFontDatabase.WritingSystem[wsName]:
TypeError: 'WritingSystem' object is not iterable
from ankirandomfont.
Oops, I think it might actually be
for font in QFontDatabase.families(QFontDatabase.WritingSystem[wsName]):
Thanks for testing this out and troubleshooting with me.
from ankirandomfont.
Error's jumping to another area now haha
Traceback (most recent call last):
File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/addons.py", line 239, in loadAddons
__import__(addon.dir_name)
File "/home/yaoberh/.local/share/Anki2/addons21/1603486068/__init__.py", line 213, in <module>
defaultFont = QFontDatabase.systemFont.family()
AttributeError: 'builtin_function_or_method' object has no attribute 'family'
from ankirandomfont.
I think we just need parens after systemFont on that line.
from ankirandomfont.
File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/addons.py", line 239, in loadAddons
__import__(addon.dir_name)
File "/home/yaoberh/.local/share/Anki2/addons21/1603486068/__init__.py", line 213, in <module>
defaultFont = QFontDatabase.systemFont().family
TypeError: systemFont(QFontDatabase.SystemFont): not enough arguments
from ankirandomfont.
I guess we need QFontDatabase.GeneralFont in the parenthesis after systemFont.
from ankirandomfont.
Yep! Anki starts with no errors now. Although it still throws this error in preview and Cards:
from ankirandomfont.
That one has me a little stumped so I'll grab Anki qt6 and do some testing of my own
from ankirandomfont.
Not sure how this differs than what you have but this one is working for me.
from ankirandomfont.
Working!
from ankirandomfont.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ankirandomfont.