[PyKDE] Qtranslator problems w/ setAccel

stuff at mailzilla.net stuff at mailzilla.net
Wed Jan 7 20:00:01 GMT 2004


To followup on the problem I reported earlier, I've provided the pyuic 
generated main.py module as an attachment.  I've modified the __tr() 
method to print it's arguments. 

Output of executing test.py is now this:

$ python test.py
__tr(MainWindow, None)
__tr(New, None)
__tr(&New, None)
__tr(Ctrl+N, None)
Fatal Python error: PyEval_SaveThread: NULL tstate
Aborted


The __tr(Ctrl+N, None) line is a result of the setAccel() method in 
the MainWindow class.  Commenting out this line (and all other setAccel 
lines) and things work as they should.  However, with the pyuic generated 
code (where the setAccel() method invokes the __tr() method), the 
application crashes as indicated by the above output.  

I've confirmed this behavior on Windows and Linux (Redhat 9.0) using the 
PyQt distribution included with BlackAdder.  On my linux box:

>>> from qt import *
>>> PYQT_VERSION_STR
'3.8'
>>> QT_VERSION_STR
'3.2.2'


Interestingly, if I modify the __tr() method to simply return it's first 
argument (return s) the output is now:

$ python test.py
__tr(MainWindow, None)
__tr(New, None)
__tr(&New, None)
__tr(Ctrl+N, None)
Traceback (most recent call last):
  File "test.py", line 11, in ?
    m = MainWindow()
  File "main.py", line 587, in __init__
    self.languageChange()
  File "main.py", line 613, in languageChange
    self.fileNewAction.setAccel(self.__tr("Ctrl+N"))
TypeError: Argument 1 of QAction.setAccel() has an invalid type

I would appreciate it if someone could run the test.py script to see if it 
works on their version of PyQt/Qt.  Perhaps this problem has been fixed in 
a more recent version of either package (I did glance at the change log 
for PyQt but did not see anything pertinent).

Thank you,

Phil
-------------- next part --------------
from qt import *
from main import MainWindow
import sys

app = QApplication(sys.argv)

translator = QTranslator(app)

app.installTranslator(translator)

m = MainWindow()

app.setMainWidget(m)
m.show()
app.exec_loop()
-------------- next part --------------
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file '/home/phil/work/translator/main.ui'
#
# Created: Wed Jan 7 07:14:29 2004
#      by: The PyQt User Interface Compiler (pyuic) 3.8
#
# WARNING! All changes made in this file will be lost!


from qt import *

image0_data = [
"22 22 7 1",
". c None",
"# c #000000",
"b c #292c29",
"c c #5a5d5a",
"d c #838583",
"e c #c5c2c5",
"a c #ffffff",
"......................",
"....##########........",
"....#aaaaaaa#b#.......",
"....#aaaaaaa#cb#......",
"....#aaaaaaa#dcb#.....",
"....#aaaaaaa#edcb#....",
"....#aaaaaaa#aedcb#...",
"....#aaaaaaa#######...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....###############...",
"......................",
"......................"
]
image1_data = [
"22 22 5 1",
". c None",
"# c #000000",
"c c #838100",
"a c #ffff00",
"b c #ffffff",
"......................",
"......................",
"......................",
"............####....#.",
"...........#....##.##.",
"..................###.",
".................####.",
".####...........#####.",
"#abab##########.......",
"#babababababab#.......",
"#ababababababa#.......",
"#babababababab#.......",
"#ababab###############",
"#babab##cccccccccccc##",
"#abab##cccccccccccc##.",
"#bab##cccccccccccc##..",
"#ab##cccccccccccc##...",
"#b##cccccccccccc##....",
"###cccccccccccc##.....",
"##cccccccccccc##......",
"###############.......",
"......................"
]
image2_data = [
"22 22 5 1",
". c None",
"# c #000000",
"a c #838100",
"b c #c5c2c5",
"c c #cdb6d5",
"......................",
".####################.",
".#aa#bbbbbbbbbbbb#bb#.",
".#aa#bbbbbbbbbbbb#bb#.",
".#aa#bbbbbbbbbcbb####.",
".#aa#bbbccbbbbbbb#aa#.",
".#aa#bbbccbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aaa############aaa#.",
".#aaaaaaaaaaaaaaaaaa#.",
".#aaaaaaaaaaaaaaaaaa#.",
".#aaa#############aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
"..##################..",
"......................"
]
image3_data = [
"22 22 88 2",
"Qt c None",
".2 c #000000",
".S c #08ff08",
"#v c #100810",
".U c #101010",
"#c c #101018",
".M c #181018",
"#e c #181818",
".A c #181820",
".L c #201820",
"#l c #202020",
".z c #202029",
"#m c #292029",
"#u c #292829",
"#n c #292831",
".R c #29ff29",
"#o c #312831",
".T c #313031",
"#p c #313039",
".Z c #31ff31",
"#q c #393039",
"#t c #393839",
".y c #393841",
"#s c #413841",
".o c #414041",
"#h c #4a4852",
".n c #5a505a",
"#r c #5a5962",
".I c #5ace5a",
"#b c #6a616a",
".p c #6a696a",
".x c #6a6973",
".Y c #6aff62",
".l c #736973",
".t c #7b717b",
".s c #7b7183",
".0 c #7bff7b",
".r c #837983",
".u c #83798b",
"#g c #83858b",
".v c #8b7994",
"#i c #8b858b",
".w c #8b8594",
"#j c #8b8d8b",
".8 c #8b8d94",
".m c #948d94",
"#k c #948d9c",
"#f c #949594",
".q c #94959c",
".J c #94c694",
"#d c #9c959c",
"#a c #9c95a4",
".k c #9c9d9c",
".N c #9c9da4",
".H c #9ccea4",
".K c #a49da4",
"#. c #a49dac",
".i c #a4a5a4",
".3 c #a4a5ac",
"## c #ac9dac",
".V c #aca5ac",
".d c #acaeac",
".j c #acaeb4",
".9 c #b4aeb4",
".# c #b4b6b4",
".a c #bdbebd",
".7 c #bdd6bd",
".c c #c5c6c5",
".5 c #cdc6cd",
".b c #cdcecd",
".4 c #cdced5",
".F c #d5ced5",
".G c #d5cede",
".h c #d5d6d5",
".E c #d5d6de",
".Q c #d5ffd5",
".B c #ded6de",
".1 c #ded6e6",
".g c #dedede",
".D c #dedee6",
".6 c #e6dee6",
".f c #e6e6e6",
".C c #e6e6ee",
".X c #e6ffe6",
".O c #eee6ee",
".e c #eeeeee",
".W c #f6f6f6",
".P c #ffffff",
"QtQtQtQtQtQt.#.a.b.b.b.b.c.c.a.a.d.aQtQtQtQt",
"QtQtQtQtQtQt.a.e.f.f.f.f.f.e.e.e.g.aQtQtQtQt",
"QtQtQtQtQtQt.a.c.c.c.b.b.c.c.c.c.a.cQtQtQtQt",
"QtQtQtQtQtQt.#.a.a.a.a.#.a.a.#.#.d.aQtQtQtQt",
"QtQtQtQtQt.c.d.c.a.c.c.c.a.a.a.c.#QtQtQtQtQt",
"QtQtQtQtQt.a.a.#.a.a.a.a.a.a.c.c.#QtQtQtQtQt",
"QtQtQtQtQt.a.#.c.a.a.a.a.a.c.a.c.dQtQtQtQtQt",
"QtQtQtQtQt.c.a.a.a.a.a.a.a.a.a.a.#QtQtQtQtQt",
"QtQtQtQtQt.d.b.f.g.g.g.g.g.g.h.g.i.i.jQtQtQt",
"QtQtQt.a.k.l.#.h.b.h.b.h.b.h.g.g.m.n.o.p.#Qt",
"QtQt.a.q.r.s.t.t.t.t.t.t.t.u.v.w.x.y.z.A.o.i",
"Qt.a.k.B.C.D.B.E.E.E.E.F.G.H.I.J.K.o.L.L.M.y",
".a.N.O.P.P.P.P.P.P.P.P.P.Q.R.S.R.b.v.T.A.U.L",
".V.W.P.P.P.P.P.P.P.P.P.P.X.Y.Z.0.P.1.t.A.2.L",
".3.E.4.5.4.h.E.E.g.6.D.B.D.E.7.F.4.5.8.M.2.A",
".m.9.j.V.3#..3.K#.#..i#..K#.###a.q.8#b#c.2.L",
".m.j.j#..3.K.K.K.N.K.N.N.N.N#a#d#d.w#b#c.2#e",
"#f#.#..K.N.K.N.N.N#a.k#a#d#d#d#a.m#g#b.M.2#h",
".m.3.K.K#a.k#a#d#a.k#a#d#a#d.q.m.8#i.x#c#e.d",
"#f#g#i.w#j.w#i.8.w#i.8.8.m.8.m#k.8.w#b#e#fQt",
".#.l.z.A#l.z#m#m#m#n#o#o#p#p#q#q#p#o#p#fQtQt",
"QtQt.d#r#s#s#t#p.T.T.T#u#u.z#e#e#v.o.kQtQtQt"
]
image4_data = [
"22 22 3 1",
". c None",
"# c #000083",
"a c #838183",
"......................",
"......................",
"......................",
"......................",
"......................",
"...........######a....",
"..#......##########...",
"..##...####......##a..",
"..###.###.........##..",
"..######..........##..",
"..#####...........##..",
"..######..........##..",
"..#######.........##..",
"..########.......##a..",
"...............a###...",
"...............###....",
"......................",
"......................",
"......................",
"......................",
"......................",
"......................"
]
image5_data = [
"22 22 3 1",
". c None",
"a c #000083",
"# c #838183",
"......................",
"......................",
"......................",
"......................",
"......................",
"....#aaaaaa...........",
"...aaaaaaaaaa......a..",
"..#aa......aaaa...aa..",
"..aa.........aaa.aaa..",
"..aa..........aaaaaa..",
"..aa...........aaaaa..",
"..aa..........aaaaaa..",
"..aa.........aaaaaaa..",
"..#aa.......aaaaaaaa..",
"...aaa#...............",
"....aaa...............",
"......................",
"......................",
"......................",
"......................",
"......................",
"......................"
]
image6_data = [
"22 22 3 1",
". c None",
"# c #000000",
"a c #000083",
"......................",
".......#.....#........",
".......#.....#........",
".......#.....#........",
".......#....##........",
".......##...#.........",
"........#...#.........",
"........##.##.........",
".........###..........",
".........###..........",
"..........#...........",
".........a#a..........",
"........aa.aaa........",
".......a.a.a..a.......",
"......a..a.a...a......",
".....a...a.a....a.....",
"....a....a.a....a.....",
"....a....a..a...a.....",
"....a....a..a..a......",
"....a...a....aa.......",
".....aaa..............",
"......................"
]
image7_data = [
"22 22 6 1",
". c None",
"# c #000000",
"b c #000083",
"c c #393cff",
"d c #8b89ff",
"a c #ffffff",
"......................",
"......................",
"########..............",
"#aaaaaa##.............",
"#a####a#a#............",
"#aaaaaa#aa#...........",
"#a####a#bbbbbbbb......",
"#aaaaaa#baaaaaabb.....",
"#a#####aba####abcb....",
"#aaaaaaabaaaaaabdcb...",
"#a#####aba####abadcb..",
"#aaaaaaabaaaaaabbbbbb.",
"#a#####aba####aaaaaab.",
"#aaaaaaabaaaaaaaaaaab.",
"#a#####aba#########ab.",
"#aaaaaaabaaaaaaaaaaab.",
"########ba#########ab.",
"........baaaaaaaaaaab.",
"........ba#########ab.",
"........baaaaaaaaaaab.",
"........bbbbbbbbbbbbb.",
"......................"
]
image8_data = [
"22 22 8 1",
". c None",
"# c #000000",
"e c #000083",
"c c #838100",
"b c #838183",
"d c #c5c2c5",
"a c #ffff00",
"f c #ffffff",
"......................",
".......#####..........",
"..######aaa######.....",
".######aaaaa######....",
"##bcb##a###a##bcb##...",
"#bcb#ddddddddd#bcb#...",
"#cbc#ddddddddd#cbc#...",
"#bcb###########bcb#...",
"#cbcbcbcbcbcbcbcbc#...",
"#bcbcbcbcbcbcbcbcb#...",
"#cbcbcbceeeeeeeeee#...",
"#bcbcbcbefffffffefe...",
"#cbcbcbcefeeeeefeffe..",
"#bcbcbcbefffffffefffe.",
"#cbcbcbcefeeeeefeffffe",
"#bcbcbcbefffffffeeeeee",
"#cbcbcbcefeeeeeffffffe",
"#bcbcbcbeffffffffffffe",
"#cbcbcbcefeeeeeeeeeefe",
".#######effffffffffffe",
"........eeeeeeeeeeeeee",
"......................"
]
image9_data = [
"22 22 106 2",
"Qt c None",
"#N c #202020",
"#J c #292829",
"#K c #393839",
"#M c #414041",
".m c #5a595a",
"#r c #5a716a",
"#A c #5a9d83",
"#B c #626162",
".N c #62696a",
"#G c #62716a",
"#v c #62ae8b",
"#H c #6a696a",
".c c #6a7173",
"#D c #6a7973",
".l c #6a797b",
".W c #6a857b",
".t c #6a8d7b",
"#x c #6a9583",
"#w c #6aae94",
".u c #737173",
".v c #737973",
".g c #73797b",
".D c #738d83",
".7 c #739583",
"#d c #73958b",
"#z c #73a59c",
"#p c #73b694",
"#o c #73be9c",
".b c #7b797b",
".O c #7b8583",
"#a c #7bae94",
"#q c #7bae9c",
"#i c #7bb69c",
".5 c #7bbe9c",
"#b c #7bbea4",
"#h c #7bc69c",
"#y c #7bc6a4",
".8 c #838583",
".4 c #8385b4",
".h c #839d94",
"#n c #83a5ac",
".V c #83aea4",
"#E c #83b69c",
"#F c #83b6a4",
"#j c #83bea4",
"#t c #83c6a4",
"#l c #83ceac",
".E c #8b8d8b",
"#g c #8b8dbd",
"## c #8b95b4",
"#m c #8baebd",
"#c c #8bb6a4",
".L c #8bc6ac",
".T c #8bceac",
"#f c #8bceb4",
".a c #949594",
".n c #94a59c",
"#u c #94a5cd",
".k c #94beac",
".M c #94c6ac",
".6 c #94c6b4",
".B c #94ceb4",
".1 c #94d6b4",
".C c #94d6bd",
".9 c #94debd",
".K c #9c95d5",
".d c #9c9d9c",
".w c #9cbeb4",
"#. c #9cbed5",
"#s c #9ccebd",
".2 c #9ccecd",
".0 c #9cdebd",
".S c #9ce6bd",
".Z c #9ce6c5",
".U c #a495de",
"#L c #a4a5a4",
".A c #a4b6de",
".3 c #a4b6ee",
".I c #a4cecd",
"#k c #a4dec5",
".s c #a4e6c5",
".f c #acaeac",
".J c #acaeee",
".R c #acb6de",
".i c #accec5",
".P c #acd6c5",
".j c #acdecd",
"#e c #ace6cd",
".# c #b4b6b4",
".H c #b4bede",
".Q c #b4dede",
".r c #b4eed5",
".e c #bdbebd",
".z c #bdc6f6",
".y c #bdd6ff",
".X c #bde6d5",
".q c #bdeede",
".Y c #bdf6de",
"#I c #c5c6c5",
".x c #c5def6",
".p c #c5f6e6",
"#C c #cdd6cd",
".G c #cddeff",
".o c #cdffee",
".F c #d5fff6",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
"QtQtQt.#.a.b.c.c.b.d.eQtQtQtQtQtQtQtQtQtQtQt",
"QtQt.f.g.h.i.j.j.k.l.b.#QtQtQtQtQtQtQtQtQtQt",
"Qt.f.m.n.o.o.p.q.r.s.t.u.eQtQtQtQtQtQtQtQtQt",
".e.v.w.q.p.x.y.z.A.B.C.D.EQtQtQtQtQtQtQtQtQt",
".d.h.F.q.G.H.I.I.J.K.L.M.N.#QtQtQtQtQtQtQtQt",
".O.P.o.Q.R.B.S.T.A.U.V.B.W.dQtQtQtQtQtQtQtQt",
".g.X.Y.Z.Z.0.1.2.3.4.5.6.7.8QtQtQtQtQtQtQtQt",
".g.j.r.0.9.1#..3###a#b#c#d.8QtQtQtQtQtQtQtQt",
".v.P#e.1.1#f.A#g.5#h#i#j.W.EQtQtQtQtQtQtQtQt",
".E#c#k#f.L#l#m#n#o#p#p#q#r.fQtQtQtQtQtQtQtQt",
".f.g#s#t#t#b#u.4#v#w#w#x.u.eQtQtQtQtQtQtQtQt",
"Qt.E.t#y#b.5#z#d#p#A#A#B.d#C.f.eQtQtQtQtQtQt",
"Qt.e.b#D#E#F#j#i#a.7.m.dQt.f#B.m.fQtQtQtQtQt",
"QtQt.e.E.N#D.W.W#G#H.fQtQt#I.b#J#K.E.eQtQtQt",
"QtQtQtQt.#.d.E.a#L#IQtQtQtQtQt#L#M#J#H.fQtQt",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.e.u#N#K.aQt",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.d#K#N#H",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.##B.m",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"
]

