You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(33) |
Dec
(20) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(7) |
Feb
(44) |
Mar
(51) |
Apr
(43) |
May
(43) |
Jun
(36) |
Jul
(61) |
Aug
(44) |
Sep
(25) |
Oct
(82) |
Nov
(97) |
Dec
(47) |
| 2005 |
Jan
(77) |
Feb
(143) |
Mar
(42) |
Apr
(31) |
May
(93) |
Jun
(93) |
Jul
(35) |
Aug
(78) |
Sep
(56) |
Oct
(44) |
Nov
(72) |
Dec
(75) |
| 2006 |
Jan
(116) |
Feb
(99) |
Mar
(181) |
Apr
(171) |
May
(112) |
Jun
(86) |
Jul
(91) |
Aug
(111) |
Sep
(77) |
Oct
(72) |
Nov
(57) |
Dec
(51) |
| 2007 |
Jan
(64) |
Feb
(116) |
Mar
(70) |
Apr
(74) |
May
(53) |
Jun
(40) |
Jul
(519) |
Aug
(151) |
Sep
(132) |
Oct
(74) |
Nov
(282) |
Dec
(190) |
| 2008 |
Jan
(141) |
Feb
(67) |
Mar
(69) |
Apr
(96) |
May
(227) |
Jun
(404) |
Jul
(399) |
Aug
(96) |
Sep
(120) |
Oct
(205) |
Nov
(126) |
Dec
(261) |
| 2009 |
Jan
(136) |
Feb
(136) |
Mar
(119) |
Apr
(124) |
May
(155) |
Jun
(98) |
Jul
(136) |
Aug
(292) |
Sep
(174) |
Oct
(126) |
Nov
(126) |
Dec
(79) |
| 2010 |
Jan
(109) |
Feb
(83) |
Mar
(139) |
Apr
(91) |
May
(79) |
Jun
(164) |
Jul
(184) |
Aug
(146) |
Sep
(163) |
Oct
(128) |
Nov
(70) |
Dec
(73) |
| 2011 |
Jan
(235) |
Feb
(165) |
Mar
(147) |
Apr
(86) |
May
(74) |
Jun
(118) |
Jul
(65) |
Aug
(75) |
Sep
(162) |
Oct
(94) |
Nov
(48) |
Dec
(44) |
| 2012 |
Jan
(49) |
Feb
(40) |
Mar
(88) |
Apr
(35) |
May
(52) |
Jun
(69) |
Jul
(90) |
Aug
(123) |
Sep
(112) |
Oct
(120) |
Nov
(105) |
Dec
(116) |
| 2013 |
Jan
(76) |
Feb
(26) |
Mar
(78) |
Apr
(43) |
May
(61) |
Jun
(53) |
Jul
(147) |
Aug
(85) |
Sep
(83) |
Oct
(122) |
Nov
(18) |
Dec
(27) |
| 2014 |
Jan
(58) |
Feb
(25) |
Mar
(49) |
Apr
(17) |
May
(29) |
Jun
(39) |
Jul
(53) |
Aug
(52) |
Sep
(35) |
Oct
(47) |
Nov
(110) |
Dec
(27) |
| 2015 |
Jan
(50) |
Feb
(93) |
Mar
(96) |
Apr
(30) |
May
(55) |
Jun
(83) |
Jul
(44) |
Aug
(8) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
(1) |
| 2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(1) |
Oct
(3) |
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
(7) |
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(9) |
2
(2) |
|
3
(2) |
4
(1) |
5
(14) |
6
(3) |
7
(1) |
8
(3) |
9
|
|
10
(7) |
11
(4) |
12
|
13
(11) |
14
(1) |
15
(2) |
16
|
|
17
|
18
|
19
(3) |
20
(2) |
21
|
22
|
23
(1) |
|
24
|
25
|
26
(1) |
27
|
28
|
29
|
|
|
From: Paul K. <pki...@ni...> - 2008-02-06 15:04:58
|
On Wed, Feb 06, 2008 at 01:21:30AM +0100, Gael Varoquaux wrote:
> On Tue, Feb 05, 2008 at 07:16:59PM -0500, Paul Kienzle wrote:
> > I'll look around some more and see if I can find the sleep until next
> > event function in wx.
>
> Yeah, sleep, I need more of that. Or maybe you can find wx.coffee ?
Sleep not found, despite half the night trying.
What follows three experiments I tried, but now I'm out of ideas. The
last thing to do would be to follow your suggestion and move the busy
loop from ginput to CanvasBase and let the individual backends override
with a better solution if available.
- Paul
Attempted solutions for modal wx event processing:
1. Run a private event loop with a timer every 0.1s to see if the user
has done selecting. This works, but it doesn't like it if the window
is closed before completion. I didn't test for it, but super-fast
clicking should let the user sometimes select an extra point, so not
a great solution.
def event_loop(self, done=lambda:False, timeout=0):
'run the eventloop until done or timeout'
print "Running private event loop"
loop = wx.EventLoop()
# stop after timeout period
def donewaiting(*args,**kw):
print "Done waiting"
loop.Exit()
if timeout > 0:
print "Starting timer"
outtimer = wx.Timer(self, id=MODAL_TIMEOUT_TIMER)
outtimer.Start(timeout*1000, oneShot=True)
self.Bind(wx.EVT_TIMER, donewaiting, outtimer)
# check if done every 0.1 s
def checkdone(*args,**kw):
if done(): loop.Exit()
steptimer = wx.Timer(self, id=MODAL_STEP_TIMER)
steptimer.Start(100, oneShot=False)
self.Bind(wx.EVT_TIMER, checkdone, steptimer)
loop.Run()
steptimer.Stop()
return
2. What seems like it should work is to use an event handler which
checks after processing each event whether or not this completes
the condition and so we can exit the loop. However, ProcessEvent
never seems to be called. Reading elsewhere I see that ProcessEvent
is not a virtual function in wx, so presumably we can't override
it in a subclass of wx.EvtHandler.
# Redirect input events to new handler
class ModalHandler(wx.EvtHandler):
def ProcessEvent(self, evt):
print "Processing event"
if done(): loop.Exit()
return False # True if processed
print "Pushing handler"
handler = ModalHandler()
self.PushEventHandler(handler)
print "enabled",handler.GetEvtHandlerEnabled()
print "handler->next",handler.GetNextHandler()
print "self->previous",self.GetPreviousHandler()
loop.Run()
self.PopEventHandler(False)
print "Done!"
3. Revising two somewhat, I send all events for the canvas through
my own event handler. To make sure I see each one I bind each window
event to my own dispatcher as well as to the underlying window. I
then use this handler rather than self in the canvas __init__.
This fails because either the window handler is not called or it
is called twice, depending on whether PushEventHandler and ProcessEvent
are called. It also fails if the window is closed unexpectedly.
class ModalHandler(wx.EvtHandler):
def __init__(self, window):
print "Creating handler"
wx.EvtHandler.__init__(self)
self.done = lambda:False
window.PushEventHandler(self)
self.window = window
self.timer = wx.Timer()
self.Bind(wx.EVT_TIMER, self.OnTimeout, self.timer)
self.loop = wx.EventLoop()
def _dispatch(self, evt):
"""Ick! ProcessEvent is not virtual, so we can't override directly!"""
#print "Processing event"
self.window.ProcessEvent(evt)
if self.done(): self.loop.Exit()
print "Returning event"
return True
def EndModal(self):
"""Force the loop to exit"""
self.done = lambda:True
def Bind(self,evt,action,*args,**kw):
# Force all events through ProcessEvent. This is the first binding.
# ProcessEvent will dispatch the event to the window itself, so be
# sure to tell the window what to do with the event. This is the
# second binding.
if wx.VERSION_STRING >= '2.5': # Event handlers 2.5
print "Binding 2.5"
wx.EvtHandler.Bind(self.window,evt,action,*args,**kw)
wx.EvtHandler.Bind(self,evt,self._dispatch)
else:
print "Binding 2.4"
evt(self,self.ProcessEvent)
evt(self.window,*args,**kw)
def OnTimeout(self):
print "timeout"
self.loop.Exit()
def RunLoop(self, done=lambda:False, timeout=0):
print "Running loop"
self.done = done
if timeout > 0: self.timer.Start(timeout, oneShot=True)
try:
self.loop.Run()
finally:
self.timer.Stop()
self.done = lambda:False
|
|
From: Gael V. <gae...@no...> - 2008-02-06 00:21:40
|
On Tue, Feb 05, 2008 at 07:16:59PM -0500, Paul Kienzle wrote: > How about giving flush_events() an until=condition and timeout=n keywords > so that flush_events becomes: > if timeout > 0: set timer event which triggers out_of_time > while get next event: > process event > if out_of_time or until(): break I'd say this is exactly the way to do it. The problem is that under GTK is seems fairly easy to do, under Tk it seems feasible, but under Qt and under Wx I have no clue how to do this. We can always fallback to busy-waiting for these toolkits. This indeed seems to be the way to go. Maybe I would empty the event stack when the "until()" condition is met, before returning to the caller, and thus blocking again. > I'll look around some more and see if I can find the sleep until next > event function in wx. Yeah, sleep, I need more of that. Or maybe you can find wx.coffee ? Cheers, Gaël |
|
From: Paul K. <pki...@ni...> - 2008-02-06 00:17:11
|
On Wed, Feb 06, 2008 at 12:38:32AM +0100, Gael Varoquaux wrote:
> On Tue, Feb 05, 2008 at 06:30:53PM -0500, Paul Kienzle wrote:
> > Setting the timeout to 0.01s for the busy loop in ginput seems excessive.
> > Since it is waiting for human interaction, generally 0.1 seconds is good
> > enough.
>
> I had gone for that originally, but it looked quite ugly when moving the
> window around. This busy waiting is quite ugly, but I have found a way of
> avoid it. IMHO it should be done in the toolkit's event loop, but it
> seems that trying to do it this would add gobbles of code for little
> gain.
How about giving flush_events() an until=condition and timeout=n keywords
so that flush_events becomes:
if timeout > 0: set timer event which triggers out_of_time
while get next event:
process event
if out_of_time or until(): break
Looking through wx I don't see how to "get next event", my choices being
run all events (MainLoop) or run pending events. I do see an "exit main
loop" function, so for wx at least one could redirect the event handler
for the window and run all the events, exiting the main loop when done,
but that seems ugly. I'll look around some more and see if I can find
the sleep until next event function in wx.
- Paul
|