demo description url parsing
This commit is contained in:
parent
5b00763bb0
commit
0de8ed1099
@ -2,6 +2,7 @@ import Tkinter as tk
|
|||||||
from ScrolledText import ScrolledText
|
from ScrolledText import ScrolledText
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from common import splitfn
|
from common import splitfn
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
#from IPython.Shell import IPShellEmbed
|
#from IPython.Shell import IPShellEmbed
|
||||||
#ipshell = IPShellEmbed()
|
#ipshell = IPShellEmbed()
|
||||||
@ -80,6 +81,7 @@ class App:
|
|||||||
|
|
||||||
def on_link(self, url):
|
def on_link(self, url):
|
||||||
print url
|
print url
|
||||||
|
webbrowser.open(url)
|
||||||
|
|
||||||
def on_demo_select(self, evt):
|
def on_demo_select(self, evt):
|
||||||
name = self.demos_lb.get( self.demos_lb.curselection()[0] )
|
name = self.demos_lb.get( self.demos_lb.curselection()[0] )
|
||||||
@ -101,28 +103,31 @@ class App:
|
|||||||
s = s.rstrip()
|
s = s.rstrip()
|
||||||
if i == 0 and not s:
|
if i == 0 and not s:
|
||||||
continue
|
continue
|
||||||
sn = len(s)
|
if s and s == '='*len(s):
|
||||||
if s and s == '='*sn:
|
|
||||||
text.tag_add('header1', 'end-2l', 'end-1l')
|
text.tag_add('header1', 'end-2l', 'end-1l')
|
||||||
elif s and s == '-'*sn:
|
elif s and s == '-'*len(s):
|
||||||
text.tag_add('header2', 'end-2l', 'end-1l')
|
text.tag_add('header2', 'end-2l', 'end-1l')
|
||||||
else:
|
else:
|
||||||
text.insert('end', s+'\n')
|
text.insert('end', s+'\n')
|
||||||
|
|
||||||
|
def add_link(start, end, url):
|
||||||
|
for tag in self.linker.add(url):
|
||||||
|
text.tag_add(tag, start, end)
|
||||||
|
self.match_text(r'http://\S+', add_link)
|
||||||
|
|
||||||
def format_line(self, s):
|
def match_text(self, pattern, tag_proc):
|
||||||
text = self.text
|
text = self.text
|
||||||
pos, n = 0, len(s)
|
text.mark_set('matchPos', '1.0')
|
||||||
while pos < n:
|
count = tk.IntVar()
|
||||||
next = s.find('http://', pos)
|
while True:
|
||||||
if next < 0:
|
match_index = text.search(pattern, 'matchPos', count=count, regexp=True, stopindex='end')
|
||||||
next = n
|
if not match_index: break
|
||||||
test.insert(tk.END, s[pos:next])
|
end_index = text.index( "%s+%sc" % (match_index, count.get()) )
|
||||||
pos = next
|
text.mark_set('matchPos', end_index)
|
||||||
|
if callable(tag_proc):
|
||||||
|
tag_proc(match_index, end_index, text.get(match_index, end_index))
|
||||||
#text.insert(tk.END, "click here!", linker.add('http://asdfsdaf'))
|
else:
|
||||||
|
text.tag_add(tag_proc, match_index, end_index)
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
tk.mainloop()
|
tk.mainloop()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'''
|
'''
|
||||||
Simple example of stereo image matching and point cloud generation.
|
Simple example of stereo image matching and point cloud generation.
|
||||||
|
|
||||||
Resulting .ply file cam be easily viewed using MeshLab (http://meshlab.sourceforge.net/)
|
Resulting .ply file cam be easily viewed using MeshLab ( http://meshlab.sourceforge.net/ )
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
'''
|
'''
|
||||||
Multiscale Turing Patterns generator.
|
Multiscale Turing Patterns generator.
|
||||||
|
=====================================
|
||||||
|
|
||||||
Inspired by http://www.jonathanmccabe.com/Cyclic_Symmetric_Multi-Scale_Turing_Patterns.pdf
|
Inspired by http://www.jonathanmccabe.com/Cyclic_Symmetric_Multi-Scale_Turing_Patterns.pdf
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user