Skip to content

Commit

Permalink
Merge pull request #73 from nucleic/feature-stylesheet
Browse files Browse the repository at this point in the history
Feature stylesheet
  • Loading branch information
sccolbert committed Oct 25, 2013
2 parents 64cfe87 + 49cd83b commit 77e2a0a
Show file tree
Hide file tree
Showing 34 changed files with 2,917 additions and 27 deletions.
73 changes: 55 additions & 18 deletions docs/source/_static/enamldoc.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
blockquote {
border-left: 2px solid #EEEEEE;
}


.ffms, #style-field-type-table td:nth-of-type(2) {
font-family: monospace;
}


.table th.field-name {
white-space: nowrap;
background-color: #F0F0F0;
border: 2px solid black;
}


.table td.field-body > blockquote {
border: none;
}


.table td.field-body > blockquote p {
font-size: 14px;
}


.table td.field-body {
padding-left: 20px;
}


.alert-info {
background-color: #FFFB85;
border-color: #FFFB85;
background-color: #FDFA92;
border-color: #FDFA92;
color: #333333;
}

Expand All @@ -16,6 +48,22 @@
}


.code-and-img {
padding: 0;
}


.code-and-img > div {
float: left;
width: 30em;
}


.code-and-img pre {
overflow-x: hidden;
}


.highlighttable {
width: 100%;
}
Expand All @@ -38,34 +86,23 @@
margin-bottom: 30px;
padding-top: 10px;
padding-bottom: 10px;
text-shadow: 0 1px 0 #fff;
background-color: #f7f5fa;
border-radius: 5px;
text-shadow: 0 1px 0 #FFFFFF;
background-color: #F5F5F5;
border: 1px solid #CCCCCC;
}


.enamldoc-sidenav .nav > li > a {
display: block;
color: #716b7a;
color: #716B7A;
padding: 5px 20px;
}


.enamldoc-sidenav .nav > li > a:hover,
.enamldoc-sidenav .nav > li > a:focus {
text-decoration: none;
background-color: #e5e3e9;
border-right: 1px solid #dbd8e0;
}


.enamldoc-sidenav .nav > .active > a,
.enamldoc-sidenav .nav > .active:hover > a,
.enamldoc-sidenav .nav > .active:focus > a {
font-weight: bold;
color: #563d7c;
background-color: transparent;
border-right: 1px solid #563d7c;
background-color: #E5E5E5;
}


Expand Down
2 changes: 2 additions & 0 deletions docs/source/api_ref/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ API Reference
nodevisitor <nodevisitor>
scintilla <scintilla/index>
stdlib <stdlib/index>
styling <styling>
validator <validator>
version <version>
widgets <widgets/index>
Expand All @@ -34,6 +35,7 @@ API Reference
icon
image
nodevisitor
styling
validator
version

Expand Down
27 changes: 27 additions & 0 deletions docs/source/api_ref/styling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. module:: enaml.styling

=============
enaml.styling
=============

.. rubric:: Classes

.. autosummary::
:nosignatures:

Setter
Stylable
Style
StyleCache
StyleSheet


.. autoclass:: Setter

.. autoclass:: Stylable

.. autoclass:: Style

.. autoclass:: StyleCache

.. autoclass:: StyleSheet
6 changes: 5 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@
'sphinx.ext.graphviz',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.autosummary',
'enamldoc'
#'enamldoc'
'numpydoc'
]

# Disable numpy auto-gen class members.
numpydoc_show_class_members = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down
50 changes: 50 additions & 0 deletions docs/source/dev_guides/code/cascade_style.enaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from enaml.widgets.api import (
Window, Container, PushButton
)
from enaml.styling import (
StyleSheet, Style, Setter
)
from enaml.qt.qt_application import (
QtApplication
)

enamldef AppSheet(StyleSheet):
Style:
element = 'PushButton'
Setter:
field = 'color'
value = 'blue'

enamldef View(Window):
title = 'Style Sheet'
Container:
Container:
padding = 0
StyleSheet:
Style:
element = 'PushButton'
Setter:
field = 'color'
value = 'red'
PushButton:
text = 'One'
PushButton:
text = 'Two'
PushButton:
text = 'Three'
PushButton:
text = 'Four'
PushButton:
text = 'Five'
StyleSheet:
Style:
Setter:
field = 'color'
value = 'green'

