예제 #1
0
class UISlider(TextField):
    javascript = [
        JSLink(modname="sipbmp3web", filename="public/jquery/jquery-1.3.2.js"),
        JSLink(modname="sipbmp3web",
               filename="public/jquery/jquery-ui-personalized-1.6rc6.js"),
    ]
    template = "genshi:sipbmp3web.widgets.templates.slider"

    def __init__(self, *args, **kw):
        self.min = kw.pop("min")
        self.max = kw.pop("max")
        validator = Int(min=self.min, max=self.max)
        try:
            validator = Pipe(kw["validator"], validator)
        except KeyError:
            pass
        kw["validator"] = validator
        super(UISlider, self).__init__(*args, **kw)

    def update_params(self, d):
        super(TextField, self).update_params(d)
        if not getattr(d, "id", None):
            raise ValueError, "Slider must have id"
        container = '%s_container' % d.id
        self.add_call(
            js_callback('$("#%s").slider({ \
            min: %d, max: %d, step: 1, range: false, \
            value: $("#%s").val(), \
            slide: function (event, ui) { \
                jQuery("#%s").val(ui.value);\
            } \
            })' % (container, self.min, self.max, d.id, d.id)))
        jQuery = js_function('jQuery')
        input = jQuery("#%s" % d.id)
        self.add_call(input.css("display", "none"))
예제 #2
0
 def get_calendar_lang_file_link(self, lang):
     """
     Returns a CalendarLangFileLink containing a list of name
     patterns to try in turn to find the correct calendar locale
     file to use.
     """
     fname = 'static/calendar/lang/calendar-%s.js' % lang.lower()
     return JSLink(modname='tw.forms',
                   filename=fname,
                   javascript=self.javascript)
예제 #3
0
파일: stomp.py 프로젝트: ralphbean/moksha
 def __init__(self, *args, **kw):
     self.notify = asbool(config.get('moksha.socket.notify', False))
     self.orbited_host = config.get('orbited_host', 'localhost')
     self.orbited_port = config.get('orbited_port', 9000)
     self.orbited_scheme = config.get('orbited_scheme', 'http')
     self.orbited_url = '%s://%s:%s' % (
         self.orbited_scheme, self.orbited_host, self.orbited_port)
     self.orbited_js = JSLink(link=self.orbited_url + '/static/Orbited.js')
     self.stomp_host = config.get('stomp_host', 'localhost')
     self.stomp_port = config.get('stomp_port', 61613)
     self.stomp_user = config.get('stomp_user', 'guest')
     self.stomp_pass = config.get('stomp_pass', 'guest')
     super(StompWidget, self).__init__(*args, **kw)
예제 #4
0
class LiveGraphWidget(LiveWidget):
    """
    This is an example live graph widget based on Michael Carter's article
    "Scalable Real-Time Web Architecture, Part 2: A Live Graph with Orbited,
    MorbidQ, and js.io".

    http://cometdaily.com/2008/10/10/scalable-real-time-web-architecture-part-2-a-live-graph-with-orbited-morbidq-and-jsio
    """
    params = ['id', 'onconnectedframe', 'onmessageframe']
    topic = 'graph_demo'
    onmessage = 'modify_graph(bars, frame.body)'
    javascript = [JSLink(filename='static/livegraph.js', modname=__name__)]
    css = [CSSLink(filename='static/livegraph.css', modname=__name__)]
    template = '<div id="${id}" />'

    def update_params(self, d):
        super(LiveGraphWidget, self).update_params(d)
        self.add_call(js_function('init_graph')(self.id))
예제 #5
0
파일: ptd.py 프로젝트: decause/moksha
class ProcessedTowerDefense(Widget):
    name = 'Processed Tower Defense'
    hidden = True
    template = 'mako:moksha.widgets.misc.ptd.templates.ptd'
    css = [
        CSSLink(filename='static/style.css', modname=modname),
    ]
    javascript = [
        processing_js,
        jsfprocessing_js,
        effects_core_js,
        effects_highlight_js,
        JSLink(filename='game/creep_waves.js', modname=modname),
        JSLink(filename='game/terrain.js', modname=modname),
        JSLink(filename='game/util.js', modname=modname),
        JSLink(filename='game/creeps.js', modname=modname),
        JSLink(filename='game/ui_modes.js', modname=modname),
        JSLink(filename='game/weapons.js', modname=modname),
        JSLink(filename='game/ptd.js', modname=modname),
    ]
