Re: [PyKDE] PyQt4 v4.1.1 is different....

2007-03-05 Thread Phil Thompson
On Monday 05 March 2007 6:33 am, Marco wrote:
 Hello, everyone!

  I have update my PyQt4 to version 4.1.1 because I want to use its new
 feature: QX11Embed.

  But there is a question, in this new version, I cannot see the detail
 error on stdout, If I got somethings error, I only get like follow:

 #
 raceback (most recent call last):
   File ./rd_qt_qx11embed.py, line 62, in ?
 main = Main()
 SystemError: NULL result without error in PyObject_Call
 ##
 I donot know what's error,  line:62 is main = Main() .


 How to debug in version PyQt 4.1.1 ?

Generate a gdb backtrace, or post your script (if it is small enough).

Phil

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


Re: [PyKDE] QThread run() method not being called when start() is executed (PyQt4/ Windows XP)

2007-03-05 Thread Phil Thompson
On Monday 05 March 2007 6:49 am, Tony Cappellini wrote:
 This is the first time I've used QThreads, and it's not going well.
 The run method is not being called after start() is executed.

 What are some possible explanations for this?

Your code is wrong.

 What can I do to debug this kind of problem?

Fix your code or post your code.

Sorry I can't give a more specific answer - a more specific question would 
help.

Phil

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


Re: [PyKDE] Error while running PyQt4.1.1 Examples in Windows

2007-03-05 Thread Phil Thompson
On Monday 05 March 2007 6:46 am, Kushal Das wrote:
 Hi,
 I installed PyQt 4.1.1 for windows along with Python2.5 and Qt4.2.2 with
 Mingw.
 After the installation, if I try to start the pyqt examples (qt-demo) the
 following error is coming:

 Pythonw.exe- Unable to locate components
 This application has failed to start because mingwm10.dll was not found.
 Re-installing the application may fix this problem.


 No good results from google :(

Make sure it is on your PATH.

Phil

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


[PyKDE] KHTML method returning null

2007-03-05 Thread Paul Giannaros
The documentation for KHTML's DOM::Document::getElementById ( 
http://api.kde.org/3.5-api/kdelibs-apidocs/khtml/html/classDOM_1_1Document.html#a20
 ) 
show's that the method returns null when an element in the webpage by the 
given ID hasn't been found. I would have thought that would have mapped to 
Python's None, but instead I'm getting a khtml.DOM.Element. Whenever I try to 
call a method on it, my application crashes with terminate called after 
throwing an instance of 'DOM::DOMException'. 
Firstly, is this intended behaviour? Secondly, is there any way that I can 
check if the return value from that call is a valid object? Maybe there is 
something you can do with the sip module? (though I can't see anything in the 
docs)

Thanks,
Paul

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


RE: [PyKDE] Back to the long delay caused when callingQDialog.getOpenFileNames()

2007-03-05 Thread Andy Anderson
This is probably a generic Qt problem, not because of PyQt.

If you can, create an equivalent C++ Qt test. If you see the same delay,
then look at the Qt mailing lists, support, etc.

You can also test to see if the delay changes with the number of files
shown in the dialog. If the delay increases with the number of files,
it's almost certainly not caused by anything at the Python or PyQt
level.

FWIW, I remember some versions of Qt3 had performance problems in the
file dialogs due to networked drives and/or networked user accounts.
IIRC, some Windows file operations, like checking user read/write
permission, are slow in some cases. I think the Qt versions of the file
dialogs checked file attributes for each file in the dialog. You might
be seeing something like this.

Andy Anderson

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tony
Cappellini
Sent: Saturday, March 03, 2007 12:46 AM
To: pykde@mats.imk.fraunhofer.de
Subject: [PyKDE] Back to the long delay caused when
callingQDialog.getOpenFileNames()

I've tried an experiment.

Using the Python extensions for Windows (build 210), on Python 2.5

I've called a routine which opens the same native W32 FileOpen dialog.

The dialog opens instantly when it is called, but I still see the 10
or so second delay when calling this though PyQt 4.2.2

Would another Windows user please verify this?

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

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


Re: [PyKDE] Mailing List Changes

2007-03-05 Thread Thorsten Horstmann

Phil Thompson wrote:
Some time in the next few days the PyKDE mailing list will be renamed (to 
PyQt) and relocated (to riverbankcomputing.com). Everybody's subscription 
details will be transferred automatically.


We'll send out an email just before the move to ask that you don't post (for 
an hour or two - famous last words). After the move we'll send out another 
email confirming the new list address.


The changes will be made next Thursday approx. 10am CET.
I'll write an email just before stopping the mailman.

 -Thorsten

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


[PyKDE] QTreeWidget and QPalette

2007-03-05 Thread hanzz
Hi,
i have problem with setting QTreeWidget QPalette. If i set alpha channel for 
QTreeWidget, then alpha channel is setted for all mainwindow too. What is 
bad?

This is the test source code. I'm using PyQt-x11-gpl-4.1.1 and qt4.2.1-2

try:
from PyQt4 import QtCore, QtGui
except:
print PyQt4 is not installed.
import sys

class mainWindow(QtGui.QMainWindow):
def __init__(self,parent=None):
apply(QtGui.QMainWindow.__init__,(self,parent))
# central widget
self.setCentralWidget(QtGui.QWidget(self))
# layout
layout=QtGui.QVBoxLayout(self.centralWidget())
# we will see palette color change on this widget
self.lineEdit=QtGui.QLineEdit(self)
layout.addWidget(self.lineEdit)
# we will change palette of this tree widget
self.treeWidget=treeWidget(self)
layout.addWidget(self.treeWidget)

class treeWidget(QtGui.QTreeWidget):
def __init__(self,parent=None):
apply(QtGui.QTreeWidget.__init__,(self,parent))
# if we set alpha channel then alpha channel will not set only 
for tree 
widget
# but for mainWindow.lineEdit too.
palette=QtGui.QPalette()
color=palette.color(QtGui.QPalette.Base)
color.setAlpha(50) # for example 50
palette.setColor(QtGui.QPalette.Base,color)
self.setPalette(palette)

# i tried this too
#palette=self.viewport().palette()
#color=palette.color(QtGui.QPalette.Base)
#color.setAlpha(50) # for example 50
#palette.setColor(QtGui.QPalette.Base,color)
#self.viewport().setPalette(palette)

app = QtGui.QApplication(sys.argv)
win = mainWindow()
win.show()
sys.exit(app.exec_())

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


Re: [PyKDE] QThread run() method not being called when start() is executed (PyQt4/ Windows XP)

2007-03-05 Thread Tony Cappellini

Hello Phil,


Fix your code or post your code.
Sorry I can't give a more specific answer - a more specific question would
help.


Not sure how more specific I could get. The run() method isn't being
invoked, and I don't know how to debug a thread issue.

As you requested, here's my code.

class ConvertThread(QThread):
 def __init__(self,main):
   QThread.__init__(self)
   self.main = main
   self.connect(self, SIGNAL('write'), self.main.write)

 def run(self):
   self.str = ''
   script=open('nm2g2.py').read()
   globs = globals()
   exec 'from nm2g2 import *' in globs
   logging = globs['logging']
   logging.basicConfig(stream=self, format='%(message)s')
   main(['nm2g2.py','-v0']+self.files)
   logging.critical('Conversion finished.')
   self.exit(0)

 def write(self, s):
   self.str += s

 def flush(self):
   self.emit(SIGNAL('write'), self.str)
   self.str = ''


class NM2G2G(QMainWindow):
   def __init__(self, parent=None):
   QMainWindow.__init__(self, parent)
   self.ui=Ui_NM2G2G()
   self.ui.setupUi(self)
   self.connect(self.ui._StartConversion, SIGNAL(clicked()),
self._ launchG2oolsApplication)

   self.convert = ConvertThread(self)

 def _launchG2oolsApplication(self):
   self.convert.files =[]
   for fn in self._TargetFilesToConvert:
  self.convert.files.append(fn)

   self.convert.start()

def write(self, s):
   self.ui.PatchConversionBrowser.insertPlainText(s)
   self.ui.PatchConversionBrowser.ensureCursorVisible()





Background info:

