![]() |
PyQT, Sharp Zaurus and color in the QTextBrowser
Hi there!
I'm a beginning Python programmer, and I like it a lot already. Since my Sharp Zaurus has a fairly complete Python environment including PyQT, I thought it would be the perfect language for programming some nice things on my Zaurus. The thing I really missed on the Z was a good Jabber client. That's why I'm building my own. Things are going good, and in a few nights I've been able to get a fairly decent though under-featured client. There is a small thing annoying me, though I'm trying to show the name of the person saying something in color: red = someone else, blue = me. This is an example of the text I'm adding to the QTextBrowser: <font color='#0000ff'><me></font>: hello world It works like a charm on my PC, but on the Zaurus the text is all black. Does anyone know how I can fix this? ~~~ brainwave flash ~~~ I just thought of something: what if the Z doesn't allow single quotes around the "color" attribute? I gave it a try, and replaced the text with: <font color="#0000ff"><me></font>: hello world And it works! Anyways, perhaps this will be picked up by others having the same problem. I'll stick around in this group and try to soak up as many good knowledge from people as I can ;-) A bit about myself: I'm a 24 year old, studying Computer Sciences at the University of Amsterdam, I'm Dutch (like Guido ;-)) and I currently live in Amsterdam too. I've been a programmer for half my life now :) Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? |
Re: PyQT, Sharp Zaurus and color in the QTextBrowser
> I just thought of something: what if the Z doesn't allow single quotes > around the "color" attribute? I gave it a try, and replaced the text > with: > > <font color="#0000ff"><me></font>: hello world > > And it works! > Very fun stuff. Someday I hope to have a Zaurus or similar device to toy with. Anyway, to actually be on topic, "proper" HTML (XHTML 1.0, and maybe HTML 4.0? I don't recall...) requires double-quotes to be used. Single quotes are illegal. So, the Qt version your Zaurus is using must be a little more strict. -Tim |
Re: PyQT, Sharp Zaurus and color in the QTextBrowser
Tim Gerla wrote:
> Anyway, to actually be on topic, "proper" HTML (XHTML 1.0, and > maybe HTML 4.0? I don't recall...) requires double-quotes to be > used. Single quotes are illegal. XHTML 1.0 is XML, which allows both single quotes and double quotes: http://www.w3.org/TR/REC-xml#NT-AttValue HTML 4 is derived from SGML, which also supports both single and double quotes, and also allows unquoted values, in some cases: http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 </F> |
Re: PyQT, Sharp Zaurus and color in the QTextBrowser
Tim Gerla wrote:
> > Very fun stuff. Someday I hope to have a Zaurus or similar device to > toy with. Anyway, to actually be on topic, "proper" HTML (XHTML 1.0, > and maybe HTML 4.0? I don't recall...) requires double-quotes to be > used. Single quotes are illegal. Are you certain about that? It seems very unlikely that it would outlaw use of single quotes when it is supposed to be XML-compatible, and XML explicitly allows either single or double quotes around attributes. I checked a page or two at W3C and couldn't find an obvious way to prove that you are wrong, but I think the onus is on you to prove that you are right here. -Peter |
Re: PyQT, Sharp Zaurus and color in the QTextBrowser
Peter Hansen enlightened us with:
> Are you certain about that? It seems very unlikely that it would > outlaw use of single quotes when it is supposed to be XML-compatible, > and XML explicitly allows either single or double quotes around > attributes. I can't find it right now, but I've had the same discussion with a few collegues of mine, and according to W3C, both single and double quotes are accepted for both HTML and XML, and thus XHTML too. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? |
Re: PyQT, Sharp Zaurus and color in the QTextBrowser
On Mon, 2003-07-14 at 14:30, Peter Hansen wrote:
> Tim Gerla wrote: > > > > Very fun stuff. Someday I hope to have a Zaurus or similar device to > > toy with. Anyway, to actually be on topic, "proper" HTML (XHTML 1.0, > > and maybe HTML 4.0? I don't recall...) requires double-quotes to be > > used. Single quotes are illegal. > > Are you certain about that? It seems very unlikely that it would > outlaw use of single quotes when it is supposed to be XML-compatible, > and XML explicitly allows either single or double quotes around attributes. You're right--I was under the wrong impression about single & double quotes. For some reason I recall reading somewhere (can't trust everything you read online) that XML only allowed double quotes, and I never bothered to verify it. Anyway, does that mean that the Qt parser has a bug? -Tim |
Re: PyQT, Sharp Zaurus and color in the QTextBrowser
Tim Gerla enlightened us with:
> Anyway, does that mean that the Qt parser has a bug? If it wants to be HTML-compliant: yes. If it wants to use HTML-like codes for markup: no Al least, that's the way I see it. I dont't know Trolltech's intentions. I'll check out the docs. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? |
Re: PyQT, Sharp Zaurus and color in the QTextBrowser
Jeremy Bowers enlightened us with:
> The confusion probably stems from the fact that as of the latest XHTML > specification at the time I read it, every single example XHTML > fragment used double quotes. At no point is it ever specified either > way in the XHTML specification, except by reference to the XML > specification. Got a point there. I use single quotes all the time thouhg, in HTML generated in PHP: <?php echo "<span class='$class'>$msg</span>" ?> It's a lot better than something I otHften see in other people's code: echo "<span class=\"$class\">$msg</span>" Doing it the other way around doesn't work, since PHP doesn't do variable substitution between single quotes. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? |
Re: PyQT, Sharp Zaurus and color in the QTextBrowser
Jeremy Bowers wrote:
> At no point is it ever specified either way in the XHTML specification, > except by reference to the XML specification. which is the whole point, of course. (we've been through this in the XML-RPC and RSS universes lately; for some reason, some people have a really hard time understanding that when you base a format on XML, you get more than just tags in angle brackets ;-) </F> |
[OT] Re: Single or Double quotes [was Re: PyQT, Sharp Zaurus and color in the QTextBrowser]
Jeremy Bowers enlightened us with:
> At no point is it ever specified either way in the XHTML > specification, except by reference to the XML specification. I'm sorry to tell you, but you're wrong in that. It is clearly stated in the HTML 4.01 specification at http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2 I found that by going to the index, looking up the item "attibutes" and then clicking the link at "quotation marks around value". Not that hard to find. The XML specification of attributes can be found at http://www.w3.org/TR/REC-xml#sec-common-syn and is a little harder to find, but not impossible. Since XHTML 1.0 is defined as "A Reformulation of HTML 4 in XML 1.0", this should be enough to also allow single and double quoted attribute values in XHTML. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? |
| All times are GMT. The time now is 10:07 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.