Re: [PyQt] SIP and Qxt Widgets

2010-12-30 Thread Alexander Nestorov
I have been trying to make a SIP file out of qxtglobal.h (from Qxt library)
( http://dev.libqxt.org/libqxt/src/c955808a1852/src/core/qxtglobal.h )
and I'm stuck. I can't figure out what to do with all those #define's and
the empty classes.

I'd appreciate some help, please.

Regards!


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

[PyQt] StackedWidget bug in 4.8.2

2010-12-27 Thread Alexander Nestorov
After upgrading to 4.8.2 from 4.8.1 my app stopped working. I'm pretty sure
that the bug is not mine as
my app just loads an .ui file generated with QtDesigner.

Here is the log: http://pastebin.ca/2030773

Regards

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

[PyQt] SIP and Qxt Widgets

2010-12-24 Thread Alexander Nestorov
I'm trying to use one of Qxt's widgets (the schedule view) in Python, but I
need to use SIP first to make the necesary
bindings as Qxt is C++ only.

After reading SIP docs I found that I need all "dependant" files apart from
qxtscheduleview.h, so I looked for all #include
in that file and started to copy all files in the same dir. I ended up with
~15 .h/.cpp files.

Next step was write the config.py and config.py.in files, and the .sip file
itself. I wrote it but I must have done
something wrong because when I try to "convert" it using SIP I get an error:

sip: QxtScheduleItemDelegate is undefined.

I don't know how to fix it.
Here is Qxt's code:
http://dev.libqxt.org/libqxt/src/c955808a1852/src/gui/qxtscheduleview.h
And here is what I have done: http://pastebin.ca/2028373

Regards

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

Re: [PyQt] Qxt bindings for python

2010-10-11 Thread Alexander Nestorov
I'm sorry, there must have been some kind of error because my message wasn't
sent and I just saw that.

My question is if somebody is working on a port of Qxt library to Python.
I need that library because it has a global keyboard hooker and I'm working
on a project similar to yakuake, so I need to know if/when the user
pressed a specific key.

Currently I'm using pyHook on Windows and python-xlib on Linux, and it works
great, but I can't find nothing for Mac OS.

Regards


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

[PyQt] Qxt bindings for python

2010-10-11 Thread Alexander Nestorov
-- 
Alexander Nestorov
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QThread and event loop

2010-10-02 Thread Alexander Nestorov
I'm going to answer to myself.
I found a solution, and it was really simple!

Working code:


class Async(QThread):
  def run(self):
self.jar = QNetworkCookieJar()
self.manager = QNetworkAccessManager()
self.manager.setCookieJar(self.jar)
self.manager.finished.connect(self.downloadFinished)
self.manager.authenticationRequired.connect(self.authenticationRequired)
self.request = QNetworkRequest(self.url)
self.request.setRawHeader("User-Agent", self.userAgent)
self.reply = self.manager.get(self.request)
self.reply.downloadProgress.connect(self.progressCallback)
self.exec_()

  def download(self, url, userAgent = "Wget/1.12 (linux-gnu)", user = "",
password = ""):
self.url = QUrl(url)
self.userAgent = userAgent
self.user = user
self.password = password
self.returnData = None
self.moveToThread(self)### <--  Added line that fixes the
problem!
self.start()

  def authenticationRequired(self, reply, authenticator):
authenticator.setUser(self.user)
authenticator.setPassword(self.password)

  def progressCallback(self, done, total):
self.emit(QtCore.SIGNAL('progress(int, int)'), done, total)

  def downloadFinished(self, reply):
print "dfinished"
self.redirect =
reply.attribute(QNetworkRequest.RedirectionTargetAttribute).toUrl()
if not self.redirect.isEmpty():
  self.request = QNetworkRequest(self.redirect)
  self.request.setRawHeader("User-Agent", self.userAgent)
  self.reply = self.manager.get(self.request)
  self.reply.downloadProgress.connect(self.progressCallback)
else:
  self.emit(QtCore.SIGNAL('finished(PyQt_PyObject)'),
str(self.reply.readAll()))
  self.quit()


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

[PyQt] QThread and event loop

2010-10-01 Thread Alexander Nestorov
I'm trying to download something in a QThread. I have been reading and I
know that I should use an event loop in order
to get signals/slots working. exec_() seems to be the thing that I need, but
it doesn't work as downloadFinished() will
never be called. Can I get some help, please?

Here is the code:

class Async(QThread):
  def run(self):
self.jar = QNetworkCookieJar()
self.manager = QNetworkAccessManager()
self.manager.setCookieJar(self.jar)
self.manager.finished.connect(self.downloadFinished)
self.manager.authenticationRequired.connect(self.authenticationRequired)
self.request = QNetworkRequest(self.url)
self.request.setRawHeader("User-Agent", self.userAgent)
self.reply = self.manager.get(self.request)
self.reply.downloadProgress.connect(self.progressCallback)
self.exec_()

  def download(self, url, userAgent = "Wget/1.12 (linux-gnu)", user = "",
password = ""):
self.url = QUrl(url)
self.userAgent = userAgent
self.user = user
self.password = password
self.returnData = None
self.start()

  def authenticationRequired(self, reply, authenticator):
authenticator.setUser(self.user)
authenticator.setPassword(self.password)

  def progressCallback(self, done, total):
self.emit(QtCore.SIGNAL('progress(int, int)'), done, total)

  def downloadFinished(self, reply):
self.redirect =
reply.attribute(QNetworkRequest.RedirectionTargetAttribute).toUrl()
if not self.redirect.isEmpty():
  self.request = QNetworkRequest(self.redirect)
  self.request.setRawHeader("User-Agent", self.userAgent)
  self.reply = self.manager.get(self.request)
  self.reply.downloadProgress.connect(self.progressCallback)
else:
  self.emit(QtCore.SIGNAL('finished(PyQt_PyObject)'),
str(self.reply.readAll()))
  self.quit()



Regards

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

[PyQt] Bug with latest PyQt4 (4.7.6)

2010-09-11 Thread Alexander Nestorov
I wrote a small test/example to show the bug. Here it is:

##
from PyQt4 import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *

print PyQt4.QtCore.PYQT_VERSION_STR

app = QApplication([""])
app.setGraphicsSystem("raster")
##

This will print '4.7.6' and then will crash with error:
AttributeError: 'QApplication' object has no attribute 'setGraphicsSystem'

This same script runs perfectly with 4.7.4
Is that a bug in PyQt4? If "yes", how can I fix that? Or when it will be
fixed?

Regads

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