[PySide] DataMapper issues
Srini Kommoori
vasure at gmail.com
Sun Feb 17 16:17:27 CET 2013
I tried to create a simple testcase to recreate the problem - so far basic
stuff works for me(mapper and sql components). If you have a simple test
case, it would help a lot.
BTW, there is a simple example under pyside examples
http://qt.gitorious.org/pyside/pyside-examples/blobs/master/examples/sql/tablemodel.py
that
I started with.
On Sun, Feb 17, 2013 at 6:22 AM, anatoly techtonik <techtonik at gmail.com>wrote:
> Hi Adrian,
>
> The detection of root cause of this bug is impossible using method of
> static analysis of your snippet. You need to strip it to the bare bones
> example that can be executed on the systems other that OpenSuse 12.2 to
> confirm the bug is not affected by operating system configuration /
> combination of versions of DB and binding packages.
>
> It will help to maintain an instruction on PySide wiki how to create such
> testing environment so that the operation can be followed and automated for
> future use. As you're the most interested person in what.
>
> Mind you that writing this 'fixture creating guide' and clearing place for
> it does not guarantee that your particular problem is easy enough (or
> feasible) to by tracked and solved. But it may increase the chances up to
> 80% depending on the complexity, and will lower the barrier for PySide
> contributors, who are not yet (but may be) able to solve your problem.
>
>
> --
> anatoly t.
>
>
> On Sun, Feb 17, 2013 at 6:05 AM, Adrian Klaver <adrian.klaver at gmail.com>wrote:
>
>> On 02/16/2013 07:01 PM, Srini Kommoori wrote:
>> > Can you set/get the sql db using python?
>> >
>> > As you are on Python, I would use sqlalchemy or native python bindings
>> > for the sql interface and test it out.
>>
>> The database connection works. I get the correct values in the lineEdit
>> widgets. As I mentioned when I set up OnFieldChange and AutoSubmit the
>> form would update the first field on entry.
>> >
>> >
>> >
>> > On Sat, Feb 16, 2013 at 3:19 PM, Adrian Klaver <adrian.klaver at gmail.com
>> > <mailto:adrian.klaver at gmail.com>> wrote:
>> >
>> > OpenSuse 12.2
>> > pyside 1.1.2-1.11
>> > Python 2.7.3
>> >
>> > I have the following and it will not save the data to the database:
>> >
>> > class PlantForm(QtGui.QMainWindow):
>> > def __init__(self, parent=None):
>> > super(PlantForm, self).__init__(parent)
>> > loader = QtUiTools.QUiLoader()
>> > self.ui =
>> >
>> loader.load("/home/aklaver/software_projects/greenhouse_app/python_code/plant_app_qt/forms/plant_form.ui")
>> > self.model = QtSql.QSqlTableModel(self, db=db)
>> > self.model.setTable("plant1")
>> > self.model.setSort(0, QtCore.Qt.AscendingOrder)
>> > self.model.setEditStrategy(self.model.OnManualSubmit)
>> > self.model.select()
>> > self.dm <http://self.dm> = QtGui.QDataWidgetMapper(self)
>> > self.dm.setSubmitPolicy(self.dm.ManualSubmit)
>> > self.dm.setModel(self.model)
>> > self.dm.addMapping(self.ui.plantNoLi, 0)
>> > self.dm.addMapping(self.ui.commonLi, 1)
>> > self.dm.addMapping(self.ui.genusLi, 2)
>> > self.dm.addMapping(self.ui.speciesLi, 3)
>> > self.dm.toFirst()
>> > self.saveBtn = self.ui.saveBtn
>> > self.saveBtn.clicked.connect(self.model.submitAll)
>> > self.ui.show()
>> > self.center()
>> >
>> > def center(self):
>> > qr = self.frameGeometry()
>> > cp = QtGui.QDesktopWidget().availableGeometry().center()
>> > qr.moveCenter(cp)
>> > self.move(qr.topLeft())
>> >
>> > I am obviously missing something, I am just not sure what?
>> > I tried the above with OnFieldChange for the model and AutoSubmit
>> for
>> > the DataMapper. When I opened the form the first field would update
>> to
>> > its existing value bit then I could not change anything. The changed
>> > value stick in the widget, they just do not get to the database.
>> >
>> > Thanks,
>> >
>> > --
>> > Adrian Klaver
>> > adrian.klaver at gmail.com <mailto:adrian.klaver at gmail.com>
>> > _______________________________________________
>> > PySide mailing list
>> > PySide at qt-project.org <mailto:PySide at qt-project.org>
>> > http://lists.qt-project.org/mailman/listinfo/pyside
>> >
>> >
>>
>>
>> --
>> Adrian Klaver
>> adrian.klaver at gmail.com
>> _______________________________________________
>> PySide mailing list
>> PySide at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/pyside
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130217/faf74ca7/attachment.html>
More information about the PySide
mailing list