Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 08-12-2019, 09:12 AM   #1
Mavireck
Connoisseur
Mavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a Texan
 
Posts: 63
Karma: 18290
Join Date: Jul 2016
Location: France
Device: Kobo H2O (broken), Kobo H2O Edition 2 v1 (stolen), Kobo Clara 2E
Kobo Dashboard (A all-in-one clock, calendar, weather and notification app)

Hello everyone.
The real project I have been working on for a few weeks was a dashboard app.
So here is the Kobo-Dashboard!




Installation:
You need KFMon and NiLuJe's KoboStuff enabled.
Then unzip one of these two packages at the root of your onboard storage:
Dashboard bundled with my (improved) PythonLauncher and WolframAlpha app (OLD VERSION)
Or here:
Dashboard as a standalone package



Sources and manual
https://github.com/Mavireck/Kobo-Dashboard
It should work with both Python2 and Python3, I suggest you install NiLuJe's package because it also requires FBInk.
I only tested it on a H20 First edition, it will probably not work well with any other version (you will need to fix quite a few things).



Some more information if you want to make your own Python app
Spoiler:

PSSM, which allows you to create a GUI app very easily and quickly.


Kobo-Python-Launcher, if you want a automatically-generated launcher to launch your own Python script (or to launch Plato or KOReader)



I hope you will like it!
It is useful to me, so I thought it might be useful to someone else.

