1. Ralph Bean
  2. tw2.jqplugins.jqplot

Commits

Ralph Bean  committed 28b057f Merge

Merge branch 'release/2.0.0'

  • Participants
  • Parent commits 4ec56d8, 9ce4c4b
  • Branches default

Comments (0)

Files changed (6)

File README.rst

View file
 tw2.jqplugins.jqplot
 =========================
 
-:Author: Ralph Bean <ralph.bean@gmail.com>
+:Author: Ralph Bean <rbean@redhat.com>
 
 .. comment: split here
 
 
 Links
 -----
-Get the `source from github <http://github.com/ralphbean/tw2.jqplugins.jqplot>`_.
+Get the `source from github <http://github.com/toscawidgets/tw2.jqplugins.jqplot>`_.
 
 `PyPI page <http://pypi.python.org/pypi/tw2.jqplugins.jqplot>`_
-and `bugs <http://github.com/ralphbean/tw2.jqplugins.jqplot/issues/>`_
+and `bugs <http://github.com/toscawidgets/tw2.jqplugins.jqplot/issues/>`_
 
 Description
 -----------
 
 This module, tw2.jqplugins.jqplot, provides `toscawidgets2 (tw2)`_ access
 to `jqPlot`_ widgets.
+
+Sampling tw2.jqplugins.jqplot in the WidgetBrowser
+--------------------------------------------------
+
+The best way to scope out ``tw2.jqplugins.jqplot`` is to load its widgets in the
+``tw2.devtools`` WidgetBrowser.  To see the source code that configures them,
+check out ``tw2.jqplugins.jqplot/tw2/jqplugins/jqplot/samples.py``
+
+To give it a try you'll need git, python, and `virtualenvwrapper
+<http://pypi.python.org/pypi/virtualenvwrapper>`_.  Run::
+
+    $ git clone git://github.com/toscawidgets/tw2.jqplugins.jqplot.git
+    $ cd tw2.jqplugins.jqplot
+    $ mkvirtualenv tw2.jqplugins.jqplot
+    (tw2.jqplugins.jqplot) $ pip install tw2.devtools
+    (tw2.jqplugins.jqplot) $ python setup.py develop
+    (tw2.jqplugins.jqplot) $ paster tw2.browser
+
+...and browse to http://localhost:8000/ to check it out.

File development-deps/develop-tw2-destroy-and-setup.sh

-#!/bin/bash -e
-
-devbase=development-deps
-venv=$devbase/virtualenv-tw2.jquery
-$(
-    rm -rf $venv
-) || echo "Did not destroy $venv"
-
-virtualenv $venv --no-site-packages
-
-source $venv/bin/activate
-
-pushd $devbase
-
-pip install genshi
-pip install mako
-pip install formencode
-
-hg clone http://bitbucket.org/paj/tw2core || \
-        (pushd tw2core && hg pull && popd)
-hg clone http://bitbucket.org/paj/tw2devtools || \
-        (pushd tw2devtools && hg pull && popd)
-hg clone http://bitbucket.org/paj/tw2forms || \
-        (pushd tw2forms && hg pull && popd)
-hg clone http://bitbucket.org/toscawidgets/tw2jquery || \
-        (pushd tw2jquery && hg pull && popd)
-git clone http://github.com/ralphbean/tw2.jquery.plugins.ui.git || \
-        (pushd tw2.jquery.plugins.ui && git pull && popd)
-#hg clone https://ralphbean@bitbucket.org/toscawidgets/tw2jquery || \
-#        (pushd tw2jquery && hg pull && popd)
-
-pushd tw2core ;  python setup.py install ; popd
-pushd tw2forms ; python setup.py install ; popd
-pushd tw2devtools ; python setup.py install ; popd
-pushd tw2jquery ; python setup.py install_lib install_egg_info ; popd
-pushd tw2.jquery.plugins.ui ; python setup.py install_lib install_egg_info ; popd
-
-popd # $devbase

File development-deps/develop-tw2-start.sh

-#!/bin/bash
-
-devbase=development-deps
-venv=$devbase/virtualenv-tw2.jquery
-source $venv/bin/activate
-
-python setup.py install_lib install_egg_info && paster tw2.browser
-
-
-

