[PyKDE] Problem finding and showing a record in a QDataBrowser

2005-08-07 Thread Jorge Godoy

Hi.


I have created an interface where I have a QDataBrowser and all of its
editing and navigating controls and one of the displayed controls is in a
QSpinBox.

I have the navigation from current to next and previous records working fine
if I only use the data browser controls.  I also can recover the correct
record if I type in a valid code at the spin box.

For the spin box to work, I'm doing this:


def codAmostra_valueChanged(self, amostra_id):
cursor = self.dbAmostras.sqlCursor()
cursor.select('amostra_id=%s' % amostra_id)
self.dbAmostras.first()
self.dbAmostras.refresh()


(codAmostra is my spinbox, dbAmostras is my QDataBrowser -- just as a
curiosity, "amostra" is the pt_BR for "sample")

I was willing to use "self.dbAmostras.seek()", but it requires that I know
the exact position of the record -- using it I wouldn't need to filter my
data and I think the problem would be solved... -- but I don't know it. 

There can be "holes" in my sequence (otherwise I'd use only the spinbox) and
I'll be having a few million entries (what makes it impossible to go
through each and every record every time I change the value at the spinbox
manually).

I was reading Qt3 docs trying to find out some other mean to recover the
record I need without messing with the filter because if I use the filter,
then I can't paginate through all records anymore.

Any hints on an alternative approach that would allow me to use both
controls?


* Python 2.4
* SIP 4.1.1 (4.1.1-255)
* >>> qt.qVersion()
  '3.3.4'
  >>>


Thanks in advance,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>


___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


Re: [PyKDE] SIP support for __radd__ and friends

2005-08-07 Thread Gerard Vermeulen
On Sun, 7 Aug 2005 16:48:01 +0100
Phil Thompson <[EMAIL PROTECTED]> wrote:

> On Friday 29 July 2005 6:45 am, Gerard Vermeulen wrote:
> > I like to see SIP support (in a class Foo) for slots like:
> > __radd__
> > __rsub__
> > __rmul__
> > __rdiv__
> > __rtruediv__
> > __rfloordiv__
> > __rmod__
> > __rdivmod__
> > __rpow__
> > __rlshift__
> > __rrshift__
> > __rand__
> > __rxor__
> > __ror__
> >
> > so that one can use:
> >
> > any_python_type binary_operator Foo_type
> 
> There was a reason why this wasn't implemented - but I can't remember what it 
> was so I'll look at it again.
> 
> If I do add support I'll probably try and do it transparently, ie. if you 
> define __add__ SIP will automatically generate a corresponding __radd__ so 
> all you'll need to do is to re-build.
> 

A few remarks:

- this feature request goes in a different direction than the last item on
  your SIP TODO list (I do not really understand what you mean).
  I am a little bit worried about the global operators,
  because of possible interference with Numerical Python operators:
>>> from Numeric import *
>>> listA = [0, 1]; listB = [2, 3]
>>> arrayA = array(listA); arrayB = array(listB)
>>> arrayA + arrayB
array([2, 4])
>>> listA + arrayB
array([2, 4])

- let me point out that it is easy to wrap 'friend' operators, so I do not
  really see the need for global operators.  I have working SIP code like:

class SbVec2s
{
...
// friend SbVec2s operator*(const SbVec2s&, int);
SbVec2s __mul__(int /Constrained/);
// friend SbVec2s operator*(const SbVec2s&, double);
SbVec2s __mul__(double);
// FIXME: friend SbVec2s operator*(int, const SbVec2s&);
// FIXME: friend SbVec2s operator*(double, const SbVec2s&);
// friend SbVec2s operator/(const SbVec2s&, int);
// friend SbVec2s operator/(const SbVec2s&, double);
SbVec2s __div__(double);
// friend SbVec2s operator+(const SbVec2s& v1, const SbVec2s&);
SbVec2s __add__(const SbVec2s&);
// friend SbVec2s operator-(const SbVec2s&, const SbVec2s&);
SbVec2s __sub__(const SbVec2s&);
// friend int operator==(const SbVec2s&, const SbVec2s&);
bool __eq__(const SbVec2s&);
// friend int operator!=(const SbVec2s&, const SbVec2s&);
bool __ne__(const SbVec2s&);

}; // class SbVec2s

- sometimes operators do not commute, for instance:
  matrix * vector != vector * matrix
  so there is the risk that the generated code for __rmul__ might be
  wrong.  Also in the SbVec2s example above there is no definition for
  friend SbVec2s operator/(double, const SbVec2s&);
  so one does not always want the __rdiv__. 

Gerard

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


Re: [PyKDE] pyQT tutorial _downloadable_

2005-08-07 Thread Diez B. Roggisch

Rakotomandimby (R12y) Mihamina wrote:

Hi,

I found this as pyQT tutorial:
http://www.opendocspublishing.com/pyqt/

Well... I found no way to download it, I need to have it in an electronic form 
(PDF, HTML,...).


My notebook is not always connected to the Net, and, having a paper book would 
be too much heavy, and eating space... would you know any PDF version of it? 



wget?

Diez

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


[PyKDE] pyQT tutorial _downloadable_

2005-08-07 Thread Rakotomandimby (R12y) Mihamina
Hi,

I found this as pyQT tutorial:
http://www.opendocspublishing.com/pyqt/

Well... I found no way to download it, I need to have it in an electronic form 
(PDF, HTML,...).

My notebook is not always connected to the Net, and, having a paper book would 
be too much heavy, and eating space... would you know any PDF version of it? 

I can buy it, if necessary.

-- 
CPS  - http://www.cps-project.org/ - Un CMS Français à découvrir
  Plone, SPIP, Xoops, Php-Nuke, c'est bien. CPS, c'est mieux. :-)
ASPO - http://www.google.fr/search?q=aspo+infogerance+serveur
  Infogérance de serveurs + Formation à l'administration UNIX

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


Re: [PyKDE] SIP support for __radd__ and friends

2005-08-07 Thread Phil Thompson
On Friday 29 July 2005 6:45 am, Gerard Vermeulen wrote:
> I like to see SIP support (in a class Foo) for slots like:
> __radd__
> __rsub__
> __rmul__
> __rdiv__
> __rtruediv__
> __rfloordiv__
> __rmod__
> __rdivmod__
> __rpow__
> __rlshift__
> __rrshift__
> __rand__
> __rxor__
> __ror__
>
> so that one can use:
>
> any_python_type binary_operator Foo_type

There was a reason why this wasn't implemented - but I can't remember what it 
was so I'll look at it again.

If I do add support I'll probably try and do it transparently, ie. if you 
define __add__ SIP will automatically generate a corresponding __radd__ so 
all you'll need to do is to re-build.

Phil

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


Re: [PyKDE] WStyle_Dialog missing in pyqt

2005-08-07 Thread Phil Thompson
On Monday 01 August 2005 1:16 pm, Marco Wahl wrote:
> WStyle_Dialog is defined in Qt 3.3 (http://doc.trolltech.com/3.3/qt.html)
> but not with the pyqt-bindings:
>
> vr12 /work/mw_te> python
> Python 2.2.2 (#1, Feb  7 2005, 15:23:55)
> [GCC 3.3 20030226 (prerelease) (SuSE Linux)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from qt import *
> >>> print 'WStyle_Dialog' in dir(Qt)
>
> 0
>
> This is obviously a bug.
>
> See also the thread
> http://mats.imk.fraunhofer.de/pipermail/pykde/2003-February/004671.html.

It was obsoleted in Qt 3.x. Use WType_Dialog instead.

Phil

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde