← Back to team overview

zim-wiki team mailing list archive

Re: Inserting the time with a hotkey

 

On Sat, Jun 9, 2012 at 3:30 AM, Jaap Karssenberg
<jaap.karssenberg@xxxxxxxxx> wrote:
> 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__:
>>
>> csudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian precise non-free contrib" >> /etc/apt/sources.list.d/virtualbox.org.list'lass 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.

Thanks for your reply, Jaap.

Sorry for being unclear: I didn't make a plugin.  I just edited
pageview.py, duplicated that InsertDateDialog class, renamed it, and
edited a few lines.  It works, except that I don't know how to call
toggle_format_strong() to toggle bold text (assuming that's the best
way).  How do I access that function?


Follow ups

References