473,608 Members | 2,667 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 3201
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

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

Similar topics

14
2201
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 people have problems running LAMP applications on it. It would be cool to be able to run any LAMP application on sourceforge on a handheld computer.
5
3003
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 platform. -- Grant Edwards grante Yow! Am I accompanied by at a PARENT or GUARDIAN? visi.com
35
7746
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 GUI toolkit that is cross-platform for Python, and am leaning toward PyQt (PyGTK is kind of dull looking in comparison). Unfortunately, although TrollTech says Qt is cross-platform, its license strategy has me a bit confused. So here is to...
8
4845
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 wxWindows, but am confused with all the Windows licensing issues. For the moment this is just for my own tinkering and utility apps, but
11
1472
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
2154
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 go with it eventually!) I'm currently using PyQt 3.12 that comes with the BlackAdder demo, it seems to work fine with Python 2.3.5 except that it doesn't support the WinXP look'n'feel, the QStyle "WindowsXP" isn't included, and using a...
10
5174
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 scroll view. sc=QScrollView(self) layout=QGridLayout(..., sc.viewport()) sc.addChild(layout) results in a TypeError.
4
5257
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 the IE process' activity and don't want PyQt to wait until the browser is closed. I tried the following code from within a PyQt app: import os url = 'http://server.domain.com/page.html' os.system('start %s' % url)
0
958
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 modules and functions.) If you have a Zaurus, and like python, welcome to use it. I post it on here: http://bean-pig.idv.tw/emb_study/archives/001049.html
0
8472
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8464
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8130
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6805
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5471
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3954
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4015
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2464
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1574
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.