Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-04-2024, 05:25 AM   #1
Buschhardt
Junior Member
Buschhardt began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Nov 2024
Device: Tolino Vision 5
System-Notification

Hello, I see in calibre also a system notification.

How can I use this in Python? A simple example would be nice.

Thank You
Buschhardt is offline   Reply With Quote
Old 11-05-2024, 02:36 AM   #2
Buschhardt
Junior Member
Buschhardt began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Nov 2024
Device: Tolino Vision 5
Thanks to kovidgoyal

Here is an example

from calibre.gui2 import notify
n = notify.get_notifier()
n('hello', timeout=3000)
Buschhardt is offline   Reply With Quote
Advert
Old 11-05-2024, 12:07 PM   #3
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,207
Karma: 1419197
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
I tried it here but couldn't make it work. notify.get_notifier() returns None (either from the command line or from a gui Plugin).
thiago.eec is offline   Reply With Quote
Old 11-05-2024, 09:29 PM   #4
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,289
Karma: 27111240
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That means no notification backend was found on your system.
kovidgoyal is offline   Reply With Quote
Old 11-06-2024, 07:27 AM   #5
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,207
Karma: 1419197
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
That means no notification backend was found on your system.
I'm on Windows 11. Shouldn't it find one?
thiago.eec is offline   Reply With Quote
Advert
Old 11-06-2024, 11:36 AM   #6
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,289
Karma: 27111240
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by thiago.eec View Post
I'm on Windows 11. Shouldn't it find one?
On windows notifications are via Qt which in turn relies on the system try which needs a QApplication.
kovidgoyal is offline   Reply With Quote
Old 11-06-2024, 11:40 AM   #7
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,207
Karma: 1419197
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
On windows notifications are via Qt which in turn relies on the system try which needs a QApplication.
So, not accessible via plugin, right?
thiago.eec is offline   Reply With Quote
Old 11-06-2024, 09:41 PM   #8
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,289
Karma: 27111240
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by thiago.eec View Post
So, not accessible via plugin, right?
Depends if it s GUI plugin yes it should be.
kovidgoyal is offline   Reply With Quote
Old 11-07-2024, 09:53 AM   #9
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,207
Karma: 1419197
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
Depends if it s GUI plugin yes it should be.
Well, first I checked if the tray was available and supported messages:
Code:
QSystemTrayIcon.isSystemTrayAvailable()
QSystemTrayIcon.supportsMessages()
Both returned 'True'.

Then, I tried to show a message from a GUI plugin:

Code:
from calibre.gui2.ui import get_gui
from calibre.gui2 import notify
gui = get_gui()
tray = QSystemTrayIcon(gui)
n = notify.get_notifier(systray=tray)
n('hello', timeout=3000)
It didn't work. No message shown.

1) If I call get_notifier() without the systray argument, then it returns None
2) If instead of get_gui(), I use QApplication.instance(), it doesn't work either

What am I missing?
thiago.eec is offline   Reply With Quote
Old 11-07-2024, 09:55 AM   #10
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,289
Karma: 27111240
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Did you enable the system tray icon in calibrepreferences? do notifications from calibre itself work? for example when a conversion is done you will get a notification about it normally.
kovidgoyal is offline   Reply With Quote
Old 11-07-2024, 10:08 AM   #11
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,207
Karma: 1419197
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
Did you enable the system tray icon in calibrepreferences? do notifications from calibre itself work? for example when a conversion is done you will get a notification about it normally.
1) Yes. Preferences > Look & feel > Enable system tray icon' is checked and the icon is showing in the tray
2) No. No notification when calibre completes a conversion.

I remember seeing notifications in the Windows notification panel only when I was in debug mode. I've never seen a notification in normal mode.

I my Windows 11 machine, when I check the system config 'System > Notifications', calibre is not listed there. I see many other programs, but not calibre.
thiago.eec is offline   Reply With Quote
Old 11-07-2024, 10:39 AM   #12
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,606
Karma: 7511185
Join Date: Sep 2020
Device: none
I see the taskbar flash upon any job completion, and I'm happy with it by the way.

For instance, in my Waterfox settings I have alerts.useSystemBackend set to false. I don't need every program in the system to be fully integrated to Windows, especially when the browser itself is almost like an OS (I have hundreds of add-ons that provide extended functionality) and send out tons of useful notifications, that I need to monitor.

The other day I tried to make a .bat script reproduce this same behavior Calibre has in my system. Taskbar flashing for that script would be perfectly sufficient because it's not too intrusive. When I realised I would need to use powershell, I put this on hold. (I can only do some basic stuff using windows classic shell)

However, from time to time I miss the ability to see when some task is completed in Calibre. For instance: GR Author Notes plugin.
Comfy.n is offline   Reply With Quote
Old 11-07-2024, 10:44 AM   #13
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,207
Karma: 1419197
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by Comfy.n View Post
I see the taskbar flash upon any job completion, and I'm happy with it by the way.
Yes, the taskbar icon flashes.
thiago.eec is offline   Reply With Quote
Old 11-07-2024, 11:10 AM   #14
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,289
Karma: 27111240
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by thiago.eec View Post
1) Yes. Preferences > Look & feel > Enable system tray icon' is checked and the icon is showing in the tray
2) No. No notification when calibre completes a conversion.

I remember seeing notifications in the Windows notification panel only when I was in debug mode. I've never seen a notification in normal mode.

I my Windows 11 machine, when I check the system config 'System > Notifications', calibre is not listed there. I see many other programs, but not calibre.
It's quite possible the Qt notifications are broken on windows. They probably dont use the new windows 11 notification infrastructure. I havent bothered looking into it since that uses winrt and building stuff against it requires extra dependencies not worth the hassle.
kovidgoyal is offline   Reply With Quote
Old 11-07-2024, 09:11 PM   #15
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,289
Karma: 27111240
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I tried it on my win11 machine with system tray enabled and notifications on job completion not disabled and I got popup notifications as expected when converting. Though I dont see any system tray anymore in windows. IIRC windows requires shortcuts to be installed for the application otherwise it refuses to show notifications so maybe its caused by using calibre portable.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide System Fonts feature (make system fonts toggable)? spedinfargo KOReader 7 10-27-2022 09:11 PM
Kobo system cannot recognize fonts added into system-wide fonts directory? codychan Kobo Developer's Corner 11 12-08-2018 05:35 PM
Notification not working BobC Feedback 12 08-04-2016 04:04 AM
Arc Notification bar freeze and eventual system UI crash (Arc 10HD) Glompish Kobo Tablets 6 12-26-2014 02:32 AM
how to clean more disk space in root file system to upgrade system chinaet iRex 1 12-18-2006 03:54 PM


All times are GMT -4. The time now is 03:48 PM.


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