Re: [PyQt] Importing Css file

2011-11-30 Thread Scott Ballard
Give this a try, It works for me in my application. I'm able to embed the
css file into the resources file.

css = QtCore.QFile(':/my_stylesheet.css')
css.open(QtCore.QIODevice.ReadOnly)
if css.isOpen():
self.setStyleSheet(QtCore.QVariant(qss.readAll()).toString())
css.close()

Cheers,
-Scott


On Wed, Nov 30, 2011 at 11:14 AM, uahmed  wrote:

> Hi
>
> Now i am getting this error on following code
>
> *Error : Could not parse stylesheet of widget 0x9743b58*
>
> Code :
>
>
> #!/usr/bin/python
> import os ,sys
> from PyQt4.QtCore import *
> from PyQt4.QtGui import *
> file_path = QString("./css_file.css")
> app =QApplication(sys.argv)
> label = QLabel("message")
> label.setStyleSheet(file_path)
> label.show()
> app.exec_()
>
> Css File
>
> QLabel#label {
>  color: red;
>  padding: 3px;
>  }
> #label {
>  color: red;
>  padding: 3px;
>  }
> label {
>  color: red;
>  padding: 3px;
>  }
> .label {
>  color: red;
>  padding: 3px;
> }
>
> Can anyone please help me in it :(
>
>
>
> On Tue, Nov 29, 2011 at 8:11 PM, uahmed  wrote:
>
>> Hi ,
>>
>> I want to include a css file to pyqt application , i wrote the following
>> code , but it is not effecting the properties of label
>>
>> my python code is this
>>
>> #!/usr/bin/python
>> import os ,sys
>> from PyQt4.QtCore import *
>> from PyQt4.QtGui import *
>> file_path = QString("css_file.qss")
>> app =QApplication(sys.argv)
>> label =QLabel("message")
>> label.setStyleSheet(file_path)
>> label.show()
>> app.exec_()
>>
>> and "css_file.qss" containing this text
>>
>> .QLabel {
>> font-weight: bold;
>> font-size: 15px;
>> color : green;
>> }
>>
>>
>
> ___
> 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] Zooming the contents of a Qt application

2011-09-22 Thread Scott Ballard
In Qt Designer there is an option in the preferences to zoom in/out the
application when its launched (tested).

Does anyone know if this is calling Qt core functionality or is it just a
trick that Designer is doing?

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

Re: [PyQt] bug: QProcessEnvironment insert failing

2010-12-10 Thread Scott Ballard
Thanks for the reply Wolfgang!

I guess the verbiage is a little misleading then. Insert implies to add to
whats existing. Perhaps QT needs to add a replace method as well. :)

Easy enough to work around though.

Cheers,
-Scott



On Fri, Dec 10, 2010 at 1:12 AM, Wolfgang Rohdewald
wrote:

> On Freitag 10 Dezember 2010, Scott Ballard wrote:
> > The insert method of QProcessEnvironment overwrites the
> > environment variable instead of inserting into it.
>
> according to the manual, this is correct.
>
> Inserts the environment variable of name name and contents value
> into this QProcessEnvironment object. If that variable already
> existed, it is replaced by the new value.
>
> --
> Wolfgang
>
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] bug: QProcessEnvironment insert failing

2010-12-09 Thread Scott Ballard
I ran across the following bug tonight:

The insert method of QProcessEnvironment overwrites the environment variable
instead of inserting into it.

=== Example ===
from PyQt4 import QtCore

env = QtCore.QProcessEnvironment.systemEnvironment()
print env.value('PATH')
>>C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;

env.insert('PATH', 'some_path')
print env.value('PATH')
>>some_path

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

Re: [PyQt] ImportError: DLL load failed: The specified procedure could not be found.

2010-08-14 Thread Scott Ballard
 This truly is a problem that I've seen on several random machines. I 
can't seem to make head or tails with it but I know others have 
encountered it too. I've also seen things work just fine and then one 
day fail, only to have to copy the DLLs into the 
Python26\Lib\site-packages\PyQt4 directory. In all cases it seems that 
the PATH is set correctly. When I find some time I'd like to track it 
down what the issue is.


-Scott


On 8/14/2010 12:00 AM, Phil Thompson wrote:

On Fri, 13 Aug 2010 22:46:13 +0300, "Ville M. Vainio"
wrote:

Lately at Leo project ( http://www.youtube.com/watch?v=Zu6J-J0qFi0 ),
we have many people complaining about pyqt ImportError in Windows.
It's solved by copying around the dll's or doing this:

http://stackoverflow.com/questions/2738879/cannot-import-pyqt4-qtgui

(not being on windows, can't verify right now)

Is this some kind of recent regression with pyqt windows installer?

Not to my knowledge. The installer will set the PATH.

Phil
___
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] Deleting QRunnables in QThreadPool

2010-07-21 Thread Scott Ballard
Just wondering if anyone knows how to delete QRunnables that have been
added to a QThreadPool.

example: I've added 5000+ QRunnable objects to a QThreadPool and I now
want to cancel all of them.

The only was seems to be to stop the entire script which kind of defeats
the purpose.

Any thought would be appreciated.
Thanks!
-Scott

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


[PyQt] QDomElement set text?

2010-07-19 Thread Scott Ballard
If I have an XML element such as "hello" I can retrieve
its text ("hello") using the method .text(), but how do I set it?

Or do I somehow have to use a QTextNode to set the QDomElement?

Any thoughts?

Thanks,
-Scott

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


[PyQt] PyQt compiled for Snow Leopard 10.6.3

2010-05-20 Thread Scott Ballard

Howdy,

Does anyone have a compiled version of PyQt for Snow Leopard 10.6.3 that 
they wouldn't mind sharing?


I'd really appreciate it and would save me a lot of time and headache! :)

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


[PyQt] This implementation does not support subelements! (ID 2 unknown for QMenuBar)

2010-05-16 Thread Scott Ballard
I created a simple QMainWindow with Designer, added two QMenu's and I 
get the following error on the command line:


QAccessibleWidget::rect: This implementation does not support 
subelements! (ID 2 unknown for QMenuBar)


This is a known bug?


--- code ---


from PyQt4 import QtCore, QtGui

class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.pushButton = QtGui.QPushButton(self.centralwidget)
self.pushButton.setObjectName("pushButton")
self.verticalLayout.addWidget(self.pushButton)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
self.menubar.setObjectName("menubar")
self.menuFile = QtGui.QMenu(self.menubar)
self.menuFile.setObjectName("menuFile")
self.menuLogging = QtGui.QMenu(self.menubar)
self.menuLogging.setObjectName("menuLogging")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuLogging.menuAction())

