Re: [PyQt] Hunting down memory leaks

2010-12-17 Thread Darryl Wallace

 Il giorno mar, 14/12/2010 alle 18.02 +0100, Hans Meine ha scritto:
  Am Dienstag 14 Dezember 2010, 17:05:42 schrieb Darryl Wallace:
   One of the things I've found in this regard has to do with Python
 and
   garbage collection.  If the reference count to certain objects does
 not go
   to zero then the item will not be garbage collected.
  
   Ensure that the objects that you want cleaned up have no references
 to
   them.  I've found that setting widgets' parents to None and then
 setting
   that variable to None often does the trick.
  
   Anyone else have tips on garbage collection with PyQt???
 
  I also use sip.delete(obj) or obj.deleteLater() from time to time.
 
  Also I have a large number of helper functions based on the gc module,
 e.g.
  the ones below.  These are very useful, use like this:
 
  h1 = gcHistogram()
  ... # some long-running calculations which seem to leak memory
  h2 = gcHistogram()
  diffHists(h1, h2)
 
  This will output the *types* of objects that have been created in the
  meantime, along with their counts.  Sometimes, this will not help
 much though,
  e.g. if you use standard python lists a lot.  (It might make sense to
 use
  specialized classes derived from list anyway, no?)
 
  def gcHistogram():
  Returns per-class counts of existing objects.
  result = {}
  for o in gc.get_objects():
  t = type(o)
  count = result.get(t, 0)
  result[t] = count + 1
  return result
 
  def diffHists(h1, h2):
  Prints differences between two results of gcHistogram().
  for k in h1:
  if h1[k] != h2[k]:
  print %s: %d - %d (%s%d) % (
  k, h1[k], h2[k], h2[k]  h1[k] and + or
,
 h2[k] -
  h1[k])
 

 really useful thanks!

 Using these functions I found that if I do something like this:

 self.ui.lineEdit.mouseReleaseEvent=self

 I have to manually do:

 self.ui.lineEdit.mouseReleaseEvent=None

 to get the widget deleted, this seems a pyqt bug,

I would suggest that it's not a PyQt bug but rather a fundamental way that
Python does garbage collection.  This would occur with any other type of
Python object that holds a reference to another type of Python object
regardless of PyQt or not.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Hunting down memory leaks

2010-12-14 Thread Darryl Wallace
 -Original Message-
 From: pyqt-boun...@riverbankcomputing.com [mailto:pyqt-
 boun...@riverbankcomputing.com] On Behalf Of Mikael Modin
 Sent: December-13-10 5:50 AM
 To: pyqt@riverbankcomputing.com
 Subject: [PyQt] Hunting down memory leaks

 Hi,

 I'm currently developing a little tool and it seems I have a memory
 leak somewhere along the line that handles images, so each leak is
 around 7mb which is kind of a big deal leading my app quickly to
 100mb. I'm wondering if any of you havea any tips to figure out what
 kind of object I'm leaking and where I'm leaking them. I'm new to
 python, Qt and PyQt so I'm not very well versed in what tools are
 available.

 Kind regards
 Mikael

One of the things I've found in this regard has to do with Python and
garbage collection.  If the reference count to certain objects does not go
to zero then the item will not be garbage collected.

Ensure that the objects that you want cleaned up have no references to
them.  I've found that setting widgets' parents to None and then setting
that variable to None often does the trick.

Anyone else have tips on garbage collection with PyQt???

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


Re: [PyQt] Build PyQt with qtlibinfix specified for Qt libraries.

2010-10-12 Thread Darryl Wallace
On Tue, Oct 12, 2010 at 4:18 AM, Phil Thompson
p...@riverbankcomputing.comwrote:

 On Mon, 11 Oct 2010 20:48:42 -0400, Darryl Wallace
 darryl.wall...@prosensus.ca wrote:
  Hello,
 
  I've built Qt 4.7.0 with the -qtlibinfix switch when running configure
 (I
  used _x64_ as the value; e.g., QtGui_x64_4.dll).  I did this so that I
  could
  have a 64-bit version of Qt running along side the 32-bit version.  When
  running PyQt's configure, it doesn't seem to find the libraries properly
  when running configure.py from the VS 2008 64-bit command console.
 
  Is there a way to specify the qtlibinfix value in the PyQt
 configure.py???

 Not at the moment. I'll add support at some point, but if you want to play
 around with it then look at the method _qt_module_to_lib() in SIP's
 siputils.py.

 Phil


Ok, it would be handy [obviously] so that I could have both 32 and 64-bit
versions on the path at the same time (even if they were in different
folders).

Maybe Ill tinker with it tonight.
Darryl
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Build PyQt with qtlibinfix specified for Qt libraries.

2010-10-11 Thread Darryl Wallace
Hello,

I've built Qt 4.7.0 with the -qtlibinfix switch when running configure (I
used _x64_ as the value; e.g., QtGui_x64_4.dll).  I did this so that I could
have a 64-bit version of Qt running along side the 32-bit version.  When
running PyQt's configure, it doesn't seem to find the libraries properly
when running configure.py from the VS 2008 64-bit command console.

Is there a way to specify the qtlibinfix value in the PyQt configure.py???

Thanks,
Darryl

-- 
__
Darryl Wallace: Manager, Software Development
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] Converting an ugly path to a shell path

2010-09-13 Thread Darryl Wallace
 -Original Message-
 From: pyqt-boun...@riverbankcomputing.com [mailto:pyqt-
 boun...@riverbankcomputing.com] On Behalf Of amfr...@web.de
 Sent: September-13-10 11:19 AM
 To: pyqt@riverbankcomputing.com
 Subject: [PyQt] Converting an ugly path to a shell path

 Hi,

 im using a QFileDialog to let the user select a path that is used later
in
 a command send to the shell like this:

 retcode = Popen(command +   + path, shell=True, stdout = PIPE, stderr
=
 PIPE)

 The problem that occurs now is when the user selects an ugly path like
 this /home/user/! §$/.
 The shell don't understand the special chars so i have to escape them
with
 \ .
 Is there a function that does this ?

Try, from the os module, os.path.abspath.

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


Re: [PyQt] Problem connecting buttonClicked signal

2010-06-22 Thread Darryl Wallace
Hello
 -Original Message-
 From: pyqt-boun...@riverbankcomputing.com [mailto:pyqt-
 boun...@riverbankcomputing.com] On Behalf Of dizou
 Sent: June-22-10 2:11 PM
 To: pyqt@riverbankcomputing.com
 Subject: [PyQt] Problem connecting buttonClicked signal


 I have a bunch of QPushButtons in a QButtonGroup. I am trying to connect
the
 buttonClicked() signal with a method, but I am not able to.

 This is what I have:

 class DrawWidget(QWidget):
 def __init__(self, parent):
 QWidget.__init__(self, parent)

 self.Setup()
 def Setup(self):
 cursorButton = QPushButton()
 platformButton = QPushButton()
 nodeButton = QPushButton()
 channelButton = QPushButton()

 buttonGroup = QButtonGroup()
 buttonGroup.setExclusive(True)
 buttonGroup.addButton(cursorButton, 0)
 buttonGroup.addButton(platformButton, 1)
 buttonGroup.addButton(nodeButton, 2)
 buttonGroup.addButton(channelButton, 3)

 for button in buttonGroup.buttons():
 button.setFlat(True)
 button.setCheckable(True)

 cursorButton.setChecked(True)
 gridLayout = QGridLayout()
 gridLayout.addWidget(cursorButton, 0, 0)
 gridLayout.addWidget(platformButton, 0, 1)
 gridLayout.addWidget(nodeButton, 0, 2)
 gridLayout.addWidget(channelButton, 0, 3)

 self.setLayout(gridLayout)

 self.connect(buttonGroup, SIGNAL(buttonClicked(int)),
 self.ButtonClick)
 #self.connect(buttonGroup, SIGNAL(clicked(int)),
self.ButtonClick)
 def ButtonClick(self, id):
 print id
 print clicked

 When I run this code, I don't get anything printed on the screen.

The reason you don't get anything is because buttonGroup is being
garbage collected because it goes out of scope after Setup is completed.
You have to set it to self.buttonGroup so that something holds reference
to it.

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


Re: [PyQt] newbie question about slots and signals

2010-06-17 Thread Darryl Wallace
Hello

-Original Message-
From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Robin Wittler
Sent: June-17-10 1:22 PM
To: pyqt@riverbankcomputing.com
Subject: [PyQt] newbie question about slots and signals

Hi,

