Removed rotation support and added paste accelerator support to the Dialpad
authorepage <eopage@byu.net>
Wed, 23 Sep 2009 12:41:20 +0000 (12:41 +0000)
committerepage <eopage@byu.net>
Wed, 23 Sep 2009 12:41:20 +0000 (12:41 +0000)
git-svn-id: file:///svnroot/gc-dialer/trunk@466 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

src/dc_glade.py
src/dialcentral.glade
src/gv_views.py

index c2b8581..02c3c79 100755 (executable)
@@ -297,7 +297,6 @@ class Dialcentral(object):
                        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,
                        }
@@ -788,16 +787,6 @@ class Dialcentral(object):
                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()
index 884f72b..412fafd 100644 (file)
               </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>
index 04c4f76..ff92ef7 100644 (file)
@@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 @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)
 """
 
@@ -517,6 +516,7 @@ class SmsEntryDialog(object):
 class Dialpad(object):
 
        def __init__(self, widgetTree, errorDisplay):
+               self._clipboard = gtk.clipboard_get()
                self._errorDisplay = errorDisplay
                self._smsDialog = SmsEntryDialog(widgetTree)
 
@@ -542,12 +542,16 @@ class Dialpad(object):
                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()
 
@@ -587,6 +591,15 @@ class Dialpad(object):
                """
                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