Re: [PyQt] override wheelEvent issue

2013-01-23 Thread Vicent Mas
On Wed, Jan 23, 2013 at 6:41 PM, Vincent Vande Vyvre
 wrote:
> Le 23/01/13 17:12, Vicent Mas a écrit :
>> Hi,
>>
>> I have a subclass of QScrollBar and I'd like to customize how it
>> handles the QEvent.Wheel event. My first idea was to override its
>> wheelEvent() method, but this method gets never called when I wheel
>> the scrollbar. If I override the event() method and filter the wheel
>> events then everything goes fine. I'd like to know why my first
>> approach (to override the wheelEvent() method) fails. The attached
>> script shows the problem.
>>
>>
>> TIA
>>
>> Vicent
>>
>> --
>> Share what you know, learn what you don't.
>>
>>
>> ___
>> PyQt mailing listPyQt@riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> Works with Qt-4.6.2 & PyQt-4.7.2
> don't works with Qt-4.8.1 & PyQt-4.9.1
>
> Both are on Ubuntu.
> --
> Vincent V.V.
> Oqapy <https://launchpad.net/oqapy> . Qarte
> <https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Thanks for the info.

I forgot to mention my versions: Python 2.7.2, Qt 4.7.4, PyQt 4.8.5,
OpenSuSe 12.

So it could be a Qt bug introduced after Qt 4.6.2 or a PyQt bug
introduced after PyQt 4.7.2. Unfortunately (or not) I'm not a C++ guy
and don't know how to check if it is a Qt problem. Could someone
provide some more info, please? If it is a Qt bug I'd like to file an
issue in the Qt bug tracker.

Thanks.


--
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] override wheelEvent issue

2013-01-23 Thread Vicent Mas
Hi,

I have a subclass of QScrollBar and I'd like to customize how it
handles the QEvent.Wheel event. My first idea was to override its
wheelEvent() method, but this method gets never called when I wheel
the scrollbar. If I override the event() method and filter the wheel
events then everything goes fine. I'd like to know why my first
approach (to override the wheelEvent() method) fails. The attached
script shows the problem.


TIA

Vicent

--
Share what you know, learn what you don't.


wheelevent_issue.py
Description: Binary data
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] QComboBox.findItem and tuples

2012-10-11 Thread Vicent Mas
Hi,

as shows the following code, QComboBox.findItem works fine with lists
but no with tuples.

if __name__ == "__main__":
import sip
sip.setapi('QVariant', 2)
from PyQt4 import QtGui
a = QtGui.QApplication([])
cb = QtGui.QComboBox()
cb.addItem("Foo", [3,4])
cb.addItem("Bah", (2, 2))
print cb.findData([3,4])
print cb.findData((2,2))

Is it a bug or just a limitation of the implementation? Or something else?

TIA

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Bug in QAction?

2011-04-09 Thread Vicent Mas
On 2011-04-08 Phil Thompson  said:

> On Thu, 7 Apr 2011 12:12:48 +0200, Vicent Mas  wrote:
> > Hi,
> > 
> > I'm trying PyQt-x11-gpl-snapshot-4.8.4-8641ecc135b3 on a debian testing
> > box
> > with Python2.7 and virtualenv-1.5.1. Running the attached script raises
> > the
> > following error:
> > 
> > (venv2.7)vmas@rachael:/tmp$ Traceback (most recent call last):
> >   File "test_qaction.py", line 9, in 
> >   
> > shortcut=QtGui.QKeySequence.New)
> > 
> > TypeError: keyword arguments are not supported
> > 
> > As far as I know the support of keyword arguments has not been dropped
> 
> so
> 
> > I
> > suppose it is a bug. Am I right or am I missing something?
> 
> Fixed in tonight's SIP snapshot.
> 
> Thanks,
> Phil

Hi,

I've just installed the new SIP snapshot and reinstalled the latest PyQt4 
snapshot so I can confirm that the problem has gone.

Great technical support, as usual.

Thanks a lot,

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Bug in QAction?

2011-04-07 Thread Vicent Mas
2011/4/7 Vicent Mas :
> On 2011-04-07 "Hans-Peter Jansen"  said:
>
>> On Thursday 07 April 2011, 12:12:48 Vicent Mas wrote:
>> > Hi,
>> >
>> > I'm trying PyQt-x11-gpl-snapshot-4.8.4-8641ecc135b3 on a debian
>> > testing box with Python2.7 and virtualenv-1.5.1. Running the attached
>> > script raises the following error:
>> >
>> > (venv2.7)vmas@rachael:/tmp$ Traceback (most recent call last):
>> >   File "test_qaction.py", line 9, in 
>> >
>> >     shortcut=QtGui.QKeySequence.New)
>> >
>> > TypeError: keyword arguments are not supported
>> >
>> > As far as I know the support of keyword arguments has not been
>> > dropped so I suppose it is a bug. Am I right or am I missing
>> > something?
>>
>> Did this worked in earlier versions? I don't use keyword arguments much,
>> but according to the builtin help, QAction simply didn't define any
>>
>> [...]
>>

> Hi,
>
> It works fine with PyQt4.8.3. The only documentation I know regarding this is
>
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/keyword_arguments.html
>
> although it is not specific to QAction.
>
> Vicent
>

Oops! I forgot to mention this one:

http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qt_properties.html

Vicent

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Bug in QAction?

2011-04-07 Thread Vicent Mas
On 2011-04-07 "Hans-Peter Jansen"  said:

> On Thursday 07 April 2011, 12:12:48 Vicent Mas wrote:
> > Hi,
> > 
> > I'm trying PyQt-x11-gpl-snapshot-4.8.4-8641ecc135b3 on a debian
> > testing box with Python2.7 and virtualenv-1.5.1. Running the attached
> > script raises the following error:
> > 
> > (venv2.7)vmas@rachael:/tmp$ Traceback (most recent call last):
> >   File "test_qaction.py", line 9, in 
> >   
> > shortcut=QtGui.QKeySequence.New)
> > 
> > TypeError: keyword arguments are not supported
> > 
> > As far as I know the support of keyword arguments has not been
> > dropped so I suppose it is a bug. Am I right or am I missing
> > something?
> 
> Did this worked in earlier versions? I don't use keyword arguments much,
> but according to the builtin help, QAction simply didn't define any
> 
> (and neither provides the signature a shortcut argument):
> >>> help(QtGui.QAction)
> 
> class QAction(PyQt4.QtCore.QObject)
> 
>  |  QAction(QObject)
>  |  QAction(QString, QObject)
>  |  QAction(QIcon, QString, QObject)
> 
> in contrary to:
> >>> help(QtGui.QWidget)
> 
> class QWidget(PyQt4.QtCore.QObject, QPaintDevice)
> 
>  |  QWidget(QWidget parent=None, Qt.WindowFlags flags=0)
> 
> Pete
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Hi,

It works fine with PyQt4.8.3. The only documentation I know regarding this is

http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/keyword_arguments.html

although it is not specific to QAction.

Vicent

::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Bug in QAction?

2011-04-07 Thread Vicent Mas
Hi,

I'm trying PyQt-x11-gpl-snapshot-4.8.4-8641ecc135b3 on a debian testing box 
with Python2.7 and virtualenv-1.5.1. Running the attached script raises the 
following error:

(venv2.7)vmas@rachael:/tmp$ Traceback (most recent call last):
  File "test_qaction.py", line 9, in 
shortcut=QtGui.QKeySequence.New)
TypeError: keyword arguments are not supported

As far as I know the support of keyword arguments has not been dropped so I 
suppose it is a bug. Am I right or am I missing something?


Vicent
::

Share what you know, learn what you don't

# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtGui

if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
action = QtGui.QAction(
'Sample action', None, 
shortcut=QtGui.QKeySequence.New)
app.exec_()



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread Vicent Mas
On 2011-03-22 "Hans-Peter Jansen"  said:

> On Tuesday 22 March 2011, 20:50:18 Vicent Mas wrote:
> > 2011/3/22 simozack :
> > > 2011/3/22 Vicent Mas :
> > >> it is explained in my second mail of this thread.  Vincent Van de
> > >> Vyvre asked exactly the same. If it is not clear enough I can
> > >> explain it again. But let me insist, even if my script was purely
> > >> an academic exercise, without practical interest, *if it exposes a
> > >> PyQt4 bug* then the bug has to be reported. My problem is that I'm
> > >> not sure if it is a PyQt4 bug, a Qt4 bug or other thing. Neither I
> > >> see a workaround that I can apply to my real code. Although I
> > >> don't know C++ I've decided to port the script to that language
> > >> and see if the problem persists. In that case I'll report it to
> > >> Nokia. Writing C++ will be painful for me
> > >> 
> > >> :-(, so if someone has more ideas please, tell me.
> > > 
> > > Maybe my poor English does another victim... :)
> > 
> > Or maybe it is just me.
> > 
> > > I don't understand why, inside the updateView method, you
> > > disconnect and then reconnect the signal "selectionChanged". I
> > > think that that signal isn't emitted if the model changed, but only
> > > if the user changes the selection.
> > > 
> > > If you don't do that (disconnecting and reconnecting the signal,
> > > not launching the updateView) do you have a not so good performarce
> > > or what? :)
> > 
> > Let's see it one more time. One thing is the minimal script attached
> > to this thread and other thing is the real code. In the script
> > connecting/disconnecting the signal has the only mission of reproduce
> > the buggy behavior of the real code. The script would work just fine
> > without connecting/disconnecting, that's clear for everybody. The
> > real code is different because there the connect/disconnect trick is
> > meaningful. Please, note that I'm not saying that
> > connecting/disconnecting is the only solution to my problem. As I've
> > already said I'm looking for alternatives or workarounds.
> 
> Vicent, have you tried signal blocking/unblocking? Connecting/
> disconnecting signals does a lot of churn behind the scenes..
> 
> Pete

Hi,

first of all, thanks to Pavel and Pete.

Pavel, I didn't realise I've disconnected everything from the signal not only 
the trackSelection slot. It fixes things in the script. I'll check if it do the 
same in the real code.

Pete, yes I was considering blocking/unblocking since a few minutes ago. I've 
never used it so I suppose that is why it has taken to me so long to consider 
this possibility.

Once again thanks to both of you (and to other contributors to this thread, of 
course).

Vicent

::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread Vicent Mas
2011/3/22 simozack :
> 2011/3/22 Vicent Mas :
>
>> it is explained in my second mail of this thread.  Vincent Van de
>> Vyvre asked exactly the same. If it is not clear enough I can explain
>> it again. But let me insist, even if my script was purely an academic
>> exercise, without practical interest, *if it exposes a PyQt4 bug* then
>> the bug has to be reported. My problem is that I'm not sure if it is a
>> PyQt4 bug, a Qt4 bug or other thing. Neither I see a workaround that I
>> can apply to my real code. Although I don't know C++ I've decided to
>> port the script to that language and see if the problem persists. In
>> that case I'll report it to Nokia. Writing C++ will be painful for me
>> :-(, so if someone has more ideas please, tell me.
>
> Maybe my poor English does another victim... :)
>

