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("C lips")) <----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.minimum SizeHint()))
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("C olumn 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 1 1569
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("C lips")) <----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.minimum SizeHint())) 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("C olumn 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.ht...00000000000000
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095 http://www.jamesstroud.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike Clair |
last post by:
Hey,
I'm having an issue with CSS, JS and the DOM. It's gonna drive me batty. I
am trying to access the properties of a layer in JS which have been
initially set in an external CSS. The problem...
|
by: Viken Karaguesian |
last post by:
Hello all,
It stinks being a newbie! One thing that I'm not sure about with CSS
is: where is the "proper" place to put font attibutes? This has me a
little confused. Take the below style sheet...
|
by: RKT |
last post by:
(Web Developer Express 2005, CSharp, C#)
I've searched high and low...
If have the typical _Default page. In it is a MultiView that contains
another MultiView - in both of those are Views...
|
by: Beorne |
last post by:
In the classes I develop my attributes are always private and are
exposed using properties.
directly or to access the attributes using the properties?
Does "wrapper" setter/getter properties...
|
by: Frank Rizzo |
last post by:
I have an interface which has a bunch of methods defined that all the
inheriting classes will have to implement.
How can I force the inheriting classes to have a class attribute?
Something like...
| |
by: camel |
last post by:
Apologies if foolish question, but I somewhat expected Custom Attributes (i.e.
inheriting from System.Attribute) decorating class properties to come through
via WSDL to the proxy the same as...
|
by: Nathan Sokalski |
last post by:
I have a validator that I wrote by inheriting from BaseValidator. At certain
points in the code, I need to access other controls on the page containing
the validator. I have the IDs of these...
|
by: djsuson |
last post by:
I'm trying to set up an inheritance tree that also uses templates. This is an attempt to simplify some previous code that was filled with redundancies. I'm working with g++ 3.4.6. The code is split...
|
by: nsphelt |
last post by:
I am wondering if it is possible to access the underlying property of a base class within a derived that has overridden that property. I am using VB.NET and when I use the MyBase keyword to access...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |