Hi Nikolaus,

Afraid this will not be an easy thing to hack. The code you need to look at
is the method "do_key_press_event" in the file zim/gui/pageview.py .

Be warned that this is a part of the code that is high on my list for
re-factoring to iron out bugs and hacks. So not easy to modify, and hacks
will not be stable towards future releases.

Changing behavior on entering a number can be done. Challenge will be to
correctly detect the "environment" of the cursor, so you know what behavior
to trigger when.

Regards,

Jaap



On Tue, Feb 10, 2015 at 7:03 PM, Nikolaus Klepp <dr.kl...@gmx.at> wrote:

> Hi!
>
> I use zim for elementary school children. Now I'd like to get it working
> for basic arithmetics and I'm kind of stuck. Maybe you could direct me
> where I should get working on the code?
>
> I'd like to let the user build calulations like these, where the numbers
> align "magicly" in the same way like you'd write it on paper, i.e.:
> - numbers use monospaced font
> - line is right aligned
> - numbers are entered left-to-right
> - numbers in the line under the summation-line are entered right-to-left
>
> example:
>         123
>          45
>         ---
>         168
>
>          123
>         4567
>         ----
>         4690
>
> To a monospaced font, I added to .config/zim/style.conf:
>         [Tag indent]
>         foreground=#000080
>         family=monospace
> which takes perfectly care about entering "atithmetic mode".
>
> Now thew hard part:
> The user types: "<tab>123<return>4"
> ZIM diplays:
> <tab>123
> <tab><space><space>4
>
> the user continues: "5"
> ZIM diplays:
> <tab>123
> <tab><space>45
>
> the user continues: "<return>-<return>"
> ZIM diplays:
> <tab>123
> <tab><space>45
> <tab>---
> <tab>
>
> the user continues: "8"
> ZIM diplays:
> <tab>123
> <tab><space>45
> <tab>---
> <tab><space><space>8
>
> the user continues: "6"
> ZIM diplays:
> <tab>123
> <tab><space>45
> <tab>---
> <tab><space>68
>
> the user continues: "1"
> ZIM diplays:
> <tab>123
> <tab><space>45
> <tab>---
> <tab>168
>
> So, where should I start hacking?
>
> Nik
>
> --
> Please do not email me anything that you are not comfortable also sharing
> with the NSA.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~zim-wiki
> Post to     : zim-wiki@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~zim-wiki
> More help   : https://help.launchpad.net/ListHelp
>
_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp

Reply via email to