i am totaly new to pyqt4 and it seems that i have a problem to
understand how signals and slots working.
First i thought this is all clear to me, but then i wrote this little
code snippet and - surprise surprise - it didn't work.
The moep method where never called. I've tried it with the
QtCore.pyqtSlot dekorator, but this didn't work neither.
So what am i doing wrong? What have i missunderstud?

cheers,
robin



#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4 import QtWebKit
from PyQt4 import QtSvg
from PyQt4 import QtNetwork

class Browser(QtWebKit.QWebView):
 def __init__(self, **kargs):
 QtWebKit.QWebView.__init__(self)
 self.manager = QtNetwork.QNetworkAccessManager()
 self.proxy = self.manager.proxy()
 self.proxy.setHostName('127.0.0.1')
 self.proxy.setPort(8080)
 self.proxy.setType(self.proxy.HttpProxy)
 self.manager.setProxy(self.proxy)
 self._page = self.page()
 self._page.setNetworkAccessManager(self.manager)
 self.connect(
 self._page,
 QtCore.SIGNAL('loadFinished(bool)'),
 self.moep
 )

 def run(self):
 self._page.mainFrame().load(QtCore.QUrl('http://google.de'))

 def moep(self):
 print load finished


if __name__ == '__main__':
 app = QtGui.QApplication([])
 b = Browser()
 b.showFullScreen()
 b.run()
 sys.exit(app.exec_())


--
The signal/slot connection seems to be working properly for me as load
finished appears in my console.  The webpage, however, didn't load.

Though, I would recommend a simpler example to learn the use of signals
and slots.  Why not just make a widget with a QPushButton and connect the
button's clicked() signal to a slot.

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


Re: [PyQt] newbie question about slots and signals

2010-06-17 Thread Darryl Wallace
 Thanks for the quick answer.
 The page doesn't load because of the proxy settings.
 In my enviroment the page loads (because of the existing proxy)
 but load finished is not printed. ;)

 With a stopped proxy (but enabled proxy settings) the load finished
string
 will be printed (and the page will not load). If i start the proxy ,the
 string will
 not be printed (but the page loads).

 wtf? :)

Perhaps the page is not actually finished loading

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


Re: [PyQt] Fast selection of non-contiguous items in QTreeview

2010-04-09 Thread Darryl Wallace
*From:* Bjorn Egil Ludvigsen [mailto:bludvig...@gmail.com]
*Sent:* April-09-10 11:36 AM
*To:* Darryl Wallace
*Cc:* pyqt@riverbankcomputing.com
*Subject:* Re: [PyQt] Fast selection of non-contiguous items in QTreeview



I am planning similar things and will run into the same issue as you I
suspect. My benchmark will be a table model with up to 1 million rows. Each
of the rows may have 1,000 items (columns) and I need filter features to
select rows (numerical simulations). Related to this and Darryl's question,
would someone like to comment in general on the feasibility of using PyQt
for such large table models (or tree models etc.) and the maximum
responsiveness one can achieve?



Regards,

Bjorn



Hello Bjorn,

I achieved some major improvements by using QItemSelection and looping
through the selected indexes and building ranges.  It’s much faster to build
the QItemSelection object then it is to select individual items.



Here’s my example.



def searchAndSelect(self, searchString, column=0):

#If the user searches for nothing, then return and do nothing

if len(searchString)==0:

return



self.obsTreeView.clearSelection()

#get the selection model from the view

selectionModel=self.obsTreeView.selectionModel()



indexes=self.obsTreeModel.match(self.obsTreeModel.index(0, column,
QtCore.QModelIndex()),

QtCore.Qt.DisplayRole,
QtCore.QVariant(searchString),

 -1,QtCore.Qt.MatchContains)

if len(indexes)0:

indexesToExclude=[]

itemSelection=QtGui.QItemSelection()

# Initialize topLeft as the first index.

topLeft=indexes[0]

bottomRight=None

for i in xrange(1, len(indexes)):

#if the difference between rows is  1

#This means that there is a break in the range.

if indexes[i].row()-indexes[i-1].row()1:

# Set the bottomRight value to the previous index.

bottomRight=indexes[i-1]

itemSelection.select(topLeft, bottomRight)

# Set the topLeft as the current Index.

topLeft=indexes[i]

# make sure to select the last bunch

bottomRight=indexes[-1]

itemSelection.select(topLeft, bottomRight)



selectionModel.select(itemSelection,

   QtGui.QItemSelectionModel.Select | QtGui.QItemSelectionModel.Rows)



self.obsTreeView.scrollTo(indexes[0],
QtGui.QAbstractItemView.PositionAtTop)

#searchAndSelect





On Thu, Apr 8, 2010 at 3:14 PM, Darryl Wallace darryl.wall...@prosensus.ca
wrote:

*Here’s an example of the code:*

* *

*def searchAndSelect(self, searchString, column=0):*

*#If the user searches for nothing, then return and do nothing*

*if len(searchString)==0:*

*return*

* *

*#get the selection model from the tree view*

*selectionModel=self.obsTreeView.selectionModel()*

*  *

*# Find the items in the model.*

*# obsTreeModel is a QStandardItemModel*

*# This part is very fast *

*items=self.obsTreeModel.findItems(searchString,
QtCore.Qt.MatchContains, column)*

**

*#select each item*

*# This part is very slow.*

*for item in items:*

*selectionModel.select(item.index(),
selectionModel.Select|selectionModel.Rows)*

*#searchAndSelect*

* *

*Does anyone have any tips on speeding up the selection part?  I’ve tried
blocking the signals of the selection model incase the selectionChanged
signal of QItemSelectionModel is causing a re-draw but it didn’t seem to
help.*

* *

*Thanks,
Darryl*



*From:* Darryl Wallace [mailto:darryl.wall...@prosensus.ca]
*Sent:* April-08-10 2:23 PM
*To:* 'pyqt@riverbankcomputing.com'
*Subject:* Fast selection of non-contiguous items in QTreeview



Hello,



I’ve done some reading and can’t find anything on non-contiguous selection
of items in item views beyond :



“Selections are made up of *selection ranges*. These efficiently maintain
information about large selections of items by recording only the starting
and ending model indexes for each range of selected items. Non-contiguous
selections of items are constructed by using more than one selection range
to describe the selection.” -
http://doc.trolltech.com/4.6/model-view-selection.html#concepts



Currently we have implemented a selection of items by scanning each row in
the model to see if it should be “selected” based on certain criteria.  Is
there a faster way to do this as looping in Python through a large (50,000
rows)?  When selections can be specified with selection ranges the selection
is fast.  However, our worst case scenario is that every-other item need be
selected: 25,000 selection ranges would be created and then we would just be
looping through everything again anyways.



Any ideas?



Thanks,

Darryl


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

Re: [PyQt] Fast selection of non-contiguous items in QTreeview

2010-04-08 Thread Darryl Wallace
*Here’s an example of the code:*

* *

*def searchAndSelect(self, searchString, column=0):*

*#If the user searches for nothing, then return and do nothing*

*if len(searchString)==0:*

*return*

* *

*#get the selection model from the tree view*

*selectionModel=self.obsTreeView.selectionModel()*

*  *

*# Find the items in the model.*

*# obsTreeModel is a QStandardItemModel*

*# This part is very fast *

*items=self.obsTreeModel.findItems(searchString,
QtCore.Qt.MatchContains, column)*

**

*#select each item*

*# This part is very slow.*

*for item in items:*

*selectionModel.select(item.index(),
selectionModel.Select|selectionModel.Rows)*

*#searchAndSelect*

* *

*Does anyone have any tips on speeding up the selection part?  I’ve tried
blocking the signals of the selection model incase the selectionChanged
signal of QItemSelectionModel is causing a re-draw but it didn’t seem to
help.*

* *

*Thanks,
Darryl*



*From:* Darryl Wallace [mailto:darryl.wall...@prosensus.ca]
*Sent:* April-08-10 2:23 PM
*To:* 'pyqt@riverbankcomputing.com'
*Subject:* Fast selection of non-contiguous items in QTreeview



Hello,



I’ve done some reading and can’t find anything on non-contiguous selection
of items in item views beyond :



“Selections are made up of *selection ranges*. These efficiently maintain
information about large selections of items by recording only the starting
and ending model indexes for each range of selected items. Non-contiguous
selections of items are constructed by using more than one selection range
to describe the selection.” -
http://doc.trolltech.com/4.6/model-view-selection.html#concepts



Currently we have implemented a selection of items by scanning each row in
the model to see if it should be “selected” based on certain criteria.  Is
there a faster way to do this as looping in Python through a large (50,000
rows)?  When selections can be specified with selection ranges the selection
is fast.  However, our worst case scenario is that every-other item need be
selected: 25,000 selection ranges would be created and then we would just be
looping through everything again anyways.



