It is common practice to dispatch the Application object before using it, but I noticed there are at least two different ways of doing it:
1.)
from win32com.client import dynamic as d
App = d.Dispatch ('XSI.Application')
2.)
from win32com.client import Dispatch
App = Dispatch("XSI.Application").Application
The reason I'm actually asking is that I'm running into a problem with timer events with the latter approach,
and I simply want to understand if there are situations where I still want to use it, or if I should always
go with the first one.
If I use the first one, I can create and change my timer event as documented:
def XSILoadPlugin( in_reg ):
#=== Register events ===
in_reg.RegisterTimerEvent( "ExecutionTimer", 0, 1 ) #Delayed timer with 1ms and zero repetitions
return True
#Later in the code I can get the timer and reset it like so:
oTimer = App.EventInfos( "QMenuExecutionTimer" ) #Find the timer
QMenuTimer.Reset( 0, 1 ) #Reset the timer
This works fine with the first approach described above.
However, if I use the second one and try to reset the timer event, I get:
AttributeError: '<win32com.gen_py.Softimage|XSI Object Model Library v1.5.EventInfo instance at 0x488173640>' object has no attribute 'Reset'
There's lots of other stuff going on in the plugin that works perfectly fine, so I guess this is just an Object Model bug, but why, and what's the difference?
Cheers,
Stefan
--
-------------------------------------------
Stefan Kubicek Co-founder
-------------------------------------------
keyvis digital imagery
Wehrgasse 9 - Grᅵner Hof
1050 Vienna Austria
Phone:
+43/699/12614231
---
www.keyvis.at ste...@keyvis.at ---
-- This email and its attachments are
--confidential and for the recipient only--