[PyQt] QTreeWidgetItem - how to properly delete so tree.insertTopLevelItem(0, treeWidgetItem) works

2010-04-01 Thread Taylor Carrasco
My question is simple, I want to take the QTreeWidgetItems out of a tree,
and reinsert them in a specific order. So far with custom classes I've been
unable to succeed.
I tried below to build a simple example of my issue but it errors out when I
hit the "ReInsert" button, perhaps due to what I'm doing wrong, perhaps for
another reason I'm overlooking.

Unfortunately I can't figure out what I'm doing wrong on the "ReInserting"
of the items into the tree, but maybe it has to do with my question.





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

class MyItem(QTreeWidgetItem):
def __init__(self, parent, text1=None, text2=None):
QTreeWidgetItem.__init__(self, parent)

self.text1 = text1
self.text2 = text2
self.setText(0, self.text1)
self.setText(1, self.text2)

class MyTree(QTreeWidget):
def __init__(self, parent):
QTreeWidget.__init__(self, parent)
self.itemList = []
self.setColumnCount(3)

for i in range(5):
item = MyItem(self, text1='Initial Item', text2='Item #: ' +
str(i))

# Always inserting at the top of the list
self.insertTopLevelItem(0, item)
self.itemList.append(item)
print 'Item : ', str(item.text(0)) + ' : ' + str(item.text(1)),
' index: ', str(i)

class MyClass(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.resize(600,400)

# Central Widget
self.layoutWidget = QWidget(self)
self.setCentralWidget(self.layoutWidget)

# Button
self.btn = QPushButton(self.layoutWidget)
self.btn.setText('ReInsert')
self.btn.setGeometry(QRect(0,0,60,40))
self.btn.setMinimumSize(QSize(60, 40))
self.btn.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,
QSizePolicy.Fixed))
# Tree
self.tree = MyTree(self.layoutWidget)
# Layout
self.lv_Main = QVBoxLayout(self.layoutWidget)
self.lv_Main.addWidget(self.btn)
self.lv_Main.addWidget(self.tree)
# Connections
self.connect(self.btn, SIGNAL('clicked()'), self.reinsertItems)

def reinsertItems(self):
tempItemList = []

for i in range(self.tree.topLevelItemCount()):
item = self.tree.takeTopLevelItem(i)
tempItemList.append(item)

# Just to print out the order of the list
for item in tempItemList:
print 'tempItemList Item index: ', item.text(1)

print "All items removed, check Tree's Item count: ",
self.tree.topLevelItemCount()

#for i in range(5):
for item in tempItemList:
self.tree.insertTopLevelItem(0, item)
print 'Item : ', str(item.text(0)) + ' : ' + str(item.text(1))


app = QApplication([])
form = MyClass()
form.show()
app.exec_()
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] ANN: New eric4 plugin versions released

2010-04-01 Thread detlev
Hi,

they are interfaces to the tools of the same name.

On Donnerstag, 1. April 2010, NARCISO, Rui wrote:
> Hi
> 
> Where can I get information about what each plugin does ?
> 
> Thanks for a great tool... can't live without it anymore.
> 
> Rui
> 
> 
> 
> -Message d'origine-
> De : pyqt-boun...@riverbankcomputing.com
>  [mailto:pyqt-boun...@riverbankcomputing.com] De la part de detlev Envoyé :
>  jeudi 1 avril 2010 15:59
> À : pyqt@riverbankcomputing.com
> Objet : [PyQt] ANN: New eric4 plugin versions released
> 
> Hi,
> 
> I'd like to inform all of you about the immediate availability of new
>  versions of these plug-ins.
> 
> - PyLint
> - CxFreeze
> 
> They are available via
> http://sourceforge.net/projects/eric-ide/files/eric4-plugins/stable
> or by accessing the plug-in repository via the eric4 IDE.
> 
> Regards,
> Detlev
> 


-- 
Detlev Offenbach
det...@die-offenbachs.de
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] ANN: New eric4 plugin versions released

2010-04-01 Thread NARCISO, Rui
Hi 

Where can I get information about what each plugin does ?

Thanks for a great tool... can't live without it anymore.

Rui



-Message d'origine-
De : pyqt-boun...@riverbankcomputing.com 
[mailto:pyqt-boun...@riverbankcomputing.com] De la part de detlev
Envoyé : jeudi 1 avril 2010 15:59
À : pyqt@riverbankcomputing.com
Objet : [PyQt] ANN: New eric4 plugin versions released

Hi,

I'd like to inform all of you about the immediate availability of new versions 
of these plug-ins.

- PyLint
- CxFreeze

They are available via
http://sourceforge.net/projects/eric-ide/files/eric4-plugins/stable
or by accessing the plug-in repository via the eric4 IDE.

Regards,
Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

This mail has originated outside your organization, either from an external 
partner or the Global Internet.
Keep this in mind if you answer this message.




The information in this e-mail is confidential. The contents may not be 
disclosed or used by anyone other than the addressee. Access to this e-mail by 
anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and 
delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of 
this e-mail as it has been sent over public networks. If you have any concerns 
over the content of this message or its Accuracy or Integrity, please contact 
Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus 
scanning software but you should take whatever measures you deem to be 
appropriate to ensure that this message and any attachments are virus free.

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


[PyQt] ANN: New eric4 plugin versions released

2010-04-01 Thread detlev
Hi,

I'd like to inform all of you about the immediate availability of new versions 
of these plug-ins.

- PyLint
- CxFreeze

They are available via
http://sourceforge.net/projects/eric-ide/files/eric4-plugins/stable
or by accessing the plug-in repository via the eric4 IDE.

Regards,
Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] How to install QScintilla on Snow Leopard ?

2010-04-01 Thread Phil Thompson
On Thu,  1 Apr 2010 14:21:43 +0200 (CEST), 
wrote:
> Hello,
> I would like to build QScintilla on my Mac Book Pro Snow Leopard. What I
> have to do ?
> 
> I'have already build pyqt for Python 3, with Python 2-6 still existing on
> my Mac, using the following commands :
>

>         python3.1 configure.py -d /Library/Python/3.1/site-packages
> -b /usr/local/bin --use-arch i386
>         make -j 2
>         sudo make install
>

> 
> Any clue is welcome...
> 
> Christophe.

How about the installation instructions?

http://www.riverbankcomputing.com/static/Docs/QScintilla2/index.html

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

[PyQt] How to install QScintilla on Snow Leopard ?

2010-04-01 Thread projetmbc
Hello,
I would like to build QScintilla on my Mac Book Pro Snow Leopard. What I have 
to do ?

I'have already build pyqt for Python 3, with Python 2-6 still existing on my 
Mac, using the following commands :

        python3.1 configure.py -d /Library/Python/3.1/site-packages -b 
/usr/local/bin --use-arch i386
        make -j 2
        sudo make install


Any clue is welcome...

Christophe.

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

Re: [PyQt] How do I get the Dock Re-size Signal

2010-04-01 Thread akumarzen


any way... i reimplemented resizeEvent of QWidget... and though that I emit
my signal.
 

TheKumaresan wrote:
> 
> Hi,
> 
> How do i get dock re size signal.
> 
> -kumaresan
> 
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 

-- 
View this message in context: 
http://old.nabble.com/How-do-I-get-the-Dock-Re-size-Signal-tp28106807p28107560.html
Sent from the PyQt mailing list archive at Nabble.com.

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


[PyQt] How do I get the Dock Re-size Signal

2010-04-01 Thread TheKumaresan
Hi,

How do i get dock re size signal.

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

[PyQt] My first PyQt plasmoid crashes

2010-04-01 Thread linuxoidoz
Hello,

I am trying to write my first plasmoid in PyQt but when I try to view it in 
plasmaviewer it crashes with segmentation fault "Executable: plasmoidviewer 
PID: 23063 Signal: 11 (Segmentation fault)", here's the log:

"~/Develop/Python/plasmoids> plasmoidviewer qt-converter.plasmoid
plasmoidviewer(23614)/plasma main: setting FormFactor to "planar"
plasmoidviewer(23614)/plasma main: setting Location to "floating"
plasmoidviewer(23614)/plasma main: setting containment to "null"
plasmoidviewer(23614)/plasma main: setting auth policy
plasmoidviewer(23614)/plasma main: just load applet
plasmoidviewer(23614)/plasma FullView::addApplet: adding applet 
"qt-converter.plasmoid" in "null"
plasmoidviewer(23614)/libplasma Plasma::CoronaPrivate::addContainment: loading 
of containment "null" failed.
plasmoidviewer(23614)/kdecore (KSycoca): Trying to open ksycoca from  
"/var/tmp/kdecache-linuxoid/ksycoca4"
plasmoidviewer(23614)/libplasma Plasma::AppletPrivate::init: Check your 
constructor!  You probably want to be passing in a Service::Ptr  or a 
QVariantList with a valid storageid as arg[0].
plasmoidviewer(23614)/python (plugin) 
KPythonPluginFactory::KPythonPluginFactory: 
KPythonPluginFactory::KPythonPluginFactory()
plasmoidviewer(23614)/python (plugin) KPythonPluginFactory::initialize: 
Initializing Python interpreter.
plasmoidviewer(23614)/python (plugin) KPythonPluginFactory::initialize: 
Succesfully initialized Python interpreter.
plasmoidviewer(23614)/python (plugin) KPythonPluginFactory::create: 
KPythonPluginFactory::create iface:  Plasma::AppletScript
plasmoidviewer(23614)/python (plugin) KPythonPluginFactory::create: keyword to 
be used for finding the plugin code:  
"plasma_scriptengine_python/pyappletscript.py"
plasmoidviewer(23614)/python (plugin) KPythonPluginFactory::create: Path to 
plugin code is:  
"/usr/share/kde4/apps/plasma_scriptengine_python/pyappletscript.py"
plasmoidviewer(23614)/python (plugin) KPythonPluginFactory::create: Returning 
result qobject
plasmoidviewer(23614)/libplasma Plasma::AppletPrivate::setupScriptSupport: 
setting up script support, package is in 
"/home/linuxoid/Develop/Python/plasmoids/qt-converter.plasmoid/" which is a 
"Plasmoid" package , main script is 
"/home/linuxoid/Develop/Python/plasmoids/qt-converter.plasmoid/contents/code/main.py"
plasmoidviewer(23614)/libplasma Plasma::Package::filePath: 
"/home/linuxoid/Develop/Python/plasmoids/qt-converter.plasmoid/contents/locale" 
does not exist
plasmoidviewer(23614)/libplasma Plasma::Package::filePath: 
"/home/linuxoid/Develop/Python/plasmoids/qt-converter.plasmoid/contents/config/main.xml"
 does not exist
plasmoidviewer(23614)/libplasma Plasma::Package::filePath: 
"/home/linuxoid/Develop/Python/plasmoids/qt-converter.plasmoid/contents/ui/config.ui"
 does not exist
KCrash: Application 'plasmoidviewer' crashing...
sock_file=/home/linuxoid/.kde4/socket-linuxoid/kdeinit4__0

[1]+  Stopped plasmoidviewer qt-converter.plasmoid"

Here's my main.py file below. I have a stand alone application and it works 
fine. It must be something to do with plasma. What am I doing wrong? Will 
greatly appreciate your help. Thank you.

# -*- coding: utf-8 -*-

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript
 
class PyQtConverter(plasmascript.Applet):
def __init__(self,parent,args=None):
plasmascript.Applet.__init__(self,parent)
 
def init(self):
self.setHasConfigurationInterface(False)
self.setAspectRatioMode(Plasma.Square)
 
self.theme = Plasma.Svg(self)
self.theme.setImagePath("widgets/background")
self.setBackgroundHints(Plasma.Applet.DefaultBackground)

self.mainWidget = QWidget()
self.scene = QGraphicsScene()
self.mainGraphicsWidget = self.scene.addWidget(self.mainWidget)

self.btnSize = QSize(50, 50)
self.iconSize = QSize(40, 40)

self.iconFind = QIcon(":/myresources/icons/search.svg")
self.iconCheck = QIcon(":/myresources/icons/check.svg")
self.iconAbout = QIcon(":/myresources/icons/about.svg")

sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)

self.btnCheck = QPushButton(self.iconCheck, "", self.mainWidget)
self.btnCheck.setIconSize(self.iconSize)

sizePolicy.setHeightForWidth(self.btnCheck.sizePolicy().hasHeightForWidth())
self.btnCheck.setSizePolicy(sizePolicy)
self.btnCheck.setMinimumSize(self.btnSize)
self.btnFind = QPushButton(self.iconFind, "", self.mainWidget)
self.btnFind.setIconSize(self.iconSize)

sizePolicy.setHeightForWidth(self.btnFind.sizePolicy().hasHeightForWidth())
self.btnFind.setSizePolicy(sizePolicy)
self.btnFind.setMinimumSize(self.btnSize)
self.btnAbout = QPushButton(self.iconAbout, "", 

Re: [PyQt] crash in sip module when a C++ exception is thrown from a class constructor

2010-04-01 Thread Phil Thompson
On Wed, 31 Mar 2010 23:02:49 +0200, Denis Rivière 
wrote:
> Hi,
> Using sip 4.10 or sip 4.10.1, I have crashes when a C++ exception is
thrown
> 
> from a C++ class constructor. It happens either if the exception is
> declared 
> in the sip binding or not.
> I experienced it on a Linux system (Fedora 12).
> 
> A small example:
> 
> # C++ header:
> #ifndef WORD_H
> #define WORD_H
> 
> class Word {
> public:
> char *the_word;
> 
> Word(const char *w);
> virtual ~Word();
> 
> };
> #endif
> #--
> 
> # C++ implementation:
> #include "word.h"
> #include 
> #include 
> #include 
> #include 
> 
> using namespace std;
> 
> Word::Word(const char *w) : the_word( strdup( w ) )
> {
>   if( string( w ) == "exception" )
> throw runtime_error( "exception in constructor" );
> }
> 
> Word::~Word()
> {
>   free( the_word );
> }
> #--
> 
> # sip code:
> %Module word 0
> 
> %Exception std::exception(SIP_Exception) /PyName=StdException/
> {
> %TypeHeaderCode
> #include 
> %End
> %RaiseCode
> const char *detail = sipExceptionRef.what();
> 
> SIP_BLOCK_THREADS
> PyErr_SetString(sipException_StdException, detail);
> SIP_UNBLOCK_THREADS
> %End
> };
> 
> 
> %Exception std::runtime_error(std::exception) /PyName=RuntimeError/
> {
> %TypeHeaderCode
> #include 
> %End
> %RaiseCode
> const char *detail = sipExceptionRef.what();
> std::cout << "throw/raise runtime_error: " << detail << std::endl;
> 
> SIP_BLOCK_THREADS
> PyErr_SetString(sipException_std_runtime_error, detail);
> SIP_UNBLOCK_THREADS
> %End
> };
> 
> class Word {
> 
> %TypeHeaderCode
> #include 
> #include 
> %End
> 
> public:
> Word(const char *) /* throw( std::runtime_error ) */;
> virtual ~Word();
> 
> };
> #--
> 
> # test case:
> import word
> w = word.Word( 'toto' ) # doesn't crash
> x = word.Word( 'exception' ) # crashes
> # --
> 
> If I un-comment the throw() on the constructor in the .sip file, it still

> crashes.
> It did not crash using older versions of sip (4.7.x at least).
> It seems to happen after the sip binding code is executed (after 
> init_Word(...) in the sip-generated source), when back in the sip.so
> module. 

Fixed in Hg.

Thanks for the test case.

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

[PyQt] ANN: New eric 5.0 snapshot released

2010-04-01 Thread detlev
Hi,

I'd like to inform all of you about the immediate availability of a new eric 
5.0 snapshot. It fixes a few bugs and adds these new features.

- added shared editor functions and a simple chat system
- added installation of a .desktop file for Linux systems

It is available via 
http://sourceforge.net/projects/eric-ide/files/eric5/unstable/20100401

Regards
Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Problem in installing PyQt on Mac OS X 10.6.2

2010-04-01 Thread Phil Thompson
On Thu, 1 Apr 2010 15:17:36 +0530, Jebagnana Das 
wrote:
> Hai everybody,
> 
>  when i tried to install PyQt on Mac Os X after installing python
> 3.1, Qt 4.6.2 and SIP 4.10.1 i encounter the following error when i
execute
> $python3 configure.py command.
> 
> Determining the layout of your Qt installation...
> This is the GPL version of PyQt 4.7 (licensed under the GNU General
Public
> License) for Python 3.1 on darwin.
> 
> Type '2' to view the GPL v2 license.
> Type '3' to view the GPL v3 license.
> Type 'yes' to accept the terms of the license.
> Type 'no' to decline the terms of the license.
> 
> Do you accept the terms of the license? yes
> Checking to see if the QtGui module should be built...
> Checking to see if the QtHelp module should be built...
> Checking to see if the QtMultimedia module should be built...
> Checking to see if the QtNetwork module should be built...
> Checking to see if the QtOpenGL module should be built...
> Checking to see if the QtScript module should be built...
> Checking to see if the QtScriptTools module should be built...
> Checking to see if the QtSql module should be built...
> Checking to see if the QtSvg module should be built...
> Checking to see if the QtTest module should be built...
> Checking to see if the QtWebKit module should be built...
> Checking to see if the QtXml module should be built...
> Checking to see if the QtXmlPatterns module should be built...
> Checking to see if the phonon module should be built...
> Checking to see if the QtAssistant module should be built...
> Checking to see if the QtDesigner module should be built...
> Qt v4.6.2 free edition is being used.
> Qt is built as a framework.
> SIP 4.10.1 is being used.
> The Qt header files are in /usr/include.
> The shared Qt libraries are in /Library/Frameworks.
> The Qt binaries are in /Developer/Tools/Qt.
> The Qt mkspecs directory is in /usr/local/Qt4.6.
> These PyQt modules will be built: QtCore.

That's the first problem.

> The PyQt Python package will be installed in
>
/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages.
> PyQt is being built with generated docstrings.
> PyQt is being built with 'protected' redefined as 'public'.
> The Designer plugin will be installed in
> /Developer/Applications/Qt/plugins/designer.
> The PyQt .sip files will be installed in
> /Library/Frameworks/Python.framework/Versions/3.1/share/sip/PyQt4.
> pyuic4, pyrcc4 and pylupdate4 will be installed in
> /Library/Frameworks/Python.framework/Versions/3.1/bin.
> Generating the C++ source for the QtCore module...
> sip: Usage: sip [-h] [-V] [-a file] [-b file] [-c dir] [-d file] [-e]
[-g]
> [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-r] [-s suffix] [-t tag]
> [-w] [-x feature] [-z file] [file]
> Error: Unable to create the C++ code.
> 
> Your help would be much appreciated..
> 
> P.S : I haven't had any problems in installing PyQt 4.7 on Mac OS X
10.5.6
> though i had difficulty in installing python 3.1

What's the output when you run configure.py with the --verbose flag?

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


[PyQt] Problem in installing PyQt on Mac OS X 10.6.2

2010-04-01 Thread Jebagnana Das
Hai everybody,

 when i tried to install PyQt on Mac Os X after installing python
3.1, Qt 4.6.2 and SIP 4.10.1 i encounter the following error when i execute
$python3 configure.py command.

Determining the layout of your Qt installation...
This is the GPL version of PyQt 4.7 (licensed under the GNU General Public
License) for Python 3.1 on darwin.

Type '2' to view the GPL v2 license.
Type '3' to view the GPL v3 license.
Type 'yes' to accept the terms of the license.
Type 'no' to decline the terms of the license.

Do you accept the terms of the license? yes
Checking to see if the QtGui module should be built...
Checking to see if the QtHelp module should be built...
Checking to see if the QtMultimedia module should be built...
Checking to see if the QtNetwork module should be built...
Checking to see if the QtOpenGL module should be built...
Checking to see if the QtScript module should be built...
Checking to see if the QtScriptTools module should be built...
Checking to see if the QtSql module should be built...
Checking to see if the QtSvg module should be built...
Checking to see if the QtTest module should be built...
Checking to see if the QtWebKit module should be built...
Checking to see if the QtXml module should be built...
Checking to see if the QtXmlPatterns module should be built...
Checking to see if the phonon module should be built...
Checking to see if the QtAssistant module should be built...
Checking to see if the QtDesigner module should be built...
Qt v4.6.2 free edition is being used.
Qt is built as a framework.
SIP 4.10.1 is being used.
The Qt header files are in /usr/include.
The shared Qt libraries are in /Library/Frameworks.
The Qt binaries are in /Developer/Tools/Qt.
The Qt mkspecs directory is in /usr/local/Qt4.6.
These PyQt modules will be built: QtCore.
The PyQt Python package will be installed in
/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages.
PyQt is being built with generated docstrings.
PyQt is being built with 'protected' redefined as 'public'.
The Designer plugin will be installed in
/Developer/Applications/Qt/plugins/designer.
The PyQt .sip files will be installed in
/Library/Frameworks/Python.framework/Versions/3.1/share/sip/PyQt4.
pyuic4, pyrcc4 and pylupdate4 will be installed in
/Library/Frameworks/Python.framework/Versions/3.1/bin.
Generating the C++ source for the QtCore module...
sip: Usage: sip [-h] [-V] [-a file] [-b file] [-c dir] [-d file] [-e] [-g]
[-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-r] [-s suffix] [-t tag]
[-w] [-x feature] [-z file] [file]
Error: Unable to create the C++ code.

Your help would be much appreciated..

P.S : I haven't had any problems in installing PyQt 4.7 on Mac OS X 10.5.6
though i had difficulty in installing python 3.1

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