473,513 Members | 2,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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'>&lt;me&gt;</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">&lt;me&gt;</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?
Jul 18 '05 #1
12 3193
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">&lt;me&gt;</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
Jul 18 '05 #2
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
Jul 18 '05 #3
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>


Jul 18 '05 #4
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?
Jul 18 '05 #5
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
Jul 18 '05 #6
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?
Jul 18 '05 #7
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?
Jul 18 '05 #8
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>


Jul 18 '05 #9
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?
Jul 18 '05 #10
Tim Gerla enlightened us with:
Very fun stuff. Someday I hope to have a Zaurus or similar device to
toy with.


For those interested: I've put up some screenshots of my jabber client,
Discuss Jabber, at http://zaurus.thirdtower.com/

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?
Jul 18 '05 #11
Are you intended on releasing the source for this? If so, dump something up
there so we can play ;o)

Greg Fortune

Sybren Stuvel wrote:
Tim Gerla enlightened us with:
Very fun stuff. Someday I hope to have a Zaurus or similar device to
toy with.


For those interested: I've put up some screenshots of my jabber client,
Discuss Jabber, at http://zaurus.thirdtower.com/

Sybren


Jul 18 '05 #12
Greg Fortune enlightened us with:
Are you intended on releasing the source for this? If so, dump
something up there so we can play ;o)


Yes, I am going to release the source for this ;-) I'll post it on
http://zaurus.thirdtower.com/ when I'm a bit further in the building
process. I'll let the group know when I do that!

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?
Jul 18 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
2193
by: Ranger West | last post by:
Hello there, Are there any out-of-the box handhelds that run Linux/Apache/MYSQL and PHP? Does Redhat, Suse, or Gentoo support any handhelds? I know the Zaurus comes close, but I've heard...
5
3000
by: Grant Edwards | last post by:
I see there's a Python binary package available for the Sharp Zaurus PDA. Has anybody deleloped an app for that platform? I'm wondering if the resource requirement of Python are a problem on that...
35
7718
by: Vamsi Mudrageda | last post by:
I am kind of new to Python, and after trying and using wxPython, I found it kind of lacking in easy-to-read documentation, speed at loading, and GUI response-time. So I am looking for an another...
8
4838
by: simo | last post by:
OK, so I'm at the stage where I want to make a choice between wxPython and PyQt. Currently I'm using wxPython mainly due to the fact that it has GPL Linux and Windows versions. I prefer Qt to...
11
1460
by: Jorge Godoy | last post by:
Anybody here doing Python development on PDAs running with PalmOS? What are you using? PipPy is still Python 1.5.2... TIA, -- Godoy. <godoy@ieee.org>
10
2136
by: Simon John | last post by:
After quite a while of wxPython I'm getting back into PyQt, mainly due to the announcement by Trolltech that they will make a GPL version of Qt4 for Windows (and Phil-T said he will make a PyQt to...
10
5161
by: Volker Lenhardt | last post by:
For a QApplication (PyQt) on the small screen of my Zaurus 5500 PDA I try to layout my data output in a QScrollView as the central widget. I'd prefer to use QGridLayout, but cannot add it to the...
4
5238
by: gregarican | last post by:
What's the easiest and cleanest way of having PyQt bring up an external application? In this case I am looking to launch Internet Explorer and bring up a specific URL. I don't care about tracking...
0
954
by: ThomasC | last post by:
Hi, I'm a python newbie, I learn it on my notebook, but it too heavy and too big. I try to porting python2.5 to my Zaurus, It running on Zaurus well, (just for my study, I didn't test all...
0
7267
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7120
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5697
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4754
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.