GithubHelp home page GithubHelp logo

timothycrosley / thedom Goto Github PK

View Code? Open in Web Editor NEW
23.0 7.0 6.0 8.08 MB

A python framework to generate html and JavaScript from reusable and combine-able widgets.

License: GNU General Public License v2.0

Ruby 0.11% JavaScript 12.18% CSS 19.66% Python 67.82% Shell 0.23%

thedom's Introduction

thedom

PyPI version PyPi downloads Build Status License Bitdeli Badge

thedom is a collection of python objects that enable developers to generate and interact with web apps server side. It encourages object oriented website development, and code reuse by seperating each DOM element into its own object, and then allowing inheritance and child elements to come together to form new elements not defined in the standard DOM.

write this:

from thedom import layout, document, buttons

page = document.Document()
layout = page.addChildElement(layout.Center()).addChildElement(layout.Horizontal())
layout += buttons.Button(text="Use thedom.", **{'class':'MainAction'})
layout += buttons.Button(text="Enjoy writing less code.", **{'class':'DeleteAction'})
layout += buttons.Button(text="100% Python.")

print page.toHTML(formatted=True)

get this:

<!DOCTYPE html>
<html>
    <head>
    <title>
    </title>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    </meta>
    </head>
    <body>
        <div class="WCenter">
            <div class="WOuter">
                <div class="WInner">
                    <div class="WClear">
                        <input class="WBlock WLeft MainAction" type="button" value="Use thedom." />
                        <input class="WBlock WLeft DeleteAction" type="button" value="Enjoy writing less code." />
                        <input class="WBlock WLeft" type="button" value="100% Python." />
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>

Installing thedom

Installing thedom is as simple as:

pip install thedom

or if you prefer

easy_install thedom

Thanks and I hope you find thedom useful!

~Timothy Crosley

thedom's People

Contributors

timothycrosley avatar

Stargazers

byteface avatar Daniel Mahler avatar Harshad Sharma avatar  avatar AberciF avatar  avatar Rogerio Marques avatar Viktor Nova avatar Tim Kamanin avatar Zack Middleton avatar JT5D avatar  avatar Alan Dong avatar Josh Hoegen avatar Rodrigo Landerdahl avatar  avatar  avatar Jonathan Barratt avatar samuel avatar  avatar  avatar Brandon Hoffman avatar Biao Xie avatar

Watchers

Structure and Interpretation of Computer Programs avatar James Cloos avatar Christian Ledermann avatar  avatar Brandon Hoffman avatar Viktor Nova avatar  avatar

thedom's Issues

Bug in getChildElementWithId

In [88]: page = WebElements.Document.Document()

In [89]: page.body.getChildElementWithId('a')

In [90]: page += WebElements.Display.Label()

In [91]: page.body.getChildElementWithId('')

AttributeError Traceback (most recent call last)
in ()
----> 1 page.body.getChildElementWithId('')

/home/ego/projects/evergreen/lib/python2.7/site-packages/WebElements/Base.pyc in getChildElementWithId(self, elementId)
921 if child.id == elementId:
922 return child
--> 923 nestedChild = child.getChildElementWithId(elementId)
924 if nestedChild:
925 return nestedChild

/home/ego/projects/evergreen/lib/python2.7/site-packages/WebElements/Base.pyc in getChildElementWithId(self, elementId)
919 childrenWithId = None
920 for child in self:
--> 921 if child.id == elementId:
922 return child
923 nestedChild = child.getChildElementWithId(elementId)

AttributeError: 'TextNode' object has no attribute 'id'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.