Re: [PyQt] [SIP] Python crash with QString

2011-09-09 Thread Demetrius Cassidy
Well, my educated guess is it's because PyQt4 is being compiled with VS2010,
but the Python binaries are all compiled under VS2008. I've had issues
before trying to use sip/PyQt4 compiled with VS2010, with Python compiled
with 2008, in that strings would end up being blank or having odd crashes
going from C++ to Python.

To keep it short, I do not recommend you mix dlls created with VS2010 with
Python built under VS2008, it has tended to cause issues at least for me.

On Fri, Sep 9, 2011 at 9:20 PM, Jens Thoms Toerring j...@toerring.de wrote:

 Hi Demetrius,

 On Fri, Sep 09, 2011 at 09:04:28PM +, Demetrius Cassidy wrote:
  Is Python also compiled with VS2010?

 Honestly, I can't tell - I got that installation and was told
 to use it as it is. My guess is that the Python version (2.7)
 was simply a binary download, gotten from somewhere I have no
 ideas about. Is there a way to find out about that? And would
 that make a lot of a difference? All I can tell at the moment
 is that a lot of other stuff that to me looks much nore complex
 to me seems to work. Please keep in mind that my experience with
 Windows is basically non-existent, so I need quite a bit of
 handholding and probably will have to ask really stupid ques-
 tions...
  Thanks and best regards, Jens
 --
   \   Jens Thoms Toerring    j...@toerring.de
   \___  http://toerring.de

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

Re: [PyQt] Possible bug in SIP

2011-07-11 Thread Demetrius Cassidy
I think it would help if you could provide a working example of this bug.
Like a sip file which reproduces this behavior.

On Mon, Jul 11, 2011 at 7:12 AM, Tony Lynch tly...@xype.com wrote:

 Hi Phil



 I’m using SIP to wrap a large C++ library and am very impressed with the
 results so far – you’ve got an annotation for most of the use cases I’m
 interested in. However, I think I’ve found a bug. I’ve copied in below my
 own ‘description to self’ of the problem, if it is not sufficient for you to
 see the problem then I’ll knock up a test case (let me know).



 When the wrapper for a class or one of its super classes indicates
 'virtual' for a method, a wrapper class is created in SIP called e.g.
 sipIwBrep, that checks if the python instance has an override method for the
 virtual call. If not then it calls what it thinks is the correct superclass
 call. However, it's idea of the correct superclass call (in this case the
 superclass being IwBrep)  is actually calculated from the wrapper
 declarations and it effectively finds the nearest superclass where the
 relevant function is wrapped. In the case of this bug, IwObject was the
 first superclass to have IsKindOf in the .sip file, so sipIwBrep was
 incorrectly calling IwObject::IsKindOf instead of IwBrep::IsKindOf.



 I cannot see any reason why the SIP-produced subclass does not always call
 the method on the immediate superclass (i.e. the wrapped class, in this case
 IwBrep).



 I hope the above makes sense,

 Regards

 Tony

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

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

Re: [PyQt] help with dip and PyQt4 widgets

2011-07-08 Thread Demetrius Cassidy
You need to call QToolButton's __init__() method.

class Indicator(QtGui.QToolButton, Model):
def __init__(self)
   super(Indicator, self).__init__()

On Fri, Jul 8, 2011 at 1:49 PM, Lic. José M. Rodriguez Bacallao 
jmr...@gmail.com wrote:

 hi folks, I am creating a composite widget with PyQt4 and Dip, the
 problem I have is that when I use dip properties for setting PyQt4
 properties in the constructor I am getting an error saying that the
 underlying C++ object has been delete, I think this is due to the way
 dip works because it call properties methods before the actual Qt4
 widget as been created when I pass an initial value in the
 constructor. When I construct the object with properties initial
 values and the use the properties accesors to set the value, this
 doens't happen. So, my question is, which is the right way to
 construct a custom composite widget with dip?

 # dip imports
 from dip.model import Model, Instance, Str

 # PyQt4 imports
 from PyQt4 import QtCore, QtGui

 class Indicator(QtGui.QToolButton, Model):

# the indicator identifier, it must be unique for all indicators
id = Str()

# the indicator text, this text will be shown
# beside the icon if one is defined
text = Str()

# the indicator tooltip
tooltip = Str()

# the indicator icon
icon = Instance(QtGui.QIcon)

@id.getter
def id(self):
print 'getting value'
return self.objectName()

@id.setter
def id(self, id):
print 'setting value'
self.setObjectName(id)

@text.getter
def text(self):
return self.text()

@text.setter
def text(self, text):
self.setText(text)

@tooltip.getter
def tooltip(self):
return self.toolTip()

@tooltip.setter
def tooltip(self, tooltip):
self.setToolTip(tooltip)

@icon.getter
def icon(self):
return self.icon()

@icon.setter
def icon(self, icon):
self.icon = icon

def perform(self):
raise NotImplementedError

 if __name__ == '__main__':
app = QtGui.QApplication([])

i = Indicator(text='xxx')
i.show()

app.exec_()

 --
 Lic. José M. Rodriguez Bacallao
 Centro de Biofisica Medica
 -
 Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
 mismo.

 Recuerda: El arca de Noe fue construida por aficionados, el titanic
 por profesionales
 -
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] SIP: deriving a python class from a C++ ABC results in a TypeError exception

2011-07-02 Thread Demetrius Cassidy
I have a C++ class which is declared with pure virtual methods, but if I
derive from this class in python and implement the pure virtual methods, I
get an exception:
TypeError: pyvoip.opal.OpalPCSSEndPoint cannot be instantiated or
sub-classed

My python class is declared as following:

class PCSSEndPoint(OpalPCSSEndPoint):
  def __init__(self):
  super(OpalPCSSEndPoint, self).__init__()

def OnShowIncoming(self, connection):
return True

def OnShowOutgoing(self, connection):
return True

def GetMediaFormats(self):
  return []


SIP definitions:

class OpalPCSSEndPoint : OpalLocalEndPoint /Abstract/
{

/**Call back to indicate that remote is ringing.
If false is returned the call is aborted.

The default implementation is pure.
*/
virtual PBoolean OnShowIncoming(
const OpalPCSSConnection  connection /NoCopy/ /// Connection having event
) = 0;

/**Call back to indicate that remote is ringing.
If false is returned the call is aborted.

The default implementation is pure.
*/
virtual PBoolean OnShowOutgoing(
const OpalPCSSConnection  connection /NoCopy/ /// Connection having event
) = 0;

};

Now the base class of OpalPCSSEndPoint is also an ABC, as it derives from an
ABC but does not re-define the pure virtual function:

class OpalLocalEndPoint : OpalEndPoint /Abstract/
{
  ...
};

class OpalEndPoint /Abstract/
{
virtual OpalMediaFormatList GetMediaFormats() const = 0;
};

I tried removing  /Abstract/ from OpalLocalEndPoint, but it made no
difference.  Any idea what's wrong in this scenario? The only way this
works, is if I subclass OpalPCSSEndPoint in C++ and then in Python create a
class derived from my OpalPCSSEndPoint subclass.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] SIP: deriving a python class from a C++ ABC results in a TypeError exception

2011-07-02 Thread Demetrius Cassidy
Actually I made a small mistake, OpalLocalEndPoint has a GetMediaFormats
implementation, but the issue remains.

class OpalLocalEndPoint : OpalEndPoint
{
  virtual OpalMediaFormatList GetMediaFormats() const;
};

On Sat, Jul 2, 2011 at 5:39 PM, Demetrius Cassidy dcassid...@gmail.comwrote:

 I have a C++ class which is declared with pure virtual methods, but if I
 derive from this class in python and implement the pure virtual methods, I
 get an exception:
 TypeError: pyvoip.opal.OpalPCSSEndPoint cannot be instantiated or
 sub-classed

 My python class is declared as following:

 class PCSSEndPoint(OpalPCSSEndPoint):
   def __init__(self):
   super(OpalPCSSEndPoint, self).__init__()

 def OnShowIncoming(self, connection):
 return True

 def OnShowOutgoing(self, connection):
 return True

 def GetMediaFormats(self):
   return []


 SIP definitions:

 class OpalPCSSEndPoint : OpalLocalEndPoint /Abstract/
 {

 /**Call back to indicate that remote is ringing.
 If false is returned the call is aborted.

 The default implementation is pure.
 */
 virtual PBoolean OnShowIncoming(
 const OpalPCSSConnection  connection /NoCopy/ /// Connection having event
 ) = 0;

 /**Call back to indicate that remote is ringing.
 If false is returned the call is aborted.

 The default implementation is pure.
 */
 virtual PBoolean OnShowOutgoing(
 const OpalPCSSConnection  connection /NoCopy/ /// Connection having event
 ) = 0;

 };

 Now the base class of OpalPCSSEndPoint is also an ABC, as it derives from
 an ABC but does not re-define the pure virtual function:

 class OpalLocalEndPoint : OpalEndPoint /Abstract/
 {
   ...
 };

 class OpalEndPoint /Abstract/
 {
 virtual OpalMediaFormatList GetMediaFormats() const = 0;
 };

 I tried removing  /Abstract/ from OpalLocalEndPoint, but it made no
 difference.  Any idea what's wrong in this scenario? The only way this
 works, is if I subclass OpalPCSSEndPoint in C++ and then in Python create a
 class derived from my OpalPCSSEndPoint subclass.


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

Re: [PyQt] SIP: deriving a python class from a C++ ABC results in a TypeError exception

2011-07-02 Thread Demetrius Cassidy
CCing mailing list

On Sat, Jul 2, 2011 at 10:50 PM, Demetrius Cassidy dcassid...@gmail.comwrote:

 On Sat, Jul 2, 2011 at 10:45 PM, Phil Thompson 
 p...@riverbankcomputing.com wrote:

 On Sat, 2 Jul 2011 17:39:14 +, Demetrius Cassidy
 dcassid...@gmail.com
 wrote:
  I have a C++ class which is declared with pure virtual methods, but if I
  derive from this class in python and implement the pure virtual methods,
 I
  get an exception:
  TypeError: pyvoip.opal.OpalPCSSEndPoint cannot be instantiated or
  sub-classed
 
  My python class is declared as following:
 
  class PCSSEndPoint(OpalPCSSEndPoint):
def __init__(self):
super(OpalPCSSEndPoint, self).__init__()

 That should be super(PCSSEndPoint, self).__init__()


   The super thing was a typo.


  def OnShowIncoming(self, connection):
  return True
 
  def OnShowOutgoing(self, connection):
  return True
 
  def GetMediaFormats(self):
return []
 
 
  SIP definitions:
 
  class OpalPCSSEndPoint : OpalLocalEndPoint /Abstract/
  {
 
  /**Call back to indicate that remote is ringing.
  If false is returned the call is aborted.
 
  The default implementation is pure.
  */
  virtual PBoolean OnShowIncoming(
  const OpalPCSSConnection  connection /NoCopy/ /// Connection having
 event
  ) = 0;
 
  /**Call back to indicate that remote is ringing.
  If false is returned the call is aborted.
 
  The default implementation is pure.
  */
  virtual PBoolean OnShowOutgoing(
  const OpalPCSSConnection  connection /NoCopy/ /// Connection having
 event
  ) = 0;
 
  };
 
  Now the base class of OpalPCSSEndPoint is also an ABC, as it derives
 from
  an
  ABC but does not re-define the pure virtual function:
 
  class OpalLocalEndPoint : OpalEndPoint /Abstract/
  {
...
  };
 
  class OpalEndPoint /Abstract/
  {
  virtual OpalMediaFormatList GetMediaFormats() const = 0;
  };
 
  I tried removing  /Abstract/ from OpalLocalEndPoint, but it made no
  difference.  Any idea what's wrong in this scenario? The only way this
  works, is if I subclass OpalPCSSEndPoint in C++ and then in Python
 create a
  class derived from my OpalPCSSEndPoint subclass.

 /Abstract/ is the cause of the problem. It doesn't mean that the C++ is an
 ABC, it means that the class contains other (unspecified) abstract
 methods.

 Phil


 So if /Abstract/ does not mean the class has pure virtual methods and
 cannot be instantiated itself, in which scenario should it be used? I'm a
 little confused here.


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

Re: [PyQt] SIP: deriving a python class from a C++ ABC results in a TypeError exception

2011-07-02 Thread Demetrius Cassidy
I think I answered my own question after re-reading the annotation docs.
Thanks.

On Sat, Jul 2, 2011 at 10:52 PM, Demetrius Cassidy dcassid...@gmail.comwrote:

 CCing mailing list


 On Sat, Jul 2, 2011 at 10:50 PM, Demetrius Cassidy 
 dcassid...@gmail.comwrote:

 On Sat, Jul 2, 2011 at 10:45 PM, Phil Thompson 
 p...@riverbankcomputing.com wrote:

 On Sat, 2 Jul 2011 17:39:14 +, Demetrius Cassidy
 dcassid...@gmail.com
 wrote:
  I have a C++ class which is declared with pure virtual methods, but if
 I
  derive from this class in python and implement the pure virtual
 methods,
 I
  get an exception:
  TypeError: pyvoip.opal.OpalPCSSEndPoint cannot be instantiated or
  sub-classed
 
  My python class is declared as following:
 
  class PCSSEndPoint(OpalPCSSEndPoint):
def __init__(self):
super(OpalPCSSEndPoint, self).__init__()

 That should be super(PCSSEndPoint, self).__init__()


   The super thing was a typo.


  def OnShowIncoming(self, connection):
  return True
 
  def OnShowOutgoing(self, connection):
  return True
 
  def GetMediaFormats(self):
return []
 
 
  SIP definitions:
 
  class OpalPCSSEndPoint : OpalLocalEndPoint /Abstract/
  {
 
  /**Call back to indicate that remote is ringing.
  If false is returned the call is aborted.
 
  The default implementation is pure.
  */
  virtual PBoolean OnShowIncoming(
  const OpalPCSSConnection  connection /NoCopy/ /// Connection having
 event
  ) = 0;
 
  /**Call back to indicate that remote is ringing.
  If false is returned the call is aborted.
 
  The default implementation is pure.
  */
  virtual PBoolean OnShowOutgoing(
  const OpalPCSSConnection  connection /NoCopy/ /// Connection having
 event
  ) = 0;
 
  };
 
  Now the base class of OpalPCSSEndPoint is also an ABC, as it derives
 from
  an
  ABC but does not re-define the pure virtual function:
 
  class OpalLocalEndPoint : OpalEndPoint /Abstract/
  {
...
  };
 
  class OpalEndPoint /Abstract/
  {
  virtual OpalMediaFormatList GetMediaFormats() const = 0;
  };
 
  I tried removing  /Abstract/ from OpalLocalEndPoint, but it made no
  difference.  Any idea what's wrong in this scenario? The only way this
  works, is if I subclass OpalPCSSEndPoint in C++ and then in Python
 create a
  class derived from my OpalPCSSEndPoint subclass.

 /Abstract/ is the cause of the problem. It doesn't mean that the C++ is
 an
 ABC, it means that the class contains other (unspecified) abstract
 methods.

 Phil


 So if /Abstract/ does not mean the class has pure virtual methods and
 cannot be instantiated itself, in which scenario should it be used? I'm a
 little confused here.



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

Re: [PyQt] Weird pyqtSignal behaviour

2011-07-01 Thread Demetrius Cassidy
On WinXP Pro and Python 2.7.1 this is what I get:

 class CX(QtCore.QObject):
... asig = QtCore.pyqtSignal()
... def __init__(self):
... QtCore.QObject.__init__(self)
... print self.asig
...
 k = CX()
bound signal asig of CX object at 0x00B91420

Using latest stable SIP and PyQt4 with Qt 4.7.2

On Mon, Jun 27, 2011 at 3:29 PM, Giuseppe Corbelli 
giuseppe.corbe...@copanitalia.com wrote:

 On 27/06/2011 17:23, Giuseppe Corbelli wrote:
  Hi all
 
  I have two boxes:
  Linux with PyQt-GPL 4.8.3/Qt 4.7.0/Python 2.6.6
  Windows 7 with PyQt-Commercial 4.8.4/Qt 4.7.3/ActivePython 2.6.6.18

 Forgot:
 sip 4.12.1 on Linux machine
 sip 4.12.3 on Linux machine

 --
Giuseppe Corbelli
 WASP Software Engineer, Copan Italia S.p.A
 Phone: +390303666104  Fax: +390302659932
 E-mail: giuseppe.corbe...@copanitalia.com
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt

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

Re: [PyQt] Inter-office distribution/installation of packages/modules

2011-06-16 Thread Demetrius Cassidy
Have you tried using py2exe? We have an application written in python with
many dependencies, and without py2exe we would have to create an installer
to manually install python and all the dependencies...And we initially did
that, but that was far more problematic in the end than deploying an .exe
(problems with multiple python installations, upgrading packages, upgrading
Python!, etc.)

Use py2exe along with gui2exe (makes deploying much simpler). It's not
perfect, and the project seems to have stalled, but it works. There is also
PyInstaller, but I have never gotten it to work with twisted and distutils.
It would also balloon our app because it started including every system32
dll it could find that was used!

On Thu, Jun 16, 2011 at 1:13 PM, James Polk jpolk5...@yahoo.com wrote:


 Apologies if this is too off-topic,but I'd like to propose a discussion
 of
 how-to's and where-fore's regarding distributing python modules to a
 user-base.

 Recently, I've been using Mark Hammond's excellent pywin32 packages,
 along with NumPy and PyOpenGL,etc.  I have a user-base of approx 40 or so,
 who will need these packages added to their base Python install.

 Rather than visit 40 separate desktops, I used pip  (pip freeze) to get a
 short list of packages outside the base install, and wrote an app that each
 user can run to find what's missing, and initiate the appropriate
 install,etc.
 Then I realized that pip itself was a 3rd party package!..DOh!

 I can fall back and use help('modules') to generate a new list, but it
 lists
 *everything* in the install,...usable but not as succinct, for pywin32 for
 example,
 it lists about a dozen things with a form of win32 in them,...and doesn't
 appear
 to return the real package name that is associated with the binary
 installation file.

 Surely these issues are fairly common phenomena in many workplaces,etc...
 I'm wondering if anybody out there has any knowledge, tips, or experiences
 regarding this issue that they can share.

 I've found moduleFinder, and various ideas about searching sys.path,
 pkgutils, but nothing else that seems like a long term viable and/or
 elegant solution.

 Thoughts anyone?

 Thanks,
 -Jim



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

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

Re: [PyQt] why do closeEvent and destroyed slot not get called on accepting PyQt4 QDialog?

2011-04-07 Thread Demetrius Cassidy
I truly believe you are approaching this from the wrong angle. If you need
to know when your QDialog is going away, you override closeEvent and do your
cleanup from there.

However, looking through the docs, it does not appear that destroy is
actually a signal. It's called from the QWidget dtor, so it makes sense that
if you call destroy(), you get the runtime error because you are deleting
the C++ object before the Python object. Do not call destroy yourself - call
self.close and override closeEvent. From there you can accept or reject
closing the dialog, and do any cleanup prior to your dialog being destroyed.

From the Qt Docs:

void QWidget::destroy ( bool destroyWindow = true, bool destroySubWindows =
true ) [protected]

Frees up window system resources. Destroys the widget window if
destroyWindow is true.

destroy() calls itself recursively for all the child widgets, passing
destroySubWindows for the destroyWindow parameter. To have more control over
destruction of subwidgets, destroy subwidgets selectively first.

This function is usually called from the QWidget destructor.

On Thu, Apr 7, 2011 at 3:04 AM, Rui DaCosta ru...@yahoo.com wrote:

 I know it can close it manually, the problem is that this is a
 simplification of a problem I had, in which we were expecting the QDialog to
 close as per the docs, but it did not.
 The *real* problem we are facing, is a bit further down the line, where we
 are getting the RuntimeError: underlying C/C++ object has been deleted
 but we never receive a destroyed signal.
 The only reason I need this signal or event is to do some teardown code for
 some callbacks to avoid getting this c++ error elsewhere.

 --
 *From:* Demetrius Cassidy dcassid...@gmail.com
 *To:* RuiDC ru...@yahoo.com
 *Sent:* Thu, 7 April, 2011 0:39:33
 *Subject:* Re: [PyQt] why do closeEvent and destroyed slot not get called
 on accepting PyQt4 QDialog?

 If you want to close, just call self.close. It's a slot, so you can map it
 to any signal. Also not sure why you want to know when your widget is
 destroyed? Let Python take care of it, you should not need to call
 sip.delete yourself. closeEvent is there if you need to know _when_ your app
 was requested to close. If you want to allow or reject closing the app, you
 need to use the QEvent object which gets passed to that function.

 On Wed, Apr 6, 2011 at 5:27 PM, RuiDC ru...@yahoo.com wrote:


 The question  code are here:

 http://stackoverflow.com/questions/5570402/why-do-closeevent-and-destroyed-slot-not-get-called-on-accepting-pyqt4-qdialog

 but hopefully someone here can give me an answer on:
 1. how to get the closeEvent to fire from accepting (or do I have to do a
 self.close()?)
 2. how to get the destroyed message to print (or do I have to go through
 sip.delete(my_widget)?)
 3. why, if I comment out the del my_widget, and uncomment the
 my_widget.destroy() I get a:
 RuntimeError: underlying C/C++ object has been deleted
 on the destroy() without the print!  i.e. how is it that it can be
 destroyed
 but not raise the signal?

 Thanks in advance,
 R
 --
 View this message in context:
 http://old.nabble.com/why-do-closeEvent-and-destroyed-slot-not-get-called-on-accepting-PyQt4-QDialog--tp31336229p31336229.html
 Sent from the PyQt mailing list archive at Nabble.com.

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



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

Re: [PyQt] why do closeEvent and destroyed slot not get called on accepting PyQt4 QDialog?

2011-04-07 Thread Demetrius Cassidy
Sorry found destroyed() - that's what happens when you reply to emails
before you have morning coffee. Anyway I'm not sure why destroyed() is never
fired. I tried your code and even modified it a bit to use the new style
slots and signals but it's not being fired.

Either way, I think the other points I raised in my last email are still
valid. IMHO using destroyed() in python is the wrong approach.

On Thu, Apr 7, 2011 at 11:02 AM, Demetrius Cassidy dcassid...@gmail.comwrote:

 I truly believe you are approaching this from the wrong angle. If you need
 to know when your QDialog is going away, you override closeEvent and do your
 cleanup from there.

 However, looking through the docs, it does not appear that destroy is
 actually a signal. It's called from the QWidget dtor, so it makes sense that
 if you call destroy(), you get the runtime error because you are deleting
 the C++ object before the Python object. Do not call destroy yourself - call
 self.close and override closeEvent. From there you can accept or reject
 closing the dialog, and do any cleanup prior to your dialog being destroyed.

 From the Qt Docs:

 void QWidget::destroy ( bool destroyWindow = true, bool destroySubWindows =
 true ) [protected]

 Frees up window system resources. Destroys the widget window if
 destroyWindow is true.

 destroy() calls itself recursively for all the child widgets, passing
 destroySubWindows for the destroyWindow parameter. To have more control over
 destruction of subwidgets, destroy subwidgets selectively first.

 This function is usually called from the QWidget destructor.

 On Thu, Apr 7, 2011 at 3:04 AM, Rui DaCosta ru...@yahoo.com wrote:

 I know it can close it manually, the problem is that this is a
 simplification of a problem I had, in which we were expecting the QDialog to
 close as per the docs, but it did not.
 The *real* problem we are facing, is a bit further down the line, where we
 are getting the RuntimeError: underlying C/C++ object has been deleted
 but we never receive a destroyed signal.
 The only reason I need this signal or event is to do some teardown code
 for some callbacks to avoid getting this c++ error elsewhere.

 --
 *From:* Demetrius Cassidy dcassid...@gmail.com
 *To:* RuiDC ru...@yahoo.com
 *Sent:* Thu, 7 April, 2011 0:39:33
 *Subject:* Re: [PyQt] why do closeEvent and destroyed slot not get called
 on accepting PyQt4 QDialog?

 If you want to close, just call self.close. It's a slot, so you can map it
 to any signal. Also not sure why you want to know when your widget is
 destroyed? Let Python take care of it, you should not need to call
 sip.delete yourself. closeEvent is there if you need to know _when_ your app
 was requested to close. If you want to allow or reject closing the app, you
 need to use the QEvent object which gets passed to that function.

 On Wed, Apr 6, 2011 at 5:27 PM, RuiDC ru...@yahoo.com wrote:


 The question  code are here:

 http://stackoverflow.com/questions/5570402/why-do-closeevent-and-destroyed-slot-not-get-called-on-accepting-pyqt4-qdialog

 but hopefully someone here can give me an answer on:
 1. how to get the closeEvent to fire from accepting (or do I have to do a
 self.close()?)
 2. how to get the destroyed message to print (or do I have to go through
 sip.delete(my_widget)?)
 3. why, if I comment out the del my_widget, and uncomment the
 my_widget.destroy() I get a:
 RuntimeError: underlying C/C++ object has been deleted
 on the destroy() without the print!  i.e. how is it that it can be
 destroyed
 but not raise the signal?

 Thanks in advance,
 R
 --
 View this message in context:
 http://old.nabble.com/why-do-closeEvent-and-destroyed-slot-not-get-called-on-accepting-PyQt4-QDialog--tp31336229p31336229.html
 Sent from the PyQt mailing list archive at Nabble.com.

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




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

Re: [PyQt] Help with QStateMachine and animations

2011-04-06 Thread Demetrius Cassidy

Actually I found out you can add this to a QAbstractTransition, but it does
not make a difference. It seems that the animation which moves widgets
off-screen does not play. I only see the widgets moving on-screen.

slightly modified code:

def _createAnimations(self):
self._stateProceeding = QState()
self._stateReleased = QState()
self._stateMachine = QStateMachine()

self._rtpAnimation = QPropertyAnimation(self.pageRTP, pos)
self._queueAnimation = QPropertyAnimation(self.pageQueue, pos)
self._rtpAnimation.setEasingCurve(QtCore.QEasingCurve.InOutCubic)
self._queueAnimation.setEasingCurve(QtCore.QEasingCurve.InOutCubic) 

self._rtpAnimation.setDuration(600)
self._queueAnimation.setDuration(self._rtpAnimation.duration())

transition = self._stateProceeding.addTransition(self.callReleased,
self._stateReleased)
transition.addAnimation(self._queueAnimation) #move off-screen
transition.addAnimation(self._rtpAnimation) #move on-screen
(works)

transition = self._stateReleased.addTransition(self.callProceeding,
self._stateProceeding)
transition.addAnimation(self._rtpAnimation) #move off-screen
transition.addAnimation(self._queueAnimation) #move on-screen
(works)


#start at 0,0 and move offscreen towards the right
self._stateProceeding.assignProperty(self.pageQueue, pos,
QPoint(self.pageQueue.width(), self.pageQueue.y()))

#set QStackedWidget index
self._stateProceeding.assignProperty(self.stackedWidget,
currentIndex, self.stackedWidget.indexOf(self.pageRTP))

#start offscreen from the left and move towards center
self._stateProceeding.assignProperty(self.pageRTP, pos,
QPoint(0,0))


#start offscreen from the right and move towards center
self._stateReleased.assignProperty(self.pageRTP, pos,
QPoint(-self.pageRTP.width(), self.pageRTP.y()))

#set QStackedWidget index
self._stateReleased.assignProperty(self.stackedWidget,
currentIndex, self.stackedWidget.indexOf(self.pageQueue))

#start at 0,0 and move offscreen towards the left
self._stateReleased.assignProperty(self.pageQueue, pos,
QPoint(0,0))


self._stateMachine.addState(self._stateReleased)
self._stateMachine.addState(self._stateProceeding)
   
self._stateMachine.setGlobalRestorePolicy(QStateMachine.DontRestoreProperties)
self._stateMachine.setInitialState(self._stateReleased)
self._stateMachine.start()





Demetrius Cassidy wrote:
 
 
 David Boddie wrote:
 
 Have you tried setting the animations on the transitions themselves
 instead
 of using default animations? Did this make a difference?
 
 David
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 
 What do you mean by setting it on the transition? QPropertyAnimation does
 not derive from QAbstractTransition so you can't add it by itself, and I
 don't see a start property =(
 
 Can you expand a bit on this?
 

-- 
View this message in context: 
http://old.nabble.com/Help-with-QStateMachine-and-animations-tp31319779p31335459.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] Help with QStateMachine and animations

2011-04-04 Thread Demetrius Cassidy
I am trying to animate a QTableView moving off-screen from center (0,0),
which is replaced by a QGroupBox which slides to 0,0 from off-screen inside
my QStackedWidget.

I am using a QStateMachine which contains two states, and basically when the
state 'stateProceeding' is entered, only the QGroupBox is animated - the
QTableView just seems to flash once, then the QStackedWidget index is
changed and QGroupBox is animated. Similarly, when it enters the
stateReleased state, the opposite happens - QTableView is animated, but not
the QGroupBox.

What am I doing wrong? I want these widgets to smoothly animate sliding on
and off-screen depending on the event.

each page is the QWidget page contained inside the QStackedWidget
self.pageQueue contains a QTableView
self.pageRTP contains a QGroupBox

Animation Code:

def _createAnimations(self):
self._stateProceeding = QState()
self._stateReleased = QState()

self._stateMachine = QStateMachine()

# when the signal callReleased is emitted while in the state
stateProceeding, move to state stateReleased
self._stateProceeding.addTransition(self.callReleased, self._stateReleased)

# reverse of the above
self._stateReleased.addTransition(self.callProceeding,
self._stateProceeding)

self._rtpAnimation = QPropertyAnimation(self.pageRTP, pos)
self._queueAnimation = QPropertyAnimation(self.pageQueue, pos)
self._rtpAnimation.setEasingCurve(QtCore.QEasingCurve.InOutCubic)
self._queueAnimation.setEasingCurve(QtCore.QEasingCurve.InOutCubic)
self._rtpAnimation.setDuration(600)
self._queueAnimation.setDuration(self._rtpAnimation.duration())


#start at 0,0 and move offscreen towards the right
self._stateProceeding.assignProperty(self.pageQueue, pos,
QPoint(self.pageQueue.width(), self.pageQueue.y()))

#set QStackedWidget index
self._stateProceeding.assignProperty(self.stackedWidget, currentIndex,
self.stackedWidget.indexOf(self.pageRTP))

#start offscreen from the left and move towards center
self._stateProceeding.assignProperty(self.pageRTP, pos, QPoint(0,0))


#start at 0,0 and move offscreen towards the left
self._stateReleased.assignProperty(self.pageQueue, pos, QPoint(0,0))

#set QStackedWidget index
self._stateReleased.assignProperty(self.stackedWidget, currentIndex,
self.stackedWidget.indexOf(self.pageQueue))

#start offscreen from the right and move towards center
self._stateReleased.assignProperty(self.pageRTP, pos,
QPoint(-self.pageRTP.width(), self.pageRTP.y()))


self._stateMachine.addState(self._stateReleased)
self._stateMachine.addState(self._stateProceeding)
self._stateMachine.addDefaultAnimation(self._queueAnimation)
self._stateMachine.addDefaultAnimation(self._rtpAnimation)
self._stateMachine.setGlobalRestorePolicy(QStateMachine.DontRestoreProperties)
self._stateMachine.setInitialState(self._stateReleased)
self._stateMachine.start()
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] sip bug wrapping protected enum in ABC

2011-03-21 Thread Demetrius Cassidy
With a simple class definition like the following, it seems that SIP tries
to wrap SIPTransaction::States using a sip generated class, but of course
that class is not created for ABCs. I am using the latest SIP snapshot, SIP
4.12.2-snapshot-ecb3e795382e, to test this code.


class SIPTransaction /Abstract/
{
public:
~SIPTransaction();
  virtual SIPTransaction * CreateDuplicate() const = 0;

protected:

enum States {
NotStarted,
Trying,
Proceeding,
Cancelling,
Completed,
Terminated_Success,
Terminated_Timeout,
Terminated_RetriesExceeded,
Terminated_TransportError,
Terminated_Cancelled,
Terminated_Aborted,
NumStates
};

 virtual void SetTerminated(States newState);
};


Offending generated code:

static sipEnumMemberDef enummembers_SIPTransaction[] = {
{sipName_Cancelling, sipSIPTransaction::Cancelling, 241},
{sipName_Completed, sipSIPTransaction::Completed, 241},
{sipName_NotStarted, sipSIPTransaction::NotStarted, 241},
{sipName_NumStates, sipSIPTransaction::NumStates, 241},
{sipName_Proceeding, sipSIPTransaction::Proceeding, 241},
{sipName_Terminated_Aborted, sipSIPTransaction::Terminated_Aborted, 241},
{sipName_Terminated_Cancelled, sipSIPTransaction::Terminated_Cancelled,
241},
{sipName_Terminated_RetriesExceeded,
sipSIPTransaction::Terminated_RetriesExceeded, 241},
{sipName_Terminated_Success, sipSIPTransaction::Terminated_Success, 241},
{sipName_Terminated_Timeout, sipSIPTransaction::Terminated_Timeout, 241},
{sipName_Terminated_TransportError,
sipSIPTransaction::Terminated_TransportError, 241},
{sipName_Trying, sipSIPTransaction::Trying, 241},
};

Of course, commenting out the code under protected stops it from being
generated, and causing compiler errors.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt4 4.7.5 configure fails under Python7 and sip 4.11

2010-09-06 Thread Demetrius Cassidy


Ah yes spaces. The bane of all evil - I forgot about that, thanks.

On 9/5/2010 10:05 PM, Robin M Baur wrote:

On Sun, Sep 5, 2010 at 19:17, Demetrius Cassidydcassid...@mass.rr.com  wrote:

Using PyQt-win-gpl-4.7.5 with sip 4.11 under Python7, configure fails with a
syntax error executing sip:

C:\Documents and Settings\dcassidy\My
Documents\Downloads\PyQt-win-gpl-4.7.5\PyQ
t-win-gpl-4.7.5python configure.py --confirm-license

[snip configure output]


Generating the C++ source for the QtCore module...
sip: Usage: sip [-h] [-V] [-a file] [-b file] [-c dir] [-d file] [-e] [-g]
[-I d
ir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag]
[-w] [
-x feature] [-z file] [file]
Error: Unable to create the C++ code.

In my (limited) experience, the usual cause of this error is that sip
doesn't understand paths with spaces in the file names.

HTH,
Robin



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


[PyQt] Qt.MatchFlags AND comparison

2010-09-05 Thread Demetrius Cassidy

Having a hard time figuring something that should be simple.

If I do Qt.MatchWildcard  Qt.MatchContains, it returns 1, but if I do
Qt.MatchContains  anything else (other than Qt.MatchContains itself) it
returns 0 as expected. What am I doing wrong, and how am I supposed to
compare my flags to a specific flag other than doing bitwise AND against the
other flag?
-- 
View this message in context: 
http://old.nabble.com/Qt.MatchFlags-AND-comparison-tp29627864p29627864.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] PyQt4 4.7.5 configure fails under Python7 and sip 4.11

2010-09-05 Thread Demetrius Cassidy

Using PyQt-win-gpl-4.7.5 with sip 4.11 under Python7, configure fails with a
syntax error executing sip:

C:\Documents and Settings\dcassidy\My
Documents\Downloads\PyQt-win-gpl-4.7.5\PyQ
t-win-gpl-4.7.5python configure.py --confirm-license
Determining the layout of your Qt installation...
This is the GPL version of PyQt 4.7.5 (licensed under the GNU General Public
License) for Python 2.7 on win32.
Checking to see if the QtGui module should be built...
Checking to see if the QtHelp module should be built...
Checking to see if the QtMultimedia module should be built...
Checking to see if the QtNetwork module should be built...
Checking to see if the QtOpenGL module should be built...
Checking to see if the QtScript module should be built...
Checking to see if the QtScriptTools module should be built...
Checking to see if the QtSql module should be built...
Checking to see if the QtSvg module should be built...
Checking to see if the QtTest module should be built...
Checking to see if the QtWebKit module should be built...
Checking to see if the QtXml module should be built...
Checking to see if the QtXmlPatterns module should be built...
Checking to see if the phonon module should be built...
Checking to see if the QtAssistant module should be built...
Checking to see if the QtDesigner module should be built...
Checking to see if the QAxContainer module should be built...
Qt v4.6.2 free edition is being used.
SIP 4.11 is being used.
The Qt header files are in C:\Qt\2010.02.1\qt\include.
The shared Qt libraries are in C:\Qt\2010.02.1\qt\lib.
The Qt binaries are in C:\Qt\2010.02.1\qt\bin.
The Qt mkspecs directory is in C:\Qt\2010.02.1\qt.
These PyQt modules will be built: QtCore, QtGui, QtHelp, QtMultimedia,
QtNetwork, QtOpenGL, QtScript, QtScriptTools, QtSql, QtSvg, QtTest,
QtWebKit,
QtXml, QtXmlPatterns, phonon, QtAssistant, QtDesigner, QAxContainer.
The PyQt Python package will be installed in C:\Python27\Lib\site-packages.
PyQt is being built with generated docstrings.
The Designer plugin will be installed in
C:\Qt\2010.02.1\qt\plugins\designer.
The PyQt .sip files will be installed in C:\Python27\sip\PyQt4.
pyuic4, pyrcc4 and pylupdate4 will be installed in C:\Python27.
Generating the C++ source for the QtCore module...
sip: Usage: sip [-h] [-V] [-a file] [-b file] [-c dir] [-d file] [-e] [-g]
[-I d
ir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag]
[-w] [
-x feature] [-z file] [file]
Error: Unable to create the C++ code.
-- 
View this message in context: 
http://old.nabble.com/PyQt4-4.7.5-configure-fails-under-Python7-and-sip-4.11-tp29627880p29627880.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] Is this a PyQt bug?

2010-07-30 Thread Demetrius Cassidy

I can confirm this also happens with the latest 4.7.5-f64f0e41c36c snapshot.
Sounds like a PyQt bug, though I have not looked at this other than testing
the code below.


Detlev Offenbach wrote:
 
 Hi,
 
 I am observing some strange behavior on Windows systems with latest
 installer. 
 Executing these lines in a Python console crash the interpreter.
 
 from PyQt4.QtNetwork import QLocalSocket
 s = QLocalSocket()
 
 I don't know, if this is a Qt bug or a PyQt bug.
 
 Regards,
 Detlev
 -- 
 Detlev Offenbach
 det...@die-offenbachs.de
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://old.nabble.com/Is-this-a-PyQt-bug--tp29308118p29309827.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] TypeError: type 'str' is not supported as a pyqtSignal() type argument type

2010-07-30 Thread Demetrius Cassidy

I am not sure why 'string' is no longer allowed in pyqtSignal. I tried using
the latest 4.7.5 snapshot, but this line below throws a type error:

pyqtSignal('string', 'string')


This was working fine as of 4.7.2 - any ideas?
-- 
View this message in context: 
http://old.nabble.com/TypeError%3A-type-%27str%27-is-not-supported-as-a-pyqtSignal%28%29-type-argument-type-tp29309835p29309835.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] TypeError: type 'str' is not supported as a pyqtSignal() type argument type

2010-07-30 Thread Demetrius Cassidy

I believe the single quotes would return a python str object. Now that I
think about it you are correct that string itself is not a type. But you
should be able pass a string instead of another object to get the same
results. At least that always worked for me prior to this release.

These fail:
 pyqtSignal('str')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: type 'str' is not supported as a pyqtSignal() type argument type
 pyqtSignal('list')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: type 'str' is not supported as a pyqtSignal() type argument type

But these work:
 pyqtSignal(str)
unbound signal 
 pyqtSignal(list)
unbound signal 


I am not sure if the above was working due to a bug that was fixed, or if
this change was intentional?


Phil Thompson-5 wrote:
 
 On Fri, 30 Jul 2010 13:54:06 -0700 (PDT), Demetrius Cassidy
 dcassid...@mass.rr.com wrote:
 I am not sure why 'string' is no longer allowed in pyqtSignal. I tried
 using
 the latest 4.7.5 snapshot, but this line below throws a type error:
 
 pyqtSignal('string', 'string')
 
 
 This was working fine as of 4.7.2 - any ideas?
 
 I don't see how that could ever have worked as 'string' is not the name of
 a type.
 
 Phil
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://old.nabble.com/TypeError%3A-type-%27str%27-is-not-supported-as-a-pyqtSignal%28%29-type-argument-type-tp29309835p29310401.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] SIP Bug: virtual function wrapped twice due to deep inheritance from base class and ABC

2010-07-03 Thread Demetrius Cassidy

There was a rogue enum in my sip file! I removed Reusability from
PIPSocket.sip and it works as intended now.

Thanks Phil.


Phil Thompson-5 wrote:
 
 On Fri, 2 Jul 2010 06:49:59 -0700 (PDT), Demetrius Cassidy
 dcassid...@mass.rr.com wrote:
 Sorry Phil - corrected inheritance tree:
 
 PUDPSocket - PIPDataGramSocket - PIPSocket - PSocket (ABC) 
 PTCPSocket - PIPSocket - PSocket (ABC)
 
 PUDPSocket does not have a 'Listen' function in it, instead it just
 inherits
 it from PIPSocket, who overrides PSocket. 
 
 No it doesn't. PIPSocket::Listen() has a different signature to
 PSocket::Listen() because they refer to different enums (both called
 Reusability).
 
 PTCPSocket DOES include a 'Listen' function in it, and overrides it from
 PIPSocket and PSocket.
 
 I've attached the corresponding sip files and the generated .cpp files
 from
 sip. 
 
 Below I've also included a snippet of the generated code for both
 classes.
 The weird thing is that SIP wraps the PIPSocket Listen function, along
 with
 the one from PSocket. http://old.nabble.com/file/p29056623/ptlib.rar
 ptlib.rar 
 
 
 class sipPUDPSocket : public PUDPSocket
 {
 public:
 
 
 /*
  * There is a protected method for every virtual method visible from
  * this class.
  */
 protected:
 ...
 PBoolean Listen(unsigned,WORD,PIPSocket::Reusability);
 PBoolean Listen(const
 PIPSocket::Address,unsigned,WORD,PIPSocket::Reusability);
 ...
 PBoolean Listen(unsigned,WORD,PSocket::Reusability);
 }
 
 class sipPTCPSocket : public PTCPSocket
 {
 public:
 ...
 /*
  * There is a protected method for every virtual method visible from
  * this class.
  */
 protected:
 PBoolean Listen(unsigned,WORD,PIPSocket::Reusability);
 PBoolean Listen(const
 PIPSocket::Address,unsigned,WORD,PIPSocket::Reusability);
 ...
 PBoolean Listen(unsigned,WORD,PSocket::Reusability);
 };
 
 Both classes share the same exact inheritance bug when wrapped:
 
 Given your .sip files, the above generated code is correct.
 
 It looks like you have a bug in your C++ code - I'd remove the
 PIPSocket::Reusability enum.
 
 Phil
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://old.nabble.com/SIP-Bug%3A-virtual-function-wrapped-twice-due-to-deep-inheritance-from-base-class-and-ABC-tp28936011p29064613.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] SIP Bug: virtual function wrapped twice due to deep inheritance from base class and ABC

2010-07-02 Thread Demetrius Cassidy

Sorry Phil - corrected inheritance tree:

PUDPSocket - PIPDataGramSocket - PIPSocket - PSocket (ABC) 
PTCPSocket - PIPSocket - PSocket (ABC)

PUDPSocket does not have a 'Listen' function in it, instead it just inherits
it from PIPSocket, who overrides PSocket. 

PTCPSocket DOES include a 'Listen' function in it, and overrides it from
PIPSocket and PSocket.

I've attached the corresponding sip files and the generated .cpp files from
sip. 

Below I've also included a snippet of the generated code for both classes.
The weird thing is that SIP wraps the PIPSocket Listen function, along with
the one from PSocket. http://old.nabble.com/file/p29056623/ptlib.rar
ptlib.rar 


class sipPUDPSocket : public PUDPSocket
{
public:


/*
 * There is a protected method for every virtual method visible from
 * this class.
 */
protected:
...
PBoolean Listen(unsigned,WORD,PIPSocket::Reusability);
PBoolean Listen(const
PIPSocket::Address,unsigned,WORD,PIPSocket::Reusability);
...
PBoolean Listen(unsigned,WORD,PSocket::Reusability);
}

class sipPTCPSocket : public PTCPSocket
{
public:
...
/*
 * There is a protected method for every virtual method visible from
 * this class.
 */
protected:
PBoolean Listen(unsigned,WORD,PIPSocket::Reusability);
PBoolean Listen(const
PIPSocket::Address,unsigned,WORD,PIPSocket::Reusability);
...
PBoolean Listen(unsigned,WORD,PSocket::Reusability);
};

Both classes share the same exact inheritance bug when wrapped:

Phil Thompson-5 wrote:
 
 On Thu, 1 Jul 2010 17:53:23 -0700 (PDT), Demetrius Cassidy
 dcassid...@mass.rr.com wrote:
 Phil,
 
 It's not code specific to that class. It's due to the deep inheritance
 tree.
 You should be able to run my test code and get the same results.
 
 Basically to sum it up:
 
 PTCPSocket  - PIPDataGramSocket - PIPSocket - PSocket (ABC)
 
 PTCPSocket, PIPSocket and PSocket all define a virtual function called
 'Listen'.
 Commenting 'Listen' out from PSocket, and SIP does not include the
 function
 twice.
 Listen is NOT a pure virtual function in the ABC, it has a body.
 Listen is fully defined in PTCPSocket, and the other classes except
 PIPDataGramSocket.
 
 The error appears in PUDPSocket but you don't even mention that class.
 Where does it fit in the inheritance tree?
 
 Phil
 
 
 Phil Thompson-5 wrote:
 
 On Sat, 19 Jun 2010 10:27:55 -0700 (PDT), Demetrius Cassidy
 dcassid...@mass.rr.com wrote:
 Basically I have a Listen() function in a derived class, that is also
 in
 the 
 base and ABC. For some reason sip ends up wrapping the same function
 twice
 (it 
 has a body in the ABC), even though it's a virtual function in all of
 the
 
 derived classes. If I comment out this function in the ABC, everything
 works 
 fine, but otherwise I get a C2535 compiler error with Visual C++. 
  
 Here is what sip comes up with: 
  
 class sipPUDPSocket : public PUDPSocket 
 { 
  
 /* 
  * There is a protected method for every virtual method visible
 from

  * this class. 
  */ 
  protected: 
 PBoolean Listen(unsigned,WORD,PIPSocket::Reusability); 
 /*more wrapped functions*/ 
 PBoolean Listen(unsigned,WORD,PIPSocket::Reusability); // --
 duplicate
 function 
 }; 
  
 C++ nmake errors: 
  
 sippyptlibPTCPSocket.cpp 
 .\sippyptlibPTCPSocket.cpp(121) : error C2535: 'PBoolean 
 sipPTCPSocket::Listen(unsigned int,WORD,PSocket::Reusability)' 
 : member function already defined or declared 
 .\sippyptlibPTCPSocket.cpp(102) : see declaration of 
 'sipPTCPSocket::Listen' 
  
  
 .\sippyptlibPTCPSocket.cpp(506) : error C2084: function 'PBoolean
 sipPTCPSocket: 
 :Listen(unsigned int,WORD,PSocket::Reusability)' already has a body 
 .\sippyptlibPTCPSocket.cpp(102) : see previous definition of
 'Listen' 
  
  
 Basic code structure based on what I am wrapping - note that I only
 included
 the 
 offending function here, as it would be too much code to include
 everything. 
 
 But you at least need to include the definition of PUDPSocket.
 
 typedef bool PBoolean; 
  
 class PTCPSocket : PIPDataGramSocket 
 { 
  public: 
   virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); 
 } 
  
 class PIPDataGramSocket : PIPSocket 
 { 
   protected: 
 PIPDataGramSocket(); 
 } 
  
 class PIPSocket : PSocket 
 { 
  public: 
   virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); 
 } 
  
 class PSocket /Abstract/ 
 { 
   public: 
 /// Flags to reuse of port numbers in Listen() function. 
 enum Reusability { 
   CanReuseAddress, 
   AddressIsExclusive 
 }; 
  
   virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); //
 
 commenting this function out fixes this problem 
  
  protected: 
 /*This function calls os_socket() with the correct parameters for
 the
 
socket protocol type. 
  */ 
 virtual PBoolean OpenSocket() = 0; 
  
 }; 
 
 Phil
 ___
 PyQt

Re: [PyQt] SIP Bug: virtual function wrapped twice due to deep inheritance from base class and ABC

2010-07-01 Thread Demetrius Cassidy

Phil,

It's not code specific to that class. It's due to the deep inheritance tree.
You should be able to run my test code and get the same results.

Basically to sum it up:

PTCPSocket  - PIPDataGramSocket - PIPSocket - PSocket (ABC)

PTCPSocket, PIPSocket and PSocket all define a virtual function called
'Listen'.
Commenting 'Listen' out from PSocket, and SIP does not include the function
twice.
Listen is NOT a pure virtual function in the ABC, it has a body.
Listen is fully defined in PTCPSocket, and the other classes except
PIPDataGramSocket.



Phil Thompson-5 wrote:
 
 On Sat, 19 Jun 2010 10:27:55 -0700 (PDT), Demetrius Cassidy
 dcassid...@mass.rr.com wrote:
 Basically I have a Listen() function in a derived class, that is also in
 the 
 base and ABC. For some reason sip ends up wrapping the same function
 twice
 (it 
 has a body in the ABC), even though it's a virtual function in all of the
 
 derived classes. If I comment out this function in the ABC, everything
 works 
 fine, but otherwise I get a C2535 compiler error with Visual C++. 
  
 Here is what sip comes up with: 
  
 class sipPUDPSocket : public PUDPSocket 
 { 
  
 /* 
  * There is a protected method for every virtual method visible from 
  * this class. 
  */ 
  protected: 
 PBoolean Listen(unsigned,WORD,PIPSocket::Reusability); 
 /*more wrapped functions*/ 
 PBoolean Listen(unsigned,WORD,PIPSocket::Reusability); // --
 duplicate
 function 
 }; 
  
 C++ nmake errors: 
  
 sippyptlibPTCPSocket.cpp 
 .\sippyptlibPTCPSocket.cpp(121) : error C2535: 'PBoolean 
 sipPTCPSocket::Listen(unsigned int,WORD,PSocket::Reusability)' 
 : member function already defined or declared 
 .\sippyptlibPTCPSocket.cpp(102) : see declaration of 
 'sipPTCPSocket::Listen' 
  
  
 .\sippyptlibPTCPSocket.cpp(506) : error C2084: function 'PBoolean
 sipPTCPSocket: 
 :Listen(unsigned int,WORD,PSocket::Reusability)' already has a body 
 .\sippyptlibPTCPSocket.cpp(102) : see previous definition of
 'Listen' 
  
  
 Basic code structure based on what I am wrapping - note that I only
 included
 the 
 offending function here, as it would be too much code to include
 everything. 
 
 But you at least need to include the definition of PUDPSocket.
 
 typedef bool PBoolean; 
  
 class PTCPSocket : PIPDataGramSocket 
 { 
  public: 
   virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); 
 } 
  
 class PIPDataGramSocket : PIPSocket 
 { 
   protected: 
 PIPDataGramSocket(); 
 } 
  
 class PIPSocket : PSocket 
 { 
  public: 
   virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); 
 } 
  
 class PSocket /Abstract/ 
 { 
   public: 
 /// Flags to reuse of port numbers in Listen() function. 
 enum Reusability { 
   CanReuseAddress, 
   AddressIsExclusive 
 }; 
  
   virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); // 
 commenting this function out fixes this problem 
  
  protected: 
 /*This function calls os_socket() with the correct parameters for the
 
socket protocol type. 
  */ 
 virtual PBoolean OpenSocket() = 0; 
  
 }; 
 
 Phil
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://old.nabble.com/SIP-Bug%3A-virtual-function-wrapped-twice-due-to-deep-inheritance-from-base-class-and-ABC-tp28936011p29051687.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] SIP Bug: virtual function wrapped twice due to deep inheritance from base class and ABC

2010-06-21 Thread Demetrius Cassidy

Phil - have you seen this yet? Any comments?


Demetrius Cassidy wrote:
 
 Basically I have a Listen() function in a derived class, that is also in
 the 
 base and ABC. For some reason sip ends up wrapping the same function twice
 (it 
 has a body in the ABC), even though it's a virtual function in all of the 
 derived classes. If I comment out this function in the ABC, everything
 works 
 fine, but otherwise I get a C2535 compiler error with Visual C++. 
  
 Here is what sip comes up with: 
  
 class sipPUDPSocket : public PUDPSocket 
 { 
  
 /* 
  * There is a protected method for every virtual method visible from 
  * this class. 
  */ 
  protected: 
 PBoolean Listen(unsigned,WORD,PIPSocket::Reusability); 
 /*more wrapped functions*/ 
 PBoolean Listen(unsigned,WORD,PIPSocket::Reusability); // --
 duplicate 
 function 
 }; 
  
 C++ nmake errors: 
  
 sippyptlibPTCPSocket.cpp 
 .\sippyptlibPTCPSocket.cpp(121) : error C2535: 'PBoolean 
 sipPTCPSocket::Listen(unsigned int,WORD,PSocket::Reusability)' 
 : member function already defined or declared 
 .\sippyptlibPTCPSocket.cpp(102) : see declaration of 
 'sipPTCPSocket::Listen' 
  
  
 .\sippyptlibPTCPSocket.cpp(506) : error C2084: function 'PBoolean
 sipPTCPSocket: 
 :Listen(unsigned int,WORD,PSocket::Reusability)' already has a body 
 .\sippyptlibPTCPSocket.cpp(102) : see previous definition of
 'Listen' 
  
  
 Basic code structure based on what I am wrapping - note that I only
 included the 
 offending function here, as it would be too much code to include
 everything. 
  
 typedef bool PBoolean; 
  
 class PTCPSocket : PIPDataGramSocket 
 { 
  public: 
   virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); 
 } 
  
 class PIPDataGramSocket : PIPSocket 
 { 
   protected: 
 PIPDataGramSocket(); 
 } 
  
 class PIPSocket : PSocket 
 { 
  public: 
   virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); 
 } 
  
 class PSocket /Abstract/ 
 { 
   public: 
 /// Flags to reuse of port numbers in Listen() function. 
 enum Reusability { 
   CanReuseAddress, 
   AddressIsExclusive 
 }; 
  
   virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); // 
 commenting this function out fixes this problem 
  
  protected: 
 /*This function calls os_socket() with the correct parameters for the 
socket protocol type. 
  */ 
 virtual PBoolean OpenSocket() = 0; 
  
 }; 
  
 -- 
 Regards, 
  -Demetrius Cassidy 
 
 

-- 
View this message in context: 
http://old.nabble.com/SIP-Bug%3A-virtual-function-wrapped-twice-due-to-deep-inheritance-from-base-class-and-ABC-tp28936011p28953735.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] SIP Bug: virtual function wrapped twice due to deep inheritance from base class and ABC

2010-06-19 Thread Demetrius Cassidy

Basically I have a Listen() function in a derived class, that is also in the 
base and ABC. For some reason sip ends up wrapping the same function twice
(it 
has a body in the ABC), even though it's a virtual function in all of the 
derived classes. If I comment out this function in the ABC, everything works 
fine, but otherwise I get a C2535 compiler error with Visual C++. 
 
Here is what sip comes up with: 
 
class sipPUDPSocket : public PUDPSocket 
{ 
 
/* 
 * There is a protected method for every virtual method visible from 
 * this class. 
 */ 
 protected: 
PBoolean Listen(unsigned,WORD,PIPSocket::Reusability); 
/*more wrapped functions*/ 
PBoolean Listen(unsigned,WORD,PIPSocket::Reusability); // -- duplicate 
function 
}; 
 
C++ nmake errors: 
 
sippyptlibPTCPSocket.cpp 
.\sippyptlibPTCPSocket.cpp(121) : error C2535: 'PBoolean 
sipPTCPSocket::Listen(unsigned int,WORD,PSocket::Reusability)' 
: member function already defined or declared 
.\sippyptlibPTCPSocket.cpp(102) : see declaration of 
'sipPTCPSocket::Listen' 
 
 
.\sippyptlibPTCPSocket.cpp(506) : error C2084: function 'PBoolean
sipPTCPSocket: 
:Listen(unsigned int,WORD,PSocket::Reusability)' already has a body 
.\sippyptlibPTCPSocket.cpp(102) : see previous definition of
'Listen' 
 
 
Basic code structure based on what I am wrapping - note that I only included
the 
offending function here, as it would be too much code to include everything. 
 
typedef bool PBoolean; 
 
class PTCPSocket : PIPDataGramSocket 
{ 
 public: 
  virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); 
} 
 
class PIPDataGramSocket : PIPSocket 
{ 
  protected: 
PIPDataGramSocket(); 
} 
 
class PIPSocket : PSocket 
{ 
 public: 
  virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); 
} 
 
class PSocket /Abstract/ 
{ 
  public: 
/// Flags to reuse of port numbers in Listen() function. 
enum Reusability { 
  CanReuseAddress, 
  AddressIsExclusive 
}; 
 
  virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); // 
commenting this function out fixes this problem 
 
 protected: 
/*This function calls os_socket() with the correct parameters for the 
   socket protocol type. 
 */ 
virtual PBoolean OpenSocket() = 0; 
 
}; 
 
-- 
Regards, 
 -Demetrius Cassidy 

-- 
View this message in context: 
http://old.nabble.com/SIP-Bug%3A-virtual-function-wrapped-twice-due-to-deep-inheritance-from-base-class-and-ABC-tp28936011p28936011.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] Help - WINAPI PSoundW and WINAPI Beep linker error using sip

2010-04-03 Thread Demetrius Cassidy

Still need help with this =(

I've tried adding this to my sip file:
%ModuleHeaderCode
#include mmsystem.h
#pragma comment(lib, winmm.lib)
%End

Tried adding the same code above directly to the offending .cpp files:
#include mmsystem.h
#pragma comment(lib, winmm.lib)

And tried just copying winmm.lib into the folder with the makefile, and
anywhere else where LIBPATH is looking and it won't link the damn thing.
Help!!



link /NOLOGO /DLL /MANIFEST /MANIFESTFILE:pyptlib.pyd.manifest
/SUBSYSTE
M:WINDOWS /MANIFESTDEPENDENCY:type='win32'
name='Microsoft.Windows.Common-Contr
ols' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*'
processorA
rchitecture='*' /INCREMENTAL:NO /OUT:pyptlib.pyd
@C:\DOCUME~1\dcassidy\LOCALS~1
\Temp\nm33B.tmp
   Creating library pyptlib.lib and object pyptlib.exp
sippyptlibPSoundChannelWin32.obj : error LNK2001: unresolved external symbol
pu
blic: virtual bool __thiscall PSoundChannelWin32::PlaySoundW(class PSound
const
,bool) (?playsou...@psoundchannelwin32@@UAE_NABVPSound@@_...@z)
sippyptlibPSoundChannel.obj : error LNK2001: unresolved external symbol
public:
 virtual bool __thiscall PSoundChannel::PlaySoundW(class PSound const
,bool) (
?playsou...@psoundchannel@@UAE_NABVPSound@@_...@z)
sippyptlibPFile.obj : error LNK2019: unresolved external symbol public:
bool __
thiscall PFile::Move(class PFilePath const ,bool)
(?m...@pfile@@QAE_NABVPFileP
ath@@_...@z) referenced in function _meth_PFile_Move
pyptlib.pyd : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: 'c:\Program Files\Microsoft Visual Studio
9.0\VC\BIN
\link.EXE' : return code '0x460'
Stop.


Demetrius Cassidy wrote:
 
 I found out I need to include winmm.lib, but I can't figure out how to
 force sip to include this. I tried adding /LIBPATH:C:\Program
 Files\Microsoft SDKs\Windows\v6.0A\Lib and including winmm.lib under LIBS
 of the makefile, but I still get the same linker errors.
 
 LIBS = /LIBPATH:$(PTLIBDIR)/lib /LIBPATH:C:\Program Files\Microsoft
 SDKs\Windows\v6.0A\Lib
 /LIBPATH:C:\iPhoneDev\h323lib\sip\qpy\QtCore\release
 /LIBPATH:C:\Python26\libs qpycore.lib ptlib.lib winmm.lib python26.lib
 
 
 
 Demetrius Cassidy wrote:
 
 I am not sure what do I need to do to include the windows library into
 sip, so it links correctly. I am trying to use PlaySoundW and Beep which
 are defined in MMSystem.h in a class called PSound. It compiles fine in
 VC9.0, but gives me linker errors when I wrap it with sip.
 
 Generating Code...
 link /NOLOGO /DLL /MANIFEST /MANIFESTFILE:pyptlib.pyd.manifest
 /SUBSYSTE
 M:WINDOWS /MANIFESTDEPENDENCY:type='win32'
 name='Microsoft.Windows.Common-Contr
 ols' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*'
 processorA
 rchitecture='*' /INCREMENTAL:NO /OUT:pyptlib.pyd
 @C:\DOCUME~1\dcassidy\LOCALS~1
 \Temp\nm1047.tmp
Creating library pyptlib.lib and object pyptlib.exp
 sippyptlibPSoundChannel.obj : error LNK2019: unresolved external symbol
 public:
  virtual bool __thiscall PSoundChannel::PlaySoundW(class PSound const
 ,bool) (
 ?playsou...@psoundchannel@@UAE_NABVPSound@@_...@z) referenced in function
 protect
 ed: virtual bool __thiscall sipPSoundChannel::PlaySoundW(class PSound
 const ,bo
 ol) (?playsou...@sippsoundchannel@@MAE_NABVPSound@@_...@z)
 sippyptlibPSound.obj : error LNK2019: unresolved external symbol public:
 static
  void __cdecl PSound::Beep(void) (?b...@psound@@SAXXZ) referenced in
 function _
 meth_PSound_Beep
 pyptlib.pyd : fatal error LNK1120: 2 unresolved externals
 NMAKE : fatal error U1077: 'c:\Program Files\Microsoft Visual Studio
 9.0\VC\BIN
 \link.EXE' : return code '0x460'
 Stop.
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Help---WINAPI-PSoundW-and-WINAPI-Beep-linker-error-using-sip-tp27966897p28129527.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] Help - WINAPI PSoundW and WINAPI Beep linker error using sip

2010-04-03 Thread Demetrius Cassidy

Found the problem...winmm library was compiled with ANSI Character set, but
sip forces Unicode character set. I had to re-compile my sip wrapped with
ANSI character set instead.



Demetrius Cassidy wrote:
 
 Still need help with this =(
 
 I've tried adding this to my sip file:
 %ModuleHeaderCode
 #include mmsystem.h
 #pragma comment(lib, winmm.lib)
 %End
 
 Tried adding the same code above directly to the offending .cpp files:
 #include mmsystem.h
 #pragma comment(lib, winmm.lib)
 
 And tried just copying winmm.lib into the folder with the makefile, and
 anywhere else where LIBPATH is looking and it won't link the damn thing.
 Help!!
 
 
 
 link /NOLOGO /DLL /MANIFEST /MANIFESTFILE:pyptlib.pyd.manifest
 /SUBSYSTE
 M:WINDOWS /MANIFESTDEPENDENCY:type='win32'
 name='Microsoft.Windows.Common-Contr
 ols' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*'
 processorA
 rchitecture='*' /INCREMENTAL:NO /OUT:pyptlib.pyd
 @C:\DOCUME~1\dcassidy\LOCALS~1
 \Temp\nm33B.tmp
Creating library pyptlib.lib and object pyptlib.exp
 sippyptlibPSoundChannelWin32.obj : error LNK2001: unresolved external
 symbol pu
 blic: virtual bool __thiscall PSoundChannelWin32::PlaySoundW(class PSound
 const
 ,bool) (?playsou...@psoundchannelwin32@@UAE_NABVPSound@@_...@z)
 sippyptlibPSoundChannel.obj : error LNK2001: unresolved external symbol
 public:
  virtual bool __thiscall PSoundChannel::PlaySoundW(class PSound const
 ,bool) (
 ?playsou...@psoundchannel@@UAE_NABVPSound@@_...@z)
 sippyptlibPFile.obj : error LNK2019: unresolved external symbol public:
 bool __
 thiscall PFile::Move(class PFilePath const ,bool)
 (?m...@pfile@@QAE_NABVPFileP
 ath@@_...@z) referenced in function _meth_PFile_Move
 pyptlib.pyd : fatal error LNK1120: 3 unresolved externals
 NMAKE : fatal error U1077: 'c:\Program Files\Microsoft Visual Studio
 9.0\VC\BIN
 \link.EXE' : return code '0x460'
 Stop.
 
 
 Demetrius Cassidy wrote:
 
 I found out I need to include winmm.lib, but I can't figure out how to
 force sip to include this. I tried adding /LIBPATH:C:\Program
 Files\Microsoft SDKs\Windows\v6.0A\Lib and including winmm.lib under
 LIBS of the makefile, but I still get the same linker errors.
 
 LIBS = /LIBPATH:$(PTLIBDIR)/lib /LIBPATH:C:\Program Files\Microsoft
 SDKs\Windows\v6.0A\Lib
 /LIBPATH:C:\iPhoneDev\h323lib\sip\qpy\QtCore\release
 /LIBPATH:C:\Python26\libs qpycore.lib ptlib.lib winmm.lib python26.lib
 
 
 
 Demetrius Cassidy wrote:
 
 I am not sure what do I need to do to include the windows library into
 sip, so it links correctly. I am trying to use PlaySoundW and Beep which
 are defined in MMSystem.h in a class called PSound. It compiles fine in
 VC9.0, but gives me linker errors when I wrap it with sip.
 
 Generating Code...
 link /NOLOGO /DLL /MANIFEST /MANIFESTFILE:pyptlib.pyd.manifest
 /SUBSYSTE
 M:WINDOWS /MANIFESTDEPENDENCY:type='win32'
 name='Microsoft.Windows.Common-Contr
 ols' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*'
 processorA
 rchitecture='*' /INCREMENTAL:NO /OUT:pyptlib.pyd
 @C:\DOCUME~1\dcassidy\LOCALS~1
 \Temp\nm1047.tmp
Creating library pyptlib.lib and object pyptlib.exp
 sippyptlibPSoundChannel.obj : error LNK2019: unresolved external symbol
 public:
  virtual bool __thiscall PSoundChannel::PlaySoundW(class PSound const
 ,bool) (
 ?playsou...@psoundchannel@@UAE_NABVPSound@@_...@z) referenced in function
 protect
 ed: virtual bool __thiscall sipPSoundChannel::PlaySoundW(class PSound
 const ,bo
 ol) (?playsou...@sippsoundchannel@@MAE_NABVPSound@@_...@z)
 sippyptlibPSound.obj : error LNK2019: unresolved external symbol
 public: static
  void __cdecl PSound::Beep(void) (?b...@psound@@SAXXZ) referenced in
 function _
 meth_PSound_Beep
 pyptlib.pyd : fatal error LNK1120: 2 unresolved externals
 NMAKE : fatal error U1077: 'c:\Program Files\Microsoft Visual Studio
 9.0\VC\BIN
 \link.EXE' : return code '0x460'
 Stop.
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Help---WINAPI-PSoundW-and-WINAPI-Beep-linker-error-using-sip-tp27966897p28130570.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] Help - WINAPI PSoundW and WINAPI Beep linker error using sip

2010-03-20 Thread Demetrius Cassidy

I am not sure what do I need to do to include the windows library into sip,
so it links correctly. I am trying to use PlaySoundW and Beep which are
defined in MMSystem.h in a class called PSound. It compiles fine in VC9.0,
but gives me linker errors when I wrap it with sip.

Generating Code...
link /NOLOGO /DLL /MANIFEST /MANIFESTFILE:pyptlib.pyd.manifest
/SUBSYSTE
M:WINDOWS /MANIFESTDEPENDENCY:type='win32'
name='Microsoft.Windows.Common-Contr
ols' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*'
processorA
rchitecture='*' /INCREMENTAL:NO /OUT:pyptlib.pyd
@C:\DOCUME~1\dcassidy\LOCALS~1
\Temp\nm1047.tmp
   Creating library pyptlib.lib and object pyptlib.exp
sippyptlibPSoundChannel.obj : error LNK2019: unresolved external symbol
public:
 virtual bool __thiscall PSoundChannel::PlaySoundW(class PSound const
,bool) (
?playsou...@psoundchannel@@UAE_NABVPSound@@_...@z) referenced in function
protect
ed: virtual bool __thiscall sipPSoundChannel::PlaySoundW(class PSound const
,bo
ol) (?playsou...@sippsoundchannel@@MAE_NABVPSound@@_...@z)
sippyptlibPSound.obj : error LNK2019: unresolved external symbol public:
static
 void __cdecl PSound::Beep(void) (?b...@psound@@SAXXZ) referenced in
function _
meth_PSound_Beep
pyptlib.pyd : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: 'c:\Program Files\Microsoft Visual Studio
9.0\VC\BIN
\link.EXE' : return code '0x460'
Stop.
-- 
View this message in context: 
http://old.nabble.com/Help---WINAPI-PSoundW-and-WINAPI-Beep-linker-error-using-sip-tp27966897p27966897.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] Help - WINAPI PSoundW and WINAPI Beep linker error using sip

2010-03-20 Thread Demetrius Cassidy

I found out I need to include winmm.lib, but I can't figure out how to force
sip to include this. I tried adding /LIBPATH:C:\Program Files\Microsoft
SDKs\Windows\v6.0A\Lib and including winmm.lib under LIBS of the makefile,
but I still get the same linker errors.

LIBS = /LIBPATH:$(PTLIBDIR)/lib /LIBPATH:C:\Program Files\Microsoft
SDKs\Windows\v6.0A\Lib /LIBPATH:C:\iPhoneDev\h323lib\sip\qpy\QtCore\release
/LIBPATH:C:\Python26\libs qpycore.lib ptlib.lib winmm.lib python26.lib



Demetrius Cassidy wrote:
 
 I am not sure what do I need to do to include the windows library into
 sip, so it links correctly. I am trying to use PlaySoundW and Beep which
 are defined in MMSystem.h in a class called PSound. It compiles fine in
 VC9.0, but gives me linker errors when I wrap it with sip.
 
 Generating Code...
 link /NOLOGO /DLL /MANIFEST /MANIFESTFILE:pyptlib.pyd.manifest
 /SUBSYSTE
 M:WINDOWS /MANIFESTDEPENDENCY:type='win32'
 name='Microsoft.Windows.Common-Contr
 ols' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*'
 processorA
 rchitecture='*' /INCREMENTAL:NO /OUT:pyptlib.pyd
 @C:\DOCUME~1\dcassidy\LOCALS~1
 \Temp\nm1047.tmp
Creating library pyptlib.lib and object pyptlib.exp
 sippyptlibPSoundChannel.obj : error LNK2019: unresolved external symbol
 public:
  virtual bool __thiscall PSoundChannel::PlaySoundW(class PSound const
 ,bool) (
 ?playsou...@psoundchannel@@UAE_NABVPSound@@_...@z) referenced in function
 protect
 ed: virtual bool __thiscall sipPSoundChannel::PlaySoundW(class PSound
 const ,bo
 ol) (?playsou...@sippsoundchannel@@MAE_NABVPSound@@_...@z)
 sippyptlibPSound.obj : error LNK2019: unresolved external symbol public:
 static
  void __cdecl PSound::Beep(void) (?b...@psound@@SAXXZ) referenced in
 function _
 meth_PSound_Beep
 pyptlib.pyd : fatal error LNK1120: 2 unresolved externals
 NMAKE : fatal error U1077: 'c:\Program Files\Microsoft Visual Studio
 9.0\VC\BIN
 \link.EXE' : return code '0x460'
 Stop.
 

-- 
View this message in context: 
http://old.nabble.com/Help---WINAPI-PSoundW-and-WINAPI-Beep-linker-error-using-sip-tp27966897p27970324.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] Connecting to base class signals in subclass

2010-03-19 Thread Demetrius Cassidy

I am not sure if this is the intended behavior, but if I subclass a QWidget
instance, and then try to connect to one of those signals in my subclass, I
get a TypeError:

 class MyLabel(QtGui.QLabel):
... def __init__(self):
... self.linkActivated.connect(self._lnkActivated)
...
... def _lnkActivated(self, link):
... pass
...
 l = MyLabel()
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 3, in __init__
TypeError: pyqtSignal must be bound to a QObject, not 'MyLabel'


Why can't I connect to my base class's signals in my subclass? 
-- 
View this message in context: 
http://old.nabble.com/Connecting-to-base-class-signals-in-subclass-tp27951038p27951038.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] Limit the height of a Layout

2010-03-03 Thread Demetrius Cassidy
It's generated code - it's not supposed to be pretty. All you do is 
import the gui code from your dialog class which is in a separate file. 
It keeps things clean and simple, and you won't have to start looking 
around APIs for stuff that QtDesigner does for you.


On 3/3/2010 6:56 AM, starglider develop wrote:

Thank you for your replay, but I'm doing everything by code,
I try to simulate a form with QtDesigner but the genereted code is a mess.

Regards,

Jorge

On 3 March 2010 01:37, dcassid...@mass.rr.com 
mailto:dcassid...@mass.rr.com wrote:


Are you using QtDesigner? You can set the min and max size for
each widget, so I'd probably look at that.
--
Regards,
 -Demetrius Cassidy

 starglider develop starglider@gmail.com
mailto:starglider@gmail.com wrote:

=
Hello,
I'm a newby and I have a question:
how can I limit the height of a QHBoxLayout?
e.g.:
There is a  central widget with a QHBoxLayout that as two
QTableWidget and I
want to limit the size of the first QTableWidget to 300 points,
but let the second QTableWidget grow until the limit of the screen.

Thank you in advance for your help.



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


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

Re: [PyQt] Trouble reading a model index from an untouched combo box

2010-01-27 Thread Demetrius Cassidy
Just took a peak at QAbstractItemView class and your right it's fully 
implemented. The view is asking the selectionModel what the current 
selected index is, and if it has no selection model (not sure if that's 
even possible) it returns an invalid QModelIndex. QComboBox.currentIndex 
is just asking the QSqlTableModel for the row. It doesn't hurt to make a 
1 line code change to test it out. I use QComboBox.currentIndex in my 
app, though I have no need to change the model in QComboBox.


Andreas Pakulat wrote:

On 26.01.10 17:41:40, Demetrius Cassidy wrote:
  

I don't think you need to use the view pointer at all - it's
returning QAbstractItemView *, which I would assume it would need to
be casted to the proper class in C++. If that's so, by design the
Abstract class will return an invalid index.



I don't think so ;) The function currentIndex on the view is not
virtual, so its implemented in the abstract class already properly.

And to get a model index to index into the model its easier to ask the
view for it, rather than constructing it yourself with model-index(
combobox-currentIndex(), model-column, QModelIndex())

Andreas

  


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

Re: [PyQt] SIP build problem with VS2008 Express Edition

2010-01-26 Thread Demetrius Cassidy
It's very likely that PyQt 4.4.4 uses some deprecated syntax that was 
removed in SIP 4.8. Are you not able to build using the latest PyQt4 
release?


Darryl Wallace wrote:

Hello,

I am trying to build SIP v4.7.9 with VS2008 Express Edition and Python 
2.5.4 via the Visual Studio 2008 Command Prompt.


When I attempt to run sip.exe from the c:\python25 I get the dreaded 
R6034 Runtime Error!


R6034
An application has made an attempt to load the C runtime library 
incorrectly.

Please contact the application's support team for more information.

The odd thing is that sip.exe will run if left in the sip4.7.9\sipgen 
directory.


Has any one come across this?   I am trying to build PyQt4.4.4.

Side note: I've just attempted to build SIP4.8.2 and SIP 4.10 and now, 
these works properly.  But now when I run configure.py for PyQt4.4.4 I 
get the following error:

sip: sip/QtCore/QtCoremod.sip:73: syntax error

Thanks,
Darryl


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


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


Re: [PyQt] Trouble reading a model index from an untouched combo box

2010-01-26 Thread Demetrius Cassidy
How about selecting index 0 once the combobox is initialized with the 
database data? It sounds to me that it has no valid index when first 
initialized, and if you try to programmatically select the first index, 
it's returning an invalid one. You don't need to generate a signal, just 
use something like .setCurrentIndex(0).


Claudio Felix wrote:

Hi everyone,

I'm developing an app which loads data from a database table into a
QSqlTableModel. At some point I associate this model to a Combo Box
(using QComboBox.setModel). The strange thing is, when I try to read
the current model index from the combo box view, for getting the
selected item's data from another database field on the same model
record, I get a invalid index, but If I just click on the combo box (I
don't even have to change the item) before trying to read its index,
it returns a valid model index. So, it is really necessary to do
something before, like generating a currentIndexChanged signal? What
I did was like this:


  def __init__(self):
   self.model = QSqlTableModel()
   self.model.setTable(dbtable)
   self.model.select()
   self.comboBox = QComboBox()
   self.comboBox.setModel(self.model)
   self.comboBox.setModelColumn(ITEM_NAME)


  def getItemID(self):
   index = self.comboBox.view().currentIndex()
   if not index.isValid():
   raise ValueError, invalid index   # Here
I always get the error if I don't click on the combo box before
   row = index.row()
   column = self.model.fieldIndex(ITEM_ID)
   return self.model.data(self.model.index(row, column)).toInt()[0]

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

  


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


Re: [PyQt] SIP build problem with VS2008 Express Edition

2010-01-26 Thread Demetrius Cassidy
Itt works fine with VS2008 Professional edition - at least on the latest 
builds. I'm sorry to say that I've never seen that error, but it sounds 
more like maybe you need to re-install the latest C++ redist package 
than a problem with PyQt4.


Darryl Wallace wrote:
I am using an existing commercial license and I had locked down the 
version of my development tools (hence, PyQt4.4.4).  I previously used 
MinGW to build the libraries (both Qt and PyQt) but I am hoping to get 
some smaller binaries for distribution.  

You were correct about the deprecated feature. SIP 4.7.x no longer 
uses %SIPOptions (which is on line 73 of QtCoremod.sip).


Regardless, that still doesn't explain the odd behaviour of SIP 4.7.9 
w.r.t. error R6034 when built with VS 2008 (especially when 4.8.2 
works fine).


I can likely find a work/around.  So far commenting out the line 73 of 
QtCoremod.sip allowed it to continue.  I haven't had a chance to fully 
build it yet.


Thanks,
Darryl

On Tue, Jan 26, 2010 at 4:54 PM, Demetrius Cassidy 
dcassid...@mass.rr.com mailto:dcassid...@mass.rr.com wrote:


It's very likely that PyQt 4.4.4 uses some deprecated syntax that
was removed in SIP 4.8. Are you not able to build using the latest
PyQt4 release?

Darryl Wallace wrote:

Hello,

I am trying to build SIP v4.7.9 with VS2008 Express Edition
and Python 2.5.4 via the Visual Studio 2008 Command Prompt.

When I attempt to run sip.exe from the c:\python25 I get the
dreaded R6034 Runtime Error!

R6034
An application has made an attempt to load the C runtime
library incorrectly.
Please contact the application's support team for more
information.

The odd thing is that sip.exe will run if left in the
sip4.7.9\sipgen directory.

Has any one come across this?   I am trying to build PyQt4.4.4.

Side note: I've just attempted to build SIP4.8.2 and SIP 4.10
and now, these works properly.  But now when I run
configure.py for PyQt4.4.4 I get the following error:
sip: sip/QtCore/QtCoremod.sip:73: syntax error

Thanks,
Darryl


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





--
__
Darryl Wallace: Project Leader
ProSensus Inc.
McMaster Innovation Park
175 Longwood Road South, Suite 301
Hamilton, Ontario, L8P 0A1
Canada(GMT -05:00)

Tel:   1-905-528-9136
Fax:   1-905-546-1372

Web site:  http://www.prosensus.ca/
__


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


Re: [PyQt] Trouble reading a model index from an untouched combo box

2010-01-26 Thread Demetrius Cassidy
I don't think you need to use the view pointer at all - it's returning 
QAbstractItemView *, which I would assume it would need to be casted to 
the proper class in C++. If that's so, by design the Abstract class will 
return an invalid index. Try to use self.comboBox.currentIndex() instead 
- it returns -1 if theres no selected index (which there won't be when 
you first set the model until you manually or programatically select one)


http://doc.trolltech.com/4.6/qcombobox.html#currentIndex-prop

Claudio Felix wrote:

2010/1/26 Demetrius Cassidy dcassid...@mass.rr.com:
  

How about selecting index 0 once the combobox is initialized with the
database data? It sounds to me that it has no valid index when first
initialized, and if you try to programmatically select the first index, it's
returning an invalid one. You don't need to generate a signal, just use
something like .setCurrentIndex(0).





Thanks for the answer Demetrius. Unfortunately, it didn't change it.
Maybe I do have to use a QDataWidgetMapper on the combo box? I thought
just getting the model associated with it should do it.. it shows all
the models' values indeed...

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

  


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


Re: [PyQt] Previous release windows binaries

2010-01-21 Thread Demetrius Cassidy
I don't remember ever seeing PyQt4 compiled with MSVC. Compile from 
source using visual studio's nmake; afterall, you are already compiling 
Qwt so it should not be much different.


Romi Agar wrote:

Hi!

Where could I find the previous PyQt installation binaries (the ones, 
that were built with MSVC). I need them to be able to compile Qwt for 
python. Because the latest release (PyQt 4.7 is built with mingw) I 
can't build it :(


Thanks


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


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


Re: [PyQt] Downloading PyQt for Python 2.6

2010-01-20 Thread Demetrius Cassidy
Er, you could compile it from source. But afaik, 2.6.4 is the current 
python version, yes? PyQt4 should also be already compiled for Python 2.6


Chris Bergstresser wrote:

Hi all --

   I have PyQt installed on a Windows development machine here, and
I'm trying to install it on another Windows development machine.  I
don't need the latest version, just a Python 2.6 compatible-version.
However, it seems with the new release of PyQt the older binaries have
been taken down.
   Is there an archive of a Python 2.6-compatible Windows installer
anywhere?  Clearly, I shouldn't have expected the company to maintain
links to older versions (although it's odd they wouldn't), but I can't
for the life of me understand why they took down the older links
*before* the new installer was available.

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

  


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


Re: [PyQt] Problem freezing a Sqlite based PyQT app

2010-01-12 Thread Demetrius Cassidy
I actually had nothing but problems with PyInstaller. In my instance, I 
am using Twisted + PyQt4 in my app, so I could never even get it to run 
while frozen. Not to mention it seems to want to pickup every dll in my 
system to package it into my app (like kernel32.dll).


You can manually copy the Qt plugins folder, since you should only need 
to do this once unless you delete the dist folder each build (that gets 
annoying quick). I know theres no support for implicit dependencies, but 
you can explicitly define them in the setup script (or you can use 
something like Gui2Exe).


Giovanni Bajo wrote:

On Mon, 2010-01-11 at 21:54 -0500, Demetrius Cassidy wrote:
  
You probably forgot to include the sqlite3.dll with your redist package. 
Alternatively, you can try to use py2exe instead of cx_Freeze. It works 
pretty well for me and is good at picking up dependencies.



AFAIK, py2exe doesn't have *any* support for picking up implicit
dependencies. For instance, for PyQt, it doesn't know about Qt plugins
so it would not pick up anything.

PyInstaller (http://www.pyinstaller.org/), instead, should work out of
the box.

  


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


Re: [PyQt] Different Behavior between Python 2.6 and Python 3.1.1

2010-01-12 Thread Demetrius Cassidy
I think .text() in Python 3.1 with PyQt4 is returning a python 'str' 
object, instead of a QString. Try and do type(self.ui.txtText.text()) 
and see what it returns.


Richard Parker wrote:
I have the following statement in an application that runs fine with 
Python 2.6 (and PyQt):


text = self.ui.txtText.text().left(5).toUpper()

In Python 3.1.1 (with PyQt), I get the following error for the first 
statement:


text = self.ui.txtText.text().left(5).toUpper()
AttributeError: 'str' object has no attribute 'left' 


The ui.txtText.text object is a QLineEdit object, whose 
documentation indicates that its text() function returns a QString 
object, whose documentatation states that the left(self, n) and 
toUpper() functions are supported. What has changed between Python 
2.6 and Python 3.1 that would account for this error?


Thanks.



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


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


Re: [PyQt] Different Behavior between Python 2.6 and Python 3.1.1

2010-01-12 Thread Demetrius Cassidy

*int(**self.ui.txtNumber.text()) *
str('abcdefg').upper()


Richard Parker wrote:

Demetrius,

I think you are right, but how can I achieve the same functionality 
with Python 3.1.1, as I do with Python 2.6? (i.e., left(5).toUpper()) 
for the str that's returned by Python 3.1.1?


I looked at [0:05].format(self.ui.txtText.text()) and that seemed 
to work, although it didn't implement the toUpper() feature and I 
really need a solution that will do so. I also have another string 
from a QLineEdit object that I want to convert to an integer value and 
I had written it as follows:


numbering =  self.ui.txtNumber.text().toInt()

But this also fails with an error on Python 3.1.1, indicating that a 
str object has on attribute toInt(). So, basically, I need to 
convert both of these to be compatible with Python 3.1.1 and I'm not 
sure how to do so. Any help will be appreciated.


-rich-

- Original Message -
From: Demetrius Cassidy dcassid...@mass.rr.com
To: Richard Parker r.richardpar...@comcast.net
Cc: PYQT pyqt@riverbankcomputing.com
Sent: Tuesday, January 12, 2010 2:49:41 PM GMT -08:00 US/Canada Pacific
Subject: Re: [PyQt] Different Behavior between Python 2.6 and Python 3.1.1

I think .text() in Python 3.1 with PyQt4 is returning a python 'str'
object, instead of a QString. Try and do type(self.ui.txtText.text())
and see what it returns.

Richard Parker wrote:
 I have the following statement in an application that runs fine with
 Python 2.6 (and PyQt):

 text = self.ui.txtText.text().left(5).toUpper()

 In Python 3.1.1 (with PyQt), I get the following error for the first
 statement:

 text = self.ui.txtText.text().left(5).toUpper()
 AttributeError: 'str' object has no attribute 'left' 


 The ui.txtText.text object is a QLineEdit object, whose
 documentation indicates that its text() function returns a QString
 object, whose documentatation states that the left(self, n) and
 toUpper() functions are supported. What has changed between Python
 2.6 and Python 3.1 that would account for this error?

 Thanks.

 

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



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


Re: [PyQt] Different Behavior between Python 2.6 and Python 3.1.1

2010-01-12 Thread Demetrius Cassidy
Stupid thunderbird messed up the formatting. use int('12345') to conver 
a string to integer. and .upper() to conver to uppercase.


Demetrius Cassidy wrote:

*int(**self.ui.txtNumber.text()) *
str('abcdefg').upper()


Richard Parker wrote:

Demetrius,

I think you are right, but how can I achieve the same functionality 
with Python 3.1.1, as I do with Python 2.6? (i.e., left(5).toUpper()) 
for the str that's returned by Python 3.1.1?


I looked at [0:05].format(self.ui.txtText.text()) and that seemed 
to work, although it didn't implement the toUpper() feature and I 
really need a solution that will do so. I also have another string 
from a QLineEdit object that I want to convert to an integer value 
and I had written it as follows:


numbering =  self.ui.txtNumber.text().toInt()

But this also fails with an error on Python 3.1.1, indicating that a 
str object has on attribute toInt(). So, basically, I need to 
convert both of these to be compatible with Python 3.1.1 and I'm not 
sure how to do so. Any help will be appreciated.


-rich-

- Original Message -
From: Demetrius Cassidy dcassid...@mass.rr.com
To: Richard Parker r.richardpar...@comcast.net
Cc: PYQT pyqt@riverbankcomputing.com
Sent: Tuesday, January 12, 2010 2:49:41 PM GMT -08:00 US/Canada Pacific
Subject: Re: [PyQt] Different Behavior between Python 2.6 and Python 
3.1.1


I think .text() in Python 3.1 with PyQt4 is returning a python 'str'
object, instead of a QString. Try and do type(self.ui.txtText.text())
and see what it returns.

Richard Parker wrote:
 I have the following statement in an application that runs fine with
 Python 2.6 (and PyQt):

 text = self.ui.txtText.text().left(5).toUpper()

 In Python 3.1.1 (with PyQt), I get the following error for the first
 statement:

 text = self.ui.txtText.text().left(5).toUpper()
 AttributeError: 'str' object has no attribute 'left' 


 The ui.txtText.text object is a QLineEdit object, whose
 documentation indicates that its text() function returns a QString
 object, whose documentatation states that the left(self, n) and
 toUpper() functions are supported. What has changed between Python
 2.6 and Python 3.1 that would account for this error?

 Thanks.

 



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






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


Re: [PyQt] Problem freezing a Sqlite based PyQT app

2010-01-11 Thread Demetrius Cassidy
You probably forgot to include the sqlite3.dll with your redist package. 
Alternatively, you can try to use py2exe instead of cx_Freeze. It works 
pretty well for me and is good at picking up dependencies.


Claudio Felix wrote:

Hello everyone,

I've been developing a PyQT database app which uses a SQlite3
database. It is working just fine on my development environment, which
is Linux based. My problem is the end users want it running on
Windows, and it does run fine on it, until I try freezing it (they
wouldn't have a clue as how to install python, PyQT and all by
themselves). I'm using cx_Freeze to get it done and on Linux even the
frozen version runs just fine, but on Windows I get this error:

Database Error: Driver not loaded

Have you guys hit anything like this before? I'm using the same
version of cx_Freeze on Linux and Windows (4.1.2) and the software
doesn't have any different imports for one or the other, so I guess
the same modules should be included in the freezing process.. is there
anything obvious I'm missing? The cx_Freeze command line used was like
this (also tried from eric4 packager plugin, with same result):

cxfreeze --target-dir=c:\test --target-name=app.exe
--base-name=Win32GUI mainwindow.py

If this helps, python version is 2.6.2, QT is 4.5.2 and PyQT is 4.4.4.

Thanks and congratulations for the great work in PyQT!

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

  


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


Re: [PyQt] Detect Application Running

2010-01-09 Thread Demetrius Cassidy
You need to scan for a specific running process. I used the wmi module 
for this in my app:


http://timgolden.me.uk/python/wmi/index.html

AON LAZIO wrote:

Hi,
 How can we find out that there is already a PyQt application 
running on Windows so when I try to open that same application, it 
won't open another one?
 It's like I already have Firefox running and when I open firefox 
again, it won't open firefox again.

 Thanks

--
Passion is my style


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


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


Re: [PyQt] How to manage multiple interdependent datamodels

2009-12-30 Thread Demetrius Cassidy



Oliver Voelzel wrote:
 
 I am writing an application, which should provide the functionality of
 SPSS (TM), a well known statistical package, in which the GUI  shows two
 table(views). One Tableview (No.1) provides adding,removing and editing
 (statistical) variables as rows, and the other one (No.2) provides
 adding/removing/editing the appropriate data (as rows), where the
 variables of view No. 1 are shown as the columns. Should I design ONE
 model, or should I work with TWO models, keeping them manually in sync. I
 considered doing this job database driven with two models and three
 database tables, but I struggled with the fact that every cell in the
 Dataview(No.2) gets its data as a result of a relational query, which
 seems to push the performance a lot? Maybe someone could give me some
 inspiration?
 
 Best regards, Oliver
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

Having a single model simplifies things in many ways, since you don't need
to worry about keeping data in sync between two models. When you are working
with large datasets, often duplicating the data, and keeping them in sync
would be very unpractical. 

The one drawback I see would be the sorting of data. Sorting is done on the
model itself, so if you sort one table, the data in the second needs to be
refreshed too or you will end up with the visible data in one table not
matching what is in the model when you go to edit it. 

Yes you can use proxy models, but in my case this wasn't practical to do
(each table displayed different columns from the same model, and also needed
to be individually sorted).



-- 
View this message in context: 
http://old.nabble.com/How-to-manage-multiple-interdependent-datamodels-tp26942706p26970008.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] sip.pyd crash due to class order of inheritance

2009-12-27 Thread Demetrius Cassidy

import sys
from PyQt4 import QtCore, QtGui

app = QtGui.QApplication(sys.argv)

class Ui_Frame(object):
def setupUi(self, Frame):
Frame.setObjectName(Frame)
Frame.resize(200, 300)
Frame.setMinimumSize(QtCore.QSize(200, 200))

class FrameWnd(Ui_Frame, QtGui.QFrame):

def __init__(self):
QtGui.QFrame.__init__(self)
self.setupUi(self)

frm = FrameWnd()
frm.show()
sys.exit(app.exec_())

If you inherit from Ui_Frame before QFrame, you get a crash in sip.pyd. But
if you swap the order around it works fine. This is using  Sip 4.10 12/23
snapshot along with PyQt 4.7 12/23 snapshot
-- 
View this message in context: 
http://old.nabble.com/sip.pyd-crash-due-to-class-order-of-inheritance-tp26936416p26936416.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] Small patch to compile sip with stackless 2.6.4

2009-12-27 Thread Demetrius Cassidy

+++ b/c:\\sip-4.10-snapshot-20091223\\siplib\\siplib.c
@@ -617,11 +617,15 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void)
 if (sip_api_register_py_type((PyTypeObject *)sipSimpleWrapper_Type) 
0)
 SIP_FATAL(sip: Failed to register sip.simplewrapper type);

+#if defined(STACKLESS)
+   sipWrapper_Type.super.tp_base = (PyTypeObject
*)sipSimpleWrapper_Type;
+#else
 #if PY_VERSION_HEX = 0x0205
 sipWrapper_Type.super.ht_type.tp_base = (PyTypeObject
*)sipSimpleWrapper_Type;
 #else
 sipWrapper_Type.super.type.tp_base = (PyTypeObject
*)sipSimpleWrapper_Type;
 #endif
+#endif

This is more like a small hack, but basically under MSVC8 I get this
compiler error:

siplib.c
.\siplib.c(621) : error C2039: 'ht_type' : is not a member of '_typeobject'
c:\python26\include\object.h(325) : see declaration of '_typeobject'

Changing to sipWrapper_Type.super.tp_base allows me to compile and it seems
to work since it's using the same pointer type. I'm sure it could be done
slightly cleaner, but so far this seems to work for me.

-- 
View this message in context: 
http://old.nabble.com/Small-patch-to-compile-sip-with-stackless-2.6.4-tp26938106p26938106.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] sip.pyd crash due to class order of inheritance

2009-12-27 Thread Demetrius Cassidy



Phil Thompson-5 wrote:
 
 On Sun, 27 Dec 2009 12:12:09 -0800 (PST), Demetrius Cassidy
 dcassid...@mass.rr.com wrote:
 import sys
 from PyQt4 import QtCore, QtGui
 
 app = QtGui.QApplication(sys.argv)
 
 class Ui_Frame(object):
 def setupUi(self, Frame):
 Frame.setObjectName(Frame)
 Frame.resize(200, 300)
 Frame.setMinimumSize(QtCore.QSize(200, 200))
 
 class FrameWnd(Ui_Frame, QtGui.QFrame):
 
 def __init__(self):
 QtGui.QFrame.__init__(self)
 self.setupUi(self)
 
 frm = FrameWnd()
 frm.show()
 sys.exit(app.exec_())
 
 If you inherit from Ui_Frame before QFrame, you get a crash in sip.pyd.
 But
 if you swap the order around it works fine. This is using  Sip 4.10
 12/23
 snapshot along with PyQt 4.7 12/23 snapshot
 
 Already fixed in the current SIP snapshot (I think).
 
 Phil
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

Yes the latest snapshot seems to fix it - thanks.

-- 
View this message in context: 
http://old.nabble.com/sip.pyd-crash-due-to-class-order-of-inheritance-tp26936416p26938128.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] PyQt4.5.2 QVariant.toPyObject() bugged (code included)

2009-07-19 Thread Demetrius Cassidy

For some reason as of 4.5.2, QVariant is behaving much differently than from
4.5.1. It seems that if I have a QVariant with a python list or tuple, that
doing toPyObject() on the QVariant object return a python list of
QVariants!! This means for each item in my list, I would also need to do a
.toPyObject!

This is completely different behavior than how it worked in 4.5.1, where
doing toPyObject would return the original list of strings, not a list of
QVariants.

Test Code:

from PyQt4.QtCore import QVariant

def testVariant():
var = QVariant(['one', 'two', 'three'])

varObj = var.toPyObject()

print checking if varObject is of type list
print(isinstance(varObj, list))

for item in varObj:
print(item)


testVariant()


Output:

checking if varObject is of type list
True
PyQt4.QtCore.QVariant object at 0x012A97D8
PyQt4.QtCore.QVariant object at 0x012A9810
PyQt4.QtCore.QVariant object at 0x012A9848

-- 
View this message in context: 
http://www.nabble.com/PyQt4.5.2-QVariant.toPyObject%28%29-bugged-%28code-included%29-tp24559310p24559310.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] PyQt-4.5 KConfigGroup incompatibility problem?

2009-07-19 Thread Demetrius Cassidy

Use 4.5.1 instead of 4.5.2 for now. I think there is a problem with QVariant
in 4.5.2, as I've had nothing but issues in that it seems to always return a
QVariant when you call any of it's methods.

I sent an email about this not long ago.


Bugzilla from wbs...@xs4all.nl wrote:
 
 Hi!
 
 Since PyQt4.5, a call to a KConfigGroup.readEntry always returns a
 QVariant:
 
 config  = KGlobal.config().group('blaat').group('blaat')
 r = config.readEntry('blaat', 'bla')
 r
 
 PyQt 4.4.3 shows: PyQt4.QtCore.QString(u'bla')
 PyQt 4.5 shows: PyQt4.QtCore.QVariant object at 0x84b1b6c
 
 to keep my program working in both PyQt 4.4 and 4.5 should I change every
 call 
 to:
 
 r = config.readEntry('blaat', QVariant('bla')).toString()
 
 ?
 
 Many thanks for an enlightening answer,
 Wilbert Berendsen
 
 -- 
 http://www.wilbertberendsen.nl/
 You must be the change you wish to see in the world.
 -- Mahatma Gandhi
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://www.nabble.com/PyQt-4.5-KConfigGroup-incompatibility-problem--tp24559422p24559612.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] pyuic4 segfaults with 20090601 snapshots

2009-06-02 Thread Demetrius Cassidy

I think theres something wrong with the 20090601 build. Build fails on
Vista64, and another guy has a problem with the x11 snapshot with the same
compiler error.

Have you tried earlier builds at all?


Darren Dale-3 wrote:
 
 I am using the 20090601 sip and pyqt4 snapshots on a 64-bit kubuntu karmic
 alpha system. I see segfaults with pyuic4, for example with the attached
 file using:
 
 pyuic4 -o ui_skipmode.py ui_skipmode.ui
 
 I don't see the problem using the same snapshots on a 64-bit gentoo
 system,
 which also uses gcc-4.4. I know karmic is in early stages of development,
 but it has been quite stable for me, and qtdemo.py seems to run without
 trouble. pyrcc4 does not appear to be segfaulting on either system.
 
 Can anyone else reproduce the segfault with the snapshots and the attached
 file?
 
 Thanks
 Darren
 
  
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 

-- 
View this message in context: 
http://www.nabble.com/pyuic4-segfaults-with-20090601-snapshots-tp23842729p23842781.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] How to slim programs under windows

2009-05-28 Thread Demetrius Cassidy

This really isn't PyQt4 related. Look at the py2exe faq, it lists common
modules you can ignore when building your exe.

You can also try UPX: http://upx.sourceforge.net/


handrix wrote:
 
 Hi,
 
 I build a exe program with py2exe, and it size is about 8M.
 The program is very simple, it's a widget that contain  too lineedit and a
 button, it's based on pyqt.
 Please is there a way to resize the file for small one.
 
 Regards,
 
 -- 
 Ali MEZGANI
 Network Engineering/Security
 http://securfox.wordpress.com/
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 

-- 
View this message in context: 
http://www.nabble.com/How-to-slim-programs-under-windows-tp23745556p23764146.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] help with qt4reactor.py?

2009-05-10 Thread Demetrius Cassidy

qt4reactor.install() should be the first line after you create your
QApplication instance.

You might also want to use the attached qtreactor, since some of the older
ones I've found will give out that QObject error.

http://www.nabble.com/file/p23474488/qt4reactor.py qt4reactor.py 

markus espenhain wrote:
 
 On Sun, 2009-05-10 at 08:32 -0400, inhahe wrote:
 Hello, can someone help me with the following code:
 
 ---
 
 from PyQt4 import QtGui, QtCore
 import sys, qt4reactor
 
 app = QtGui.QApplication(sys.argv)
 mainwin = QtGui.QMainWindow()
 mainwin.showMaximized()
 qt4reactor.install(app)
 from twisted.internet import reactor
 
 reactor.run()
 
 ---
 
 the problem is the console window keeps displaying
 
 QObject: Do not delete object, 'unnamed', during its event handler!
 QObject: Do not delete object, 'unnamed', during its event handler!
 QObject: Do not delete object, 'unnamed', during its event handler!
 QObject: Do not delete object, 'unnamed', during its event handler!
 QObject: Do not delete object, 'unnamed', during its event handler!
 QObject: Do not delete object, 'unnamed', during its event handler!
 
 etc., a few times per second.  the app seems to work, but that still
 bothers me. i want it to be Done Right.
 
 i'm using pyqt 4.3 and python 2.5 on windows xp.
 
 
 hi
 
 we are using twisted and qt4reactor
 (http://www.tarbox.org/qtreactor/index.html + twisted 8.1 + qt 4.3/4/5 +
 python 2.5) on linux and i haven't seen such messages before - our
 setup/run is different - maybe this helps
 
 ...
 
 from PyQt4 import QtCore, QtGui
 app = QtGui.QApplication(sys.argv)
 from lipy import qt4reactor
 qt4reactor.install()
 from twisted.internet import reactor
 
 # mainwin creation etc
 # ...
 
 reactor.runReturn()
 sys.exit(app.exec_())
 
 markus
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://www.nabble.com/help-with-qt4reactor.py--tp23469814p23474488.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] faster alternative to QHeaderView's resizeToContents?

2009-05-09 Thread Demetrius Cassidy

Are you calling resizeToContents for each item in your table?

Sent from my iPhone

On May 9, 2009, at 3:28 AM, Edwin Marshall aspidi...@inbox.com wrote:

I have a QTableView that displays the contents of a model with over  
3000 rows, each with 11 columns. I'd like to the original size of  
these columns to be no larger than the content within them, but  
setting their resizeMode's to QHeaderView.resizeToContents causes  
the tremendous slow downs (where originally the data would load in  
two seconds, using this mode causes the data to be loaded after  
about a minute and a half). Is there some faster alternative?


I'm thinking of calculating the width by using the length of the  
largest item in the column, but that would require me to know how  
large in pixels each character is.


Any suggestions?  Mean while, I'm going to stare at the Qt  
documentation for a couple more hours to see if I find something.
Get Free 5GB Email – Check out spam free email with many cool featur 
es!

Visit http://www.inbox.com/email to find out more!
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Problem with latest PyQt build - ImportError: DLL load failed: Invalid access to memory location.

2009-04-29 Thread Demetrius Cassidy

 from PyQt4 import QtCore
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: DLL load failed: Invalid access to memory location.

If I use the nightly build from 4252009, it all works as intended.

Using Qt 4.51 with the included mingw32 to build PyQt. It builds fine and
theres no errors, but Python fails to import the *.pyd files.
-- 
View this message in context: 
http://www.nabble.com/Problem-with-latest-PyQt-build---ImportError%3A-DLL-load-failed%3A-Invalid-access-to-memory-location.-tp23302281p23302281.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] multiple QThread simultaneously

2009-04-29 Thread Demetrius Cassidy

I don't see why there would be a limit. Can you post a sample code?


NARCISO, Rui wrote:
 
 
 Hi all,
 
 I have a class MyThread that inherits from QThread and I would like to be
 able to run multiple instances of MyThread in parallel (even if one has to
 wait while the other completes).
 
 I have tried with a simple instanciation of MyThread, connecting to a
 signal I emit within MyThread and then starting it...
 
 The problem I have is that if I start a newly created MyThread I get an
 error from the previous one (I think) when I try to emit my signal ...
 
 Why is this happening ? Can I not have serveral instances of the same
 thread running at the same time ?
 
 Thanks
 
 Rui
 
 
 The information in this e-mail is confidential. The contents may not be
 disclosed or used by anyone other then the addressee. Access to this
 e-mail by anyone else is unauthorised.
 If you are not the intended recipient, please notify Airbus immediately
 and delete this e-mail.
 Airbus cannot accept any responsibility for the accuracy or completeness
 of this e-mail as it has been sent over public networks. If you have any
 concerns over the content of this message or its Accuracy or Integrity,
 please contact Airbus immediately.
 All outgoing e-mails from Airbus are checked using regularly updated virus
 scanning software but you should take whatever measures you deem to be
 appropriate to ensure that this message and any attachments are virus
 free.
 
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://www.nabble.com/multiple-QThread-simultaneously-tp23277099p23302402.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] RuntimeError: underlying C/C++ object has been deleted

2009-04-27 Thread Demetrius Cassidy

You cannot instantiate a base class wrapped through sip with super. You need
to directly call the base class contructor via the __init__ method.

I quote The way that super is currently implemented means that the lazy
lookup is bypassed resulting in AttributeError exceptions unless the
attribute has been previously referenced.

I don't advocate the use of super, because while it might save some typing,
you end up introducing weird bugs like these into your program. Just call
the base classes __init__ method directly instead.

See: http://docs.huihoo.com/pyqt/pyqt4.html#super-and-pyqt-classes



Alexandr N Zamaraev wrote:
 
 Alexandr N Zamaraev wrote:
 Os Windows Vista Home Ru + sp1
 g++ (GCC) 3.4.5 (mingw-vista special r3)
 Qt 4.5 (self build)
 sip-4.7.9 (self build)
 PyQt-win-gpl-4.4.4.zip (self build)
 I reproduce this with
 sip-4.8-snapshot-20090424 (self build)
 PyQt-win-gpl-4.5-snapshot-20090328 (self build)
 
 Call Garbage Collector after the closing of the dialogue does not 
 produce any effect.
 
 Can anyone suggest some ideas for more accurate detection of this bug?
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://www.nabble.com/RuntimeError%3A-underlying-C-C%2B%2B-object-has-been-deleted-tp23194199p23251277.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] Populate Model data in a separate thread

2009-04-27 Thread Demetrius Cassidy

How many items do you need to populate in your model class? Unless you are
populating a view with thousands of items, I do not suggest threads at all
since they can be dangerous if you do not know how to use them. 

If you absolutely needed to do this, my approach would be to have some sort
of method I could call on my dialog to fetch items in a separate thread in
the model, and once I have my data I could populate myself and call the
appropriate begin/end methods on my QAbstractItemModel class.

If I knew what you were trying to accomplish, then maybe I could give you
some better guidance.

Edwin Marshall-2 wrote:
 
 
 
 
 
 I've been reading on qtcentre that it is possible to populate a model from
 a separate qthread in order to prevent a program from freezing before it
 loads, however the example code I have seen is a bit too much involved
 (and in c++) for me to comprehend. I was wondering if anyone knew of a
 pyqt program that did, or could point me toward some code snippets doing
 this. The only thing that I can gather is that I need to create the
 qthread in the __init__ method of my model and call it's run command.
 However, I can't figure out what exactly need to go in the run method, or
 what signals to emit/catch. Thansk in advance for any help 
 
 
 
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 

-- 
View this message in context: 
http://www.nabble.com/Populate-Model-data-in-a-separate-thread-tp23219092p23251498.html
Sent from the PyQt mailing list archive at Nabble.com.

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


Re: Re: [PyQt] Populate Model data in a separate thread (Demetrius Cassidy)

2009-04-27 Thread Demetrius Cassidy

I suggest you read over http://doc.trolltech.com/4.5/qthread.html, and while
the examples are in C++ don't look too much into the syntax differences but
rather what it's doing.

Although I haven't used QThread before, I have used python's threading
classes. My understanding is that you create a QThread derived class, which
defines a run() method. In the run method is where you do your blocking
calls (i.e. talk to the database).

You are basically going to have your model defer the loading of your data to
your thread class. You need to have a method in your model call the thread's
start() method, and connect to the thread's finished signal.

Note that you can not call a widget from your data thread. #1 rule of a data
thread is that it should NEVER directly or indirectly touch a GUI thread.
Very bad things can happen if you do so.

class MyThread(QThread):
   def __init__(self, parent=None):
   QThread.__init__(self, parent)

  def run(self):
 callDatabaseBlockingMethod() #do something with the data
 self.exec() #start the event loop


class MyModel(QAbstractTableModel):
   def __init__(self, parent=None):
QAbstractTableModel.__init__(self, parent)
myDataThread = MyThread(parent)
myDataThread.finished.connect(self._finished)

  def loadData(self):
  self.beginInsertRows(firstRow, rowCount, QModelIndex())
  self.myDataThread.start() #this slot will call the run() method on the
thread

  def _finished(self):
  #do something with data from myDataThread
  self.endInsertRows()
   

  



Edwin Marshall-2 wrote:
 
 First of all, I am subscribed to the digest version of the mailing list,
 so I'm not 100% sure how to reply to specific topics, sorry.
 
 Demetrius, my model currently contains approx. 1,800 records, and will
 eventually contain about 4,400 records, each with 11 columns, one of which
 displays a pixmap.
 
 In my model's __init__() method, I load the data from a sqlite table using
 python's native sqlite3 API (QTSql was way too slow, which is why I can't
 use QSQLRelationalTableModel). In the rowCount() method, I return the
 number of records in my database table, and in the columnCount() method I
 return the number of columns. The data method simply maps an index.row()
 and index.column() to the same row and column in the database.
 
 I would like to defer the loading of the model's data to a thread so that
 the user doesn't experience delay when he opens my program. Ideally, the
 program's window would immediately be shown with an empty table view, and
 once my model was done getting it's data, would populate the table view.
 
 If I understood you correctly, you are suggesting that I implement my
 model as an editable one, then have a method that is run in a thread that
 populates it using its setData() and insertRows() methods? While I think I
 have a grasp of writing editable models, I'm not sure I understand how to
 connect signals from a qthread to that of my model. Could you elaborate,
 please?
 
 Thanks in advance,
 Edwin Marshall
 
 -Original Message-
 From: pyqt-requ...@riverbankcomputing.com
 Sent: Mon, 27 Apr 2009 12:00:12 +0100
 To: pyqt@riverbankcomputing.com
 Subject: PyQt Digest, Vol 57, Issue 53
 
 Send PyQt mailing list submissions to
  pyqt@riverbankcomputing.com
 
 To subscribe or unsubscribe via the World Wide Web, visit
  http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 or, via email, send a message with subject or body 'help' to
  pyqt-requ...@riverbankcomputing.com
 
 You can reach the person managing the list at
  pyqt-ow...@riverbankcomputing.com
 
 When replying, please edit your Subject line so it is more specific
 than Re: Contents of PyQt digest...
 Today's Topics:
 
1. pyrcc4 regression in snapshot-0425? (Grissiom)
2. resource name problem in ui_* (Robert Norman)
3. Re: Searching for a very small scprit using CLIPBOARD
   (Aron Bierbaum)
4. Re: re[PyQt] source name problem in ui_* (Demetrius Cassidy)
5. Re: RuntimeError: underlying C/C++ object has been deleted
   (Alexandr N Zamaraev)
6. Re: RuntimeError: underlying C/C++ object has been deleted
   (Demetrius Cassidy)
7. Re: Populate Model data in a separate thread (Demetrius Cassidy)
8. Re: RuntimeError: underlying C/C++ object has been deleted
   (Alexandr N Zamaraev)
 ___
 PyQt mailing list
 PyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 
 Receive Notifications of Incoming Messages
 Easily monitor multiple email accounts  access them with a click.
 Visit http://www.inbox.com/notifier and check it out!
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://www.nabble.com/Re%3A-Re%3A-Populate

Re: re[PyQt] source name problem in ui_*

2009-04-26 Thread Demetrius Cassidy

You need to tell it what you want to name your python resource file as. So
something like pyrcc4 -py2 -o resources_rc.py will create the correct file
that is imported in the ui file.

Now if anyone knows _how_ to change the path to the resource file in your
ui, so pyuic does from something import resource_rc.py instead of import
resource_rc.py I would like to know.


Robert Norman wrote:
 
 I'm new to PyQt and have been impressed with the ease of use and power of
 the system.  One quirk that I can't seem to get a handle on is that when I
 run the tools to make my ui_* file from a designer file, the included
 resource is improperly named. So if there is a resource.qrc file then
 the
 ui_* file contains import resource_qc  but the tools make
 qrc_resource.py . I've just been renaming either the file or the
 reference
 just go get moving on some projects but would like to understand what's
 happening.
 
 What am I missing?
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 

-- 
View this message in context: 
http://www.nabble.com/resource-name-problem-in-ui_*-tp23243006p23249418.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] Searching for a very small scprit using CLIPBOARD

2009-04-25 Thread Demetrius Cassidy

from PyQt4.QtGui import QApplication

clipboard = QApplication.clipboard()
clipboard.setText('mytext')

see http://doc.trolltech.com/4.5/qapplication.html


projetmbc wrote:
 
 Hello,
 here is an example for using the clipboard of Tkinter :
 
 from Tkinter import *
 root = Tk()
 root.clipboard_clear()
 root.clipboard_append('A text in the clipboard...')
 root.withdraw()
 
 
 I would like to do the same with PyQt. Is it possible ?
 
 Christophe.
 
 PS : if someone knows a Python script which is an universal ClipBoard 
 (ie which works on Unix and Windows), it would be better. The purpose is 
 just to send text.
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://www.nabble.com/Searching-for-a-very-small-scprit-using-CLIPBOARD-tp23236437p23237601.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] First bottom-up GUI, acting strange

2009-04-19 Thread Demetrius Cassidy

Looking over your code, I suspect the problem is with this line:

data = webPage.read(8192)
  if not data:
  break

Unless data is 0 or None, it will go into an infinite loop. From your 
description, it does not sound like it will ever return 0. It is also not 
good programming practice to write loops that are by nature always True. I 
suggest you use the total number of bytes instead as the condition for your 
loop, so after x amount of bytes is read or written, the loop finishes.


I also suggest making the download in a separate thread, to avoid locking up 
the GUI during long downloads (because the while loop is going to be using 
up all the CPU time for your app, without giving the Qt event loop a chance 
to run).


- Original Message - 
From: Nonyaz che...@nonyaz.com

To: pyqt@riverbankcomputing.com
Sent: Saturday, April 18, 2009 11:58 PM
Subject: [PyQt] First bottom-up GUI, acting strange



I made an attempt to port over a little command line file DL script I
wrote into a GUI as a practice working with PyQt.
While I have seemingly achieved that goal, the resulting product is
not acting as I suspected. When I start a download,
the GUI will continue to update as long as I don't click it, as soon
as I do, the OS throws up Not Responding in the
title bar and the GUI no longer updates.  Even when I don't click it,
I can tell somethings not right, the start button never
releases, and the progress bar effects on vista are not apparent.

Hopefully someone can point out to me what I'm doing wrong, I have a
feeling its just bad event loop execution, although
I'm not quite sure how I could rewrite it so it wouldn't have this 
problem.


import urllib, os, time, sys, win32con
import win32clipboard as w
from PyQt4.QtCore import *
from PyQt4.QtGui import *

class Window(QDialog):
  def __init__(self, parent=None):
  super(Window, self).__init__(parent)

  self.lineedit = QLineEdit()
  self.getclip = QCommandLinkButton(Poll Clipboard)
  self.progbar = QProgressBar()
  self.speed = QLabel()
  self.status = QLabel()
  self.startb = QPushButton(Start DL)

  grid = QGridLayout()
  buttlay = QHBoxLayout()
  buttlay.addStretch()
  buttlay.addWidget(self.startb)
  grid.addWidget(self.lineedit,0,0)
  grid.addWidget(self.getclip,0,1)
  grid.addWidget(self.progbar,1,0,1,0)
  grid.addWidget(self.status,3,0)
  grid.addWidget(self.speed,3,1)
  grid.addLayout(buttlay,4,1)
  self.setLayout(grid)

  self.setWindowTitle(Clipboard DL V.001)
  self.lineedit.setText(getText())
  self.lineedit.setMinimumSize(300,0)
  self.startb.setMaximumSize(75,300)

  self.connect(self.startb, SIGNAL(clicked()),
   fileDL)
  self.connect(self.getclip, SIGNAL(clicked()),
   setClipText)


class myURLOpener(urllib.FancyURLopener):
  def http_error_206(self, url, fp, errcode, errmsg, headers, data=None):
  print I've been 206'd!
  pass

def getText():
  w.OpenClipboard()
  try:
  d = w.GetClipboardData(win32con.CF_TEXT)
  except:
  d = None.
  w.CloseClipboard()
  if d[:7] != http://:
  d = Clipboard does not contain a valid URL.
  return d

def fileDL():
  loop = 1
  existSize = 0
  dlFile = getFilename()
  url = str(daprog.lineedit.text())

  myUrlclass = myURLOpener()
  webPage = myUrlclass.open(url)
  contentLength = int(webPage.headers['Content-Length'])

  if os.path.exists(str(dlFile)):
  outputFile = open(dlFile,ab)
  existSize = os.path.getsize(dlFile)

  if existSize  contentLength:
  webPage.close()
  myUrlclass = None
  myUrlclass = myURLOpener()
  myUrlclass.addheader(Range,bytes=%s- % (existSize))
  webPage = myUrlclass.open(url)

  else:
  try:
  outputFile = open(dlFile,wb)
  except:
  os.mkdir(dldir+'/'+show)
  outputFile = open(dlFile,wb)
  existSize = 0


  if existSize == contentLength:
  daprog.status.setText(All %s bytes already downloaded!\n %
(contentLength))
  raw_input()
  loop = 0
  elif existSize == 0:
  pass
  elif existSize  contentLength:
  daprog.status.setText(Resuming download)

  numBytes = existSize
  daprog.status.setText(Download Started)
  counterr = 0
  while loop:
  if counterr == 0:
  intime = time.time()

daprog.progbar.setValue((float(numBytes)/float(contentLength)*100))
  data = webPage.read(8192)
  if not data:
  break
  outputFile.write(data)
  numBytes += len(data)
  if counterr == 10:
  counterr = -1
  outtime = time.time()
  lab = %.2f KB/s % (((8192*10)/(outtime-intime))/1000)
  daprog.speed.setText(lab)
  counterr += 1


  daprog.progbar.setValue(100)
  daprog.status.setText(Done)
  webPage.close()
  outputFile.close()



def getFilename():
  hack_fin = 0
  fname = ''
  for x in str(daprog.lineedit.text())[::-1]:
  if x == /:
  hack_fin = 1

Re: [PyQt] PyQt make failure

2009-04-11 Thread Demetrius Cassidy

Sounds like a problem with the C++ libraries.

Taken from the PyQt documentation:

You may need to install the MSVC2008 C++ runtime DLLs from 
http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BFdisplaylang=en
here 


Von Dreele wrote:
 
 I have the following installed on my WinXP SP3 system;
 MinGW 4.3.1
 Python 2.5.2
 Qt 4.5.0
 Sip 4.7.9
 QScintilla-gpl 2.3.2
 PyQt Py2.5.2-gpl-4.4.3 from the exe file.
 All appears to work except Eric4; fails on:
 
 QVariant::load(QDataStream s): type  unknown to QVariant.
  
 on start up.
 
 I have written to Detlev directly about this.
 
 The PyQt version of QtAssistant fails on start up with the following:
 
 Microsoft Visual C++ Runtime Library Runtime Error!
 Program: C:\Python25\Lib\site-packages\PyQt4\assistant.exe
 
 This application has requested the Runtime to terminate it in an unusual
 way.
 Please contact the application's support team for more information
 
 Not nice.
 This gives me pause in using PyQt/Qt compared to WX/WXPython for my
 applications development.
 Bob Von Dreele
 
 

-- 
View this message in context: 
http://www.nabble.com/PyQt-make-failure-tp23002715p23003182.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] segfault when using a proxy and SIGNAL( clicked(QModelIndex) )

2009-04-11 Thread Demetrius Cassidy

Why do you need access to the QModelIndex internal pointer? It sounds like
you are trying to access a null pointer, causing a crash.

Looking at the signature, ptr is some sort of id or extra data associated
with the index, which you probably need to add yourself when creating an
index.

QModelIndex QAbstractItemModel::createIndex ( int row, int column, void *
ptr = 0 ) const   [protected]


TP-5 wrote:
 
 TP a écrit :
 Could this be a bug in PyQt?
 
 Has someone tried my script to check if the segfault is reproducible?
 
 Julien
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://www.nabble.com/segfault-when-using-a-proxy-and-SIGNAL%28-%22clicked%28QModelIndex%29%22-%29-tp22977318p23006807.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] How do you close a QDialog?

2009-04-10 Thread Demetrius Cassidy

You are still doing the same thing as last time =(

Ok, first of all, separate your GUI code from your dialog code. Use Qt
Designer to create your GUI, then pyuic to convert the ui code into python
equivalent. This will create a python file with a class called Ui_MainWindow
or Ui_Dialog, depending on the type of window.

Create a new class, say MyAppMainWindow, and derive it from both the Ui code
(Ui_MainWindow) and QMainWindow. In __init__, call
QMainWindow.__init__(self) and self.setupUi(self).

Your code will look just like my previous example, except that MainWindow
will contain a button to open a dialog. 

Here is some sample code, with the GUI code omitted since it's irrelevant.

import sys
from PyQt4.QtGui import QMainWindow, QDialog

class MyAppMainWindow(QMainWindow, Ui_MainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setupUi(self)

#same as self.connect(self.pushButton, SIGNAL('clicked'),
self.openDialog) but more Pythonic.
self.pushButton.connect(self.openDialog) 

def openDialog(self):
self.dlg = MyAppDialog()
self.dlg.show()


class MyAppDialog(QDialog, Ui_Dialog):
def __init__(self):
QDialog.__init__(self)
self.setupUi(self)
self.pushButton.connect(self.close)


if __name__ == __main__:
app = QtGui.QApplication(sys.argv)
MainWindow = MyAppMainWindow()
MainWindow.show()
sys.exit(app.exec_())






GatorAlli wrote:
 
 The mainwindow is a QMainWindow.
 
 Here's some code that has the problem.
 
 ___main.py__
 from PyQt4 import QtCore, QtGui
 class Ui_MainWindow(object):
 def setupUi(self, MainWindow):
 MainWindow.setObjectName(MainWindow)
 MainWindow.resize(154, 96)
 self.centralwidget = QtGui.QWidget(MainWindow)
 self.centralwidget.setObjectName(centralwidget)
 self.gridLayout = QtGui.QGridLayout(self.centralwidget)
 self.gridLayout.setObjectName(gridLayout)
 self.pushButton = QtGui.QPushButton(self.centralwidget)
 self.pushButton.setObjectName(pushButton)
 self.gridLayout.addWidget(self.pushButton, 0, 0, 1, 1)
 MainWindow.setCentralWidget(self.centralwidget)
 self.menubar = QtGui.QMenuBar(MainWindow)
 self.menubar.setGeometry(QtCore.QRect(0, 0, 154, 21))
 self.menubar.setObjectName(menubar)
 MainWindow.setMenuBar(self.menubar)
 self.statusbar = QtGui.QStatusBar(MainWindow)
 self.statusbar.setObjectName(statusbar)
 MainWindow.setStatusBar(self.statusbar)
 self.retranslateUi(MainWindow)
 QtCore.QObject.connect(self.pushButton,
 QtCore.SIGNAL(clicked()), self.display)
 QtCore.QMetaObject.connectSlotsByName(MainWindow)
 def retranslateUi(self, MainWindow):

 MainWindow.setWindowTitle(QtGui.QApplication.translate(MainWindow,
 MainWindow, None, QtGui.QApplication.UnicodeUTF8))
 self.pushButton.setText(QtGui.QApplication.translate(MainWindow,
 Show the QDialog, None, QtGui.QApplication.UnicodeUTF8))
 def display(self):
 import d
 import sys
 app = QtGui.QApplication(sys.argv)
 ui = d.sprite_dialog()
 ui.exec_()  
 #sys.exit(app.exec_())
 if __name__ == __main__:
 import sys
 app = QtGui.QApplication(sys.argv)
 MainWindow = QtGui.QMainWindow()
 ui = Ui_MainWindow()
 ui.setupUi(MainWindow)
 MainWindow.show()
 sys.exit(app.exec_())
 ___
 
 
 ___d.py
 from PyQt4 import QtCore, QtGui
 class Ui_Dialog(object):
 def setupUi(self, Dialog):
 Dialog.setObjectName(Dialog)
 Dialog.resize(400, 300)
 self.gridLayout = QtGui.QGridLayout(Dialog)
 self.gridLayout.setObjectName(gridLayout)
 self.pushButton = QtGui.QPushButton(Dialog)
 self.pushButton.setObjectName(pushButton)
 self.gridLayout.addWidget(self.pushButton, 0, 0, 1, 1)
 self.retranslateUi(Dialog)
 QtCore.QObject.connect(self.pushButton,
 QtCore.SIGNAL(clicked()), self._close_)
 QtCore.QMetaObject.connectSlotsByName(Dialog)
 def retranslateUi(self, Dialog):
 Dialog.setWindowTitle(QtGui.QApplication.translate(Dialog,
 Dialog, None, QtGui.QApplication.UnicodeUTF8))
 self.pushButton.setText(QtGui.QApplication.translate(Dialog,
 Close this dialog, None, QtGui.QApplication.UnicodeUTF8))
 class sprite_dialog(QtGui.QDialog, Ui_Dialog):
 def __init__(self): 
 QtGui.QDialog.__init__(self) 
 self.setupUi(self) 
 def _close_(self):
 self.hide()
 
 
 Put main.py and d.py in the same directory. 
 Run main.py.
 Click Show the 

[PyQt] BUG: pyqtSignal('QString') vs pyqtSignal(['QString']) causes crash

2009-04-10 Thread Demetrius Cassidy

I am not sure if passing a string by itself to pyqtSignal is correct, but
shoulden't it raise an exception instead of crashing? I don't see why we
can't use this form instead.

If I use the latter form of pyqtSignal(['QString']), passing it a list of
strings, everything works great. If I pass it a quoted string, I get a crash
in QtCore.pyd using the latest nightly build (0409)

Simple test case, replace pyqtSignal('QString') with pyqtSignal(['QString'])
and it works OK.

import sys
from PyQt4 import QtGui, QtCore


class mainDlg(QtGui.QDialog):

clickEvent = QtCore.pyqtSignal('QString')

def __init__(self):
QtGui.QDialog.__init__(self)
self.setObjectName('Dialog')
self.resize(120, 120)
self.crashButton = QtGui.QPushButton()
self.crashButton.setText('Crash!')
self.verticalLayout = QtGui.QVBoxLayout(self)
self.verticalLayout.setObjectName(verticalLayout)
self.verticalLayout.addWidget(self.crashButton)
QtCore.QMetaObject.connectSlotsByName(self)

self.crashButton.clicked.connect(self.doCrash)
self.clickEvent.connect(self.OnEvent)


def doCrash(self):
self.clickEvent.emit('omgwtfbbq') - crashes here

def OnEvent(self, txt):
pass


app = QtGui.QApplication(sys.argv)  
dlg = mainDlg()
dlg.show()
-- 
View this message in context: 
http://www.nabble.com/BUG%3A-pyqtSignal%28%27QString%27%29-vs-pyqtSignal%28-%27QString%27-%29-causes-crash-tp22995320p22995320.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] How do you close a QDialog?

2009-04-09 Thread Demetrius Cassidy

You should read the Python tutorial. It would probably help.

http://docs.python.org/tutorial/


GatorAlli wrote:
 
 Thanks! It worked! =)
 
 Now how could you run this dialog from another script?
 
 (I'm no good at self, classes, and inheritance.)
 

-- 
View this message in context: 
http://www.nabble.com/How-do-you-close-a-QDialog--tp22874235p22977765.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] How do you close a QDialog?

2009-04-09 Thread Demetrius Cassidy

I don't follow 100%, but I guess you have say a GameMainWindow (non Qt), and
you want to open a new QtDialog from within your MainWindow? 

The problem might be if you run your own even loop, then you run PyQt's
event loop, messages for your window are no longer being received, causing
the freeze. Since I don't know what your MainWindow is I can only haphazard
a guess.

Can you post a short sample reproducing the freeze? 


GatorAlli wrote:
 
 You see... I have a main application window. There is a button in the main
 window. Whan you click the button, the dialog should pop up. When the
 dialog's close command is called, I want the dialog to close cleanly,
 returning to the main window.
 
 I tried this...
 
 __Mainwindow.py
 import sprite
 import sys
 app = QtGui.QApplication(sys.argv)
 ui = sprite.action_select_dialog()
 ui.show()
 sys.exit(app.exec_())
 ___
 
 It opens the dialog perfectly, but when I call the hide command on the
 dialog, the dialog closes, but the main window is frozen. :-((
 
 That's all I want you to answer.
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/How-do-you-close-a-QDialog--tp22874235p22981747.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] New Style emit without subclassing

2009-04-08 Thread Demetrius Cassidy
What's wrong with the old signal? It works. I am not sure about the new one 
you are talking about, and haven't really seen any docs on it.


- Original Message - 
From: Matt Smith mel...@orangepalantir.org

To: pyqt@riverbankcomputing.com
Sent: Wednesday, April 08, 2009 7:45 AM
Subject: Re: [PyQt] New Style emit without subclassing



Thats not quite what I'm getting at.  That will emit the signal, which
is the 'old style' but the new style is a bit different, and after you
set it up you emit the signal by using:

mysignal.emit(args)

My question is that the only way I know how to make a 'new style' signal
emittable is via creating a class attribute, ie:

class MyScene(QtGui.QGraphicsScene):
   mysignal = QtCore.pyqtSignal(QtGui.QGraphicsSceneMouseEvent)
   def __init__(self,parent):
   #normal init stuff

thanks
mbs


From: Demetrius Cassidy dcassid...@mass.rr.com
Subject: Re: [PyQt] New Style emit without subclassing
To: pyqt@riverbankcomputing.com
Message-ID: 285bc363d5e443c4983af69eec852...@rahxephon
Content-Type: text/plain; format=flowed; charset=iso-8859-1;
reply-type=original

from PyQt4.QtCore import SIGNAL

class MyScene(QtGui.QGraphicsScene):
   def __init__(self,parent=None):
  QtGui.QGraphicsScene.__init__(self,parent)

self.emit(SIGNAL((itemClicked(QGraphicsSceneMouseEvent*



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


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


Re: [PyQt] Copying Directory structure from a template one

2009-04-08 Thread Demetrius Cassidy

I must admit I am not very familiar with QDirModel, but why not use os.walk?

#top would be the root directory you are begining your search at.
 def _walkDirPath(self, top):
   for dirpath, dirnames, filenames in os.walk(top):
   for name in filenames:
   # yields: c:\mydata\myfile.exe
   yield os.path.join(dirpath, name), name 

- Original Message - 
From: F.A. Pinkse fapin...@gmail.com

To: pyqt@riverbankcomputing.com
Sent: Wednesday, April 08, 2009 10:52 AM
Subject: [PyQt] Copying Directory structure from a template one



Hello All,

For very new job in my CAD work I make a copy of an old Job Directory 
structure and rename the directories/files as needed by hand.

Finally I decided to throw Python at it.
I hard coded the structure, but I felt I could do better, like copying a 
template and do a rename in the process.

But somehow I got stuck.

Here is what I did so far.

Used the QDirModel(), giving me the whole file system.
Using filters will narrow this down, right?
I can do a .hasChildren(), but I fail on the . findChildren() bit which 
is needed for navigation, I think.



Has anyone a good source of examples on this.

Thanks,


Frans.

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

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


Re: [PyQt] New Style emit without subclassing

2009-04-07 Thread Demetrius Cassidy

from PyQt4.QtCore import SIGNAL

class MyScene(QtGui.QGraphicsScene):
  def __init__(self,parent=None):
 QtGui.QGraphicsScene.__init__(self,parent)
  self.emit(SIGNAL((itemClicked(QGraphicsSceneMouseEvent*

   
- Original Message - 
From: Matt Smith mel...@orangepalantir.org

To: pyqt@riverbankcomputing.com
Sent: Tuesday, April 07, 2009 3:17 PM
Subject: [PyQt] New Style emit without subclassing



I'm not clear on how to make an object emit a signal without
subclassing, with the new style emits.

ie, old style:

   myscene.emit(
   QtCore.SIGNAL(itemClicked(QGraphicsSceneMouseEvent*)
   ,ev
   )

Where as if I subclass:

   class MyScene(QtGui.QGraphicsScene):
   touchedItem = QtCore.pyqtSignal( QtGui.QGraphicsSceneMouseEvent)
   def __init__(self,parent=None):
   QtGui.QGraphicsScene.__init__(self,parent)

then I could use

myscene.touchedItem.emit(ev)





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

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


Re: [PyQt] New Style emit without subclassing

2009-04-07 Thread Demetrius Cassidy

Small Typo.. Should be:
self.emit(SIGNAL(itemClicked(QGraphicsSceneMouseEvent*)))


Demetrius Cassidy wrote:
 
 from PyQt4.QtCore import SIGNAL
 
 class MyScene(QtGui.QGraphicsScene):
def __init__(self,parent=None):
   QtGui.QGraphicsScene.__init__(self,parent)
self.emit(SIGNAL((itemClicked(QGraphicsSceneMouseEvent*
 
 
 - Original Message - 
 From: Matt Smith mel...@orangepalantir.org
 To: pyqt@riverbankcomputing.com
 Sent: Tuesday, April 07, 2009 3:17 PM
 Subject: [PyQt] New Style emit without subclassing
 
 
 I'm not clear on how to make an object emit a signal without
 subclassing, with the new style emits.
 
 ie, old style:
 
myscene.emit(
QtCore.SIGNAL(itemClicked(QGraphicsSceneMouseEvent*)
,ev
)
 
 Where as if I subclass:
 
class MyScene(QtGui.QGraphicsScene):
touchedItem = QtCore.pyqtSignal( QtGui.QGraphicsSceneMouseEvent)
def __init__(self,parent=None):
QtGui.QGraphicsScene.__init__(self,parent)
 
 then I could use
 
 myscene.touchedItem.emit(ev)
 
 
 
 
 
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 
 

-- 
View this message in context: 
http://www.nabble.com/New-Style-emit-without-subclassing-tp22936297p22938508.html
Sent from the PyQt mailing list archive at Nabble.com.

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