예제 #6
0
파일: stomp.py 프로젝트: ralphbean/moksha
#
# Authors: Luke Macken <*****@*****.**>

import moksha

from tg import config
from tw.api import Widget, JSLink, js_callback, js_function
from paste.deploy.converters import asbool

from moksha.api.widgets.orbited import orbited_host, orbited_port, orbited_url
from moksha.api.widgets.orbited import orbited_js
from moksha.lib.helpers import defaultdict
from moksha.widgets.notify import moksha_notify
from moksha.widgets.json import jquery_json_js

stomp_js = JSLink(link=orbited_url + '/static/protocols/stomp/stomp.js')


def stomp_subscribe(topic):
    """ Return a javascript callback that subscribes to a given topic,
        or a list of topics.
    """
    sub = "stomp.subscribe('%s');"
    if isinstance(topic, list):
        sub = ''.join([sub % t for t in topic])
    else:
        sub = sub % topic
    return sub


def stomp_unsubscribe(topic):
예제 #7
0
파일: grid.py 프로젝트: ralphbean/moksha
# limitations under the License.

import uuid
import simplejson as json

from tw.api import JSLink, js_callback
from tw.forms import FormField
from tw.jquery.ui_core import jquery_ui_core_js
from tw.jquery import jQuery, jquery_js

from moksha.lib.helpers import when_ready
from moksha.widgets.json import jquery_json_js
from moksha.widgets.jquery_template import jquery_template_js

moksha_ui_grid_js = JSLink(
    filename='public/javascript/ui/moksha.ui.grid.js',
    modname='moksha',
    javascript=[jquery_ui_core_js, jquery_template_js, jquery_json_js])

moksha_ui_popup_js = JSLink(filename='public/javascript/ui/moksha.ui.popup.js',
                            modname='moksha',
                            javascript=[jquery_ui_core_js])


class Grid(FormField):
    javascript = [jquery_ui_core_js, moksha_ui_grid_js, moksha_ui_popup_js]
    params = [
        'rows_per_page', 'page_num', 'total_rows', 'filters', 'unique_key',
        'sort_key', 'sort_order', 'row_template', 'resource', 'resource_path',
        'loading_throbber', 'uid', 'more_link', 'alphaPager', 'numericPager'
    ]
    hidden = True  # hide from the moksha main menu
예제 #8
0
            /* Unsubscribe from current feed, subscribe to new one */
        }
    """.replace('\n', ''))


## Load our feed tree widgets.
feedtree_engine = config.get('moksha.feedtree.engine', 'live')
if feedtree_engine == 'live':   # Live widgets
    feed_tree = MokshaLiveFeedTree('feed_tree')
    feed_entries_tree = MokshaLiveFeedEntriesTree('feed_entries_tree')
elif feedtree_engine == 'ajax': # Ajax widgets
    feed_tree = MokshaAjaxFeedTree('feed_tree')
    feed_entries_tree = MokshaAjaxFeedEntriesTree('feed_entries_tree')

splitter_js = JSLink(filename='static/splitter.js',
                     javascript=[jquery_js],
                     modname=__name__)

splitter_css = CSSLink(filename='static/main.css',
                       media='all',
                       modname=__name__)


class MokshaFeedReaderWidget(LiveWidget):
    name = 'Moksha Feed Reader'
    params = ['topic']
    topic = 'moksha.feeds' # will get replaced by a unique uuid at render-time
    template = 'mako:moksha.widgets.feeds.templates.feedreader'
    children = [feed_tree, feed_entries_tree]
    javascript = [splitter_js]
    css = [splitter_css]
예제 #9
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Authors: Luke Macken <*****@*****.**>

from tw.api import Widget, JSLink, CSSLink
from tw.jquery import jquery_js

from moksha.api.widgets.orbited import orbited_js

irc2_js = JSLink(filename='static/irc2.js',
                 javascript=[orbited_js],
                 modname=__name__)

willowchat_js = JSLink(filename='static/willowchat.js',
                       javascript=[jquery_js, irc2_js],
                       modname=__name__)

gui_js = JSLink(filename='static/gui.js',
                javascript=[willowchat_js],
                modname=__name__)

willowchat_css = CSSLink(filename='static/style.css', modname=__name__)


class LiveChatWidget(Widget):
    name = 'Chat'
예제 #10
0
파일: __init__.py 프로젝트: 86me/mediacore
 def render(self, *args, **kwargs):
     if not hasattr(self, 'condition') or self.condition():
         return JSLink.render(self, *args, **kwargs)
     return ""
예제 #11
0
from tw.api import JSLink
from tw.jquery import jquery_js

jquery_json_js = JSLink(modname=__name__,
                        filename='static/jquery.json.js',
                        javascript=[jquery_js])
예제 #12
0
# This file is part of Moksha
# Copyright (C) 2008-2010  Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
:mod:`fedoracommunity.widgets.expander` -- An Expander Widget
=============================================================

http://plugins.learningjquery.com/expander
"""

