Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 01-09-2022, 06:44 AM   #91
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@Kovid: I run from source. For testing and other reasons I now frequently switch between the Qt5 and Qt6 calibre versions. Invariably when I switch, some _ui.py files are out of sync because the form compile process depends on dates. Would you consider adding a way via env var or option to force build_forms.py / build_forms / force_compile to True? Thanks.
chaley is offline   Reply With Quote
Old 01-09-2022, 07:33 AM   #92
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by chaley View Post
@Kovid: I run from source. For testing and other reasons I now frequently switch between the Qt5 and Qt6 calibre versions. Invariably when I switch, some _ui.py files are out of sync because the form compile process depends on dates. Would you consider adding a way via env var or option to force build_forms.py / build_forms / force_compile to True? Thanks.
At the moment, I have installed the portable version of the beta and put the Qt6 source in its own directory. And I use a batch files that set environment variables and change directories for whichever I want to run.
davidfor is offline   Reply With Quote
Advert
Old 01-09-2022, 08:02 AM   #93
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,360
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by chaley View Post
@Kovid: I run from source. For testing and other reasons I now frequently switch between the Qt5 and Qt6 calibre versions. Invariably when I switch, some _ui.py files are out of sync because the form compile process depends on dates. Would you consider adding a way via env var or option to force build_forms.py / build_forms / force_compile to True? Thanks.
https://github.com/kovidgoyal/calibr...c4bdf474a7904b
kovidgoyal is online now   Reply With Quote
Old 01-09-2022, 08:32 AM   #94
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
Thanks. As written, the migrated_forms flag wins. The attached patch takes care of that so that. In case it matters the patch was made using 5.34 source, not 5.99.
Attached Files
File Type: txt a_patch.txt (872 Bytes, 354 views)
chaley is offline   Reply With Quote
Old 01-09-2022, 08:34 AM   #95
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
At the moment, I have installed the portable version of the beta and put the Qt6 source in its own directory. And I use a batch files that set environment variables and change directories for whichever I want to run.
I too use the portable version of the beta binaries.

The issue arises because I use Atlassan Sourcetree as my git manager. It lets me create, delete, and switch between branches with a click or two. It also deals with monitoring source to detect changes, packaging commits, pushing changes to create pull requests, and pulling changes on demand. Its version browser is quite good. It does what I need.

The way Sourcetree works is that changes (pulled changes, branch switching, etc) all happen in the same source tree. This works very well with Eclipse/Pydev, the IDE I use, because changes are instantly shown in the IDE. Of course this is what causes the problem I pointed out: non-managed files such as *_ui.py aren't touched during a switch.

What I do now is search for *_ui.py files and delete them. This works but is a bother because I usually forget to do it and then calibre won't start. There is also a flag in gui.json, "migrated_forms_to_qt6" that if deleted or set to False will force recompilation of the forms, but changing this is more trouble than deleting the files.

Last edited by chaley; 03-08-2022 at 11:46 AM.
chaley is offline   Reply With Quote
Advert
Old 01-09-2022, 08:37 AM   #96
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,360
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@chaley: You might want to consider a git hook that's what I use, see git_post_checkout_hook.py (you can obv skip the build part and just redo the forms.
kovidgoyal is online now   Reply With Quote
Old 01-09-2022, 09:45 AM   #97
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
@chaley: You might want to consider a git hook that's what I use, see git_post_checkout_hook.py (you can obv skip the build part and just redo the forms.
Making git hooks work on windows seems to be impossible without installing cygwin and everything that comes with it.

Thanks for the change, but it fails with
Code:
Traceback (most recent call last):
  File "runpy.py", line 194, in _run_module_as_main
  File "runpy.py", line 87, in _run_code
  File "site.py", line 82, in <module>
  File "site.py", line 77, in main
  File "site.py", line 49, in run_entry_point
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\debug.py", line 264, in main
    calibre(['calibre'] + args[1:])
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\gui_launch.py", line 61, in calibre
    with register_with_default_programs():
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\gui_launch.py", line 42, in register_with_default_programs
    from calibre.gui2 import gprefs
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\gui2\__init__.py", line 1447, in <module>
    build_forms(os.environ['CALIBRE_DEVELOP_FROM'], check_for_migration=True)
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\build_forms.py", line 71, in build_forms
    gprefs.set(f'migrated_forms_to_qt{qt_major}', True)
