diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2023-01-23 15:51:24 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2023-01-23 15:51:24 +0100 |
commit | 21c6548234338921fe97ec67148e9fa753c694b4 (patch) | |
tree | 3432057bff20868f762ffe12fe42924be193dce4 /kspread/plugins/scripting | |
parent | 86480e58eafc1fa3486e03155ed34e02b4595a24 (diff) | |
download | koffice-21c6548234338921fe97ec67148e9fa753c694b4.tar.gz koffice-21c6548234338921fe97ec67148e9fa753c694b4.zip |
Update after renaming qt => tqt in PyTQt module.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'kspread/plugins/scripting')
-rwxr-xr-x | kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py | 58 | ||||
-rwxr-xr-x | kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py | 270 |
2 files changed, 164 insertions, 164 deletions
diff --git a/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py b/kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py index 7d308ab2..a72c5f6c 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: - from TQt import qt + from TQt import tqt except (ImportError): raise Exception("Failed to import the required PyTQt python module.") -class Dialog(tqt.QDialog): +class Dialog(tqt.TQDialog): def __init__(self, scriptpath, parent): self.scriptpath = scriptpath import krosskspreadcore self.doc = krosskspreadcore.get("KSpreadDocument") - from TQt import qt - qt.TQDialog.__init__(self, parent, "Dialog", 1, qt.TQt.WDestructiveClose) + from TQt import tqt + tqt.TQDialog.__init__(self, parent, "Dialog", 1, tqt.TQt.WDestructiveClose) self.setCaption("Export to HTML File") - layout = qt.TQVBoxLayout(self) - box = qt.TQVBox(self) + layout = tqt.TQVBoxLayout(self) + box = tqt.TQVBox(self) box.setMargin(10) box.setSpacing(10) layout.addWidget(box) - sheetbox = qt.TQHBox(box) + sheetbox = tqt.TQHBox(box) sheetbox.setSpacing(6) - sheetlabel = qt.TQLabel("Sheet:",sheetbox) - self.sheetcombo = qt.TQComboBox(sheetbox) + sheetlabel = tqt.TQLabel("Sheet:",sheetbox) + self.sheetcombo = tqt.TQComboBox(sheetbox) currentsheetname = self.doc.currentSheet().name() for sheetname in self.doc.sheetNames(): self.sheetcombo.insertItem(sheetname) @@ -65,10 +65,10 @@ class Dialog(tqt.QDialog): , } - stylebox = qt.TQHBox(box) + stylebox = tqt.TQHBox(box) stylebox.setSpacing(6) - stylelabel = qt.TQLabel("Style:",stylebox) - self.stylecombo = qt.TQComboBox(stylebox) + stylelabel = tqt.TQLabel("Style:",stylebox) + self.stylecombo = tqt.TQComboBox(stylebox) stylenames = list(self.styles.keys()) stylenames.sort() for stylename in stylenames: @@ -76,30 +76,30 @@ class Dialog(tqt.QDialog): stylelabel.setBuddy(self.stylecombo) stylebox.setStretchFactor(self.stylecombo,1) - filebox = qt.TQHBox(box) + filebox = tqt.TQHBox(box) filebox.setSpacing(6) - 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 = tqt.TQLabel("File:",filebox) + self.fileedit = tqt.TQLineEdit(self.getDefaultFile(),filebox) + btn = tqt.TQPushButton("...",filebox) + tqt.TQObject.connect(btn, tqt.SIGNAL("clicked()"),self.browseClicked) filelabel.setBuddy(self.fileedit) filebox.setStretchFactor(self.fileedit,1) - btnbox = qt.TQHBox(box) + btnbox = tqt.TQHBox(box) btnbox.setSpacing(6) - okbtn = qt.TQPushButton(btnbox) + okbtn = tqt.TQPushButton(btnbox) okbtn.setText("Export") okbtn.setDefault(True) - qt.TQObject.connect(okbtn,qt.SIGNAL("clicked()"),self.startExport) - cancelbtn = qt.TQPushButton(btnbox) + tqt.TQObject.connect(okbtn,tqt.SIGNAL("clicked()"),self.startExport) + cancelbtn = tqt.TQPushButton(btnbox) cancelbtn.setText("Cancel") - qt.TQObject.connect(cancelbtn,qt.SIGNAL("clicked()"),self.close) + tqt.TQObject.connect(cancelbtn,tqt.SIGNAL("clicked()"),self.close) box.setMinimumWidth(480) def browseClicked(self): - from TQt import qt - filename = str( qt.TQFileDialog.getSaveFileName(str(self.fileedit.text()),"*.htm *.html *.xhtml;;*", self) ) + from TQt import tqt + filename = str( tqt.TQFileDialog.getSaveFileName(str(self.fileedit.text()),"*.htm *.html *.xhtml;;*", self) ) if filename != "": self.fileedit.setText(filename) def getDefaultFile(self): @@ -119,7 +119,7 @@ class Dialog(tqt.QDialog): return os.path.join(homepath, "kspreadexport.html") def startExport(self): - from TQt import qt + from TQt import tqt sheetname = str( self.sheetcombo.currentText() ) sheet = self.doc.sheetByName( sheetname ) @@ -130,7 +130,7 @@ class Dialog(tqt.QDialog): file = open(filename, "w") except IOError as xxx_todo_changeme: (errno, strerror) = xxx_todo_changeme.args - qt.TQMessageBox.critical(self,"Error","<qt>Failed to create HTML file \"%s\"<br><br>%s</qt>" % (filename,strerror)) + tqt.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") @@ -171,10 +171,10 @@ class Dialog(tqt.QDialog): if __name__ == "__main__": scriptpath = os.getcwd() - qtapp = qt.TQApplication(sys.argv) + tqtapp = tqt.TQApplication(sys.argv) else: scriptpath = os.path.dirname(__name__) - qtapp = qt.tqApp + tqtapp = tqt.tqApp -dialog = Dialog(scriptpath, qtapp.mainWidget()) +dialog = Dialog(scriptpath, tqtapp.mainWidget()) dialog.exec_loop() diff --git a/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py b/kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py index a6608014..e23b9c56 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: - from TQt import qt + from TQt import tqt except (ImportError): raise Exception("Failed to import the required PyTQt python module.") #################################################################################### # Samples. -class Widget(qt.TQHBox): +class Widget(tqt.TQHBox): def __init__(self, parentwidget, label = None): self.parentwidget = parentwidget - from TQt import qt - qt.TQHBox.__init__(self, parentwidget) + from TQt import tqt + tqt.TQHBox.__init__(self, parentwidget) self.setMargin(4) self.setSpacing(4) - if label != None: qt.TQLabel(label, self) + if label != None: tqt.TQLabel(label, self) def value(self): return None class ListWidget(Widget): def __init__(self, parentwidget, label): - from TQt import qt + from TQt import tqt global Widget Widget.__init__(self, parentwidget, label) - self.combo = qt.TQComboBox(self) + self.combo = tqt.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): - from TQt import qt + from TQt import tqt global Widget Widget.__init__(self, parentwidget, label) - self.edit = qt.TQLineEdit(self) + self.edit = tqt.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 - from TQt import qt + from TQt import tqt global Widget Widget.__init__(self, parentwidget, label) - self.edit = qt.TQLineEdit(self) + self.edit = tqt.TQLineEdit(self) self.setStretchFactor(self.edit,1) - btn = qt.TQPushButton("...",self) - qt.TQObject.connect(btn, qt.SIGNAL("clicked()"), self.btnClicked) + btn = tqt.TQPushButton("...",self) + tqt.TQObject.connect(btn, tqt.SIGNAL("clicked()"), self.btnClicked) def btnClicked(self): - from TQt import qt + from TQt import tqt text = str( self.edit.text() ) if self.openfiledialog: - filename = str( qt.TQFileDialog.getOpenFileName(text, self.filtermask, self.parentwidget) ) + filename = str( tqt.TQFileDialog.getOpenFileName(text, self.filtermask, self.parentwidget) ) else: - filename = qt.TQFileDialog.getSaveFileName(text, self.filtermask, self.parentwidget) + filename = tqt.TQFileDialog.getSaveFileName(text, self.filtermask, self.parentwidget) if filename != "": self.edit.setText( filename ) def value(self): return self.edit.text() @@ -384,7 +384,7 @@ class Samples: def getCode(self): return ( '# Import the PyTQt module.', - 'from TQt import qt', + 'from TQt import tqt', '', 'def loadFile(filename):', ' # Import the krosskspreadcore module.', @@ -395,7 +395,7 @@ class Samples: ' xml = file.read()', ' file.close()', ' except IOError, (errno, strerror):', - ' qt.TQMessageBox.critical(self,"Error","<qt>Failed to read file %s<br><br>%s</qt>" % (filename,strerror))', + ' tqt.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.TQFileDialog.getOpenFileName(filename,"*.xml;;*", self)', + 'openfilename = tqt.TQFileDialog.getOpenFileName(filename,"*.xml;;*", self)', 'if str(openfilename) != "":', ' loadFile( openfilename )', ) @@ -421,7 +421,7 @@ class Samples: def getCode(self): return ( '# Import the PyTQt module.', - 'from TQt import qt', + 'from TQt import tqt', '', 'def saveFile(filename):', ' # Import the krosskspreadcore module.', @@ -430,7 +430,7 @@ class Samples: ' try:', ' file = open(filename, "w")', ' except IOError, (errno, strerror):', - ' qt.TQMessageBox.critical(self,"Error","<qt>Failed to create file %s<br><br>%s</qt>" % (filename,strerror))', + ' tqt.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.TQFileDialog.getSaveFileName(filename,"*.xml;;*", self)', + 'savefilename = tqt.TQFileDialog.getSaveFileName(filename,"*.xml;;*", self)', 'if str(savefilename) != "":', ' saveFile( savefilename )', ) @@ -561,7 +561,7 @@ class Samples: self.parentwidget = parentwidget class OpenFileDialog: - """ Show the usage of the openfile dialog with QFileDialog. """ + """ Show the usage of the openfile dialog with TQFileDialog. """ name = "Open File Dialog" def __init__(self, parent): pass @@ -570,13 +570,13 @@ class Samples: } def getCode(self): return ( - 'from TQt import qt', - 'openfilename = qt.TQFileDialog.getOpenFileName("{FileName}","*.txt *.html;;*", self)', + 'from TQt import tqt', + 'openfilename = tqt.TQFileDialog.getOpenFileName("{FileName}","*.txt *.html;;*", self)', 'print("openfile=%s" % openfilename)', ) class SaveFileDialog: - """ Show the usage of the savefile dialog with QFileDialog. """ + """ Show the usage of the savefile dialog with TQFileDialog. """ name = "Save File Dialog" def __init__(self, parent): pass @@ -585,13 +585,13 @@ class Samples: } def getCode(self): return ( - 'from TQt import qt', - 'savefilename = qt.TQFileDialog.getSaveFileName("{FileName}","*.txt *.html;;*", self)', + 'from TQt import tqt', + 'savefilename = tqt.TQFileDialog.getSaveFileName("{FileName}","*.txt *.html;;*", self)', 'print("savefile=%s" % savefilename)', ) class CustomDialog: - """ Show a custom dialog that inherits a QDialog. """ + """ Show a custom dialog that inherits a TQDialog. """ name = "Custom Dialog" def __init__(self, parent): pass @@ -599,25 +599,25 @@ class Samples: } def getCode(self): return ( - 'from TQt import qt', + 'from TQt import tqt', '', - 'class MyDialog(qt.TQDialog):', + 'class MyDialog(tqt.TQDialog):', ' def __init__(self, parent):', - ' from TQt import qt', - ' qt.TQDialog.__init__(self, parent, "MyDialog", 1, qt.TQt.WDestructiveClose)', + ' from TQt import tqt', + ' tqt.TQDialog.__init__(self, parent, "MyDialog", 1, tqt.TQt.WDestructiveClose)', ' self.setCaption("My Dialog")', - ' btn = qt.TQPushButton("Click me",self)', - ' qt.TQObject.connect(btn, qt.SIGNAL("clicked()"), self.buttonClicked)', + ' btn = tqt.TQPushButton("Click me",self)', + ' tqt.TQObject.connect(btn, tqt.SIGNAL("clicked()"), self.buttonClicked)', ' def buttonClicked(self):', - ' from TQt import qt', - ' qt.TQMessageBox.information(self, "The Caption", "This is the message string.")', + ' from TQt import tqt', + ' tqt.TQMessageBox.information(self, "The Caption", "This is the message string.")', '', 'dialog = MyDialog(self)', 'dialog.exec_loop()', ) class InputDialog: - """ Show how to use a QInputDialog. """ + """ Show how to use a TQInputDialog. """ name = "Input Dialog" def __init__(self, parent): global EditWidget @@ -627,9 +627,9 @@ class Samples: } def getCode(self): return ( - 'from TQt import qt', + 'from TQt import tqt', '', - 'text, ok = qt.TQInputDialog.getText("{Caption}", "{Message}", qt.TQLineEdit.Normal, "")', + 'text, ok = tqt.TQInputDialog.getText("{Caption}", "{Message}", tqt.TQLineEdit.Normal, "")', 'if ok:', ' print("Text defined: %s" % text)', 'else:', @@ -651,13 +651,13 @@ class Samples: } def getCode(self): return ( - 'from TQt import qt', + 'from TQt import tqt', '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.TQDataStream(data, qt.IO_ReadOnly)', + 'ds = tqt.TQDataStream(data, tqt.IO_ReadOnly)', 'print("Clipboard content:\\n%s" % tdecore.dcop_next(ds, TQSTRING_OBJECT_NAME_STRING))', ) @@ -669,7 +669,7 @@ class Samples: } def getCode(self): return ( - 'from TQt import qt', + 'from TQt import tqt', 'import tdecore, dcop, dcopext', '', 'dcopclient = tdecore.TDEApplication.dcopClient()', @@ -678,9 +678,9 @@ class Samples: 'd = dcopext.DCOPApp(app, dcopclient)', '', 'def dataToList(data, types = []):', - ' from TQt import qt', + ' from TQt import tqt', ' import tdecore', - ' ds = qt.TQDataStream(data, qt.IO_ReadOnly)', + ' ds = tqt.TQDataStream(data, tqt.IO_ReadOnly)', ' return [ tdecore.dcop_next(ds, t) for t in types ]', '', 'for funcname in ["totalAlbums","totalArtists","totalCompilations","totalGenres","totalTracks"]:', @@ -696,7 +696,7 @@ class Samples: } def getCode(self): return ( - 'from TQt import qt', + 'from TQt import tqt', 'import tdecore, dcop, dcopext', '', 'dcopclient = tdecore.TDEApplication.dcopClient()', @@ -707,7 +707,7 @@ class Samples: '(state,rtype,rdata) = d.appclient.call("kopete", "KopeteIface", "contacts()","")', 'if not state: raise Exception("Failed to call the kopete contacts-function")', '', - 'ds = qt.TQDataStream(rdata.data(), qt.IO_ReadOnly)', + 'ds = tqt.TQDataStream(rdata.data(), tqt.IO_ReadOnly)', 'sl = tdecore.dcop_next (ds, TQSTRINGLIST_OBJECT_NAME_STRING)', 'print("contacts=%s" % [ str(s) for s in sl ])', ) @@ -720,19 +720,19 @@ class Samples: } def getCode(self): return ( - 'from TQt import qt', + 'from TQt import tqt', 'import tdecore, dcop, dcopext', '', 'def dataToList(data, types = []):', - ' from TQt import qt', + ' from TQt import tqt', ' import tdecore', - ' ds = qt.TQDataStream(data, qt.IO_ReadOnly)', + ' ds = tqt.TQDataStream(data, tqt.IO_ReadOnly)', ' return [ tdecore.dcop_next(ds, t) for t in types ]', 'def listToData(listdict):', - ' from TQt import qt', + ' from TQt import tqt', ' import tdecore', - ' ba= qt.TQByteArray()', - ' ds = qt.TQDataStream(ba, qt.IO_WriteOnly)', + ' ba= tqt.TQByteArray()', + ' ds = tqt.TQDataStream(ba, tqt.IO_WriteOnly)', ' for (typename,value) in listdict:', ' tdecore.dcop_add (ds, value, typename)', ' return ba', @@ -747,7 +747,7 @@ class Samples: '# Call the getDocuments() function.', '(state,rtype,rdata) = d.appclient.call(appname, "KoApplicationIface", "getDocuments()","")', 'if not state: raise Exception("%s: Failed to call getDocuments-function" % appname)', - 'documents = dataToList(rdata,["QValueList<DCOPRef>"])[0]', + 'documents = dataToList(rdata,["TQValueList<DCOPRef>"])[0]', 'print("documents=%s" % [ str( doc.obj() ) for doc in documents ])', 'document = documents[0] # Let\'s just take the first document.', '', @@ -765,48 +765,48 @@ class Samples: #################################################################################### # Dialog implementations. -class SampleDialog(qt.TQDialog): +class SampleDialog(tqt.TQDialog): def __init__(self, parent, sampleclazz, samplechildclazz): - from TQt import qt - qt.TQDialog.__init__(self, parent, "SampleDialog", 1) + from TQt import tqt + tqt.TQDialog.__init__(self, parent, "SampleDialog", 1) - layout = qt.TQVBoxLayout(self) - box = qt.TQVBox(self) + layout = tqt.TQVBoxLayout(self) + box = tqt.TQVBox(self) box.setMargin(4) box.setSpacing(10) layout.addWidget(box) - 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 = tqt.TQScrollView(box) + self.scrollview.setResizePolicy(tqt.TQScrollView.AutoOne) + #self.scrollview.setFrameStyle(tqt.TQFrame.NoFrame); + self.scrollview.setResizePolicy(tqt.TQScrollView.AutoOneFit); self.scrollview.viewport().setPaletteBackgroundColor(self.paletteBackgroundColor()) - mainbox = qt.TQVBox( self.scrollview.viewport() ) + mainbox = tqt.TQVBox( self.scrollview.viewport() ) mainbox.setMargin(6) mainbox.setSpacing(6) - desclabel = qt.TQLabel(mainbox) - qt.TQFrame(mainbox).setFrameStyle( qt.TQFrame.HLine | qt.TQFrame.Sunken ) + desclabel = tqt.TQLabel(mainbox) + tqt.TQFrame(mainbox).setFrameStyle( tqt.TQFrame.HLine | tqt.TQFrame.Sunken ) self.sample = sampleclazz( mainbox ) self.samplechild = samplechildclazz( self.sample ) desclabel.setText( "<qt>%s</qt>" % self.samplechild.__doc__ ) - mainbox.setStretchFactor(qt.TQWidget(mainbox), 1) + mainbox.setStretchFactor(tqt.TQWidget(mainbox), 1) mainbox.show() self.scrollview.addChild(mainbox) - btnbox = qt.TQHBox(box) + btnbox = tqt.TQHBox(box) btnbox.setMargin(6) btnbox.setSpacing(6) - okbtn = qt.TQPushButton(btnbox) + okbtn = tqt.TQPushButton(btnbox) okbtn.setText("Ok") - qt.TQObject.connect(okbtn, qt.SIGNAL("clicked()"), self.okClicked) - cancelbtn = qt.TQPushButton(btnbox) + tqt.TQObject.connect(okbtn, tqt.SIGNAL("clicked()"), self.okClicked) + cancelbtn = tqt.TQPushButton(btnbox) cancelbtn.setText("Cancel") - qt.TQObject.connect(cancelbtn, qt.SIGNAL("clicked()"), self.close) + tqt.TQObject.connect(cancelbtn, tqt.SIGNAL("clicked()"), self.close) self.setCaption(self.samplechild.name) - box.setMinimumSize(qt.TQSize(500,340)) + box.setMinimumSize(tqt.TQSize(500,340)) def okClicked(self): self.code = self.samplechild.getCode() @@ -823,7 +823,7 @@ class SampleDialog(qt.TQDialog): code = code.replace("{%s}" % widgetname, str(value)) return code -class MainDialog(qt.TQDialog): +class MainDialog(tqt.TQDialog): def __init__(self, scriptpath, parent): self.scriptpath = scriptpath if not hasattr(__main__,"scripteditorfilename"): @@ -833,118 +833,118 @@ class MainDialog(qt.TQDialog): self.doc = krosskspreadcore.get("KSpreadDocument") import os - from TQt import qt - qt.TQDialog.__init__(self, parent, "MainDialog", 1, qt.TQt.WDestructiveClose) + from TQt import tqt + tqt.TQDialog.__init__(self, parent, "MainDialog", 1, tqt.TQt.WDestructiveClose) self.setCaption("Script Editor") - layout = qt.TQVBoxLayout(self) - box = qt.TQVBox(self) + layout = tqt.TQVBoxLayout(self) + box = tqt.TQVBox(self) box.setMargin(4) box.setSpacing(10) layout.addWidget(box) - menu = qt.TQMenuBar(box) + menu = tqt.TQMenuBar(box) - splitter = qt.TQSplitter(box) - splitter.setOrientation(qt.TQt.Vertical) + splitter = tqt.TQSplitter(box) + splitter.setOrientation(tqt.TQt.Vertical) - 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.scripttext = tqt.TQMultiLineEdit(splitter) + self.scripttext.setWordWrap( tqt.TQTextEdit.NoWrap ) + self.scripttext.setTextFormat( tqt.TQt.PlainText ) + tqt.TQObject.connect(self.scripttext, tqt.SIGNAL("cursorPositionChanged(int,int)"),self.cursorPositionChanged) - self.console = qt.TQTextBrowser(splitter) - splitter.setResizeMode(self.console, qt.TQSplitter.KeepSize) + self.console = tqt.TQTextBrowser(splitter) + splitter.setResizeMode(self.console, tqt.TQSplitter.KeepSize) - statusbar = qt.TQStatusBar(box) - self.messagestatus = qt.TQLabel(statusbar) + statusbar = tqt.TQStatusBar(box) + self.messagestatus = tqt.TQLabel(statusbar) statusbar.addWidget(self.messagestatus,1) - self.cursorstatus = qt.TQLabel(statusbar) + self.cursorstatus = tqt.TQLabel(statusbar) statusbar.addWidget(self.cursorstatus) self.cursorPositionChanged() - box.setMinimumSize( qt.TQSize(680,540) ) + box.setMinimumSize( tqt.TQSize(680,540) ) - filemenu = qt.TQPopupMenu(menu) + filemenu = tqt.TQPopupMenu(menu) menu.insertItem("&File", filemenu) - newaction = qt.TQAction("New", qt.TQKeySequence("CTRL+N"), self) - qt.TQObject.connect(newaction, qt.SIGNAL("activated()"), self.newFile) + newaction = tqt.TQAction("New", tqt.TQKeySequence("CTRL+N"), self) + tqt.TQObject.connect(newaction, tqt.SIGNAL("activated()"), self.newFile) newaction.addTo(filemenu) - openaction = qt.TQAction("Open...", qt.TQKeySequence("CTRL+O"), self) - qt.TQObject.connect(openaction, qt.SIGNAL("activated()"), self.openFileAs) + openaction = tqt.TQAction("Open...", tqt.TQKeySequence("CTRL+O"), self) + tqt.TQObject.connect(openaction, tqt.SIGNAL("activated()"), self.openFileAs) openaction.addTo(filemenu) - saveaction = qt.TQAction("Save", qt.TQKeySequence("CTRL+S"), self) - qt.TQObject.connect(saveaction, qt.SIGNAL("activated()"), self.saveFile) + saveaction = tqt.TQAction("Save", tqt.TQKeySequence("CTRL+S"), self) + tqt.TQObject.connect(saveaction, tqt.SIGNAL("activated()"), self.saveFile) saveaction.addTo(filemenu) - saveasaction = qt.TQAction("Save as...", qt.TQKeySequence("CTRL+A"), self) - qt.TQObject.connect(saveasaction, qt.SIGNAL("activated()"), self.saveFileAs) + saveasaction = tqt.TQAction("Save as...", tqt.TQKeySequence("CTRL+A"), self) + tqt.TQObject.connect(saveasaction, tqt.SIGNAL("activated()"), self.saveFileAs) saveasaction.addTo(filemenu) filemenu.insertSeparator() - quitaction = qt.TQAction("Quit", qt.TQKeySequence("CTRL+Q"), self) - qt.TQObject.connect(quitaction, qt.SIGNAL("activated()"), self.close) + quitaction = tqt.TQAction("Quit", tqt.TQKeySequence("CTRL+Q"), self) + tqt.TQObject.connect(quitaction, tqt.SIGNAL("activated()"), self.close) quitaction.addTo(filemenu) - editmenu = qt.TQPopupMenu(menu) + editmenu = tqt.TQPopupMenu(menu) menu.insertItem("&Edit", editmenu) - undoaction = qt.TQAction("Undo", qt.TQKeySequence("CTRL+Z"), self) - qt.TQObject.connect(undoaction, qt.SIGNAL("activated()"), self.scripttext.undo) + undoaction = tqt.TQAction("Undo", tqt.TQKeySequence("CTRL+Z"), self) + tqt.TQObject.connect(undoaction, tqt.SIGNAL("activated()"), self.scripttext.undo) undoaction.addTo(editmenu) - redoaction = qt.TQAction("Redo", qt.TQKeySequence("CTRL+Shift+Z"), self) - qt.TQObject.connect(redoaction, qt.SIGNAL("activated()"), self.scripttext.redo) + redoaction = tqt.TQAction("Redo", tqt.TQKeySequence("CTRL+Shift+Z"), self) + tqt.TQObject.connect(redoaction, tqt.SIGNAL("activated()"), self.scripttext.redo) redoaction.addTo(editmenu) editmenu.insertSeparator() - cutaction = qt.TQAction("Cut", qt.TQKeySequence("CTRL+X"), self) - qt.TQObject.connect(cutaction, qt.SIGNAL("activated()"), self.scripttext.cut) + cutaction = tqt.TQAction("Cut", tqt.TQKeySequence("CTRL+X"), self) + tqt.TQObject.connect(cutaction, tqt.SIGNAL("activated()"), self.scripttext.cut) cutaction.addTo(editmenu) - copyaction = qt.TQAction("Copy", qt.TQKeySequence("CTRL+C"), self) - qt.TQObject.connect(copyaction, qt.SIGNAL("activated()"), self.scripttext.copy) + copyaction = tqt.TQAction("Copy", tqt.TQKeySequence("CTRL+C"), self) + tqt.TQObject.connect(copyaction, tqt.SIGNAL("activated()"), self.scripttext.copy) copyaction.addTo(editmenu) - pasteaction = qt.TQAction("Paste", qt.TQKeySequence("CTRL+V"), self) - qt.TQObject.connect(pasteaction, qt.SIGNAL("activated()"), self.scripttext.paste) + pasteaction = tqt.TQAction("Paste", tqt.TQKeySequence("CTRL+V"), self) + tqt.TQObject.connect(pasteaction, tqt.SIGNAL("activated()"), self.scripttext.paste) pasteaction.addTo(editmenu) - clearaction = qt.TQAction("Clear", qt.TQKeySequence("CTRL+Shift+X"), self) - qt.TQObject.connect(clearaction, qt.SIGNAL("activated()"), self.scripttext.clear) + clearaction = tqt.TQAction("Clear", tqt.TQKeySequence("CTRL+Shift+X"), self) + tqt.TQObject.connect(clearaction, tqt.SIGNAL("activated()"), self.scripttext.clear) clearaction.addTo(editmenu) editmenu.insertSeparator() - selallaction = qt.TQAction("Select All", 0, self) - qt.TQObject.connect(selallaction, qt.SIGNAL("activated()"), self.scripttext.selectAll) + selallaction = tqt.TQAction("Select All", 0, self) + tqt.TQObject.connect(selallaction, tqt.SIGNAL("activated()"), self.scripttext.selectAll) selallaction.addTo(editmenu) - scriptmenu = qt.TQPopupMenu(menu) + scriptmenu = tqt.TQPopupMenu(menu) menu.insertItem("&Script", scriptmenu) - compileaction = qt.TQAction("Compile", qt.TQKeySequence("F9"), self) - qt.TQObject.connect(compileaction, qt.SIGNAL("activated()"), self.compileScript) + compileaction = tqt.TQAction("Compile", tqt.TQKeySequence("F9"), self) + tqt.TQObject.connect(compileaction, tqt.SIGNAL("activated()"), self.compileScript) compileaction.addTo(scriptmenu) - executeaction = qt.TQAction("Execute", qt.TQKeySequence("F10"), self) - qt.TQObject.connect(executeaction, qt.SIGNAL("activated()"), self.executeScript) + executeaction = tqt.TQAction("Execute", tqt.TQKeySequence("F10"), self) + tqt.TQObject.connect(executeaction, tqt.SIGNAL("activated()"), self.executeScript) executeaction.addTo(scriptmenu) - self.samplemenu = qt.TQPopupMenu(menu) + self.samplemenu = tqt.TQPopupMenu(menu) menu.insertItem("&Samples", self.samplemenu) itemid = 500 global Samples for samplename in dir(Samples): if samplename.startswith("_"): continue itemid += 1 - menu = qt.TQPopupMenu(self.samplemenu) - qt.TQObject.connect(menu, qt.SIGNAL("activated(int)"), self.sampleActivated) + menu = tqt.TQPopupMenu(self.samplemenu) + tqt.TQObject.connect(menu, tqt.SIGNAL("activated(int)"), self.sampleActivated) self.samplemenu.insertItem(samplename, menu, -1, self.samplemenu.count() - 1) attr = getattr(Samples,samplename) for a in dir(attr): @@ -1048,7 +1048,7 @@ class MainDialog(qt.TQDialog): def newFile(self): self.console.clear() - #if qt.TQMessageBox.warning(self,"Remove?","Remove the selected item?",qt.TQMessageBox.Yes,qt.TQMessageBox.Cancel) != qt.TQMessageBox.Yes: + #if tqt.TQMessageBox.warning(self,"Remove?","Remove the selected item?",tqt.TQMessageBox.Yes,tqt.TQMessageBox.Cancel) != tqt.TQMessageBox.Yes: self.scripttext.clear() def openFile(self, filename): @@ -1060,12 +1060,12 @@ class MainDialog(qt.TQDialog): __main__.scripteditorfilename = filename except IOError as xxx_todo_changeme: (errno, strerror) = xxx_todo_changeme.args - qt.TQMessageBox.critical(self,"Error","<qt>Failed to open script file \"%s\"<br><br>%s</qt>" % (filename,strerror)) + tqt.TQMessageBox.critical(self,"Error","<qt>Failed to open script file \"%s\"<br><br>%s</qt>" % (filename,strerror)) def openFileAs(self): - from TQt import qt + from TQt import tqt self.console.clear() - filename = str( qt.TQFileDialog.getOpenFileName(__main__.scripteditorfilename,"*.py;;*", self) ) + filename = str( tqt.TQFileDialog.getOpenFileName(__main__.scripteditorfilename,"*.py;;*", self) ) if filename == "": return self.openFile(filename) @@ -1076,11 +1076,11 @@ class MainDialog(qt.TQDialog): file.close() except IOError as xxx_todo_changeme1: (errno, strerror) = xxx_todo_changeme1.args - qt.TQMessageBox.critical(self,"Error","<qt>Failed to open script file \"%s\"<br><br>%s</qt>" % (__main__.scripteditorfilename,strerror)) + tqt.TQMessageBox.critical(self,"Error","<qt>Failed to open script file \"%s\"<br><br>%s</qt>" % (__main__.scripteditorfilename,strerror)) def saveFileAs(self): - from TQt import qt - filename = str( qt.TQFileDialog.getSaveFileName(__main__.scripteditorfilename,"*.py;;*", self) ) + from TQt import tqt + filename = str( tqt.TQFileDialog.getSaveFileName(__main__.scripteditorfilename,"*.py;;*", self) ) if filename == "": return __main__.scripteditorfilename = filename self.saveFile() @@ -1090,10 +1090,10 @@ class MainDialog(qt.TQDialog): if __name__ == "__main__": scriptpath = os.getcwd() - qtapp = qt.TQApplication(sys.argv) + tqtapp = tqt.TQApplication(sys.argv) else: scriptpath = os.path.dirname(__name__) - qtapp = qt.tqApp + tqtapp = tqt.tqApp -dialog = MainDialog(scriptpath, qtapp.mainWidget()) +dialog = MainDialog(scriptpath, tqtapp.mainWidget()) dialog.exec_loop() |