Commits

olemis  committed d97cd52

Preparing for version 1.4.1.

  • Participants
  • Parent commits b4bb58d

Comments (0)

Files changed (8)

 # A hidden file created by the Mac OS X Finder.
 .DS_Store
 # Compiled Python scripts
-.*.pyc
-.*.pyo
+**/*.pyc
+**/*.pyo
 # Metadata for Python package 
 **/PKG-INFO
 **/*.egg-info
 # Temporary folders
 **/temp
 **/temp/*
+# SVN entries and temp files
+**/.svn/*
+**/*.tmp
+# Build and dist dirs
+trac-dev/gviz/build/**
+trac-dev/gviz/dist/**

File trac-dev/gviz/CHANGES

   a third (i.e. `checked`) element. It also handles unicode 
   characters appropriately.
 
+- MoinMoin encoder now returns `text/x.moin.wiki` MIME type.
+
 - Few optimizations and refactorings (e.g. unnecessary imports have 
   been removed) ... bah!
 

File trac-dev/gviz/TODO

 Outstanding tasks
 -----------------
 
-+ Include all the names of Google's Visualization Gadgets in 
-  GadgetAliases.GOOGLE_GADGETS mapping.
++ Write tests for all features included in TracGViz 1.3.3.
 
-+ Fix MIME types returned by MoinMoin (text/x.moin.wiki) and reStructuredText 
-  (text/restructured, test/x-rst) encoders.
++ Ensure that pictures submitted for image-based gadget borders have 
+  the proper dimensions.
 
-- Test GViz providers for VCS (`svn` + `git` ? + `mtn`).
++ Implement local gadget borders with the help of Trac Resources.
+
++ Implement navigation to Trac Gadgets area.
+
++ GViz API QL: Allow to select the columns to be returned, their 
+  order, and labels.
+
++ GViz API QL: Add support for limitting the number of returned rows, 
+  as well as skipping a given number of first rows.
+
++ Add support for retrieving table data in reStructuredText (rst) 
+  format.
+
++ Use Trac i18n for strings displayed to clients.
+
++ Build a translations catalog for es-ES.
+
+- Test GViz providers for VCS (`git` ? + `mtn`).
 
 - Find the root cause for missing changes in revisions `1`, `3` and 
   `8` (e.g. lack of support in TracMercurial for `copy` events?)
 - Allow people to upload and use their own image and CSS borders in
   gadgets.
 
-- Ensure that pictures submitted for image-based gadget borders have 
-  the proper dimensions.
-
-- Implement local gadget borders with the help of Trac Resources.
-
 - Implement preview capabilities for gadgets and borders.
 
-- Implement navigation to Trac Gadgets area.
-
 - Implement context navigation contributors to Trac Gadgets area.
 
 - Add support for CSS-based and external (HTTP) gadget borders.
 - Optimize the calls to TracRPC's Method objects by preventing 
   them from building lists out of generators.
 
-- GViz API QL: Allow to select the columns to be returned, their 
-  order, and labels.
-
-- GViz API QL: Add support for limitting the number of returned rows, 
-  as well as skipping a given number of first rows.
-
 - GViz API QL: Add tasks to support `from`, `where`, `group by`, 
   `pivot`, `order by`, `format` and `options` clauses.
 
-- Add support for retrieving table data in reStructuredText (rst) 
-  format.
-
 - Allow data source providers to control the details needed to handle 
   queries.
 
   conditions are met e.g. ticket custom fields in 
   `ticket.GVizTicketReport`).
 
-- Use Trac i18n for strings displayed to clients.
-
 - Execute reports defined using URLs to saved custom queries.
 
 - Provide default border images for gadgets.

File trac-dev/gviz/extfmt.py

 from util import render_gviz_value
 
 class GVizMoinEncoder(Component):
-    """MoinMoin wiki encoder for Google Visualization API.
+    r"""MoinMoin wiki encoder for Google Visualization API.
     """
     implements(IGVizTableEncoder)
     
     def supported_versions(self):
-        """Support Google Visualization API version 0.5 and superior.
+        r"""Support Google Visualization API version 0.5 and superior.
         """
         yield ('>=', (0, 5))
     
         return out
     
     def get_format_id(self):
-        """Return 'moin'.
+        r"""Return 'moin'.
         """
         return 'moin'
     
     def get_content_type(self):
-        """MIME-type in this case is `text/plain` AFAIK.
+        r"""MIME-type for MoinMoin wiki formatting is `text/x.moin.wiki`.
         """
         return 'text/x.moin.wiki'
 
 class GVizRstEncoder(Component):
-    """reStructuredText encoder for Google Visualization API.
+    r"""reStructuredText encoder for Google Visualization API.
     """
     implements(IGVizTableEncoder)
     
     def supported_versions(self):
-        """Support Google Visualization API version 0.5 and superior.
+        r"""Support Google Visualization API version 0.5 and superior.
         """
         yield ('>=', (0, 5))
     
         
         @param table the target instance of `gviz_api.DataTable`.
         """
-        return "Not implemented yet"
+        raise NotImplementedError("reStructuredText format is not "
+                                  "supported yet :(")
     
     def get_format_id(self):
-        """Return 'moin'.
+        r"""Return 'moin'.
         """
         return 'rst'
     
     def get_content_type(self):
-        """MIME-type in this case is `text/plain` AFAIK.
+        r"""MIME-type for reStructuredText is `test/x-rst`.
         """
         # TODO : Return more suitable mime type
-        return 'text/plain'
+        return 'test/x-rst'
 

File trac-dev/gviz/gviz_docs.mm

+<map version="0.8.0">
+<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
+<node CREATED="1238206272171" ID="Freemind_Link_709574700" MODIFIED="1238206334625" TEXT="TracGViz">
+<node CREATED="1241143748671" ID="_" MODIFIED="1241143758781" POSITION="right" TEXT="TracLinks">
+<node CREATED="1241143759890" ID="Freemind_Link_1778377561" MODIFIED="1241143767093" TEXT="Google Spreadsheets">
+<node CREATED="1241143774203" ID="Freemind_Link_1787616121" MODIFIED="1241143910062" TEXT="Basic syntax"/>
+<node CREATED="1241143788953" ID="Freemind_Link_892477203" MODIFIED="1241143807515" TEXT="Selecting rows"/>
+<node CREATED="1241143807968" ID="Freemind_Link_1613548852" MODIFIED="1241143818296" TEXT="Header"/>
+<node CREATED="1241143824046" ID="Freemind_Link_719579543" MODIFIED="1241143946328" TEXT="iGoogleGadget">
+<node CREATED="1241143948593" ID="Freemind_Link_1500056872" MODIFIED="1241143983375" TEXT="GViz gadget data source"/>
+</node>
+</node>
+<node CREATED="1241144020796" ID="Freemind_Link_1658560106" MODIFIED="1241144022156" TEXT="Google Apps Reporting Visualization API "/>
+<node CREATED="1241144026093" ID="Freemind_Link_544164706" MODIFIED="1241144034296" TEXT="Standard visualizations"/>
+</node>
+</node>
+</map>

File trac-dev/gviz/setup.py

     (1, 3, 1),
     (1, 3, 2),
     (1, 3, 3),
+    (1, 4, 1),
     ]
     
 latest = '.'.join(str(x) for x in versions[-1])

File trac-dev/gviz/void/__init__.py

Empty file added.

File trac-dev/gviz/yt/wiki.py

+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+# Copyright 2009-2011 Olemis Lang <olemis at gmail.com>
+#
+#   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.
+
+"""Embed Youtube players and widgets using WikiFormatting.
+"""
+
+from trac.core import Interface, Component, ExtensionPoint, \
+        implements, TracError
+from trac.config import Option
+from trac.mimeview.api import Context
+from trac.util import get_pkginfo
+from trac.web.api import IRequestHandler, RequestDone
+from pkg_resources import resource_string, resource_filename
+from trac.env import IEnvironmentSetupParticipant
+from trac.perm import IPermissionRequestor
+from trac.web.api import IRequestHandler
+from trac.web.chrome import ITemplateProvider, add_stylesheet
+from trac.wiki.api import IWikiSyntaxProvider, parse_args
+from trac.wiki.macros import WikiMacroBase
+from trac.wiki.formatter import Formatter
+
+from genshi.core import Markup
+from genshi.builder import tag, Element
+
+__all__ = ('YoutubeEmbeddedPlayer',)
+
+class YoutubeEmbeddedPlayer(WikiMacroBase):
+    """TODO
+    """
+    
+    # TODO: Reuse iGoogleGadget's method. Refactor both these methods
+    # to be in `utils` module
+    @staticmethod
+    def resolve_link_url(formatter, link_text):
+        """Resolve a TracLinks expression.
+        
+        @param link_text the TracLinks expression.
+        @return the location (i.e. URL) this link is pointing to.
+        """
+        req, env, ctx = formatter.req, formatter.env, formatter.context
+        abs_ref, href = (req or env).abs_href, (req or env).href
+        lf = FirstTracLinkFormatter(env, ctx)
+        lf.format(link_text)
+        return lf.first_link
+    
+    MACRO_DEFAULTS = dict(
+            title='', width=320, height=200, output='js',
+            lang='en_US', country='ALL',
+            border=r"#ffffff|1px,1px solid black|1px,1px" \
+                        " solid black|0px,1px black"
+            )
+    
+    def expand_macro(self, formatter, name, contents):
+        _, args = parse_args(contents)
+        self.log.debug('IG: iGoogleGadgetMacro -> args = %s', args)
+        url = self.resolve_link_url(formatter, args.get('url', ''))
+        if not url:
+            raise TracError("Unknown gadget : 'url' argument " \
+                            "is either wrong or missing")
+        del args['url']
+        defaults = self.MACRO_DEFAULTS
+        spec_args = dict([arg, args.pop(arg, defval)] 
+                        for arg, defval in defaults.iteritems())
+        spec_args['w'] = spec_args.pop('width')
+        spec_args['h'] = spec_args.pop('height')
+        border = self.resolve_link_url(formatter, spec_args['border'])
+        if border:
+            spec_args['border'] = border
+        gadget_params = dict(chain([('url', url), ('synd', 'open')],
+                (('up_' + k, v) for k, v in args.iteritems()), # user preferences ;)
+                spec_args.iteritems()))
+        url = urlunparse(['http', 'gmodules.com', '/ig/ifr', '', \
+                        urlencode(gadget_params), ''])
+        
+        self.log.debug("IG: Gadget preferences %s", gadget_params)
+        return Markup('<script src="%s"></script>' % (url,))
+
+