Or maybe it is just me.

> I don't understand why, inside the updateView method, you disconnect
> and then reconnect the signal "selectionChanged". I think that that
> signal isn't emitted if the model changed, but only if the user
> changes the selection.
>
> If you don't do that (disconnecting and reconnecting the signal, not
> launching the updateView) do you have a not so good performarce or
> what? :)
>

Let's see it one more time. One thing is the minimal script attached
to this thread and other thing is the real code. In the script
connecting/disconnecting the signal has the only mission of reproduce
the buggy behavior of the real code. The script would work just fine
without connecting/disconnecting, that's clear for everybody. The real
code is different because there the connect/disconnect trick is
meaningful. Please, note that I'm not saying that
connecting/disconnecting is the only solution to my problem. As I've
already said I'm looking for alternatives or workarounds. It is just
that I've not yet  found a clean alternative for solving my problem.

On the other hand what is clear for me is that even if the attached
script is absurd, stupid or useless, if I'm suspicious that it
contains a PyQt4 bug I have to report it here. This is exactly what
I've done. If Phil see a bug I hope he will fix it (so my real code
will work as is until I find a better design), if not I simply will
keep looking for a solution to my problem.

I hope things are clearer now (if they are not then I'm in trouble :-)

Vicent

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread Vicent Mas
2011/3/22 simozack :
> *Sorry, I answered with a private e-mail*
>
> 2011/3/17 Vicent Mas :
>
>> can somebody help me with this problem, please? I've spent several
>> days thinking about it but I still don't know if it is a bug (as I
>> believe) or not and I have not a fix, not even a workaround.
>
> Hi Vincent,
>
> It works fine if in the updateView() method you don't disconnect and
> reconnect the selectionChanged signal (try to comment the first and
> the last line of the method).
>
> But I don't understand what you are trying to do with that. Can you
> explain, please? :)
>
> HTH,
> Simone
> ___
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

Hi,

it is explained in my second mail of this thread.  Vincent Van de
Vyvre asked exactly the same. If it is not clear enough I can explain
it again. But let me insist, even if my script was purely an academic
exercise, without practical interest, *if it exposes a PyQt4 bug* then
the bug has to be reported. My problem is that I'm not sure if it is a
PyQt4 bug, a Qt4 bug or other thing. Neither I see a workaround that I
can apply to my real code. Although I don't know C++ I've decided to
port the script to that language and see if the problem persists. In
that case I'll report it to Nokia. Writing C++ will be painful for me
:-(, so if someone has more ideas please, tell me.


Vicent


-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with selected cells in a QTableView

2011-03-17 Thread Vicent Mas
2011/3/11 Vicent Mas :
>>
>> Hi,
>>
>> Your code works fine without the function 'updateView(self, *value):'
>>
>> Is it necessary to use it and why ?
>>
>
> Sure it works fine without that method. But the script is just a
> simplified code that shows a problem present in a larger and more
> complex code in which that method is required.
>
> In the real code I use table models for displaying datasets with
> several thousand millions of rows (the number of rows can be a 64bits
> integer). As I can't load such large datasets in memory at once I've
> to use buffers and table models with dimensions much smaller than
> dimensions of the real dataset. Obviously that means that I have to
> refresh the data of the table model when I move upward and downward
> the dataset. This is why I need an updateView method. Suppose that my
> table model (which has let say 2000 rows) contains the first 2000 rows
> of a dataset with 2 rows and I've selected the cell (100, 0). If I
> move downward and I reache the row 5000 of my dataset the whole data
> and the selection status of the table model have to be refreshed. Now
> the cell (100, 0) of the table model shouldn't be selected. But If I
> go back to the first 2000 rows of the dataset then the cell (100, 0)
> should be selected again.
>
> And anyway, even if the attached script was a crazycode that I have
> written just for pleasure, if it shows a bug then the bug has to be
> reported, right?
>
> Hope thinks are clearer now,
>
> Vicent
>

Hi all,

can somebody help me with this problem, please? I've spent several
days thinking about it but I still don't know if it is a bug (as I
believe) or not and I have not a fix, not even a workaround.

Your help will be appreciate,

TIA

Vicent
-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with selected cells in a QTableView

2011-03-11 Thread Vicent Mas
>
> Hi,
>
> Your code works fine without the function 'updateView(self, *value):'
>
> Is it necessary to use it and why ?
>

Sure it works fine without that method. But the script is just a
simplified code that shows a problem present in a larger and more
complex code in which that method is required.

In the real code I use table models for displaying datasets with
several thousand millions of rows (the number of rows can be a 64bits
integer). As I can't load such large datasets in memory at once I've
to use buffers and table models with dimensions much smaller than
dimensions of the real dataset. Obviously that means that I have to
refresh the data of the table model when I move upward and downward
the dataset. This is why I need an updateView method. Suppose that my
table model (which has let say 2000 rows) contains the first 2000 rows
of a dataset with 2 rows and I've selected the cell (100, 0). If I
move downward and I reache the row 5000 of my dataset the whole data
and the selection status of the table model have to be refreshed. Now
the cell (100, 0) of the table model shouldn't be selected. But If I
go back to the first 2000 rows of the dataset then the cell (100, 0)
should be selected again.

And anyway, even if the attached script was a crazycode that I have
written just for pleasure, if it shows a bug then the bug has to be
reported, right?

Hope thinks are clearer now,

Vicent

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Issue with selected cells in a QTableView

2011-03-11 Thread Vicent Mas
Hi,

the attached script exhibits a strange behaviour which can be reproduced as 
follows:

- run the script and enlarge the table. Keep the vertical scrollbar visible
- select a range of cells with the mouse, for instance top_left=(0,2) and
bottom_right=(2,3).
- now drag the slider downwards until the selection disappears *completely* 
and upwards until it appears again
- now click on any unselected cell (or select a new range of cells). By doing 
it I expected that the complete selection would be cleared and the clicked 
cell would become current and selected. Instead only the previous current cell 
is deselected. The rest of the old selection remains selected and also the new 
clicked cell is selected and current
- repeat the previous step as many times as you want. The behaviour is always 
the same

Is this a bug or am I doing something wrong?

I'm using PyQt4.8.3 and Python 2.7 on a Debian testing box.

TIA,

Vicent

::

Share what you know, learn what you don't

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

import sys
from PyQt4 import QtCore, QtGui

class TableModel(QtCore.QAbstractTableModel):
def __init__(self, parent=None):
super(TableModel, self).__init__(parent)
self.nrows = 30
self.ncols = 4

def rowCount(self, index=QtCore.QModelIndex()):
if not index.isValid():
  return self.nrows
else:
  return 0

def columnCount(self, index=QtCore.QModelIndex()):
if not index.isValid():
  return self.ncols
else:
  return 0

def data(self, index, role=QtCore.Qt.DisplayRole):
if not index.isValid() or not (0 <= index.row() < self.nrows):
return None
cell = index.row() + index.column()
if role == QtCore.Qt.DisplayRole:
return cell
elif role == QtCore.Qt.TextAlignmentRole:
return int(QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
else:
return None


class TableView(QtGui.QTableView):
def __init__(self, parent=None):
super(TableView, self).__init__(parent)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.tmodel = TableModel()
self.setModel(self.tmodel)
self.selection_model = self.selectionModel()
self.setSelectionMode(QtGui.QAbstractItemView.ContiguousSelection)
self.vscrollbar = self.verticalScrollBar()

self.selection_model.selectionChanged.connect(self.trackSelection)
self.vscrollbar.sliderMoved.connect(self.updateView)

def updateView(self, *value):
self.selection_model.selectionChanged.disconnect()
self.selection_model.clearSelection()
top_left = self.tmodel.index(self.top_left[0], self.top_left[1])
bottom_right = self.tmodel.index(self.bottom_right[0], self.bottom_right[1])
selection = QtGui.QItemSelection(top_left, bottom_right)
self.selection_model.select(selection, QtGui.QItemSelectionModel.Select)
self.selection_model.selectionChanged.connect(self.trackSelection)

def trackSelection(self, selected, deselected):
# Get the selection range of the selection model
selection = self.selection_model.selectedIndexes()
cells = [[i.row(), i.column()] for i in selection]
self.top_left = min(cells)
self.bottom_right = max(cells)


if __name__ == '__main__':
  app = QtGui.QApplication(sys.argv)
  view = TableView()
  view.show()
  app.exec_()

signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] 'module' object has no attribute 'StackedWidget'

2011-01-24 Thread Vicent Mas
2011/1/24 lucabe...@libero.it :
> Hello I have install eric on mac, but when i try to generate dialog code i get
> this error :
> 'module' object has no attribute 'StackedWidget'
>
> Any Suggest?
>
>
> Python
> 2.6.1
> Qt
> 4.7.0
> PyQt
> 4.8.2
> sip
> 4.12
> QScintilla
> 2.4.6
> eric4
> 4.4.11 (r3912)
>
>
> Thanks
>
> Luca
> ___
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

Hi,

not completely sure but I think this issue has been answered a couple
of times recently in this list. Just look for StackedWidget in the
subjects.

Vicent

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QMainWindow bug?

2011-01-20 Thread Vicent Mas
2011/1/20 Phil Thompson :
> On Tue, 18 Jan 2011 19:32:57 +0000, Vicent Mas  wrote:
>> Hi,
>>
>> it seems there is a bug in QMainWindow.createPopupMenu. In my system
>> (Windows XP, Python 2.6, PyQt 4.8.2 installed using the Windows
>> installer), when I run the attached script and close the created
>> QMainWindow, an error dialog appears saying that python.exe has found
>> a problem and must be closed.
>>
>> Could someone confirm this behavior? Thanks.
>>
>> Vicent
>
> It will be fixed in tonight's snapshot.
>

Great. Thanks a lot.

> The Qt docs say that ownership of the menu is transfered to the caller.
> However this is misleading as it gives the menu a parent.
>
> The change means that it you want to delete the menu then you will need to
> give it a None parent first.
>

OK, I understand it.

Vicent

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QMainWindow bug?

2011-01-19 Thread Vicent Mas
2011/1/19 Antonio Valentino :
> Hi Vicent,
>
> Il giorno Tue, 18 Jan 2011 19:32:57 +
> Vicent Mas  ha scritto:
>
>> Hi,
>>
>> it seems there is a bug in QMainWindow.createPopupMenu. In my system
>> (Windows XP, Python 2.6, PyQt 4.8.2 installed using the Windows
>> installer), when I run the attached script and close the created
>> QMainWindow, an error dialog appears saying that python.exe has found
>> a problem and must be closed.
>>
>> Could someone confirm this behavior? Thanks.
>
> Segmentation fault on:
>
> GNU/Linux x86_64 2.6.35 (Ubuntu 10.10)
> Python 2.6.6
> PyQt4 4.7.4
> Qt4 4.7.0
>
>
> No problem if I add
>
> del toolbars_submenu
>
> at the very and of the program
> It seems that having around references to objects that are child of the
> mainwin triggers the problem.
>
> ciao
>
> --
> Antonio Valentino
>

