| 1 | = wxGUI API proposal = |
| 2 | |
| 3 | The proposal does not have to be complete and there can be several different proposals. (All can be listed in different sections on this page for now; if too long a subpage should be created and linked here.) |
| 4 | |
| 5 | The API should be used for communication between objects in the wxGUI, for creating new GUI applications (and GUI addons/plugins) and for controlling the wxGUI from the embedded Python command line. |
| 6 | |
| 7 | == Short proposal based on the current state of refactoring == |
| 8 | |
| 9 | {{{ |
| 10 | #!python |
| 11 | class Layer(object): |
| 12 | |
| 13 | class LayerList(object): |
| 14 | def GetSelectedLayers(self, checkedOnly=True): |
| 15 | |
| 16 | # GrassInterface is a root in the tree of objects/interfaces which compose API |
| 17 | # provides the functionality which should be available to every GUI component |
| 18 | # and is expected to be passed to almost all objects |
| 19 | class GrassInterface: |
| 20 | def RunCmd(self, *args, **kwargs): |
| 21 | |
| 22 | def Help(self, entry): |
| 23 | |
| 24 | def WriteLog(self, text, wrap=None, priority=1): |
| 25 | """The meaning and usage of priority is not clear""" |
| 26 | |
| 27 | def WriteCmdLog(self, line, pid=None, switchPage=True): |
| 28 | |
| 29 | def WriteWarning(self, line): |
| 30 | |
| 31 | def WriteError(self, line): |
| 32 | |
| 33 | def GetLayerList(self): |
| 34 | |
| 35 | def GetMapDisplay(self): |
| 36 | |
| 37 | def GetAllMapDisplays(self): |
| 38 | |
| 39 | def GetMapWindow(self): |
| 40 | |
| 41 | # more classes should be defined... |
| 42 | }}} |