Any ideas?



Thanks,

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

Re: [PyQt] Getting a segfault when I close my program

2010-03-11 Thread Darryl Wallace
Hello,

-Original Message-
From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of dizou
Sent: March-11-10 2:54 PM
To: pyqt@riverbankcomputing.com
Subject: Re: [PyQt] Getting a segfault when I close my program


If I take out the line:
treeControlLayout.addItem(self.rightSpacer, 0, 8)
or
viewControlLayout.addItem(self.rightSpacer, 0, 8)
I don't get the segfault anymore.
So I can't have both of those lines of code in.



I believe it's because you can't have the self.rightSpacer object in two
different places.  My guess is you're getting the segfault because when
the first layout is destroyed it cleans up the self.rightSpacer.  Then
when the second layout is destroyed it's trying to clean up the
self.rightSpacer, but it's been deallocated already.

Try using a different spacer object for each layout, e.g.:
treeControlLayout.addItem(QSpacerItem(10, 0, QSizePolicy.Expanding), 0,8)
viewControlLayout.addItem(QSpacerItem(10, 0, QSizePolicy.Expanding), 0, 8)


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


[PyQt] Memory Release question

2010-02-03 Thread Darryl Wallace
Hello,

Quick question and sorry if it's been discussed before.  I'm using Python
2.5, Qt 4.5.3 and PyQt 4.4.4, sip 4.7.9 on Windows 7 all built with VS2008.
 I'm wondering how memory from destroyed objects are released back to the
operating system.

If I take the MDI example and start that program, it's using 11,060K of ram.
 Creating a new document in the MDI (by clicking the new button on the
toolbar brings the ram usage up to 11,376K.  Upon closing the document, ram
usage went down to 11,372K.  After a minute or so it went down to 11,340K.
 Why doesn't it go back to closer to 11,060?

I would guess that when the QTextEdit object was destroyed, that the memory
it used would be returned.

Can anyone provide some info?

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

Re: [PyQt] Memory Release question

2010-02-03 Thread Darryl Wallace
Thanks for the clarification.

On Wed, Feb 3, 2010 at 3:10 PM, Ville M. Vainio vivai...@gmail.com wrote:

 On Wed, Feb 3, 2010 at 7:08 PM, Darryl Wallace
 darryl.wall...@prosensus.ca wrote:

  If I take the MDI example and start that program, it's using 11,060K of
 ram.
   Creating a new document in the MDI (by clicking the new button on the
  toolbar brings the ram usage up to 11,376K.  Upon closing the document,
 ram
  usage went down to 11,372K.  After a minute or so it went down to
 11,340K.
   Why doesn't it go back to closer to 11,060?
  I would guess that when the QTextEdit object was destroyed, that the
 memory
  it used would be returned.
  Can anyone provide some info?

 The application heap is not typically returned to OS directly when
 objects are freed. Rather, the freed space will be used by other
 objects allocated by the application.

 --
 Ville M. Vainio
 http://tinyurl.com/vainio




-- 
__
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

[PyQt] Error buliding QScintilla 2.2 Python bindings

2010-01-27 Thread Darryl Wallace
Hello,

I'm trying to build QScintilla 2.2 (same error occurs with 2.3) with Python
bindings.  I am using Windows MSVC2008, Qt 4.5.3, PyQt4.4.4.
QScintilla builds properly.  The QScintilla C++ example builds and runs.

When running nmake on the Python bindings, it raises an error in the file
sipQsciQsciCommandSet.cpp on line 106.  Error C2065 'QSciCommandList' :
Undeclared identifier.

After sifting through some header files, I am unable to find any reference
to QsciCommandList.

Any ideas?

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

[PyQt] SIP build problem with VS2008 Express Edition

2010-01-26 Thread Darryl Wallace
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

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

2010-01-26 Thread Darryl Wallace
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.comwrote:

 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





-- 
__
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

[PyQt] Same widget in multiple locations

2010-01-15 Thread Darryl Wallace
Quick question and i think I already know the answer, but I'll throw it out
there.

Is it possible to display the same QWidget in different places?

--
Quick background.. I'm making some plots using PyQwt.  These plots are
connected to a play/pause tool bar with position slider to update the plot
contents.  I've changed my program flow such that one main toolbar to
control the plots is not sufficient as they may now have data from different
locations.

My idea was to create one toolbar to control each plot from the same group
of plots, except I wanted to display the toolbar in each plot subwindow.
 This way I could avoid having to make multiple connections all going back
to the same place.

Now this means displaying the same widget in multiple locations on the
screen at once (one within each plot child window).  Is it possible to
display the same widget in different places?

I've tried just adding the same object to a layout and it shows up only in
one of the windows.  I've also tried using a graphicsview/scene combination
where I add the widget to the scene, but this yields an error reported to
the console by QGraphicsProxyWidget saying that the widget was already
added.
--
Any help would be much appreciated if it's possible.  But I think the answer
is that the same widget cannot be shown in more than one location.

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

Re: [PyQt] QVariant.toFloat()

2010-01-14 Thread Darryl Wallace
Hello,


 when I use toDouble() I obtain a data in this format:

 (9.5, True)


The method definition for toDouble in C++ is:

QVariant.toDouble(bool *ok=0)

The ok value will be true if the conversion to a double was successful.
 Because passing a pointer into a function this way is not Pythonic, Phil
had it return the value and success in a tuple (at least I think that was
the motivation).

So this means you need to index the first value of the tuple, e.g. value =
QVariant.toDouble()[0]


 When it should be a float 9.50 (cause like I said, is what I have in DB).

 How can I get it 2 decimals positions?


As Andreas noted in the next post, the decimal places shouldn't matter
because it's a double precision floating point value.  If you want it to be
placed in your data base as a string with two decimal places, then export it
to the database with a formatted string.  But I'm not sure this is what
you're asking.

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

Re: [PyQt] PyQT spreadsheet

2009-11-02 Thread Darryl Wallace
Why don't you check out Spyder from PythonXY (pythonxy.com).  It's open
source and has lots of examples of these.

On Sun, Nov 1, 2009 at 2:44 PM, Giorgio Luciano
giorgio.luci...@inwind.itwrote:


 We are building a small scientific framework using PyQT. The idea is to
 have
 a MDI with tables and the ability to copy and paste (and import) txt, csv,
 matlab, and excel files.
 The idea is to have a more tiny friendly environment for data analysis.

 So far we have implementd the MDI, and we are implementing the tables (via
 QTable widget)

 I've digged around (and also asked in this list)  but it seems there are
 really No examples of spreadsheet made in qt (the only one that I know is
 StupidSheet on google coode but it seems no more active).

 Anyone that would like to use the code since now and is interested in
 implementing is very wellcome and also any hints about the topic.
 We will be glad also if people would like to give feedback on what we have
 implemented.

 problems we have

 -clipboard from excel/opencalc doesnt' split  correctly
 -doubt about if it would be useful to implement special formatting in the
 tables

 I hope we could merge (help) with the owner of subplot routines ;)
 http://code.google.com/p/subplot/people/detail?u=bhclowers (anyone there)

 here's the link of SVN

 http://code.google.com/p/openchem/source/browse/#svn/trunk

 Cheers to all
 Giorgio


 Not to mention that the project is opensource and it will be released under
 GPL (or BSD, still to see but no money from it :)))
 --
 View this message in context:
 http://old.nabble.com/PyQT-spreadsheet-tp26153125p26153125.html
 Sent from the PyQt mailing list archive at Nabble.com.

 ___
 PyQt mailing listPyQt@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] Wrong cursor

2009-10-29 Thread Darryl Wallace
Hello,

On Thu, Oct 29, 2009 at 9:21 AM, Mads Ipsen m...@comxnet.dk wrote:

 The script below should display a QWidget with a Qt::SizeAllCursor. Instead
 it displays a Qt::ClosedHandCursor. Bug?

 System information
 Linux
 Python 2.6.1
 Qt 4.5.2
 PyQt 4.5.4


I am using Ubuntu and the Qt::SizeAllCursor actually looks like a closed
hand.  If you try the Qt::ClosedHandCursor, it looks like a slightly
different cursor.

I tried this using Qt 4.4.0 in C++ to verifiy that it is not a PyQt
problem.

