Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Closed Thread
 
Thread Tools Search this Thread
Old 07-06-2022, 03:31 AM   #106
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: 44,356
Karma: 23708270
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@davidfor: That much weirdness is above my paygrade I'm afraid. Since running it from powershell works, you have a tolerable workaround. You can try checking environment variables in the two contexts to see if there is something different causing it, other than that, I dont have a clue.
kovidgoyal is online now  
Old 07-06-2022, 06:24 AM   #107
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: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by kovidgoyal View Post
@davidfor: That much weirdness is above my paygrade I'm afraid. Since running it from powershell works, you have a tolerable workaround. You can try checking environment variables in the two contexts to see if there is something different causing it, other than that, I dont have a clue.
I agree with you about it being above our paygrade. I don't see why there would be a difference. It probably is some difference in path somewhere, but, I cannot see anything. When I can, I will try it on another machine and see what happens.
davidfor is offline  
Advert
Old 07-06-2022, 10:16 AM   #108
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: 44,356
Karma: 23708270
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Heads up for people running from source, the qt6 branch has been merged into master. So now you can only run from latest source with a calibre 6 beta build.
kovidgoyal is online now  
Old 07-06-2022, 10:40 AM   #109
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: 11,942
Karma: 7219261
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
Heads up for people running from source, the qt6 branch has been merged into master. So now you can only run from latest source with a calibre 6 beta build.
Is calibre 5 source now frozen or will you backport changes for a while? If frozen then I won't bother to set up parallel development environments.
chaley is offline  
Old 07-06-2022, 11:16 AM   #110
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: 44,356
Karma: 23708270
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by chaley View Post
Is calibre 5 source now frozen or will you backport changes for a while? If frozen then I won't bother to set up parallel development environments.
It's frozen.
kovidgoyal is online now  
Advert
Old 07-06-2022, 04:11 PM   #111
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,309
Karma: 63232809
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I switched to the master branch, and now my dark mode is missing again. Did I misunderstand?
ownedbycats is offline  
Old 07-06-2022, 04:23 PM   #112
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: 11,942
Karma: 7219261
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I switched to the master branch, and now my dark mode is missing again. Did I misunderstand?
I saw something saying that the choice is now a preference in Look and Feel, and that the environment variables are gone. Did you try the preference?
chaley is offline  
Old 07-06-2022, 04:30 PM   #113
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,309
Karma: 63232809
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I see it now. Colour palette.
Attached Thumbnails
Click image for larger version

Name:	2022-07-06 17_29_51-calibre - Preferences - Look & feel.png
Views:	297
Size:	50.0 KB
ID:	194768  
ownedbycats is offline  
Old 07-06-2022, 05:47 PM   #114
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,309
Karma: 63232809
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
For anyone else who's run into bold text rendering weirdly in the comments field (this may be dependent on UI font used):

QT6 changed the font weight for 'bold' from 600 to 700. You can search comments:font-weight to find them and then apply this search-and-replace:

Click image for larger version

Name:	2022-07-06 18_45_28-Editing metadata for one book.png
Views:	409
Size:	6.5 KB
ID:	194770

Last edited by ownedbycats; 07-06-2022 at 05:53 PM.
ownedbycats is offline  
Old 07-07-2022, 02:06 AM   #115
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: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
As the main source is now the Qt6, I installed the beta over my main calibre install and updated the source. When running from source I got:

Code:
calibre, version 5.99.12
ERROR: Startup error: There was an error during calibre startup. Parts of calibre may not function. Click "Show details" to learn more.

Traceback (most recent call last):
  File "E:\Development\GitHub\calibre\src\calibre\gui2\main.py", line 315, in initialize_db_stage2
  File "E:\Development\GitHub\calibre\src\calibre\gui2\main.py", line 258, in start_gui
  File "E:\Development\GitHub\calibre\src\calibre\gui2\ui.py", line 239, in initialize
  File "E:\Development\GitHub\calibre\src\calibre\gui2\jobs.py", line 628, in __init__
  File "E:\Development\GitHub\calibre\src\calibre\gui2\dialogs\jobs_ui.py", line 19, in setupUi
AttributeError: type object 'QIcon' has no attribute 'Normal'
The line in question is:

Code:
icon.addPixmap(QtGui.QPixmap(I("jobs.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
And looks like it should be:

Code:
icon.addPixmap(QtGui.QPixmap(I("jobs.png")), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
With a similar line further down.

That is compiled from jobs.ui. I did see messages about this as I started it the first time, but, I didn't notice if this was updated or not.
davidfor is offline  
Old 07-07-2022, 02:26 AM   #116
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: 44,356
Karma: 23708270
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@davidfor: delete the *_ui.py files and they should be regenerated correctly for PyQt6 automatically.
kovidgoyal is online now  
Old 07-07-2022, 03:18 AM   #117
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: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by kovidgoyal View Post
@davidfor: delete the *_ui.py files and they should be regenerated correctly for PyQt6 automatically.
When I looked, there were a some fairly old ones that didn't match any current files. I just removed them all and it started OK.
davidfor is offline  
Old 07-08-2022, 12:59 AM   #118
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: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
The beta does not appear to be loading user created template functions. I should have two. One is used in a plugboard and I noticed errors when updating my device. When I checked, the template function was not displayed in the list in the preferences. I do not see any errors as calibre starts. And I can see the "user_template_functions" entry in the preferences table in the database.
davidfor is offline  
Old 07-08-2022, 05:52 AM   #119
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: 11,942
Karma: 7219261
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
The beta does not appear to be loading user created template functions. I should have two. One is used in a plugboard and I noticed errors when updating my device. When I checked, the template function was not displayed in the list in the preferences. I do not see any errors as calibre starts. And I can see the "user_template_functions" entry in the preferences table in the database.
It works for me.

I assume we are talking about python functions, not stored templates.

Some things to try to help me figure out what is going on.
  • If you send me your metadata.db then I can try it. If willing then send it to calibre_test at charleshaley dot org.
  • What is in the the database preference? Mine contains stuff like this. In reality there are no embedded newlines. EDIT: It is critical that the fourth string in an entry start with either "def" or "program:".
    Spoiler:
    [
    [
    "myFunc3",
    "foo\t",
    4,
    "def evaluate(self, formatter, kwargs, mi, locals, val, is_read_pct, \n\t\t\t\tis_reading_str, no_page_read_str):\n\ttry:\n\t\ttest_val = int(is_read_pct)\n\texcept:\n\t\treturn 'is_read_pct is not a number'\n\n\timport re\n\tpattern = u'.*(\\d+[-/]\\d+[-/]\\d+).*?Derni\u00e8re page lue : Emplacement \\d+ \\((\\d+)%\\)'\n\tmg = re.match(pattern, val, re.U + re.I + re.DOTALL);\n\tif mg is None:\n\t\treturn no_page_read_str\n\tdate = mg.group(1)\n\tpct = mg.group(2)\n\ttry:\n\t\tf = int(pct)\n\t\tif f > test_val:\n\t\t\treturn date\n\t\telif f > 0:\n\t\t\treturn is_reading_str + ': ' + pct + '%'\n\texcept:\n\t\tpass\n\treturn no_page_read_str"
    ],
    [
    "myFunc2",
    "",
    -1,
    "def evaluate(self, formatter, kwargs, mi, locals):\n\timport re\n\ttags = mi.get('tags')\n\tv = 0\n\tif tags:\n\t\tfor t in tags:\n\t\t\tm = re.match('recommended\\..*\\.([\\d.]+)', t)\n\t\t\tif m:\n\t\t\t\tv = v + int(m.group(1))\n\treturn v"
    ]
    ]
  • What happens if you create the example function 'my_ifempty()' shown in the bottom of the help text of the preferences editor? I copied the information exactly as shown and it worked.
  • There is a "plugin tweak" (a non-listed tweak) named enable_template_debug_printing. If you set it to True then function bodies will be printed when calibre starts up.

Last edited by chaley; 07-08-2022 at 05:58 AM.
chaley is offline  
Old 07-08-2022, 11:09 AM   #120
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: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Yes, the Python functions. I have had one working and copied between my libraries for a while. I was able to add the sample and it was listed. But, after restarting calibre, it disappeared. But, it was in the database and the original functions had disappeared.

For the library, I was looking at, the database had:

Code:
[
  [
    "rating_as_stars", 
    "rating_as_stars(x) -- returns x number of stars.", 
    1, 
    "def evaluate(self, formatter, kwargs, mi, locals, r):\n\ttry:\n\t\tx = int(r) * '\u2605'\n\texcept:\n\t\tx = ''\n\treturn x"
  ], 
  [
    "counts_for_comments", 
    "counts_for_comments(x) -- returns the word and page count formatted for the comment.\n\nThis will look like:\n<p><b>Word count:</b> nnnn <b>Page count:</b> nnnn</p>\n\nIf either count is missing, that part of the string will not be included. If neither exist, the result is empty.", 
    -1, 
    "def evaluate(self, formatter, kwargs, mi, locals):\n\twords = getattr(mi, '#words', None)\n\tpages = getattr(mi, '#pages', None)\n    counts_str = None\n    if words:\n\t    words_str = \"<b>Word count:</b> {0:,}\".format(words)\n        counts_str = words_str\n    if pages:\n\t    pages_str = \"<b>Page count:</b> {0:,}\".format(pages)\n        counts_str = counts_str + ' ' + pages_str if counts_str else pages_str\n    if counts_str:\n        counts_str = '<p>' + counts_str + '</p>' \n\treturn counts_str"
  ]
]
These have been there and working for some tie.

And now, after adding "my_ifempty" and restarting, I have:
Code:
[
  [
    "my_ifempty",
    "y_ifempty(val) -- return val if it is not empty, otherwise the string 'EMPTY'",
    1,
    "def evaluate(self, formatter, kwargs, mi, locals, val):\n            if val:\n                return val\n            else:\n                return 'EMPTY'"
  ]
]

When I added the tweak and restarted, the log showed:

Code:
[0.27] Initializing db...

from calibre.utils.formatter_functions import FormatterUserFunction
from calibre.utils.formatter_functions import formatter_functions
class UserFunction(FormatterUserFunction):
    def evaluate(self, formatter, kwargs, mi, locals, val):
                if val:
                    return val
                else:
                    return 'EMPTY'
[0.34] db initialized
]

And then after the plugins had finished initializing:

Code:
from calibre.utils.formatter_functions import FormatterUserFunction
from calibre.utils.formatter_functions import formatter_functions
class UserFunction(FormatterUserFunction):
    def evaluate(self, formatter, kwargs, mi, locals, val):
                if val:
                    return val
                else:
                    return 'EMPTY'
I always run from source with a few changes that I like. I did try it directly and the added function was not in the list.

I'll try the other things tomorrow.
davidfor is offline  
Closed Thread


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching for Text in Footnotes aherinandrianina Calibre 1 12-05-2018 04:08 AM
Troubles searching text in files Maxwell61 Library Management 9 09-18-2018 06:13 PM
searching google from e-reader text garrry Related Tools 2 06-15-2013 04:39 AM
searching a document based on highlighted text KasPaz Kindle Developer's Corner 0 02-06-2012 10:37 PM
Searching text on 300 and 505 Thrasher Sony Reader 6 04-28-2010 03:41 AM


All times are GMT -4. The time now is 10:17 PM.


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