Back to index

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

List of all members.

Public Member Functions

def __init__
def wait
def isAlive

Public Attributes

 fileconn
 file

Detailed Description

Definition at line 28 of file photoshp.py.


Constructor & Destructor Documentation

Launch editor process

Definition at line 29 of file photoshp.py.

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

Member Function Documentation

Returns true if the editor process is still alive

Definition at line 52 of file photoshp.py.

00052 
00053     def isAlive(self):
00054         """Returns true if the editor process is still alive"""
00055         # Photoshop has no API for checking if a file is still open
00056         # This workaround just checks if the file connection is
00057         # still accessible. It will be until Photoshop itself is closed 8^/
00058         try:
00059             self.fileconn.Title # See if the file is still accessible
00060         except:
00061             return 0
00062         return 1

Wait for editor to exit or until timeout

Definition at line 48 of file photoshp.py.

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

Member Data Documentation

Definition at line 46 of file photoshp.py.

Definition at line 45 of file photoshp.py.


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