callbackMapping = {
"on_paste": self._on_paste,
"on_refresh": self._on_menu_refresh,
- "on_rotate": self._on_menu_rotate,
"on_clearcookies_clicked": self._on_clearcookies_clicked,
"on_about_activate": self._on_about_activate,
}
except Exception, e:
self._errorDisplay.push_exception()
- def _on_menu_rotate(self, *args):
- try:
- orientation = gtk_toolbox.get_screen_orientation()
- if orientation == gtk.ORIENTATION_HORIZONTAL:
- hildonize.window_to_portrait(self._window)
- elif orientation == gtk.ORIENTATION_VERTICAL:
- hildonize.window_to_landscape(self._window)
- except Exception, e:
- self._errorDisplay.push_exception()
-
def _on_paste(self, *args):
try:
contents = self._clipboard.wait_for_text()
</widget>
</child>
<child>
- <widget class="GtkMenuItem" id="rotateMenuItem">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Rotate</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_rotate"/>
- </widget>
- </child>
- <child>
<widget class="GtkMenuItem" id="about">
<property name="visible">True</property>
<property name="label" translatable="yes">_About</property>
@todo Add CTRL-V support to Dialpad
@todo Touch selector for callback number
-@todo Look into top half of dialogs being a treeview rather than a label
@todo Alternate UI for dialogs (stackables)
"""
class Dialpad(object):
def __init__(self, widgetTree, errorDisplay):
+ self._clipboard = gtk.clipboard_get()
self._errorDisplay = errorDisplay
self._smsDialog = SmsEntryDialog(widgetTree)
self._backTapHandler.on_cancel = self._reset_back_button
self._window = gtk_toolbox.find_parent_window(self._numberdisplay)
+ self._keyPressEventId = 0
def enable(self):
self._dialButton.grab_focus()
self._backTapHandler.enable()
+ self._keyPressEventId = self._window.connect("key-press-event", self._on_key_press)
def disable(self):
+ self._window.disconnect(self._keyPressEventId)
+ self._keyPressEventId = 0
self._reset_back_button()
self._backTapHandler.disable()
"""
pass
+ def _on_key_press(self, widget, event):
+ try:
+ if event.keyval == ord("v") and event.get_state() & gtk.gdk.CONTROL_MASK:
+ contents = self._clipboard.wait_for_text()
+ if contents is not None:
+ self.set_number(contents)
+ except Exception, e:
+ self._errorDisplay.push_exception()
+
def _on_sms_clicked(self, widget):
try:
action = PhoneTypeSelector.ACTION_SEND_SMS