Register Guidelines E-Books Search Today's Posts Mark Forums Read

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
Enthusiast
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: 32
Karma: 18230
Join Date: Jul 2016
Location: Somewhere in France
Device: Kobo Mini, Kobo H20 v1
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 it is:


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
Or here:
Dashboard as a standalone package



Here is the link to the sources and a 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).


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:	313
Size:	126.7 KB
ID:	172883  

Last edited by Mavireck; 08-19-2019 at 09:11 AM.
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: 8,965
Karma: 14300102
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
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: 8,965
Karma: 14300102
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
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
Enthusiast
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: 32
Karma: 18230
Join Date: Jul 2016
Location: Somewhere in France
Device: Kobo Mini, Kobo H20 v1

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: 8,965
Karma: 14300102
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
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: 717
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
Enthusiast
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: 32
Karma: 18230
Join Date: Jul 2016
Location: Somewhere in France
Device: Kobo Mini, Kobo H20 v1
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: 6,102
Karma: 27131869
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Aura One, Aura H2O, Aura HD, Nexus 7 HD, iPad Air, 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: 717
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: 160
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
Enthusiast
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: 32
Karma: 18230
Join Date: Jul 2016
Location: Somewhere in France
Device: Kobo Mini, Kobo H20 v1
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: 8,965
Karma: 14300102
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
@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: 160
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: 8,965
Karma: 14300102
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
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: 8,965
Karma: 14300102
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
@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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kindle weather dashboard matopeto Kindle Developer's Corner 15 12-31-2018 01:54 PM
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 11:25 PM.


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