~ubuntu-branches/ubuntu/natty/mago/natty

« back to all changes in this revision

Viewing changes to mago/application/gcalc.py

  • Committer: Bazaar Package Importer
  • Author(s): Ara Pulido
  • Date: 2010-12-03 16:08:32 UTC
  • Revision ID: james.westby@ubuntu.com-20101203160832-97pz2nxwmo54iwfk
Tags: 0.3-0ubuntu3
* Updated from trunk
 + Added new applications to our tests base
 + Fixes LP: #682845 

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
               "/" : "btndivide",
60
60
               "C" : "btnclear",
61
61
               "." : "btnnumeric_point",
62
 
               "s" : "btnsquare_root"}
 
62
               "s" : "btnsquare_root",
 
63
               "m" : "btnmodulusdivide"}
63
64
    EDITBAR_ROLE        = "edit bar"
64
65
    EDITBAR_INDEX       = 0
65
66
    SLEEP_DELAY         = 2
97
98
        True
98
99
        """
99
100
        calculator = ooldtp.context(self.name)
100
 
        try:
101
 
            children = calculator.getchild(button,'push button')
102
 
            for child in children:
103
 
                childName=child.getName()
104
 
                if calculator.hasstate(childName, ldtp.state.SHOWING):
105
 
                    return True
106
 
        except ldtp.LdtpExecutionError:
107
 
            raise ldtp.LdtpExecutionError, "Error locating button %s" % button
 
101
 
 
102
        children = calculator.getchild(button,'push button')
 
103
        for child in children:
 
104
            childName=child.getName()
 
105
            if calculator.hasstate(childName, ldtp.state.SHOWING):
 
106
                return True
 
107
        
108
108
        return False
109
109
    
110
110
    def push(self, buttons):
120
120
        """
121
121
        calculator = ooldtp.context(self.name)
122
122
        for button in buttons:
123
 
            try:
124
 
                children = calculator.getchild(self.BUTTONS[button],'push button')
125
 
                for child in children:
126
 
                    child.click()
127
 
            except ldtp.LdtpExecutionError:
128
 
                raise ldtp.LdtpExecutionError, "Error clicking button %s" % button
 
123
            children = calculator.getchild(self.BUTTONS[button],'push button')
 
124
            for child in children:
 
125
                child.click()
129
126
    
130
127
    def get_view(self):
131
128
        """
161
158
        new_window_name = self.VIEWS[new_view]["WINDOW"]
162
159
        new_view_menu_name = self.VIEWS[new_view]["MENU"]
163
160
        calculator = ooldtp.context(self.name)
164
 
        try:
165
 
            mnu_new_view = calculator.getchild(new_view_menu_name)
166
 
        except ldtp.LdtpExecutionError:
167
 
            raise ldtp.LdtpExecutionError, "The menu item for the requested view was not found."
 
161
        mnu_new_view = calculator.getchild(new_view_menu_name)
168
162
 
169
 
        try:
170
 
            mnu_new_view.selectmenuitem() 
171
 
        except ldtp.LdtpExecutionError:
172
 
            raise ldtp.LdtpExecutionError, "There was a problem changing views."
 
163
        mnu_new_view.selectmenuitem() 
 
164
        
173
165
        self.set_name(new_window_name)
174
166
        calculator.remap()
175
167
        time.sleep(self.SLEEP_DELAY) # need to give mago some time to catch up to calc ui
188
180
        @rtype: string
189
181
        """
190
182
        calculator = ooldtp.context(self.name)
191
 
        try:
192
 
            editBar = calculator.getchild(role=self.EDITBAR_ROLE)
193
 
            value = editBar[0].gettextvalue()
194
 
        except ldtp.LdtpExecutionError:
195
 
            raise ldtp.LdtpExecutionError, "There was a problem reading the value."
 
183
        editBar = calculator.getchild(role=self.EDITBAR_ROLE)
 
184
        value = editBar[0].gettextvalue()
196
185
        return value
197
186
 
198
187
    def set_thousands_separator(self, option = True):