Re: [PyQt] ipython, pdb and pyQT

2009-07-14 Thread Ville M. Vainio
On Mon, Jul 13, 2009 at 5:03 PM, TheLonelyStarnabb...@lonely-star.org wrote:

 I am trying to debug a pyQt application from ipython using pdb.
 I get lots of

 QCoreApplication::exec: The event loop is already running

If you are on Linux, you may want to explore PuDB (
http://pypi.python.org/pypi/pudb ). It has the huge advantage of not
using readline.

Another thing to google for is pyqtRemoveInputHook.

One thing to try is *not* doing QCoreApplication::exec (just remove
exec_ from your program). readline spins the mainloop in itself
(PyOS_InputHook), so your events get handled.

-- 
Ville M. Vainio
http://tinyurl.com/vainio
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Documentation

2009-07-14 Thread Arve Knudsen
An alternative at least is to browse the online documentation at
docs.trolltech.com.

Arve

On 7/14/09, Peter Stewart peterstew...@telus.net wrote:
   I've just downloaded Pyqt4 using the binary package for windows option. 
 The
 documentation wasn't included as it was too big.  Now the Assistant won't
 load anything that's not a .qch file and I can't find the documentation to
 download in this form..thanks  Peter

 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
Sent from my mobile device
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Documentation

2009-07-14 Thread Arve Knudsen
Sorry, the link should be doc.trolltech.com.

Arve

On 7/14/09, Arve Knudsen arve.knud...@gmail.com wrote:
 An alternative at least is to browse the online documentation at
 docs.trolltech.com.

 Arve

 On 7/14/09, Peter Stewart peterstew...@telus.net wrote:
  I've just downloaded Pyqt4 using the binary package for windows option.
 The
 documentation wasn't included as it was too big.  Now the Assistant won't
 load anything that's not a .qch file and I can't find the documentation
 to
 download in this form..thanks  Peter

 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt


 --
 Sent from my mobile device


-- 
Sent from my mobile device
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Is there a logical link bewtween C++ methods and Python methods for QScintilla ?

2009-07-14 Thread projetmbc

Hello,
I've seen some C++ lexers using   styler.SetLevel(nbLine,nbLevel)   so 
as to do folding. Is there an equivalent of it ?


Best regards.

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Is there a logical link bewtween C++ methods and Python methods for QScintilla ?

2009-07-14 Thread Phil Thompson
On Tue, 14 Jul 2009 12:55:07 +0200, projetmbc projet...@club-internet.fr
wrote:
 Hello,
 I've seen some C++ lexers using   styler.SetLevel(nbLine,nbLevel)   so 
 as to do folding. Is there an equivalent of it ?

The internal C++ lexers use functions that are not part of the published
Scintilla API. Look at SCI_SETFOLDLEVEL instead.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


RE: [PyQt] Documentation

2009-07-14 Thread Peter Stewart
Yes, I appreciate that I have access to the online documentation. However I
cannot run the tutorial or the examples script: qtdemo.pyw. In fact when I
try to run it, I'm presented with a warning message If you are using the
GPL version on PyQt from the binary installer, then you will probably see
warning messages about missing documentation. I'd sure like to see that
tutorial.
Thanks for the response Arve.
Peter


Sorry, the link should be doc.trolltech.com.

Arve

On 7/14/09, Arve Knudsen arve.knud...@gmail.com wrote:
 An alternative at least is to browse the online documentation at
 docs.trolltech.com.

 Arve

 On 7/14/09, Peter Stewart peterstew...@telus.net wrote:
  I've just downloaded Pyqt4 using the binary package for windows option.
 The
 documentation wasn't included as it was too big.  Now the Assistant won't
 load anything that's not a .qch file and I can't find the documentation
 to
 download in this form..thanks  Peter


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: PyQt v4.5.2 Released

2009-07-14 Thread Phil Thompson
PyQt v4.5.2 has been released and is available from the usual place.

This is primarily a bug fix release, see
http://www.riverbankcomputing.com/news/pyqt-452 for the detail.

A warning for any Python v3 users...

The next planned release of PyQt will be v4.6 and will include support for
the incompatible API changes described in the Roadmap. Based on feedback on
the mailing list I had agreed to follow the guidance that API changes
should not be introduced when porting from Python v2 to v3. However I've
changed my mind and in PyQt v4.6 the default APIs for Python v3 will be the
incompatible versions (eg. QString will not exist). My justification is...

- the newer APIs are more Pythonic than the original ones and so should be
  the preferred ones for Python v3

- each of the older APIs can be restored with a single function call.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] ANN: PyQt v4.5.2 Released

