Skip to content

Commit

Permalink
example of formatting object
Browse files Browse the repository at this point in the history
  • Loading branch information
h4ck3rm1k3 committed Dec 23, 2013
1 parent 163ae80 commit 5435727
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/orca/formatting/__init__.py
@@ -0,0 +1,12 @@
class Formatting :

def __init__(self, format_type, enum):
self.format_type = format_type
self.enum = enum

def unfocused(self, c):
return []

def focused(self, c):
return []

5 changes: 5 additions & 0 deletions src/orca/formatting/braille/__init__.py
@@ -0,0 +1,5 @@
from orca.formatting import Formatting

class Braille (Formatting):
def __init__(self, enum):
Formatting.__init__(self, "braille", enum)
24 changes: 24 additions & 0 deletions src/orca/formatting/braille/animation.py
@@ -0,0 +1,24 @@
from orca.formatting.braille import Braille
import pyatspi
from orca.braille import Component

class AnimationBrailleAction(Braille):
def __init__(self):
Braille.__init__(self, pyatspi.ROLE_ANIMATION)

def unfocused(self, c):
return [
Component(c.obj,
c.asString(
c.label +
c.displayedText +
c.roleName +
(
c.description
and
c.space(": ") +
c.description
)
)
)
]
File renamed without changes.
36 changes: 36 additions & 0 deletions test/unit/orca_formatting.py
@@ -0,0 +1,36 @@
from orca.formatting.braille.animation import AnimationBrailleAction

class Context ():

def asString(self, content, delimiter=" "):
#orca/braille_generator.py
pass

@property
def obj (self):
pass

@property
def label (self):
return []

@property
def displayedText (self):
return []

@property
def roleName (self):
return []

@property
def description (self):
return []

def space (self, value):
return []

c = Context()
x = AnimationBrailleAction()

p = x.unfocused(c)
print(p)

0 comments on commit 5435727

Please sign in to comment.