Hi,

Antonio, your workaround works here. Thanks a lot. Anyway I think the
current behavior is buggy. Even if I set the WA_DeleteOnClose flag on
the main window (which I expected to delete the main window and its
children when the window is closed) the script crashes if I don't
apply your workaround.

Vicent

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QMainWindow bug?

2011-01-18 Thread Vicent Mas
2011/1/18 Nick Gaens :
> - Win7 64bit
> - Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
> (Intel)] on win32
> - Qt v4.7.0
> - PyQt GPL v4.8.1 for Python v2.6
> Result: no crashes, works like a charm..
>

Hi,

I get the crash also on Windows Vista 32bit (again Python 2.6 and PyQt 4.8.2)

Vicent

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] QMainWindow bug?

2011-01-18 Thread Vicent Mas
Hi,

it seems there is a bug in QMainWindow.createPopupMenu. In my system
(Windows XP, Python 2.6, PyQt 4.8.2 installed using the Windows
installer), when I run the attached script and close the created
QMainWindow, an error dialog appears saying that python.exe has found
a problem and must be closed.

Could someone confirm this behavior? Thanks.

Vicent

-- 
Share what you know, learn what you don't.


mw_bug.py
Description: Binary data
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] : VendorId issue

2011-01-13 Thread Vicent Mas
Hi,

2011/1/12 Ulrich Berning :
> It is definitely a problem of the tables package in combination with MinGW.
> I guess, you are using compiled binary packages.
>

Yes, I am.

> With the following combination of packages, I can reproduce your problem:
>
> python-2.6.6.msi
> numpy-1.5.1-win32-superpack-python2.6.exe
> numexpr-1.4.1.win32-py2.6.exe
> tables-2.2.1.win32-py2.6.exe
> PyQt-Py2.6-x86-gpl-4.8.2-1.exe
>
> ---
>
> The following combination works as expected:
>
> python-2.6.6.msi
> numpy-1.3.0-win32-superpack-python2.6.exe
> tables-2.1.2.win32-py2.6.exe
> PyQt-Py2.6-x86-gpl-4.8.2-1.exe
>
> ---
>
> Try to build the tables package from source.
> If you only need 32 bit executables, you should give the free Microsoft
> Visual C++ 2008 Express Edition a try.
>
> With Visual C++ 2008, it runs without problems (using tables-2.2.1).
>
> Ulli

OK. I'll try your suggestions. Thank you for so much useful
information (and sorry again for the new private mail :( Also thanks
to Armando for his reply.

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] VendorId issue

2011-01-10 Thread Vicent Mas
Hi,

I'm trying to make an executable for the launcher script of my pyqt
application. I'm using the mingw version of sib.py (from the VendorId
package) but I've found some problems when importing modules that I
don't know how to fix. This used to work fine in the past, when my
application only supported python 2.5 and PyQt 4.6 (IIRC). Now I've
moved to python 2.6 and pyqt 4.8.2 and the executable built via sib.py
is unable to import my application modules (although they are
installed in the standard c:/python26/lib/site-packages directory and
I can import them with no problems from a python console). I've just
realized that the VendorID package is rather old so maybe it doesn't
support python2.6 and/or current versions of PyQt. Could someone tell
me if I'm right?

Thanks in advance,

Vicent

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Bug in QFileDialog

2010-12-09 Thread Vicent Mas
On 2010-12-09 Baz Walter  said:

> On 09/12/10 18:01, Vicent Mas wrote:
> > On 2010-12-09 Baz Walter  said:
> >>> but it means that there is still a bug: in the doItWrong function of my
> >>> script the setFileMode call doesn't reset the FileName label to a
> >>> default value. So it seems that I'll end writing my first C++ code
> >>> (using Antonio's code as a guide) and sending a bug report to Nokia.
> >> 
> >> i can't reproduce this.
> >> 
> >> if i comment out the call to setFileMode in the doItWrong function, the
> >> label of the Accept button is set to "accept label"; otherwise it is
> >> reset to "Open".
> >> 
> >> so it looks like everything works as per the qt docs.
> >> 
> >> (this is using: python 2.7.1, qt 4.7.1, sip 4.11.2, pyqt 4.8.1)
> > 
> > No, accordingly to the docs the setFileMode sets two constants: FileName
> > and Accept. What I say is that the FileName constant is not being reset.
> > At least here.
> 
> yes, sorry - i missed that you were now referring to the FileName label.
> 
> however, it appears that this may actually be a documentation bug.
> 
> QFileDialog has an internal property "fileNameLabelExplicitlySat" [sic]
> which is set to true when using setLabelText.
> 
> the setFileMode method checks this property when deciding whether to
> reset the FileName label. there is no corresponding property for any of
> the other labels.

He, he,

use the force, read the source.

Thanks for the info. So if no more news arrive it seems that what should be 
reported to Nokia is a documentation bug (I've lost a great opportunity for 
writing C++ code. That's a pitty ;-)

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Bug in QFileDialog

2010-12-09 Thread Vicent Mas
On 2010-12-09 Baz Walter  said:

> On 09/12/10 06:55, Vicent Mas wrote:
> > On 2010-12-08 "Hans-Peter Jansen"  said:
> >> [...]
> >> 
> >> Vicent, bad luck: check the fileMode paragraph a couple of lines below:
> >> 
> >> http://doc.trolltech.com/latest/qfiledialog.html#FileMode-enum
> >> 
> >> This function will set the labels for the FileName and Accept
> >> DialogLabels. It is possible to set custom text after the call to
> >> setFileMode().
> > 
> > Hi,
> > 
> > but it means that there is still a bug: in the doItWrong function of my
> > script the setFileMode call doesn't reset the FileName label to a
> > default value. So it seems that I'll end writing my first C++ code
> > (using Antonio's code as a guide) and sending a bug report to Nokia.
> 
> i can't reproduce this.
> 
> if i comment out the call to setFileMode in the doItWrong function, the
> label of the Accept button is set to "accept label"; otherwise it is
> reset to "Open".
> 
> so it looks like everything works as per the qt docs.
> 
> (this is using: python 2.7.1, qt 4.7.1, sip 4.11.2, pyqt 4.8.1)

No, accordingly to the docs the setFileMode sets two constants: FileName and 
Accept. What I say is that the FileName constant is not being reset. At least 
here.

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Bug in QFileDialog

2010-12-08 Thread Vicent Mas
On 2010-12-08 "Hans-Peter Jansen"  said:

> [...]
> 
> Vicent, bad luck: check the fileMode paragraph a couple of lines below:
> 
> http://doc.trolltech.com/latest/qfiledialog.html#FileMode-enum
> 
> This function will set the labels for the FileName and Accept
> DialogLabels. It is possible to set custom text after the call to
> setFileMode().
> 

Hi,

but it means that there is still a bug: in the doItWrong function of my script 
the setFileMode call doesn't reset the FileName label to a default value. So 
it seems that I'll end writing my first C++ code (using Antonio's code as a 
guide) and sending a bug report to Nokia.

Thanks to both of you guys,

Vicent

::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Bug in QFileDialog

2010-12-08 Thread Vicent Mas
On 2010-12-08 "Hans-Peter Jansen"  said:

> On Friday 03 December 2010, 11:12:42 Vicent Mas wrote:
> > Hi,
> > 
> > the attached script shows a bug in QFileDialog. If on a given dialog
> > you call setLabelText(QFileDialog.Accept, text) and then you call
> > setFileMode(FileMode) then the label is not set and the default label
> > is used. If you call setFileMode(FileMode) first and then you call
> > setLabelText(QFileDialog.Accept, text) then the label is set.
> > 
> > As you can see in the script the problem only happens with the
> > QFileDialog.Accept constant. Other QFileDialog.DialogLabel constants
> > work fine.
> > 
> > I don't know if it is a Qt bug or a PyQt one. Neither I know if the
> > problem is in the setLabelText method or in th setFileMode one.
> 
> Confirmed with:
> python: 2.6
> sip: 4.12-snapshot-b202f0d04ba6
> qt4: 4.7.1
> pyqt4: snapshot-4.8.2-e73d5045bea5
> 
> This script is simple enough to do a C++ version, as I doubt that this
> is a PyQt issue. Then, you need that version anyway to report this to
> Nokia. ;-)
> 
> Pete
> 

Thanks for your answer Pete.

I've never written in C++. I suppose this is a good time for starting :D

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Bug in QFileDialog

2010-12-08 Thread Vicent Mas
On 2010-12-03 Vicent Mas  said:

> On 2010-12-03 Vicent Mas  said:
> > Hi,
> > 
> > the attached script shows a bug in QFileDialog. If on a given dialog you
> > call setLabelText(QFileDialog.Accept, text) and then you call
> > setFileMode(FileMode) then the label is not set and the default label is
> > used. If you call setFileMode(FileMode) first and then you call
> > setLabelText(QFileDialog.Accept, text) then the label is set.
> > 
> > As you can see in the script the problem only happens with the
> > QFileDialog.Accept constant. Other QFileDialog.DialogLabel constants work
> > fine.
> > 
> > I don't know if it is a Qt bug or a PyQt one. Neither I know if the
> > problem is in the setLabelText method or in th setFileMode one.
> 
> I forgot to mention the versions info:
> 
> Python 2.5.5
> Qt 4.6.3
> PyQt 4.8
> 

Hi,

I sent the above report last Friday but get no answer at all. Please, let me 
know if there is something wrong with it (not clear enough, attached script 
not working...) and I'll try fix the message and send a more appropriate 
version.

TIA

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Bug in QFileDialog

2010-12-03 Thread Vicent Mas
On 2010-12-03 Vicent Mas  said:

> Hi,
> 
> the attached script shows a bug in QFileDialog. If on a given dialog you
> call setLabelText(QFileDialog.Accept, text) and then you call
> setFileMode(FileMode) then the label is not set and the default label is
> used. If you call setFileMode(FileMode) first and then you call
> setLabelText(QFileDialog.Accept, text) then the label is set.
> 
> As you can see in the script the problem only happens with the
> QFileDialog.Accept constant. Other QFileDialog.DialogLabel constants work
> fine.
> 
> I don't know if it is a Qt bug or a PyQt one. Neither I know if the problem
> is in the setLabelText method or in th setFileMode one.
> 

I forgot to mention the versions info:

Python 2.5.5
Qt 4.6.3
PyQt 4.8

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Bug in QFileDialog

2010-12-03 Thread Vicent Mas
Hi,

the attached script shows a bug in QFileDialog. If on a given dialog you call 
setLabelText(QFileDialog.Accept, text) and then you call setFileMode(FileMode) 
then the label is not set and the default label is used. If you call 
setFileMode(FileMode) first and then you call setLabelText(QFileDialog.Accept, 
text) then the label is set.

As you can see in the script the problem only happens with the 
QFileDialog.Accept constant. Other QFileDialog.DialogLabel constants work fine.

I don't know if it is a Qt bug or a PyQt one. Neither I know if the problem is 
in the setLabelText method or in th setFileMode one.

Vicent
::

Share what you know, learn what you don't

#!/usr/bin/env python

import sys
from PyQt4 import QtGui
from PyQt4 import QtCore

def doItRight():
  file_selector = QtGui.QFileDialog(None, 'File selector')
  file_selector.setFileMode(QtGui.QFileDialog.AnyFile)
  file_selector.setLabelText(QtGui.QFileDialog.Accept, 'accept label')
  file_selector.setLabelText(QtGui.QFileDialog.Reject, 'reject label')
  file_selector.setLabelText(QtGui.QFileDialog.LookIn, 'look in label')
  file_selector.setLabelText(QtGui.QFileDialog.FileName, 'filename label')
  file_selector.setLabelText(QtGui.QFileDialog.FileType, 'filetype label')
  file_selector.exec_()
  del file_selector

def doItWrong():
  file_selector = QtGui.QFileDialog(None, 'File selector')
  file_selector.setLabelText(QtGui.QFileDialog.Accept, 'accept label')
  file_selector.setLabelText(QtGui.QFileDialog.Reject, 'reject label')
  file_selector.setLabelText(QtGui.QFileDialog.LookIn, 'look in label')
  file_selector.setLabelText(QtGui.QFileDialog.FileName, 'filename label')
  file_selector.setLabelText(QtGui.QFileDialog.FileType, 'filetype label')
  file_selector.setFileMode(QtGui.QFileDialog.AnyFile)
  file_selector.exec_()
  del file_selector

def main():
  app = QtGui.QApplication(sys.argv)
  doItRight()
  doItWrong()
  app.exec_()

if __name__ == '__main__':
  main()




signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] About dimensions of QAbstractTableModel

