[PyQt] PyQt installation on mac os x 10.6 fails

2009-11-25 Thread Jack Thomas
I hope this is the correct place to ask for help installing PyQt.

I have been trying to install PyQt on Snow Leopard on my MacBook Pro with
little success. I have been following the guide
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#configuring-sip-and-pyqt-for-macos-10-6-snow-leopard.
I installed SIP from source using the --arch i386 option. I installed QT4
from a .dmg downloaded from http://qt.nokia.com/products. And then I
attempted to install PyQt from source using the --use-arch=i386 option. The
configure and make steps both exit with no errors but sudo make install
exits with the following error:

g++ -headerpad_max_install_names -arch i386 -single_module -dynamiclib -o
 libpythonplugin.dylib pluginloader.o moc_pluginloader.o
 -F/Library/Frameworks -L/Library/Frameworks -framework Python -framework
 QtDesigner -framework QtScript -framework QtXml -framework QtGui -framework
 Carbon -framework AppKit -framework QtCore -lz -lm -framework
 ApplicationServices
 ld: warning: in /Library/Frameworks/Python.framework/Python, file is not of
 required architecture
 Undefined symbols:
   _Py_Initialize, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyLong_AsVoidPtr, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyErr_Print, referenced from:
   PyCustomWidgets::getModuleAttr(char const*, char const*)in
 pluginloader.o
   PyCustomWidgets::getModuleAttr(char const*, char const*)in
 pluginloader.o
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyString_FromString, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyType_IsSubtype, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyModule_GetDict, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyObject_CallObject, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyObject_CallFunctionObjArgs, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyList_Append, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyType_Type, referenced from:
   _PyType_Type$non_lazy_ptr in pluginloader.o
   _Py_IsInitialized, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyDict_Next, referenced from:
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyImport_ImportModule, referenced from:
   PyCustomWidgets::getModuleAttr(char const*, char const*)in
 pluginloader.o
   PyCustomWidgets::PyCustomWidgets(QObject*)in pluginloader.o
   _PyObject_GetAttrString, referenced from:
   PyCustomWidgets::getModuleAttr(char const*, char const*)in
 pluginloader.o
 ld: symbol(s) not found
 collect2: ld returned 1 exit status
 make[1]: *** [libpythonplugin.dylib] Error 1
 make: *** [install] Error 2



I currently have Python 2.5.2 installed. I am currently downloading version
2.6.4 and try again. If there is any more info needed, please ask.  Any help
would be greatly appreciated. Thank you.

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

Re: [PyQt] QObject.sender() bug

2009-11-25 Thread Marcos Dione
On Tue, Nov 24, 2009 at 01:15:10PM -0700, Matt Newell wrote:
 On Monday 23 November 2009 13:53:09 Marcos Dione wrote:
  I think the backtrace is eloquent enough:
 
  --- traceback ---
  Traceback (most recent call last):
File
  /home/mdione/src/projects/satyr/collection-agregator/satyr/models.py,
  line 97, in addSongs sender= QObject.sender ()
  TypeError: first argument of unbound method QObject.sender() must be a
  QObject instance
  --- traceback ---
 
 It's a member function so it needs the instance.  Usually that means calling
 self.sender().

but the original qt function is a class method.

-- 
(Not so) Random fortune:
Maebe: Do you guys know where I could get one of those gold T-shaped
pendants?
Michael: That's a cross.
Maebe: Across from where?
-- Arrested development
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QObject.sender() bug

2009-11-25 Thread Phil Thompson
On Wed, 25 Nov 2009 10:03:58 +0100, Marcos Dione mdi...@grulic.org.ar
wrote:
 On Tue, Nov 24, 2009 at 01:15:10PM -0700, Matt Newell wrote:
 On Monday 23 November 2009 13:53:09 Marcos Dione wrote:
  I think the backtrace is eloquent enough:
 
  --- traceback ---
  Traceback (most recent call last):
File
 
/home/mdione/src/projects/satyr/collection-agregator/satyr/models.py,
  line 97, in addSongs sender= QObject.sender ()
  TypeError: first argument of unbound method QObject.sender() must be a
  QObject instance
  --- traceback ---
 
 It's a member function so it needs the instance.  Usually that means
 calling
 self.sender().
 
 but the original qt function is a class method.

No it isn't.

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


Re: [PyQt] [SIP] wrap a class with protected destructor

2009-11-25 Thread Sébastien Petitdemange
Hi List,

No one can help?

SEB
Sébastien Petitdemange wrote:
 Hi List,
 
 I try to use the new release of sip (4.9.2) and I notice that destructor
 wrapping is different from sip 4.7.9. And I have a compilation error:
 
 sip 4.9.2 generate this for the destructor:
   
 static void release_SinkTaskBase(void *sipCppV,int sipState)
 {
 SinkTaskBase *sipCpp = reinterpret_castSinkTaskBase *(sipCppV);
 
 #line 338 processlib_tmp.sip
  Py_BEGIN_ALLOW_THREADS;
  sipCpp-unref();
  Py_END_ALLOW_THREADS;
 #line 216 sipprocesslibSinkTaskBase.cpp
 
 Py_BEGIN_ALLOW_THREADS
 
 if (sipState  SIP_DERIVED_CLASS)
 delete reinterpret_castsipSinkTaskBase *(sipCppV);
 else
 delete reinterpret_castSinkTaskBase *(sipCppV);
 
 Py_END_ALLOW_THREADS
 }
 
 and as the SinkTaskBase object has a protected Destructor so the
 compilation failed.
 
 previously sip 4.7.9 only use the %MethodCode provide so the wrapping
 method look like that:
 
 static void release_SinkTaskBase(void *sipCppV,int)
 {
 SinkTaskBase *sipCpp = reinterpret_castSinkTaskBase *(sipCppV);
 #line 338 processlib_tmp.sip
  Py_BEGIN_ALLOW_THREADS;
  sipCpp-unref();
  Py_END_ALLOW_THREADS;
 #line 215 sipprocesslibSinkTaskBase.cpp
 }
 
 Is there a way (New key word) to wrap a protected or even private
 destructor ?
 
 
 Thanks in advance,
 
 SEB
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt

attachment: sebastien_petitdemange.vcf___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Unable to install on Mac Snow Leopard

2009-11-25 Thread Darren Dale
On Wed, Nov 25, 2009 at 2:58 AM, Antonio Valentino
antonio.valent...@tiscali.it wrote:
 Hi Darren,

 Il giorno Mon, 23 Nov 2009 21:42:37 -0500
 Darren Dale dsdal...@gmail.com ha scritto:

 On Mon, Nov 23, 2009 at 8:25 PM, Kareem Yusuf koyu...@gmail.com
 wrote:
  When I try to install PyQt, and run Make I get the following
  error ... In file included from
  /Library/Frameworks/QtCore.framework/Headers/qmetatype.h:45,
                   from
  /Library/Frameworks/QtCore.framework/Headers/QMetaType:1,
                   from sipAPIQtCore.h:40,
                   from sipQtCorecmodule.cpp:34:
  /Library/Frameworks/QtCore.framework/Headers/qglobal.h:288:2:
  error: #error You are building a 64-bit application, but using a
  32-bit version of Qt. Check your build configuration.
  make[1]: *** [sipQtCorecmodule.o] Error 1
  make: *** [all] Error 2
 
  I had read some of the threads that suggested that some fixes had
  been placed into the latest dev snapshot, which I am using. However
  still getting the same problem.
  Please advise.

 I just installed everything this morning on snow leopard without any
 problems. I installed the Qt release candidate binary, and then the
 most recent stable releases of sip and pyqt from sources.

 in the last few days there was more than one thread discussing PyQt
 installation on Snow Leopard but I'm still unable to get it running.

 In my case the error happens at import time (I can't provide details
 since I'm not on my macbook right now).

 Please can you provide more details on installation procedure you used?

 Which version of Qt 4.6 RC did you used? Cocoa? 32 or 64 bits?
 In this case did you still use the -arch=i386 flag?

Release candidate 1, 64 bits cocoa. I did not use -arch=i386, as I am
using the system python which is 64 bit.

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


[PyQt] QVariant misunderstandings

2009-11-25 Thread Giovanni Bajo
Hi Phil,

I must say I have not quite followed up all the developments wrt
QVariant. I'm using Python 2 and thus the QVariant v1 API.

Shouldn't the following work as intuitevely expected?

 from PyQt4.Qt import *
 a = QString(ciao)
 QVariant(a).toString()
PyQt4.QtCore.QString(u'')
 QVariant(a).type()
127

Why should a plain QString be inserted within the QVariant as a custom
type?

I'm using SIP 4.9.3 and PyQt 4.6.2 (unless I've broken something with my
internal merges).
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


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


Re: [PyQt] QVariant misunderstandings

2009-11-25 Thread Phil Thompson
On Wed, 25 Nov 2009 15:44:25 +0100, Giovanni Bajo ra...@develer.com
wrote:
 Hi Phil,
 
 I must say I have not quite followed up all the developments wrt
 QVariant. I'm using Python 2 and thus the QVariant v1 API.
 
 Shouldn't the following work as intuitevely expected?
 
 from PyQt4.Qt import *
 a = QString(ciao)
 QVariant(a).toString()
 PyQt4.QtCore.QString(u'')
 QVariant(a).type()
 127
 
 Why should a plain QString be inserted within the QVariant as a custom
 type?
 
 I'm using SIP 4.9.3 and PyQt 4.6.2 (unless I've broken something with my
 internal merges).

That's the bug that was fixed with SIP 4.9.3.

You've either broken something or forgotten to rebuild PyQt.

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


RE: [PyQt] Two questions about PyQt

2009-11-25 Thread tiob lew

Thank you so much for the help. 
Once more question. Again related to the RadioButton. 
Assume we define two RadioButtons as rb1 = QtGui.QRadioButton('MyRadioButton1', 
self) rb2 = QtGui.QRadioButton('MyRadioButton2', self)

If rb1 is checked , one action is performed in some other place.  If rb2 is 
checked, some other action is performed. 
For example, in the following code,  if rb1 is checked, the name should be set 
to 'Alice' if Button 'update' is hit.   if rb2 is checked, then the name should 
be set to 'Tom'. 
How should the code be modified to achieve this goal. 

Many thanks. 


===#!/usr/bin/python#MyUI.py
import sysimport randomfrom PyQt4 import QtCore, QtGui

class MyUI2(QtGui.QWidget): def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setWindowTitle('My UI2')
self.rb1 = QtGui.QRadioButton('MyButton1', self)
self.rb2 = QtGui.QRadioButton('MyButton2', self)
bg = QtGui.QButtonGroup(parent) 
bg.setExclusive(1)  bg.addButton(self.rb1)  
bg.addButton(self.rb2)
hbox = QtGui.QHBoxLayout()  hbox.addStretch(1)  
hbox.addWidget(self.rb1)hbox.addWidget(self.rb2)
self.setLayout(hbox)self.resize(900, 600)

lb1 = QtGui.QLabel('Name')
self.tf1 = QtGui.QLineEdit()hbox.addWidget(lb1) 
hbox.addWidget(self.tf1)
self.tf1.setText('Jone')update 
= QtGui.QPushButton('update')hbox.addWidget(update)  
self.connect(update, QtCore.SIGNAL('clicked()'),
self.update_info )  def update_info(self):  
tx=''   #if self.rb1.checked(): #   
self.tf1.setText('Alice')   #if self.rb2.checked(): #   
self.tf1.setText('Tom')


app = QtGui.QApplication(sys.argv)ui = 
MyUI2()ui.show()sys.exit(app.exec_())===







 From: david.dou...@logilab.fr
 To: pyqt@riverbankcomputing.com
 Subject: Re: [PyQt] Two questions about PyQt
 Date: Wed, 25 Nov 2009 08:46:58 +0100
 CC: lewt...@hotmail.com
 
 Le Wednesday 25 November 2009 07:19:48 tiob lew, vous avez écrit :
  I am a newbie to Python and have two questions using python to design UI
  based PyQT4.6.
 
  The source code is
  ===
  #!/usr/bin/python
  #MyUI.py
 
  import sys
  import random
  from PyQt4 import QtCore, QtGui
 
 
  class MyUI(QtGui.QWidget):
  def __init__(self, parent=None):
  QtGui.QWidget.__init__(self, parent)
  self.setWindowTitle('My UI')
 
  cb1 = QtGui.QCheckBox('MyCheckBox1', self)
  cb2 = QtGui.QCheckBox('MyCheckBox2', self)
 
  bg = QtGui.QButtonGroup(parent)
 
  bg.setExclusive(1)
  bg.addButton(cb1)
  bg.addButton(cb2)
 
  hbox = QtGui.QHBoxLayout()
  hbox.addStretch(1)
  hbox.addWidget(cb1)
  hbox.addWidget(cb2)
  self.setLayout(hbox)
  self.resize(900, 600)
 
  lb1 = QtGui.QLabel('Name')
  lb2 = QtGui.QLabel('Age')
  lb3 = QtGui.QLabel('Address')
 
  tf1 = QtGui.QLineEdit()
  tf2 = QtGui.QLineEdit()
  tf3 = QtGui.QLineEdit()
 
  hbox.addWidget(lb1)
  hbox.addWidget(tf1)
  hbox.addWidget(lb2)
  hbox.addWidget(tf2)
  hbox.addWidget(lb3)
  hbox.addWidget(tf3)
 
  tf1.setText('Jone')
  tf2.setText('28')
  tf3.setText('London')
 
  update = QtGui.QPushButton('update')
  hbox.addWidget(update)
  self.connect(update, QtCore.SIGNAL('clicked()'),
   self, QtCore.SLOT('update_info(self)'))
 
  def update_info(self):
  tf1.setText('Alice')
  tf2.setText('18')
  tf3.setText('New York')
 
  app = QtGui.QApplication(sys.argv)
  ui = MyUI()
  ui.show()
  sys.exit(app.exec_())
 
 
  
 
  I want to implement two functions in this piece of code.
  1) implement the exclusive checkbox in a group of checkboxes. In another
  word, only one of CheckBox1 and Checkbox2 could be checked at any time.
 
 Use QRadioButton widgets for this.
 
  2) After clicking update button, the information should be updated as
  Name  Alice
  Age - 18
  Address--- New York
 
 Simply keep references to your QLineEdit widgets as attributes of your class, 
 eg. by replacing everywhere tf1 by self.tf1 (and so forth).
 And replace 
  self.connect(update, QtCore.SIGNAL('clicked()'),
   self, QtCore.SLOT('update_info(self)'))
 
 by 
  self.connect(update, QtCore.SIGNAL('clicked()'),
   self.update_info)
 
 
  How should the code 

[PyQt] Re-implemented function doesn't get called from internal Qt methods

2009-11-25 Thread Jugdish
I have written my own class derived from QTabBar with a re-implementation of
the QTabBar::initStyleOption() method, but for some reason it never gets
executed.

Here is my code:


from PyQt4 import QtGui

class MyTabBar(QtGui.QTabBar):

def initStyleOption(self, option, tabIndex):
print inside initStyleOption
QtGui.QTabBar.initStyleOption(self, option, tabIndex)


Looking at the Qt source code for QTabBar (qtabbar.cpp), I see that
initStyleOption() is called inside the paintEvent() method, so I should be
seeing my print statement on every paint event.

Any idea what I'm doing wrong?

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

Re: [PyQt] QVariant misunderstandings

2009-11-25 Thread Giovanni Bajo
On Wed, 2009-11-25 at 14:56 +, Phil Thompson wrote:
 On Wed, 25 Nov 2009 15:44:25 +0100, Giovanni Bajo ra...@develer.com
 wrote:
  Hi Phil,
  
  I must say I have not quite followed up all the developments wrt
  QVariant. I'm using Python 2 and thus the QVariant v1 API.
  
  Shouldn't the following work as intuitevely expected?
  
  from PyQt4.Qt import *
  a = QString(ciao)
  QVariant(a).toString()
  PyQt4.QtCore.QString(u'')
  QVariant(a).type()
  127
  
  Why should a plain QString be inserted within the QVariant as a custom
  type?
  
  I'm using SIP 4.9.3 and PyQt 4.6.2 (unless I've broken something with my
  internal merges).
 
 That's the bug that was fixed with SIP 4.9.3.
 
 You've either broken something or forgotten to rebuild PyQt.

Doh, my bad, it turned out I was using 4.9.2 in fact, and I hadn't
realized that there were two releases in a week.
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


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


[PyQt] Casting from QSettings

2009-11-25 Thread lokev

Hi Guys .. PyQt-noob .. and this is driving me nuts .. probably easy to sort
though ..

So I'm saving ints in a QSettings instance .. like this ..
def closeEvent(self, event):
settings = QSettings()
settings.setValue(MoneySpent, self.moneySpent)

and I'm loading this in init ..

def __init__(self, parent=None):
settings = QSettings()
self.moneySpent = settings.value(MoneySpent, 0).toInt()

but then the type of self.moneySpent is a tuple, not an int, so when i later
try

self.moneySpent += 50

i get:
TypeError: can only concatenate tuple (not int) to tuple ...

... s ? Why does settings.value(MoneySpent, 0).toInt() set the type
of self.moneySpent to tuple  ?

I appreciate any help i can get to sort this out .. :)

- lokev


-- 
View this message in context: 
http://old.nabble.com/Casting-from-QSettings-tp26467897p26467897.html
Sent from the PyQt mailing list archive at Nabble.com.

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


Re: [PyQt] Unable to install on Mac Snow Leopard

2009-11-25 Thread Antonio Valentino
Il giorno Wed, 25 Nov 2009 07:31:44 -0500
Darren Dale dsdal...@gmail.com ha scritto:

 On Wed, Nov 25, 2009 at 2:58 AM, Antonio Valentino
 antonio.valent...@tiscali.it wrote:
  Hi Darren,
 
  Il giorno Mon, 23 Nov 2009 21:42:37 -0500
  Darren Dale dsdal...@gmail.com ha scritto:
 
  I just installed everything this morning on snow leopard without
  any problems. I installed the Qt release candidate binary, and
  then the most recent stable releases of sip and pyqt from sources.
 
  in the last few days there was more than one thread discussing PyQt
  installation on Snow Leopard but I'm still unable to get it running.
 
  In my case the error happens at import time (I can't provide details
  since I'm not on my macbook right now).
 
  Please can you provide more details on installation procedure you
  used?
 
  Which version of Qt 4.6 RC did you used? Cocoa? 32 or 64 bits?
  In this case did you still use the -arch=i386 flag?
 
 Release candidate 1, 64 bits cocoa. I did not use -arch=i386, as I am
 using the system python which is 64 bit.

Thank you very much Darren.
I will try it tonight.

Just a last question: did you had problems with the installation bug
mentioned in http://doc.qt.nokia.com/4.6-snapshot/known-issues.html ?

best regards

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


Re: [PyQt] Unable to install on Mac Snow Leopard

2009-11-25 Thread Darren Dale
On Wed, Nov 25, 2009 at 11:36 AM, Antonio Valentino
antonio.valent...@tiscali.it wrote:
 Il giorno Wed, 25 Nov 2009 07:31:44 -0500
 Darren Dale dsdal...@gmail.com ha scritto:

 On Wed, Nov 25, 2009 at 2:58 AM, Antonio Valentino
 antonio.valent...@tiscali.it wrote:
  Hi Darren,
 
  Il giorno Mon, 23 Nov 2009 21:42:37 -0500
  Darren Dale dsdal...@gmail.com ha scritto:
 
  I just installed everything this morning on snow leopard without
  any problems. I installed the Qt release candidate binary, and
  then the most recent stable releases of sip and pyqt from sources.
 
  in the last few days there was more than one thread discussing PyQt
  installation on Snow Leopard but I'm still unable to get it running.
 
  In my case the error happens at import time (I can't provide details
  since I'm not on my macbook right now).
 
  Please can you provide more details on installation procedure you
  used?
 
  Which version of Qt 4.6 RC did you used? Cocoa? 32 or 64 bits?
  In this case did you still use the -arch=i386 flag?

 Release candidate 1, 64 bits cocoa. I did not use -arch=i386, as I am
 using the system python which is 64 bit.

 Thank you very much Darren.
 I will try it tonight.

 Just a last question: did you had problems with the installation bug
 mentioned in http://doc.qt.nokia.com/4.6-snapshot/known-issues.html ?

No, I don't remember running into that problem. My mac is a brand new
machine, and installing Qt and PyQt were practically the first things
I did with it, so I might have forgotten.

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


Re: [PyQt] Casting from QSettings

2009-11-25 Thread Prafulla Kiran


Hi Lokev,

According to the Qt API docs, QVariant's toInt method returns a tuple 
with the first field being the value and
the second field  - a boolean indicating whether or not the casting went 
fine. Hence you would have to use


settings.value(MoneySpent, 0).toInt()[0]   to retrieve the int value

Regards,
Prafulla

lokev wrote:

Hi Guys .. PyQt-noob .. and this is driving me nuts .. probably easy to sort
though ..

So I'm saving ints in a QSettings instance .. like this ..
def closeEvent(self, event):
settings = QSettings()
settings.setValue(MoneySpent, self.moneySpent)

and I'm loading this in init ..


def __init__(self, parent=None):
settings = QSettings()
self.moneySpent = settings.value(MoneySpent, 0).toInt()

but then the type of self.moneySpent is a tuple, not an int, so when i later
try

self.moneySpent += 50

i get:
TypeError: can only concatenate tuple (not int) to tuple ...

... s ? Why does settings.value(MoneySpent, 0).toInt() set the type
of self.moneySpent to tuple  ?

I appreciate any help i can get to sort this out .. :)

- lokev


  




No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.425 / Virus Database: 270.14.82/2525 - Release Date: 11/25/09 07:31:00


  


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


Re: [PyQt] Re-implemented function doesn't get called from internal Qt methods

2009-11-25 Thread Phil Thompson
On Wed, 25 Nov 2009 15:15:37 +, Jugdish jugd...@gmail.com wrote:
 I have written my own class derived from QTabBar with a re-implementation
 of
 the QTabBar::initStyleOption() method, but for some reason it never gets
 executed.
 
 Here is my code:
 
 
 from PyQt4 import QtGui
 
 class MyTabBar(QtGui.QTabBar):
 
 def initStyleOption(self, option, tabIndex):
 print inside initStyleOption
 QtGui.QTabBar.initStyleOption(self, option, tabIndex)
 
 
 Looking at the Qt source code for QTabBar (qtabbar.cpp), I see that
 initStyleOption() is called inside the paintEvent() method, so I should
be
 seeing my print statement on every paint event.
 
 Any idea what I'm doing wrong?

The C++ method isn't virtual so you can't reimplement it.

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


Re: [PyQt] [SIP] wrap a class with protected destructor

2009-11-25 Thread Phil Thompson
On Mon, 23 Nov 2009 10:01:45 +0100, Sébastien Petitdemange
sebastien.petitdema...@esrf.fr wrote:
 Hi List,
 
 I try to use the new release of sip (4.9.2) and I notice that destructor
 wrapping is different from sip 4.7.9. And I have a compilation error:
 
 sip 4.9.2 generate this for the destructor:
 
 static void release_SinkTaskBase(void *sipCppV,int sipState)
 {
 SinkTaskBase *sipCpp = reinterpret_castSinkTaskBase *(sipCppV);
 
 #line 338 processlib_tmp.sip
  Py_BEGIN_ALLOW_THREADS;
  sipCpp-unref();
  Py_END_ALLOW_THREADS;
 #line 216 sipprocesslibSinkTaskBase.cpp
 
 Py_BEGIN_ALLOW_THREADS
 
 if (sipState  SIP_DERIVED_CLASS)
 delete reinterpret_castsipSinkTaskBase *(sipCppV);
 else
 delete reinterpret_castSinkTaskBase *(sipCppV);
 
 Py_END_ALLOW_THREADS
 }
 
 and as the SinkTaskBase object has a protected Destructor so the
 compilation failed.
 
 previously sip 4.7.9 only use the %MethodCode provide so the wrapping
 method look like that:
 
 static void release_SinkTaskBase(void *sipCppV,int)
 {
 SinkTaskBase *sipCpp = reinterpret_castSinkTaskBase *(sipCppV);
 #line 338 processlib_tmp.sip
  Py_BEGIN_ALLOW_THREADS;
  sipCpp-unref();
  Py_END_ALLOW_THREADS;
 #line 215 sipprocesslibSinkTaskBase.cpp
 }
 
 Is there a way (New key word) to wrap a protected or even private
 destructor ?

You wrap a protected dtor just as you would wrap a public dtor. It looks
like you haven't done this.

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


Re: [PyQt] QMovie start/stop from a different thread

2009-11-25 Thread David Boddie
On Wed, 25 Nov 2009 16:35:28 +1100, tom wrote:

 i create a QMovie in the main thread :

         self.movie = QMovie(images\whitephone-animation.mng,
 QByteArray(), self)
         self.movie.setCacheMode(QMovie.CacheAll)
         self.movie.setSpeed(100)
         self.movie_canvas.setMovie(self.movie)

[...]

 can i call the start / stop slots from within that different thread, and
 how would i do that ?

Connect signals to the movie's start() and stop() slots, and emit them when
you need to start or stop it.

David

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


Re: [PyQt] Freezes and crashes with signal autoconnection

2009-11-25 Thread Christian Roche

Hi there,

so what should I do about this issue? Should I file a bug report? Or is it
only me? The PyQt4 version I'm using is fairly recent however it crashes A
LOT! What gives?

Thanks for your help,
Chris

-- 
View this message in context: 
http://old.nabble.com/Freezes-and-crashes-with-signal-autoconnection-tp25716493p26522132.html
Sent from the PyQt mailing list archive at Nabble.com.

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


Re: [PyQt] QMovie start/stop from a different thread

2009-11-25 Thread tom
thanks david,

i was looking for a code example of that. all the examples i found are using
existing 'events' like clicked() of a button.

figured it out in the end so for others looking for something similar:

i ended up creating a function like:

def startMyMove(self):
 self.movie.setPaused(False)

def stopMyMove(self):
 self.movie.setPaused(False)

linking them like

self.connect(self, QtCore.SIGNAL(startMyMovie()),
self. startMyMovie )
self.connect(self, QtCore.SIGNAL(stopMyMovie()),
self. stopMyMovie )

in the constructor

and when i want it to start or stop i call :

self.emit(QtCore.SIGNAL(startMyMovie()) )
or
self.emit(QtCore.SIGNAL(stopMyMovie()) )

from within the thread

seems to work

thanks all !!

2009/11/26 David Boddie da...@boddie.org.uk

 On Wed, 25 Nov 2009 16:35:28 +1100, tom wrote:

  i create a QMovie in the main thread :
 
  self.movie = QMovie(images\whitephone-animation.mng,
  QByteArray(), self)
  self.movie.setCacheMode(QMovie.CacheAll)
  self.movie.setSpeed(100)
  self.movie_canvas.setMovie(self.movie)

 [...]

  can i call the start / stop slots from within that different thread, and
  how would i do that ?

 Connect signals to the movie's start() and stop() slots, and emit them when
 you need to start or stop it.

 David

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

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