UnboundLocalError: local variable 'gprefs' referenced before assignment
This happens because gprefs isn't imported if the env var is set. My patch (above) has one fix that works in this case.
chaley is offline   Reply With Quote
Old 01-09-2022, 09:51 AM   #98
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,360
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@chaley: feel free to send a PR with your fix.
kovidgoyal is online now   Reply With Quote
Old 01-09-2022, 10:01 AM   #99
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
@chaley: feel free to send a PR with your fix.
Done.
chaley is offline   Reply With Quote
Old 01-11-2022, 02:29 PM   #100
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,216
Karma: 1419583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Hi, @Kovid.

I've just finished redesigning one of my plugin's config dialog, and as part of the process I added help using QWhatsThis. It works perfectly on 5.34 but, to my surprise, I've noticed that the beta does not have the "What's this?" icon.

Did you intentionally remove it? Is it a glitch?
thiago.eec is offline   Reply With Quote
Old 01-11-2022, 02:52 PM   #101
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,574
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Pretty sure the What's This? button is disabled by default in Qt6. You'll need to set the Qt::WindowContextHelpButtonHint Window flag if you want to use it with Qt6+
DiapDealer is offline   Reply With Quote
Old 01-11-2022, 04:30 PM   #102
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,216
Karma: 1419583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by DiapDealer View Post
Pretty sure the What's This? button is disabled by default in Qt6. You'll need to set the Qt::WindowContextHelpButtonHint Window flag if you want to use it with Qt6+
Thanks, @DiapDealer. That solved it!
thiago.eec is offline   Reply With Quote
Old 01-12-2022, 09:49 AM   #103
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,360
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Released version 5.99.3 with support for icon themeing.

As of 5.99.3 the betas have support for proper icon themeing with support for using different icon themes for light and dark mode and calibre switches between them automatically. In order to use icons from themes that support your plugin you should pass the plugin name to the get_icons() function to load an icon. For example:

Code:
icon = get_icons('owp_sigil.png', 'Open With')
this will load the owp_sigil.png plugin from the users installed icon theme, if present, falling back to the image in the plugin zip file. Note that if you use kiwidude's code for loading icons, you will need to adjust it, as the way it loads themed icons will no longer work.
kovidgoyal is online now   Reply With Quote
Old 01-12-2022, 12:48 PM   #104
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,973
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
I've put up test versions of my plugins and the kiwidude ones I support that appear to work in both qt5 & qt6.

For others supporting kiwidude plugins, here's my checklist for the 5 I did:
  • Remove all Qt4 imports. Keep Qt5 (vs new qt.core (5.13+)) for back compatible to v2.85.1.
  • Remove calls to convert_qvariant() and defining code (plus QVariant import); only needed for qt4.
  • Remove QTableWidgetItem.UserType from calls to QTableWidgetItem.__init__() as proposed by jackie_w. un_pogaz's code also works, but it makes no difference and I can't find any reason to keep it.
  • Remove class NumericLineEdit and QRegExp imports--not used in my 5. If you need NumericLineEdit, look at replacements QRegularExpression and QRegularExpressionValidator.
  • Set minimum Calibre version to 2.85.1--or else keep all the qt4 imports, qvariant, etc.
  • Change setChecked->setCheckState when called with Qt.Checked/UnChecked. Or change to pass bool instead.
  • Remove call to setTabStopWidth from raw prefs viewer--changed in qt6 and not needed
  • Bump version

Last edited by JimmXinu; 01-12-2022 at 04:45 PM. Reason: Forgot setTabStopWidth
JimmXinu is offline   Reply With Quote
Old 01-12-2022, 03:45 PM   #105
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 439
Karma: 145424
Join Date: Dec 2017
Device: Kobo
Quote:
Originally Posted by JimmXinu View Post
  • Set minimum Calibre version to 2.85.1--or else keep all the qt4 imports, qvariant, etc.

Calibre version 2.0.0 instead?
All Calibre 2.x use Qt5, so avoid the v2 it seems to me a little excessive (Unless there's something twisted)

Last edited by un_pogaz; 01-12-2022 at 03:56 PM.
un_pogaz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Suggestion for PI Devs BetterRed Plugins 11 09-27-2020 06:18 PM
Attn plugin devs: porting to python 3 kovidgoyal Plugins 129 06-16-2020 01:31 AM
Attention All Plugin Devs: Remove vestiges from python 2? KevinH Plugins 11 05-29-2020 03:16 PM
Plugin Devs: Should we include a License or COPYING file? KevinH Plugins 3 08-15-2017 01:09 PM
New Plugin Features in the upcoming Sigil 0.8.900 KevinH Plugins 6 09-14-2015 02:48 PM


All times are GMT -4. The time now is 12:21 AM.


MobileRead.com is a privately owned, operated and funded community.