Darryl




 Mads

 import sys
 from PyQt4 import QtCore, QtGui

 if __name__ == __main__:
   app = QtGui.QApplication(sys.argv)

   widget = QtGui.QWidget()
   widget.show()

   cursor = QtGui.QCursor(QtCore.Qt.SizeAllCursor)
   widget.setCursor(cursor)

   sys.exit(app.exec_())

 --
 +-+
 | Mads Ipsen, Scientific developer|
 +---+-+
 | QuantumWise A/S   | phone: +45-29716388 |
 | Nørre Søgade 27A  | www:www.quantumwise.com |
 | DK-1370 Copenhagen K, Denmark | email:  m...@quantumwise.com |
 +---+-+


 ___
 PyQt mailing listPyQt@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

[PyQt] Error building PyQt bindings for QScintilla 2.4

2009-08-20 Thread Darryl Wallace

Hello,

I'm trying to update my QScintilla bindings to v2.4 from v2.2.

Make and install of the C++ library was fine. 


When trying the Python bindings, configure.py yields the following error:

QScintilla 2.4 is being used.
PyQt 4.4.2 is being used.
Qt v4.4.0 Desktop edition is being used.
SIP 4.7.7 is being used.
The QScintilla module will be installed in
/usr/lib/python2.5/site-packages/PyQt4.
The QScintilla API file will be installed in
/usr/local/Trolltech/Qt-4.4.0/qsci/api/python.
The QScintilla .sip files will be installed in /usr/share/sip/PyQt4.
Generating the C++ source for the Qsci module...
sip: /usr/share/sip/PyQt4/QtCore/qxmlstream.sip:192: Incorrect number of 
arguments to Python slot

Error: Unable to create the C++ code.


Well, I was mainly trying to update it to see if there are any fixes to 
the autocomplete pop-up stealing focus on X11 (using Ubuntu 9.04).


Thanks,
Darryl

--
__
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] PyQt without X11

2009-07-30 Thread Darryl Wallace
While I realize the application example you're showing here uses webkit, you
should be able to use QtCore.QCoreApplication.

This will allow you to run PyQt console type applications.

On Wed, Jul 29, 2009 at 6:02 PM, arnau tokl...@gmail.com wrote:

 Hello,

 I was wondering if it was possible to run PyQt without a X11 server when no
 GUI
 is going to be used. I've tried with GUIenabled=False, but I still get a
 segmentation fault:

 ---
 GNU/Linux Debian Sid
 python 2.5.4
 python-qt 4.5.1
 libqt4-webkit 4.5.2

 $ python
 Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47)
 [GCC 4.3.3] on linux

 from PyQt4.QtGui import QApplication
 from PyQt4.QtWebKit import QWebPage
 QApplication([], False)
 webpage = QWebPage()

 Segmentation fault

 ---

 It might be a FAQ, but I've been unable to find an answer, sorry.

 thanks,
 arnau

 ---
 http://code.google.com/p/spynner/

 ___
 PyQt mailing listPyQt@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] Re: QSpinBox: behavior on Linux

2009-06-04 Thread Darryl Wallace

TP wrote:

Thanks a lot.
I have another question: how to know the PyQt and Qt version from python?

I have searched in the archive, but the result is not satisfying:

http://search.gmane.org/?query=__version__+pyqtauthor=group=gmane.comp.python.pyqt-pykdesort=relevanceDEFAULTOP=andxP=__version__xFILTERS=Gcomp.python.pyqt-pykde---A
QtCore.qVersion() for Qt version and, QtCore.PYQT_VERSION_STR for PyQt 
version


Please use a new thread for different topics.  This will prevent your 
question from getting missed.


Darryl

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


Re: Fwd: [PyQt] QAction menu questions

2009-06-03 Thread Darryl Wallace

Hello,


Is there an example someone could point me to that demonstrates how to 
specify the About Menu and item name, changing them from Python and 
About Python to MyApp and About MyApp?
I run your script and the window title says Menu Test and under the 
help I have About My App and About Qt and I've attached the 
screenshot for proof :)


What operating system are you running in?

Also, it should say About MyApp as the code says:

self.aboutAct = QtGui.QAction(self.tr(About MyApp), self)
self.aboutAct.setStatusTip(self.tr(Show the application's About box))


I'm not sure what your problem could be.

Darryl

inline: screenshot_001.png___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] FetchMore Example - Table Edition

2009-05-11 Thread Darryl Wallace

Hello Everyone,

The last time I wrote in I had presented the FetchMore example.  I've 
extended this example to use a simple table model.  The input is a 2d 
numpy array.  I couldn't find an example with lazy table population 
anywhere, so here's what I've got.


Feel free to use it as you wish.  Hope that someone finds it useful.

Regards,
Darryl

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


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

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

# Fetch More Example - Lazy Table Edition
# Ported to PyQt4 by Darryl Wallace, 2009 - walla...@gmail.com

import sys
from PyQt4 import QtGui, QtCore
import numpy

class LazyTableModel(QtCore.QAbstractTableModel):

def __init__(self, data, parent=None):
QtCore.QAbstractTableModel.__init__(self, parent)
self.numRows=0
self.numColumns=0
self._data=data
#__init__

def rowCount(self, parent):

parent=QModelIndex

return self.numRows
#rowCount

def columnCount(self, parent):

parent=QModelIndex

return self.numColumns
#columnCount

def data(self, index, role=QtCore.Qt.DisplayRole):

index=QModelIndex

if not index.isValid():
return QtCore.QVariant()

if index.row()=self.numRows or index.row()0 or 
index.column()=self.numColumns or index.column()0:
return QtCore.QVariant()

if role==QtCore.Qt.DisplayRole:
return QtCore.QVariant(self._data[index.row(), index.column()])
elif role==QtCore.Qt.BackgroundRole:
return QtCore.QVariant(QtGui.qApp.palette().base())

return QtCore.QVariant()
#data

def canFetchMore(self, index):

index=QModelIndex

if self.numRowsself._data.shape[0] or 
self.numColumnsself._data.shape[1]:
return True
else:
return False
#canFetchMore

def fetchMore(self, index):

Index=QModelIndex

maxFetch=10 #maximum number of rows/columns to grab at a time.

remainderRows=self._data.shape[0]-self.numRows
rowsToFetch=min(maxFetch, remainderRows)

if rowsToFetch0:
self.beginInsertRows(QtCore.QModelIndex(), self.numRows, 
self.numRows+rowsToFetch-1)
self.endInsertRows()
self.numRows+=rowsToFetch

remainderColumns=self._data.shape[1]-self.numColumns
columnsToFetch=min(maxFetch, remainderColumns)
if columnsToFetch0:
self.beginInsertColumns(QtCore.QModelIndex(), self.numColumns, 
self.numColumns+columnsToFetch-1)
self.endInsertColumns()
self.numColumns+=columnsToFetch

self.emit(QtCore.SIGNAL(numberPopulated), rowsToFetch, columnsToFetch)
#fetchMore
#LazyTableModel

class Window(QtGui.QWidget):

def __init__(self, data, parent=None):

Data is any 2-d numpy array

QtGui.QWidget.__init__(self, parent)

self.model = LazyTableModel(data, parent=self)

view=QtGui.QTableView()
view.setModel(self.model)

self.logViewer=QtGui.QTextBrowser()

self.logViewer.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, 
QtGui.QSizePolicy.Preferred))

self.connect(self.model, QtCore.SIGNAL(numberPopulated), 
self.updateLog)

layout=QtGui.QGridLayout()
layout.addWidget(view, 0, 0, 1, 2)
layout.addWidget(self.logViewer, 1, 0, 1, 2)

self.setLayout(layout)

self.setWindowTitle(self.tr(Fetch More Example - Table Edition))
self.resize(400, 600)
#__init__

def updateLog(self, rows, columns):
self.logViewer.append(self.tr(%1 rows added.  %2 columns 
added).arg(rows).arg(columns))
#updateLog
#Window

if __name__=='__main__':
qApp=QtGui.QApplication(sys.argv)
data=numpy.random.normal(size=(117, 53))
fetchMoreWindow=Window(data)
fetchMoreWindow.show()
qApp.exec_()
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] FetchMore Example

2009-05-08 Thread Darryl Wallace

Hello Everyone,

Since I was interested in the FetchMore example (included in Qt4.5) and 
extending it for myself, I just decided to port the FetchMore example to 
PyQt4 since I noticed it was not included in the ItemViews examples in 
the latest snapshot. 


Feel free to use it as you wish.

Phil feel free to included it in your list of examples should it be 
deemed acceptable.  The only thing that I have done differently is that 
I force the QStringList to be a Python list.  I wrote it using PyQt4.4.2 
in Linux (Ubuntu).


See the attached file.

Regards,
Darryl
# Fetch More Example
# Ported to PyQt4 by Darryl Wallace, 2009 - walla...@gmail.com

import sys
from PyQt4 import QtGui, QtCore

class FileListModel(QtCore.QAbstractListModel):

def __init__(self, parent=None):
QtCore.QAbstractListModel.__init__(self, parent)
self.fileCount=0
self.fileList=[]#initialize the file list as a Python list.
#__init__

def rowCount(self, parent):

parent=QModelIndex

return self.fileCount
#rowCount

def data(self, index, role=QtCore.Qt.DisplayRole):

index=QModelIndex

if not index.isValid():
return QtCore.QVariant()

if index.row()=len(self.fileList) or index.row()0:
return QtCore.QVariant()

if role==QtCore.Qt.DisplayRole:
return QtCore.QVariant(self.fileList[index.row()])
elif role==QtCore.Qt.BackgroundRole:
batch=(index.row()/100)%2
if batch==0:
return QtCore.QVariant(QtGui.qApp.palette().base())
else:
return QtCore.QVariant(QtGui.qApp.palette().alternateBase())
return QtCore.QVariant()
#data

def canFetchMore(self, index):

index=QModelIndex

if self.fileCountlen(self.fileList):
return True
else:
return False
#canFetchMore

def fetchMore(self, index):

Index=QModelIndex


remainder=len(self.fileList)-self.fileCount
itemsToFetch=min(100, remainder)

self.beginInsertRows(QtCore.QModelIndex(), self.fileCount, 
self.fileCount+itemsToFetch)

self.fileCount+=itemsToFetch

self.endInsertRows()

self.emit(QtCore.SIGNAL(numberPopulated), itemsToFetch)
#fetchMore

def setDirPath(self, path):
dir=QtCore.QDir(path)

self.fileList=list(dir.entryList()) # force Python list.
self.fileCount=0
self.reset()
#setDirPath
#FileListModel

class Window(QtGui.QWidget):

def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)

self.model = FileListModel(self)

self.model.setDirPath(QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.PrefixPath))

label = QtGui.QLabel(self.tr(Directory))
lineEdit=QtGui.QLineEdit()
label.setBuddy(lineEdit)

view=QtGui.QListView()
view.setModel(self.model)

self.logViewer=QtGui.QTextBrowser()

self.logViewer.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, 
QtGui.QSizePolicy.Preferred))

self.connect(lineEdit, QtCore.SIGNAL(textChanged(const QString )), 
self.model.setDirPath)
self.connect(lineEdit, QtCore.SIGNAL(textChanged(const QString )), 
 self.logViewer, QtCore.SLOT(clear()))
self.connect(self.model, QtCore.SIGNAL(numberPopulated), 
self.updateLog)

layout=QtGui.QGridLayout()
layout.addWidget(label, 0, 0)
layout.addWidget(lineEdit, 0, 1)
layout.addWidget(view, 1, 0, 1, 2)
layout.addWidget(self.logViewer, 2, 0, 1, 2)

self.setLayout(layout)

self.setWindowTitle(self.tr(Fetch More Example))
#__init__

def updateLog(self, number):
self.logViewer.append(self.tr(%1 items added.).arg(number))
#updateLog
#Window

if __name__=='__main__':
qApp=QtGui.QApplication(sys.argv)

fetchMoreWindow=Window()
fetchMoreWindow.show()
sys.exit(qApp.exec_())
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Populate Model data in a separate thread

2009-04-28 Thread Darryl Wallace

Hello Detlev,

Where abouts in eric4 do you do perform this lazy population?  This 
interests me as I suffer from a similar table population slowdown.


Thanks,
Darryl

Detlev Offenbach wrote:
Another solution would be to do lazy population of the model. That is, if 
child items are to be shown, fetch them at that time. This avoids populating 
the model in advance and is more responsive. See eric4 as an example.


Detlev

On Montag, 27. April 2009, Demetrius Cassidy wrote:
  

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
  




  

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


[PyQt] AutoExpanding Contents QComboBox - Windows

2009-04-17 Thread Darryl Wallace

Hello Everyone,

I'm using Windows with Qt4.4.0 and PyQt4.3.3.  I have a QComboBox where 
the contents are wider than the combobox itself.  In Linux, when you 
click on the combobox it expands to the width of the contents.  In 
Windows it cuts the contents off and the view is the same width as the 
the combobox.


Any idea how, in windows, to expand the width of the view of the 
contents when the combobox is clicked?


I've set the flag for the sizeAdjustPolicy to QComboBox.AdjustToContents 
but it still does not work.


Any ideas?
Thanks,
Darryl
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Eric4 buggy

2009-03-17 Thread Darryl Wallace
Perhaps you should direct your question to the eric mailing list.  I've 
been using Eric4 for over year with no problems.


Mario Daniel Carugno wrote:

Hi, i'm trying eric4 and seems too buggy.
Now i configure options, but every time i start Eric, configuration is
lost and i get the dialog:

eric4 has not been configured yet. The configuration dialog will be started

I tried with version 4.1 from debian testing, but also i've downloaded
the last version 4.3
Always the same thing

And eric was buggy in early versions too, sometimes it closes itself,
for instance.

Why is eric so buggy ? Do anybody know some 'stable' version of eric ?
___
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] Reducing Ram Usage Tips?

2009-03-13 Thread Darryl Wallace

Hello,

I've recently developed a data analysis program using PyQt.  It's not a 
huge program but it's not small either.  I've noticed that, in Windows, 
the memory usage at startup is ~80MB.  I've removed all of the 'import 
*'s that I previously had and do not load the Qt module at any location.


I am packaging the entire library in the exe using py2exe.

Just wondering if anyone else has had any success bringing down the 
memory consumption.


Thanks,
Darryl

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


Re: [PyQt] Reducing Ram Usage Tips?

2009-03-13 Thread Darryl Wallace

Hello Stan

stan wrote:

On Fri, 2009-03-13 at 09:37 -0400, Darryl Wallace wrote:
  

Hello,

I've recently developed a data analysis program using PyQt.  It's not a 
huge program but it's not small either.  I've noticed that, in Windows, 
the memory usage at startup is ~80MB.  I've removed all of the 'import 
*'s that I previously had and do not load the Qt module at any location.


I am packaging the entire library in the exe using py2exe.

Just wondering if anyone else has had any success bringing down the 
memory consumption.


Thanks,
Darryl



While there are a great number advantages to having a nice single
huge .exe, memory consumption is driven up as that entire .exe has to
be loaded in memory at one time, of course.  With the one directory
option in PyInstaller or py2exe, the .exe's themselves are quite small
by comparison, so that loading and speed generally are much faster out
of the gate as they make system calls as needed; of course memory
usage will then increase as needed, but in general, memory use seems
to remain much smaller.  Of course, the initial distribution directory
is often bigger (a one timer, usually), but later I have found that
simple updates, bug fixes, etc. don't require many additional dirctory
items (of course this depends on what you later add!), but total
subsequent distribution time is greatly simplified and is limited to the
new .exe and the simple occasional additions.
  
Ok that's one of the things that  I thought regarding the single 'exe' 
file. 

Did you happen to avoid using the QTCore4.dll and QtGui4.dll? (you
mentioned not having loaded the Qt modules) Can these be avoided in
favor of the PyQt dll's??  Those are very large, but I think they must
be always and unavoidably pulled in by PyQt??
  
From what I've read and my experience you cannot avoid including the Qt 
dll's.  While they're very large relatively speaking, my entire 
program approaches a 21 MB zipped download; acceptable as far as I'm 
concerned.


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


[PyQt] QFIleDialog.getSaveFileName get the selectedFilter

2009-03-10 Thread Darryl Wallace
I prefer to use the static method for the getSaveFilename in the 
QFileDialog so that the user sees the Windows/Mac native dialog.


My problem is that if the user doesn't type the file extension the in 
the save file name (say when selecting an image type to save a file as), 
then I don't have a way of checking to see what type of file they wanted 
to save as.


Is there away to get the selectedFilter using this method?

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


Re: [PyQt] Qt 4.5 and PyQt 4.5 for Ubuntu Hardy?

2009-03-05 Thread Darryl Wallace
You could just 'make' them yourself.   Then you don't have to move off 
Hardy and can use them immediately.


Joshua Kugler wrote:

Hello!

I asked on #ubuntu, but didn't get any response. I thought I'd try a more
focused venue. :)

Is there anyone doing Qt 4.5 builds for Hardy?  And planning on doing
PyQt4.5 builds for hardy?  I want to do some Qt 4.5 work, but I'm not ready
to move off of an LTS version.

Thanks!

j

___
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] QVector Bug?

2009-02-12 Thread Darryl Wallace
Ok so I guess it's not technically a 'QVector' since QVector is not 
explictly implemented.  Regardless, the code used to work in PyQt4.4.2 
for QPolygon.


And I solve the problem using .at() instead of the __getitem__ / [] operator

darryl

Darryl Wallace wrote:

Hello,

I may have encountered an error with using QPolygon (or I guess any 
QVectorQPoint / QVectorQPointF)  It doesn't appear to be able to 
set the values.


The following code is my test:

from PyQt4 import Qt

from random import random

f=Qt.QPolygonF(5)

print Before
for i in range(5):
   print f[i].x(), f[i].y()

print After
for i in range(5):
   newX=random()
   newY=random()
   f[i].setX(newX)
   f[i].setY(newY)
   print newX,newY,   /   ,f[i].x(),f[i].y()
---
Using PyQt4.4.4, Qt 4.4.0, SIP 4.7.9, Python 2.5.2, Windows

You can see that running the program yields no change.  The QVector 
documentation for the [] operator states that:


T  QVector::operator[] ( int /i/ )
Returns the item at index position /i/ as a modifiable reference.
/i/ must be a valid index position in the vector (i.e., 0 = /i/  
size cid:part1.06020005.08010804@prosensus.ca()).
See also at cid:part2.01070405.06030700@prosensus.ca() and value 
cid:part3.08090504.08050301@prosensus.ca().


So I think it should still work.  I can verify that the above this 
works code works for PyQt4.4.2, Qt 4.4.0, SIP 4.7.7, Python 2.5.2 in 
Linux.


Is there a work-around available for the near future?

Thanks
Darryl





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


[PyQt] QVector Bug?

2009-02-12 Thread Darryl Wallace

Hello,

I may have encountered an error with using QPolygon (or I guess any 
QVectorQPoint / QVectorQPointF)  It doesn't appear to be able to set 
the values.


The following code is my test:

from PyQt4 import Qt

from random import random

f=Qt.QPolygonF(5)

print Before
for i in range(5):
   print f[i].x(), f[i].y()

print After
for i in range(5):
   newX=random()
   newY=random()
   f[i].setX(newX)
   f[i].setY(newY)
   print newX,newY,   /   ,f[i].x(),f[i].y()
---
Using PyQt4.4.4, Qt 4.4.0, SIP 4.7.9, Python 2.5.2, Windows

You can see that running the program yields no change.  The QVector 
documentation for the [] operator states that:


T  QVector::operator[] ( int /i/ )
Returns the item at index position /i/ as a modifiable reference.
/i/ must be a valid index position in the vector (i.e., 0 = /i/  size 
cid:part1.06020005.08010804@prosensus.ca()).
See also at cid:part2.01070405.06030700@prosensus.ca() and value 
cid:part3.08090504.08050301@prosensus.ca().


So I think it should still work.  I can verify that the above this works 
code works for PyQt4.4.2, Qt 4.4.0, SIP 4.7.7, Python 2.5.2 in Linux.


Is there a work-around available for the near future?

Thanks
Darryl




--
__
Darryl Wallace: Project Leader
ProSensus Inc.
McMaster Innovation Park
175 Longwood Road South
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] Dialogue box with hyperlink

2009-01-27 Thread Darryl Wallace

Hello,
Has anyone somewhere an example code of a small dialogue box which 
contains a hyperlink to a web site?


I would like to point the user to some web site, in the confirmation 
dialogue I want to show.


Quick way is to use a QLabel with qt /qt tags in the string and then 
using the standard html for creating a hyperlink:


For example:

dialogLabel = QtGui.QLabel(qt Please visit a href = 
http://www.google.ca Google/ato search./qt)


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


Re: [PyQt] Resizing a DockWidget?

2009-01-21 Thread Darryl Wallace

Hello,

Marc Nations wrote:

Hi,
 
I'm trying to resize a DockWidget after the application has started. I 
have tried all of the functions that I thought would resize it:
 
self.ui.dockWidget.setGeometry(x,y,w,h)

self.ui.dockWidget.resize(w,h)
 
I tried with QSize and QGeometry as well. I also tried using the 
adjustSize() and a couple of others to see if it changed. I tried to 
call show() after to see if it would help, but nothing seems to work.
 
It flickers momentarily at the new size and pops back, so it looks 
like it's being properly resizes and then something resets it back to 
the original size. Is this the correct way to resize the dock widget, 
and what is causing it to immediately change again?
Perhaps this is a silly question, but is it floating or is it docked?  
If it's docked then it's going to take the shape of the space in which 
it is docked.  If it is docked, I am wondering why you're trying to 
change it's shape.


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


Re: [PyQt] Resizing a DockWidget?

2009-01-21 Thread Darryl Wallace
Try this: 


http://www.qtsoftware.com/developer/faqs/550

Darryl


Marc Nations wrote:
I'm trying to resize it while it is docked. The reason I'm trying to 
resize it is because I want to adjust the default width of the form 
based on how many other windows are currently open in the main 
application and how big the monitor is. As a result, I won't know it's 
geometry until after the application starts. The dock widget is hidden 
until the user decides to open it. At the point it needs to know it's 
size.
So when you say it's going to take the shape of the space it's docked 
in, I had assumed that using the resize() function would propagate 
upwards and instruct the containing frame to redraw. Is that not the case?
 
As far as going the other direction and resizing the containing frame, 
which would then force a resize on the dock widget, I'm not sure how 
to reference the containing frame since the parent object is the main 
window.
 

 
On Wed, Jan 21, 2009 at 8:16 AM, Darryl Wallace 
darryl.wall...@prosensus.ca mailto:darryl.wall...@prosensus.ca wrote:


Hello,


Marc Nations wrote:

Hi,
 I'm trying to resize a DockWidget after the application has
started. I have tried all of the functions that I thought
would resize it:
 self.ui.dockWidget.setGeometry(x,y,w,h)
self.ui.dockWidget.resize(w,h)
 I tried with QSize and QGeometry as well. I also tried using
the adjustSize() and a couple of others to see if it changed.
I tried to call show() after to see if it would help, but
nothing seems to work.
 It flickers momentarily at the new size and pops back, so it
looks like it's being properly resizes and then something
resets it back to the original size. Is this the correct way
to resize the dock widget, and what is causing it to
immediately change again?

Perhaps this is a silly question, but is it floating or is it
docked?  If it's docked then it's going to take the shape of the
space in which it is docked.  If it is docked, I am wondering why
you're trying to change it's shape.

Darryl



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


Re: [PyQt] QMessagebox in slot terminates application

2009-01-12 Thread Darryl Wallace


Marc Nations wrote:

Why are you calling the exec_() function from inside the sys.exit() call?

From the way it's programmed, it looks like sys.exit() will execute 
and hold until it gets a result back from the MessageBox called inside 
the tray icon. At that point it's going to exit using the result as 
it's argument. 

If you just select 'OK' then the MessageBox returns a 0, which will 
then cause a normal termination the program (exit code 0).
Actually, if you click OK, message box returns 1024.  Which is the value 
of the enum of StandardButton.  So you're seeing normal termination, but 
if the Ok button were the result, then the exit code would be 1024.  It 
will return the error code based on what the application returns, not 
the messagebox.


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


Re: [PyQt] QMessagebox in slot terminates application

2009-01-12 Thread Darryl Wallace

Hello,

Although now I'm a little confused as to why the app is even returning 
a value when the MessageBox is closed. Even if you take sys.exit() out 
and just print out the value the app returns, it will still exit. 
Basically the whole app acts like a DialogBox that gets triggered by 
the MessageBox.
You need to start a QApplication because it starts the eventloop for the 
GUI application to run in.  See the documentation for 
QApplication::exec.  The program exits with code 0 because the 
application exited normally.


I'm not sure I fully understand what all the exec() function does.
I tested this out in the systray example that comes with PyQt.  I 
connected the maximize action to a method I made called showMessage 
which then just starts a msg box.  If the Systray object  is visible on 
the screen (via restore) then the QMessageBox does not kill the 
program.  If the Systray object is hidden it does not kill the program.


The QMessageBox inherits QDialog which has the function exec(): Shows 
the dialog as a modal dialog, blocking until the user closes it.  

Though, my guess is that when exec() is called via the QMessageBox, it 
is stealing the event loop from the Systray (or something along those 
lines), since its parent (the Systray) is not visible.  So when the 
messagebox closes it is the end of the application.  Furthermore, the 
closeEvent for the Systray object is not called when the QMessageBox is 
called.  This indicates, to me, that the QMessageBox is the end.


I'm not sure if this is an accurate explanation.  But that is what I 
think is happening.  Perhaps Phil or a person more experienced with the 
inner workings can provide a better explanation.


A work-around would be to create a QMessageBox manually (i.e. not one of 
those static public members) fill it with what you want and call .show() 
depending on the state of the Systray widget (i.e. if 
systray.isVisible() call exec_()  else, call .show()).


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


Re: [PyQt] QMessagebox in slot terminates application

2009-01-12 Thread Darryl Wallace

Tim,

This is the more accurate explanation I was looking for!

darryl
Tim Hoffmann wrote:

Marc Nations schrieb:
Yeah, that's more correct. Since the MessageBox is being called 
indirectly the actual value it returns isn't being utilized.


Although now I'm a little confused as to why the app is even 
returning a value when the MessageBox is closed. Even if you take 
sys.exit() out and just print out the value the app returns, it will 
still exit. Basically the whole app acts like a DialogBox that gets 
triggered by the MessageBox.


I'm not sure I fully understand what all the exec() function does.

int QApplication.exec_() :
Enters the main event loop and waits until exit() is called, then 
returns the value that was set to exit()


QMessageBox.information() should call the inherited QDialog.exec_() 
which installs a local event loop, because the dialog is modal.



I found out what's happening:
Closing the QMessageBox is something like QDialog.done(). This emitts 
a QApplication.lastWindowClosed() signal if the dialog is the last 
window. Because of the default app.quitOnLastWindowClosed == True 
exit() will be called for the main loop and the application terminates 
regularly.


So by adding app.setQuitOnLastWindowClosed(False) the application does 
not terminate any more.


Tim


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


Re: [PyQt] Problem with apps build with Py2exe

2009-01-09 Thread Darryl Wallace

Hello,

Well, shouldn't py2exe include all required libraries? I'm having the same 
problem here, I'll investigate some more this weekend, but if the problem is 
some missing libraries there should be a way of including them in the dist 
  
Not necessarily.  For example, it will not automatically include the 
QtSvg4 library because (in my installation anyways) this is considered a 
system library.  You can force this by overriding py2exe's isSystemDll 
and creating a list of dll's you want to include automatically in your 
setup.py script.  I use the following code below.When py2exe is 
checking which dll's should be included, it first asks if they are 
system dll's; if so, they will not be included (since a system dll 
should be on the system by default?).