2010-11-30 Thread Vicent Mas
On 2010-11-29 Andreas Pakulat  said:

> 
> I don't know Marks book, but I do know that his material is high
> quality. Sure for a simple example to learn the basics returning a
> static number regardless of the parent item passed in is fine. Its
> easier to understand for beginners, but that doesn't mean its correct.
> And once your model gets more complicated or you use it for different
> views you'll eventually run into behavioural weirdness. At that point
> you should verify that your model works sanely (according to what Qt's
> itemviews define as sane, which may not be the same as the definition of
> a human brain ;). Best/easiest way to do that is adding the mentioned
> modeltest to your model and run your app. One of the things that it'll
> instantly assert on is returning non-0 amount of rows for a valid
> parent but no index/data for it.
> 

I completely agree. I insisted in the simple approach because I was focused on 
the Ian's sample code, which seems to fit in the simplest case.

Thanks a lot for your enlightening answer,

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] About dimensions of QAbstractTableModel

2010-11-29 Thread Vicent Mas
On 2010-11-29 Andreas Pakulat  said:

> On 29.11.10 18:48:26, Vicent Mas wrote:
> > 2010/11/28 Andreas Pakulat :
> > > On 27.11.10 21:27:55, Ian wrote:
> > > 
> > > [...]
> > > 
> > >> def rowCount(self, parent = None):
> > >> ''' return No of rows of data. parent is a QModelIndex '''
> > >> return len(self.view)
> > > 
> > > This is wrong, even for table models you have to take care to return
> > > the right number of rows depending on the parent. That means if your
> > > model gets asked for the rowCount with a valid parent, you want to
> > > return 0 (as you don't have childs under any of your rows). So check
> > > for parent.isValid().
> > > 
> > >> def columnCount(self, parent = None):
> > >> ''' return number of columns. parent = QModelIndex()
> > >> 
> > >>id, name, cubref, address, town, contacts
> > >> 
> > >> '''
> > >> return 6
> > > 
> > > Basically the same here as above, though I think this is not quite as
> > > critical.
> > 
> > Hi Andreas,
> > 
> > Are you sure about this? Does it mean that the example given in the
> > page 428 of Summerfield's book "Rapid GUI Programming with Python and Qt"
> > is wrong?
> > Also I find misleading the Qt documentation regarding this subject
> > (right now I can only have a look to the Qt-6 docs). On one side the
> > QAbstractItemModel.rowCount documentation agrees with you (or
> > vice versa :-). But reading the "Model Subclassing Reference" page,
> 
> > section "Read-only access" one can see:
> I'm not sure what you're trying to express with the quote, 
> but as I said
> the Qt api docs are really lacking in-depth information about the exact
> details of the contract that QAbstractItemModel and the View/Delegate
> classes expected to be hold. 

I completely agree.

> One such thing is that rowCount can be used
> to implement hasChildren, which is what is being done in the default
> implementations. In such a case rowCount is called with an invalid index
> to get the toplevel rowcount. Then when the view wants to find out
> wether an index has children its again called with the valid top-level
> index. In such a case a table and list model wants to make sure to
> return 0 as it has no childrens. This detail is actually also mentioned
> in the API docs for QAbstractItemView::rowCount() as tip.
> 

Indeed that's a very interesting info. But for table models I think that 
hasChildren is not meaningful. One can overwrite it without calling rowCount 
and then use safely the approach used in the Summerfield's book that I mention 
in my previous mail. I know that Qt api docs recommend something different, but 
the Summerfield's approach is simpler and it just works.

> Anyway, about the columnCount. That one is AFAIK not as problematic
> because there's no view that actually supports different amounts of
> columns depending on the tree hierarchy. Hence its usually ok to return
> a static number from this function.
> 
> To find out what exactly goes wrong in your case a small runnable
> example is necessary, IIRC your sample code had additional dependencies
> on other software and sample data to provide something useful. You
> should try with some static data first.
> 

I've no sent any sample code (I'm not Ian but Vicent :-). I'm just reading the 
mailing list and trying to improve my understanding of models and views.

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] About dimensions of QAbstractTableModel

2010-11-29 Thread Vicent Mas
Hi,

originally I posted this question the the long thread "Bugs galore in 
QAbstractTableModel" but I'm suspicious the question has just been missed 
because I got no answer and that thread seems now mainly devoted to modtest.py 
So I've decided to resend my question with a new Subject. I hope I'm not being 
too impatient.

2010/11/28 Andreas Pakulat :
> On 27.11.10 21:27:55, Ian wrote:

> [...]
>
>> def rowCount(self, parent = None):
>> ''' return No of rows of data. parent is a QModelIndex '''
>> return len(self.view)
>
> This is wrong, even for table models you have to take care to return the
> right number of rows depending on the parent. That means if your model
> gets asked for the rowCount with a valid parent, you want to return 0
> (as you don't have childs under any of your rows). So check for
> parent.isValid().
>
>> def columnCount(self, parent = None):
>> ''' return number of columns. parent = QModelIndex()
>>id, name, cubref, address, town, contacts
>> '''
>> return 6
>
> Basically the same here as above, though I think this is not quite as
> critical.
>

Hi Andreas,

Are you sure about this? Does it mean that the example given in the
page 428 of Summerfield's book "Rapid GUI Programming with Python and Qt" is 
wrong?
Also I find misleading the Qt documentation regarding this subject
(right now I can only have a look to the Qt-6 docs). On one side the
QAbstractItemModel.rowCount documentation agrees with you (or
vice versa :-). But reading the "Model Subclassing Reference" page,
section "Read-only access" one can see:

"
rowCount()  Provides the number of rows of data exposed by the model.
These four functions must be implemented in all types of model,
including list models (QAbstractListModel subclasses) and table models
(QAbstractTableModel subclasses).

Additionally, the following functions must be implemented in direct
subclasses of QAbstractTableModel and QAbstractItemModel:

columnCount()   Provides the number of columns of data exposed by the
model. List models do not provide this function because it is already
implemented in QAbstractListModel.
"

Sorry if I'm missing something obvious (it wouldn't be the first time
that I've issues with the Qt documentation regarding models and views).

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Bugs galore in QAbstractTableModel???

2010-11-28 Thread Vicent Mas
2010/11/28 Andreas Pakulat :
> On 27.11.10 21:27:55, Ian wrote:

> [...]
>
>>     def rowCount(self, parent = None):
>>         ''' return No of rows of data. parent is a QModelIndex '''
>>         return len(self.view)
>
> This is wrong, even for table models you have to take care to return the
> right number of rows depending on the parent. That means if your model
> gets asked for the rowCount with a valid parent, you want to return 0
> (as you don't have childs under any of your rows). So check for
> parent.isValid().
>
>>     def columnCount(self, parent = None):
>>         ''' return number of columns. parent = QModelIndex()
>>            id, name, cubref, address, town, contacts
>>         '''
>>         return 6
>
> Basically the same here as above, though I think this is not quite as
> critical.
>

Hi Andreas,

Are you sure about this? Does it mean that the example given in the
page 428 of Summerfield's book is wrong?
Also I find misleading the Qt documentation regarding this subject
(right now I can only have a look to the Qt-6 docs). On one side the
QAbstractItemModel.rowCount documentation agrees with you (or
viceversa :-). But reading the Model Subclassing Reference page,
section Read-only access one can see:

"
rowCount()  Provides the number of rows of data exposed by the model.
These four functions must be implemented in all types of model,
including list models (QAbstractListModel subclasses) and table models
(QAbstractTableModel subclasses).

Additionally, the following functions must be implemented in direct
subclasses of QAbstractTableModel and QAbstractItemModel:

columnCount()   Provides the number of columns of data exposed by the
model. List models do not provide this function because it is already
implemented in QAbstractListModel.
"

Sorry if I'm missing something obvious (it wouldn't be the first time
that I've issues with the Qt documentation regarding models and views)

Vicent
-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Garbage collection issue?

2010-11-20 Thread Vicent Mas
On 2010-11-19 Doug Bell  said:

> Hi,
> 
> When exiting my PyQt application, I get the following error message:
> 
>   QObject::startTimer: QTimer can only be used with threads started with
>   QThread
> 
> The strange thing is that my application is single-threaded and doesn't
> contain any QTimers.
> 
> The error seems to be related to garbage collection at application exit.
> It started showing up when I added a reference between two objects that
> were already referenced in the other direction (becoming similar to a
> doubly-linked list).
> 
> I tried to create a small example showing the problem, but I was unable
> to reproduce the issue in a simpler program, even after duplicating much
> of the basic structure.
> 

Hi,

same issue here. I've fixed it by setting the QtCore.Qt.WA_DeleteOnClose 
attribute on the main window of my program.

Hope it helps,

Vicent

::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] headerDataChanged connection: new-style syntax problem

2010-11-13 Thread Vicent Mas
On 2010-11-13 Phil Thompson  said:

> On Sat, 13 Nov 2010 11:08:20 +0100, Vicent Mas  wrote:
> > On 2010-11-13 Phil Thompson  said:
> >> On Sat, 13 Nov 2010 09:57:26 +0100, Vicent Mas 
> 
> wrote:
> >> > Hi,
> >> > 
> >> > I'm upgrading some code and moving signal/slot connections from old
> >> 
> >> style
> >> 
> >> > to
> >> > 
> >> > new style but I'm having problem with this line:
> >> > self.connect(self.tmodel,
> 
> QtCore.SIGNAL("headerDataChanged(int,
> 
> >> > int,
> >> > 
> >> > int)"), self.my_slot)
> >> > 
> >> > where self is an instance of QtGui.QTableView and self.tmodel is an
> >> > instance
> >> > of QtCore.QAbstractTableModel.
> >> > 
> >> > I've tried:
> >> > 
> >> > 1) self.tmodel.headerDataChanged.connect(self.my_slot)
> >> > 2) self.tmodel.headerDataChanged[int, int, int].connect(self.my_slot)
> >> > 
> >> > and other variations with no luck. Could someone tell me how to
> 
> convert
> 
> >> it
> >> 
> >> > to
> >> > the new-style syntax, please? I'm using Qt-4.6.3 and PyQt-4.8.
> >> 
> >> Define "no luck".
> >> 
> >> Phil
> >> 
> > :-) I mean that some times my program aborts, other times I get no
> 
> errors
> 
> > but
> > the slot is never executed. I don't use any debugger, I just put a print
> > 
> > 'something' in the first line of the slot but the string is never
> 
> printed.
> 
> > The
> > old-style version works just fine.
> 
> So you need to create a test that demonstrates the problem.
> 
> Phil