The gui launches another python app. That app converts files from one
format to another format, resulting in an output file (with a specific
file extension) being generated for each input file. I can run that
python app from the cmd line, and the input file are converted,
indicating the target app functionality.

My GUI is a slight adaptation of another GUI written by someone else.
My GUI suffers from freezing/hanging while the target app is
running. The other GUI does not, because it is using a Thread to write
to the GUI. So, I'm trying to adapt my gui, so it doesn't hang while
the target app is running.

Both GUIs call the same target application to convert the files. My
GUI uses the exact same ConvertThread() class as the GUI which works,
but it seems as though run() is not being called in my GUI.

self.ui._StartConversion is the button which is clicked which results
in self.convert.start()
getting called.


The reasons I speculate that run() isn't getting called

1. No output files are generated by the target application (the Python
app being launched by the GUI)

2. I've set breakpoints where self.convert.start() is called, and in
NM2G2G.write() self.convert.start() is being executed, but
NM2G2G.write() never gets called. Since NM2G2G.write() isn't getting
called, I'm speculating that run() is never being called.

If I can elaborate on anything else, let me know.

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


[PyKDE] Crash when using QAction.setShortcut

2007-03-05 Thread Miguel Lobo

The following simple code crashes for me:

from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import Qt

action = QtGui.QAction(None)
action.setShortcut(QtGui.QKeySequence(Qt.Key_Q))

I'm using:

* Qt/Windows 4.2.2 Open Source Edition.
* PyQt 4.1.1
* sip 4.5.2

I haven't changed these versions in a while and everything else seems to
work ok.

Sorry about not posting a backtrack, I'm not sure how to generate one under
Windows.  Hopefully somebody will be able to reporuce this problem.

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


[PyKDE] Re: PyKDE Digest, Vol 32, Issue 10

2007-03-05 Thread Tony Cappellini

Message: 2
Date: Mon, 5 Mar 2007 11:45:38 -0500
From: Andy Anderson [EMAIL PROTECTED]
Subject: RE: [PyKDE] Back to the long delay caused when
  callingQDialog.getOpenFileNames()
To: pykde@mats.imk.fraunhofer.de
Message-ID:


This is probably a generic Qt problem, not because of PyQt.

It's probably more of an issue with the ming32 compilation of QT 4.2.2- eh?


If you can, create an equivalent C++ Qt test. If you see the same delay,
then look at the Qt mailing lists, support, etc.


I doubt I could do that to an degree of success.
I don't know C++ and would likely add more problems to this trying to
get there, than there
already are. If there is anything else I can to move this along, let me know.


You can also test to see if the delay changes with the number of files
shown in the dialog. If the delay increases with the number of files,


This I can do- will report back results tonight


FWIW, I remember some versions of Qt3 had performance problems in the
file dialogs due to networked drives and/or networked user accounts.

It sounds reasonable.

However, I have tried this where I work (from my laptop), which has a
lot of networked drives, and at home (from the same laptop), where I
have a wireless network, but do not have any drives mapped.

I need to reinstall Py2.5, and the same version of QT, sip, PyQt on my
desktop machine at home and try the same thing.

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


[PyKDE] Re: Crash when using QAction.setShortcut [SOLVED]

2007-03-05 Thread Miguel Lobo

No matter, I've just discovered that the proper way to solve this problem is
to create the QApplication before calling QAction.setShortcut e.g.:

from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import Qt

import sys
application = QtGui.QApplication(sys.argv)

action = QtGui.QAction(None)
action.setShortcut(QtGui.QKeySequence(Qt.Key_Q))

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


Re: [PyKDE] QThread run() method not being called when start() is executed (PyQt4/ Windows XP)

2007-03-05 Thread Andreas Pakulat
On 05.03.07 14:32:13, Tony Cappellini wrote:
 Fix your code or post your code.
 Sorry I can't give a more specific answer - a more specific question would
 help.
 
 Not sure how more specific I could get. The run() method isn't being
 invoked, and I don't know how to debug a thread issue.
 
 As you requested, here's my code.
 
 class ConvertThread(QThread):
  def __init__(self,main):
QThread.__init__(self)
self.main = main
self.connect(self, SIGNAL('write'), self.main.write)
 
  def run(self):
self.str = ''
script=open('nm2g2.py').read()
globs = globals()
exec 'from nm2g2 import *' in globs
logging = globs['logging']
logging.basicConfig(stream=self, format='%(message)s')
main(['nm2g2.py','-v0']+self.files)
logging.critical('Conversion finished.')
self.exit(0)
 
  def write(self, s):
self.str += s
 
  def flush(self):
self.emit(SIGNAL('write'), self.str)
self.str = ''
[...] 
 The reasons I speculate that run() isn't getting called
 
 1. No output files are generated by the target application (the Python
 app being launched by the GUI)
 
 2. I've set breakpoints where self.convert.start() is called, and in
 NM2G2G.write() self.convert.start() is being executed, but
 NM2G2G.write() never gets called. Since NM2G2G.write() isn't getting
 called, I'm speculating that run() is never being called.

Well, of course not because nothing in your code calls flush and thus
the emitting of the write signal is never done. Also I'm not sure wether
its a good idea to have a signal and a function with the same name in
the ConvertThread class.

Andreas

-- 
You will be honored for contributing your time and skill to a worthy cause.

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


Re: [PyKDE] Crash when using QAction.setShortcut

2007-03-05 Thread Andreas Pakulat
On 06.03.07 00:09:05, Miguel Lobo wrote:
 The following simple code crashes for me:
 
 from PyQt4 import QtCore, QtGui
 from PyQt4.QtCore import Qt
 
 action = QtGui.QAction(None)
 action.setShortcut(QtGui.QKeySequence(Qt.Key_Q))
 
 I'm using:
 
 * Qt/Windows 4.2.2 Open Source Edition.
 * PyQt 4.1.1
 * sip 4.5.2

You're missing a QApplication object.

Andreas 

-- 
You have been selected for a secret mission.

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


Re: [PyKDE] KHTML method returning null

2007-03-05 Thread Jim Bublitz
On Monday 05 March 2007 08:29, Paul Giannaros wrote:
 The documentation for KHTML's DOM::Document::getElementById (
 http://api.kde.org/3.5-api/kdelibs-apidocs/khtml/html/classDOM_1_1Document.
html#a20 ) show's that the method returns null when an element in the
 webpage by the given ID hasn't been found. I would have thought that would
 have mapped to Python's None, but instead I'm getting a khtml.DOM.Element.

If the underlying C++ call returns null, the PyKDE call should return None 
(see sip_api_return_from_new_instance in siplib/siplib.c)

 Whenever I try to call a method on it, my application crashes with
 terminate called after throwing an instance of 'DOM::DOMException'.
 Firstly, is this intended behaviour? 

I don't think so.

 Secondly, is there any way that I can 
 check if the return value from that call is a valid object? 

Try accessing some method of the object, I suppose (you can also check its 
Python type, of course, but that only tells you what Python thinks the object 
is).

I'd suggest posting a short example program that demonstrates the problem 
(include the html necessary to cause it too).

Most of this stuff is straightforward sip wrappers - meaning sip generates the 
code the same as for any other C++ class, and there isn't anything unusual or 
customized that I can see. That suggests the most likely problem is in the 
implementation you're doing - the commonest problem is not keeping a Python 
reference to an object you're trying to access, for example.

However the khtml, and especially DOM, stuff hasn't gotten a lot of use, and I 
have no application code to test it with, so problems either in PyKDE or the 
underlying KDE code are quite possible too.

Either way, an example would be useful to see what's happening.

Jim


 Maybe there is 
 something you can do with the sip module? (though I can't see anything in
 the docs)

 Thanks,
 Paul

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

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


[PyKDE] more and more signal from on connect...(on QProcess)

2007-03-05 Thread Marco

Hi, I want to write a MPlayer GUI frontend.

Now, I meet a bug, when:
click play, a movie showing, click stop, the movie stop and print
ONE message

click play, the movie show again, click stop, the movie stop and
print TWO messages

click play, the movie show again, click stop, the movie stop and
print THREE messages

..

I donot know how to fix the bug. Can anybody help me? Thank you!


--
LinuX Power


rd_qt_qx11embed.py
Description: application/python
___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde