[Python] domanda

Stefano Cerbioni stfn77 a gmail.com
Gio 19 Apr 2012 18:40:29 CEST


scusate  ,  non riesco a capie  come risolvere  questo problema mi da 
come  errore  nella linea 163
attributeerror: ui_ftpeo object has no attribute 'tr'

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'ftpeo.ui'
#
# Created: Sat Apr 14 22:40:09 2012
#      by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

try:
     _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
     _fromUtf8 = lambda s: s

class Ui_FtpeO(object):
     def setupUi(self, FtpeO):
         FtpeO.setObjectName(_fromUtf8("FtpeO"))
         FtpeO.resize(622, 594)
         FtpeO.setWindowTitle(QtGui.QApplication.translate("FtpeO", 
"FtpeO", None, QtGui.QApplication.UnicodeUTF8))
         icon = QtGui.QIcon()
         
icon.addPixmap(QtGui.QPixmap(_fromUtf8("://ftpeo/icone/lion-icon.png")), 
QtGui.QIcon.Normal, QtGui.QIcon.Off)
         FtpeO.setWindowIcon(icon)
         FtpeO.setAutoFillBackground(False)
         FtpeO.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
         self.centralwidget = QtGui.QWidget(FtpeO)
         self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
         self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget)
         self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
         self.lineEdit = QtGui.QLineEdit(self.centralwidget)
         self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
         self.gridLayout_2.addWidget(self.lineEdit, 0, 0, 1, 3)

         self.pushButton_3 = QtGui.QPushButton(self.centralwidget)
         
self.pushButton_3.setToolTip(QtGui.QApplication.translate("FtpeO", 
"Carica i file da uplodare si devono \n"
"chiamare perforza Slide1.jpg", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton_3.setText(QtGui.QApplication.translate("FtpeO", 
"Carica", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))



         self.gridLayout_2.addWidget(self.pushButton_3, 0, 3, 1, 1)
         self.lineEdit_2 = QtGui.QLineEdit(self.centralwidget)
         self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2"))
         self.gridLayout_2.addWidget(self.lineEdit_2, 1, 0, 1, 3)
         self.pushButton_4 = QtGui.QPushButton(self.centralwidget)
         
self.pushButton_4.setToolTip(QtGui.QApplication.translate("FtpeO", 
"Carica i file da uplodare si devono \n"
"chiamare perforza Slide2.jpg", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton_4.setText(QtGui.QApplication.translate("FtpeO", 
"Carica", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton_4.setObjectName(_fromUtf8("pushButton_4"))
         self.gridLayout_2.addWidget(self.pushButton_4, 1, 3, 1, 1)
         self.lineEdit_3 = QtGui.QLineEdit(self.centralwidget)
         self.lineEdit_3.setObjectName(_fromUtf8("lineEdit_3"))
         self.gridLayout_2.addWidget(self.lineEdit_3, 2, 0, 1, 3)
         self.pushButton_5 = QtGui.QPushButton(self.centralwidget)
         
self.pushButton_5.setToolTip(QtGui.QApplication.translate("FtpeO", 
"Carica i file da uplodare si devono \n"
"chiamare perforza Slide3.jpg", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton_5.setText(QtGui.QApplication.translate("FtpeO", 
"Carica", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton_5.setObjectName(_fromUtf8("pushButton_5"))
         self.gridLayout_2.addWidget(self.pushButton_5, 2, 3, 1, 1)
         self.comboBox = QtGui.QComboBox(self.centralwidget)
         self.comboBox.setToolTip(QtGui.QApplication.translate("FtpeO", 
"Seleziona il Drive", None, QtGui.QApplication.UnicodeUTF8))
         self.comboBox.setObjectName(_fromUtf8("comboBox"))
         self.gridLayout_2.addWidget(self.comboBox, 3, 2, 1, 1)
         self.treeWidget = QtGui.QTreeWidget(self.centralwidget)
         self.treeWidget.setObjectName(_fromUtf8("treeWidget"))
         self.treeWidget.headerItem().setText(0, 
QtGui.QApplication.translate("FtpeO", "Nome", None, 
QtGui.QApplication.UnicodeUTF8))
         self.treeWidget.headerItem().setText(1, 
QtGui.QApplication.translate("FtpeO", "Dimensioni", None, 
QtGui.QApplication.UnicodeUTF8))
         self.treeWidget.headerItem().setText(2, 
QtGui.QApplication.translate("FtpeO", "Permessi", None, 
QtGui.QApplication.UnicodeUTF8))
         self.gridLayout_2.addWidget(self.treeWidget, 4, 0, 1, 1)
         self.gridLayout = QtGui.QGridLayout()
         self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
         self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
         
self.pushButton_2.setToolTip(QtGui.QApplication.translate("FtpeO", 
"Trasferisci File da Server a Pc", None, QtGui.QApplication.UnicodeUTF8))
         icon1 = QtGui.QIcon()
         
icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/ftpeo/icone/areao43/scalable/actions/forward.svg")), 
QtGui.QIcon.Normal, QtGui.QIcon.Off)
         self.pushButton_2.setIcon(icon1)
         self.pushButton_2.setShortcut(_fromUtf8("Right"))
         self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
         self.gridLayout.addWidget(self.pushButton_2, 0, 0, 1, 1)
         self.pushButton = QtGui.QPushButton(self.centralwidget)
         
self.pushButton.setToolTip(QtGui.QApplication.translate("FtpeO", 
"Trasferisci File da Pc a Server", None, QtGui.QApplication.UnicodeUTF8))
         icon2 = QtGui.QIcon()
         
icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/ftpeo/icone/areao43/scalable/actions/back.svg")), 
QtGui.QIcon.Normal, QtGui.QIcon.Off)
         self.pushButton.setIcon(icon2)
         
self.pushButton.setShortcut(QtGui.QApplication.translate("FtpeO", 
"Left", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton.setObjectName(_fromUtf8("pushButton"))
         self.gridLayout.addWidget(self.pushButton, 1, 0, 1, 1)
         self.pushButton_7 = QtGui.QPushButton(self.centralwidget)
         
self.pushButton_7.setToolTip(QtGui.QApplication.translate("FtpeO", 
"Cancella File", None, QtGui.QApplication.UnicodeUTF8))
         icon3 = QtGui.QIcon()
         
icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/ftpeo/icone/areao43/scalable/actions/editclear.svg")), 
QtGui.QIcon.Normal, QtGui.QIcon.Off)
         self.pushButton_7.setIcon(icon3)
         
self.pushButton_7.setShortcut(QtGui.QApplication.translate("FtpeO", 
"Del", None, QtGui.QApplication.UnicodeUTF8))
         self.pushButton_7.setObjectName(_fromUtf8("pushButton_7"))
         self.gridLayout.addWidget(self.pushButton_7, 2, 0, 1, 1)
         self.gridLayout_2.addLayout(self.gridLayout, 4, 1, 1, 1)
         self.treeWidget_2 = QtGui.QTreeWidget(self.centralwidget)
         self.treeWidget_2.setObjectName(_fromUtf8("treeWidget_2"))
         self.treeWidget_2.headerItem().setText(0, 
QtGui.QApplication.translate("FtpeO", "Nome", None, 
QtGui.QApplication.UnicodeUTF8))
         self.treeWidget_2.headerItem().setText(1, 
QtGui.QApplication.translate("FtpeO", "Dimensioni", None, 
QtGui.QApplication.UnicodeUTF8))
         self.treeWidget_2.headerItem().setText(2, 
QtGui.QApplication.translate("FtpeO", "Permessi", None, 
QtGui.QApplication.UnicodeUTF8))
         self.gridLayout_2.addWidget(self.treeWidget_2, 4, 2, 1, 2)
         FtpeO.setCentralWidget(self.centralwidget)
         self.menubar = QtGui.QMenuBar(FtpeO)
         self.menubar.setGeometry(QtCore.QRect(0, 0, 622, 25))
         self.menubar.setObjectName(_fromUtf8("menubar"))
         self.menuFile = QtGui.QMenu(self.menubar)
         self.menuFile.setTitle(QtGui.QApplication.translate("FtpeO", 
"File", None, QtGui.QApplication.UnicodeUTF8))
         self.menuFile.setObjectName(_fromUtf8("menuFile"))
         self.menuHelp = QtGui.QMenu(self.menubar)
         self.menuHelp.setTitle(QtGui.QApplication.translate("FtpeO", 
"Help", None, QtGui.QApplication.UnicodeUTF8))
         self.menuHelp.setObjectName(_fromUtf8("menuHelp"))
         FtpeO.setMenuBar(self.menubar)
         self.statusbar = QtGui.QStatusBar(FtpeO)
         self.statusbar.setObjectName(_fromUtf8("statusbar"))
         FtpeO.setStatusBar(self.statusbar)
         self.actionDisconnetti = QtGui.QAction(FtpeO)
         
self.actionDisconnetti.setText(QtGui.QApplication.translate("FtpeO", 
"Connetti", None, QtGui.QApplication.UnicodeUTF8))
         
self.actionDisconnetti.setObjectName(_fromUtf8("actionDisconnetti"))
         self.actionDisconnetti_2 = QtGui.QAction(FtpeO)
         
self.actionDisconnetti_2.setText(QtGui.QApplication.translate("FtpeO", 
"Disconnetti", None, QtGui.QApplication.UnicodeUTF8))
         
self.actionDisconnetti_2.setObjectName(_fromUtf8("actionDisconnetti_2"))
         self.actionEsci = QtGui.QAction(FtpeO)
         self.actionEsci.setText(QtGui.QApplication.translate("FtpeO", 
"Esci", None, QtGui.QApplication.UnicodeUTF8))
         
self.actionEsci.setShortcut(QtGui.QApplication.translate("FtpeO", 
"Ctrl+Q", None, QtGui.QApplication.UnicodeUTF8))
         self.actionEsci.setObjectName(_fromUtf8("actionEsci"))
         self.actionInfo = QtGui.QAction(FtpeO)
         self.actionInfo.setText(QtGui.QApplication.translate("FtpeO", 
"Info", None, QtGui.QApplication.UnicodeUTF8))
         self.actionInfo.setObjectName(_fromUtf8("actionInfo"))
         self.menuFile.addSeparator()
         self.menuFile.addAction(self.actionDisconnetti)
         self.menuFile.addAction(self.actionDisconnetti_2)
         self.menuFile.addAction(self.actionEsci)
         self.menuHelp.addAction(self.actionInfo)
         self.menubar.addAction(self.menuFile.menuAction())
         self.menubar.addAction(self.menuHelp.menuAction())

         self.retranslateUi(FtpeO)
         QtCore.QObject.connect(self.actionEsci, 
QtCore.SIGNAL(_fromUtf8("activated()")), FtpeO.close)
         QtCore.QObject.connect(self.pushButton_3, 
QtCore.SIGNAL(_fromUtf8("clicked()")), self.openFile)
         QtCore.QMetaObject.connectSlotsByName(FtpeO)
         FtpeO.setTabOrder(self.pushButton_3, self.pushButton_4)
         FtpeO.setTabOrder(self.pushButton_4, self.pushButton_5)
         FtpeO.setTabOrder(self.pushButton_5, self.comboBox)
         FtpeO.setTabOrder(self.comboBox, self.pushButton_2)
         FtpeO.setTabOrder(self.pushButton_2, self.pushButton)
         FtpeO.setTabOrder(self.pushButton, self.pushButton_7)
         FtpeO.setTabOrder(self.pushButton_7, self.treeWidget_2)
         FtpeO.setTabOrder(self.treeWidget_2, self.treeWidget)
         FtpeO.setTabOrder(self.treeWidget, self.lineEdit)
         FtpeO.setTabOrder(self.lineEdit, self.lineEdit_2)
         FtpeO.setTabOrder(self.lineEdit_2, self.lineEdit_3)

     def retranslateUi(self, FtpeO):
         pass

#import FTpeo_qrc


     def openFile(self):
         fName = QtGui.QFileDialog.getOpenFileName(self, "Seleziona un 
file Da Importare", "Open new file", self.tr("All Files (*);;Text Files 
(*txt)"))

         if fName.isEmpty() == False:
                     self.textEdit.append(fName)



if __name__ == "__main__":
     import sys
     app = QtGui.QApplication(sys.argv)
     FtpeO = QtGui.QMainWindow()
     ui = Ui_FtpeO()
     ui.setupUi(FtpeO)
     FtpeO.show()
     sys.exit(app.exec_())




Il 18/04/2012 14:50, Giuseppe Amato ha scritto:
>
>
> 2012/4/18 Stefano Cerbioni <stfn77 a gmail.com <mailto:stfn77 a gmail.com>>
>
>
>     #import FTpeo_qrc
>      def LoadFiles( self ):
>
>
> Il def deve stare uno spazio più indietro. Se non è questo prova a 
> controllare se non hai mischiato spazi e tabulazioni.
>
> -- 
> ----------------------------------------------------------------------
> Giuseppe Amato
> e-mail: giuamato a gmail.com <mailto:giuamato a gmail.com>
>
>
>
> _______________________________________________
> Python mailing list
> Python a lists.python.it
> http://lists.python.it/mailman/listinfo/python

-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.python.it/pipermail/python/attachments/20120419/38d54e68/attachment-0001.html>


Maggiori informazioni sulla lista Python