Hi,

finally I caught on the problem. I was considering the connection part but I 
forgot about the emission part. The model was explicitly emitting the 
headerDataChanged signal using the old-style syntax. So when I tried to 
connect the emitted signal to a slot using the new-style syntax I was mixing 
both styles when dealing with that signal. Not a good idea. Emitting the 
signal with the new-style syntax solves the problem.

Sorry for the noise,

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] headerDataChanged connection: new-style syntax problem

2010-11-13 Thread Vicent Mas
On 2010-11-13 Phil Thompson  said:

> On Sat, 13 Nov 2010 09:57:26 +0100, Vicent Mas  wrote:
> > Hi,
> > 
> > I'm upgrading some code and moving signal/slot connections from old
> 
> style
> 
> > to
> > 
> > new style but I'm having problem with this line:
> > self.connect(self.tmodel, QtCore.SIGNAL("headerDataChanged(int,
> > int,
> > 
> > int)"), self.my_slot)
> > 
> > where self is an instance of QtGui.QTableView and self.tmodel is an
> > instance
> > of QtCore.QAbstractTableModel.
> > 
> > I've tried:
> > 
> > 1) self.tmodel.headerDataChanged.connect(self.my_slot)
> > 2) self.tmodel.headerDataChanged[int, int, int].connect(self.my_slot)
> > 
> > and other variations with no luck. Could someone tell me how to convert
> 
> it
> 
> > to
> > the new-style syntax, please? I'm using Qt-4.6.3 and PyQt-4.8.
> 
> Define "no luck".
> 
> Phil

:-) I mean that some times my program aborts, other times I get no errors but 
the slot is never executed. I don't use any debugger, I just put a print 
'something' in the first line of the slot but the string is never printed. The 
old-style version works just fine.

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] headerDataChanged connection: new-style syntax problem

2010-11-13 Thread Vicent Mas
Hi,

I'm upgrading some code and moving signal/slot connections from old style to 
new style but I'm having problem with this line:

self.connect(self.tmodel, QtCore.SIGNAL("headerDataChanged(int, int, 
int)"), self.my_slot)

where self is an instance of QtGui.QTableView and self.tmodel is an instance 
of QtCore.QAbstractTableModel.

I've tried:

1) self.tmodel.headerDataChanged.connect(self.my_slot)
2) self.tmodel.headerDataChanged[int, int, int].connect(self.my_slot)

and other variations with no luck. Could someone tell me how to convert it to 
the new-style syntax, please? I'm using Qt-4.6.3 and PyQt-4.8.

Thanks,

Vicent
::

Share what you know, learn what you don't

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


Re: [PyQt] Re: problem with QAbstractItemModel

2009-11-07 Thread Vicent Mas
On 2009-11-07 Vicent Mas  said:

> On 2009-11-07 Linos  said:
> > ...
> > Hi,
> > in the qt examples from qt 4.5 documentation you can see they use this
> > in the model:
> > http://doc.trolltech.com/4.5/itemviews-simpletreemodel-treemodel-cpp.html
> >
> > QModelIndex TreeModel::index(int row, int column, const QModelIndex
> >  &parent) const
> >   {
> >   if (!hasIndex(row, column, parent))
> >   return QModelIndex();
> >
> >   TreeItem *parentItem;
> >
> >   if (!parent.isValid())
> >   parentItem = rootItem;
> >   else
> >   parentItem = static_cast(parent.internalPointer());
> >
> >   TreeItem *childItem = parentItem->child(row);
> >   if (childItem)
> >   return createIndex(row, column, childItem);
> >   else
> >   return QModelIndex();
> >   }
> 
> Thanks for this info. I simply didn't check this page because I was
>  interested in editable models not in read-only models. Its funny to see
>  that index method implementation in the read-only example is more complex
>  than in the editable one.
> 
> But still, it is nearly the same workaround provided by Baz and doesn't
>  answer my question about validity of the passed row argument.
> 
> > and this in the item class.
> > http://doc.trolltech.com/4.5/itemviews-simpletreemodel-treeitem-cpp.html
> >
> > TreeItem *TreeItem::child(int row)
> >   {
> >   return childItems.value(row);
> >   }
> >
> > but they can do this because QList .value method dont get an error if it
> > is out of bounds.
> 
> Yes but, as you can see in the in the index method provided in that
>  example, this is called *after* the row argument has been validated so it
>  has no impact in my question.
> 

OK, finally I got it. The validity of the parent model index passed to the 
QAbstractItemModel *must* be checked. It is said explicitely in the page 
referenced by Linos:

Models must implement an index() function to provide indexes for views and 
delegates to use when accessing data. Indexes are created for other components 
when they are referenced by their row and column numbers, and their parent 
model index. If an invalid model index is specified as the parent, it is up to 
the model to return an index that corresponds to a top-level item in the 
model.

Checking the parent validity in the way suggested by Balz will check 
implicitely the row and column validity.

As I said I did read the "Editable tree model example" which doesn't do that 
checking (I don't know why) but not the "Simple tree model example" (which 
does exactly that checking) so I was puzzled.

THANKS guys for your help.

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Re: problem with QAbstractItemModel

2009-11-07 Thread Vicent Mas
On 2009-11-07 Linos  said:

> ...
> Hi,
>   in the qt examples from qt 4.5 documentation you can see they use this 
> in
>  the model:
> http://doc.trolltech.com/4.5/itemviews-simpletreemodel-treemodel-cpp.html
> 
> QModelIndex TreeModel::index(int row, int column, const QModelIndex
>  &parent) const
>   {
>   if (!hasIndex(row, column, parent))
>   return QModelIndex();
> 
>   TreeItem *parentItem;
> 
>   if (!parent.isValid())
>   parentItem = rootItem;
>   else
>   parentItem = static_cast(parent.internalPointer());
> 
>   TreeItem *childItem = parentItem->child(row);
>   if (childItem)
>   return createIndex(row, column, childItem);
>   else
>   return QModelIndex();
>   }
> 

Thanks for this info. I simply didn't check this page because I was interested 
in editable models not in read-only models. Its funny to see that index method 
implementation in the read-only example is more complex than in the editable 
one.

But still, it is nearly the same workaround provided by Baz and doesn't answer 
my question about validity of the passed row argument.

> and this in the item class.
> http://doc.trolltech.com/4.5/itemviews-simpletreemodel-treeitem-cpp.html
> 
> TreeItem *TreeItem::child(int row)
>   {
>   return childItems.value(row);
>   }
> 
> but they can do this because QList .value method dont get an error if it is
>  out of bounds.

Yes but, as you can see in the in the index method provided in that example, 
this is called *after* the row argument has been validated so it has no impact 
in my question.

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Re: problem with QAbstractItemModel

2009-11-06 Thread Vicent Mas
On 2009-11-06 Baz Walter  said:

> ...
> your implementation of QAbstractItemModel.index is going to get called
> *a lot* and in many unforseen ways. 

Yes, but it is a general fact, not something that happens to my particular 
implementation, right?


> i think a more sane implementation
> would be something like this:
> 
>  def index(self, row, column, parent):
>  if self.hasIndex(row, column, parent):
>  branch = self.nodeFromIndex(parent)
>  return self.createIndex(row, column, branch.childAtRow(row))
>  return QModelIndex()
> 
> this fixes your immediate bug, and will probably avoid many others.
> 

I know that my implementation is very rough, but it is intended just for 
testing purposes. Of course your workaround and other similar (like the one 
sent by Linos) fixes the problem, but they leave the main question unanswered:  
why wrong row values are passed to the index method? Is it expected? If it is 
developers are forced to include good sanity code in their index method 
implementation (as you and Linos did), but I've not seen any reference to this 
in the Qt documentation. IMHO the Qt model implementation should not allow 
wrong row values to be passed to the index method. In fact, the example in the 
'Editable Tree Model Example' section of the Qt documentation doesn't check at 
all the validity of the row argument passed to the index method 
implementation.

On the other hand the fact that my script works fine with some Qt/PyQt versions 
but fails with recent versions seems to indicate that there is a bug either in 
the Qt implemention of models or in that PyQt versions.

Vicent

PS: Baz, thanks for your code snippet
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Re: problem with QAbstractItemModel

2009-11-06 Thread Vicent Mas
> On Fri, 6 Nov 2009 10:22:59 +0100, Vicent Mas  wrote:
> >> Hi,
> >>
> >> the attached script implements a minimal tree model featuring rows
> >>  deletion. It works just fine with (Qt 4.4, PyQt 4.4.4). However, with
> >>  (Qt
> >>  4.5.2, PyQt 4.5.4) and (Qt 4.5.2, PyQt 4.6.1) deleting the last row
> >>  raises
> >>  the following error:
> >>
> >> v...@rachael:/tmp$ python tmTester.py &
> >> [2] 6819
> >> v...@rachael:/tmp$ Traceback (most recent call last):
> >>   File "tmTester.py", line 189, in index
> >> return self.createIndex(row, column, branch.childAtRow(row))
> >>   File "tmTester.py", line 86, in childAtRow
> >> return self.children[row]
> >> IndexError: list index out of range
> >>
> >> Is it a bug in the recent versions of PyQt? Or should I fix some problem
> >> in
> >>  the script?
> >>
> >> I would really appreciate your help.
> >
> > Hi,
> >
> > I'm still struggling with this problem, looking for a solution (or, at
> > least,
> > a workaround) with no luck. Could somebody give me a hand please? I
> 
> really
> 
> > need to fix this issue.
> 
> Try and simplify your test case. 250+ lines isn't something people can take
> a quick look at.
> 
> Phil
> 

Hi,

