wiki:wxGUIDevelopment/Refactoring/wxGUIAPIproposal

Version 3 (modified by wenzeslaus, 11 years ago) ( diff )

--

wxGUI API proposal

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.)

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.

Short proposal based on the current state of refactoring

Note that the main purpose of this API called GrassInterface is to create layer between existing wxGUI classes. This layer enables us to combine existing parts freely.

The term GrassInterface denotes the class which is the root of the object tree. However, all classes which belongs to this tree can sometimes by reffered as GrassInterface too. GrassInterface interface is the abstract base class or interface and its implementation may be also called interfaces because the word interface is overloaded in this case.

Currently the GrassInterface implementations are some proxy objects which provides the right API to the existing classes. However, it is expected that some classes will implement GrassInterface directly.

class Layer(object):

class LayerList(object):
    def GetSelectedLayers(self, checkedOnly=True):

# GrassInterface is a root in the tree of objects/interfaces which compose API
# provides the functionality which should be available to every GUI component
# and is expected to be passed to almost all objects
class GrassInterface:
    def RunCmd(self, *args, **kwargs):

    def Help(self, entry):

    def WriteLog(self, text, wrap=None, priority=1):
        """The meaning and usage of priority is not clear"""

    def WriteCmdLog(self, line, pid=None, switchPage=True):

    def WriteWarning(self, line):

    def WriteError(self, line):

    def GetLayerList(self):

    def GetMapDisplay(self):

    def GetAllMapDisplays(self):

    def GetMapWindow(self):

# more classes should be defined...
Note: See TracWiki for help on using the wiki.