class MainWindow(QMainWindow):
    def __init__(self,parent = None,name = None,fl = 0):
        QMainWindow.__init__(self,parent,name,fl)
        self.statusBar()

        self.image0 = QPixmap(image0_data)
        self.image1 = QPixmap(image1_data)
        self.image2 = QPixmap(image2_data)
        self.image3 = QPixmap(image3_data)
        self.image4 = QPixmap(image4_data)
        self.image5 = QPixmap(image5_data)
        self.image6 = QPixmap(image6_data)
        self.image7 = QPixmap(image7_data)
        self.image8 = QPixmap(image8_data)
        self.image9 = QPixmap(image9_data)

        if not name:
            self.setName("MainWindow")



        self.fileNewAction = QAction(self,"fileNewAction")
        self.fileNewAction.setIconSet(QIconSet(self.image0))
        self.fileOpenAction = QAction(self,"fileOpenAction")
        self.fileOpenAction.setIconSet(QIconSet(self.image1))
        self.fileSaveAction = QAction(self,"fileSaveAction")
        self.fileSaveAction.setIconSet(QIconSet(self.image2))
        self.fileSaveAsAction = QAction(self,"fileSaveAsAction")
        self.filePrintAction = QAction(self,"filePrintAction")
        self.filePrintAction.setIconSet(QIconSet(self.image3))
        self.fileExitAction = QAction(self,"fileExitAction")
        self.editUndoAction = QAction(self,"editUndoAction")
        self.editUndoAction.setIconSet(QIconSet(self.image4))
        self.editRedoAction = QAction(self,"editRedoAction")
        self.editRedoAction.setIconSet(QIconSet(self.image5))
        self.editCutAction = QAction(self,"editCutAction")
        self.editCutAction.setIconSet(QIconSet(self.image6))
        self.editCopyAction = QAction(self,"editCopyAction")
        self.editCopyAction.setIconSet(QIconSet(self.image7))
        self.editPasteAction = QAction(self,"editPasteAction")
        self.editPasteAction.setIconSet(QIconSet(self.image8))
        self.editFindAction = QAction(self,"editFindAction")
        self.editFindAction.setIconSet(QIconSet(self.image9))
        self.helpContentsAction = QAction(self,"helpContentsAction")
        self.helpIndexAction = QAction(self,"helpIndexAction")
        self.helpAboutAction = QAction(self,"helpAboutAction")


        self.toolBar = QToolBar(QString(""),self,Qt.DockTop)

        self.fileNewAction.addTo(self.toolBar)
        self.fileOpenAction.addTo(self.toolBar)
        self.fileSaveAction.addTo(self.toolBar)


        self.menubar = QMenuBar(self,"menubar")

        self.menubar.setGeometry(QRect(0,0,388,23))

        self.fileMenu = QPopupMenu(self)
        self.fileNewAction.addTo(self.fileMenu)
        self.fileOpenAction.addTo(self.fileMenu)
        self.fileSaveAction.addTo(self.fileMenu)
        self.fileSaveAsAction.addTo(self.fileMenu)
        self.fileMenu.insertSeparator()
        self.filePrintAction.addTo(self.fileMenu)
        self.fileMenu.insertSeparator()
        self.fileExitAction.addTo(self.fileMenu)
        self.menubar.insertItem(QString(""),self.fileMenu,2)

        self.editMenu = QPopupMenu(self)
        self.editUndoAction.addTo(self.editMenu)
        self.editRedoAction.addTo(self.editMenu)
        self.editMenu.insertSeparator()
        self.editCutAction.addTo(self.editMenu)
        self.editCopyAction.addTo(self.editMenu)
        self.editPasteAction.addTo(self.editMenu)
        self.editMenu.insertSeparator()
        self.editFindAction.addTo(self.editMenu)
        self.menubar.insertItem(QString(""),self.editMenu,3)

        self.helpMenu = QPopupMenu(self)
        self.helpContentsAction.addTo(self.helpMenu)
        self.helpIndexAction.addTo(self.helpMenu)
        self.helpMenu.insertSeparator()
        self.helpAboutAction.addTo(self.helpMenu)
        self.menubar.insertItem(QString(""),self.helpMenu,4)


        self.languageChange()

        self.resize(QSize(388,344).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.fileNewAction,SIGNAL("activated()"),self.fileNew)
        self.connect(self.fileOpenAction,SIGNAL("activated()"),self.fileOpen)
        self.connect(self.fileSaveAction,SIGNAL("activated()"),self.fileSave)
        self.connect(self.fileSaveAsAction,SIGNAL("activated()"),self.fileSaveAs)
        self.connect(self.filePrintAction,SIGNAL("activated()"),self.filePrint)
        self.connect(self.fileExitAction,SIGNAL("activated()"),self.fileExit)
        self.connect(self.editUndoAction,SIGNAL("activated()"),self.editUndo)
        self.connect(self.editRedoAction,SIGNAL("activated()"),self.editRedo)
        self.connect(self.editCutAction,SIGNAL("activated()"),self.editCut)
        self.connect(self.editCopyAction,SIGNAL("activated()"),self.editCopy)
        self.connect(self.editPasteAction,SIGNAL("activated()"),self.editPaste)
        self.connect(self.editFindAction,SIGNAL("activated()"),self.editFind)
        self.connect(self.helpIndexAction,SIGNAL("activated()"),self.helpIndex)
        self.connect(self.helpContentsAction,SIGNAL("activated()"),self.helpContents)
        self.connect(self.helpAboutAction,SIGNAL("activated()"),self.helpAbout)


    def languageChange(self):
        self.setCaption(self.__tr("MainWindow"))
        self.fileNewAction.setText(self.__tr("New"))
        self.fileNewAction.setMenuText(self.__tr("&New"))
        self.fileNewAction.setAccel(self.__tr("Ctrl+N"))
        self.fileOpenAction.setText(self.__tr("Open"))
        self.fileOpenAction.setMenuText(self.__tr("&Open..."))
        self.fileOpenAction.setAccel(self.__tr("Ctrl+O"))
        self.fileSaveAction.setText(self.__tr("Save"))
        self.fileSaveAction.setMenuText(self.__tr("&Save"))
        self.fileSaveAction.setAccel(self.__tr("Ctrl+S"))
        self.fileSaveAsAction.setText(self.__tr("Save As"))
        self.fileSaveAsAction.setMenuText(self.__tr("Save &As..."))
        self.fileSaveAsAction.setAccel(QString.null)
        self.filePrintAction.setText(self.__tr("Print"))
        self.filePrintAction.setMenuText(self.__tr("&Print..."))
        self.filePrintAction.setAccel(self.__tr("Ctrl+P"))
        self.fileExitAction.setText(self.__tr("Exit"))
        self.fileExitAction.setMenuText(self.__tr("E&xit"))
        self.fileExitAction.setAccel(QString.null)
        self.editUndoAction.setText(self.__tr("Undo"))
        self.editUndoAction.setMenuText(self.__tr("&Undo"))
        self.editUndoAction.setAccel(self.__tr("Ctrl+Z"))
        self.editRedoAction.setText(self.__tr("Redo"))
        self.editRedoAction.setMenuText(self.__tr("&Redo"))
        self.editRedoAction.setAccel(self.__tr("Ctrl+Y"))
        self.editCutAction.setText(self.__tr("Cut"))
        self.editCutAction.setMenuText(self.__tr("&Cut"))
        self.editCutAction.setAccel(self.__tr("Ctrl+X"))
        self.editCopyAction.setText(self.__tr("Copy"))
        self.editCopyAction.setMenuText(self.__tr("C&opy"))
        self.editCopyAction.setAccel(self.__tr("Ctrl+C"))
        self.editPasteAction.setText(self.__tr("Paste"))
        self.editPasteAction.setMenuText(self.__tr("&Paste"))
        self.editPasteAction.setAccel(self.__tr("Ctrl+V"))
        self.editFindAction.setText(self.__tr("Find"))
        self.editFindAction.setMenuText(self.__tr("&Find..."))
        self.editFindAction.setAccel(self.__tr("Ctrl+F"))
        self.helpContentsAction.setText(self.__tr("Contents"))
        self.helpContentsAction.setMenuText(self.__tr("&Contents..."))
        self.helpContentsAction.setAccel(QString.null)
        self.helpIndexAction.setText(self.__tr("Index"))
        self.helpIndexAction.setMenuText(self.__tr("&Index..."))
        self.helpIndexAction.setAccel(QString.null)
        self.helpAboutAction.setText(self.__tr("About"))
        self.helpAboutAction.setMenuText(self.__tr("&About"))
        self.helpAboutAction.setAccel(QString.null)
        self.toolBar.setLabel(self.__tr("Tools"))
        self.menubar.findItem(2).setText(self.__tr("&File"))
        self.menubar.findItem(3).setText(self.__tr("&Edit"))
        self.menubar.findItem(4).setText(self.__tr("&Help"))


    def fileNew(self):
        print "MainWindow.fileNew(): Not implemented yet"

    def fileOpen(self):
        print "MainWindow.fileOpen(): Not implemented yet"

    def fileSave(self):
        print "MainWindow.fileSave(): Not implemented yet"

    def fileSaveAs(self):
        print "MainWindow.fileSaveAs(): Not implemented yet"

    def filePrint(self):
        print "MainWindow.filePrint(): Not implemented yet"

    def fileExit(self):
        print "MainWindow.fileExit(): Not implemented yet"

    def editUndo(self):
        print "MainWindow.editUndo(): Not implemented yet"

    def editRedo(self):
        print "MainWindow.editRedo(): Not implemented yet"

    def editCut(self):
        print "MainWindow.editCut(): Not implemented yet"

    def editCopy(self):
        print "MainWindow.editCopy(): Not implemented yet"

    def editPaste(self):
        print "MainWindow.editPaste(): Not implemented yet"

    def editFind(self):
        print "MainWindow.editFind(): Not implemented yet"

    def helpIndex(self):
        print "MainWindow.helpIndex(): Not implemented yet"

    def helpContents(self):
        print "MainWindow.helpContents(): Not implemented yet"

    def helpAbout(self):
        print "MainWindow.helpAbout(): Not implemented yet"

    def __tr(self,s,c = None):
        print "__tr(%s, %s)" % (s, c)
        return qApp.translate("MainWindow",s,c)


More information about the PyQt mailing list