well, there are lots of blank lines and comments (eric4 says there are 172 
lines of code) and I've ran pylint in order to make sure I was not including 
unnecessary stuf. But I will try to shrink it again.

Thanks for your answer.

Vicent
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Re: problem with QAbstractItemModel

2009-11-06 Thread Vicent Mas
> Hi,
> 
> the attached script implements a minimal tree model featuring rows
>  deletion. It works just fine with (Qt 4.4, PyQt 4.4.4). However, with (Qt
>  4.5.2, PyQt 4.5.4) and (Qt 4.5.2, PyQt 4.6.1) deleting the last row raises
>  the following error:
> 
> v...@rachael:/tmp$ python tmTester.py &
> [2] 6819
> v...@rachael:/tmp$ Traceback (most recent call last):
>   File "tmTester.py", line 189, in index
> return self.createIndex(row, column, branch.childAtRow(row))
>   File "tmTester.py", line 86, in childAtRow
> return self.children[row]
> IndexError: list index out of range
> 
> Is it a bug in the recent versions of PyQt? Or should I fix some problem in
>  the script?
> 
> I would really appreciate your help.
> 

Hi,

I'm still struggling with this problem, looking for a solution (or, at least, 
a workaround) with no luck. Could somebody give me a hand please? I really 
need to fix this issue.

TIA

Vicent

PD: I ran the script in a debian box with python 2.5.
::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] problem with QAbstractItemModel

2009-11-04 Thread Vicent Mas
Hi,

the attached script implements a minimal tree model featuring rows deletion. 
It works just fine with (Qt 4.4, PyQt 4.4.4). However, with (Qt 4.5.2, PyQt 
4.5.4) and (Qt 4.5.2, PyQt 4.6.1) deleting the last row raises the following 
error:

v...@rachael:/tmp$ python tmTester.py &
[2] 6819
v...@rachael:/tmp$ Traceback (most recent call last):
  File "tmTester.py", line 189, in index
return self.createIndex(row, column, branch.childAtRow(row))
  File "tmTester.py", line 86, in childAtRow
return self.children[row]
IndexError: list index out of range

Is it a bug in the recent versions of PyQt? Or should I fix some problem in the 
script?

I would really appreciate your help.

Vicent
::

Share what you know, learn what you don't

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


import sys

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

class TreeModelTester(QMainWindow):
"""Test correctness of tree models/views """


def __init__(self):
"""Initialize the application."""

QMainWindow.__init__(self)

self.counter = 0

# Make the GUI
self.setWindowTitle('TreeView tester')
self.setupMenus()

central_widget = QWidget(self)
central_layout = QVBoxLayout(central_widget)
self.setCentralWidget(central_widget)
self.dbs_tree_view = QTreeView(central_widget)
central_layout.addWidget(self.dbs_tree_view)

# The tree of databases model/view
self.dbs_tree_model = DBsTreeModel(self)
self.dbs_tree_view.setModel(self.dbs_tree_model)


def setupMenus(self):
"""Set up the main window menus."""

remove_action = QAction('&Remove', self)
remove_action.setShortcut(QKeySequence.Delete)
self.connect(remove_action, SIGNAL("triggered()"), self.slotRemoveBranch)
menu = self.menuBar().addMenu('&Menu')
menu.addAction(remove_action)


def closeEvent(self, event):
"""Handle close events."""
qApp.quit()


def slotRemoveBranch(self):
"""Delete a given branch from the tree model and its views."""

current = self.dbs_tree_view.currentIndex()
if current is None:
return

# Delete the node
self.dbs_tree_model.deleteNode(current)


class GroupNode(object):
"""A group node in the tree of databases model."""

def __init__(self, parent, name):
"""Create a group node for the tree of databases model."""

self.children = []
self.parent = parent
self.name = name


def __len__(self):
return len(self.children)


def insertChild(self, child, position=0):
"""Insert a child in a group node."""
self.children.insert(position, child)


def childAtRow(self, row):
"""The row-th child of this node."""

assert 0 <= row <= len(self.children)
return self.children[row]


def row(self):
"""The position of this node in the parent's list of children."""

if self.parent:
return self.parent.children.index(self)

return 0
class DBsTreeModel(QAbstractItemModel):
"""The tree of databases model."""

def __init__(self, parent=None):
"""Create the model."""

QAbstractItemModel.__init__(self, parent)

# Populate the model
self.root = GroupNode(None, 'root')
self.addBranch(QModelIndex(), 'First node')
self.addBranch(QModelIndex(), 'Second node')
self.addBranch(QModelIndex(), 'Third node')



def flags(self, index):
"""Returns the item flags for the given index. """
return Qt.ItemIsEnabled|Qt.ItemIsSelectable


def data(self, index, role):
"""Returns the data stored under the given role for the item
referred to by the index."""

if not index.isValid():
return QVariant()
node = self.nodeFromIndex(index)
if role == Qt.DisplayRole:
return QVariant(node.name)
else:
return QVariant()


def setData(self, index, value, role=Qt.DisplayRole):
"""Sets the role data for the item at index to value."""

if not index.isValid():
return False
node = self.nodeFromIndex(index)
if role == Qt.DisplayRole:
node.name = value
self.emit(SIGNAL(
'dataChanged(QModelIndex, QModelIndex)'), index, index)
return True
return False


def headerData(self, section, orientation, role):
"""Returns the data for the given role and section in the header
with the specified orientation.
"""

if (orientation, role) == (Qt.Horizontal, \
Qt.DisplayRole):
return QVariant('Sample tree')

return QVariant()


def columnCount(self, parent):
"""The number of columns for the children of the given index."""
return 1


