zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #03231
Re: presentations with zim
Agus,
you are right, currently I have developed a custom tool useful for
presentations, which takes the opened page with a DEFINED ORDER of
sub-pages in form of sub-links:
+introduction
+methods
+...
consequently after running the custom tool a small window appears and you
can change pages with page up, page down and escape the window by pressing
the escape key or button. It would be nice to integrate it more neatly to
the full screen feature of ZIM, which I have used for some presentations
before :-D Hope it helps and possibly it may be useful also for somebody
else...
You need to copy attached files to ~/.config/zim/customtools/ and restart
the ZIM, than the custom tool should appear under menu -- tools -- presenter
All the best,
Jakub
On 29 January 2015 at 21:32, Agustin Lobo <aloboaleu@xxxxxxxxx> wrote:
> Jakub,
>
> At some point you said
> "...especially in presentations, which I love to make in ZIM "
>
> Could you explain how you actually make presentations with zim or
> point to the appropriate doc?
>
> Thanks!
> Agus
>
> --
> Agustin Lobo
> aloboaleu@xxxxxxxxx
>
import gtk
import subprocess
import time
import os
import sys
# custom tool
program = "zim"
notebook = sys.argv[1]
path = sys.argv[2]
namespace = ""
index = 0
#list_sublinks = ["",] + sublinks.replace("+", "").split("\n")
def get_namespace_from(path):
global notebook
if path.endswith(".txt"):
path = path[:-4]
return path.replace(notebook,"").replace("/",":")[1:]
def convert_to_absolute_path(namespace):
rel_path = namespace.replace(':',"/")+'.txt'
rel_path = rel_path.replace(" ", "_")
abs_path = os.path.join(notebook, rel_path)
return abs_path
def get_page_sublinks(path):
global namespace
links = []
if os.path.exists(path+".txt"):
page = open(path+".txt", "r")
for line in page.readlines():
link_chunks = line.split("[[+")
if len(link_chunks) > 1:
for link_chunk in link_chunks[1:]:
end_link = link_chunk.find("]]")
start_title = 0
end_title = link_chunk.find("|")
if end_title == -1:
end_title = end_link
link = link_chunk[start_title:end_title]
comment = link_chunk[end_link+2:].strip()
# print title
if not ":" in link:
links.append(namespace+":"+link)
return links
def wakeup(widget, event):
global index
global namespace
global list_sublinks
if type(event) == int:
keycode = event
else:
keycode = event.keyval
# PgUp
if keycode == 65365 and index > 0:
index = index - 1
# PgDn
elif keycode == 65366 and index < len(list_sublinks)-1:
index = index + 1
# Esc
elif keycode == 65307:
destroy(widget)
# change page if index gives sense
if index >= 0 and index < len(list_sublinks):
print "index: %i" % index
print "length of sublinks: %i" % len(list_sublinks)
print "namesspace: %s" % list_sublinks[index]
subprocess.call([program, notebook, list_sublinks[index]])
def destroy(widget, data=None):
widget.destroy()
gtk.main_quit()
namespace = get_namespace_from(path)
print namespace
list_sublinks = [namespace,]+get_page_sublinks(path)
print list_sublinks
w = gtk.Window()
#w.set_title("ZIM-Wiki presenter")
w.set_decorated(False)
w.set_has_frame(False)
w.set_border_width(4)
w.set_keep_above(True)
w.set_gravity(gtk.gdk.GRAVITY_SOUTH_EAST)
width, height = w.get_size()
w.move(gtk.gdk.screen_width() - width, gtk.gdk.screen_height() - height)
w.add_events(gtk.gdk.KEY_PRESS_MASK)
w.connect("key-press-event", wakeup)
hbox = gtk.HButtonBox()
w.add(hbox)
# Create a new button
prev_button = gtk.Button("PgUp")
next_button = gtk.Button("PgDn")
quit_button = gtk.Button("ESC")
# Connect the "clicked" signal of the button to our callback
prev_button.connect("pressed", wakeup, 65365)
next_button.connect("pressed", wakeup, 65366)
quit_button.connect("pressed", destroy)
hbox.add(prev_button)
hbox.add(next_button)
hbox.add(quit_button)
hbox.set_size_request(200, 25)
prev_button.show()
next_button.show()
quit_button.show()
hbox.show()
w.show()
gtk.main()
Attachment:
presenter-usercreated.desktop
Description: application/desktop
References