Mail System Error - Returned Mail
*** WARNING ** This message has been scanned by MDaemon AntiVirus and was found to contain infected attachment(s). Please review the list below. AttachmentVirus name Action taken -- Document.scr ??? Removed ** The original message was received at Fri, 20 May 2005 17:15:33 +0700 from indomaret.co.id [178.88.246.140] - The following addresses had permanent fatal errors - -- http://mail.python.org/mailman/listinfo/python-list
removing row from table. PyQT
I'm trying to remove the selected rows from the table,
but it's not working, i've tried many ways, don't know what I'm missing.
code below:
class MonitorUi(QWidget):
def __init__(self,parent = None):
QWidget.__init__(self,parent)
self._initalTable =
[["none","none","none"],["none","none","none"],["none","none","none"]]
self.lista=""
self.headerH =
["Id","UserName","Engine","Proj","FileToRender","StartFrame","EndFrame","Packets","Skip","Attr","Status"]
self.setWindowTitle("RenderMonitor")
self.setGeometry(150,150,1000,500)
self.setWindowIcon(QIcon('monkey.png'))
timer = QTimer(self)
self.ItemEdit = QLineEdit()
self.buttonRemove = QPushButton("remove")
self.buttonRende = QPushButton("Rende!")
self.tableWidget = QTableWidget(1000,11)
layoutH = QHBoxLayout()
layoutH.addWidget(self.ItemEdit)
#layoutH.addStretch(1)
layoutH.addWidget(self.buttonRemove)
layoutH.addWidget(self.buttonRende)
layoutV = QVBoxLayout()
layoutV.addLayout(layoutH)
layoutV.addWidget(self.tableWidget)
self.setLayout(layoutV)
self.connect(self.buttonRemove, SIGNAL("clicked()"), self.remove)
self.connect(self.buttonRende, SIGNAL("clicked()"),
self.MsgServerRender)
timer.start(1000)
QObject.connect(timer, SIGNAL("timeout()"), self.displayTable)
def setDataBridge(self,dataInst):
self.lista = dataInst
def clearTable(self):
self.tableWidget.clear()
def remove(self):
print "removendo da tabela"
#self.tableWidget.removeRow(self.tableView.selectedIndexes())
self.tableWidget.removeRow(self.tableWidget.selectedRows)
#self.mapper.toNext()
#self.tableView.selectRow(self.mapper.currentIndex())
def MsgServerRender(self):
sender = ClientMsgRender()
sender.sendTo("run")
def displayTable(self):
print "display table"
self.tableWidget.setHorizontalHeaderLabels(self.headerH)
self.headerV=[]
list2= self.lista.getInfo()
item = 0
linha = 0
while item < len(list2):
#self.tableWidget = QTableWidget(item,9)
self.headerV.append(("job" + str(item)))
elemento = 0
coluna = 0
while elemento < 11 :
str(list2[item][elemento])
NewTableitem = QTableWidgetItem(list2[item][elemento])
#NewTableitem.setFlags(Qt.ItemIsSelectable |
Qt.ItemIsEnabled )#no editable item
#NewTableitem.setFlags(Qt.ItemIsEnabled )#no editable item
self.tableWidget.setItem(linha,coluna, NewTableitem)
elemento += 1
coluna += 1
item += 1
linha += 1
self.tableWidget.setVerticalHeaderLabels(self.headerV)
--
http://mail.python.org/mailman/listinfo/python-list
folks, what's wrong with this?
Hi All: I am just a beginner in python. Can anyone please tell me what is wrong with this piece of code? import copy class BaseDummyObject(object): def __init__(self): pass def __getattr__(self, item): try: return self.__dict__.__getitem__(item) except KeyError: print "Attribute Error: attr %s of class %s non-existent!" %(item, self.__class__.__name__) class DummyObject(BaseDummyObject): pass def main(): bar = 3 obj = DummyObject() obj.foo = bar obj.me = obj newobj = copy.deepcopy(obj) if __name__ == "__main__": main() So when I do this, I get: Attribute Error: attr __deepcopy__ of class DummyObject non-existent! Attribute Error: attr __getnewargs__ of class DummyObject non- existent! Traceback (most recent call last): File "C:\Workspace\QA3.0\Python_Lib\Mobidia\RemoteManager \test_code.py", line 39, in main() File "C:\Workspace\QA3.0\Python_Lib\Mobidia\RemoteManager \test_code.py", line 30, in main newobj = copy.deepcopy(obj) File "C:\Python26\lib\copy.py", line 181, in deepcopy rv = reductor(2) TypeError: 'NoneType' object is not callable Any help will be really appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Re: folks, what's wrong with this?
On Apr 1, 12:10 pm, Robert Kern wrote: > On 2010-04-01 13:56 PM, Ani wrote: > > > > > Hi All: > > > I am just a beginner in python. Can anyone please tell me what is > > wrong with this piece of code? > > > import copy > > class BaseDummyObject(object): > > > def __init__(self): > > pass > > > def __getattr__(self, item): > > try: > > return self.__dict__.__getitem__(item) > > except KeyError: > > print "Attribute Error: attr %s of class %s non-existent!" > > %(item, > > > self.__class__.__name__) > > You need to raise an AttributeError here. Otherwise, it implicitly returns > None > for all attributes not in the __dict__ and thus confusing the copy.deepcopy() > code. > Thanks Robert. So I raised the exception and now everything looks good. So what's happening here? When a certain attribute is not available in the __dict__ and an exception is raised, who's catching it? Ani -- http://mail.python.org/mailman/listinfo/python-list
Re: folks, what's wrong with this?
> And now for the most import point: __getattr__ is only called as a > *last* resort. That is, after the attribute lookup mechanism will have > tried *and failed* to find the name in the instance's __dict__. Thanks you all for all the suggestions and thoughts. So in other words, this piece of code: try: return self.__dict__.__getitem__(item) except KeyError: raise AttributeError(item) in __getattr__ is redundant. -- http://mail.python.org/mailman/listinfo/python-list
