daly
2012-04-19 11:36:13 UTC
Hello,
I try to use guidata with PySide, my code works perfectly with PyQt4.
cons but when I change:
from PyQt4.QtCore import * -> from PyQt4.QtCore import *
from PyQt4.QtGui import * -> from PyQt4.QtGui import *
an error message appears:
TypeError: 'PySide.QtGui.QBoxLayout.addWidget' called with wrong
argument types:
PySide.QtGui.QBoxLayout.addWidget(DataSetEditGroupBox)
Supported signatures:
PySide.QtGui.QBoxLayout.addWidget(PySide.QtGui.QWidget, int = 0,
PySide.QtCore.Qt.Alignment = 0)"
this is my code
-------------------------------------------------------------------
# -*- coding: utf-8 -*-
from PySide.QtCore import *
from PySide.QtGui import *
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker,relationship
from datetime import *
import pickle
import guidata
from defineClasses import *
from guidata.dataset.qtwidgets import DataSetShowGroupBox,
DataSetEditGroupBox
from guidata.dataset.datatypes import ( DataSet, BeginGroup, EndGroup,
ValueProp)
from guidata.dataset.dataitems import (BoolItem, FloatItem,
StringItem, DateItem,ChoiceItem,TextItem ,DateTimeItem)
import sys, os
class PatientWidget(DataSet):
"""
displays Patient data
"""
g1 = BeginGroup(u"")
name=StringItem(u"Nom")
firstname=StringItem(u"Prénom")
sex = ChoiceItem(u"Sexe",("Masculin", "Feminin"))
birth_date = DateItem(u"Date de naissance")
_g1 = EndGroup(u"")
g2 = BeginGroup(u"").set_pos(col=1)
adress = StringItem(u"Adresse")
zip_code = StringItem(u"Code postal")
city = StringItem(u"Ville")
_g2 = EndGroup(u"")
g3 = BeginGroup(u"").set_pos(col=3)
fixed_phone = StringItem(u"Tél fixe")
mobile_phone = StringItem(u"Tél mobile")
reference=StringItem(u"Réference")
authority_number=StringItem(u"Numéro administratif")
date_added=DateTimeItem(u"Date insertion")
_g3 = EndGroup(u"")
g4 = BeginGroup(u"")
notes=TextItem(u"Remarques")
_g4 = EndGroup(u"")
def loadPatient(self,p):
self.name=p.name
self.firstname=p.firstname
self.birth_date = p.birth_date
#sex = ChoiceItem(u"Sexe",("Masculin", "Feminin"))
self.adress = p.adress
self.zip_code = p.zip_code
self.city = p.city
self.fixed_phone = p.fixed_phone
self.mobile_phone = p.mobile_phone
self.reference=p.reference
self.authority_number=p.authority_number
self.notes=p.notes
#self.date_added=date(2012,05,12)
def test2():
app=QApplication(sys.argv)
f= DataSetEditGroupBox("Standard dataset", PatientWidget,
comment='')
w=QWidget()
layout = QVBoxLayout()
layout.addWidget(f)
w.setLayout(layout)
p=getPatient(id=2)
print app
w.show()
sys.exit(app.exec_())
if __name__ == "__main__":
test2()
I try to use guidata with PySide, my code works perfectly with PyQt4.
cons but when I change:
from PyQt4.QtCore import * -> from PyQt4.QtCore import *
from PyQt4.QtGui import * -> from PyQt4.QtGui import *
an error message appears:
TypeError: 'PySide.QtGui.QBoxLayout.addWidget' called with wrong
argument types:
PySide.QtGui.QBoxLayout.addWidget(DataSetEditGroupBox)
Supported signatures:
PySide.QtGui.QBoxLayout.addWidget(PySide.QtGui.QWidget, int = 0,
PySide.QtCore.Qt.Alignment = 0)"
this is my code
-------------------------------------------------------------------
# -*- coding: utf-8 -*-
from PySide.QtCore import *
from PySide.QtGui import *
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker,relationship
from datetime import *
import pickle
import guidata
from defineClasses import *
from guidata.dataset.qtwidgets import DataSetShowGroupBox,
DataSetEditGroupBox
from guidata.dataset.datatypes import ( DataSet, BeginGroup, EndGroup,
ValueProp)
from guidata.dataset.dataitems import (BoolItem, FloatItem,
StringItem, DateItem,ChoiceItem,TextItem ,DateTimeItem)
import sys, os
class PatientWidget(DataSet):
"""
displays Patient data
"""
g1 = BeginGroup(u"")
name=StringItem(u"Nom")
firstname=StringItem(u"Prénom")
sex = ChoiceItem(u"Sexe",("Masculin", "Feminin"))
birth_date = DateItem(u"Date de naissance")
_g1 = EndGroup(u"")
g2 = BeginGroup(u"").set_pos(col=1)
adress = StringItem(u"Adresse")
zip_code = StringItem(u"Code postal")
city = StringItem(u"Ville")
_g2 = EndGroup(u"")
g3 = BeginGroup(u"").set_pos(col=3)
fixed_phone = StringItem(u"Tél fixe")
mobile_phone = StringItem(u"Tél mobile")
reference=StringItem(u"Réference")
authority_number=StringItem(u"Numéro administratif")
date_added=DateTimeItem(u"Date insertion")
_g3 = EndGroup(u"")
g4 = BeginGroup(u"")
notes=TextItem(u"Remarques")
_g4 = EndGroup(u"")
def loadPatient(self,p):
self.name=p.name
self.firstname=p.firstname
self.birth_date = p.birth_date
#sex = ChoiceItem(u"Sexe",("Masculin", "Feminin"))
self.adress = p.adress
self.zip_code = p.zip_code
self.city = p.city
self.fixed_phone = p.fixed_phone
self.mobile_phone = p.mobile_phone
self.reference=p.reference
self.authority_number=p.authority_number
self.notes=p.notes
#self.date_added=date(2012,05,12)
def test2():
app=QApplication(sys.argv)
f= DataSetEditGroupBox("Standard dataset", PatientWidget,
comment='')
w=QWidget()
layout = QVBoxLayout()
layout.addWidget(f)
w.setLayout(layout)
p=getPatient(id=2)
print app
w.show()
sys.exit(app.exec_())
if __name__ == "__main__":
test2()