from tw.api import JSLink
from tw.jquery import jquery_js

expander_js = JSLink(filename='static/jquery.expander.js',
                     modname=__name__,
                     javascript=[jquery_js])
예제 #13
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import moksha
import moksha.utils

from tw.api import Widget, JSLink, CSSLink
from tw.jquery import jquery_js

layout_js = JSLink(filename='static/layout.js', modname=__name__)
layout_css = CSSLink(filename='static/layout.css', modname=__name__)
ui_core_js = JSLink(filename='static/ui/ui.core.js', modname=__name__)
ui_draggable_js = JSLink(filename='static/ui/ui.draggable.js', modname=__name__)
ui_droppable_js = JSLink(filename='static/ui/ui.droppable.js', modname=__name__)
ui_sortable_js = JSLink(filename='static/ui/ui.sortable.js', modname=__name__)

class LayoutWidget(Widget):
    template = 'mako:moksha.api.widgets.layout.templates.layout'
    params = ['header', 'content', 'sidebar', 'footer', 'invisible']
    css = [layout_css]
    javascript = [jquery_js, layout_js, ui_core_js, ui_draggable_js,
                  ui_droppable_js, ui_sortable_js]

    header = content = sidebar = footer = invisible = []
예제 #14
0
파일: widgets.py 프로젝트: ralphbean/moksha
This module contains ToscaWidgets for the `mbMenu jQuery Plugin
<http://plugins.jquery.com/project/mbMenu>`_, which was developed by Matteo
Bicocchi. © 2002-2008 Open Lab srl, Matteo Bicocchi. GPL licensed.

