Skip to content

Commit

Permalink
Link GoToPage pdf links to our way of jumping to pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Cimbali committed Jan 11, 2017
1 parent 15053b4 commit cdd4cd6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pympress/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ def get_link_action(self, link_type, action):
#TODO make a history of visited pages, use this action to jump forward in history
fun = lambda: print(_("Pympress does not yet support link type \"{}\" to \"{}\"").format(link_type, dest_name))
elif dest_name == "GoToPage":
#TODO connect this to the "G" action which allows to pick a page to jump to
fun = lambda: print(_("Pympress does not yet support link type \"{}\" to \"{}\"").format(link_type, dest_name))
# Same as the "G" action which allows to pick a page to jump to
fun = pympress.ui.UI.notify_label_event
elif dest_name == "Find":
#TODO popup a text box and search results with Page.find_text
# http://lazka.github.io/pgi-docs/Poppler-0.18/classes/Page.html#Poppler.Page.find_text
Expand Down
11 changes: 10 additions & 1 deletion pympress/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ def on_label_event(self, *args):
event_type = None if alt_start_editing else event.type

# Click in label-mode
if alt_start_editing or event.type == Gdk.EventType.BUTTON_PRESS: # click
if alt_start_editing or event_type == Gdk.EventType.BUTTON_PRESS: # click
if self.editing_cur_ett:
self.restore_current_label_ett()

Expand All @@ -1194,6 +1194,15 @@ def on_label_event(self, *args):
return True


@classmethod
def notify_label_event(cls):
""" Static way to start the "go to" label editing.
Typically used as callbacks from document links.
"""
cls._instance.on_label_event(True)


def on_label_ett_event(self, *args):
""" Manage events on the current slide label/entry.
Expand Down

0 comments on commit cdd4cd6

Please sign in to comment.