zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #01791
Re: Inserting the time with a hotkey
On Fri, Jun 8, 2012 at 9:17 PM, Adam Porter <adam@xxxxxxxxxxxxx> wrote:
> I am so close to having it work. It took some trial and error, and a
> few "Looks like you discovered a bug" dialogs, but finally I cut
> everything out of the InsertTimeDialog (formerly InsertDateDialog)
> class except this in __init__:
>
> class InsertTimeDialog(Dialog):
> def __init__(self, ui, buffer):
> buffer.insert_at_cursor("**"+datetime.datetime.now().strftime('%H:%M')+"**")
How about completely removing this Dialog class and instead putting
your logic to insert a time in the routine that creates the dialog ?
That should simplify things a bit more.
Usually I advice people to look at the "Print to Browser" plugin for
the bar boiler plate to add a menu item and have a single function
called when that menu item is clicked or triggered by the accelerator
key.
Hope this helps, otherwise would have to see the whole plugin you made.
Regards,
Jaap
Follow ups
References