-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKidExamplePage.py
More file actions
40 lines (34 loc) · 1.36 KB
/
Copy pathKidExamplePage.py
File metadata and controls
40 lines (34 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
from glob import glob
from WebKit.Examples.ExamplePage import ExamplePage
class KidExamplePage(ExamplePage):
def title(self):
try:
title = os.path.splitext(os.path.basename(self._orig_file))[0]
except AttributeError:
title = 'Kid Example'
return title
def cornerTitle(self):
return "Kid Examples"
def scripts(self):
"""Create list of dictionaries with info about a particular script."""
examples = []
filesyspath = self.request().serverSidePath()
files = glob(os.path.join(os.path.dirname(filesyspath), "*.kid"))
for i in files:
file = os.path.split(i)[1]
script = {}
script['pathname'] = script['name'] = file
examples.append(script)
return examples
def writeOtherMenu(self):
self.menuHeading('Other')
self.menuItem('View source of<br/>%s' % self.title(),
self.request().uriWebKitRoot() +
'KidKit/Examples/View?filename=%s'
% os.path.basename(self.request().serverSidePath()))
if self.application().hasContext('Documentation'):
filename = 'Documentation/WebKit.html'
if os.path.exists(filename):
self.menuItem('Local WebKit docs',
self.request().servletPath() + '/' + filename)