diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2023-01-21 21:52:20 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2023-01-22 01:58:18 +0100 |
commit | 135d005014a1e85295af4e379f026a361537ae5f (patch) | |
tree | c70f25a5248237a5c4676c928fd400b10aa7a641 /kspread/plugins/scripting/scripts | |
parent | 596d0f7b9ed99de0814acfb835cc8945cee37405 (diff) | |
download | koffice-135d005014a1e85295af4e379f026a361537ae5f.tar.gz koffice-135d005014a1e85295af4e379f026a361537ae5f.zip |
Update python scripts for PyTQt.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'kspread/plugins/scripting/scripts')
-rwxr-xr-x | kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py | 58 | ||||
-rwxr-xr-x | kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py | 280 |
2 files changed, 173 insertions, 165 deletions
diff --git a/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py b/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py index 529a2d26..d38771fc 100755 --- a/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py +++ b/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py @@ -16,30 +16,30 @@ Dual-licensed under LGPL v2+higher and the BSD license. import os, sys try: - import qt + from TQt import qt except (ImportError): - raise "Failed to import the required PyQt python module." + raise "Failed to import the required PyTQt python module." -class Dialog(qt.QDialog): +class Dialog(tqt.QDialog): def __init__(self, scriptpath, parent): self.scriptpath = scriptpath import krosskspreadcore self.doc = krosskspreadcore.get("KSpreadDocument") - import qt - qt.QDialog.__init__(self, parent, "Dialog", 1, qt.Qt.WDestructiveClose) + from TQt import qt + qt.TQDialog.__init__(self, parent, "Dialog", 1, qt.TQt.WDestructiveClose) self.setCaption("Export to HTML File") - layout = qt.QVBoxLayout(self) - box = qt.QVBox(self) + layout = qt.TQVBoxLayout(self) + box = qt.TQVBox(self) box.setMargin(10) box.setSpacing(10) layout.addWidget(box) - sheetbox = qt.QHBox(box) + sheetbox = qt.TQHBox(box) sheetbox.setSpacing(6) - sheetlabel = qt.QLabel("Sheet:",sheetbox) - self.sheetcombo = qt.QComboBox(sheetbox) + sheetlabel = qt.TQLabel("Sheet:",sheetbox) + self.sheetcombo = qt.TQComboBox(sheetbox) currentsheetname = self.doc.currentSheet().name() for sheetname in self.doc.sheetNames(): self.sheetcombo.insertItem(sheetname) @@ -65,10 +65,10 @@ class Dialog(qt.QDialog): , } - stylebox = qt.QHBox(box) + stylebox = qt.TQHBox(box) stylebox.setSpacing(6) - stylelabel = qt.QLabel("Style:",stylebox) - self.stylecombo = qt.QComboBox(stylebox) + stylelabel = qt.TQLabel("Style:",stylebox) + self.stylecombo = qt.TQComboBox(stylebox) stylenames = self.styles.keys() stylenames.sort() for stylename in stylenames: @@ -76,32 +76,32 @@ class Dialog(qt.QDialog): stylelabel.setBuddy(self.stylecombo) stylebox.setStretchFactor(self.stylecombo,1) - filebox = qt.QHBox(box) + filebox = qt.TQHBox(box) filebox.setSpacing(6) - filelabel = qt.QLabel("File:",filebox) - self.fileedit = qt.QLineEdit(self.getDefaultFile(),filebox) - btn = qt.QPushButton("...",filebox) - qt.QObject.connect(btn, qt.SIGNAL("clicked()"),self.browseClicked) + filelabel = qt.TQLabel("File:",filebox) + self.fileedit = qt.TQLineEdit(self.getDefaultFile(),filebox) + btn = qt.TQPushButton("...",filebox) + qt.TQObject.connect(btn, qt.SIGNAL("clicked()"),self.browseClicked) filelabel.setBuddy(self.fileedit) filebox.setStretchFactor(self.fileedit,1) - btnbox = qt.QHBox(box) + btnbox = qt.TQHBox(box) btnbox.setSpacing(6) - okbtn = qt.QPushButton(btnbox) + okbtn = qt.TQPushButton(btnbox) okbtn.setText("Export") okbtn.setDefault(True) - qt.QObject.connect(okbtn,qt.SIGNAL("clicked()"),self.startExport) - cancelbtn = qt.QPushButton(btnbox) + qt.TQObject.connect(okbtn,qt.SIGNAL("clicked()"),self.startExport) + cancelbtn = qt.TQPushButton(btnbox) cancelbtn.setText("Cancel") - qt.QObject.connect(cancelbtn,qt.SIGNAL("clicked()"),self.close) + qt.TQObject.connect(cancelbtn,qt.SIGNAL("clicked()"),self.close) box.setMinimumWidth(480) def browseClicked(self): - import qt - filename = str( qt.QFileDialog.getSaveFileName(str(self.fileedit.text()),"*.htm *.html *.xhtml;;*", self) ) + from TQt import qt + filename = str( qt.TQFileDialog.getSaveFileName(str(self.fileedit.text()),"*.htm *.html *.xhtml;;*", self) ) if filename != "": self.fileedit.setText(filename) - + def getDefaultFile(self): import os try: @@ -119,7 +119,7 @@ class Dialog(qt.QDialog): return os.path.join(homepath, "kspreadexport.html") def startExport(self): - import qt + from TQt import qt sheetname = str( self.sheetcombo.currentText() ) sheet = self.doc.sheetByName( sheetname ) @@ -129,7 +129,7 @@ class Dialog(qt.QDialog): try: file = open(filename, "w") except IOError, (errno, strerror): - qt.QMessageBox.critical(self,"Error","<qt>Failed to create HTML file \"%s\"<br><br>%s</qt>" % (filename,strerror)) + qt.TQMessageBox.critical(self,"Error","<qt>Failed to create HTML file \"%s\"<br><br>%s</qt>" % (filename,strerror)) return file.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n") @@ -170,7 +170,7 @@ class Dialog(qt.QDialog): if __name__ == "__main__": scriptpath = os.getcwd() - qtapp = qt.QApplication(sys.argv) + qtapp = qt.TQApplication(sys.argv) else: scriptpath = os.path.dirname(__name__) qtapp = qt.tqApp diff --git a/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py b/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py index 4356c90d..e39bcc42 100755 --- a/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py +++ b/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py @@ -14,30 +14,30 @@ Dual-licensed under LGPL v2+higher and the BSD license. import os, sys try: - import qt + from TQt import qt except (ImportError): - raise "Failed to import the required PyQt python module." + raise "Failed to import the required PyTQt python module." #################################################################################### # Samples. -class Widget(qt.QHBox): +class Widget(qt.TQHBox): def __init__(self, parentwidget, label = None): self.parentwidget = parentwidget - import qt - qt.QHBox.__init__(self, parentwidget) + from TQt import qt + qt.TQHBox.__init__(self, parentwidget) self.setMargin(4) self.setSpacing(4) - if label != None: qt.QLabel(label, self) + if label != None: qt.TQLabel(label, self) def value(self): return None class ListWidget(Widget): def __init__(self, parentwidget, label): - import qt + from TQt import qt global Widget Widget.__init__(self, parentwidget, label) - self.combo = qt.QComboBox(self) + self.combo = qt.TQComboBox(self) self.combo.setEditable(True) self.setStretchFactor(self.combo,1) def value(self): @@ -45,10 +45,10 @@ class ListWidget(Widget): class EditWidget(Widget): def __init__(self, parentwidget, label): - import qt + from TQt import qt global Widget Widget.__init__(self, parentwidget, label) - self.edit = qt.QLineEdit(self) + self.edit = qt.TQLineEdit(self) self.setStretchFactor(self.edit,1) def value(self): return self.edit.text() @@ -57,20 +57,20 @@ class FileWidget(Widget): def __init__(self, parentwidget, label, filtermask, openfiledialog = True): self.filtermask = filtermask self.openfiledialog = openfiledialog - import qt + from TQt import qt global Widget Widget.__init__(self, parentwidget, label) - self.edit = qt.QLineEdit(self) + self.edit = qt.TQLineEdit(self) self.setStretchFactor(self.edit,1) - btn = qt.QPushButton("...",self) - qt.QObject.connect(btn, qt.SIGNAL("clicked()"), self.btnClicked) + btn = qt.TQPushButton("...",self) + qt.TQObject.connect(btn, qt.SIGNAL("clicked()"), self.btnClicked) def btnClicked(self): - import qt + from TQt import qt text = str( self.edit.text() ) if self.openfiledialog: - filename = str( qt.QFileDialog.getOpenFileName(text, self.filtermask, self.parentwidget) ) + filename = str( qt.TQFileDialog.getOpenFileName(text, self.filtermask, self.parentwidget) ) else: - filename = qt.QFileDialog.getSaveFileName(text, self.filtermask, self.parentwidget) + filename = qt.TQFileDialog.getSaveFileName(text, self.filtermask, self.parentwidget) if filename != "": self.edit.setText( filename ) def value(self): return self.edit.text() @@ -383,8 +383,8 @@ class Samples: } def getCode(self): return ( - '# Import the PyQt module.', - 'import qt', + '# Import the PyTQt module.', + 'from TQt import qt', '', 'def loadFile(filename):', ' # Import the krosskspreadcore module.', @@ -395,7 +395,7 @@ class Samples: ' xml = file.read()', ' file.close()', ' except IOError, (errno, strerror):', - ' qt.QMessageBox.critical(self,"Error","<qt>Failed to read file %s<br><br>%s</qt>" % (filename,strerror))', + ' qt.TQMessageBox.critical(self,"Error","<qt>Failed to read file %s<br><br>%s</qt>" % (filename,strerror))', ' return', '', ' # Get the current document.', @@ -405,7 +405,7 @@ class Samples: '', '# Show the openfile dialog', 'filename = "{FileName}"', - 'openfilename = qt.QFileDialog.getOpenFileName(filename,"*.xml;;*", self)', + 'openfilename = qt.TQFileDialog.getOpenFileName(filename,"*.xml;;*", self)', 'if str(openfilename) != "":', ' loadFile( openfilename )', ) @@ -420,8 +420,8 @@ class Samples: } def getCode(self): return ( - '# Import the PyQt module.', - 'import qt', + '# Import the PyTQt module.', + 'from TQt import qt', '', 'def saveFile(filename):', ' # Import the krosskspreadcore module.', @@ -430,7 +430,7 @@ class Samples: ' try:', ' file = open(filename, "w")', ' except IOError, (errno, strerror):', - ' qt.QMessageBox.critical(self,"Error","<qt>Failed to create file %s<br><br>%s</qt>" % (filename,strerror))', + ' qt.TQMessageBox.critical(self,"Error","<qt>Failed to create file %s<br><br>%s</qt>" % (filename,strerror))', ' return', ' # Get the current document.', ' document = krosskspreadcore.get("KSpreadDocument")', @@ -443,7 +443,7 @@ class Samples: '', '# Show the savefile dialog', 'filename = "{FileName}"', - 'savefilename = qt.QFileDialog.getSaveFileName(filename,"*.xml;;*", self)', + 'savefilename = qt.TQFileDialog.getSaveFileName(filename,"*.xml;;*", self)', 'if str(savefilename) != "":', ' saveFile( savefilename )', ) @@ -554,9 +554,9 @@ class Samples: #################################################################################### - # PyQt + # PyTQt - class PyQt: + class PyTQt: def __init__(self, parentwidget): self.parentwidget = parentwidget @@ -570,8 +570,8 @@ class Samples: } def getCode(self): return ( - 'import qt', - 'openfilename = qt.QFileDialog.getOpenFileName("{FileName}","*.txt *.html;;*", self)', + 'from TQt import qt', + 'openfilename = qt.TQFileDialog.getOpenFileName("{FileName}","*.txt *.html;;*", self)', 'print "openfile=%s" % openfilename', ) @@ -585,8 +585,8 @@ class Samples: } def getCode(self): return ( - 'import qt', - 'savefilename = qt.QFileDialog.getSaveFileName("{FileName}","*.txt *.html;;*", self)', + 'from TQt import qt', + 'savefilename = qt.TQFileDialog.getSaveFileName("{FileName}","*.txt *.html;;*", self)', 'print "savefile=%s" % savefilename', ) @@ -599,18 +599,18 @@ class Samples: } def getCode(self): return ( - 'import qt', + 'from TQt import qt', '', - 'class MyDialog(qt.QDialog):', + 'class MyDialog(qt.TQDialog):', ' def __init__(self, parent):', - ' import qt', - ' qt.QDialog.__init__(self, parent, "MyDialog", 1, qt.Qt.WDestructiveClose)', + ' from TQt import qt', + ' qt.TQDialog.__init__(self, parent, "MyDialog", 1, qt.TQt.WDestructiveClose)', ' self.setCaption("My Dialog")', - ' btn = qt.QPushButton("Click me",self)', - ' qt.QObject.connect(btn, qt.SIGNAL("clicked()"), self.buttonClicked)', + ' btn = qt.TQPushButton("Click me",self)', + ' qt.TQObject.connect(btn, qt.SIGNAL("clicked()"), self.buttonClicked)', ' def buttonClicked(self):', - ' import qt', - ' qt.QMessageBox.information(self, "The Caption", "This is the message string.")', + ' from TQt import qt', + ' qt.TQMessageBox.information(self, "The Caption", "This is the message string.")', '', 'dialog = MyDialog(self)', 'dialog.exec_loop()', @@ -627,9 +627,9 @@ class Samples: } def getCode(self): return ( - 'import qt', + 'from TQt import qt', '', - 'text, ok = qt.QInputDialog.getText("{Caption}", "{Message}", qt.QLineEdit.Normal, "")', + 'text, ok = qt.TQInputDialog.getText("{Caption}", "{Message}", qt.TQLineEdit.Normal, "")', 'if ok:', ' print "Text defined: %s" % text', 'else:', @@ -651,12 +651,13 @@ class Samples: } def getCode(self): return ( - 'import qt, tdecore, dcop, dcopext', + 'from TQt import qt', + 'import tdecore, dcop, dcopext', 'dcopclient = tdecore.TDEApplication.dcopClient()', 'apps = [ app for app in dcopclient.registeredApplications() if str(app).startswith("klipper") ]', 'd = dcopext.DCOPApp(apps[0], dcopclient)', 'result,typename,data = d.appclient.call(apps[0],"klipper","getClipboardContents()","")', - 'ds = qt.QDataStream(data, qt.IO_ReadOnly)', + 'ds = qt.TQDataStream(data, qt.IO_ReadOnly)', 'print "Clipboard content:\\n%s" % tdecore.dcop_next(ds, TQSTRING_OBJECT_NAME_STRING)', ) @@ -668,7 +669,8 @@ class Samples: } def getCode(self): return ( - 'import qt, tdecore, dcop, dcopext', + 'from TQt import qt', + 'import tdecore, dcop, dcopext', '', 'dcopclient = tdecore.TDEApplication.dcopClient()', 'apps = [ app for app in dcopclient.registeredApplications() if str(app).startswith("amarok") ]', @@ -676,8 +678,9 @@ class Samples: 'd = dcopext.DCOPApp(app, dcopclient)', '', 'def dataToList(data, types = []):', - ' import qt, tdecore', - ' ds = qt.QDataStream(data, qt.IO_ReadOnly)', + ' from TQt import qt', + ' import tdecore', + ' ds = qt.TQDataStream(data, qt.IO_ReadOnly)', ' return [ tdecore.dcop_next(ds, t) for t in types ]', '', 'for funcname in ["totalAlbums","totalArtists","totalCompilations","totalGenres","totalTracks"]:', @@ -693,7 +696,8 @@ class Samples: } def getCode(self): return ( - 'import qt, tdecore, dcop, dcopext', + 'from TQt import qt', + 'import tdecore, dcop, dcopext', '', 'dcopclient = tdecore.TDEApplication.dcopClient()', 'apps = [ app for app in dcopclient.registeredApplications() if str(app).startswith("kopete") ]', @@ -703,7 +707,7 @@ class Samples: '(state,rtype,rdata) = d.appclient.call("kopete", "KopeteIface", "contacts()","")', 'if not state: raise "Failed to call the kopete contacts-function"', '', - 'ds = qt.QDataStream(rdata.data(), qt.IO_ReadOnly)', + 'ds = qt.TQDataStream(rdata.data(), qt.IO_ReadOnly)', 'sl = tdecore.dcop_next (ds, TQSTRINGLIST_OBJECT_NAME_STRING)', 'print "contacts=%s" % [ str(s) for s in sl ]', ) @@ -716,16 +720,19 @@ class Samples: } def getCode(self): return ( - 'import qt, tdecore, dcop, dcopext', + 'from TQt import qt', + 'import tdecore, dcop, dcopext', '', 'def dataToList(data, types = []):', - ' import qt, tdecore', - ' ds = qt.QDataStream(data, qt.IO_ReadOnly)', + ' from TQt import qt', + ' import tdecore', + ' ds = qt.TQDataStream(data, qt.IO_ReadOnly)', ' return [ tdecore.dcop_next(ds, t) for t in types ]', 'def listToData(listdict):', - ' import qt, tdecore', - ' ba= qt.QByteArray()', - ' ds = qt.QDataStream(ba, qt.IO_WriteOnly)', + ' from TQt import qt', + ' import tdecore', + ' ba= qt.TQByteArray()', + ' ds = qt.TQDataStream(ba, qt.IO_WriteOnly)', ' for (typename,value) in listdict:', ' tdecore.dcop_add (ds, value, typename)', ' return ba', @@ -758,48 +765,48 @@ class Samples: #################################################################################### # Dialog implementations. -class SampleDialog(qt.QDialog): +class SampleDialog(qt.TQDialog): def __init__(self, parent, sampleclazz, samplechildclazz): - import qt - qt.QDialog.__init__(self, parent, "SampleDialog", 1) + from TQt import qt + qt.TQDialog.__init__(self, parent, "SampleDialog", 1) - layout = qt.QVBoxLayout(self) - box = qt.QVBox(self) + layout = qt.TQVBoxLayout(self) + box = qt.TQVBox(self) box.setMargin(4) box.setSpacing(10) layout.addWidget(box) - self.scrollview = qt.QScrollView(box) - self.scrollview.setResizePolicy(qt.QScrollView.AutoOne) - #self.scrollview.setFrameStyle(qt.QFrame.NoFrame); - self.scrollview.setResizePolicy(qt.QScrollView.AutoOneFit); + self.scrollview = qt.TQScrollView(box) + self.scrollview.setResizePolicy(qt.TQScrollView.AutoOne) + #self.scrollview.setFrameStyle(qt.TQFrame.NoFrame); + self.scrollview.setResizePolicy(qt.TQScrollView.AutoOneFit); self.scrollview.viewport().setPaletteBackgroundColor(self.paletteBackgroundColor()) - mainbox = qt.QVBox( self.scrollview.viewport() ) + mainbox = qt.TQVBox( self.scrollview.viewport() ) mainbox.setMargin(6) mainbox.setSpacing(6) - desclabel = qt.QLabel(mainbox) - qt.QFrame(mainbox).setFrameStyle( qt.QFrame.HLine | qt.QFrame.Sunken ) + desclabel = qt.TQLabel(mainbox) + qt.TQFrame(mainbox).setFrameStyle( qt.TQFrame.HLine | qt.TQFrame.Sunken ) self.sample = sampleclazz( mainbox ) self.samplechild = samplechildclazz( self.sample ) desclabel.setText( "<qt>%s</qt>" % self.samplechild.__doc__ ) - mainbox.setStretchFactor(qt.QWidget(mainbox), 1) + mainbox.setStretchFactor(qt.TQWidget(mainbox), 1) mainbox.show() self.scrollview.addChild(mainbox) - btnbox = qt.QHBox(box) + btnbox = qt.TQHBox(box) btnbox.setMargin(6) btnbox.setSpacing(6) - okbtn = qt.QPushButton(btnbox) + okbtn = qt.TQPushButton(btnbox) okbtn.setText("Ok") - qt.QObject.connect(okbtn, qt.SIGNAL("clicked()"), self.okClicked) - cancelbtn = qt.QPushButton(btnbox) + qt.TQObject.connect(okbtn, qt.SIGNAL("clicked()"), self.okClicked) + cancelbtn = qt.TQPushButton(btnbox) cancelbtn.setText("Cancel") - qt.QObject.connect(cancelbtn, qt.SIGNAL("clicked()"), self.close) + qt.TQObject.connect(cancelbtn, qt.SIGNAL("clicked()"), self.close) self.setCaption(self.samplechild.name) - box.setMinimumSize(qt.QSize(500,340)) + box.setMinimumSize(qt.TQSize(500,340)) def okClicked(self): self.code = self.samplechild.getCode() @@ -816,7 +823,7 @@ class SampleDialog(qt.QDialog): code = code.replace("{%s}" % widgetname, str(value)) return code -class MainDialog(qt.QDialog): +class MainDialog(qt.TQDialog): def __init__(self, scriptpath, parent): self.scriptpath = scriptpath if not hasattr(__main__,"scripteditorfilename"): @@ -825,118 +832,119 @@ class MainDialog(qt.QDialog): import krosskspreadcore self.doc = krosskspreadcore.get("KSpreadDocument") - import os, qt - qt.QDialog.__init__(self, parent, "MainDialog", 1, qt.Qt.WDestructiveClose) + import os + from TQt import qt + qt.TQDialog.__init__(self, parent, "MainDialog", 1, qt.TQt.WDestructiveClose) self.setCaption("Script Editor") - - layout = qt.QVBoxLayout(self) - box = qt.QVBox(self) + + layout = qt.TQVBoxLayout(self) + box = qt.TQVBox(self) box.setMargin(4) box.setSpacing(10) layout.addWidget(box) - menu = qt.QMenuBar(box) + menu = qt.TQMenuBar(box) - splitter = qt.QSplitter(box) - splitter.setOrientation(qt.Qt.Vertical) + splitter = qt.TQSplitter(box) + splitter.setOrientation(qt.TQt.Vertical) - self.scripttext = qt.QMultiLineEdit(splitter) - self.scripttext.setWordWrap( qt.QTextEdit.NoWrap ) - self.scripttext.setTextFormat( qt.Qt.PlainText ) - qt.QObject.connect(self.scripttext, qt.SIGNAL("cursorPositionChanged(int,int)"),self.cursorPositionChanged) + self.scripttext = qt.TQMultiLineEdit(splitter) + self.scripttext.setWordWrap( qt.TQTextEdit.NoWrap ) + self.scripttext.setTextFormat( qt.TQt.PlainText ) + qt.TQObject.connect(self.scripttext, qt.SIGNAL("cursorPositionChanged(int,int)"),self.cursorPositionChanged) - self.console = qt.QTextBrowser(splitter) - splitter.setResizeMode(self.console, qt.QSplitter.KeepSize) + self.console = qt.TQTextBrowser(splitter) + splitter.setResizeMode(self.console, qt.TQSplitter.KeepSize) - statusbar = qt.QStatusBar(box) - self.messagestatus = qt.QLabel(statusbar) + statusbar = qt.TQStatusBar(box) + self.messagestatus = qt.TQLabel(statusbar) statusbar.addWidget(self.messagestatus,1) - self.cursorstatus = qt.QLabel(statusbar) + self.cursorstatus = qt.TQLabel(statusbar) statusbar.addWidget(self.cursorstatus) self.cursorPositionChanged() - box.setMinimumSize( qt.QSize(680,540) ) + box.setMinimumSize( qt.TQSize(680,540) ) - filemenu = qt.QPopupMenu(menu) + filemenu = qt.TQPopupMenu(menu) menu.insertItem("&File", filemenu) - - newaction = qt.QAction("New", qt.QKeySequence("CTRL+N"), self) - qt.QObject.connect(newaction, qt.SIGNAL("activated()"), self.newFile) + + newaction = qt.TQAction("New", qt.TQKeySequence("CTRL+N"), self) + qt.TQObject.connect(newaction, qt.SIGNAL("activated()"), self.newFile) newaction.addTo(filemenu) - openaction = qt.QAction("Open...", qt.QKeySequence("CTRL+O"), self) - qt.QObject.connect(openaction, qt.SIGNAL("activated()"), self.openFileAs) + openaction = qt.TQAction("Open...", qt.TQKeySequence("CTRL+O"), self) + qt.TQObject.connect(openaction, qt.SIGNAL("activated()"), self.openFileAs) openaction.addTo(filemenu) - saveaction = qt.QAction("Save", qt.QKeySequence("CTRL+S"), self) - qt.QObject.connect(saveaction, qt.SIGNAL("activated()"), self.saveFile) + saveaction = qt.TQAction("Save", qt.TQKeySequence("CTRL+S"), self) + qt.TQObject.connect(saveaction, qt.SIGNAL("activated()"), self.saveFile) saveaction.addTo(filemenu) - saveasaction = qt.QAction("Save as...", qt.QKeySequence("CTRL+A"), self) - qt.QObject.connect(saveasaction, qt.SIGNAL("activated()"), self.saveFileAs) + saveasaction = qt.TQAction("Save as...", qt.TQKeySequence("CTRL+A"), self) + qt.TQObject.connect(saveasaction, qt.SIGNAL("activated()"), self.saveFileAs) saveasaction.addTo(filemenu) filemenu.insertSeparator() - - quitaction = qt.QAction("Quit", qt.QKeySequence("CTRL+Q"), self) - qt.QObject.connect(quitaction, qt.SIGNAL("activated()"), self.close) + + quitaction = qt.TQAction("Quit", qt.TQKeySequence("CTRL+Q"), self) + qt.TQObject.connect(quitaction, qt.SIGNAL("activated()"), self.close) quitaction.addTo(filemenu) - editmenu = qt.QPopupMenu(menu) + editmenu = qt.TQPopupMenu(menu) menu.insertItem("&Edit", editmenu) - undoaction = qt.QAction("Undo", qt.QKeySequence("CTRL+Z"), self) - qt.QObject.connect(undoaction, qt.SIGNAL("activated()"), self.scripttext.undo) + undoaction = qt.TQAction("Undo", qt.TQKeySequence("CTRL+Z"), self) + qt.TQObject.connect(undoaction, qt.SIGNAL("activated()"), self.scripttext.undo) undoaction.addTo(editmenu) - redoaction = qt.QAction("Redo", qt.QKeySequence("CTRL+Shift+Z"), self) - qt.QObject.connect(redoaction, qt.SIGNAL("activated()"), self.scripttext.redo) + redoaction = qt.TQAction("Redo", qt.TQKeySequence("CTRL+Shift+Z"), self) + qt.TQObject.connect(redoaction, qt.SIGNAL("activated()"), self.scripttext.redo) redoaction.addTo(editmenu) editmenu.insertSeparator() - cutaction = qt.QAction("Cut", qt.QKeySequence("CTRL+X"), self) - qt.QObject.connect(cutaction, qt.SIGNAL("activated()"), self.scripttext.cut) + cutaction = qt.TQAction("Cut", qt.TQKeySequence("CTRL+X"), self) + qt.TQObject.connect(cutaction, qt.SIGNAL("activated()"), self.scripttext.cut) cutaction.addTo(editmenu) - copyaction = qt.QAction("Copy", qt.QKeySequence("CTRL+C"), self) - qt.QObject.connect(copyaction, qt.SIGNAL("activated()"), self.scripttext.copy) + copyaction = qt.TQAction("Copy", qt.TQKeySequence("CTRL+C"), self) + qt.TQObject.connect(copyaction, qt.SIGNAL("activated()"), self.scripttext.copy) copyaction.addTo(editmenu) - pasteaction = qt.QAction("Paste", qt.QKeySequence("CTRL+V"), self) - qt.QObject.connect(pasteaction, qt.SIGNAL("activated()"), self.scripttext.paste) + pasteaction = qt.TQAction("Paste", qt.TQKeySequence("CTRL+V"), self) + qt.TQObject.connect(pasteaction, qt.SIGNAL("activated()"), self.scripttext.paste) pasteaction.addTo(editmenu) - clearaction = qt.QAction("Clear", qt.QKeySequence("CTRL+Shift+X"), self) - qt.QObject.connect(clearaction, qt.SIGNAL("activated()"), self.scripttext.clear) + clearaction = qt.TQAction("Clear", qt.TQKeySequence("CTRL+Shift+X"), self) + qt.TQObject.connect(clearaction, qt.SIGNAL("activated()"), self.scripttext.clear) clearaction.addTo(editmenu) editmenu.insertSeparator() - selallaction = qt.QAction("Select All", 0, self) - qt.QObject.connect(selallaction, qt.SIGNAL("activated()"), self.scripttext.selectAll) + selallaction = qt.TQAction("Select All", 0, self) + qt.TQObject.connect(selallaction, qt.SIGNAL("activated()"), self.scripttext.selectAll) selallaction.addTo(editmenu) - scriptmenu = qt.QPopupMenu(menu) + scriptmenu = qt.TQPopupMenu(menu) menu.insertItem("&Script", scriptmenu) - compileaction = qt.QAction("Compile", qt.QKeySequence("F9"), self) - qt.QObject.connect(compileaction, qt.SIGNAL("activated()"), self.compileScript) + compileaction = qt.TQAction("Compile", qt.TQKeySequence("F9"), self) + qt.TQObject.connect(compileaction, qt.SIGNAL("activated()"), self.compileScript) compileaction.addTo(scriptmenu) - executeaction = qt.QAction("Execute", qt.QKeySequence("F10"), self) - qt.QObject.connect(executeaction, qt.SIGNAL("activated()"), self.executeScript) + executeaction = qt.TQAction("Execute", qt.TQKeySequence("F10"), self) + qt.TQObject.connect(executeaction, qt.SIGNAL("activated()"), self.executeScript) executeaction.addTo(scriptmenu) - self.samplemenu = qt.QPopupMenu(menu) + self.samplemenu = qt.TQPopupMenu(menu) menu.insertItem("&Samples", self.samplemenu) itemid = 500 global Samples for samplename in dir(Samples): if samplename.startswith("_"): continue itemid += 1 - menu = qt.QPopupMenu(self.samplemenu) - qt.QObject.connect(menu, qt.SIGNAL("activated(int)"), self.sampleActivated) + menu = qt.TQPopupMenu(self.samplemenu) + qt.TQObject.connect(menu, qt.SIGNAL("activated(int)"), self.sampleActivated) self.samplemenu.insertItem(samplename, menu, -1, self.samplemenu.count() - 1) attr = getattr(Samples,samplename) for a in dir(attr): @@ -1040,7 +1048,7 @@ class MainDialog(qt.QDialog): def newFile(self): self.console.clear() - #if qt.QMessageBox.warning(self,"Remove?","Remove the selected item?",qt.QMessageBox.Yes,qt.QMessageBox.Cancel) != qt.QMessageBox.Yes: + #if qt.TQMessageBox.warning(self,"Remove?","Remove the selected item?",qt.TQMessageBox.Yes,qt.TQMessageBox.Cancel) != qt.TQMessageBox.Yes: self.scripttext.clear() def openFile(self, filename): @@ -1051,12 +1059,12 @@ class MainDialog(qt.QDialog): file.close() __main__.scripteditorfilename = filename except IOError, (errno, strerror): - qt.QMessageBox.critical(self,"Error","<qt>Failed to open script file \"%s\"<br><br>%s</qt>" % (filename,strerror)) + qt.TQMessageBox.critical(self,"Error","<qt>Failed to open script file \"%s\"<br><br>%s</qt>" % (filename,strerror)) def openFileAs(self): - import qt + from TQt import qt self.console.clear() - filename = str( qt.QFileDialog.getOpenFileName(__main__.scripteditorfilename,"*.py;;*", self) ) + filename = str( qt.TQFileDialog.getOpenFileName(__main__.scripteditorfilename,"*.py;;*", self) ) if filename == "": return self.openFile(filename) @@ -1066,11 +1074,11 @@ class MainDialog(qt.QDialog): file.write( str( self.scripttext.text() ) ) file.close() except IOError, (errno, strerror): - qt.QMessageBox.critical(self,"Error","<qt>Failed to open script file \"%s\"<br><br>%s</qt>" % (__main__.scripteditorfilename,strerror)) + qt.TQMessageBox.critical(self,"Error","<qt>Failed to open script file \"%s\"<br><br>%s</qt>" % (__main__.scripteditorfilename,strerror)) def saveFileAs(self): - import qt - filename = str( qt.QFileDialog.getSaveFileName(__main__.scripteditorfilename,"*.py;;*", self) ) + from TQt import qt + filename = str( qt.TQFileDialog.getSaveFileName(__main__.scripteditorfilename,"*.py;;*", self) ) if filename == "": return __main__.scripteditorfilename = filename self.saveFile() @@ -1080,7 +1088,7 @@ class MainDialog(qt.QDialog): if __name__ == "__main__": scriptpath = os.getcwd() - qtapp = qt.QApplication(sys.argv) + qtapp = qt.TQApplication(sys.argv) else: scriptpath = os.path.dirname(__name__) qtapp = qt.tqApp |