self.retranslateUi(MainWindow)
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", 
"PushButton", None, QtGui.QApplication.UnicodeUTF8))

self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", 
"File", None, QtGui.QApplication.UnicodeUTF8))

self.menuLogging.setTitle(QtGui.QApplication.translate("MainWindow", 
"Logging", None, QtGui.QApplication.UnicodeUTF8))



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_())

--
Cheers,
-Scott

Scott Ballard
CG Supervisor / Pipeline TD
http://www.linkedin.com/in/scottballard

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


[PyQt] DPX image format

2010-05-11 Thread Scott Ballard
Anyone know if QT supports the DPX image format or how hard it would be to
implement support for it?

Thanks,
-Scott

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


[PyQt] Playing Quicktimes on Windows using Phonon

2010-04-23 Thread Scott Ballard
Howdy,

I'm wondering if anyone has gotten Quicktimes to play on Windows using
Phonon?

I'm able to play Quicktimes in Windows Media Player using a Quicktime WMP
Filter made by Riverpast (riverpast.com) but they don't play in
Phonon.VideoPlayer. Do I need to add MIME support for it?

Any tips would be helpful!

Cheers,
-Scott

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


[PyQt] QGroupbox CSS inner border color?

2010-04-22 Thread Scott Ballard
Does anyone know the CSS code to change the inner border color of the
QGroupbox?

border-color only changes the outer color but not the inner border color.

Thanks,
-Scott

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


Re: [PyQt] Updated Windows Installers for Python v2.6 and v3.1

2010-04-20 Thread Scott Ballard

Works like a charm now Phil!! Thanks!


On 4/20/2010 5:00 AM, Phil Thompson wrote:

I've uploaded new Windows installers for Python v2.6 and v3.1.

These are built against Python v2.6.4 (rather than v2.6.5) and v3.1.1
(rather than v3.1.2).

Hopefully this will fix the problems with the original installers which
seems to be caused by a binary incompatibility in the latest versions of
Python.

Phil
___
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] DLL Problem with PyQt-Py3.1-gpl-4.7.3-1.exe

2010-04-19 Thread Scott Ballard




Phil,

I investigated the DLL problem and found the following. Still not sure
what is causing it though. I tested 2 different PyQt installers under
Windows 7 64-bit, uninstalling each before testing the other. I made a
clean PATH env var to just PyQt and Python.

-- PyQt-Py2.6-gpl-4.7-1.exe  - Works fine

From a command prompt:
C:\Users\scott>set
path=C:\Python26\Lib\site-packages\PyQt4\bin;C:\Python26
C:\Users\scott>python
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtCore
>>>

-- PyQt-Py2.6-gpl-4.7.3-1.exe - Errors out

From a command prompt:
C:\Users\scott>set
PATH=C:\Python26\Lib\site-packages\PyQt4\bin;C:\Python26
C:\Users\scott>python
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtCore
Traceback (most recent call last):
  File "", line 1, in 
ImportError: DLL load failed: The specified procedure could not be
found.
>>>



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

Re: [PyQt] DLL Problem with PyQt-Py3.1-gpl-4.7.3-1.exe

2010-04-19 Thread Scott Ballard
Phil, do you mind posting the PATH env var from your test machine? I'm
curious to see how it matches up to mine. I installed with Admin
privileges.

-Scott


> On Mon, 19 Apr 2010 09:00:54 -0700, Scott Ballard 
> wrote:
>> I noticed this issue when I've installed the 4.7.x releases under Python
>> 2.6. When compared to the 4.6.x releases, the directory structure has
>> changed and all of the DLLs have been moved to a subdirectory instead of
>> the root. There was a thread that described copying the QtCore and QtGui
>> DLLs to the root directory, but when I tried it this weekend on the
> newest
>> release it failed with the same error message.
>>
>> Phil, do you have any thoughts on this?
>
> No - it works fine for me and I test each installer on a clean system.
>
> I don't test a non-admin install.
>
> Phil
>


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


Re: [PyQt] DLL Problem with PyQt-Py3.1-gpl-4.7.3-1.exe

2010-04-19 Thread Scott Ballard
I noticed this issue when I've installed the 4.7.x releases under Python 2.6. 
When compared to the 4.6.x releases, the directory structure has changed and 
all of the DLLs have been moved to a subdirectory instead of the root. There 
was a thread that described copying the QtCore and QtGui DLLs to the root 
directory, but when I tried it this weekend on the newest release it failed 
with the same error message.

Phil, do you have any thoughts on this?

Michael Collins  wrote:

