diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-29 01:11:08 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-29 01:11:08 -0600 |
commit | 8a055d66f43592c257cece2eb8cc021808062917 (patch) | |
tree | d0922f201bd5d24b62a33160d1d9baf9e89f9a70 /examples2/application.py | |
parent | b388516ca2691303a076a0764fd40bf7116fe43d (diff) | |
download | pytqt-8a055d66f43592c257cece2eb8cc021808062917.tar.gz pytqt-8a055d66f43592c257cece2eb8cc021808062917.zip |
Initial TQt conversion
Diffstat (limited to 'examples2/application.py')
-rwxr-xr-x | examples2/application.py | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/examples2/application.py b/examples2/application.py index 294c6cb..8b8f43b 100755 --- a/examples2/application.py +++ b/examples2/application.py @@ -94,40 +94,40 @@ You can also select the <b>Print</b> command from the <b>File</b> menu.''' editorList = [] -class ApplicationWindow(QMainWindow): +class ApplicationWindow(TQMainWindow): def __init__(self): - QMainWindow.__init__(self,None,'example application main window',Qt.WDestructiveClose) + TQMainWindow.__init__(self,None,'example application main window',TQt.WDestructiveClose) - self.filename = QString.null - self.printer = QPrinter() + self.filename = TQString.null + self.printer = TQPrinter() - self.fileTools = QToolBar(self,'file operations') + self.fileTools = TQToolBar(self,'file operations') - openIcon = QPixmap(fileopen) - self.fileOpen = QToolButton(openIcon,'Open File',QString.null,self.load,self.fileTools,'open file') + openIcon = TQPixmap(fileopen) + self.fileOpen = TQToolButton(openIcon,'Open File',TQString.null,self.load,self.fileTools,'open file') - saveIcon = QPixmap(filesave) - self.fileSave = QToolButton(saveIcon,'Save File',QString.null,self.save,self.fileTools,'save file') + saveIcon = TQPixmap(filesave) + self.fileSave = TQToolButton(saveIcon,'Save File',TQString.null,self.save,self.fileTools,'save file') - printIcon = QPixmap(fileprint) - self.filePrint = QToolButton(printIcon,'Print File',QString.null,self.printDoc,self.fileTools,'print file') + printIcon = TQPixmap(fileprint) + self.filePrint = TQToolButton(printIcon,'Print File',TQString.null,self.printDoc,self.fileTools,'print file') - QWhatsThis.whatsThisButton(self.fileTools) + TQWhatsThis.whatsThisButton(self.fileTools) - QWhatsThis.add(self.fileOpen,fileOpenText) - QMimeSourceFactory.defaultFactory().setPixmap('fileopen',openIcon) - QWhatsThis.add(self.fileSave,fileSaveText) - QWhatsThis.add(self.filePrint,filePrintText) + TQWhatsThis.add(self.fileOpen,fileOpenText) + TQMimeSourceFactory.defaultFactory().setPixmap('fileopen',openIcon) + TQWhatsThis.add(self.fileSave,fileSaveText) + TQWhatsThis.add(self.filePrint,filePrintText) - self.file = QPopupMenu(self) + self.file = TQPopupMenu(self) self.menuBar().insertItem('&File',self.file) - self.file.insertItem('&New',self.newDoc,Qt.CTRL + Qt.Key_N) + self.file.insertItem('&New',self.newDoc,TQt.CTRL + TQt.Key_N) - id = self.file.insertItem(QIconSet(openIcon),'&Open',self.load,Qt.CTRL + Qt.Key_O) + id = self.file.insertItem(TQIconSet(openIcon),'&Open',self.load,TQt.CTRL + TQt.Key_O) self.file.setWhatsThis(id,fileOpenText) - id = self.file.insertItem(QIconSet(saveIcon),'&Save',self.save,Qt.CTRL + Qt.Key_S) + id = self.file.insertItem(TQIconSet(saveIcon),'&Save',self.save,TQt.CTRL + TQt.Key_S) self.file.setWhatsThis(id,fileSaveText) id = self.file.insertItem('Save &as',self.saveAs) @@ -135,22 +135,22 @@ class ApplicationWindow(QMainWindow): self.file.insertSeparator() - id = self.file.insertItem(QIconSet(printIcon),'&Print',self.printDoc,Qt.CTRL + Qt.Key_P) + id = self.file.insertItem(TQIconSet(printIcon),'&Print',self.printDoc,TQt.CTRL + TQt.Key_P) self.file.setWhatsThis(id,filePrintText) self.file.insertSeparator() - self.file.insertItem('&Close',self,SLOT('close()'),Qt.CTRL + Qt.Key_W) - self.file.insertItem('&Quit',qApp,SLOT('closeAllWindows()'),Qt.CTRL + Qt.Key_Q) + self.file.insertItem('&Close',self,SLOT('close()'),TQt.CTRL + TQt.Key_W) + self.file.insertItem('&Quit',qApp,SLOT('closeAllWindows()'),TQt.CTRL + TQt.Key_Q) - self.help = QPopupMenu(self) + self.help = TQPopupMenu(self) self.menuBar().insertSeparator() self.menuBar().insertItem('&Help',self.help) - self.help.insertItem('&About',self.about,Qt.Key_F1) - self.help.insertItem('About &Qt',self.aboutQt) + self.help.insertItem('&About',self.about,TQt.Key_F1) + self.help.insertItem('About &TQt',self.aboutTQt) - self.e = QMultiLineEdit(self,'editor') + self.e = TQMultiLineEdit(self,'editor') self.e.setFocus() self.setCentralWidget(self.e) @@ -163,7 +163,7 @@ class ApplicationWindow(QMainWindow): editorList.append(ed) def load(self): - fn = QFileDialog.getOpenFileName(QString.null,QString.null,self) + fn = TQFileDialog.getOpenFileName(TQString.null,TQString.null,self) if fn.isEmpty(): self.statusBar().message('Loading aborted',2000) return @@ -208,7 +208,7 @@ class ApplicationWindow(QMainWindow): self.statusBar().message('File %s saved' % (self.filename),2000) def saveAs(self): - fn = QFileDialog.getSaveFileName(QString.null,QString.null,self) + fn = TQFileDialog.getSaveFileName(TQString.null,TQString.null,self) if not fn.isEmpty(): self.filename = fn self.save() @@ -222,12 +222,12 @@ class ApplicationWindow(QMainWindow): if self.printer.setup(self): self.statusBar().message('Printing...') - p = QPainter() + p = TQPainter() p.begin(self.printer) p.setFont(self.e.font()) yPos = 0 fm = p.fontMetrics() - metrics = QPaintDeviceMetrics(self.printer) + metrics = TQPaintDeviceMetrics(self.printer) for i in range(self.e.numLines): if Margin + yPos > metrics.height() - Margin: @@ -236,7 +236,7 @@ class ApplicationWindow(QMainWindow): self.printer.newPage() yPos = 0 - p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip,self.e.textLine(i)) + p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),TQt.ExpandTabs | TQt.DontClip,self.e.textLine(i)) yPos = yPos + fm.lineSpacing() p.end() @@ -249,7 +249,7 @@ class ApplicationWindow(QMainWindow): ce.accept() return - rc = QMessageBox.information(self,'Qt Application Example', + rc = TQMessageBox.information(self,'TQt Application Example', 'The document has been changed since the last save.', 'Save Now','Cancel','Leave Anyway',0,1) @@ -262,14 +262,14 @@ class ApplicationWindow(QMainWindow): ce.ignore() def about(self): - QMessageBox.about(self,'Qt Application Example', - 'This example demonstrates simple use of QMainWindow,\nQMenuBar and QToolBar.') + TQMessageBox.about(self,'TQt Application Example', + 'This example demonstrates simple use of TQMainWindow,\nTQMenuBar and TQToolBar.') - def aboutQt(self): - QMessageBox.aboutQt(self,'Qt Application Example') + def aboutTQt(self): + TQMessageBox.aboutTQt(self,'TQt Application Example') -a = QApplication(sys.argv) +a = TQApplication(sys.argv) mw = ApplicationWindow() mw.setCaption('Document 1') mw.show() |