.. moduleauthor:: Luke Macken <*****@*****.**>
"""

from tw.api import JSLink, Widget, CSSLink, js_symbol
from tw.jquery import jquery_js, jQuery

from moksha.lib.helpers import when_ready

modname = __name__

jquery_mbmenu_js = JSLink(modname=modname,
                          filename='static/mbMenu.js',
                          javascript=[jquery_js])

jquery_mbmenu_min_js = JSLink(modname=modname,
                              filename='static/mbMenu.min.js',
                              javascript=[jquery_js])

mbmenu_css_1 = CSSLink(modname=modname,
                       filename='static/css/menu1.css',
                       media='screen')
mbmenu_css = CSSLink(modname=modname,
                     filename='static/css/menu.css',
                     media='screen')


class MokshaMenuBase(Widget):
예제 #15
0
class LiveChatWidget(Widget):
    name = 'Chat'
    params = ['bootstrap']
    bootstrap = JSLink(link='/apps/chat/bootstrap')
    template = '<div id="willowchat" reposition="true">${bootstrap}</div>'
    visible = False
예제 #16
0
from tagger.model import DBSession, Language, Category, Setting, Media
from tagger.lib.render import LinkWidget, MediaWidget
from tagger.lib.widgets import SideArticle, SideMedia, SideLink

__all__ = ['BaseController']

w_link = LinkWidget()
w_media = MediaWidget()
w_sideobj = dict(
    article=SideArticle(),
    media=SideMedia(),
    link=SideLink(),
)

# JQuery and plugins
jquery_js = JSLink(link=url('/js/jquery.js'))
jquery_tools_js = JSLink(link=url('/js/jquery.tools.js'))

# tagger
tagger_js = JSLink(link=url('/js/tagger.js'))

# springs
mjs_js = JSLink(link=url('/js/extern/mjs.js'))
springs_js = JSLink(link=url('/js/springs.js'))

# FlowPlayer - don't load this at startup, its a fallback for browsers not
# supporting HTML5 <video> tag
flowplayer_js = JSLink(link=url('/js/flowplayer.js'))


class BaseController(TGController):
예제 #17
0
import tw
from tw.api import CSSLink, JSLink, js_function
from tw.forms import FormField, validators

__all__ = [
    "CalendarDatePicker", "CalendarDateTimePicker", "calendar_js",
    "calendar_setup"
]

setup_calendar = js_function("Calendar.setup")

log = logging.getLogger(__name__)

calendar_css = CSSLink(modname='tw.forms',
                       filename='static/calendar/calendar-system.css')
calendar_js = JSLink(modname='tw.forms',
                     filename='static/calendar/calendar.js')
calendar_setup = JSLink(javascript=[calendar_js],
                        modname='tw.forms',
                        filename='static/calendar/calendar-setup.js')


class CalendarDatePicker(FormField):
    """
    Uses a javascript calendar system to allow picking of calendar dates.
    The date_format is in mm/dd/yyyy unless otherwise specified
    """
    css = [calendar_css]
    javascript = [calendar_js, calendar_setup]
    template = "tw.forms.templates.calendar"
    params = [
        "calendar_lang",
예제 #18
0
Moksha SpaceTree Widget
=======================

A widget for the Javascript InfoVis Toolkit.

.. moduleauthor:: Luke Macken <*****@*****.**>
.. upstream:: http://thejit.org
.. upstream-license:: BSD
"""

from tw.api import Widget, JSLink, CSSLink
from tw.jquery import jquery_js
from tw.jquery.flot import excanvas_js

jit_yc_js = JSLink(filename='static/jit-yc.js',
                   javascript=[excanvas_js],
                   modname=__name__)
jit_base_css = CSSLink(filename='static/css/base.css', modname=__name__)
jit_spacetree_css = CSSLink(filename='static/css/Spacetree.css',
                            modname=__name__)


class SpaceTree(Widget):
    params = {
        'query': 'URL to query for JSON data',
        'title': 'The title of this graph',
        'description': 'A description of this graph',
    }
    javascript = [jit_yc_js]
    css = [jquery_js, jit_base_css, jit_spacetree_css]
    template = 'mako:moksha.widgets.mokshajit.templates.spacetree'
예제 #19
0
    WidgetsList,
    )

from tw.forms import (
    TableForm,
    TextField,
    )

from abl.jquery.core import jquery_js

from .validators import NotRegistered



underscore_js = JSLink(modname="wirbelsturm",
                       filename="javascript/underscore.js"
                       )

backbone_js = JSLink(modname="wirbelsturm",
                     filename="javascript/backbone.js",
                     javascript=[jquery_js, underscore_js],
                     )


centralstation_js = JSLink(modname="wirbelsturm",
                           filename="javascript/centralstation.js",
                           javascript=[backbone_js],
                           )


예제 #20
0
파일: notify.py 프로젝트: ralphbean/moksha
from tw.api import JSLink, CSSLink, Widget
from tw.jquery import jquery_js

jquery_jgrowl_js = JSLink('jquery_jgrowl_js',
                          filename='static/jquery.jgrowl.js',
                          javascript=[jquery_js],
                          modname=__name__)
jquery_jgrowl_css = CSSLink('jquery_jgrowl_css',
                            filename='static/jquery.jgrowl.css',
                            modname=__name__)


class MokshaNotificationWidget(Widget):
    javascript = [jquery_jgrowl_js]
    css = [jquery_jgrowl_css]


moksha_notify = MokshaNotificationWidget('moksha_notify')
예제 #21
0
# This file is part of Moksha.
# Copyright (C) 2008-2010  Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from tw.api import JSLink
from tw.jquery import jquery_js