>Hey,
>
>So I just upgraded my pyqt this weekend to 4.7.3-1 under Python 3.1.
>It seems as though there is an issue loading the QtCore,QtGui,etc
>DLL's post-install. I did uninstall the old version and the problem
>persisted.
>
>The Python exception thrown is:
>DLL Load Failed: The specified procedure could not be found.
>
>I've upgraded these packages before without issue, so my feeling is
>that something is different with this release.
>
>Thanks!
>
>Michael
>___
>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: packaging PyQt app

2010-03-02 Thread Scott Ballard




You need to include sip:

http://www.py2exe.org/index.cgi/Py2exeAndPyQt

from distutils.core import setup
import py2exe
setup(windows=[{"script":"main.py"}], options={"py2exe":{"includes":["sip"]}})
-Scott

On 3/2/2010 8:51 AM, Anshul Jain wrote:
I have made a very simple browser using Qwebview in PyQt.
Now i want to package it as an installer to distribute it. I have tried
out py2exe. But after i do the command:
  
  
  python setup.py py2exe
  
  
  and then try and run the .exe file created, i get an error, "no
module named sip found". please help me where am i going wrong. My
setup.py code is as follows:
  
  
  
  from distutils.core import setup
  
  
  setup(name = "Aura Browser",
        version = "0.1",
        description = "A tiny Web Browser",
        author = "Anshul kumar Jain",
        author_email = "ans...@seeta.in",
        url = ""true"
 href="http://seeta.in/j/team.html">http://seeta.in/j/team.html",
        packages = [""],
        data_files = [("browser/images", ["images/back.png",
                                          "images/home.png",
                                          "images/reload.png",
                                          "images/next.png",
                                          "images/stop.png",])]
        )
  
  
  the code has 'browser.py' as main file and a Qt python class
file 'httpWidget.py'
  
  
  Please help me sort out the problem.
  
  
  Thanks
  
  

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


__ Information from ESET NOD32 Antivirus, version of virus signature database 4909 (20100302) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

  



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

Re: [PyQt] MemoryError: can I use more?

2010-02-15 Thread Scott Ballard




I should have mentioned that I
believe you need to run Python and PyQt compiled for 64 bit to use the
extra memory. Maybe a wiser computer user can chime in on this one!??
It sounds like the 32bit emulation is running into the same memory
limitation on the 64bit machine as the 32 bit machine. This might be a little tough since I
believe you need to compile PyQt 64bit yourself. I don't think
there are any pre-compiled 64bit installers for Windows. 

In computer graphics our apps need to be compile specifically for 64bit
to use the extra memory. Let us know when you solve this as I'm sure it
effects a lot of people.

Cheers,
-Scott

Scott Ballard
CG Supervisor / Pipeline TD
http://www.linkedin.com/in/scottballard 

On 2/14/2010 4:22 PM, Echavarria Gregory, Maria Angelica wrote:

  Scott,

Thanks for the tip of the 0.5GB more... I'm googling it! that might be all I need...

Just to let you know that one of the machines I tested my app in is 64 bit and happened the same. The RAM consumed by the OS and other processes is already included in the 2.2 I'm telling... my app enters to work when the RAM is already consumed in ~600 MB in the 3- 32 bit machines ... in the 64 bit machine was exactly the same only that it started a little bit higher because it has windows 7... Do you know if this is normal? should I believe I have a memory bug in my application?

Thank you again,
Angelica.

M. Angelica Echavarria-Gregory, M.Sc., E.I.
Ph.D Candidate
University of Miami
Phone 305 284-3611

From: sc...@scottballard.net [sc...@scottballard.net]
Sent: Friday, February 12, 2010 7:29 PM
To: Echavarria Gregory, Maria Angelica
Cc: pyqt@riverbankcomputing.com
Subject: Re: [PyQt] MemoryError: can I use more?

Unfortunately, Windows 32bit only allows roughly 2.5 gbs of memory in
total regardless of the amount of memory on the system. This is a limit of
all 32bit OSs. You could try putting the /3GB switch in your c:\boot.ini
file (google it for specifics) which should give you another .5gbs of ram.

You might need to switch to a 64bit machine. Sorry...
-Scott


  
  
Dear group:

I am developing a PyQt application using PyQt 4.3 and Python 2.5.4 in
windows 32 OS. The amount of data it works with is huge. I have managed to
keep memory footprint low, but have found that, independent of the
physical RAM of the machine, python always gives the MemoryError message
when it has occupied exactly only 2.2 GB. I have tested this in 4
different machines, all with memory of 3 to 4 GB... I'm amazed.

Could any of you please help me figure out how to change that limit? I
typed help(MemoryError) and it is a class itself, but that help told me
nothing I can use...

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


  
  __ Information from ESET NOD32 Antivirus, version of virus signature database 4866 (20100214) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




  



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

Re: [PyQt] PyQt 4.7 and py2exe error

2010-02-09 Thread Scott Ballard
Does that work for the .ui files as well? I haven't been able to get 
py2exe to compile successfully if it includes a .ui. Instead I've had to 
convert the .ui file using pyuic4 to a python file and import it from there.


Any tips or tutorials for using .ui files with py2exe or pyInstaller?
Thanks!

On 2/9/2010 7:22 AM, Giovanni Bajo wrote:

Il giorno lun, 08/02/2010 alle 18.30 -0800, Scott Ballard ha scritto:
   

Wow, that worked like a charm! I'd love to get Phil's input on this one.
The package looks like a dummy package but I dont know.
 

py2exe thinks that you need port_v3 (which is Python 3.0 code, so
invalid for Python 2.x programs), because the code optionally imports
it.

Note that PyInstaller takes automatically care of this and other PyQt
packaging issues (eg: plugins).

   

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


Re: [PyQt] PyQt 4.7 and py2exe error

2010-02-08 Thread Scott Ballard
Wow, that worked like a charm! I'd love to get Phil's input on this one. 
The package looks like a dummy package but I dont know.


Thanks for the tip!
-Scott

On 2/8/2010 6:15 PM, INADA Naoki wrote:

I've removed 'port_v3' directory.
I don't know this is a best solution or not.

On Tue, Feb 9, 2010 at 4:25 AM, Scott Ballard  wrote:
   

I'm trying to create an executable on Windows using Py 2.6.2, PyQt 4.7 and
py2exe 0.6.9 and am getting the following error:

C:\Python26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning:
the sets module is deprecated
  import sets
running py2exe
*** searching for required modules ***
error: compiling
'C:\Python26\lib\site-packages\PyQt4\uic\port_v3\proxy_base.py' failed
SyntaxError: invalid syntax (proxy_base.py, line 4)

-- command
python setup.py py2exe

--setup.py
from distutils.core import setup
import py2exe
setup(windows=[{"script" : "shotValidator.pyw"}], options={"py2exe" :
{"includes" : ["sip", ]}})


Any thoughts?

Thanks,
-Scott
___
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] PyQt 4.7 and py2exe error

2010-02-08 Thread Scott Ballard
I'm trying to create an executable on Windows using Py 2.6.2, PyQt 4.7 
and py2exe 0.6.9 and am getting the following error:


C:\Python26\lib\site-packages\py2exe\build_exe.py:16: 
DeprecationWarning: the sets module is deprecated

  import sets
running py2exe
*** searching for required modules ***
error: compiling 
'C:\Python26\lib\site-packages\PyQt4\uic\port_v3\proxy_base.py' failed

SyntaxError: invalid syntax (proxy_base.py, line 4)

-- command
python setup.py py2exe

--setup.py
from distutils.core import setup
import py2exe
setup(windows=[{"script" : "shotValidator.pyw"}], options={"py2exe" : 
{"includes" : ["sip", ]}})



Any thoughts?

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


Re: [PyQt] Downloading PyQt for Python 2.6

2010-01-20 Thread Scott Ballard




Not sure why Phil hasn't chimed in
by now, he usually does.

Anyway, I throw PyQt-Py2.6-gpl-4.5.4.exe up on my FTP if anyone wants
it. I believe that was the latest version for Python2.6

www.scottballard.net/PyQt-Py2.6-gpl-4.5.4.exe

Cheers,
-Scott

Chris Bergstresser wrote:

  On Wed, Jan 20, 2010 at 5:57 PM, Demetrius Cassidy
 wrote:
  
  
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

  
  
   I have never compiled anything from source in my life.  I don't
have a compiler installed on this machine, nor do I really feel like
finding, installing, and debugging one just to install this package.
   The download page at
http://riverbankcomputing.com/software/pyqt/download has links for
Python 2.5-compatible PyQt 4.4.3, but that's all.

-- 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] pyqt, py2exe and ui files

2009-11-24 Thread Scott Ballard




Thanks for the response Albert!

For some wierd reason I can see the parse module in Eclipse, but for
some reason, py2exe still complains that PyQt4.elementtree.ElementTree
is missing and the executable throws an exception 'ImportError: cannot
import name parse'.

I checked the environment and I'm using the same python2.5 install for
Eclipse and command line py2exe.

Any thoughts?
-Scott


Albert Cervera i Areny wrote:

  A Dimecres, 25 de novembre de 2009, Scott Ballard va escriure:
  
  
I have a Python/PyQt script that is loading a .ui file. If I use py2exe
to turn it into an executable I get errors about missing modules like
PyQt4.elementtree.ElementTree. If I convert the .ui files using pyuic4
and embed them into the Python script then py2exe works just fine.

Has anyone figured out how to use .ui files with py2exe?

  
  
Sure. Simply adding:

from xml.etree.ElementTree import parse, SubElement

in your main application .py file should do.

  
  
Any helpful tips or tutorials would be appreciated.

Many thanks!
-Scott


___
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] pyqt, py2exe and ui files

2009-11-24 Thread Scott Ballard
I have a Python/PyQt script that is loading a .ui file. If I use py2exe 
to turn it into an executable I get errors about missing modules like 
PyQt4.elementtree.ElementTree. If I convert the .ui files using pyuic4 
and embed them into the Python script then py2exe works just fine.


Has anyone figured out how to use .ui files with py2exe?

Any helpful tips or tutorials would be appreciated.

Many thanks!
-Scott


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


Re: [PyQt] QtSQL cant connect using MySQL driver

2009-09-08 Thread Scott Ballard




Ok, I got this working (sort of). I
put the libmySQL.dll in the Python26\Lib\site-packages\PyQt4 and the
QMYSQL and QMSYSQL3 drivers are now listed from QSqlDatabase.drivers()

For some strange reason, I can connect to the database (without crash)
from Windows 7 64-bit and a local wamp install. But on a Windows XP SP3
32-bit machine accessing Wamp across the network it makes the
connection to the database and then promptly crashes with an
Application Error - the instruction at "0x01ae364" referenced memory at
"0x1533f40". The memory could not be read.

If I figure out the crash I will post the results.

-Scott

Phil Thompson wrote:

  On Tue, 08 Sep 2009 08:48:53 -0700, Scott Ballard 
wrote:
  
  
Thanks for the response Phil! Forgive my ignorance but does it assume
the default path to the MySQL client libraries or can that path be set?

  
  I'm
  
  
wondering if I can get this working with Wamp which has a different MySQL
install path Or do the MysSQL libraries need to be install in the Qt
directory?

  
  
Sorry, I don't know. I can only suggest copying the libraries around until
you find something that works.

Phil

__ Information from ESET NOD32 Antivirus, version of virus signature database 4396 (20090904) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




  



__ Information from ESET NOD32 Antivirus, version of virus signature database 4407 (20090908) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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

Re: [PyQt] QtSQL cant connect using MySQL driver

2009-09-08 Thread Scott Ballard




Thanks for the response Phil! Forgive my ignorance but does it assume
the default path to the MySQL client libraries or can that path be set?
I'm
wondering if I can get this working with Wamp which has a different
MySQL install path Or do the MysSQL libraries need to be install in
the Qt directory?

Thanks!

Phil Thompson wrote:

  On Mon, 7 Sep 2009 15:44:54 -0700, Christian Caron 
wrote:
  
  
Phil has control over PyQt. I'm talking about compiling mysql support  
into Trolltech's err I mean Nokia's Qt.

  
  
The PyQt installer includes a copy of Qt built with support for MySQL. It
requires the MySQL client libraries to be installed (unlike the PostgreSQL
support which is linked against static libraries).

Phil

  
  
On Sep 7, 2009, at 3:39 PM, Scott Ballard wrote:



  According to Phil, he added MySQL support to the last build...

  
  

  I'm just wondering why the MySQL drivers can't be compiled into  
  

  
  the PyQt Windows binary installer, instead we have to compile our  
own Qt/PyQt with the >>MySQL and/or PostGres drivers.
 >They are in the current installers (for Python v2.6 and v3.1). I'm  
not
  
  
updating the installer for Python v2.5.

  
  
Phil

  
  

Christian Caron wrote:
  
  
By default, QtSql does't have support for mysql. You have to  
compile it by specifying the right options when ./configuring Qt  
for build.

Christian

On Sep 7, 2009, at 3:29 PM, Scott Ballard wrote:



  Hey list,

Sorry to ask about this again, but I never got it working and was  
pulled off onto something else. Now I have time to look into it  
again.

I can't seem to get the qmysql driver to work with the QtSQL  
module in PyQt 4.5.4 and Python 2.6.2 on Windows XP SP2.

What exactly is required to make a connection to a MySql database  
from PyQt? I have Wamp installed, running MySql and am able to  
connect to it using the MySQLdb module.

The qmysql4.dll is in the Python26\Lib\site-packages\PyQt4\plugins 
\sqldrivers.

Here's the important output:
2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit  
(Intel)]
PYQT_VERSION_STR: 4.5.4
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL

Has anyone gotten this working? Are there any 3rd party DLLs that  
need to be installed? Any hints would be welcome!

Cheers,
-Scott
___
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] QtSQL cant connect using MySQL driver

2009-09-07 Thread Scott Ballard




Makes sense now... looks like this
is going to be more involved than I hoped. Thanks for the help!!


Christian Caron wrote:
Phil has control over PyQt. I'm talking about compiling
mysql support into Trolltech's err I mean Nokia's Qt.
  
  
On Sep 7, 2009, at 3:39 PM, Scott Ballard wrote:
  
  
  According to Phil, he added MySQL support to
the last build...


>>I'm just wondering why the MySQL drivers can't be compiled into
the PyQt Windows binary installer, instead we have to compile our own
Qt/PyQt with the >>MySQL and/or PostGres drivers.

 >They are in the current installers (for Python v2.6 and v3.1). I'm
not

>updating the installer for Python v2.5.


>Phil




Christian Caron wrote:

By default, QtSql does't have support for
mysql. You have to compile it by specifying the right options when
./configuring Qt for build.
  
      
Christian
  
  
On Sep 7, 2009, at 3:29 PM, Scott Ballard wrote:
  
  
  Hey list,


Sorry to ask about this again, but I never got it working and was
pulled off onto something else. Now I have time to look into it again.


I can't seem to get the qmysql driver to work with the QtSQL module in
PyQt 4.5.4 and Python 2.6.2 on Windows XP SP2.


What exactly is required to make a connection to a MySql database from
PyQt? I have Wamp installed, running MySql and am able to connect to it
using the MySQLdb module.


The qmysql4.dll is in the
Python26\Lib\site-packages\PyQt4\plugins\sqldrivers.


Here's the important output:

2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)]

PYQT_VERSION_STR: 4.5.4

QSqlDatabase: QMYSQL driver not loaded

QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL


Has anyone gotten this working? Are there any 3rd party DLLs that need
to be installed? Any hints would be welcome!


Cheers,

-Scott

___

PyQt mailing list    PyQt@riverbankcomputing.com

http://www.riverbankcomputing.com/mailman/listinfo/pyqt

  
  
  

  
  
  



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

Re: [PyQt] QtSQL cant connect using MySQL driver

2009-09-07 Thread Scott Ballard

According to Phil, he added MySQL support to the last build...

>>I'm just wondering why the MySQL drivers can't be compiled into the 
PyQt Windows binary installer, instead we have to compile our own 
Qt/PyQt with the >>MySQL and/or PostGres drivers.
  
>They are in the current installers (for Python v2.6 and v3.1). I'm not

>updating the installer for Python v2.5.

>Phil



Christian Caron wrote:
By default, QtSql does't have support for mysql. You have to compile 
it by specifying the right options when ./configuring Qt for build.


Christian

On Sep 7, 2009, at 3:29 PM, Scott Ballard wrote:


Hey list,

Sorry to ask about this again, but I never got it working and was 
pulled off onto something else. Now I have time to look into it again.


I can't seem to get the qmysql driver to work with the QtSQL module 
in PyQt 4.5.4 and Python 2.6.2 on Windows XP SP2.


What exactly is required to make a connection to a MySql database 
from PyQt? I have Wamp installed, running MySql and am able to 
connect to it using the MySQLdb module.


The qmysql4.dll is in the 
Python26\Lib\site-packages\PyQt4\plugins\sqldrivers.


Here's the important output:
2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)]
PYQT_VERSION_STR: 4.5.4
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL

Has anyone gotten this working? Are there any 3rd party DLLs that 
need to be installed? Any hints would be welcome!


Cheers,
-Scott
___
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] QtSQL cant connect using MySQL driver

2009-09-07 Thread Scott Ballard

Hey list,

Sorry to ask about this again, but I never got it working and was pulled 
off onto something else. Now I have time to look into it again.


I can't seem to get the qmysql driver to work with the QtSQL module in 
PyQt 4.5.4 and Python 2.6.2 on Windows XP SP2.


What exactly is required to make a connection to a MySql database from 
PyQt? I have Wamp installed, running MySql and am able to connect to it 
using the MySQLdb module.


The qmysql4.dll is in the 
Python26\Lib\site-packages\PyQt4\plugins\sqldrivers.


Here's the important output:
2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)]
PYQT_VERSION_STR: 4.5.4
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL

Has anyone gotten this working? Are there any 3rd party DLLs that need 
to be installed? Any hints would be welcome!


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


Re: [PyQt] missing MySQL/PostGres drivers

2009-08-18 Thread Scott Ballard
Ok, so under Windows XP 32-bit I've installed Python 2.6.2 and 
PyQt-Py2.6-gpl-4.5.4-1.exe and the QMYSQL driver is not listed in the 
available drivers. I've verified that I'm running 2.6 and not 2.5.


The drivers that are available are:
QSQLITE
QODBC3
QODBC
QPSQL7
QPSQL

The qmysql4.dll is in the 
Python26\Lib\site-packages\PyQt4\plugins\sqldrivers.


Any thoughts Phil? Is there anything special I need to do to load the 
driver?


Phil Thompson wrote:

On Tue, 18 Aug 2009 10:56:44 -0700, Scott Ballard Qt
wrote:
  

Hey Phil and community,

I'm just wondering why the MySQL drivers can't be compiled into the PyQt 
Windows binary installer, instead we have to compile our own Qt/PyQt 
with the MySQL and/or PostGres drivers.


Is it for legal reasons? It's really a bullet in the foot...



They are in the current installers (for Python v2.6 and v3.1). I'm not
updating the installer for Python v2.5.

Phil

__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4346 (20090818) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




  



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4346 (20090818) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


[PyQt] missing MySQL/PostGres drivers

2009-08-18 Thread Scott Ballard

Hey Phil and community,

I'm just wondering why the MySQL drivers can't be compiled into the PyQt 
Windows binary installer, instead we have to compile our own Qt/PyQt 
with the MySQL and/or PostGres drivers.


Is it for legal reasons? It's really a bullet in the foot...

Cheers,
-Scott


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4346 (20090818) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


Re: [PyQt] Collapse/expand frame

2009-08-13 Thread Scott Ballard




Thanks for all the feedback. Are
there any good tutorials for implementing your own custom
widgets/layouts? (if no one has an implementation of this)

Cheers,
-Scott

Alexei Puzikov wrote:

  

  I'm really looking for a frame that has the collapse/expand ability
built into it. See the image in the link. You can see the Texture Map
submenu  collapsed/expanded. Any thoughts?

www.scottballard.net/collapsibleFrame.jpg
  

I see - why don't you BYO. This kind of widget is uncommon, and thus the
reason not being available already.

But it's pretty easy to combine basic widgets to a composite one. And due to
Qts powerful layout machinery, you mostly don't need to care about the
implicit widget resize.

  
  
Actually, you do, as soon as you'll pass over some amount of controls.

I have the editor here that reimplements the screenshot (it's Maya, btw) and
in worst situations contains approx. 4500 controls. And I'm still
unable to remove
flickering on switch - basically, the layout refresh.

If anybody can prototype something that works with big amount of controls - his
help would be enormous. Really.

A.

__ Information from ESET NOD32 Antivirus, version of virus signature database 4333 (20090813) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




  



__ Information from ESET NOD32 Antivirus, version of virus signature database 4333 (20090813) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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

Re: [PyQt] Collapse/expand frame

2009-08-13 Thread Scott Ballard
I'm really looking for a frame that has the collapse/expand ability 
built into it. See the image in the link. You can see the Texture Map 
submenu  collapsed/expanded. Any thoughts?


www.scottballard.net/collapsibleFrame.jpg

Many thanks!
-Scott


Hans-Peter Jansen wrote:

Am Mittwoch, 12. August 2009 schrieb Scott Ballard:
  

Does anyone know of a way to collapse/expand a frame or a group box that
contains widgets in it? I don't see anything in the docs or Google about
it, but it would seem like something common.



Try .hide()/.show() resp. .setVisible(bool)

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

__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4330 (20090812) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




  



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4332 (20090813) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


[PyQt] Collapse/expand frame

2009-08-12 Thread Scott Ballard
Does anyone know of a way to collapse/expand a frame or a group box that 
contains widgets in it? I don't see anything in the docs or Google about 
it, but it would seem like something common.


Cheers,
-Scott


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4330 (20090812) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


[PyQt] .ui files embedded in a resource file

2009-05-15 Thread Scott Ballard
I'm wondering if it's possible to embed a .ui file into a resource file 
and access it like icons or images? I gave it a try and it seemed that 
it put it into the resource file, but I couldn't access it in the 
conventional way. The docs don't make any mention of it.


It would be powerful to be able to wrap up all the UI icons, images and 
.ui files into one resource file.


Thanks,
-Scott


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4080 (20090515) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


Re: [PyQt] riverbankcomputing.co.uk down?

2009-05-10 Thread Scott Ballard

Looks like its back up... nevermind.


Scott Ballard wrote:
Can't seem to get on the website. Anyone know if its down? Can anyone 
else get on it?


-Scott
___
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] riverbankcomputing.co.uk down?

2009-05-10 Thread Scott Ballard
Can't seem to get on the website. Anyone know if its down? Can anyone 
else get on it?


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


Re: [PyQt] node graph widgets?

2009-05-07 Thread Scott Ballard




Do you have any examples or source
code your willing to share? Or any links to examples?

Thanks!
-Scott


Alexei Puzikov wrote:

  Nothing standard, however it's actually pretty easy to implement
either with GraphicsScene or OpenGL surface.

Latter is exactly what I've did.

Alexei

  
  
Does anyone know if Qt (PyQt) offer any widgets for creating a node graph
with connections between the nodes? A quick Google search didn't turn up
much.

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


  
  
  



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

[PyQt] node graph widgets?

2009-05-07 Thread Scott Ballard
Does anyone know if Qt (PyQt) offer any widgets for creating a node 
graph with connections between the nodes? A quick Google search didn't 
turn up much.


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


[PyQt] Parenting a PyQt window to another application

2009-04-23 Thread Scott Ballard

Hi,

I'm trying to find a way to parent a PyQt (QMainWindow) to another 
application. In my case, I have PyQt running in Autodesk Maya and am 
trying to get the PyQt window to parent to Maya's main window (so that 
it raises/restores with Maya's window)


I was able to get the PyQt window to parent to Maya's main window using 
the Python win32gui module (GetActiveWindow(), GetParent() and 
SetParent()). I am able to move the border of the window around the Maya 
interface but the window doesn't redraw correctly and none of the 
menus/buttons work.


Any suggestions are appreciated!
-Scott


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4029 (20090422) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


[PyQt] Eclipse sliding info panels

2009-04-19 Thread Scott Ballard
For those who haven't seen the sliding info panels in the Eclipses IDE 
they are great. They slide out over the main working area and collapse 
out of sight when you click back into the main working area. Makes it 
really convenient to get/edit data.


They differ from splitting a Frame in two with QSplitter in that it 
doesn't change the dimensions of the main pane. They ride over the top 
of the main pane.


I'm wondering if any one knows if this is possible in PyQt?

Cheers,
-Scott


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4020 (20090420) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


Re: [PyQt] QDirModel populating QTreeView in Windows Slow Response

2009-04-19 Thread Scott Ballard




Could be that one of your drives has
gone to sleep. It takes a couple of seconds for the drive to wake up
and give a directory listing. Its not that slow on my machine.

-Scott

akumarzen wrote:

  I populate QTreeView with QDirModel ... While EXECUTING. It takes much time
to generate the TREE Structure... Is it true! QDirModel -> QTreeView takes
much time? Say 5-6 Sec~!
I m  using XP in Intel Penti Dual CPU, 2ghz, 2gb RAM!
  



__ Information from ESET NOD32 Antivirus, version of virus signature database 4019 (20090418) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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

[PyQt] QAbstractItemModel, QTreeView, arbitrary Python object, drag/drop working example

2009-04-15 Thread Scott Ballard

Hi,

After spending too long trying to figure out how to get a 
hierarchy(tree) of arbitrary Python objects, QAbstractItemModel, 
QTreeView working with drag/drop I've finally cracked the nut.


I've come up with a simplified example of it so that others don't have 
to go through the pain I went through. There seems the be a real lack of 
documentation and examples on the subject. The example code doesn't 
include any error checking to keep things simple. The example also 
allows hierarchies of data to be drag/drop instead of individual rows. 
Dropped rows are appended to the end of the parent. I didn't implement 
inserting between rows (but that isn't hard to do).


I really have to thank Phil Thomson who provided me with the code 
(PyMimeData) that allows arbitrary Python objects to be passed as 
QMimeData. Thanks Phil, your a life saver!


Feel free to include this example in the next release of PyQt.

Cheers,
-Scott Ballard
CG Supervisor / Pipeline TD
www.scottballard.net .  http://www.linkedin.com/in/scottballard



- code - code 
- code -

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from copy import deepcopy
from cPickle import dumps, load, loads
from cStringIO import StringIO


class PyMimeData(QMimeData):
   """ The PyMimeData wraps a Python instance as MIME data.
   """
   # The MIME type for instances.
   MIME_TYPE = QString('application/x-ets-qt4-instance')

   def __init__(self, data=None):
   """ Initialise the instance.
   """
   QMimeData.__init__(self)

   # Keep a local reference to be returned if possible.
   self._local_instance = data

   if data is not None:
   # We may not be able to pickle the data.
   try:
   pdata = dumps(data)
   except:
   return

   # This format (as opposed to using a single sequence) allows the
   # type to be extracted without unpickling the data itself.
   self.setData(self.MIME_TYPE, dumps(data.__class__) + pdata)

   @classmethod
   def coerce(cls, md):
   """ Coerce a QMimeData instance to a PyMimeData instance if 
possible.

   """
   # See if the data is already of the right type.  If it is then 
we know

   # we are in the same process.
   if isinstance(md, cls):
   return md

   # See if the data type is supported.
   if not md.hasFormat(cls.MIME_TYPE):
   return None

   nmd = cls()
   nmd.setData(cls.MIME_TYPE, md.data())

   return nmd

   def instance(self):
   """ Return the instance.
   """
   if self._local_instance is not None:
   return self._local_instance

   io = StringIO(str(self.data(self.MIME_TYPE)))

   try:
   # Skip the type.
   load(io)

   # Recreate the instance.
   return load(io)
   except:
   pass

   return None

   def instanceType(self):
   """ Return the type of the instance.
   """
   if self._local_instance is not None:
   return self._local_instance.__class__

   try:
   return loads(str(self.data(self.MIME_TYPE)))
   except:
   pass

   return None


class myNode(object):
   def __init__(self, name, state, description, parent=None):
  
   self.name = QString(name)

   self.state = QString(state)
   self.description = QString(description)
  
   self.parent = parent

   self.children = []
  
   self.setParent(parent)
  
   def setParent(self, parent):

   if parent != None:
   self.parent = parent
   self.parent.appendChild(self)
   else:
   self.parent = None
  
   def appendChild(self, child):

   self.children.append(child)
  
   def childAtRow(self, row):

   return self.children[row]
  
   def rowOfChild(self, child):   
   for i, item in enumerate(self.children):

   if item == child:
   return i
   return -1
  
   def removeChild(self, row):

   value = self.children[row]
   self.children.remove(value)

   return True
  
   def __len__(self):

   return len(self.children)
  


class myModel(QAbstractItemModel):
  
   def __init__(self, parent=None):

   super(myModel, self).__init__(parent)
  
   self.treeView = parent

   self.headers = ['Item','State','Description']

   self.columns = 3
  
   # Create items

   self.root = myNode('root', 'on', 'this is root', None)
  
   itemA = myNode('itemA', 'on', 'this is item A', self.root)

   itemA1 = myNode('itemA1&#x

[PyQt] Drag/Drop, removeRows method not being called

2009-04-08 Thread Scott Ballard

Hi,

Wondering if anyone has a clue about this. I'm using a sub-classed 
QAbstractItemModel with all of the required methods reimplemented for 
drag/drop functionality.


For some reason, if the columnCount method returns a value great than 1 
the removeRows method doesn't get called after the dropMimeData. If 
columnCount method returns 1 then removeRows method is called properly 
after dropMimeData.


I tried tracking this with the debugger in Eclipse/PyDev but the 
mechanism(method) that calls removeRows must be internal to PyQt as I 
don't see it being called.


What am I missing? Any thoughts are greatly appreciated!
-Scott



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 3994 (20090407) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


[PyQt] Model/View, QTreeView, drag/drop and arbitrary objects

2009-03-23 Thread Scott Ballard

Hi,

I'm trying to put together a QTreeView using the Model/View programming 
but using either the Python Object class or QObject class as the data. 
It seems that neither can be passed around as MIME/QDataStream data for 
the drag and drop functionality. This looks the be a limitation of the 
PyQt implementation and not of Qt itself. Would be great if the 
documentation explicitly mentioned that they didn't implement 
Q_DECLARE_METATYPE() functionality under QMetaType instead having dead 
links to the method.


The current implementation seems to only support a small subset of PyQt 
classes (QStringList and a couple others) These are no good for handling 
objects with a lot of custom attributes.


I'm wondering if anyone has successfully done this before and what the 
trick is? Do you have any example code? There was mention of supporting 
arbitrary Python objects and QDataStream in the PyQt roadmap but no 
mention of when it might be completed. I understand that it won't be 
included in PyQT 4.5.


I really hope that I am overlooking something as my application hinges 
around this. The model/view programming seems great for simple stuff but 
falls apart quickly for more high level uses. Someone must have figured 
this out before!?


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


Re: [PyQt] Executing function with argument under a button in pyqt

2009-03-13 Thread Scott Ballard




I came across this link while I was
trying to do the same thing. It explained everything and might help you
with passing arguments.

http://blog.qgis.org/node/102

Cheers,
-Scott



klia wrote:

  

Till Gerken-2 wrote:
  
  
On Fri, Mar 13, 2009 at 2:23 PM, klia  wrote:


  I have this function that is suppose to extract Exif(exchangeable image
formate) from photos and direct the output to an .CSV file (comma
seperated
values)

well the function syntax is like the following:

was...@home:~/Desktop/Project2/GUI$ python myexif.py -q waseem1.JPG >
test.csv

in the program now my photos are listed in ListWidget...
How can i select photo or multiple photos from the listwidget and execute
the above syntax after clicking a button which is already there in order
to
create a CSV file??
  

Just create a new method that you connect to your button's clicked()
signal and include the Exif extraction code there. Since your Exif
extraction already seems to be in Python, you do not have to execute
any external programs.

connect(yourButton, SIGNAL("clicked(bool)"), yourExifMethod)

The signal is documented here:
http://doc.trolltech.com/4.4/qpushbutton.html#details
http://doc.trolltech.com/4.4/qabstractbutton.html#clicked

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



  
  Thank you for replaying,

creating a connect method ain't a problem for me but how to select photo in
the ListWidget and then executing myexif functiion with -q argument?
  



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

[PyQt] QDataStream and arbitrary Python objects

2009-03-13 Thread Scott Ballard




I'm a bit of a PyQt newbie but have
plenty of Python experience.

Does anyone know if arbitrary Python objects will be supported by
QDataStream in PyQt 4.5?

I'm looking for a method of using PyQts model/view programming and its
drag and drop functionality with Python's base object class which
doesn't seem to be supported. Surprisingly, it seems that QDataStream
doesn't even support QObject (unless I'm missing something)

Many thanks!
-Scott





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