[PyKDE] PyQT for QT4 ?

2004-12-24 Thread Michael Sparks
I expect the answer here is either "no" or "not yet", but here goes :)

Has anyone tried builting PyQT for QT4, on the off chance that large
swathes work? (You never know :) Better yet, has anyone got QT4 working
with Python?

(I've noticed that alot of the irritations I have with the QTextEdit have
been resolved in QT4, hence the query)

I doubt the answer is yes, but as they say, you don't know unless you ask
:)

Merry Christmas,


Michael.

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


[PyKDE] Solved: Re: Inserting Rich Text in a QTextEdit

2004-12-20 Thread Michael Sparks
On Mon, 20 Dec 2004, Michael Sparks wrote:
> I've been using a QTextEdit for a while as a simple rich text editor, and
> recently been playing with various ideas and have hit a bit of a block.
> Essentially what I want to do is this:
>
[ question wanting
editor.insert(""+str(page)+""  )
  to actually insert that as rich text (ie add the tags as tags) rather
  than interpreted as plain text ]

OK, in case the silence was "no idea" (I did a bunch of web searches that
came up blank - both before and after posing the q) I've settled on this
approach which works:

 if editor.hasSelectedText():
text = editor.selectedText()
editor.removeSelectedText()
 else:
text = page
 editor.setUpdatesEnabled( 0)
 q=editor.getCursorPosition()
 editor.append(""+str(text)+""  )
 paraCount = editor.paragraphs()
 print editor.paragraphLength(paraCount-1)
 editor.setSelection(paraCount-1,0,paraCount-1, 
editor.paragraphLength(paraCount-1))
 editor.cut()
 editor.setCursorPosition(*q)
 editor.paste()
 editor.setUpdatesEnabled( 1)
 editor.updateContents()

Context:

I have an edittable drop down which may contain either page names or URLs.
When the user selects one (or types in a new page name or URL), the
current section is used as the link text, and page name/URL used as the
link target. If there isn't a current selection, the page name/URL is used
as the link text.

I suppose you could generalise this as:

def insertRichText(editor, someText):
 if editor.hasSelectedText():
text = editor.selectedText()
editor.removeSelectedText()
 else:
text = page
 editor.setUpdatesEnabled( 0)
 q=editor.getCursorPosition()
 editor.append(str(someText))
 paraCount = editor.paragraphs()
 print editor.paragraphLength(paraCount-1)
 editor.setSelection(paraCount-1,0,paraCount-1, 
editor.paragraphLength(paraCount-1))
 editor.cut()
 editor.setCursorPosition(*q)
 editor.paste()
 editor.setUpdatesEnabled( 1)
 editor.updateContents()

If you use a custom stylesheet, this should also mean that you can use
this approach for inserting anything into the current position in the
document.


Michael.

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


[PyKDE] Inserting Rich Text in a QTextEdit

2004-12-19 Thread Michael Sparks
Hi,


I've been using a QTextEdit for a while as a simple rich text editor, and
recently been playing with various ideas and have hit a bit of a block.
Essentially what I want to do is this:

   editor.insert(""+str(page)+""  )

And have that rendered _and stored in the text_(*) as a hyperlink - ie the
above line results in (with defaults) "page" being rendered underlined in
blue.
   (*) Hence a stylesheet isn't an option here :-(

Instead however what I see in the editor is this:

  Somepage

(Which gets saved as 

Re: [PyKDE] A simple PyQt program

2004-06-26 Thread Michael Sparks
On Sat, 26 Jun 2004, Joshua wrote:

> Hi,
>
> TypeError: update() takes exactly 2 arguments (3 given)
...
> win2.update(self, command)

This has 3 arguments to the update command.

Your arguments are (win2, self, command) - the win2 is an implicit first
argument.

I haven't looked through your code much, since I suspect this is the bit
stumping you, but I suspect what you want is either:

   win2.update(command)
   self.update(command)

I suspect the former of the 2.


Michael.


___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


Re: [PyKDE] Seek: Qt based, rich text editor written in PyQt

2004-06-15 Thread Michael Sparks
On Monday 14 June 2004 10:24 am, Andrew Smart wrote:
> Hi,
>
> I currently seek a Qt based, rich text editor written in PyQt.
>
> The Qt included "rich text editor control" is not sufficient for
> our requirement profile, unfortunatly.

What's wrong with it - what do you find is missing from it? Personally I
find it a pretty useful widget. (And in fact it's the sole reason I'm
using PyQT rather than wx windows or similar)


Michael.

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


[PyKDE] Scribbling on QTextEdit/QTextBrowser

2004-05-25 Thread Michael Sparks
Hi,


I'm playing with PyQT under Linux at the moment... I'm wondering - is
there a way of mixing _something like_ QPainter with both/either
QTextEdit/QTextBrowser. The scenario I'm thinking of is scribbling notes
on these as annotations.  (for example running on a PDA/tablet PC2)
Something similar to DHTML layers would be the ideal sort of scenario...

The question I have is this - is this possible with PyQT?

I've looked at the QGL overlay stuff, but this seems to be very dependent
on facilities in your display system. (That wouldn't be a problem, but it
appears the X-Server for my graphics card is one of the ones that doesn't
support overlay!)

Failing that, does anyone know of a way of anchoring something like a
QPainter widget inside QTextEdit/QTextBrowser in the same way you would
anchor an image ? (This might actually be a more appropriate approach IMO)

Any comments/pointers very much appreciated :)


Michael.

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde