#653: Create a tab widget
-------------------------+--------------------------------------------------
Reporter: kevin | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Widgets | Version:
Severity: normal | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by roger.demetrescu):
Alberto, I'm still having problems with CSSLink...
With your patch I can get it:
{{{
>>> css = CSSLink(mod=static, name="sample.css")
>>> css.render()
'<LINK MEDIA="all" HREF="/tg_widgets/turbogears.widgets/sample.css"
TYPE="text/css" REL="stylesheet">'
>>> css.render(media="printer")
'<LINK MEDIA="printer" HREF="/tg_widgets/turbogears.widgets/sample.css"
TYPE="text/css" REL="stylesheet">'
}}}
That is fine. But what I wanted to do is this:
{{{
>>> css = CSSLink(mod=static, name="sample.css", media="printer")
Traceback (most recent call last):
File "<pyshell#45>", line 1, in -toplevel-
css = CSSLink(mod=static, name="sample.css", media="printer")
File "D:\Turbogears\turbogears\widgets\base.py", line 50, in widgetinit
func(self, *args, **kw)
TypeError: __init__() got an unexpected keyword argument 'media'
}}}
So media attribute can't be used in the constructor, just in render().
Maybe I am doing something wrong, but may initial intention was to use the
CSSLink this way:
{{{
#!py
class Tabber(CompoundWidget):
css = [CSSLink(mod=static, name="tabber.css", media="screen"),
CSSLink(mod=static, name="tabber-print.css", media="printer")]
javascript = [JSLink(mod=static, name="tabber.js")]
template = """
<div xmlns:py="http://purl.org/kid/ns#" id="${name}" class="tabber">
<div py:for="tab,defaulttab in tabs"
py:replace='tab.display(defaulttab=defaulttab)' />
</div>
"""
# continue ...
}}}
But as you can imagine, it will cause an error...
AFAIK, CSSLink & CSSSource should be fixed to allow media attribute in
__init__().
Thanks again!
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/653>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---