PK8($o`o` ecco_dde.pyimport os, sys, time, csv, datetime __all__ = [ 'EccoDDE', 'DDEConnectionError', 'StateError', 'FileNotOpened', 'WrongSession', 'ItemType', 'FolderType', 'InsertLevel', 'OLEMode', 'SelectionType', 'format_date', 'format_datetime', ] class DDEConnectionError(Exception): """Problem connecting to a DDE Server""" class StateError(Exception): """Ecco is not in the expected state""" class FileNotOpened(StateError): """Ecco didn't open a requested file""" class WrongSession(StateError): """The expected session is not active""" def format_date(dt): if hasattr(dt, 'strftime'): return dt.strftime("%Y%m%d") return dt def format_datetime(dt): if hasattr(dt, 'strftime'): return dt.strftime("%Y%m%d%H%M%s") return dt def additional_tests(): import doctest return doctest.DocFileSuite( 'README.txt', optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE, ) # Item Types class ItemType(object): ItemText = 1 OLE = 2 # Selection Types class SelectionType(object): Items = 1 Folders = 2 Nothing = 0 # Folder Types class FolderType(object): CheckMark = 1 Date = 2 Number = 3 Text = 4 PopUpList = 5 # Insert locations class InsertLevel(object): Indent = 'd' # "first daughter" Outdent = 'a' # "next aunt" Same = 's' # "next sister" # OLE Modes class OLEMode(object): Link = 1 Embed = 2 class ecco(csv.Dialect): delimiter = ',' quotechar = '"' doublequote = True skipinitialspace = False lineterminator = '' quoting = csv.QUOTE_MINIMAL csv.register_dialect("ecco", ecco) def sz(s): if '\000' in s: return s.split('\000',1)[0] class output(list): """StringIO-substitute for csv writing""" __slots__ = () write = list.append def format(rows): out = output() fmt = csv.writer(out, 'ecco').writerows(rows) return '\n\r'.join(out) def fold(seq): seq = iter(seq) return zip(seq, seq) def unfold(seq): return [i2 for i1 in seq for i2 in i1] class EccoDDE(object): """A thin wrapper over the Ecco DDE API""" sleep = 1 retries = 10 filename = None connection = None server = None def __init__(self, **kw): cls = self.__class__ for k, v in kw.items(): if hasattr(cls, k): setattr(self, k, v) raise TypeError("No keyword argument "+repr(k)) def close(self): """Disconnect the DDE connection and shut down the server""" if self.connection is not None: self.connection = None if self.server is not None: self.server.Shutdown() self.server = None #__del__ = close def assert_session(self, session_id): """Raise an error if active session is not `sessionId`""" if self.GetCurrentFile() != session_id: raise StateError("Attempt to close or save inactive session") def close_all(self): """Attempt to close all open files""" self.open() while True: session = self.GetCurrentFile() if session is None: return self.CloseFile(session) def open(self): if self.connection is not None: return import win32ui, win32gui, dde, pywintypes if self.server is None: self.server = dde.CreateServer() self.server.Create("client") attempted = False for i in range(self.retries+1): try: win32gui.FindWindow('MauiFrame', 'Ecco') conn = dde.CreateConversation(self.server) conn.ConnectTo('Ecco', 'Ecco') self.connection = conn return except pywintypes.error, e: if e.args != ( 2,'FindWindow','The system cannot find the file specified.' ): raise except: t,v,tb = sys.exc_info() if (t,v) != ('error','ConnectTo failed'): del t,v,tb; conn=None raise if attempted: time.sleep(self.sleep) else: if self.filename is None: import _winreg self.filename = _winreg.QueryValue( _winreg.HKEY_CLASSES_ROOT, 'NetManage EccoPro\\shell\\open\\command' ).replace(' %1','') os.startfile(self.filename) attempted = True else: raise DDEConnectionError("ConnectTo failed") def __call__(self, cmd, *args): """Send `cmd` and `args` to Ecco via DDE 'request' or 'execute' If `args` are supplied or `cmd` is a string, a one-line csv-formatted request is sent. If `cmd` is not a string, it must be an iterable of sequences, which will then be turned into a csv-formatted string. If the resulting command is more than 250 characters long, a DDE 'exec' will be used instead of a 'request'. In either case, the result is parsed from csv into a list of lists of strings, and then returned. """ if args: cmd = format([(cmd,) + args]) elif not isinstance(cmd, basestring): cmd = format(cmd) if self.connection is None: self.open() if len(cmd)>250: self.connection.Exec(cmd) data = sz(self.connection.Request('GetLastResult')) else: data = sz(self.connection.Request(cmd)) data = data.replace('\n\r','\n').replace('\r','\n').split('\n') return list(csv.reader(data)) def poke(self, cmd, *args): """Just like __call__(), but send a DDE poke, with no return value""" data = args and format([args]) or '' if self.connection is None: self.open() self.connection.Poke(cmd, data) def intlist(self, *cmd): return map(int, self(*cmd)[0]) def one_or_many(self, cmd, ob, cvt=int): if hasattr(ob, '__iter__') and not isinstance(ob, basestring): return map(cvt, self(cmd, *ob)[0]) else: return cvt(self(cmd, ob)[0][0]) def one_or_many_to_many(self, cmd, ob, cvt=int): if hasattr(ob, '__iter__') and not isinstance(ob, basestring): return [map(cvt, row) for row in self(cmd, *ob)] else: return map(cvt, self(cmd, ob)[0]) # --- "DDE Requests supported" def CreateFolder(self, name_or_dict, folder_type=FolderType.CheckMark): """Create folders for a name or a dictionary mapping names to types If `name_or_dict` is a string, create a folder of `folder_type` and return a folder id. Otherwise, `name_or_dict` should be a dictionary (or other object with an ``.items()`` method), and a dictionary mapping names to folder ids will be returned. """ if isinstance(name_or_dict, basestring): return self.intlist('CreateFolder', folder_type, name_or_dict)[0] items = name_or_dict.items() items = zip( items, self.intlist('CreateFolder', *unfold([(j,i) for i,j in items])) ) return dict([(k,i) for (k,t),i in items]) def CreateItem(self, item, data=()): """Create `item` (text) with optional data, returning new item id `data`, if supplied, should be a sequence of ``(folderid,value)`` pairs for the item to be initialized with. """ return self.intlist('CreateItem', item, *unfold(data))[0] def GetFoldersByName(self, name): """Return a list of folder ids for folders matching `name`""" return self.intlist('GetFoldersByName', name) def GetFoldersByType(self, folder_type=0): """Return a list of folder ids whose types equal `folder_type`""" return self.intlist('GetFoldersByType', folder_type) def GetFolderItems(self, folder_id, *extra): """Get the items for `folder_id`, w/optional sorting and criteria Examples:: # Sort by value, descending: GetFolderItems(id, 'vd') # Sort by item text, ascending, if the folder value>26: GetFolderItems(id, 'ia', 'GT', 26) # No sort, item text contains 'foo' GetFolderItems(id, 'IC', 'foo') See the Ecco API documentation for the full list of supported operators. """ return self.intlist('GetFolderItems', folder_id, *extra) def GetFolderName(self, folder_id): """Name for `folder_id` (or a list of names if id is an iterable)""" return self.one_or_many('GetFolderName', folder_id, str) def GetFolderType(self, folder_id): """Type for `folder_id` (or a list of types if id is an iterable)""" return self.one_or_many('GetFolderType', folder_id) def GetFolderValues(self, item_ids, folder_ids): """Return folder values for specified folders and items `item_ids` can be a single item ID, or a sequence. If it's a sequence, the return value is a sequence ordered by the input item ids. `folder_ids` can be a single folder ID, or a sequence. If it's a sequence, the data returned for each item is a sequence ordered by the input folder ids. If a single item ID and single folder ID are used, that folder value is returned for that item. If a single folder ID is used and multiple item IDs, the result is a list of values, one value per item. If multiple folder IDs are used, and only one item ID, then the result is a single list containing the values for that one item. In other words, depending on the input, you'll get either a value, a list of values (either different folders for one item, or one folder for different items), or a list of lists of values. """ cmd = [['GetFolderValues'], []] for inp,out in zip([item_ids,folder_ids], cmd): if hasattr(inp,'__iter__'): out.extend(inp) else: out.append(inp) data = self(cmd) if not hasattr(folder_ids, '__iter__'): for i,v in enumerate(data): data[i], = v or ('',) if not hasattr(item_ids, '__iter__'): data, = data return data def GetItemFolders(self, item_ids): """Get the folders for `item_ids` If `item_ids` is iterable, each element must be either an item id or an iterable of item ids, representing a set of items for whom the folders should be retrieved. The result is a list of lists of folders, corresponding to the order of the input iterable. If `item_ids` is not iterable, the return value is a list of folder ids containing that one specific item. """ if hasattr(item_ids, '__iter__'): data = [] for item in item_ids: if hasattr(item, '__iter__'): data.append(list(item)) else: data.append([item]) data[0].insert(0,'GetItemFolders') return [map(int,d) for d in self(data)] else: return self.intlist('GetItemFolders',item_ids) def GetItemParents(self, item_id): """Return a root-first list of parent item ids of `item_id` If `item_id` is an iterable, return a list of lists, corresponding to the sequence of items. """ return self.one_or_many_to_many('GetItemParents', item_id) def GetItemSubs(self, item_id, depth=0): """itemId -> [(child_id,indent), ... ]""" return fold(self.intlist('GetItemSubs',depth,item_id)) def GetItemText(self, item_id): """Text for `item_id` (or a list of strings if id is an iterable)""" return self.one_or_many('GetItemText', item_id, str) def GetItemType(self, item_id): """Type for `item_id` (or a list of types if id is an iterable)""" return self.one_or_many('GetItemType', item_id) def GetSelection(self): """Returns a list: [ type (1=items, 2=folders), selectedIds]""" res = [ map(int,line) for line in self('GetSelection') ] res[0] = res[0][0] return res def GetVersion(self): """Return the Ecco API protocol version triple (major, minor, rev#)""" return self.intlist('GetVersion') def NewFile(self): """Create a new 'Untitled' file, returning a session id""" time.sleep(0.01) # give Ecco a chance to catch up return int(self('NewFile')[0][0]) def OpenFile(self, pathname): """Open or switch to `pathname` and return a session ID If the named file was not actually opened (not found, corrupt, etc.), a ``ecco_dde.FileNotOpened`` error will be raised instead. """ result = self(format([['OpenFile', pathname]]))[0] result = result and int(result[0]) or 0 if not result: raise FileNotOpened(pathname) return result def PasteOLEItem(self, mode=OLEMode.Embed, item_id=None, data=()):# """Paste from the clipboard, returning an item id If `item_id` is not None, the paste will go into that item. `mode` should be ``OLEMode.Link`` or ``OLEMode.Embed`` (the default). `data`, if supplied, should be a sequence of ``(folderid,value)`` pairs for the item to be initialized or updated with. """ if item_id is None: item_id = '' return int(self('PasteOleItem', mode, item_id, *unfold(data))[0][0]) # --- "Extended DDE Requests" def GetChanges(self, timestamp, folder_ids=()): """Get changes since `timestamp`, optionally restricted to `folder_ids` `timestamp` is an opaque value from Ecco itself, supplied as part of the return value from this method. If `folder_ids` is supplied, only changes to those folders and the items in them are included. Returns a triple of ``(nextstamp, items, folders)``, where ``nextstamp`` is the value that should be passed in to the next call to ``GetChanges()``, ``items`` is a list of items with changed text or folder values, and ``folders`` is a list of folders that have had items removed. Note that due to the way Ecco processes change timestamps, not all listed items or folders may have actually changed since your last call to this method. """ data = self('GetChanges', timestamp, *folder_ids)+[[],[]] return int(data[0][0]), map(int, data[1]), map(int, data[2]) def GetViews(self): """Return a list of the view ids of all views in current session""" return self.intlist('GetViews') def GetViewNames(self, view_id=None): """Return one or more view names If `view_id` is an iterable, this returns a list of view names for the corresponding view ids. If `view_id` is ``None`` or not given, this returns a list of ``(name, id)`` pairs for all views in the current session. Otherwise, the name of the specified view is returned. """ if view_id is None: views = self.intlist('GetViews') return zip(self.GetViewNames(views), views) else: return self.one_or_many('GetViewNames', view_id, str) def GetViewFolders(self, view_id): """Folder ids for `view_id` (or list of lists if id is an iterable)""" return self.one_or_many_to_many('GetViewFolders', view_id) def GetPopupValues(self, folder_id): """Popup values for `folder_id` (or list of lists if id is iterable)""" return self.one_or_many_to_many('GetPopupValues', folder_id, str) def GetFolderOutline(self): """Return a list of ``(folderid, depth)`` pairs for the current file""" return fold(self.intlist("GetFolderOutline")) def GetViewColumns(self, view_id): """Folderids for `view_id` columns (`view_id` must be a single int)""" return self.intlist('GetViewColumns', view_id) def GetViewTLIs(self, view_id): """Return a list of ``(folder_id, itemlist)`` pairs for `view_id`""" rows = self('GetViewTLIs', view_id) for pos, row in enumerate(rows): rows[pos] = int(row.pop(0)), map(int, row) return rows def GetOpenFiles(self): """Return a list of session IDs for all currently-open files""" self.open() # ensure connect errors propagate try: return self.intlist("GetOpenFiles") except: return [] def CreateView(self, name, folder_ids): assert folder_ids, "Must include at least one folder ID!" return self.intlist('CreateView', name, *folder_ids)[0] def GetFolderAutoAssignRules(self, folder_id): """Get list of strings defining auto-assign rules for `folder_id`""" self.open() # ensure connect errors propagate try: return self('GetFolderAutoAssignRules', folder_id)[0] except: return [] def GetCurrentFile(self): """Return the session id of the active file""" self.open() # ensure connect errors propagate try: return int(self('GetCurrentFile')[0][0]) except: return None def GetFileName(self, session_id): """Return the file name for the given session ID""" return self(format([['GetFileName', session_id]]))[0][0] # --- "DDE Pokes supported" def ChangeFile(self, session_id): """Switch to the designated `session_id`""" if self.GetCurrentFile()!=session_id: # Alas, this poke doesn't always work, at least not in my Ecco... self.poke('ChangeFile', session_id) # So we may have to use OpenFile instead: if self.GetCurrentFile()!=session_id: self.OpenFile(self.GetFileName(session_id)) def CloseFile(self, session_id): """Close the designated session, *without* saving it""" self.assert_session(session_id) self.poke('CloseFile'); self.close() # force re-open for next access def CopyOLEItem(self, item_id):# """Copy the specified OLE item to the Windows clipboard""" self.poke('CopyOLEItem', item_id) def InsertItem(self, anchor_id, items, where=InsertLevel.Indent): """Insert item or items at `anchor_id` w/optional indent `where` should be ``InsertLevel.Indent``, ``InsertLevel.Outdent``, or ``InsertLevel.Same`` (default is ``Indent``). `items` may be a single item id, or a sequence of items. The items are moved to a point relative to `anchor_id`, which may be 0 to indicate that the item(s) are to become top-level. """ if not hasattr(items, '__iter__'): items = [items] self.poke('InsertItem', anchor_id, where, *items) def RemoveItem(self, item_id): """Delete `item_id` (can be an iterable of ids)""" if hasattr(item_id, '__iter__'): self.poke('RemoveItem', *item_id) else: self.poke('RemoveItem', item_id) def SaveFile(self, session_id, pathname=None): """Save the designated session to `pathname`; fails if not current""" self.assert_session(session_id) if pathname: self.poke('SaveFile', pathname) else: self.poke('SaveFile') def SetFolderName(self, folder_id, name): """Set the name of `folder_id` to `name`""" self.poke('SetFolderName', folder_id, name) def SetFolderValues(self, item_ids, folder_ids, values): """Return folder values for specified folders and items `item_ids` can be a single item ID, or a sequence. If it's a sequence, then `values` must be a sequence ordered by the input item ids. `folder_ids` can be a single folder ID, or a sequence. If it's a sequence, the `values` for each item must be a sequence ordered by the input folder ids. If a single item ID and single folder ID are used, then `values` must be a single value. If a single folder ID is used and multiple item IDs, then `values` must be a list of values, one value per item. If multiple folder IDs are used, and only one item ID, then `values` must be a single list containing the values for that one item. In other words, depending on the target, you'll set either a value, a list of values (either different folders for one item, or one folder for different items), or a list of lists of values. """ items, folders = cmd = [[], []] multi_folder = hasattr(folder_ids, '__iter__') multi_item = hasattr(item_ids, '__iter__') if multi_folder: folders.extend(folder_ids) if multi_item: if not hasattr(values, '__len__'): values = list(values) else: values = [values] else: folders.append(folder_ids) if multi_item: values = [[v] for v in values] else: values = [[values]] if multi_item: items.extend(item_ids) else: items.append(item_ids) if len(values)!=len(items): raise ValueError("Length mismatch between item_ids and values") fc = len(folders) for v in values: if not hasattr(v, '__len__'): v = list(v) if len(v)!=fc: raise ValueError("Length mismatch between folder_ids and values") cmd.append(v) if self.connection is None: self.open() self.connection.Poke('SetFolderValues', format(cmd)) def SetItemText(self, item_id, text=None): """Set the text of `item_id` to `text` (or a dictionary of item->text) If `text` is None, `item_id` must be a dictionary mapping item ID's to text values. Otherwise, `item_id` should be a single item ID, and `text` is the text to set. """ if text is None: self.poke('SetItemText', *unfold(item_id.items())) else: self.poke('SetItemText', item_id, text) def ShowPhoneBookItem(self, item_id, only=True): """Show the specified item in the phonebook view Item or one of its parents must be in the Phonebook folder. If `only` is true, the phonebook will show only this item. Otherwise, the item is added to the current list of phonebook items. This also switches to the phonebook view, if it's not already visible. """ self.poke('ShowPhoneBookItem', item_id, int(bool(only))) # --- "Extended DDE Pokes" def ChangeView(self, view_id): """Display the specified view""" self.poke('ChangeView', view_id) def AddCompView(self, view_id): """Add `view_id` as a composite view to the current view""" self.poke('AddCompView', view_id) def RemoveCompView(self, view_id): """Remove the specified view from the current view's composite views""" self.poke('RemoveCompView', view_id) def SetCalDate(self, date): """Display `date` in the calendar (only if calendar is already visible) `date` may be a ``datetime.date`` or ``datetime.datetime`` instance, or any other object with a ``strftime()`` method. Otherwise, it should be a string already formatted to Ecco's date format. """ self.poke('SetCalDate', format_date(date)) def DeleteView(self, view_id): """Delete the specified view (`view_id` must be a single int)""" self.poke('DeleteView', view_id) #AddFileToMenu FilePath IconID def AddColumnToView(self, view_id, folder_id): """Add the specified folder(s) as column(s) of `view_id`""" self.poke_one_or_many('AddColumnToView', folder_id, view_id) def AddFolderToView(self, view_id, folder_id): """Add the specified folder(s) to contents of `view_id`""" self.poke_one_or_many('AddFolderToView', folder_id, view_id) def poke_one_or_many(self, cmd, ob, *args): if hasattr(ob, '__iter__') and not isinstance(ob, basestring): self.poke(cmd, *args+tuple(ob)) else: self.poke(cmd, *args+(ob,)) PK8t߃ ecco_dde.pyc; EBGc @sdkZdkZdkZdkZdkZddddddddd d d d g Zdefd YZdefdYZdefdYZ defdYZ dZ dZ dZ defdYZd efdYZdefdYZdefdYZd efdYZdeifdYZeidedZdefdYZdZdZd Zdefd!YZdS("NsEccoDDEsDDEConnectionErrors StateErrors FileNotOpeneds WrongSessionsItemTypes FolderTypes InsertLevelsOLEModes SelectionTypes format_datesformat_datetimecBstZdZRS(s"Problem connecting to a DDE Server(s__name__s __module__s__doc__(((s!build\bdist.win32\egg\ecco_dde.pysDDEConnectionError s cBstZdZRS(s!Ecco is not in the expected state(s__name__s __module__s__doc__(((s!build\bdist.win32\egg\ecco_dde.pys StateError s cBstZdZRS(s!Ecco didn't open a requested file(s__name__s __module__s__doc__(((s!build\bdist.win32\egg\ecco_dde.pys FileNotOpeneds cBstZdZRS(s"The expected session is not active(s__name__s __module__s__doc__(((s!build\bdist.win32\egg\ecco_dde.pys WrongSessions cCs)t|do|idSn|SdS(Nsstrftimes%Y%m%d(shasattrsdtsstrftime(sdt((s!build\bdist.win32\egg\ecco_dde.pys format_datescCs)t|do|idSn|SdS(Nsstrftimes %Y%m%d%H%M%s(shasattrsdtsstrftime(sdt((s!build\bdist.win32\egg\ecco_dde.pysformat_datetimescCs*dk}|idd|i|iBSdS(Ns README.txts optionflags(sdoctests DocFileSuitesELLIPSISsNORMALIZE_WHITESPACE(sdoctest((s!build\bdist.win32\egg\ecco_dde.pysadditional_tests!s  cBstZdZdZRS(Nii(s__name__s __module__sItemTextsOLE(((s!build\bdist.win32\egg\ecco_dde.pysItemType+scBstZdZdZdZRS(Niii(s__name__s __module__sItemssFolderssNothing(((s!build\bdist.win32\egg\ecco_dde.pys SelectionType0scBs&tZdZdZdZdZdZRS(Niiiii(s__name__s __module__s CheckMarksDatesNumbersTexts PopUpList(((s!build\bdist.win32\egg\ecco_dde.pys FolderType6s cBstZdZdZdZRS(Nsdsass(s__name__s __module__sIndentsOutdentsSame(((s!build\bdist.win32\egg\ecco_dde.pys InsertLevel>scBstZdZdZRS(Nii(s__name__s __module__sLinksEmbed(((s!build\bdist.win32\egg\ecco_dde.pysOLEModeDsseccocBs/tZdZdZeZeZdZe i Z RS(Ns,s"s( s__name__s __module__s delimiters quotecharsTrues doublequotesFalsesskipinitialspaceslineterminatorscsvs QUOTE_MINIMALsquoting(((s!build\bdist.win32\egg\ecco_dde.pyseccoSs cCs)d|jo|idddSndS(Nsii(ssssplit(ss((s!build\bdist.win32\egg\ecco_dde.pyssz]s soutputcBstZdZfZeiZRS(s#StringIO-substitute for csv writing(s__name__s __module__s__doc__s __slots__slistsappendswrite(((s!build\bdist.win32\egg\ecco_dde.pysoutputas cCs5t}ti|di|}di|SdS(Nseccos (soutputsoutscsvswriters writerowssrowssfmtsjoin(srowssfmtsout((s!build\bdist.win32\egg\ecco_dde.pysformatfs cCst|}t||SdS(N(sitersseqszip(sseq((s!build\bdist.win32\egg\ecco_dde.pysfoldks cCs6gi}|D]}|D]}||qq~SdS(N(sappends_[1]sseqsi1si2(sseqs_[1]si1si2((s!build\bdist.win32\egg\ecco_dde.pysunfoldoscBsutZdZdZdZeZeZeZdZ dZ dZ dZ dZ dZd Zd Zed Zed Zeid ZfdZdZddZdZdZdZdZdZdZddZ dZ!dZ"dZ#dZ$dZ%dZ&e'i(efdZ)fd Z*d!Z+ed"Z,d#Z-d$Z.d%Z/d&Z0d'Z1d(Z2d)Z3d*Z4d+Z5d,Z6d-Z7d.Z8d/Z9e:i;d0Z<d1Z=ed2Z>d3Z?d4Z@ed5ZAeBd6ZCd7ZDd8ZEd9ZFd:ZGd;ZHd<ZId=ZJd>ZKRS(?s$A thin wrapper over the Ecco DDE APIii cKsd|i}xT|iD]F\}}t||ot|||nt dt |qWdS(NsNo keyword argument ( sselfs __class__sclsskwsitemssksvshasattrssetattrs TypeErrorsrepr(sselfskwsvskscls((s!build\bdist.win32\egg\ecco_dde.pys__init__s   cCsK|itj o t|_n|itj o|iit|_ndS(s6Disconnect the DDE connection and shut down the serverN(sselfs connectionsNonesserversShutdown(sself((s!build\bdist.win32\egg\ecco_dde.pyscloses   cCs'|i|jotdndS(s3Raise an error if active session is not `sessionId`s)Attempt to close or save inactive sessionN(sselfsGetCurrentFiles session_ids StateError(sselfs session_id((s!build\bdist.win32\egg\ecco_dde.pysassert_sessionscCsK|ix:to2|i}|tjodSn|i|q WdS(sAttempt to close all open filesN(sselfsopensTruesGetCurrentFilessessionsNones CloseFile(sselfssession((s!build\bdist.win32\egg\ecco_dde.pys close_alls   c Cs|itj odSndk}dk}dk} dk} |itjo#| i|_|ii dnt }xat |i dD]@}yC|idd| i|i}|idd||_dSWn| ij o)}|idddfjoqWnLti\} }} | |fdd fjo~ ~~ t}qWnX|oti|iq|itjo1dk}|i|i d i!d d |_nt"i#|it$}qWt%d dS( Nsclientis MauiFramesEccois FindWindows*The system cannot find the file specified.serrorsConnectTo faileds$NetManage EccoPro\shell\open\commands %1s(&sselfs connectionsNoneswin32uiswin32guisddes pywintypessservers CreateServersCreatesFalses attemptedsrangesretriessis FindWindowsCreateConversationsconns ConnectToserrorsesargsssyssexc_infostsvstbstimessleepsfilenames_winregs QueryValuesHKEY_CLASSES_ROOTsreplacesoss startfilesTruesDDEConnectionError( sselfsis attemptedswin32uis_winregsconnswin32guisvses pywintypesstbsddest((s!build\bdist.win32\egg\ecco_dde.pysopens@$      cGs|ot|f|g}n"t|t ot|}n|itjo|int |djo,|ii |t |ii d}nt |ii |}|iddiddid}tti|SdS(sSend `cmd` and `args` to Ecco via DDE 'request' or 'execute' If `args` are supplied or `cmd` is a string, a one-line csv-formatted request is sent. If `cmd` is not a string, it must be an iterable of sequences, which will then be turned into a csv-formatted string. If the resulting command is more than 250 characters long, a DDE 'exec' will be used instead of a 'request'. In either case, the result is parsed from csv into a list of lists of strings, and then returned. is GetLastResults s s N(sargssformatscmds isinstances basestringsselfs connectionsNonesopenslensExecsszsRequestsdatasreplacessplitslistscsvsreader(sselfscmdsargssdata((s!build\bdist.win32\egg\ecco_dde.pys__call__s 'cGsR|o t|gpd}|itjo|in|ii||dS(s?Just like __call__(), but send a DDE poke, with no return valuesN( sargssformatsdatasselfs connectionsNonesopensPokescmd(sselfscmdsargssdata((s!build\bdist.win32\egg\ecco_dde.pyspokes cGstt||dSdS(Ni(smapsintsselfscmd(sselfscmd((s!build\bdist.win32\egg\ecco_dde.pysintlistscCs^t|dot|t ot||||dSn||||ddSdS(Ns__iter__i(shasattrsobs isinstances basestringsmapscvtsselfscmd(sselfscmdsobscvt((s!build\bdist.win32\egg\ecco_dde.pys one_or_manys!cCszt|dot|t o;gi}|||D]}|t ||q8~Snt ||||dSdS(Ns__iter__i( shasattrsobs isinstances basestringsappends_[1]sselfscmdsrowsmapscvt(sselfscmdsobscvts_[1]srow((s!build\bdist.win32\egg\ecco_dde.pysone_or_many_to_manys!;c Cst|to|id||dSn|i}t||idtgi }|D]\}}|||fqW~}t gi }|D]"\\}}}|||fq~SdS(saCreate folders for a name or a dictionary mapping names to types If `name_or_dict` is a string, create a folder of `folder_type` and return a folder id. Otherwise, `name_or_dict` should be a dictionary (or other object with an ``.items()`` method), and a dictionary mapping names to folder ids will be returned. s CreateFolderiN(s isinstances name_or_dicts basestringsselfsintlists folder_typesitemsszipsunfoldsappends_[1]sisjsdictskst( sselfs name_or_dicts folder_typesitemssjs_[1]sistsk((s!build\bdist.win32\egg\ecco_dde.pys CreateFolders HcCs!|id|t|dSdS(sCreate `item` (text) with optional data, returning new item id `data`, if supplied, should be a sequence of ``(folderid,value)`` pairs for the item to be initialized with. s CreateItemiN(sselfsintlistsitemsunfoldsdata(sselfsitemsdata((s!build\bdist.win32\egg\ecco_dde.pys CreateItemscCs|id|SdS(s7Return a list of folder ids for folders matching `name`sGetFoldersByNameN(sselfsintlistsname(sselfsname((s!build\bdist.win32\egg\ecco_dde.pysGetFoldersByNamesicCs|id|SdS(s;Return a list of folder ids whose types equal `folder_type`sGetFoldersByTypeN(sselfsintlists folder_type(sselfs folder_type((s!build\bdist.win32\egg\ecco_dde.pysGetFoldersByTypescGs|id||SdS(sGet the items for `folder_id`, w/optional sorting and criteria Examples:: # Sort by value, descending: GetFolderItems(id, 'vd') # Sort by item text, ascending, if the folder value>26: GetFolderItems(id, 'ia', 'GT', 26) # No sort, item text contains 'foo' GetFolderItems(id, 'IC', 'foo') See the Ecco API documentation for the full list of supported operators. sGetFolderItemsN(sselfsintlists folder_idsextra(sselfs folder_idsextra((s!build\bdist.win32\egg\ecco_dde.pysGetFolderItems scCs|id|tSdS(s>Name for `folder_id` (or a list of names if id is an iterable)s GetFolderNameN(sselfs one_or_manys folder_idsstr(sselfs folder_id((s!build\bdist.win32\egg\ecco_dde.pys GetFolderName3scCs|id|SdS(s>Type for `folder_id` (or a list of types if id is an iterable)s GetFolderTypeN(sselfs one_or_manys folder_id(sselfs folder_id((s!build\bdist.win32\egg\ecco_dde.pys GetFolderType7sc Csdggg}xQt||g|D]:\}}t|do|i|q%|i|q%W||}t|d o8x5t |D]#\}}|pdf\|| [(child_id,indent), ... ]s GetItemSubsN(sfoldsselfsintlistsdepthsitem_id(sselfsitem_idsdepth((s!build\bdist.win32\egg\ecco_dde.pys GetItemSubsscCs|id|tSdS(s>Text for `item_id` (or a list of strings if id is an iterable)s GetItemTextN(sselfs one_or_manysitem_idsstr(sselfsitem_id((s!build\bdist.win32\egg\ecco_dde.pys GetItemTextscCs|id|SdS(s<Type for `item_id` (or a list of types if id is an iterable)s GetItemTypeN(sselfs one_or_manysitem_id(sselfsitem_id((s!build\bdist.win32\egg\ecco_dde.pys GetItemTypescCsPgi}|dD]}|tt|q~}|dd|d<|SdS(s9Returns a list: [ type (1=items, 2=folders), selectedIds]s GetSelectioniN(sappends_[1]sselfslinesmapsintsres(sselfsress_[1]sline((s!build\bdist.win32\egg\ecco_dde.pys GetSelections6cCs|idSdS(s@Return the Ecco API protocol version triple (major, minor, rev#)s GetVersionN(sselfsintlist(sself((s!build\bdist.win32\egg\ecco_dde.pys GetVersionscCs)tidt|dddSdS(s4Create a new 'Untitled' file, returning a session idf0.01sNewFileiN(stimessleepsintsself(sself((s!build\bdist.win32\egg\ecco_dde.pysNewFiles cCs]|td|ggd}|ot|dpd}| ot|n|SdS(sOpen or switch to `pathname` and return a session ID If the named file was not actually opened (not found, corrupt, etc.), a ``ecco_dde.FileNotOpened`` error will be raised instead. sOpenFileiN(sselfsformatspathnamesresultsints FileNotOpened(sselfspathnamesresult((s!build\bdist.win32\egg\ecco_dde.pysOpenFiles cCsB|tjo d}nt|d||t|ddSdS(s]Paste from the clipboard, returning an item id If `item_id` is not None, the paste will go into that item. `mode` should be ``OLEMode.Link`` or ``OLEMode.Embed`` (the default). `data`, if supplied, should be a sequence of ``(folderid,value)`` pairs for the item to be initialized or updated with. ss PasteOleItemiN(sitem_idsNonesintsselfsmodesunfoldsdata(sselfsmodesitem_idsdata((s!build\bdist.win32\egg\ecco_dde.pys PasteOLEItems cCsU|d||ggg}t|ddtt|dtt|dfSdS(sGet changes since `timestamp`, optionally restricted to `folder_ids` `timestamp` is an opaque value from Ecco itself, supplied as part of the return value from this method. If `folder_ids` is supplied, only changes to those folders and the items in them are included. Returns a triple of ``(nextstamp, items, folders)``, where ``nextstamp`` is the value that should be passed in to the next call to ``GetChanges()``, ``items`` is a list of items with changed text or folder values, and ``folders`` is a list of folders that have had items removed. Note that due to the way Ecco processes change timestamps, not all listed items or folders may have actually changed since your last call to this method. s GetChangesiiiN(sselfs timestamps folder_idssdatasintsmap(sselfs timestamps folder_idssdata((s!build\bdist.win32\egg\ecco_dde.pys GetChangess cCs|idSdS(s=Return a list of the view ids of all views in current sessionsGetViewsN(sselfsintlist(sself((s!build\bdist.win32\egg\ecco_dde.pysGetViewsscCsM|tjo)|id}t|i||Sn|id|tSdS(sXReturn one or more view names If `view_id` is an iterable, this returns a list of view names for the corresponding view ids. If `view_id` is ``None`` or not given, this returns a list of ``(name, id)`` pairs for all views in the current session. Otherwise, the name of the specified view is returned. sGetViewss GetViewNamesN( sview_idsNonesselfsintlistsviewsszips GetViewNamess one_or_manysstr(sselfsview_idsviews((s!build\bdist.win32\egg\ecco_dde.pys GetViewNamess  cCs|id|SdS(s@Folder ids for `view_id` (or list of lists if id is an iterable)sGetViewFoldersN(sselfsone_or_many_to_manysview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pysGetViewFoldersscCs|id|tSdS(sAPopup values for `folder_id` (or list of lists if id is iterable)sGetPopupValuesN(sselfsone_or_many_to_manys folder_idsstr(sselfs folder_id((s!build\bdist.win32\egg\ecco_dde.pysGetPopupValuesscCst|idSdS(sAReturn a list of ``(folderid, depth)`` pairs for the current filesGetFolderOutlineN(sfoldsselfsintlist(sself((s!build\bdist.win32\egg\ecco_dde.pysGetFolderOutlinescCs|id|SdS(s@Folderids for `view_id` columns (`view_id` must be a single int)sGetViewColumnsN(sselfsintlistsview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pysGetViewColumnsscCs\|d|}xBt|D]4\}}t|idtt|f||Return a list of ``(folder_id, itemlist)`` pairs for `view_id`s GetViewTLIsiN( sselfsview_idsrowss enumeratespossrowsintspopsmap(sselfsview_idsrowsspossrow((s!build\bdist.win32\egg\ecco_dde.pys GetViewTLIss  ,cCs-|iy|idSWn gSnXdS(s9Return a list of session IDs for all currently-open filess GetOpenFilesN(sselfsopensintlist(sself((s!build\bdist.win32\egg\ecco_dde.pys GetOpenFiless  cCs,|p td|id||dSdS(Ns$Must include at least one folder ID!s CreateViewi(s folder_idssAssertionErrorsselfsintlistsname(sselfsnames folder_ids((s!build\bdist.win32\egg\ecco_dde.pys CreateViewscCs1|iy|d|dSWn gSnXdS(s>Get list of strings defining auto-assign rules for `folder_id`sGetFolderAutoAssignRulesiN(sselfsopens folder_id(sselfs folder_id((s!build\bdist.win32\egg\ecco_dde.pysGetFolderAutoAssignRules s  cCs8|iyt|dddSWn tSnXdS(s(Return the session id of the active filesGetCurrentFileiN(sselfsopensintsNone(sself((s!build\bdist.win32\egg\ecco_dde.pysGetCurrentFiles  cCs%|td|ggddSdS(s-Return the file name for the given session IDs GetFileNameiN(sselfsformats session_id(sselfs session_id((s!build\bdist.win32\egg\ecco_dde.pys GetFileNamescCsX|i|joA|id||i|jo|i|i|qTndS(s%Switch to the designated `session_id`s ChangeFileN(sselfsGetCurrentFiles session_idspokesOpenFiles GetFileName(sselfs session_id((s!build\bdist.win32\egg\ecco_dde.pys ChangeFiles cCs(|i||id|idS(s1Close the designated session, *without* saving its CloseFileN(sselfsassert_sessions session_idspokesclose(sselfs session_id((s!build\bdist.win32\egg\ecco_dde.pys CloseFile%s cCs|id|dS(s4Copy the specified OLE item to the Windows clipboards CopyOLEItemN(sselfspokesitem_id(sselfsitem_id((s!build\bdist.win32\egg\ecco_dde.pys CopyOLEItem*scCs8t|d o |g}n|id|||dS(sInsert item or items at `anchor_id` w/optional indent `where` should be ``InsertLevel.Indent``, ``InsertLevel.Outdent``, or ``InsertLevel.Same`` (default is ``Indent``). `items` may be a single item id, or a sequence of items. The items are moved to a point relative to `anchor_id`, which may be 0 to indicate that the item(s) are to become top-level. s__iter__s InsertItemN(shasattrsitemssselfspokes anchor_idswhere(sselfs anchor_idsitemsswhere((s!build\bdist.win32\egg\ecco_dde.pys InsertItem.s cCs8t|do|id|n|id|dS(s,Delete `item_id` (can be an iterable of ids)s__iter__s RemoveItemN(shasattrsitem_idsselfspoke(sselfsitem_id((s!build\bdist.win32\egg\ecco_dde.pys RemoveItem?scCs9|i||o|id|n|iddS(s?Save the designated session to `pathname`; fails if not currentsSaveFileN(sselfsassert_sessions session_idspathnamespoke(sselfs session_idspathname((s!build\bdist.win32\egg\ecco_dde.pysSaveFileFs  cCs|id||dS(s%Set the name of `folder_id` to `name`s SetFolderNameN(sselfspokes folder_idsname(sselfs folder_idsname((s!build\bdist.win32\egg\ecco_dde.pys SetFolderNameNsc Csggg\}}}t|d}t|d} |oF|i|| o%t|d ot |}q}q|g}nO|i || o.gi }|D]} || gq~}n |gg}| o|i|n|i |t|t|jotdnt|} x_|D]W} t| d ot | } nt| | jotdn|i | q0W|itjo|in|iidt|dS(sReturn folder values for specified folders and items `item_ids` can be a single item ID, or a sequence. If it's a sequence, then `values` must be a sequence ordered by the input item ids. `folder_ids` can be a single folder ID, or a sequence. If it's a sequence, the `values` for each item must be a sequence ordered by the input folder ids. If a single item ID and single folder ID are used, then `values` must be a single value. If a single folder ID is used and multiple item IDs, then `values` must be a list of values, one value per item. If multiple folder IDs are used, and only one item ID, then `values` must be a single list containing the values for that one item. In other words, depending on the target, you'll set either a value, a list of values (either different folders for one item, or one folder for different items), or a list of lists of values. s__iter__s__len__s+Length mismatch between item_ids and valuess-Length mismatch between folder_ids and valuessSetFolderValuesN(sitemssfoldersscmdshasattrs folder_idss multi_foldersitem_idss multi_itemsextendsvaluesslistsappends_[1]svslens ValueErrorsfcsselfs connectionsNonesopensPokesformat( sselfsitem_idss folder_idssvaluessfolderss multi_foldersitemsscmds_[1]sfcsvs multi_item((s!build\bdist.win32\egg\ecco_dde.pysSetFolderValuesSs<   .   cCsD|tjo |idt|in|id||dS(s Set the text of `item_id` to `text` (or a dictionary of item->text) If `text` is None, `item_id` must be a dictionary mapping item ID's to text values. Otherwise, `item_id` should be a single item ID, and `text` is the text to set. s SetItemTextN(stextsNonesselfspokesunfoldsitem_idsitems(sselfsitem_idstext((s!build\bdist.win32\egg\ecco_dde.pys SetItemTexts  cCs#|id|tt|dS(s]Show the specified item in the phonebook view Item or one of its parents must be in the Phonebook folder. If `only` is true, the phonebook will show only this item. Otherwise, the item is added to the current list of phonebook items. This also switches to the phonebook view, if it's not already visible. sShowPhoneBookItemN(sselfspokesitem_idsintsboolsonly(sselfsitem_idsonly((s!build\bdist.win32\egg\ecco_dde.pysShowPhoneBookItemscCs|id|dS(sDisplay the specified views ChangeViewN(sselfspokesview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pys ChangeViewscCs|id|dS(s5Add `view_id` as a composite view to the current views AddCompViewN(sselfspokesview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pys AddCompViewscCs|id|dS(sARemove the specified view from the current view's composite viewssRemoveCompViewN(sselfspokesview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pysRemoveCompViewscCs|idt|dS(s(Display `date` in the calendar (only if calendar is already visible) `date` may be a ``datetime.date`` or ``datetime.datetime`` instance, or any other object with a ``strftime()`` method. Otherwise, it should be a string already formatted to Ecco's date format. s SetCalDateN(sselfspokes format_datesdate(sselfsdate((s!build\bdist.win32\egg\ecco_dde.pys SetCalDatescCs|id|dS(s:Delete the specified view (`view_id` must be a single int)s DeleteViewN(sselfspokesview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pys DeleteViewscCs|id||dS(s5Add the specified folder(s) as column(s) of `view_id`sAddColumnToViewN(sselfspoke_one_or_manys folder_idsview_id(sselfsview_ids folder_id((s!build\bdist.win32\egg\ecco_dde.pysAddColumnToViewscCs|id||dS(s4Add the specified folder(s) to contents of `view_id`sAddFolderToViewN(sselfspoke_one_or_manys folder_idsview_id(sselfsview_ids folder_id((s!build\bdist.win32\egg\ecco_dde.pysAddFolderToViewscGsZt|dot|t o|i||t|n|i|||fdS(Ns__iter__( shasattrsobs isinstances basestringsselfspokescmdsargsstuple(sselfscmdsobsargs((s!build\bdist.win32\egg\ecco_dde.pyspoke_one_or_manys!(Ls__name__s __module__s__doc__ssleepsretriessNonesfilenames connectionsservers__init__sclosesassert_sessions close_allsopens__call__spokesintlistsints one_or_manysone_or_many_to_manys FolderTypes CheckMarks CreateFolders CreateItemsGetFoldersByNamesGetFoldersByTypesGetFolderItemss GetFolderNames GetFolderTypesGetFolderValuessGetItemFolderssGetItemParentss GetItemSubss GetItemTexts GetItemTypes GetSelections GetVersionsNewFilesOpenFilesOLEModesEmbeds PasteOLEItems GetChangessGetViewss GetViewNamessGetViewFolderssGetPopupValuessGetFolderOutlinesGetViewColumnss GetViewTLIss GetOpenFiless CreateViewsGetFolderAutoAssignRulessGetCurrentFiles GetFileNames ChangeFiles CloseFiles CopyOLEItems InsertLevelsIndents InsertItems RemoveItemsSaveFiles SetFolderNamesSetFolderValuess SetItemTextsTruesShowPhoneBookItems ChangeViews AddCompViewsRemoveCompViews SetCalDates DeleteViewsAddColumnToViewsAddFolderToViewspoke_one_or_many(((s!build\bdist.win32\egg\ecco_dde.pysEccoDDE|s    )            )                            >      (sosssysstimescsvsdatetimes__all__s ExceptionsDDEConnectionErrors StateErrors FileNotOpeneds WrongSessions format_datesformat_datetimesadditional_testssobjectsItemTypes SelectionTypes FolderTypes InsertLevelsOLEModesDialectseccosregister_dialectsszslistsoutputsformatsfoldsunfoldsEccoDDE(s SelectionTypesEccoDDEsadditional_testssdatetimesfolds InsertLevelsItemTypes__all__soutputs FileNotOpenedscsvs FolderTypesformatssyss WrongSessionsunfoldsDDEConnectionErrors format_datesszsformat_datetimes StateErrorstimesOLEModesossecco((s!build\bdist.win32\egg\ecco_dde.pys?s*-*       PK86scBstZdZdZRS(Nii(s__name__s __module__sLinksEmbed(((s!build\bdist.win32\egg\ecco_dde.pysOLEModeDsseccocBs/tZdZdZeZeZdZe i Z RS(Ns,s"s( s__name__s __module__s delimiters quotecharsTrues doublequotesFalsesskipinitialspaceslineterminatorscsvs QUOTE_MINIMALsquoting(((s!build\bdist.win32\egg\ecco_dde.pyseccoSs cCs)d|jo|idddSndS(Nsii(ssssplit(ss((s!build\bdist.win32\egg\ecco_dde.pyssz]s soutputcBstZdZfZeiZRS(s#StringIO-substitute for csv writing(s__name__s __module__s__doc__s __slots__slistsappendswrite(((s!build\bdist.win32\egg\ecco_dde.pysoutputas cCs5t}ti|di|}di|SdS(Nseccos (soutputsoutscsvswriters writerowssrowssfmtsjoin(srowssfmtsout((s!build\bdist.win32\egg\ecco_dde.pysformatfs cCst|}t||SdS(N(sitersseqszip(sseq((s!build\bdist.win32\egg\ecco_dde.pysfoldks cCs6gi}|D]}|D]}||qq~SdS(N(sappends_[1]sseqsi1si2(sseqs_[1]si1si2((s!build\bdist.win32\egg\ecco_dde.pysunfoldoscBsutZdZdZdZeZeZeZdZ dZ dZ dZ dZ dZd Zd Zed Zed Zeid ZfdZdZddZdZdZdZdZdZdZddZ dZ!dZ"dZ#dZ$dZ%dZ&e'i(efdZ)fd Z*d!Z+ed"Z,d#Z-d$Z.d%Z/d&Z0d'Z1d(Z2d)Z3d*Z4d+Z5d,Z6d-Z7d.Z8d/Z9e:i;d0Z<d1Z=ed2Z>d3Z?d4Z@ed5ZAeBd6ZCd7ZDd8ZEd9ZFd:ZGd;ZHd<ZId=ZJd>ZKRS(?s$A thin wrapper over the Ecco DDE APIii cKsd|i}xT|iD]F\}}t||ot|||nt dt |qWdS(NsNo keyword argument ( sselfs __class__sclsskwsitemssksvshasattrssetattrs TypeErrorsrepr(sselfskwsvskscls((s!build\bdist.win32\egg\ecco_dde.pys__init__s   cCsK|itj o t|_n|itj o|iit|_ndS(s6Disconnect the DDE connection and shut down the serverN(sselfs connectionsNonesserversShutdown(sself((s!build\bdist.win32\egg\ecco_dde.pyscloses   cCs'|i|jotdndS(s3Raise an error if active session is not `sessionId`s)Attempt to close or save inactive sessionN(sselfsGetCurrentFiles session_ids StateError(sselfs session_id((s!build\bdist.win32\egg\ecco_dde.pysassert_sessionscCsK|ix:to2|i}|tjodSn|i|q WdS(sAttempt to close all open filesN(sselfsopensTruesGetCurrentFilessessionsNones CloseFile(sselfssession((s!build\bdist.win32\egg\ecco_dde.pys close_alls   c Cs|itj odSndk}dk}dk} dk} |itjo#| i|_|ii dnt }xat |i dD]@}yC|idd| i|i}|idd||_dSWn| ij o)}|idddfjoqWnLti\} }} | |fdd fjo~ ~~ t}qWnX|oti|iq|itjo1dk}|i|i d i!d d |_nt"i#|it$}qWt%d dS( Nsclientis MauiFramesEccois FindWindows*The system cannot find the file specified.serrorsConnectTo faileds$NetManage EccoPro\shell\open\commands %1s(&sselfs connectionsNoneswin32uiswin32guisddes pywintypessservers CreateServersCreatesFalses attemptedsrangesretriessis FindWindowsCreateConversationsconns ConnectToserrorsesargsssyssexc_infostsvstbstimessleepsfilenames_winregs QueryValuesHKEY_CLASSES_ROOTsreplacesoss startfilesTruesDDEConnectionError( sselfsis attemptedswin32uis_winregsconnswin32guisvses pywintypesstbsddest((s!build\bdist.win32\egg\ecco_dde.pysopens@$      cGs|ot|f|g}n"t|t ot|}n|itjo|int |djo,|ii |t |ii d}nt |ii |}|iddiddid}tti|SdS(sSend `cmd` and `args` to Ecco via DDE 'request' or 'execute' If `args` are supplied or `cmd` is a string, a one-line csv-formatted request is sent. If `cmd` is not a string, it must be an iterable of sequences, which will then be turned into a csv-formatted string. If the resulting command is more than 250 characters long, a DDE 'exec' will be used instead of a 'request'. In either case, the result is parsed from csv into a list of lists of strings, and then returned. is GetLastResults s s N(sargssformatscmds isinstances basestringsselfs connectionsNonesopenslensExecsszsRequestsdatasreplacessplitslistscsvsreader(sselfscmdsargssdata((s!build\bdist.win32\egg\ecco_dde.pys__call__s 'cGsR|o t|gpd}|itjo|in|ii||dS(s?Just like __call__(), but send a DDE poke, with no return valuesN( sargssformatsdatasselfs connectionsNonesopensPokescmd(sselfscmdsargssdata((s!build\bdist.win32\egg\ecco_dde.pyspokes cGstt||dSdS(Ni(smapsintsselfscmd(sselfscmd((s!build\bdist.win32\egg\ecco_dde.pysintlistscCs^t|dot|t ot||||dSn||||ddSdS(Ns__iter__i(shasattrsobs isinstances basestringsmapscvtsselfscmd(sselfscmdsobscvt((s!build\bdist.win32\egg\ecco_dde.pys one_or_manys!cCszt|dot|t o;gi}|||D]}|t ||q8~Snt ||||dSdS(Ns__iter__i( shasattrsobs isinstances basestringsappends_[1]sselfscmdsrowsmapscvt(sselfscmdsobscvts_[1]srow((s!build\bdist.win32\egg\ecco_dde.pysone_or_many_to_manys!;c Cst|to|id||dSn|i}t||idtgi }|D]\}}|||fqW~}t gi }|D]"\\}}}|||fq~SdS(saCreate folders for a name or a dictionary mapping names to types If `name_or_dict` is a string, create a folder of `folder_type` and return a folder id. Otherwise, `name_or_dict` should be a dictionary (or other object with an ``.items()`` method), and a dictionary mapping names to folder ids will be returned. s CreateFolderiN(s isinstances name_or_dicts basestringsselfsintlists folder_typesitemsszipsunfoldsappends_[1]sisjsdictskst( sselfs name_or_dicts folder_typesitemssjs_[1]sistsk((s!build\bdist.win32\egg\ecco_dde.pys CreateFolders HcCs!|id|t|dSdS(sCreate `item` (text) with optional data, returning new item id `data`, if supplied, should be a sequence of ``(folderid,value)`` pairs for the item to be initialized with. s CreateItemiN(sselfsintlistsitemsunfoldsdata(sselfsitemsdata((s!build\bdist.win32\egg\ecco_dde.pys CreateItemscCs|id|SdS(s7Return a list of folder ids for folders matching `name`sGetFoldersByNameN(sselfsintlistsname(sselfsname((s!build\bdist.win32\egg\ecco_dde.pysGetFoldersByNamesicCs|id|SdS(s;Return a list of folder ids whose types equal `folder_type`sGetFoldersByTypeN(sselfsintlists folder_type(sselfs folder_type((s!build\bdist.win32\egg\ecco_dde.pysGetFoldersByTypescGs|id||SdS(sGet the items for `folder_id`, w/optional sorting and criteria Examples:: # Sort by value, descending: GetFolderItems(id, 'vd') # Sort by item text, ascending, if the folder value>26: GetFolderItems(id, 'ia', 'GT', 26) # No sort, item text contains 'foo' GetFolderItems(id, 'IC', 'foo') See the Ecco API documentation for the full list of supported operators. sGetFolderItemsN(sselfsintlists folder_idsextra(sselfs folder_idsextra((s!build\bdist.win32\egg\ecco_dde.pysGetFolderItems scCs|id|tSdS(s>Name for `folder_id` (or a list of names if id is an iterable)s GetFolderNameN(sselfs one_or_manys folder_idsstr(sselfs folder_id((s!build\bdist.win32\egg\ecco_dde.pys GetFolderName3scCs|id|SdS(s>Type for `folder_id` (or a list of types if id is an iterable)s GetFolderTypeN(sselfs one_or_manys folder_id(sselfs folder_id((s!build\bdist.win32\egg\ecco_dde.pys GetFolderType7sc Csdggg}xQt||g|D]:\}}t|do|i|q%|i|q%W||}t|d o8x5t |D]#\}}|pdf\|| [(child_id,indent), ... ]s GetItemSubsN(sfoldsselfsintlistsdepthsitem_id(sselfsitem_idsdepth((s!build\bdist.win32\egg\ecco_dde.pys GetItemSubsscCs|id|tSdS(s>Text for `item_id` (or a list of strings if id is an iterable)s GetItemTextN(sselfs one_or_manysitem_idsstr(sselfsitem_id((s!build\bdist.win32\egg\ecco_dde.pys GetItemTextscCs|id|SdS(s<Type for `item_id` (or a list of types if id is an iterable)s GetItemTypeN(sselfs one_or_manysitem_id(sselfsitem_id((s!build\bdist.win32\egg\ecco_dde.pys GetItemTypescCsPgi}|dD]}|tt|q~}|dd|d<|SdS(s9Returns a list: [ type (1=items, 2=folders), selectedIds]s GetSelectioniN(sappends_[1]sselfslinesmapsintsres(sselfsress_[1]sline((s!build\bdist.win32\egg\ecco_dde.pys GetSelections6cCs|idSdS(s@Return the Ecco API protocol version triple (major, minor, rev#)s GetVersionN(sselfsintlist(sself((s!build\bdist.win32\egg\ecco_dde.pys GetVersionscCs)tidt|dddSdS(s4Create a new 'Untitled' file, returning a session idf0.01sNewFileiN(stimessleepsintsself(sself((s!build\bdist.win32\egg\ecco_dde.pysNewFiles cCs]|td|ggd}|ot|dpd}| ot|n|SdS(sOpen or switch to `pathname` and return a session ID If the named file was not actually opened (not found, corrupt, etc.), a ``ecco_dde.FileNotOpened`` error will be raised instead. sOpenFileiN(sselfsformatspathnamesresultsints FileNotOpened(sselfspathnamesresult((s!build\bdist.win32\egg\ecco_dde.pysOpenFiles cCsB|tjo d}nt|d||t|ddSdS(s]Paste from the clipboard, returning an item id If `item_id` is not None, the paste will go into that item. `mode` should be ``OLEMode.Link`` or ``OLEMode.Embed`` (the default). `data`, if supplied, should be a sequence of ``(folderid,value)`` pairs for the item to be initialized or updated with. ss PasteOleItemiN(sitem_idsNonesintsselfsmodesunfoldsdata(sselfsmodesitem_idsdata((s!build\bdist.win32\egg\ecco_dde.pys PasteOLEItems cCsU|d||ggg}t|ddtt|dtt|dfSdS(sGet changes since `timestamp`, optionally restricted to `folder_ids` `timestamp` is an opaque value from Ecco itself, supplied as part of the return value from this method. If `folder_ids` is supplied, only changes to those folders and the items in them are included. Returns a triple of ``(nextstamp, items, folders)``, where ``nextstamp`` is the value that should be passed in to the next call to ``GetChanges()``, ``items`` is a list of items with changed text or folder values, and ``folders`` is a list of folders that have had items removed. Note that due to the way Ecco processes change timestamps, not all listed items or folders may have actually changed since your last call to this method. s GetChangesiiiN(sselfs timestamps folder_idssdatasintsmap(sselfs timestamps folder_idssdata((s!build\bdist.win32\egg\ecco_dde.pys GetChangess cCs|idSdS(s=Return a list of the view ids of all views in current sessionsGetViewsN(sselfsintlist(sself((s!build\bdist.win32\egg\ecco_dde.pysGetViewsscCsM|tjo)|id}t|i||Sn|id|tSdS(sXReturn one or more view names If `view_id` is an iterable, this returns a list of view names for the corresponding view ids. If `view_id` is ``None`` or not given, this returns a list of ``(name, id)`` pairs for all views in the current session. Otherwise, the name of the specified view is returned. sGetViewss GetViewNamesN( sview_idsNonesselfsintlistsviewsszips GetViewNamess one_or_manysstr(sselfsview_idsviews((s!build\bdist.win32\egg\ecco_dde.pys GetViewNamess  cCs|id|SdS(s@Folder ids for `view_id` (or list of lists if id is an iterable)sGetViewFoldersN(sselfsone_or_many_to_manysview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pysGetViewFoldersscCs|id|tSdS(sAPopup values for `folder_id` (or list of lists if id is iterable)sGetPopupValuesN(sselfsone_or_many_to_manys folder_idsstr(sselfs folder_id((s!build\bdist.win32\egg\ecco_dde.pysGetPopupValuesscCst|idSdS(sAReturn a list of ``(folderid, depth)`` pairs for the current filesGetFolderOutlineN(sfoldsselfsintlist(sself((s!build\bdist.win32\egg\ecco_dde.pysGetFolderOutlinescCs|id|SdS(s@Folderids for `view_id` columns (`view_id` must be a single int)sGetViewColumnsN(sselfsintlistsview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pysGetViewColumnsscCs\|d|}xBt|D]4\}}t|idtt|f||Return a list of ``(folder_id, itemlist)`` pairs for `view_id`s GetViewTLIsiN( sselfsview_idsrowss enumeratespossrowsintspopsmap(sselfsview_idsrowsspossrow((s!build\bdist.win32\egg\ecco_dde.pys GetViewTLIss  ,cCs-|iy|idSWn gSnXdS(s9Return a list of session IDs for all currently-open filess GetOpenFilesN(sselfsopensintlist(sself((s!build\bdist.win32\egg\ecco_dde.pys GetOpenFiless  cCs|id||dSdS(Ns CreateViewi(sselfsintlistsnames folder_ids(sselfsnames folder_ids((s!build\bdist.win32\egg\ecco_dde.pys CreateViewscCs1|iy|d|dSWn gSnXdS(s>Get list of strings defining auto-assign rules for `folder_id`sGetFolderAutoAssignRulesiN(sselfsopens folder_id(sselfs folder_id((s!build\bdist.win32\egg\ecco_dde.pysGetFolderAutoAssignRules s  cCs8|iyt|dddSWn tSnXdS(s(Return the session id of the active filesGetCurrentFileiN(sselfsopensintsNone(sself((s!build\bdist.win32\egg\ecco_dde.pysGetCurrentFiles  cCs%|td|ggddSdS(s-Return the file name for the given session IDs GetFileNameiN(sselfsformats session_id(sselfs session_id((s!build\bdist.win32\egg\ecco_dde.pys GetFileNamescCsX|i|joA|id||i|jo|i|i|qTndS(s%Switch to the designated `session_id`s ChangeFileN(sselfsGetCurrentFiles session_idspokesOpenFiles GetFileName(sselfs session_id((s!build\bdist.win32\egg\ecco_dde.pys ChangeFiles cCs(|i||id|idS(s1Close the designated session, *without* saving its CloseFileN(sselfsassert_sessions session_idspokesclose(sselfs session_id((s!build\bdist.win32\egg\ecco_dde.pys CloseFile%s cCs|id|dS(s4Copy the specified OLE item to the Windows clipboards CopyOLEItemN(sselfspokesitem_id(sselfsitem_id((s!build\bdist.win32\egg\ecco_dde.pys CopyOLEItem*scCs8t|d o |g}n|id|||dS(sInsert item or items at `anchor_id` w/optional indent `where` should be ``InsertLevel.Indent``, ``InsertLevel.Outdent``, or ``InsertLevel.Same`` (default is ``Indent``). `items` may be a single item id, or a sequence of items. The items are moved to a point relative to `anchor_id`, which may be 0 to indicate that the item(s) are to become top-level. s__iter__s InsertItemN(shasattrsitemssselfspokes anchor_idswhere(sselfs anchor_idsitemsswhere((s!build\bdist.win32\egg\ecco_dde.pys InsertItem.s cCs8t|do|id|n|id|dS(s,Delete `item_id` (can be an iterable of ids)s__iter__s RemoveItemN(shasattrsitem_idsselfspoke(sselfsitem_id((s!build\bdist.win32\egg\ecco_dde.pys RemoveItem?scCs9|i||o|id|n|iddS(s?Save the designated session to `pathname`; fails if not currentsSaveFileN(sselfsassert_sessions session_idspathnamespoke(sselfs session_idspathname((s!build\bdist.win32\egg\ecco_dde.pysSaveFileFs  cCs|id||dS(s%Set the name of `folder_id` to `name`s SetFolderNameN(sselfspokes folder_idsname(sselfs folder_idsname((s!build\bdist.win32\egg\ecco_dde.pys SetFolderNameNsc Csggg\}}}t|d}t|d} |oF|i|| o%t|d ot |}q}q|g}nO|i || o.gi }|D]} || gq~}n |gg}| o|i|n|i |t|t|jotdnt|} x_|D]W} t| d ot | } nt| | jotdn|i | q0W|itjo|in|iidt|dS(sReturn folder values for specified folders and items `item_ids` can be a single item ID, or a sequence. If it's a sequence, then `values` must be a sequence ordered by the input item ids. `folder_ids` can be a single folder ID, or a sequence. If it's a sequence, the `values` for each item must be a sequence ordered by the input folder ids. If a single item ID and single folder ID are used, then `values` must be a single value. If a single folder ID is used and multiple item IDs, then `values` must be a list of values, one value per item. If multiple folder IDs are used, and only one item ID, then `values` must be a single list containing the values for that one item. In other words, depending on the target, you'll set either a value, a list of values (either different folders for one item, or one folder for different items), or a list of lists of values. s__iter__s__len__s+Length mismatch between item_ids and valuess-Length mismatch between folder_ids and valuessSetFolderValuesN(sitemssfoldersscmdshasattrs folder_idss multi_foldersitem_idss multi_itemsextendsvaluesslistsappends_[1]svslens ValueErrorsfcsselfs connectionsNonesopensPokesformat( sselfsitem_idss folder_idssvaluessfolderss multi_foldersitemsscmds_[1]sfcsvs multi_item((s!build\bdist.win32\egg\ecco_dde.pysSetFolderValuesSs<   .   cCsD|tjo |idt|in|id||dS(s Set the text of `item_id` to `text` (or a dictionary of item->text) If `text` is None, `item_id` must be a dictionary mapping item ID's to text values. Otherwise, `item_id` should be a single item ID, and `text` is the text to set. s SetItemTextN(stextsNonesselfspokesunfoldsitem_idsitems(sselfsitem_idstext((s!build\bdist.win32\egg\ecco_dde.pys SetItemTexts  cCs#|id|tt|dS(s]Show the specified item in the phonebook view Item or one of its parents must be in the Phonebook folder. If `only` is true, the phonebook will show only this item. Otherwise, the item is added to the current list of phonebook items. This also switches to the phonebook view, if it's not already visible. sShowPhoneBookItemN(sselfspokesitem_idsintsboolsonly(sselfsitem_idsonly((s!build\bdist.win32\egg\ecco_dde.pysShowPhoneBookItemscCs|id|dS(sDisplay the specified views ChangeViewN(sselfspokesview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pys ChangeViewscCs|id|dS(s5Add `view_id` as a composite view to the current views AddCompViewN(sselfspokesview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pys AddCompViewscCs|id|dS(sARemove the specified view from the current view's composite viewssRemoveCompViewN(sselfspokesview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pysRemoveCompViewscCs|idt|dS(s(Display `date` in the calendar (only if calendar is already visible) `date` may be a ``datetime.date`` or ``datetime.datetime`` instance, or any other object with a ``strftime()`` method. Otherwise, it should be a string already formatted to Ecco's date format. s SetCalDateN(sselfspokes format_datesdate(sselfsdate((s!build\bdist.win32\egg\ecco_dde.pys SetCalDatescCs|id|dS(s:Delete the specified view (`view_id` must be a single int)s DeleteViewN(sselfspokesview_id(sselfsview_id((s!build\bdist.win32\egg\ecco_dde.pys DeleteViewscCs|id||dS(s5Add the specified folder(s) as column(s) of `view_id`sAddColumnToViewN(sselfspoke_one_or_manys folder_idsview_id(sselfsview_ids folder_id((s!build\bdist.win32\egg\ecco_dde.pysAddColumnToViewscCs|id||dS(s4Add the specified folder(s) to contents of `view_id`sAddFolderToViewN(sselfspoke_one_or_manys folder_idsview_id(sselfsview_ids folder_id((s!build\bdist.win32\egg\ecco_dde.pysAddFolderToViewscGsZt|dot|t o|i||t|n|i|||fdS(Ns__iter__( shasattrsobs isinstances basestringsselfspokescmdsargsstuple(sselfscmdsobsargs((s!build\bdist.win32\egg\ecco_dde.pyspoke_one_or_manys!(Ls__name__s __module__s__doc__ssleepsretriessNonesfilenames connectionsservers__init__sclosesassert_sessions close_allsopens__call__spokesintlistsints one_or_manysone_or_many_to_manys FolderTypes CheckMarks CreateFolders CreateItemsGetFoldersByNamesGetFoldersByTypesGetFolderItemss GetFolderNames GetFolderTypesGetFolderValuessGetItemFolderssGetItemParentss GetItemSubss GetItemTexts GetItemTypes GetSelections GetVersionsNewFilesOpenFilesOLEModesEmbeds PasteOLEItems GetChangessGetViewss GetViewNamessGetViewFolderssGetPopupValuessGetFolderOutlinesGetViewColumnss GetViewTLIss GetOpenFiless CreateViewsGetFolderAutoAssignRulessGetCurrentFiles GetFileNames ChangeFiles CloseFiles CopyOLEItems InsertLevelsIndents InsertItems RemoveItemsSaveFiles SetFolderNamesSetFolderValuess SetItemTextsTruesShowPhoneBookItems ChangeViews AddCompViewsRemoveCompViews SetCalDates DeleteViewsAddColumnToViewsAddFolderToViewspoke_one_or_many(((s!build\bdist.win32\egg\ecco_dde.pysEccoDDE|s    )            )                            >      (sosssysstimescsvsdatetimes__all__s ExceptionsDDEConnectionErrors StateErrors FileNotOpeneds WrongSessions format_datesformat_datetimesadditional_testssobjectsItemTypes SelectionTypes FolderTypes InsertLevelsOLEModesDialectseccosregister_dialectsszslistsoutputsformatsfoldsunfoldsEccoDDE(s SelectionTypesEccoDDEsadditional_testssdatetimesfolds InsertLevelsItemTypes__all__soutputs FileNotOpenedscsvs FolderTypesformatssyss WrongSessionsunfoldsDDEConnectionErrors format_datesszsformat_datetimes StateErrorstimesOLEModesossecco((s!build\bdist.win32\egg\ecco_dde.pys?s*-*       PK82EGG-INFO/dependency_links.txt PK8!8t  EGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: EccoDDE Version: 0.9 Summary: Thin wrapper over the Ecco Personal Information Manager's DDE API Home-page: http://pypi.python.org/pypi/EccoDDE Author: Phillip J. Eby Author-email: peak@eby-sarna.com License: PSF or ZPL Download-URL: http://peak.telecommunity.com/snapshots/ Description: EccoDDE is a very thin wrapper over the DDE API of the Ecco Pro personal information manager for Windows. Unlike other Python interfaces to Ecco, it does not provide any higher-level objects to represent items, folders, etc., but instead permits you to create whatever higher-level objects suit your own particular application. Also, EccoDDE uses the original Ecco API names for its methods, so that you can use the Ecco API reference as a rough guide to EccoDDE. Some methods have enhanced functionality that you can access by using different argument types, but even these are nearly always just exposing capabilities of the underlying Ecco API, rather than doing any Python-specific wrapping. 48 of Ecco's 49 API calls are implemented. (The 49th, ``AddFileToMenu``, does not have appear to be documented anywhere on the 'net.) The main value-add that EccoDDE provides over writing your own ad-hoc interface is robustness. EccoDDE can transparently launch Ecco if it's not started, and it avoids many subtle quoting and line-termination problems that you'd run into when writing an interface from scratch. EccoDDE also has an automated test suite, so that any future additions to the library won't break current functionality. This library requires the PyWin32 package, but does not automatically install it, due to it not being compatible with easy_install at this time. You must manually install PyWin32 before using EccoDDE. For complete EccoDDE documentation, please consult the `EccoDDE developer's guide`_. Questions, comments, and bug reports for this package should be directed to the `PEAK mailing list`_. .. _Trellis: http://pypi.python.org/pypi/Trellis .. _Trellis tutorial: http://peak.telecommunity.com/DevCenter/Trellis .. _EccoDDE developer's guide: http://peak.telecommunity.com/DevCenter/EccoDDE#toc .. _PEAK mailing list: http://www.eby-sarna.com/mailman/listinfo/peak/ .. _toc: Platform: UNKNOWN PK8r6EGG-INFO/SOURCES.txtREADME.txt ecco_dde.py setup.cfg setup.py EccoDDE.egg-info/PKG-INFO EccoDDE.egg-info/SOURCES.txt EccoDDE.egg-info/dependency_links.txt EccoDDE.egg-info/top_level.txtPK8T EGG-INFO/top_level.txtecco_dde PK82EGG-INFO/zip-safe PK8($o`o` ecco_dde.pyPK8t߃ `ecco_dde.pycPK86