[PyKDE] QWidgetFactory support

2003-01-30 Thread Hans-Peter Jansen
Hi Phil,

attached is an implementation of QWidgetFactory based on the PyQt 
snapshot from 25.01. Since it's my first PyQt module, it would be 
nice, if you take a look over it, especially into the sip files.
Any Transfer* magic missing? The win parts of quimod.sip are
definitely wrong, but I don't know better, yet.

At least, QWidgetFactory.create(some.ui) seems to work fine on
linux.

I've kept your copyright, but added myself to it. I hope, this is
fine with you.

Pete
--- build.py.orig	2003-01-26 02:03:04.0 +0100
+++ build.py	2003-01-30 17:58:49.0 +0100
@@ -345,19 +345,20 @@
 TARGET = qttest
 CONFIG = qt @TEST_OPENGL@ console warn_off release @BL_THREAD@
 INCLUDEPATH = . @BL_INCLUDEPATH@
 DEFINES = @BL_DEFINES@
 SOURCES = qttest.cpp
-LIBS += @TEST_SCILIBDIR@
+LIBS += @TEST_SCILIBDIR@ @TEST_QUILIBDIR@
 
 win32:LIBS += @BL_PYLIB@
 )
 
-# Disable OpenGL and QScintilla support by default.
+# Disable OpenGL, QScintilla and Qui support by default.
 global proPatches
 proPatches[TOPENGL] = [re.compile(@TEST_OPENGL@,re.M), ]
 proPatches[TSCILIBDIR] = [re.compile(@TEST_SCILIBDIR@,re.M), ]
+proPatches[TQUILIBDIR] = [re.compile(@TEST_QUILIBDIR@,re.M), ]
 
 # Create a dummy source file to suppress a qmake warning.
 copyToFile(qttest.cpp,)
 
 buildMakefile(qttest.pro)
@@ -978,10 +979,22 @@
 
 # Put things back.
 proPatches[TSCILIBDIR] = [re.compile(@TEST_SCILIBDIR@,re.M), ]
 buildMakefile(qttest.pro)
 
+if qtVersion = 0x03:
+quilib = 
+if sys.platform == win32:
+quilib = qui.lib
+else:
+quilib = -lqui
+proPatches[TQUILIBDIR] = [re.compile(@TEST_QUILIBDIR@,re.M), quilib]
+buildMakefile(qttest.pro)
+tryModule(qui, qwidgetfactory.h, QWidgetFactory())
+# Put things back.
+proPatches[TQUILIBDIR] = [re.compile(@TEST_QUILIBDIR@,re.M), ]
+buildMakefile(qttest.pro)
 
 
 def generateFeatures(featfile):
 Generate the header file describing the Qt features that are enabled if
 it doesn't already exist.  (If it already exists then we are probably cross

// This is the SIP interface definition for the qui module of PyQt.
//
// Copyright (c) 2003
//  Hans-Peter Jansen [EMAIL PROTECTED]
// 	Riverbank Computing Limited [EMAIL PROTECTED]
// 
// This file is part of PyQt.
// 
// This copy of PyQt is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2, or (at your option) any later
// version.
// 
// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
// details.
// 
// You should have received a copy of the GNU General Public License along with
// PyQt; see the file LICENSE.  If not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


%Module qui 0

%Import qtmod.sip

%Include copying.sip


%Include qwidgetfactory.sip


// The project file template.

%Makefile qui.pro
# The project file for the qui module.
#
# Copyright (c) 2003
# 	Riverbank Computing Limited [EMAIL PROTECTED]
# 
# This file is part of PyQt.
# 
# This copy of PyQt is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
# 
# PyQt is supplied in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
# 
# You should have received a copy of the GNU General Public License along with
# PyQt; see the file LICENSE.  If not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


TEMPLATE = lib
TARGET = @BL_TARGET@
DESTDIR = @BL_DESTDIR@
CONFIG += qt warn_off @BL_DEBUG@ @BL_SIP@ @BL_DLL@ @BL_THREAD@
INCLUDEPATH = . ../qt @BL_INCLUDEPATH@
DEFINES = SIP_MAKE_MODULE_DLL @BL_DEFINES@

sip3:unix:LIBS += -L@BL_DESTDIR@ -lqtcmodule -L@BL_SIPMODDIR@ -lsip -lqui
sip3:win32:LIBS += @BL_DESTDIR@\libqtc.lib @BL_SIPMODDIR@\libsip.lib @BL_PYLIB@ @BL_QUILIBDIR@\qui.lib

sip4:unix:LIBS += -lqui
sip4:win32:LIBS += @BL_PYLIB@ @BL_QUILIBDIR@\qui.lib

SOURCES = \
	$B

HEADERS = \
	$H
%End

// This is the SIP interface definition for QWidgetFactory.
//
// Copyright (c) 2003
//  Hans-Peter Jansen [EMAIL PROTECTED]
// 	Riverbank Computing Limited [EMAIL PROTECTED]
// 
// This file is part of PyQt.
// 
// This copy of PyQt is free software; you can redistribute it and/or modify it
// under the terms of the GNU 

Re: [PyKDE] python qtable

2003-01-30 Thread Gordon Tyler
Sandeep C wrote:

I have a QTable in place, how do i dynamically add and delete data to
the table? 

  self.tblTable.setItem(row, column, item)

Where item is an instance of QTableItem or one of its subclasses, 
QComboTableItem and QCheckTableItem.

Or:

  self.tblTable.setText(row, column, string)

Read the docs, it's all there: http://doc.trolltech.com/3.1/qtable.html

 Also how do i set the title of the columns?

self.tblTable.horizontalHeader().setLabel(index, title)

def updateTableView(self,schema):
 header = self.tblTable.horizontalHeader()
 count = header.count()
 for i in range(count):
 header.removeLabel(i)


The line above should be: header.removeLabel(0)

Ciao,
Gordon


___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde



[PyKDE] Qt PyQt under IRIX

2003-01-30 Thread John Marshall
Hi,

I have an application which uses python and PyQt
and am having a nightmare trying to get it working
reliably under IRIX. I have tried many setups:

A) python 2.2.1 + qt-3.0.6 + sip-3.5 + PyQt-3.5
B) python 2.2.2 + qt-3.1.1 + sip-3.5 + PyQt-3.5
C) python 2.2.2 + qt-3.1.1(threads) + sip-3.5 + PyQt-3.5

Also, I have tried using the SGI compilers with and
without optimization and the gnu compilers. But,
there has been no improvement.

My application uses python threads for I/O and
select()/poll() calls with timeouts, and Qt for
the GUI. The interesting thing is that I can
provoke the problem by having:
-
from qt import *

if __name__ == __main__:
app = QApplication(sys.args)

while 1:
... do I/O ...
-

Note that I only call QApplication(); nothing else
from Qt is called. I have tested the I/O of my
application without Qt and it has worked for 30minutes
with transactions going constantly. When it fails (it
sleeps indefinitely), it takes under 8 minutes (varies). I
have tested the IRIX threads under Python generating 4000
of them without a problem.

My application has run for weeks under Linux without a
problem. So, I am wondering if anyone has had any problems
as I have described under IRIX.

If anyone knows, is there any timer/signal stuff going on
that Qt starts up even in QApplication that might be causing
my application to hang?

Thanks,
John

___
PyKDE mailing list[EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde