Exemplo n.º 1
0
def add_stylesheet():
    # should use urllib.parse, but it imports so many modules...
    css_url = '/'.join(
        __file__.split('/')[:-1] +
        ['css/smoothness/jquery-ui-1.10.3.custom.min.css'])
    _link = html.LINK(Href=css_url)
    _link.rel = 'stylesheet'

    document <= _link
Exemplo n.º 2
0
def add_stylesheet():
    _link = html.LINK(
        Href='/src/Lib/ui/css/smoothness/jquery-ui-1.10.3.custom.min.css')
    _link.rel = 'stylesheet'

    document <= _link
Exemplo n.º 3
0
jQuery function $, with the additional methods provided by jQuery UI. For 
instance, to turn an element into a dialog :

jq[elt_id].dialog()

When jQuery UI methods expect a Javascript object, they can be passed as
key/value pairs :

jq['tags'].autocomplete(source=availableTags)

"""
from browser import html, document, window, load

_path = __file__[:__file__.rfind('/')] + '/'

document <= html.LINK(rel="stylesheet",
                      href=_path + 'css/smoothness/jquery-ui.css')

# The scripts must be loaded in blocking mode, by using the function
# load(script_url[, names]) in module javascript
# If we just add them to the document with script tags, eg :
#
# document <= html.SCRIPT(sciprt_url)
# _jqui = window.jQuery.noConflict(True)
#
# the name "jQuery" is not in the Javascript namespace until the script is
# fully loaded in the page, so "window.jQuery" raises an exception

# Load jQuery and put name 'jQuery' in the global Javascript namespace
load(_path + 'jquery-1.11.2.min.js', ['jQuery'])
load(_path + 'jquery-ui.min.js')
Exemplo n.º 4
0
 def add_css_file(self, file):
     """"""
     document.select('head')[0] <= html.LINK(
         href=os.path.join('root', file), type='text/css', rel='stylesheet')
Exemplo n.º 5
0
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
# FITNESS FOR A PARTICULAR PURPOSE.                                           #
# See the GNU General Public License for more details.                        #
# You should have received a copy of the GNU General Public License           #
# along with this program.  If not, see <https://www.gnu.org/licenses/>.      #

from browser import document, window, ajax, alert, confirm
import browser.html as html
import os

head = document.select("head")[0]
head.insertAdjacentElement(
    "afterbegin",
    html.LINK(rel="stylesheet",
              href="brywidgets/widgetset.css",
              type="text/css"))


#Utility function
def delete(element):
    element.parentNode.removeChild(element)
    del element


#Colour utility functions


def rgbtotuple(colour):
    return tuple([int(x) for x in colour[4:-1].split(",")])
Exemplo n.º 6
0
def add_stylesheet():
    _link=html.LINK(Href='/src/Lib/ui/css/smoothness/jquery-ui-1.10.3.custom.min.css')
    _link.rel='stylesheet'

    doc <= _link     # document doesn't work here.. :( must use doc