moksha_js = JSLink(modname=__name__,
                   filename='static/moksha.js',
                   javascript=[jquery_js])

moksha_extension_points_js = JSLink(
    modname="moksha",
    filename='public/javascript/moksha.extensions.js',
    javascript=[moksha_js])
예제 #22
0
from tw.api import Widget, JSLink, CSSLink, js_function
from moksha.widgetbrowser import util
import string

__all__ = ['WidgetBrowserTabs']

mod = __name__
#mod = 'widgetbrowser'
flora_all_css = CSSLink(modname=mod, filename="static/themes/flora/flora.all.css")
tabs_css = CSSLink(modname=mod, filename="static/ui.tabs.css")
wb_css = CSSLink(modname=mod, filename="static/widgetbrowser.css")
pygments_css = CSSLink(modname=mod, filename="static/pygments.css")
httprepl_css = CSSLink(modname=mod, filename="static/httprepl.css")
jquery_js = JSLink(modname=mod, filename="static/jquery.js")
# Do not pull jquery as an automatic dependency since Sphinx already includes
# it
ui_base_js = JSLink(modname=mod, filename="static/ui.base.js",
                    location="bodybottom")
ui_tabs_js = JSLink(modname=mod, filename="static/ui.tabs.js",
                    location="bodybottom",
                    javascript=[ui_base_js])
ui_dragabble_js = JSLink(modname=mod, filename="static/ui.draggable.js",
                         location="bodybottom")
ui_resizable_js = JSLink(modname=mod, filename="static/ui.resizable.js",
                         location="bodybottom")
ui_dialog_js = JSLink(modname=mod, filename="static/ui.dialog.js",
                      location="bodybottom",
                      javascript=[ui_base_js, ui_dragabble_js, ui_resizable_js])
