Merge branch 'michaelweghorn/no_more_exception_on_textview_click' into 'master'
interface_view: Drop manual click handler that runs into exception
See merge request GNOME/accerciser!22
Samuel Thibault
1 year, 9 months ago
1429 | 1429 |
# bold formatting is 4.
|
1430 | 1430 |
self.label_end.set_markup(_('End: %d') % end)
|
1431 | 1431 |
|
1432 | |
def _onTextViewPressed(self, widget, event):
|
1433 | |
'''
|
1434 | |
Update spin button in the case that the textview was clicked.
|
1435 | |
Once the spin button's value changes, it's own callback fires which
|
1436 | |
re-populates the attribute view.
|
1437 | |
|
1438 | |
@param widget: The widget that recived the click event,
|
1439 | |
typically the text view.
|
1440 | |
@type widget: gtk.Widget
|
1441 | |
@param event: The click event.
|
1442 | |
@type event: gtk.gdk.Event
|
1443 | |
'''
|
1444 | |
if event.button != 1:
|
1445 | |
return
|
1446 | |
|
1447 | |
x, y = event.get_coords()
|
1448 | |
x, y = self.text_view.window_to_buffer_coords(gtk.TextWindowType.WIDGET,
|
1449 | |
int(x), int(y))
|
1450 | |
iter = self.text_view.get_iter_at_location(x, y)
|
1451 | |
|
1452 | |
self.offset_spin.set_value(iter.get_offset())
|
1453 | |
|
1454 | 1432 |
def _onTextCursorMove(self, text_buffer, param_spec):
|
1455 | 1433 |
'''
|
1456 | 1434 |
Update spinner when input cursor moves.
|
1457 | |
|
|
1435 |
Once the spin button's value changes, it's own callback fires
|
|
1436 |
which re-populates the attribute view.
|
|
1437 |
|
1458 | 1438 |
@param text_buffer: The section's main text buffer.
|
1459 | 1439 |
@type text_buffer: gtk.TextBuffer
|
1460 | 1440 |
@param param_spec: Some gobject crud
|
2516 | 2516 |
<property name="can_focus">True</property>
|
2517 | 2517 |
<property name="editable">False</property>
|
2518 | 2518 |
<property name="accepts_tab">False</property>
|
2519 | |
<signal name="button-press-event" handler="_onTextViewPressed" swapped="no"/>
|
2520 | 2519 |
<signal name="focus-in-event" handler="_onTextFocusChanged" swapped="no"/>
|
2521 | 2520 |
<signal name="focus-out-event" handler="_onTextFocusChanged" swapped="no"/>
|
2522 | 2521 |
</object>
|