2009-07-14 Thread Giovanni Bajo

On 7/14/2009 6:52 PM, Phil Thompson wrote:

PyQt v4.5.2 has been released and is available from the usual place.

This is primarily a bug fix release, see
http://www.riverbankcomputing.com/news/pyqt-452 for the detail.

A warning for any Python v3 users...

The next planned release of PyQt will be v4.6 and will include support for
the incompatible API changes described in the Roadmap. Based on feedback on
the mailing list I had agreed to follow the guidance that API changes
should not be introduced when porting from Python v2 to v3. However I've
changed my mind and in PyQt v4.6 the default APIs for Python v3 will be the
incompatible versions (eg. QString will not exist). My justification is...

- the newer APIs are more Pythonic than the original ones and so should be
  the preferred ones for Python v3

- each of the older APIs can be restored with a single function call.


FWIW, I had spoken against binding the API change to the Python v3 
change, but the default is irrelevant to me. As long as both APIs are 
available on both Python versions through a simple function call at 
startup, I'm perfectly fine.

--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Small paid development task

2009-07-14 Thread Jason H

I mentioned last week that I was looking to get some of the Kinetic project's 
bindings into PyQt. Unfortunately, it is going slow, and my time has had me 
working things where I am more productive. I am now offering anyone up to 
$200US via paypal to get these patched into the latest PyQt 4.5.2 snapshot. I 
am hoping this code will be done in a way (quality, style, license) that it can 
be used by Phil in the PyQt 4.6 release. I just need to test these features 
sooner than later, and the next Qt release is 6-9 months off. 

In order to get these classes, you'll have to get Qt/master or Qt/master-stable 
out of the git repo. Part of deleivery, aside from sip files is to then provide 
instructions on how to drop it into a PyQt 4.5.2 installation. 

Classes I need immediately for my test: ($100)
* QAbstractAnimation 
* QAnimationGroup 
* QEasingCurve 
* QParallelAnimationGroup 
* QPropertyAnimation 
* QSequentialAnimationGroup 
* QVariantAnimation 

Not so immediate, but would like to have them eventually: ($100)
* QGraphicsWidget 
* QAbstractState 
* QAbstractTransition 
* QActionState 
* QEventTransition 
* QFinalState 
* QHistoryState 
* QKeyEventTransition 
* QMouseEventTransition 
* QSignalEvent 
* QSignalTransition 
* QState 
* QStateAction 
* QStateFinishedEvent 
* QStateFinishedTransition 
* QStateInvokeMethodAction 
* QtStateMachine 
* QTransition 

I figure it's a cool opportunity to get paid for something that has to be done 
anyway. 

Thanks



  
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Problem to make the use of folder with QScintilla (even with traditional lexer)

2009-07-14 Thread projetmbc

Hello,
normally,  
self.editor.setFolding(Qsci.QsciScintilla.BoxedTreeFoldStyle)  asks to 
the QScintilla widget to reduce or expand foldings by using the mouse. 
This doesn't work in the joined code even if foldings are marked by a 
vertical line.


What's the problem with the way I define options of the editor ? Here is 
a piece of code :

=
class MainWindow(QtGui.QMainWindow):
   def __init__(self):
   QtGui.QMainWindow.__init__(self)
   self.setWindowTitle('Custom Lexer Example')
   self.setGeometry(QtCore.QRect(50,200,400,400))
   self.editor = Qsci.QsciScintilla(self)
   self.editor.setUtf8(True)

   self.editor.setFolding(Qsci.QsciScintilla.BoxedTreeFoldStyle)
  
   self.setCentralWidget(self.editor)

   self.lexer = CustomLexer(self.editor)
   self.editor.setLexer(self.lexer)
   self.editor.setText('\n# sample source\n\nfoo = 1\nbar = 2\n')

class CustomLexer(Qsci.QsciLexerCustom):
  ..
=

Best regards.
Christophe.
#!/usr/bin/env python
#coding=utf-8
import sys
from PyQt4 import QtCore, QtGui, Qsci

# Code given by Baz WALTER on the PyQt list

class MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.setWindowTitle('Custom Lexer Example')
self.setGeometry(QtCore.QRect(50,200,400,400))
self.editor = Qsci.QsciScintilla(self)
self.editor.setUtf8(True)

self.editor.setFolding(Qsci.QsciScintilla.BoxedTreeFoldStyle)

self.setCentralWidget(self.editor)
self.lexer = CustomLexer(self.editor)
self.editor.setLexer(self.lexer)
  
self.editor.setText('\n# sample source\n\nfoo = 1\nbar = 2\n')


class CustomLexer(Qsci.QsciLexerCustom):
def __init__(self, parent):
Qsci.QsciLexerCustom.__init__(self, parent)
self._styles = {
0: 'Default',
1: 'Comment',
2: 'Key',
3: 'Assignment',
4: 'Value',
}
for key,value in self._styles.iteritems():
setattr(self, value, key)

def description(self, style):
return self._styles.get(style, '')

def defaultColor(self, style):
if style == self.Default:
return QtGui.QColor('#00')
elif style == self.Comment:
return QtGui.QColor('#C0C0C0')
elif style == self.Key:
return QtGui.QColor('#CC')
elif style == self.Assignment:
return QtGui.QColor('#CC')
elif style == self.Value:
return QtGui.QColor('#00CC00')
return Qsci.QsciLexerCustom.defaultColor(self, style)

def styleText(self, start, end):
editor = self.editor()
if editor is None:
return

# scintilla works with encoded bytes, not decoded characters.
# this matters if the source contains non-ascii characters and
# a multi-byte encoding is used (e.g. utf-8)
source = ''
if end  editor.length():
end = editor.length()
if end  start:
if sys.hexversion = 0x0206:
# faster when styling big files, but needs python 2.6
source = bytearray(end - start)
editor.SendScintilla(
editor.SCI_GETTEXTRANGE, start, end, source)
else:
source = unicode(editor.text()
).encode('utf-8')[start:end]
if not source:
return

# the line index will also be needed to implement folding
index = editor.SendScintilla(editor.SCI_LINEFROMPOSITION, start)
if index  0:
# the previous state may be needed for multi-line styling
pos = editor.SendScintilla(editor.SCI_GETLINEENDPOSITION,
   index - 1)
state = editor.SendScintilla(editor.SCI_GETSTYLEAT, pos)
else:
state = self.Default

set_style = self.setStyling
self.startStyling(start, 0x1f)

# scintilla always asks to style whole lines
for line in source.splitlines(True):
length = len(line)
levelFolder = editor.SendScintilla(editor.SCI_GETFOLDLEVEL, index)
if line.startswith('+ '):
state = self.Comment
editor.SendScintilla(editor.SCI_SETFOLDLEVEL, index, 
levelFolder+10)
else:
# the following will style lines like x = 0
pos = line.find('=')
if pos  0:
set_style(pos, self.Key)
set_style(1, self.Assignment)
length = length - pos - 1
state = self.Value
else:
state = self.Default
set_style(length, state)
# folding implementation goes here


# PB PB PB PB PB PB PB