My guess is that it needs to be forced to include msvcp90.dll or 
something.  If it is a dll like the MS VC Runtime DLL then that needs to 
be included along side your exe (not packaged within it or it's 
library).  I would say in your setup.py script to manually copy it to 
your dist folder.


Darryl
--

Example (originally from 
http://eli.thegreenplace.net/2008/10/09/packaging-dlls-with-executable-made-by-py2exe/):

-

# Override the function in py2exe to determine if a dll should be included.
dllList = ('yourLibraryName.dll')

origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
   if os.path.basename(pathname).lower() in dllList:
   return 0
   return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL

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


Re: [PyQt] Re: QComboBox items width

2008-12-16 Thread Darryl Wallace

Hello,

Reinaldo de Carvalho wrote:

QComboBox items width are limited by QComboBox maximun size width and some text 
of
items is not visible. Is possible set a different  (large) width for
QComboBox items?


My guess would be to use the initStyleOption method.  And you would need 
create a subclass of a style option?


Both the Plastique and Cleanlooks styles do what you're asking.  The 
windows style is a little more stubborn, I suppose.


This also annoys me as I have a list of options in a combobox that get 
cut off in the windows style.


darryl


Someone can help me?

Example:

Now:

-
|  QComboBox|- clicked
-
|  QComboBoxItem1  |
-
|  QComboBoxItem2  |
-

I Want:

-
|  QComboBox|- clicked

|  QComboBoxItem1|

|  QComboBoxItem2|



  

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


Re: [PyQt] QThread problem

2008-12-08 Thread Darryl Wallace

Hello,

Sergio Jovani wrote

class Download(QThread):
def __init__(self, url, path, filename, parent = None):
QThread.__init__(self, parent)
self.path=path
self.url=url
self.filename=filename

def run(self):
os.chdir(self.path)

urllib.urlretrieve(self.url,self.filename,reporthook=self.myreporthook)
  


I don't know if this would be the problem, because it looks like you 
have trimmed the code to only contain relevant parts.  I have a couple 
questions.  If you don't terminate, does it properly retrieve the item 
at the url? 

Your code here for the Download class has no definition of 
self.myreporthook so could that be the problem?


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


Re: [PyQt] QcheckBox

2008-10-10 Thread Darryl Wallace

Hello,

The checkbox has the ability to be tri-state (unchecked | partially 
checked | checked).  So using setCheckState() will require a 
Qt.CheckState enum, since this is how you set it's tri-state value.  
What you want to use is


setChecked(True) or setChecked(False)

That should work.  If you want to ensure that it cannot have a tristate 
mode use setTristate(False).


It's all in the docs: 
http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qcheckbox.html


Darryl

Min Li wrote:


Hi, everyone.

Sorry to bother your guys.

I'm a Novice in PyQt. Currently, I want to set the 'clicked' status as 
the default  status for QcheckBox. 


I have tried some ways, such as setCheckState().

However, they're not working. I think I use it in a wrong way.

Could you pleasae give me some advices for that?

Regards

Lee



___
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] Using PyQt within an application

2008-08-14 Thread Darryl Wallace

I'm assuming you're using a QDialog.

A)If it's a standard dialog (with OK/Cancel) then I usually use the 
accept()/reject() slots on the dialog.  These close the dialog and 
return the status of the dialog upon exit (accepted or rejected).


B) I would guess that you don't want the dialog to be modal.  this way 
you can still interact with the application that called it.  Use the 
method on the dialog, setModal(False) to turn off modality. 


darryl

andYpsilon wrote:

Hi! I am starting a PyQt dialog from inside an application (The Compositing
package Nuke from The Foundry) to use the application specific python
module.

The problem is, as soon as I am in the main event loop, Nuke crashes when
doing something outside of the dialog. This would be somehow OK, if the
quit() or the exit() function wouldn't quit the whole application instead of
only closing the dialog window.

Does anyone know how to: A) -Quit a dialog without quitting the application
from which the dialog was startetd??

or B) How to run the main event loop that the application from whioch the
dialog was started can still be used??





thx,
a desperate andy


  

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


Re: [PyQt] Collapsible Dock Widget??

2008-07-23 Thread Darryl Wallace
Yeah just like that.  Except I would also want to put a toggle button on 
the title bar of the widget so that toggle between auto-hide and staying 
open.


Any tips on how to get started with that auto-hide functionality?

Thanks,
Darryl

Giovanni Bajo wrote:

On Tue, 2008-07-22 at 10:20 -0400, Darryl Wallace wrote:
  
Has anyone tried to make the dock widgets collapsible (similar to the 
windows based dock widgets in that have the little thumbtack icon) in Qt 
or PyQt?



I'm not sure what you mean. I made the dock widget auto-hide and
reappear when you go to the edge of the window. Is this what you are
speaking of?
  

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


[PyQt] Collapsible Dock Widget??

2008-07-22 Thread Darryl Wallace
Has anyone tried to make the dock widgets collapsible (similar to the 
windows based dock widgets in that have the little thumbtack icon) in Qt 
or PyQt?


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


[PyQt] QSplashScreen and windows

2008-06-18 Thread Darryl Wallace
Has anyone had trouble getting splash screen to display properly in 
Windows?  I imagine this is a Qt problem and not a PyQt problem but I 
thought I would ask here as well as Qt support.


I have written a code like this:
##
from PyQt4 import QtGui, Qt

import sys
import os
from time import sleep
import resources

progname = MainWindow

if __name__ == __main__:
   qApp = QtGui.QApplication(sys.argv)
 
  
   splash=QtGui.QSplashScreen(QtGui.QPixmap(

   :+resources/main_logo.png),
   Qt.Qt.WindowStaysOnTopHint)
   splash.showMessage(Loading %s...%progname)
   splash.show()
  
   splash.raise_()

   
    Import the main application window
   
   from mainwindow import MainWindow
   splash.raise_()
   aw = MainWindow(progname)
   splash.raise_()
   aw.show()
   splash.raise_()
   aw.raise_()
   splash.raise_()
   splash.raise_()
   splash.raise_()
   splash.raise_()
   splash.raise_()
   splash.raise_()
   sleep(1)  # add a little sleep.  if the mainwindow 
loads super quickly,
   # splash screen quits on aw and you 
barely see it

   splash.finish(aw)
   aw.raise_()
   sys.exit(qApp.exec_())

##

as you can see, some frustration has led to repeatedly trying to raise 
the splash screen to the highest level on the screen.


This code works fine under linux (even without all of the 
splash.raise_() calls).


Using PyQt4.4.2, Qt 4.4.0, Ubuntu 8.04, and any kind of Windows = Win2k pro

Any one else have this problem?

Thanks,
Darryl

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


Re: [PyQt] QSplashScreen and windows

2008-06-18 Thread Darryl Wallace


I fixed it. 


If anyone else gets this and doesn't know.

add the line

qApp.processEvents()

after splash.show()

darryl

Darryl Wallace wrote:
Has anyone had trouble getting splash screen to display properly in 
Windows?  I imagine this is a Qt problem and not a PyQt problem but I 
thought I would ask here as well as Qt support.


I have written a code like this:
##
from PyQt4 import QtGui, Qt

import sys
import os
from time import sleep
import resources

progname = MainWindow

if __name__ == __main__:
   qApp = QtGui.QApplication(sys.argv)
 
 splash=QtGui.QSplashScreen(QtGui.QPixmap(

   :+resources/main_logo.png),
   Qt.Qt.WindowStaysOnTopHint)
   splash.showMessage(Loading %s...%progname)
   splash.show()
 splash.raise_()
   
    Import the main application window
   
   from mainwindow import MainWindow
   splash.raise_()
   aw = MainWindow(progname)
   splash.raise_()
   aw.show()
   splash.raise_()
   aw.raise_()
   splash.raise_()
   splash.raise_()
   splash.raise_()
   splash.raise_()
   splash.raise_()
   splash.raise_()
   sleep(1)  # add a little sleep.  if the mainwindow 
loads super quickly,
   # splash screen quits on aw and you 
barely see it

   splash.finish(aw)
   aw.raise_()
   sys.exit(qApp.exec_())

##

as you can see, some frustration has led to repeatedly trying to raise 
the splash screen to the highest level on the screen.


This code works fine under linux (even without all of the 
splash.raise_() calls).


Using PyQt4.4.2, Qt 4.4.0, Ubuntu 8.04, and any kind of Windows = 
Win2k pro


Any one else have this problem?

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


[PyQt] ImportError on QtGui. PyQt4.4 commercial

2008-05-21 Thread Darryl Wallace

Hello,

I've just installed:

Qt4.4,
SIP 4.7.5
PyQt 4.4

On Ubuntu 8.04.

Everything installed fine.  But now upon attempting to import QtGui I 
get the following error:


from PyQt4 import QtGui
Traceback (most recent call last):
 File stdin, line 1, in module
ImportError: /usr/lib/python2.5/site-packages/PyQt4/QtGui.so: undefined 
symbol: sipNm_QtGui_QLCDNumber


Any ideas?

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


[PyQt] Re: ImportError on QtGui. PyQt4.4 commercial

2008-05-21 Thread Darryl Wallace

Phil Thompson wrote:

On Wednesday 21 May 2008 13:42:08 Darryl Wallace wrote:
  

Hello,

I've just installed:

Qt4.4,
SIP 4.7.5
PyQt 4.4

On Ubuntu 8.04.

Everything installed fine.  But now upon attempting to import QtGui I
get the following error:

from PyQt4 import QtGui
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: /usr/lib/python2.5/site-packages/PyQt4/QtGui.so: undefined
symbol: sipNm_QtGui_QLCDNumber

Any ideas?

Thanks,
Darryl



No.

Did you have Ubuntu's PyQt4 installed? Did you overwrite it?

Phil
  
I previously had installed PyQt -x11-4.3.3 GPL, which I had just 
overwritten.  All other modules are imported fine.


I am going to manually clean out the folder and try to install the 
latest commercial release of 4.4.2.  I will let you know if I have more 
troubles.


Darryl

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


Re: [PyQt] Problem linking PyQt 4.3.3 on OS X 10.4]

2008-04-10 Thread Darryl Wallace

Hello Dylan,

I had a similar error with QtOpenGL.so when compiling PyQt4 on the OSX.
This occured while running 'make' and I had to go into the folder 
/QtOpenGL and edit the MakeFile.


I had to find the line that started with LFLAG and add -flat_namespace 
-undefined suppress   at the end (without the quotes).


Perhaps this will work when the error is on QtCore.so.  I don't remember 
the cause of this problem, however.


The tip was found on this blog giving a brief tutorial on building Qt4 
and PyQt on Mac OSX:

http://phanatic.hu/archives/2007/11/building-qt-4-and-pyqt-on-mac-os-x-leopard/

There is a comment near the bottom by someone named Dexter who gives 
the above solution.


Did you install Qt4 from the .dmg package?

Darryl


Dylan Trotter wrote:
I'm getting undefined symbols when I try to compile PyQt on OS X. The 
error

message is identical to the one mentioned in this thread:

http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg11309.html

I've tried PyQt 4.3.3 with Qt 4.3.4 and 4.3.3 with no success. Has anyone
encountered this and found a solution?

Thanks,

-dt


  __
Ask a question on any topic and get answers from real people. Go to 
Yahoo! Answers and share what you know at http://ca.answers.yahoo.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] PyQt4 with cx_Freeze

2008-02-20 Thread Darryl Wallace

Armando,

I had built the FreezePython as you say file and running it gives me the 
same result.  ?  I'm not sure what else I might need to include.


darryl

V. Armando Sole wrote:

Hello

At 16:04 19/02/2008 -0500, Darryl Wallace wrote:

Hello,

I'm trying to use cx_Freeze (my latest try has been with version 3) 
to try to freeze a PyQt program into a binary for distribution.  I 
tried just compiling the Multiple Document Interface (mdi.py) example 
that comes with PyQt4 as a test.  I was wondering if you could help 
me out.

I run:

python FreezePython.py --install-dir dist --include-modules sip mdi.py/



Did you read the README that comes with cx_freeze?

As far as I know, if you build cx_freeze yourself you have to run:

python MakeFrozenBases.py
python --no-copy-deps FreezePython.py

in order to have it fully installed. You do not use the .py file but 
the generated frozen.


Then the command:

FreezePython -O --install-dir=dist --include-modules=sip mdi.py

should do what you expect (you may need to add your QtCore4 .so and 
QtGui4.so libraries to the dist directory if they are not copied there).


Armando

___
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] PyQt4 with cx_Freeze

2008-02-20 Thread Darryl Wallace

Armando,

I did a gdb on my executable and it appears as though the 
PyQt4.QtCore.so file is causing the problem.  I am wondering if it is 
due to the fact that I am running this on an AMD64 bit machine. 

Just curious to see if my directory contents match yours, here is a list 
of files in my 'dist' folder:

---
array.so  itertools.so  mdi  PyQt4.QtCore.so  PyQt4.QtGui.so  sip.so  
strop.so

---

I don't know if I'm missing a library or what is going on.

Thanks for your help.
darryl



V. Armando Sole wrote:

Hello,

At 08:34 20/02/2008 -0500, you wrote:

Armando,

I had built the FreezePython as you say file and running it gives me 
the same result.  ?  I'm not sure what else I might need to include.


Strange. Sorry but I cannot reproduce your error. All I can tell is 
that I have everything (Python, Qt, PyQt, ...) compiled to use shared 
libraries. My cx_freeze version is 3.0.3.


Armando



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


[PyQt] PyQt4 with cx_Freeze

2008-02-19 Thread Darryl Wallace

Hello,

I'm trying to use cx_Freeze (my latest try has been with version 3) to 
try to freeze a PyQt program into a binary for distribution.  I tried 
just compiling the Multiple Document Interface (mdi.py) example that 
comes with PyQt4 as a test.  I was wondering if you could help me out.  
I run:


python FreezePython.py --install-dir dist --include-modules sip mdi.py/

/it runs through saying
Missing modules:
? Carbon.File imported from macpath
? _emx_link imported from os
? ce imported from os
? mac imported from os
? nt imported from ntpath, os
? org.python.core imported from copy
? os.path imported from os
? os2 imported from os
? riscos imported from os
? riscosenviron imported from os
? riscospath imported from os
Copying /usr/lib/python2.5/site-packages/sip.so
Copying /usr/lib/python2.5/lib-dynload/itertools.so
Copying /usr/lib/python2.5/lib-dynload/strop.so
Copying /usr/lib/python2.5/site-packages/PyQt4/QtCore.so
Copying /usr/lib/python2.5/lib-dynload/array.so
Copying /usr/lib/python2.5/site-packages/PyQt4/QtGui.so
Frozen binary dist/mdi created.
Done.

So It has created my frozen binary.  But when I go to run this file at 
the command prompt (./mdi), get an error that just says Segmentation 
Fault (core dumped)


Any ideas?

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