File setup.py

View file
 
 setup(
     name='tw2.jqplugins.jqplot',
-    version='2.0b4',
+    version='2.0.0',
     description='toscawidgets2 wrapper for the jqPlot jQuery plugin',
     long_description=long_description,
     author='Ralph Bean',
-    author_email='ralph.bean@gmail.com',
+    author_email='rbean@redhat.com',
     license='MIT',
-    url='http://github.com/ralphbean/tw2.jqplugins.jqplot',
+    url='http://github.com/toscawidgets/tw2.jqplugins.jqplot',
     install_requires=[
         "tw2.core>=2.0b2",
         "tw2.jqplugins.ui",

File tw2/jqplugins/jqplot/__init__.py

View file
 """ TW2 widget wrapper the jquery ui jqplot
 
-Get the source from http://github.com/ralphbean/tw2.jqplugins.jqplot
+Get the source from http://github.com/toscawidgets/tw2.jqplugins.jqplot
 """
 
 from widgets import *

File tw2/jqplugins/jqplot/static/js/jqplot-utils.js

View file
 /* Some workhorse functions for tw2.jquery.plugins.jqplot */
 
 function doJQPlotWidget(sel, data, options){
-        $.jqplot.config.enablePlugins = true;
-        $.jqplot(sel, data, options);
+    $.jqplot.config.enablePlugins = true;
+    $.jqplot(sel, data, options);
 }
 
 // closure
 function make_jqplot_async_callback(pl) {
-        return function (json) {
-                for ( _i = 0; _i < json.data.length; _i++ ) {
-                        pl.series[_i].data = json.data[_i] ;
-                }
-                for (ax in json.options.axes) {
-                        pl.axes[ax]._ticks = []
-                        if ( 'axes' in json.options &&
-                                ax in json.options.axes &&
-                                'min' in json.options.axes[ax] ) {
-                                pl.axes[ax].min = json.options['axes'][ax].min;
-                                pl.axes[ax].max = json.options['axes'][ax].max;
-                        }
-                        pl.axes[ax].numberTicks = null
-                        pl.axes[ax].tickInterval = null
-                        pl.axes[ax]._tickInterval = null
-                }
-                pl.redraw();
-        };
+    return function (json) {
+        for ( _i = 0; _i < json.data.length; _i++ ) {
+            pl.series[_i].data = json.data[_i] ;
+        }
+        for (ax in json.options.axes) {
+            pl.axes[ax]._ticks = []
+            if ( 'axes' in json.options &&
+                ax in json.options.axes &&
+                'min' in json.options.axes[ax] ) {
+                pl.axes[ax].min = json.options['axes'][ax].min;
+                pl.axes[ax].max = json.options['axes'][ax].max;
+            }
+            pl.axes[ax].numberTicks = null
+            pl.axes[ax].tickInterval = null
+            pl.axes[ax]._tickInterval = null
+        }
+        pl.redraw();
+    };
 }
 
 function doPollingJQPlotWidget(sel, data, options, url, url_kwargs, interval){
-        $.jqplot.config.enablePlugins = true;
+    if (typeof(window._tw2_jqplots)=='undefined') window._tw2_jqplots = {};
 
-        // Setup our initial plot
-        var the_plot_thickens = $.jqplot(sel, data, options);
+    $.jqplot.config.enablePlugins = true;
 
-        var callback = make_jqplot_async_callback(the_plot_thickens);
+    // Setup our initial plot
+    var the_plot_thickens = $.jqplot(sel, data, options);
 
-        // Finally make the JSON call
-        $.getJSON(url, url_kwargs, callback);
+    var callback = make_jqplot_async_callback(the_plot_thickens);
+    window._tw2_jqplots[sel] = callback;
 
-        // And if we want to keep polling, do it
-        if ( interval > 0 ) {
-                setInterval( function() {
-                        $.getJSON(url, url_kwargs, callback);
-                }, interval );
-        }
+    // Finally make the JSON call
+    $.getJSON(url, url_kwargs, callback);
+
+    // And if we want to keep polling, do it
+    if ( interval > 0 ) {
+        setInterval( function() {
+            $.getJSON(url, url_kwargs, callback);
+        }, interval );
+    }
 
 }