don't loop through all jQuery functions on every Ox.Element creation
This commit is contained in:
parent
f625493d9c
commit
9a61861bf5
4 changed files with 2757 additions and 518 deletions
|
|
@ -1,14 +1,51 @@
|
|||
import json
|
||||
import os
|
||||
import simplejson
|
||||
|
||||
def read_file(file):
|
||||
print 'reading', file
|
||||
f = open(file)
|
||||
data = f.read()
|
||||
f.close()
|
||||
return data
|
||||
|
||||
def write_file(file, data):
|
||||
print 'writing', file
|
||||
write_path(file)
|
||||
f = open(file, 'w')
|
||||
f.write(data)
|
||||
f.close()
|
||||
return len(data)
|
||||
|
||||
def write_path(file):
|
||||
path = os.path.split(file)[0]
|
||||
if path and not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
|
||||
build_path = '../../build/'
|
||||
|
||||
# SVG
|
||||
|
||||
path = '../../source/svg/symbols/'
|
||||
for dirname, dirnames, filenames in os.walk(path):
|
||||
for filename in filenames:
|
||||
if filename[0] != '.' and filename[0] != '_':
|
||||
svg = read_file(path + filename)
|
||||
new_filename = 'symbol' + filename[0].upper() + filename[1:]
|
||||
write_file(build_path + 'svg/ox.ui.classic/' + new_filename, svg)
|
||||
write_file(build_path + 'svg/ox.ui.modern/' + new_filename, svg.replace('#404040', '#FFFFFF').replace('#000000', '#FFFFFF'))
|
||||
|
||||
# JSON
|
||||
|
||||
images = []
|
||||
path = '../../build/'
|
||||
|
||||
for dirname, dirnames, filenames in os.walk(path + 'png'):
|
||||
for dirname, dirnames, filenames in os.walk(build_path + 'png'):
|
||||
for filename in filenames:
|
||||
if filename[:1] != '.':
|
||||
images.append(os.path.join(dirname.replace(path, ''), filename))
|
||||
images.append(os.path.join(dirname.replace(build_path, ''), filename))
|
||||
|
||||
f = open(path + 'json/ox.ui.images.json', 'w')
|
||||
f.write(simplejson.dumps(images))
|
||||
f.close()
|
||||
for dirname, dirnames, filenames in os.walk(build_path + 'svg'):
|
||||
for filename in filenames:
|
||||
if filename[:1] != '.':
|
||||
images.append(os.path.join(dirname.replace(build_path, ''), filename))
|
||||
|
||||
write_file(build_path + 'json/ox.ui.images.json', json.dumps(images, indent=4, sort_keys=True))
|
||||
Loading…
Add table
Add a link
Reference in a new issue