Features/Touch/Programming Tips: Difference between revisions
Created page with "While touch will just work for many activities, there are some times when some intervention is needed. The examples below will hopefully help Sugar activity developers as they..." |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 10: | Line 10: | ||
def _fixed_resize_cb(self, widget=None, rect=None): | def _fixed_resize_cb(self, widget=None, rect=None): | ||
""" If a toolbar opens or closes, we need to resize the vbox | |||
holding out scrolling window. | holding out scrolling window. """ | ||
self.vbox.set_size_request(rect.width, rect.height) | self.vbox.set_size_request(rect.width, rect.height) | ||
| Line 20: | Line 20: | ||
self.vbox = Gtk.VBox(False, 0) | self.vbox = Gtk.VBox(False, 0) | ||
self.vbox.set_size_request( | self.vbox.set_size_request( | ||
Gdk.Screen.width(), | |||
Gdk.Screen.height() - style.GRID_CELL_SIZE) | |||
self.fixed.put(self.vbox, 0, 0) | self.fixed.put(self.vbox, 0, 0) | ||
self.vbox.show() | self.vbox.show() | ||
| Line 54: | Line 55: | ||
'''4.''' The interaction is as follows: (1) in the button_press event, show the TextView widget and move it into position; (2) the on-screen keyboard will appear when the TextView is clicked; (3) when exiting the TextView, get the text from the buffer and then hide the widget. | '''4.''' The interaction is as follows: (1) in the button_press event, show the TextView widget and move it into position; (2) the on-screen keyboard will appear when the TextView is clicked; (3) when exiting the TextView, get the text from the buffer and then hide the widget. | ||
self.text_buffer = self.text_entry.get_buffer() | self.text_buffer = self.text_entry.get_buffer() | ||
| Line 64: | Line 64: | ||
text = self.text_buffer.get_text(bounds[0], bounds[1], True) | text = self.text_buffer.get_text(bounds[0], bounds[1], True) | ||
# Do something with text | # Do something with text | ||
# Then hide the TextView widget | |||
self.text_entry.hide() | self.text_entry.hide() | ||