zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #03268
Re: Change input
-
To:
"zim-wiki" <zim-wiki@xxxxxxxxxxxxxxxxxxx>
-
From:
"Dr. Nikolaus Klepp" <dr.klepp@xxxxxx>
-
Date:
Tue, 17 Feb 2015 11:59:37 +0100
-
In-reply-to:
<CA+TmwMGibuWTLmHYjLDk3Pn3SNP3gZFLF-w+8=aP2ftRSJ_3Ww@mail.gmail.com>
-
User-agent:
KMail/1.9.10 (enterprise35 0.20100827.1168748)
Hi Jaap!
I looked at the code and see what you mean :-)
When you work on that code, may I suggest you add just one callback for "key pressed" that can be utilised from plugins? With that callback I could quite easily implement my planed behaviour, just like an autoformat plugin.
Nik
Am Freitag, 13. Februar 2015 schrieb Jaap Karssenberg:
> 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.klepp@xxxxxx> 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@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~zim-wiki
> > More help : https://help.launchpad.net/ListHelp
> >
>
--
Please do not email me anything that you are not comfortable also sharing with the NSA.
References