Skip to content

Commit

Permalink
tw2.bootstrap -> tw2.bootstrap.forms. Paves the way for #5.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Jun 7, 2012
1 parent f1ebfef commit 45d6cf5
Show file tree
Hide file tree
Showing 36 changed files with 26 additions and 22 deletions.
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
recursive-include tw2/bootstrap/templates *
recursive-include tw2/bootstrap/static *
recursive-include tw2/bootstrap/forms/templates *
recursive-include tw2/bootstrap/forms/static *
include README.md
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
# "Genshi",
],
packages=find_packages(exclude=['ez_setup', 'tests']),
namespace_packages=['tw2'],
namespace_packages=[
'tw2',
'tw2.bootstrap',
],
zip_safe=False,
include_package_data=True,
test_suite = 'nose.collector',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
)
import tw2.core as twc
import tw2.forms as twf
import tw2.bootstrap as twb
import tw2.bootstrap.forms as twb

import datetime

Expand Down
5 changes: 1 addition & 4 deletions tw2/bootstrap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
import widgets
__doc__ = widgets.__doc__

from widgets import *
__import__('pkg_resources').declare_namespace(__name__)
4 changes: 4 additions & 0 deletions tw2/bootstrap/forms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import widgets
__doc__ = widgets.__doc__

from widgets import *
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 14 additions & 14 deletions tw2/bootstrap/widgets.py → tw2/bootstrap/forms/widgets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
``tw2.bootstrap`` is a drop-in replacement for ``tw2.forms`` enabled to
``tw2.bootstrap.forms`` is a drop-in replacement for ``tw2.forms`` enabled to
work with `twitter bootstrap <http://twitter.github.com/bootstrap/>`_.
"""

Expand All @@ -8,7 +8,7 @@
import tw2.jquery as twj

from datetime import datetime
from tw2.bootstrap.utils import replace_all
from tw2.bootstrap.forms.utils import replace_all

__all__ = [
'bootstrap_css',
Expand Down Expand Up @@ -121,9 +121,9 @@


class BootstrapMixin(twc.Widget):
""" Abstract base class for tw2.bootstrap widgets. """
""" Abstract base class for tw2.bootstrap.forms widgets. """

#template = "genshi:tw2.bootstrap.templates.bootstrap"
#template = "genshi:tw2.bootstrap.forms.templates.bootstrap"

# declare static resources here
# you can remove either or both of these, if not needed
Expand Down Expand Up @@ -158,7 +158,7 @@ class TextArea(BootstrapMixin, twf.TextArea):


class _BoolControl(BootstrapMixin):
template = "tw2.bootstrap.templates.bool_control"
template = "tw2.bootstrap.forms.templates.bool_control"

def prepare(self):
super(_BoolControl, self).prepare()
Expand Down Expand Up @@ -191,7 +191,7 @@ class IgnoredField(twf.HiddenField):


class LabelField(BootstrapMixin, twf.LabelField):
template = "tw2.bootstrap.templates.label_field"
template = "tw2.bootstrap.forms.templates.label_field"
css_class = "input-medium uneditable-input"

def prepare(self):
Expand Down Expand Up @@ -226,12 +226,12 @@ class HorizontalLayout(BootstrapMixin, twf.widgets.BaseLayout):
Arrange widgets and labels horizontally:
Float left, right-aligned labels on same line as controls
""" + twf.widgets.BaseLayout.__doc__
template = "mako:tw2.bootstrap.templates.horizontal_layout"
template = "mako:tw2.bootstrap.forms.templates.horizontal_layout"


class HorizontalForm(BootstrapMixin, twf.Form):
"""Equivalent to a Form containing a HorizontalLayout."""
template = "mako:tw2.bootstrap.templates.horizontal_form"
template = "mako:tw2.bootstrap.forms.templates.horizontal_form"
css_class = "form-horizontal"
child = twc.Variable(default=HorizontalLayout)
children = twc.Required
Expand All @@ -242,7 +242,7 @@ class HorizontalForm(BootstrapMixin, twf.Form):

class CalendarDatePicker(TextField):
resources = TextField.resources + [datepicker_js, datepicker_css]
template = "mako:tw2.bootstrap.templates.datepicker"
template = "mako:tw2.bootstrap.forms.templates.datepicker"

style = twc.Param(
'Specify the template to use. [field, component]',
Expand Down Expand Up @@ -416,11 +416,11 @@ class PostlabeledPartialRadioButton(BootstrapMixin,


class RadioButtonList(BootstrapMixin, twf.RadioButtonList):
template = "tw2.bootstrap.templates.selection_list"
template = "tw2.bootstrap.forms.templates.selection_list"


class RadioButtonTable(BootstrapMixin, twf.RadioButtonTable):
template = "tw2.bootstrap.templates.selection_table"
template = "tw2.bootstrap.forms.templates.selection_table"


class RowLayout(BootstrapMixin, twf.RowLayout):
Expand All @@ -444,7 +444,7 @@ class SingleSelectField(BootstrapMixin, twf.SingleSelectField):


class Spacer(BootstrapMixin, twf.Spacer):
template = "tw2.bootstrap.templates.spacer"
template = "tw2.bootstrap.forms.templates.spacer"


class TableFieldSet(BootstrapMixin, twf.TableFieldSet):
Expand All @@ -460,10 +460,10 @@ class TableLayout(BootstrapMixin, twf.TableLayout):


class VerticalCheckBoxTable(SelectionField, twf.VerticalCheckBoxTable):
template = "tw2.bootstrap.templates.vertical_selection_table"
template = "tw2.bootstrap.forms.templates.vertical_selection_table"
css_class = "table table-condensed"


class VerticalRadioButtonTable(SelectionField, twf.VerticalRadioButtonTable):
template = "tw2.bootstrap.templates.vertical_selection_table"
template = "tw2.bootstrap.forms.templates.vertical_selection_table"
css_class = "table table-condensed"

0 comments on commit 45d6cf5

Please sign in to comment.