def main():
app = QtApplication()
app.style_sheet = AppSheet()
view = View()
view.show()
app.start()
29 changes: 29 additions & 0 deletions docs/source/dev_guides/code/pseudo_class_style.enaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from enaml.widgets.api import (
Window, Container, Field, CheckBox
)
from enaml.styling import (
StyleSheet, Style, Setter
)

enamldef Main(Window):
title = 'Style Sheet'
StyleSheet:
Style:
element = 'CheckBox'
pseudo_class = 'checked'
Setter:
field = 'color'
value = 'indianred'
Style:
element = 'Field'
pseudo_class = 'focus'
Setter:
field = 'color'
value = 'green'
Container:
CheckBox:
text = 'One'
CheckBox:
text = 'Two'
Field:
text = 'Three'
25 changes: 25 additions & 0 deletions docs/source/dev_guides/code/pseudo_element_style.enaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from enaml.widgets.api import (
Window, Container, GroupBox, PushButton
)
from enaml.styling import (
StyleSheet, Style, Setter
)

enamldef Main(Window):
title = 'Style Sheet'
StyleSheet:
Style:
element = 'GroupBox'
pseudo_element = 'title'
Setter:
field = 'color'
value = 'indianred'
Container:
GroupBox:
title = 'Group Box'
PushButton:
text = 'One'
PushButton:
text = 'Two'
PushButton:
text = 'Three'
44 changes: 44 additions & 0 deletions docs/source/dev_guides/code/selector_style.enaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from enaml.widgets.api import (
Window, Container, PushButton, Field,
CheckBox
)
from enaml.styling import (
StyleSheet, Style, Setter
)

enamldef Main(Window):
title = 'Style Sheet'
StyleSheet:
Style:
element = 'PushButton'
Setter:
field = 'color'
value = 'red'
Style:
style_class = 'blue-class'
Setter:
field = 'color'
value = 'blue'
Style:
object_name = 'special'
Setter:
field = 'color'
value = 'green'
Setter:
field = 'font-weight'
value = 'bold'
Container:
PushButton:
text = 'One'
PushButton:
text = 'Two'
Field:
style_class = 'blue-class'
text = 'Three'
CheckBox:
style_class = 'blue-class'
text = 'Four'
checked = True
PushButton:
text = 'Five'
name = 'special'
22 changes: 22 additions & 0 deletions docs/source/dev_guides/code/simple_style.enaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from enaml.widgets.api import (
Window, Container, PushButton
)
from enaml.styling import (
StyleSheet, Style, Setter
)

enamldef Main(Window):
title = 'Style Sheet'
StyleSheet:
Style:
element = 'PushButton'
Setter:
field = 'color'
value = 'blue'
Container:
PushButton:
text = 'First'
PushButton:
text = 'Second'
PushButton:
text = 'Third'
56 changes: 56 additions & 0 deletions docs/source/dev_guides/code/specificity_style.enaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from enaml.widgets.api import (
Window, Container, PushButton, Field
)
from enaml.styling import (
StyleSheet, Style, Setter
)

enamldef Main(Window):
title = 'Style Sheet'
StyleSheet:
Style:
element = 'PushButton'
Setter:
field = 'color'
value = 'blue'
Style:
element = 'PushButton'
style_class = 'alpha'
Setter:
field = 'color'
value = 'red'
Style:
element = 'PushButton'
style_class = 'beta'
Setter:
field = 'color'
value = 'green'
Style:
style_class = 'alpha, beta'
Setter:
field = 'color'
value = 'steelblue'
Setter:
field = 'font'
value = 'bold 12pt Arial'
Style:
object_name = 'special'
Setter:
field = 'color'
value = 'goldenrod'
Container:
PushButton:
text = 'One'
PushButton:
text = 'Two'
style_class = 'alpha'
PushButton:
text = 'Three'
style_class = 'beta'
Field:
text = 'Four'
style_class = 'alpha beta'
PushButton:
text = 'Five'
style_class = 'alpha beta'
name = 'special'
Loading

0 comments on commit 77e2a0a

Please sign in to comment.