Peter J. Bismuti wrote: > > How do you access attributes of a class when inheriting from it? Can't you > just say: > > self.attribute? > > Help?! > ....................................................................................................... > #!/usr/bin/python > > from Dialog import Dialog > import enscmd > > class RatDialog(Dialog): > def __init__(self,parent = Dialog,name = "RatDialog",modal = 0,fl = 0): > Dialog.__init__(self) > self.ClipListView.header().setLabel(0,self.__tr("Clips")) <----ERROR > self.ClipListView.clear() > def CloseButton_clicked(self): > self.close() > > .................................................................................... > > from qt import * > > > class Dialog(QDialog): > def __init__(self,parent = None,name = None,modal = 0,fl = 0): > QDialog.__init__(self,parent,name,modal,fl) > > if not name: > self.setName("Dialog") > > > DialogLayout = QGridLayout(self,1,1,11,6,"DialogLayout") > > layout14 = QVBoxLayout(None,0,6,"layout14") > > layout13 = QHBoxLayout(None,0,6,"layout13") > > self.ClipListView = QListView(self,"ClipListView") > self.ClipListView.addColumn(self.__tr("Column 1")) > layout13.addWidget(self.ClipListView) > > self.ClipTextEdit = QTextEdit(self,"ClipTextEdit") > layout13.addWidget(self.ClipTextEdit) > layout14.addLayout(layout13) > > layout10 = QHBoxLayout(None,0,6,"layout10") > > layout9 = QVBoxLayout(None,0,6,"layout9") > > layoutWidth = QHBoxLayout(None,0,6,"layoutWidth") > > self.WidthLabel = QLabel(self,"WidthLabel") > layoutWidth.addWidget(self.WidthLabel) > > self.WidthLineEdit = QLineEdit(self,"WidthLineEdit") > layoutWidth.addWidget(self.WidthLineEdit) > layout9.addLayout(layoutWidth) > > layout5 = QVBoxLayout(None,0,6,"layout5") > > self.OriginLabel = QLabel(self,"OriginLabel") > self.OriginLabel.setAlignment(QLabel.WordBreak | QLabel.AlignCenter) > layout5.addWidget(self.OriginLabel) > > layoutX = QHBoxLayout(None,0,6,"layoutX") > > self.XLabel = QLabel(self,"XLabel") > layoutX.addWidget(self.XLabel) > > self.XLineEdit = QLineEdit(self,"XLineEdit") > layoutX.addWidget(self.XLineEdit) > layout5.addLayout(layoutX) > > layoutY = QHBoxLayout(None,0,6,"layoutY") > > self.YLabel = QLabel(self,"YLabel") > layoutY.addWidget(self.YLabel) > > self.YLineEdit = QLineEdit(self,"YLineEdit") > layoutY.addWidget(self.YLineEdit) > layout5.addLayout(layoutY) > > layoutZ = QHBoxLayout(None,0,6,"layoutZ") > > self.ZLabel = QLabel(self,"ZLabel") > layoutZ.addWidget(self.ZLabel) > > self.ZLineEdit = QLineEdit(self,"ZLineEdit") > layoutZ.addWidget(self.ZLineEdit) > layout5.addLayout(layoutZ) > layout9.addLayout(layout5) > layout10.addLayout(layout9) > > self.ButtonGroup = QButtonGroup(self,"ButtonGroup") > > self.CircleRadioButton = > QRadioButton(self.ButtonGroup,"CircleRadioButton") > self.CircleRadioButton.setGeometry(QRect(20,50,56,21)) > > self.SquareRadioButton = > QRadioButton(self.ButtonGroup,"SquareRadioButton") > self.SquareRadioButton.setGeometry(QRect(20,20,64,21)) > self.SquareRadioButton.setChecked(1) > layout10.addWidget(self.ButtonGroup) > layout14.addLayout(layout10) > > layout11 = QHBoxLayout(None,0,6,"layout11") > > self.NewClipButton = QPushButton(self,"NewClipButton") > layout11.addWidget(self.NewClipButton) > > self.DeleteClipButton = QPushButton(self,"DeleteClipButton") > layout11.addWidget(self.DeleteClipButton) > > self.CloseButton = QPushButton(self,"CloseButton") > layout11.addWidget(self.CloseButton) > layout14.addLayout(layout11) > > DialogLayout.addLayout(layout14,0,0) > > self.languageChange() > > self.resize(QSize(340,427).expandedTo(self.minimumSizeHint())) > self.clearWState(Qt.WState_Polished) > > > self.connect(self.NewClipButton,SIGNAL("clicked()"),self.NewClipButton_clicked) > > self.connect(self.DeleteClipButton,SIGNAL("clicked()"),self.DeleteClipButton_clicked) > > self.connect(self.CloseButton,SIGNAL("clicked()"),self.CloseButton_clicked) > > > def languageChange(self): > self.setCaption(self.__tr("RAT")) > self.ClipListView.header().setLabel(0,self.__tr("Column 1")) > self.ClipListView.clear() > item = QListViewItem(self.ClipListView,None) > item.setText(0,self.__tr("New Item")) > > self.WidthLabel.setText(self.__tr("<b>Width/Radius</b>")) > self.OriginLabel.setText(self.__tr("<b>Origin</b>")) > self.XLabel.setText(self.__tr("<b>X</b>")) > self.YLabel.setText(self.__tr("<b>Y</b>")) > self.ZLabel.setText(self.__tr("<b>Z</b>")) > self.ButtonGroup.setTitle(self.__tr("Clip Type")) > self.CircleRadioButton.setText(self.__tr("Circle")) > self.SquareRadioButton.setText(self.__tr("Square")) > self.NewClipButton.setText(self.__tr("New")) > self.DeleteClipButton.setText(self.__tr("Delete")) > self.CloseButton.setText(self.__tr("Close")) > > > def NewClipButton_clicked(self): > print "Dialog.NewClipButton_clicked(): Not implemented yet" > > def DeleteClipButton_clicked(self): > print "Dialog.DeleteClipButton_clicked(): Not implemented yet" > > def CloseButton_clicked(self): > print "Dialog.CloseButton_clicked(): Not implemented yet" > > def __tr(self,s,c = None): > return qApp
the __tr() method of Dialog becomes name-mangled in descendents to _Dialog__tr. See http://docs.python.org/tut/node11.html#SECTION0011600000000000000000 James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list