| | 223 | @edje.decorators.signal_callback( "mouse,clicked,1", "button_bottom_middle" ) |
| | 224 | def on_edje_signal_button_bottom_middle_pressed( self, emission, source ): |
| | 225 | self.main.transition_to("dtmf") |
| | 226 | |
| | 227 | #----------------------------------------------------------------------------# |
| | 228 | class pyphone_dtmf(edje_group): |
| | 229 | #----------------------------------------------------------------------------# |
| | 230 | def __init__(self, main): |
| | 231 | edje_group.__init__(self, main, "dtmf") |
| | 232 | self.text = [] |
| | 233 | self.last = 0.0 |
| | 234 | |
| | 235 | @edje.decorators.signal_callback( "mouse,clicked,1", "button_*" ) |
| | 236 | def on_edje_signal_dialer_button_pressed(self, emission, source): |
| | 237 | key = source.split("_", 1)[1] |
| | 238 | if key in ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"): |
| | 239 | self.text.append(key) |
| | 240 | # The trailing whitespace is a workaround for the one char invisible |
| | 241 | # bug due to some problems with scaling of text parts. |
| | 242 | self.part_text_set("label", "".join(self.text)+" ") |
| | 243 | elif key in "star": |
| | 244 | if self.text and ( time.time()-self.last < self.TIMEOUT ): |
| | 245 | if self.text[-1] == "*": |
| | 246 | del self.text[-1] |
| | 247 | self.text.append( "+" ) |
| | 248 | elif self.text[-1] == "+": |
| | 249 | del self.text[-1] |
| | 250 | self.text.append( "*" ) |
| | 251 | else: |
| | 252 | self.text.append( "*" ) |
| | 253 | else: |
| | 254 | self.text.append("*") |
| | 255 | self.part_text_set( "label", "".join(self.text)+" " ) |
| | 256 | elif key in "hash": |
| | 257 | self.text += "#" |
| | 258 | self.part_text_set( "label", "".join(self.text)+" " ) |
| | 259 | elif key in "delete": |
| | 260 | self.text = self.text[:-1] |
| | 261 | self.part_text_set("label", "".join(self.text)+" ") |
| | 262 | elif key in "dial": |
| | 263 | if dbus_object.gsm_device_obj: |
| | 264 | dbus_object.gsm_call_iface.SendDtmf( "".join(self.text)) |
| | 265 | self.main.transition_to("call") |
| | 266 | |
| | 267 | @edje.decorators.signal_callback("call_button_pressed", "button_right") |
| | 268 | def on_edje_signal_call_button_right_pressed(self, emission, source): |
| | 269 | self.main.transition_to("call") |
| | 270 | |
| | 271 | |