def rowCount(self, parent):
"""The number

[PyQt] problem with mdisubindow background

2009-02-13 Thread Vicent Mas
Hi,

I'm trying to change the background of a QMdiSubwindow but it is not as
easy as I expected. For simplicity, in the attached example, I use a
QLabel as internal widget. When I try to change the label background
using the common chain

get palette + change palette + set palette

nothing happens (although it works when the QLabel is not the internal
widget of a QMdiSubWindow). I'm forced to use a style sheet. However
I'd prefer not to do it (stylesheets are not supported on Mac OS X, the
Qt docs says). The attached script shows the problem.

Could somebody help me with this problem?

TIA

PS: I'm using Qt 4.4.0 and PyQt 4.4.4

Vicent

-- 
Share what you know, learn what you don't.
#!/usr/bin/env python

import sys

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

app = QApplication(sys.argv)

#This works
label = QLabel('Hi darling! ')
palette = label.palette()
palette.setBrush(QPalette.Active, QPalette.Window, QBrush(QColor('red')))
label.setPalette(palette)
label.show()

#This doesn't
mdi = QMdiArea()
new_label = QLabel('Hi again honey!   ')
#new_label.setStyleSheet("background-color: red")
new_palette = new_label.palette()
new_palette.setBrush(QPalette.Active, QPalette.Window, QBrush(QColor('red')))
new_label.setPalette(new_palette)
mdi.addSubWindow(new_label)
mdi.show()

app.exec_()
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] re: Wretched horizontal scrolling of QTreeWidget on Linux

2008-11-18 Thread Vicent Mas
Sorry for the noise. It seems that my email client was not
synchronized with the server and I didn't saw your last post.
Happy to see that you fixed the problem.

Vicent.

2008/11/18 Edward K. Ream <[EMAIL PROTECTED]>:
> [quote]
> On Linux, a QTreeWidget will typically scroll horizontally when an
> item to the right of the present item is selected programatically,
> i.e., not with the mouse, but with code triggered from a keystroke.
> Worse, scrolling doesn't get restored to zero horizontal offset when a
> "leftward" item is selected.  Not good.
> [end quote]
>
> It turns out that the difference in behaviors in the QTreeWidget on
> the XP and Linux platforms was the result of a call to
> QTreeWidget.scrollToItem in an item-expanded event handler. On XP,
> this scrolls only vertically; on Linux, it may scroll in either
> direction.  Removing this call makes the QTreeWidget usable on Linux.
>
> I'm tempted to call this the most serious bug I've found with PyQt,
> which is another way of saying that PyQt has been very very good to me
> :-)
>
> Edward
> 
> Edward K. Ream email: [EMAIL PROTECTED]
> Leo: http://webpages.charter.net/edreamleo/front.html
> 
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Wretched horizontal scrolling of QTreeWidget on Linux

2008-11-18 Thread Vicent Mas
Hi,

you could catch the itemSelectionChanged() signal, then get the currently 
selected item with selectedItems() and then call scrollToItem() slot. Note 
that you can play with several scroll hint values in the scrollToItem method.
I haven't tested it, sorry.

Hope it helps.

El Tuesday 18 November 2008 Edward K. Ream escribió:
> On XP, a QTreeWidget never scrolls horizontally automatically, and
> that works well in practice.
>
> On Linux, a QTreeWidget will typically scroll horizontally when an
> item to the right of the present item is selected programatically,
> i.e., not with the mouse, but with code triggered from a keystroke.
> Worse, scrolling doesn't get restored to zero horizontal offset when a
> "leftward" item is selected.  Not good.
>
> I don't see any options/methods that have any chance of affecting
> this. Saving and restoring scrollbar positions does not work.
> Presumably one could dig deep into QAbstractScrollArea to save and
> restore the underlying scroll rect, but this is going to be far from
> fun.
>
> Anyone have any suggestions, or sample code? Thanks.
>
> Edward
> 
> Edward K. Ream email: [EMAIL PROTECTED]
> Leo: http://webpages.charter.net/edreamleo/front.html
> 
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



-- 
::

Share what you know, learn what you don't


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


Re: [PyQt] Re: problem with connected scrollbars

2008-11-13 Thread Vicent Mas
Thanks for your confirmation.

Vicent

El Thursday 13 November 2008 Phil Thompson escribió:
> On Wed, 12 Nov 2008 14:54:55 +0100, Georg Altmann <[EMAIL PROTECTED]>
>
> wrote:
> > Vicent Mas schrieb:
> >> Hi,
> >>
> >> thanks for your answer. I've been working about the TypeError and I've
> >> found
> >> that the call
> >>
> >> my_scrollbar.triggerAction(QtGui.QAbstractSlider.SliderSingleStepAdd)
> >>
> >> works
> >>
> >> but the (apparently equivalent) call
> >>
> >> my_scrollbar.triggerAction(1)
> >>
> >> fails raising the TypeError. However QAbstractSlider.SliderSingleStepAdd
> >> is
> >> supposed to have an integer value of 1, isn't it? At least this is what
>
> I
>
> >> understand when reading the Qt docs.
> >
> > No, its an enum. It looks like int is not implicitly converted to the
> > required enum type. Interesting. Probably there is more info in the SIP
> > docs.
>
> This restriction has been relaxed in SIP v4.7.8, so passing an integer
> value should now work.
>
> Phil
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



-- 
::

Share what you know, learn what you don't


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


Re: [PyQt] Re: problem with connected scrollbars

2008-11-12 Thread Vicent Mas
Hi,

in http://www.riverbankcomputing.co.uk/static/Docs/sip4/sipref.html one can 
read:

2   Potential Incompatibilities with Earlier Versions
2.1   SIP v4.7.8

This version allows a Python int object to be passed whenever an enum is 
expected. This can mean that two signatures that were different with prior 
versions are now the same as far as Python is concerned. The Constrained 
annotation can now be applied to an enum argument to revert to the earlier 
behaviour.

I'm using sip 4.7.6. I suppose that it means that my code will work after 
updating to version 4.7.8 (although I don't know anything about sip, so I may 
be wrong). I'll try.

Regards


El Wednesday 12 November 2008 Georg Altmann escribió:
> Vicent Mas schrieb:
> > Hi,
> >
> > thanks for your answer. I've been working about the TypeError and I've
> > found that the call
> >
> > my_scrollbar.triggerAction(QtGui.QAbstractSlider.SliderSingleStepAdd)
> >
> > works
> >
> > but the (apparently equivalent) call
> >
> > my_scrollbar.triggerAction(1)
> >
> > fails raising the TypeError. However QAbstractSlider.SliderSingleStepAdd
> > is supposed to have an integer value of 1, isn't it? At least this is
> > what I understand when reading the Qt docs.
>
> No, its an enum. It looks like int is not implicitly converted to the
> required enum type. Interesting. Probably there is more info in the SIP
> docs.
>




-- 
::

Share what you know, learn what you don't


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


Re: [PyQt] Re: problem with connected scrollbars

2008-11-12 Thread Vicent Mas
Hi,

thanks for your answer. I've been working about the TypeError and I've found 
that the call

my_scrollbar.triggerAction(QtGui.QAbstractSlider.SliderSingleStepAdd)

works

but the (apparently equivalent) call

my_scrollbar.triggerAction(1)

fails raising the TypeError. However QAbstractSlider.SliderSingleStepAdd is 
supposed to have an integer value of 1, isn't it? At least this is what I 
understand when reading the Qt docs.

Even more, the actionTriggered SIGNAL passes integer values to the slot it is 
connected. So I supposed that I could use this values directly for triggering 
the same action in other scrollbar, but I cannot. Instead the constants names 
have to be used. Could you (or somebody else :-) tell me why?

Thanks.

PS: and thanks for your code, of course.

 
El Wednesday 12 November 2008 Georg Altmann escribió:
> Vicent Mas schrieb:
> > Hello,
> >
> > I'm trying to make a QTableView with two 'connected' vertical scrollbars.
> > By connected I mean that the second scrollbar should be able to act on
> > the first one. As a simple case I want the first scrollbar to repeat the
> > action triggered by the second one. For instance, if I press the down
> > arrow of the second scrollbar I want the down arrow of the first
> > scrollbar to be pressed too. The attached script tries to do it. However
> > an unexpected (unexpected for me I mean :-) TypeError makes the script to
> > fail. Could someone help me with this problem, please?
>
> You didn't write were the error actually occurs. Anyway I had the same
> problem of linking multiple scollbars. My solution is below. Of course
> this only makes sense if the sliders have the same range. Otherwise the
> class could be modified to use relative values. Depends on what you want
> to accomplish.
>
> Use the class like this:
>
> mySliderLinker = SliderLinker([scrollbar1, scrollbar2])
>
> Regards
> Georg
>
>
> from PyQt4 import QtCore,QtGui
> from PyQt4.QtCore import SIGNAL,SLOT
>
>
> class SliderLinker(QtCore.QObject):
>  '''Links multiple QAbstractSlider s together.
>
>  If one slider's value changes, the other linked sliders will be set
>
>  to this value.'''
>
>  def __init__(self, sliders, parent = None):
>  super(SliderLinker,self).__init__(parent)
>  self._sliders = sliders
>  self._linkerSlots = []
>  self.initSliders()
>
>  def initSliders(self):
>  for s in self._sliders:
>  ls = LinkerSlot(self,s)
>  self._linkerSlots.append(ls)
>
>  def updateFrom(self,slider):
>  val = slider.value()
>  for s in self._sliders:
>  if(s is not slider):
>  s.setValue(val)
>
> class LinkerSlot(QtCore.QObject):
>  def __init__(self,linker,slider, parent = None):
>  super(LinkerSlot,self).__init__(parent)
>  self._linker = linker
>  self._slider = slider
>  self.connect(slider, SIGNAL('valueChanged(int)'),
>  self.updateSliders)
>
>  def updateSliders(self, value):
>  self._linker.updateFrom(self._slider)
>
>
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



-- 
::

Share what you know, learn what you don't


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


[PyQt] problem with connected scrollbars

2008-11-08 Thread Vicent Mas
Hello,

I'm trying to make a QTableView with two 'connected' vertical scrollbars. By 
connected I mean that the second scrollbar should be able to act on the first 
one. As a simple case I want the first scrollbar to repeat the action 
triggered by the second one. For instance, if I press the down arrow of the 
second scrollbar I want the down arrow of the first scrollbar to be pressed 
too. The attached script tries to do it. However an unexpected (unexpected 
for me I mean :-) TypeError makes the script to fail. Could someone help me 
with this problem, please?

Thanks in advance.

-- 
::

Share what you know, learn what you don't



two_scrollbars.py
Description: application/python
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Getting length of QTextEdit without calling w.toPlainText

2008-11-03 Thread Vicent Mas
Hi,

I suppose you can use the QTextCursor, move it to the end of your document and 
then call  its position method (but I haven't tested it).

Hope it helps.

El Monday 03 November 2008 Edward K. Ream escribió:
> It there a way to get the length of the text in a QTextEdit without
> calling w.toPlainText()?
>
> Something like w.textLength() would substantially reduce the number of
> allocated strings in my app.
>
> Thanks.
>
> Edward
> 
> Edward K. Ream email: [EMAIL PROTECTED]
> Leo: http://webpages.charter.net/edreamleo/front.html
> 
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



-- 
::

Share what you know, learn what you don't


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


Re: [PyQt] problem with model/view

2008-06-27 Thread Vicent Mas
El Friday 27 June 2008 Phil Thompson escribió:
> On Fri, 27 Jun 2008 10:22:13 +0200, Vicent Mas <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > the attached scripts are intended to do the same thing: display a widget
> > that
> > contains a QTreeView with two columns and one row. The script right.py
> > works
> > just fine. However the other doesn't work and I cannot understand the
> > reason.
> > Probably I'm doing something very stupid, but I'm unable to find out what
> > is
> > it. Could someone help me, please?
>
> Keep a reference to the model?
>
> Phil

Right answer, of course.

Thanks Phil.

-- 
::

Share what you know, learn what you don't


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


[PyQt] problem with model/view

2008-06-27 Thread Vicent Mas
Hi,

the attached scripts are intended to do the same thing: display a widget that 
contains a QTreeView with two columns and one row. The script right.py works 
just fine. However the other doesn't work and I cannot understand the reason. 
Probably I'm doing something very stupid, but I'm unable to find out what is 
it. Could someone help me, please?

Thanks in advance.

-- 
::

Share what you know, learn what you don't



wrong.py
Description: application/python


right.py
Description: application/python
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Problem with QVariant

2008-04-11 Thread Vicent Mas
Hello,

I've recently upgraded from PyQt4.1.1 to 4.3.4-snapshot-20080408. Now, an 
application that worked fine with the older version fails when trying to save 
QColor or QFont values via QSettings.setValue method. In these cases the 
following is printed to console:

QVariant::save: unable to save type 64.
QVariant::save: unable to save type 67.
QVariant::save: unable to save type 67.
QVariant::save: unable to save type 67.

I've double checked that values passed to the method are correct. Moreover, 
any other kind of values (bool, int, strings...) are saved with no problems.

Are the errors caused by a PyQt bug?
-- 
::

Share what you know, learn what you don't

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


[PyQt] Re: One more question about GPL v3

2008-03-07 Thread Vicent Mas
OK.

Thanks a lot for your answers.

El Friday 07 March 2008 Phil Thompson escribió:
> On Friday 07 March 2008, Vicent Mas wrote:
> > Hi again,
> >
> > I was wondering if PyQt3 applications can be distributed under GPL v3. Is
> > it possible? Or only GPL v2 is supported for PyQt3?
>
> GPL2 only.
>
> Phil
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



-- 
::

Share what you know, learn what you don't


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


[PyQt] One more question about GPL v3

2008-03-07 Thread Vicent Mas
Hi again,

I was wondering if PyQt3 applications can be distributed under GPL v3. Is it 
possible? Or only GPL v2 is supported for PyQt3?

Vicent
-- 
::

Share what you know, learn what you don't

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


[PyQt] GPL v3 question

2008-03-07 Thread Vicent Mas
Hello,

I'have just seen that, since January, Trolltech releases Qt under GPL v3 
license. Does it apply to PyQt4 too?

TIA
-- 
::

Share what you know, learn what you don't

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


[PyQt] setLabel problem

2007-06-22 Thread Vicent Mas
Hi,

I've found a performance problem in the QHeader.setLabel method. I've an 
application that makes an intensive use of this method. It is written 
in PyQt 3.15 (I know, I should move to PyQt4, but I'm too busy at the 
moment :( When I run the application in PyQt 3.17 the performance falls 
drastically in some operations. Profiling the application shows that 
the problem seems to be in the QHeader.setLabel method. You can see the 
profiling results in the attached file. I also attach a very rough 
benchmark that shows the problem when you run it using both versions of 
PyQt.

IIRC PyQt 3.15 was installed with sip 4.3.2 whereas PyQt 3.17 has been 
installed with sip 4.6.

Any help will be appreciated.

-- 
::

Share what you know, learn what you don't

Profile for PyQt 3.17
-
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on 
tyrrell, Qt-Version
>>> import pstats
>>> p = pstats.Stats('VTProfile_317')
>>> p.sort_stats('time').print_stats(10)
Wed Jun 20 15:13:32 2007VTProfile_317

 205990 function calls (204929 primitive calls) in 49.884 CPU seconds

   Ordered by: internal time
   List reduced from 1268 to 10 due to restriction <10>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
1   28.457   28.457   48.046   48.046 :0(exec_loop)
10004   17.2530.002   17.9040.002 :0(setLabel)
10.5210.5211.1331.133 C:\...\vtapp.py:104(__init__)
754370.4350.0000.4350.000 :0(time)
 94700.3710.0001.6520.000 
C:\...\vtTables\hpViewport.py:302(eventFilter)
107190.2850.0001.1800.000 :0(eventFilter)
 27530.1900.0000.8960.000 
C:\...\vtTables\hpViewport.py:144(paintCell)
 27880.1640.0000.5000.000 :0(paintCell)
   100.1560.016   18.4761.848 
C:\...\vtTables\hpViewport.py:253(tableFault)
 27530.1340.0000.3360.000 
C:\...\vtWidgets\vtTableItem.py:65(paint)




Profile for PyQt 3.15
-
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
tyrrell, Qt-Version
>>> import pstats
>>> p = pstats.Stats('VTProfile_315')
>>> p.sort_stats('time').print_stats(10)
Fri Jun 22 07:27:40 2007VTProfile_315

 242928 function calls (242551 primitive calls) in 30.699 CPU seconds

   Ordered by: internal time
   List reduced from 1395 to 10 due to restriction <10>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
1   25.252   25.252   28.777   28.777 :0(exec_loop)
230040.6160.0000.6160.000 :0(setLabel)
10.4950.4951.0551.055 C:\...\vtapp.py:104(__init__)
784590.4140.0000.4140.000 :0(time)
 55020.3550.0001.7930.000 
C:\...\vtTables\hpViewport.py:144(paintCell)
 55360.3330.0000.9740.000 :0(paintCell)
   230.3140.0141.9720.086 
C:\...\vtTables\hpViewport.py:253(tableFault)
 55020.2350.0000.6410.000 
C:\...\vtWidgets\vtTableItem.py:65(paint)
 55020.2270.0000.3010.000 :0(paint)
 19020.1480.0001.9400.001 :0(eventFilter)



>>> 


setLabelSingleBenchmark.py
Description: application/python
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyKDE] Re: eric4 autoindentation

2007-03-02 Thread Vicent Mas
El Friday, 2 de March de 2007 13:06 [EMAIL PROTECTED] escribió:
> Hi,
>
> I've just installed eric4 and tried it. Really impressive.
> Unfortunately Python autoindentation is not working. In the
> Preferences dialog 'Auto indentation' and 'Auto indentation after :'
> checkboxes are both checked. Is the problem due to a bug? Or I need
> change the
> configuration? My software versions are:
>
> Python 2.4.4
> Qt 4.2.2
> PyQt 4.1.1
> sip 4.5.2
> QScintilla 2-snapshot-20070117
> Eric4 4.0-snapshot-20070218
>
> Thanks in advance for your help.

Ooops! I've just realised that eric has its own mailing list. Sorry for 
the noise.

-- 
::

Share what you know, learn what you don't

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


[PyKDE] vendorID + py2app problem

2006-09-26 Thread Vicent Mas
Hi everyone. 

I am trying to use py2app to create an application bundle out of a 
binary signed with VendorID, generated out of a Python script. Using 
py2app on the unsigned script seems to work without problems, and the 
generated app works fine. However, we can't figure out how to make 
py2app use the signed binary as the main program for the application 
bundle.  We have tried in two ways to no solution:

  1. Using the signed binary as the 'app' argument to py2app, but it
 crashes since it (of course) expects a Python script.
  2. Using the normal script for py2app, and somehow replacing it
 afterwards in the bundle.  However, tweaking the plist or the
 __boot__.py file is required, and the later doesn't allow arguments
 to be passed properly to the binary program.

Is any of the previous approaches viable?  Is there some other way to do
it?

Thanks in advance for your help.

PS: Sorry if this is off topic but the pyqt-mac list archives don't show
vendorID related questions so I decided to try here first.

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


[PyKDE] Mac OS X problems with the menu bar.

2005-12-09 Thread Vicent Mas
Hello,
I've a pyqt application that runs fine in Linux and Windows but not in 
Mac OS X. The following problems appear in the Application menu of the 
menu bar:

- the name of the application menu is Python instead of the name of my
 application. Is it possible to fix this problem?. I've googled with no
 luck.
- I've inserted the Quit menu item and the About menu item via
 QAction().add() using translated strings '&Quit MyApp' and '&About
 MyApp'. It works for the About menu item (I see About MyApp in the
 application menu) but not for the Quit menu item (I see Quit Python in
 the application menu). Any clue?

Thanks for your help.

PS: I'm running latest versions of qt-mac, qscintilla, sip and pyqt.

-- 
Share what you know, learn what you don't



pgpf4jrIhedBm.pgp
Description: PGP signature
___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


Re: [PyKDE] custom style problem

2004-07-08 Thread Vicent Mas
El Thursday 08 July 2004 16:30, Phil Thompson escribio:
>
> Works for me - once all the syntax errors in the above fragment are fixed
> (and the incorrect call to the QWindowsStyle ctor is replaced by a call to
> QWindows.drawControl()).
>
> It's always better to post a complete script - like the attached.

My fault. Sorry. The call was ok in my script but wrong in my message. In fact 
the problem was in the main script. I was calling qApp.setStyle() before to 
call qApp.setMainWidget(). The problem was that the main widget itself 
contains a call to qApp.setStyle(), so the effect of the first setStyle() 
call was overwritten by the second one.

Thanks again.
-- 
Share what you know, learn what you don't

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


[PyKDE] custom style problem

2004-07-08 Thread Vicent Mas
Hi,
I'm trying to create a simple custom style (newbie with styles) but I cannot 
to make it work, so I need some help. This is what I've done.

customstyle script
-
from qt import *

class CustomStyle(QWindowsStyle):
def __init__(self) :
apply(QWindowsStyle.__init__m (self,))

def drawControl(self, celem, painter, widget, rect, colorGroup, flags, opt) :
print "I'm here"
if celem ==QStyle.CE_PushButtonLabel :
# do something
else :
QWindowsStyle(self, celem, painter, widget, rect, colorGroup, 
flags, opt)

main script:

from customstyle import *
...
app = QApplication(args)
app.setStyle(customStyle())
...

I expected that when the application draws the label (pixmap or iconset with 
text) of any QPushButton some actions would be executed, but nothing happens. 
In fact the string  is never printed.
I really don't know what is wrong. Please, could you tell me where are the 
mistakes?

Thanks in advance.
-- 
Share what you know, learn what you don't

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


Re: [review] [PyKDE] large tables problem

2004-06-23 Thread Vicent Mas
El Wednesday 23 June 2004 07:10, Jim Bublitz escribio:
> ...
> If your application allows it, you can operate the table with fixed number
> of cells/fixed amount of memory, reload the cells as necessary (don't
> destroy/construct new cells), and overload the navigation methods (cursor
> up/down, page up/down, home, end, and the equivalent mouse/scrollbar/button
> operations) to cause a "page fault" and reload the table when navigation is
> about to go outside the range of rows currently displayed.
>

I was thinking about it, and discarded this possibility because I didn't know 
how to overload the navigation methods. In particular I don't know how  can I 
do that the scrollbar of a table with let's say 100 rows behaves and looks 
like the scrollbar of a table with much more rows. Could you give me a clue, 
please?

> There are probably some ways to minimize data movement, but the limiting
> factor for speed is probably redraws. The memory used should then be
> independent of the table size.
>

Right. This is exactly the goal I'm trying to achieve. Data movement is 
already very optimized in my application, but the suggestions you pointed 
above still remain to be done.

Thanks a lot Jim. You are the best.
-- 
Share what you know, learn what you don't

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


[PyKDE] large tables problem

2004-06-22 Thread Vicent Mas
Hi,
I'm working on a viewer for large tabular datasets. The underlying application 
from which my viewer read data is a hierarchical database that can deal with 
really large datasets (tipically too large to be managed with relational 
databases). Following the advises of Qt documentation and the Qt Quarterly  
article http://doc.trolltech.com/qq/qq07-big-tables.html I've written my own 
table class by deriving QTable class and overwriting several functions. In 
particular the resizeData() function has been reimplemented to do nothing. In 
addition, I use buffers so just a small part of the displayed dataset is in 
memory at a given time.
However the amount of memory allocated by my application is still too big when 
I create large tables (you can see a summary at the bottom of the message).
 Does anybody know what else can I do in order to reduce the amount of 
allocated memory? Help would be really appreciated.

Thanks in advance.

Some useful info:

Debian box (kernel 2.6.2)
python 2.3.4
qt 3.2.3
pyqt 3.12

The following table is based on the output of command . 

ROWS   %CPU  %MEM   VSZ(KB) RSS TIME COMMAND
0 9.74.040652   20796   0:53 python main.py
10**5  1.2  4.5 43332   23412   0:03 python main.py
10**6  1.3  9.5  69168  49208   0:04 python main.py
10**7  7.4  59.4326512  306584   0:35 python main.py

Of course main.py is the script that launches my application and the ROWS 
column gives the number of rows of the opened table :). For testing purposes 
columns have been fixed to 4 and cells contain strings of 1 character length.

-- 
Share what you know, learn what you don't

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


Re: [PyKDE] QSettings problem

2004-04-19 Thread Vicent Mas
On Monday 19 April 2004 07:06, Phil Thompson wrote:
> On Sunday 18 April 2004 8:55 pm, Vicent Mas wrote:
> > Hi,
> > I'm trying to use QSettings.setPath method for configuring my application
> > but it seems to be completely ignored. For instance, this simple script:
> >
> > --
Hi,

> > #!/usr/bin/env python
> >
> > from qt import *
> >
> > c = QSettings()
> > c.setPath('MyCompany.com', 'MyApplication')
> > c.writeEntry('/Look/currentStyle', 'Platinum')
> > --
>
> What does writeEntry() return?
>

It returns true.

> > creates the file $HOME/.qt/lookrc with content:
> > [General]
> > CurrentStyle=Windows
> >
> > If I add a search path with insertSearchPath, let's say $HOME/test, then
> > I get a $HOME/test/lookrc file, with the same content as before
>
> Are you sure? "CurrentStyle" != "currentStyle".
>

Yes, you are right. It's a copy -paste mistake. You know, I ran the script 
several times, changing values. The output doesn't correspond to the script
('Platinum' != 'Windows' and 'CurrentStyle' != 'currentStyle'), but it behaves 
as I told you.

> > I've revised this mailing list archives looking for a solution, but  with
> > no success. What I'm doing wrong?
> >
> > Thanks in advance for your help.
>
> Most likely the user doesn't have permissions on the global settings.
>

The user has permissions (I'm the system admin;).

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

-- 
Share what you know, learn what you don't



pgp0.pgp
Description: signature


[PyKDE] QSettings problem (II)

2004-04-18 Thread Vicent Mas
Ooops!
I'm running a Linux box with
Python 2.3.3
Qt 3.2.3
PyQt 3.10
SIP 4.0rc2

-- 
Share what you know, learn what you don't



pgp0.pgp
Description: signature


[PyKDE] QSettings problem

2004-04-18 Thread Vicent Mas
Hi,
I'm trying to use QSettings.setPath method for configuring my application but 
it seems to be completely ignored. For instance, this simple script:

--
#!/usr/bin/env python

from qt import *

c = QSettings()
c.setPath('MyCompany.com', 'MyApplication')
c.writeEntry('/Look/currentStyle', 'Platinum')
--

creates the file $HOME/.qt/lookrc with content:
[General]
CurrentStyle=Windows

If I add a search path with insertSearchPath, let's say $HOME/test, then I get 
a $HOME/test/lookrc file, with the same content as before

I've revised this mailing list archives looking for a solution, but  with no 
success. What I'm doing wrong?

Thanks in advance for your help.

-- 
Share what you know, learn what you don't



pgp0.pgp
Description: signature