Skip to content

Treibstoff integration #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
/coverage/
/lib64
/pyvenv.cfg
/portal.db/
/node_modules/
1 change: 1 addition & 0 deletions base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ recaptcha_public_key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[gunicorn]
recipe = zc.recipe.egg:scripts
eggs =
treibstoff
Pillow
yafowil[test]
yafowil.demo
Expand Down
3 changes: 2 additions & 1 deletion dev.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ cs = [email protected]:conestack
bda = [email protected]:bluedynamics

[sources]
treibstoff = git [email protected]:conestack/treibstoff.git
plumber = git ${gh:cs}/plumber.git
node = git ${gh:cs}/node.git
webresource = git ${gh:cs}/webresource.git
yafowil = git ${gh:cs}/yafowil.git
yafowil.bootstrap = git ${gh:cs}/yafowil.bootstrap.git branch=2.0
yafowil.lingua = git ${gh:cs}/yafowil.lingua.git
yafowil.webob = git ${gh:cs}/yafowil.webob.git
yafowil.widget.ace = git ${gh:cs}/yafowil.widget.ace.git branch=2.0
yafowil.widget.array = git ${gh:cs}/yafowil.widget.array.git branch=2.0
yafowil.widget.ace = git ${gh:cs}/yafowil.widget.ace.git branch=2.0
yafowil.widget.autocomplete = git ${gh:cs}/yafowil.widget.autocomplete.git branch=2.0
yafowil.widget.chosen = git ${gh:cs}/yafowil.widget.chosen.git branch=2.0
yafowil.widget.color = git ${gh:cs}/yafowil.widget.color.git
Expand Down
7 changes: 7 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ python3 -m venv .

./bin/pip install wheel zc.buildout
./bin/buildout -c localhost.cfg

if ! which npm &> /dev/null; then
sudo apt-get install npm
fi

npm --prefix . --no-save install \
./devsrc/treibstoff
51 changes: 49 additions & 2 deletions src/yafowil/demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import webresource as wr
import yafowil.loader # noqa
import yafowil.webob # noqa
import treibstoff # noqa


curdir = os.path.dirname(__file__)
Expand Down Expand Up @@ -130,10 +131,16 @@ def load_resources():
def get_resources(widget_name=None):
load_resources()
group = wr.ResourceGroup()
group.add(group_map['treibstoff'])
group.add(group_map['yafowil.demo'])
group.add(group_map['yafowil.bootstrap'])
if widget_name not in [None, 'yafowil']:
group.add(group_map[widget_name])
if isinstance(widget_name, list):
for name in widget_name:
if name not in [None, 'yafowil']:
group.add(group_map[name])
else:
if widget_name not in [None, 'yafowil']:
group.add(group_map[widget_name])
return group


Expand All @@ -144,10 +151,50 @@ def rendered_resources(resources):


def rendered_scripts(widget_name=None):
# provide resources for use of other widgets in yafowil.widget.array
if widget_name == 'yafowil.widget.array':
widget_name = [
'yafowil.widget.ace',
'yafowil.widget.array',
'yafowil.widget.autocomplete',
'yafowil.widget.color',
'yafowil.widget.chosen',
'yafowil.widget.cron',
'yafowil.widget.datetime',
'yafowil.widget.dict',
'yafowil.widget.image',
'yafowil.widget.location',
'yafowil.widget.multiselect',
'yafowil.widget.richtext',
'yafowil.widget.select2',
'yafowil.widget.slider',
'yafowil.widget.tiptap',
'yafowil.widget.wysihtml5',
]
return rendered_resources(get_resources(widget_name).scripts)


def rendered_styles(widget_name=None):
# provide resources for use of other widgets in yafowil.widget.array
if widget_name == 'yafowil.widget.array':
widget_name = [
'yafowil.widget.ace',
'yafowil.widget.array',
'yafowil.widget.autocomplete',
'yafowil.widget.color',
'yafowil.widget.chosen',
'yafowil.widget.cron',
'yafowil.widget.datetime',
'yafowil.widget.dict',
'yafowil.widget.image',
'yafowil.widget.location',
'yafowil.widget.multiselect',
'yafowil.widget.richtext',
'yafowil.widget.select2',
'yafowil.widget.slider',
'yafowil.widget.tiptap',
'yafowil.widget.wysihtml5',
]
return rendered_resources(get_resources(widget_name).styles)


Expand Down
3 changes: 3 additions & 0 deletions src/yafowil/demo/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from yafowil.utils import entry_point
import os
import webresource as wr
import treibstoff


resources_dir = os.path.join(os.path.dirname(__file__), 'resources')
Expand All @@ -26,6 +27,7 @@
name='yafowil-demo-css',
resource='yafowil.demo.css'
))
ts_resources = treibstoff.resources.copy()


##############################################################################
Expand All @@ -35,6 +37,7 @@
@entry_point(order=10)
def register():
factory.register_resources('bootstrap3', 'yafowil.demo', resources)
factory.register_resources('bootstrap3', 'treibstoff', ts_resources)


##############################################################################
Expand Down