Hi Detlev,

The attached script shows how a required file is marked as unused with a 
warning.  The warning is 

Warning: "qrc_hi" imported but unused.

However, in line 27 of hi.py the qrc_hi is used, though the reference to it is 
indirect and in a rather obscure format.  I attach the script hi.py, hi.qrc, 
hi.ui and an icon from a  small collection of icons, to enable an  independent 
verification. The XML file hi.qrc shows how the "document-new.png" fits in the 
small package of icons.

The debugger check of unused files and variables has proved itself extremely 
useful, at least for me - I was really surprised how many times I had unused 
variables and files - thank you for such a useful facility!

Regards,
Al.

Attachment: hi.ui
Description: application/designer

#!/usr/bin/env python
# quitter.py - provide a button to quit this "program"

# Copyright (c) 2010-2011 Algis Kabaila. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public Licence as published
# by the Free Software Foundation, either version 2 of the Licence, or
# version 3 of the Licence, or (at your option) any later version. It is
# provided for educational purposes and is distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public Licence for more details.

import sys

from PyQt4.QtGui import QMainWindow, QApplication, QAction, QIcon
#from PySide.QtGui import QMainWindow, QPushButton, QApplication
 
from ui_hi import Ui_MainWindow
import qrc_hi

class MainWindow(QMainWindow, Ui_MainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        iconToolBar = self.addToolBar('') 
        self.action_Hi = QAction(QIcon(":/hi.png"), "&Hi", self)
        iconToolBar.addAction(self.action_Hi)
        self.action_Hi.triggered.connect(self.hi)
        
    def hi(self):
        self.lineEdit.setText(' Hi, Detlev!')
    
if __name__ == '__main__':
    app = QApplication(sys.argv)
    frame = MainWindow()
    frame.show()    
    app.exec_()
    
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file alias="hi.png">select_tango/32x32/actions/document-new.png</file>
</qresource>
</RCC>

<<attachment: document-new.png>>

_______________________________________________
Eric mailing list
[email protected]
http://www.riverbankcomputing.com/mailman/listinfo/eric

Reply via email to