All pastes #208525 Raw Edit

Casanova

public text v1 · immutable
#208525 ·published 2006-10-18 17:54 UTC
rendered paste body
class IDL:
    """ Contains a list of IDL interface names """
    # interface name strings for ease of reference
    DEVICEEVENT_LISTENER_IDL = 'IDL:Accessibility/DeviceEventListener:1.0'
    EVENT_LISTENER_IDL = 'IDL:Accessibility/EventListener:1.0'
    ACTION_IDL = 'IDL:Accessibility/Action:1.0'
    ACCESSIBLE_IDL = 'IDL:Accessibility/Accessible:1.0'
    APPLICATION_IDL = 'IDL:Accessibility/Application:1.0'
    COLLECTION_IDL = 'IDL:Accessibility/Collection:1.0'
    COMPONENT_IDL = 'IDL:Accessibility/Component:1.0'
    DESKTOP_IDL = 'IDL:Accessibility/Desktop:1.0'
    EDITABLE_TEXT_IDL = 'IDL:Accessibility/EditableText:1.0'
    HYPERLINK_IDL = 'IDL:Accessibility/Hyperlink:1.0'
    HYPERTEXT_IDL = 'IDL:Accessibility/Hypertext:1.0'
    IMAGE_IDL = 'IDL:Accessibility/Image:1.0'
    LOGIN_HELPER_IDL = 'IDL:Accessibility/LoginHelper:1.0'
    STREAMABLE_CONTENT_IDL = 'IDL:Accessibility/StreamableContent:1.0'
    TABLE_IDL = 'IDL:Accessibility/Table:1.0'
    TEXT_IDL = 'IDL:Accessibility/Text:1.0'
    VALUE_IDL = 'IDL:Accessibility/Value:1.0'
    SELECTION_IDL = 'IDL:Accessibility/Selection:1.0'

    def __init__(self):
        pass

class Role:
    """ Contains a list of the roles played by each widget in the appplications
    """ 
    def __init__ (self):
        self.prefixes = ['ROLE_', 'STATE_', 'TEXT_', 'MODIFIER_', 'LOCALE_',
                         'RELATION_', 'KEY_', 'MATCH_', 'SORT_', 'LAYER_']

    def get_role (self, widget):
        """returns the Role of the widget"""
        for prefix in self.prefixes:
            for attr in Accessibility.__dict__.keys():
                if attr.startswith(prefix) and  \
                   Accessibility.__dict__[prefix] == widget.getRole():
                    return prefix
        
    

class Desktop:
    """ Contains a List of workspaces in the current desktop """
    def __init__ (self):

        self.desktops = {} # contains the actual desktops
        # desktops = {0 : Workspace 0,
        #             1 : Workspace 1,
        #             .
        #             .
        #            }
    

    def __iter__ (self, index):
        pass

    def __str__ (self):
        return 'List of '+len(self.desktops.keys())+' workspaces'

class Workspace:
    """ Represents a Workspace in the desktop. Each Workspace contains a list
    of applications that are present in that particular workspace """
    def __init__ (self, WS):
        self.apps = {} # list of applications
        # apps = {app_name1 : Application 1,
        #         app_name2 : Application 2,
        #         .
        #         .
        #        }

    def __iter__ (self, index):
        pass

    def __str__ (self):
        return 'Workspace containing '+len(self.apps.keys())+' Applications'


class Application:
    """ Contains the Appmap for each Application """
    def __init__ (self, app):
        # populate the appmap