Thanks all the Kobo developpers, I used a lot from your code. (Especially for this project : NiLuJe for KoboStuff, KFMon and FBInk, sherman for the osk and the code for handling touch input, and brunolalb for the weather app that motivated me to make my own dashboard (I did get a lot of inspiration from your app), baskerville for Plato and helping me fix the Plato launch from my PythonLauncher, etc...
Attached Thumbnails
Click image for larger version

Name:	kobo.jpg
Views:	2890
Size:	126.7 KB
ID:	172883  

Last edited by Mavireck; 05-23-2020 at 12:43 PM. Reason: Reference to PSSM
Mavireck is offline   Reply With Quote
Old 08-12-2019, 10:31 AM   #2
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Random comments about FBInk usage ahead .

You should be able to use fbink_refresh() (or fbink_cls(), if you need a blank screen), f.g., for a flashing full-screen refresh:

Code:
        fbink_cfg.is_flashing = True
        FBInk.fbink_refresh(fbfd, 0, 0, 0, 0, FBInk.HWD_PASSTHROUGH, fbink_cfg)
Same thing for fbink_print_ot():

Code:
        FBInk.fbink_add_ot_font("PxPlus_IBM_VGA8.ttf", FBInk.FNT_BOLD)
        fbink_ot_cfg = ffi.new("FBInkOTConfig *")
        fbink_ot_cfg.margins.top = 500
        fbink_ot_cfg.margins.bottom = 600
        fbink_ot_cfg.margins.left = 400
        fbink_ot_cfg.margins.right = 50
        fbink_ot_cfg.size_pt = 10.0
        fbink_ot_cfg.is_formatted = True
        FBInk.fbink_print_ot(fbfd, "**Wheeeee!**", fbink_ot_cfg, fbink_cfg, ffi.NULL)
        FBInk.fbink_free_ot_fonts()
(Tested at the end of the try: block in the binding's hello.py example, which explains the indentation & variable names ).

----

In the same vein, I'm fairly sure you can send ioctl in straight Python, instead of relying on a C helper for the frontlight (I'd, err, forgotten you were doing Python when I originally mentioned a C helper ;p).

Last edited by NiLuJe; 08-12-2019 at 10:44 AM.
NiLuJe is offline   Reply With Quote
Advert
Old 08-12-2019, 10:51 AM   #3
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
And as far as images are concerned, you can avoid the encoding process for Pillow-generated content, and directly pass the raw data to fbink_print_raw_data() (c.f., the Pillow example).

You also *probably* don't need to do an invert via ImageOps, FBInk can either do it itself (bracket your print call between fbink_cfg.is_inverted = True and fbink_cfg.is_inverted = False), or, better, let the device's hardware do it (same idea, but with is_nightmode instead or is_inverted).

Both solutions imply that the refresh region only contains the image in question, though, because the inversions will apply to the full region .
(Which shouldn't be an issue here, unless you're doing some fancy batch-processing with no_refresh set during fbink_print_*() and then a final fbink_refresh())

Last edited by NiLuJe; 08-12-2019 at 10:54 AM.
NiLuJe is offline   Reply With Quote
Old 08-12-2019, 01:37 PM   #4
Mavireck
Connoisseur
Mavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a Texan
 
Posts: 63
Karma: 18290
Join Date: Jul 2016
Location: France
Device: Kobo H2O (broken), Kobo H2O Edition 2 v1 (stolen), Kobo Clara 2E

Thanks a lot for your helpful messages! I will update my scripts ASAP!
Although I may remove the screen inversion button then, it was pretty much broken anyway (well it was working, but it was a dirty hack). I will leave it as a configuration parameter nonetheless.

As for the font, thanks for the help, but my main issue was a FBInk bug, which you fixed in the last updates I installed the last version and it now works fine.


Unrelated : Did you actually read all the code? These were tiny details I thought nobody would notice

Last edited by Mavireck; 08-12-2019 at 04:25 PM.
Mavireck is offline   Reply With Quote
Old 08-12-2019, 02:10 PM   #5
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
No, I mostly skimmed it and noticed the comments .
NiLuJe is offline   Reply With Quote
Advert
Old 08-13-2019, 04:35 PM   #6
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
My only suggest is: remove predictions after tomorrow, they are useless
Lucas Malor is offline   Reply With Quote
Old 08-13-2019, 05:31 PM   #7
Mavireck
Connoisseur
Mavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a Texan
 
Posts: 63
Karma: 18290
Join Date: Jul 2016
Location: France
Device: Kobo H2O (broken), Kobo H2O Edition 2 v1 (stolen), Kobo Clara 2E
Quote:
Originally Posted by Lucas Malor View Post
My only suggest is: remove predictions after tomorrow, they are useless
I will think about how to implement a variable to change the number of days which can be displayed (I don't quite know how I will do that, but it is an interesting idea!)
Mavireck is offline   Reply With Quote
Old 08-13-2019, 06:49 PM   #8
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,513
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Lucas Malor View Post
My only suggest is: remove predictions after tomorrow, they are useless
Quote:
Originally Posted by Mavireck View Post
I will think about how to implement a variable to change the number of days which can be displayed (I don't quite know how I will do that, but it is an interesting idea!)
I think they should be left in for their entertainment value.
DNSB is offline   Reply With Quote
Old 08-14-2019, 02:41 AM   #9
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
Or you can add the percentage of reliability. And you'll laugh.
Lucas Malor is offline   Reply With Quote
Old 08-14-2019, 03:09 AM   #10
lohtse
Groupie
lohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exercise
 
lohtse's Avatar
 
Posts: 197
Karma: 38050
Join Date: Oct 2013
Location: Anywhere I am sent!!!
Device: Kobo Touch
Anmyone able to just put all the required files in to ONE zip file???

oddly having issue swith github etc for downloads/access..

would be a great help..


thank you
lohtse is offline   Reply With Quote
Old 08-14-2019, 06:00 AM   #11
Mavireck
Connoisseur
Mavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a TexanMavireck might easily be mistaken for a Texan
 
Posts: 63
Karma: 18290
Join Date: Jul 2016
Location: France
Device: Kobo H2O (broken), Kobo H2O Edition 2 v1 (stolen), Kobo Clara 2E
Quote:
Originally Posted by lohtse View Post
Anmyone able to just put all the required files in to ONE zip file???

oddly having issue swith github etc for downloads/access..

would be a great help..


thank you

Here you go:
https://github.com/Mavireck/Kobo-Pyt...eases/tag/v1.0

It packs both my Dashboard and my Wolfram Alpha app. And it starts a very simple menu from which you can start them, and from which you can also start PBChess, Koreader and YAWK (I have not fixed Plato's launch script yet). (I don't like to have too many "fake books" which are only script starters).


Installation guide:
If you are not using a Kobo H2O First Edition:
- edit the launcher.py in Kobo-Python-Launcher for appropriate screen_width, screen_height and input file (if input does not work).
- Edit Kobo-Dashboard/files/config.json and Kobo-WolframAlpha/WAK.py for the same reason.
- Report if you see any error, although I do not guarantee a long-term maintenance.
- Then follow the steps below:

If you are already using a H20:
- Install KFMon and KoboStuff by NiLuJe.
- Edit Kobo-Dashboard/files/config.json with your openweathermaps APPID et cityID.
- If you want to start KOReader from my simple menu, copy .adds/mavireck/Kobo-Python-Launcher/startKoreaderFromPythonLauncher.sh into .adds/koreader/
- If you want to remove/add entries to the Python Launcher, edit the .adds/mavireck/Kobo-Python-Launcher/launcher.json file


P.S. Is it really impossible to edit a thread title? That is the first forum for which I am unable to change it...

Last edited by Mavireck; 08-14-2019 at 06:03 AM.
Mavireck is offline   Reply With Quote
Old 08-14-2019, 07:36 AM   #12
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@Mavireck: Switching to git submodules might make things easier? .

And, yeah, you can't edit your own thread's title (... unless you have moderating rights ).

What you *can* do is tap the report button (!) and explain what you want to do with the title, that usually works to get a moderator to see the request .
NiLuJe is offline   Reply With Quote
Old 08-14-2019, 11:50 AM   #13
lohtse
Groupie
lohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exerciselohtse juggles running chainsaws for a bit of light exercise
 
lohtse's Avatar
 
Posts: 197
Karma: 38050
Join Date: Oct 2013
Location: Anywhere I am sent!!!
Device: Kobo Touch
Quote:
Originally Posted by Mavireck View Post
Here you go:
https://github.com/Mavireck/Kobo-Pyt...eases/tag/v1.0

It packs both my Dashboard and my Wolfram Alpha app. And it starts a very simple menu from which you can start them, and from which you can also start PBChess, Koreader and YAWK (I have not fixed Plato's launch script yet). (I don't like to have too many "fake books" which are only script starters).


Installation guide:
If you are not using a Kobo H2O First Edition:
- edit the launcher.py in Kobo-Python-Launcher for appropriate screen_width, screen_height and input file (if input does not work).
- Edit Kobo-Dashboard/files/config.json and Kobo-WolframAlpha/WAK.py for the same reason.
- Report if you see any error, although I do not guarantee a long-term maintenance.
- Then follow the steps below:

If you are already using a H20:
- Install KFMon and KoboStuff by NiLuJe.
- Edit Kobo-Dashboard/files/config.json with your openweathermaps APPID et cityID.
- If you want to start KOReader from my simple menu, copy .adds/mavireck/Kobo-Python-Launcher/startKoreaderFromPythonLauncher.sh into .adds/koreader/
- If you want to remove/add entries to the Python Launcher, edit the .adds/mavireck/Kobo-Python-Launcher/launcher.json file


P.S. Is it really impossible to edit a thread title? That is the first forum for which I am unable to change it...
Hmmmm will this work on a Kobo Touch?
lohtse is offline   Reply With Quote
Old 08-14-2019, 11:53 AM   #14
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
From what I gather w/ KOReader, input handling is touch and go (pun intended) on the original Touch trilogy.

We haven't found a fool-proof way of figuring out how to handle *all* variants properly without user interaction.

TL;DR: In spirit, yes, but in practice, possibly with quirky touch handling.
NiLuJe is offline   Reply With Quote
Old 08-14-2019, 11:55 AM   #15
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@Mavireck: Speaking of other devices, I'd possibly get rid of the user-configurable screen dimensions (or at least make that a dev/test option), and instead default to figuring them out automagically (say, via fbink_get_state() ;p) .

Code:
state = ffi.new("FBInkState *")
FBInk.fbink_get_state(fbink_cfg, state)
print("Screen is {}x{}".format(state.screen_width, state.screen_height))

Last edited by NiLuJe; 08-14-2019 at 11:58 AM.
NiLuJe is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kindle weather dashboard matopeto Kindle Developer's Corner 22 02-04-2023 06:12 AM
How to use a Kindle DX as information dashboard peanutman Kindle Developer's Corner 1 05-05-2017 05:31 AM
Kindle as a motorcycle dashboard? elektrinis Kindle Developer's Corner 22 03-16-2016 01:25 PM
Macinstosh Dashboard Opens Security Vulnerabilities Bob Russell Lounge 0 05-09-2005 11:40 AM


All times are GMT -4. The time now is 05:23 AM.


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