Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
ExternalEditor.Plugins.winword.EditorProcess Class Reference

List of all members.

Public Member Functions

def __init__
def wait
def isAlive

Public Attributes

 wordapp
 file

Detailed Description

Definition at line 25 of file winword.py.


Constructor & Destructor Documentation

Launch editor process

Definition at line 26 of file winword.py.

00026 
00027     def __init__(self, file):
00028         """Launch editor process"""
00029         word = win32com.client.Dispatch('Word.Application')
00030         # Try to open the file, keep retrying until we succeed or timeout
00031         i = 0
00032         timeout = 45
00033         while i < timeout:
00034             try:
00035                 word.Documents.Open(file)
00036             except:
00037                 i += 1
00038                 if i >= timeout:
00039                     raise RuntimeError('Could not launch Word.')
00040                 sleep(1)
00041             else:
00042                 break
00043         word.Visible = 1
00044         self.wordapp = word
00045         self.file = file
        

Member Function Documentation

Returns true if the editor process is still alive

Definition at line 50 of file winword.py.

00050 
00051     def isAlive(self):
00052         """Returns true if the editor process is still alive"""
00053               try:
00054             self.wordapp.Documents(self.file)
00055         except pythoncom.com_error, why:
00056             # COM will reject the call to access the doc if the user is
00057             # doing anything interactive at the time the call is made.  The
00058             # symptom is a COM error numbered -2147418111 named "Call rejected
00059             # by callee".  This is most critically seen when the user has
00060             # modified the document but chooses "exit" without first saving.
00061             # Without this check in place, the document is not saved back to
00062             # Zope, but no error is raised.
00063             if why[0] == -2147418111:
00064                 return 1
00065         except:
00066             return 0
00067         else:
00068             return 1
        
Wait for editor to exit or until timeout

Definition at line 46 of file winword.py.

00046 
00047     def wait(self, timeout):
00048         """Wait for editor to exit or until timeout"""
00049         sleep(timeout)
            

Member Data Documentation

Definition at line 44 of file winword.py.

Definition at line 43 of file winword.py.


The documentation for this class was generated from the following file: