On Sun, 12 Sep 2010 23:04:42 -0500
Terry Brown <terry_n_br...@yahoo.com> wrote:

> +            print g.app.gui.runAskDateTimeDialog(c, 'When?',
> +              message="When is it?",
> +              step_min={QtGui.QDateTimeEdit.MinuteSection: 5})

Here's my @button code for inserting a date / time (formatted for use with 
`remind` (http://www.roaringpenguin.com/products/remind) at the current text 
cursor position:

    from PyQt4 import QtGui
    dt = g.app.gui.runAskDateTimeDialog(c, 'When?',
        message="When is it?",
        step_min={QtGui.QDateTimeEdit.MinuteSection: 5})
        
    ds = dt.strftime("%Y %b %d %H:%M")
    
    txt = p.b
    w = c.frame.body.bodyCtrl
    pnt = w.getInsertPoint()
    p.b = txt[:pnt] + ds + txt[pnt:]
    w.setInsertPoint(pnt+len(ds))
    c.redraw()

I might be missing a more friendly wrapper for "insert this string at the 
cursor", if I'm not, perhaps some additions along those lines would be good.  
But probably not high priority.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to leo-edi...@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to