widgetbrowser_js = JSLink(modname=mod, filename="static/widgetbrowser.js",
                          javascript=[ui_tabs_js],
                          css=[tabs_css, wb_css, pygments_css],
예제 #23
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Authors: Luke Macken <*****@*****.**>

from tg import config
from tw.api import Widget, JSLink, js_callback

orbited_host = config.get('orbited_host', 'localhost')
orbited_port = config.get('orbited_port', 9000)
orbited_url = '%s://%s:%s' % (config.get('orbited_scheme',
                                         'http'), orbited_host, orbited_port)
orbited_js = JSLink(link=orbited_url + '/static/Orbited.js')


class OrbitedWidget(Widget):
    params = {
        'onopen': 'A javascript callback for when the connection opens',
        'onread': 'A javascript callback for when new data is read',
        'onclose': 'A javascript callback for when the connection closes',
    }
    onopen = onread = onclose = js_callback('function(){}')
    javascript = [orbited_js]
    template = """
        <script type="text/javascript">
            Orbited.settings.port = %(port)s
            Orbited.settings.hostname = '%(host)s'
            document.domain = document.domain
예제 #24
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from tw.api import JSLink, Widget
from tw.jquery.ui_core import jquery_ui_core_js
from tw.jquery import jQuery, jquery_js
from uuid import uuid4

moksha_ui_selectable_js = JSLink(
    modname='moksha',
    filename='public/javascript/ui/moksha.ui.selectable.js',
    javascript=[jquery_ui_core_js])


class Selectable(Widget):
    template = 'mako:moksha.api.widgets.selectable.templates.selectable'
    javascript = [moksha_ui_selectable_js]

    def update_params(self, d):
        super(Selectable, self).update_params(d)
        content_id = d.id + '-uuid' + str(uuid4())
        d['content_id'] = content_id

        self.add_call(jQuery("#%s" % d.content_id).moksha_selectable())
예제 #25
0
# This file is part of Moksha.
# Copyright (C) 2008-2010  Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from tw.api import JSLink
from tw.jquery import jquery_js

jquery_template_js = JSLink(modname=__name__,
        filename='static/jquery.template.js',
        javascript=[jquery_js])
예제 #26
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from tw.jquery.ui_tabs import JQueryUITabs, jquery_ui_tabs_js
from tw.jquery.ui import ui_widget_js
from tw.api import Widget, JSLink, js_function
from tw.forms import FormField
from pylons import config, request
from repoze.what import predicates
from moksha.lib.helpers import eval_app_config, ConfigWrapper, when_ready

moksha_ui_tabs_js = JSLink(modname='moksha', filename='public/javascript/ui/moksha.ui.tabs.js', javascript=[jquery_ui_tabs_js, ui_widget_js])

import urllib

class TabbedContainerTabs(Widget):
    template = 'mako:moksha.api.widgets.containers.templates.tabbedcontainer_tabs'

class TabbedContainerPanes(Widget):
    template = 'mako:moksha.api.widgets.containers.templates.tabbedcontainer_panes'

tabwidget = TabbedContainerTabs('tabs')
panewidget = TabbedContainerPanes('panes')

jQuery = js_function('jQuery')

"""
예제 #27
0
from tw.api import JSLink

kamaloka_protocol_js = JSLink(filename='static/amqp.protocol.js',
                              modname=__name__)

kamaloka_protocol_0_10_js = JSLink(filename='static/amqp.protocol_0_10.js',
                                   javascript=[kamaloka_protocol_js],
                                   modname=__name__)

kamaloka_qpid_js = JSLink(filename='static/qpid_amqp.js',
                          javascript=[kamaloka_protocol_0_10_js],
                          modname=__name__)
예제 #28
0
파일: ptd.py 프로젝트: decause/moksha
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Processed Tower Defense Widget

from tw.api import Widget, CSSLink, JSLink
from tw.jquery.ui import effects_core_js, effects_highlight_js
from tw.jquery.processing import processing_js

modname = __name__

jsfprocessing_js = JSLink(filename='static/jsfprocessing.js',
                          javascript=[processing_js],
                          modname=modname)

# lulz
konami = JSLink(filename='static/konami.js', modname=modname)


class ProcessedTowerDefense(Widget):
    name = 'Processed Tower Defense'
    hidden = True
    template = 'mako:moksha.widgets.misc.ptd.templates.ptd'
    css = [
        CSSLink(filename='static/style.css', modname=modname),
    ]
    javascript = [
        processing_js,
예제 #29
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Authors: Luke Macken <*****@*****.**>

import uuid
from tw.api import Widget, JSLink, CSSLink, js_callback
from tw.jquery import jquery_js, jQuery

from moksha.api.widgets.live import LiveWidget
from moksha.api.widgets.live import subscribe_topics, unsubscribe_topics

container_js = JSLink(filename='static/js/mbContainer.min.js',
                      javascript=[jquery_js],
                      modname=__name__)
container_css = CSSLink(filename='static/css/mbContainer.css',
                        modname=__name__)


class MokshaContainer(Widget):
    template = 'mako:moksha.widgets.container.templates.container'
    javascript = [container_js]
    css = [container_css]
    options = ['draggable', 'resizable']
    button_options = ['iconize', 'minimize', 'close']
    params = [
        'buttons', 'skin', 'height', 'width', 'left', 'top', 'id', 'title',
        'icon', 'content', 'widget_name', 'view_source', 'dock', 'onResize',
        'onClose', 'onCollapse', 'onIconize', 'onDrag', 'onRestore'
예제 #30
0
from tw.api import Widget, JSLink, CSSLink, js_function
from tw.jquery import jquery_js

from datetime import datetime

__all__ = ["Epiclock"]

# declare your static resources here

dateformat_js = JSLink(modname=__name__,
                       filename='static/jquery.dateformat.min.js',
                       javascript=[jquery_js])
epiclock_js = JSLink(modname=__name__,
                     filename='static/jquery.epiclock.min.js',
                     javascript=[dateformat_js])

epiclock_css = CSSLink(modname=__name__, filename='static/jquery.epiclock.css')


class Epiclock(Widget):
    """ widget implementation
    """
    template = """<span id="${id}"></span>"""

    javascript = [epiclock_js]
    css = [epiclock_css]

    params = {
        # see included jquery.epiclock.js for more info
        "mode": "one of 'clock', 'explicit', 'countdown', 'countup', \
                    rollover', 'expire', 'loop', 'stopwatch', 'holdup', 'timer'",