diff options
-rwxr-xr-x | chalk/core/createdcop.py | 2 | ||||
-rw-r--r-- | kexi/plugins/scripting/scripts/copycenter/CopyCenter.py | 218 | ||||
-rw-r--r-- | kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py | 192 | ||||
-rw-r--r-- | kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py | 164 | ||||
-rwxr-xr-x | kspread/plugins/scripting/scripts/exporthtml/ExportHtml.py | 58 | ||||
-rwxr-xr-x | kspread/plugins/scripting/scripts/scripteditor/ScriptEditor.py | 270 | ||||
-rw-r--r-- | lib/kformula/prototype/engine.py | 2 | ||||
-rwxr-xr-x | lib/kformula/prototype/main.py | 2 | ||||
-rwxr-xr-x | lib/kformula/prototype/unicode.py | 2 | ||||
-rwxr-xr-x | lib/kformula/scripts/bycodes.py | 8 | ||||
-rwxr-xr-x | lib/kross/python/scripts/gui.py | 78 | ||||
-rw-r--r-- | lib/kross/test/testgui.py | 50 |
12 files changed, 523 insertions, 523 deletions
diff --git a/chalk/core/createdcop.py b/chalk/core/createdcop.py index f51b3968..cefe3fd8 100755 --- a/chalk/core/createdcop.py +++ b/chalk/core/createdcop.py @@ -26,7 +26,7 @@ dcopiface_header = """/* This file is part of the KDE project #include <dcopref.h> #include <dcopobj.h> -#include <qstring.h> +#include <tqstring.h> class %(classname)s; diff --git a/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py b/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py index 7c934da3..6ecbea5f 100644 --- a/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py +++ b/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py @@ -83,38 +83,38 @@ class Copierer: def writeFailed(self,record): pass def runGuiApp(copycenter, name): - from TQt import qt + from TQt import tqt import sys #-------------------------------------------------------------------- - class ListViewDialog(qt.TQDialog): + class ListViewDialog(tqt.TQDialog): def __init__(self, parent, caption): - qt.TQDialog.__init__(self, parent, "ProgressDialog", 1) + tqt.TQDialog.__init__(self, parent, "ProgressDialog", 1) self.parent = parent self.setCaption(caption) - layout = qt.TQVBoxLayout(self) - box = qt.TQVBox(self) + layout = tqt.TQVBoxLayout(self) + box = tqt.TQVBox(self) box.setMargin(2) layout.addWidget(box) - self.listview = qt.TQListView(box) + self.listview = tqt.TQListView(box) self.listview.setAllColumnsShowFocus(True) self.listview.header().setStretchEnabled(True,0) - btnbox = qt.TQHBox(box) + btnbox = tqt.TQHBox(box) btnbox.setMargin(6) btnbox.setSpacing(6) - self.okbtn = qt.TQPushButton(btnbox) + self.okbtn = tqt.TQPushButton(btnbox) self.okbtn.setText("Ok") - #qt.TQObject.connect(okbtn, qt.SIGNAL("clicked()"), self.okClicked) - self.cancelbtn = qt.TQPushButton(btnbox) + #tqt.TQObject.connect(okbtn, tqt.SIGNAL("clicked()"), self.okClicked) + self.cancelbtn = tqt.TQPushButton(btnbox) self.cancelbtn.setText("Cancel") - qt.TQObject.connect(self.cancelbtn, qt.SIGNAL("clicked()"), self.close) - box.setMinimumSize(qt.TQSize(460,380)) + tqt.TQObject.connect(self.cancelbtn, tqt.SIGNAL("clicked()"), self.close) + box.setMinimumSize(tqt.TQSize(460,380)) def addItem(self,valuelist,afteritem = None): if afteritem == None: - item = qt.TQListViewItem(self.listview) + item = tqt.TQListViewItem(self.listview) else: - item = qt.TQListViewItem(self.listview,afteritem) + item = tqt.TQListViewItem(self.listview,afteritem) i = 0 for value in valuelist: item.setText(i,value) @@ -123,20 +123,20 @@ def runGuiApp(copycenter, name): #-------------------------------------------------------------------- - class CopyJobWidget(qt.TQVBox): + class CopyJobWidget(tqt.TQVBox): def __init__(self,dialog,parent): self.dialog = dialog - qt.TQVBox.__init__(self,parent) + tqt.TQVBox.__init__(self,parent) self.setSpacing(6) - typebox = qt.TQHBox(self) + typebox = tqt.TQHBox(self) typebox.setSpacing(6) - label = qt.TQLabel("Job File:",typebox) - self.jobfilecombobox = qt.TQComboBox(typebox) + label = tqt.TQLabel("Job File:",typebox) + self.jobfilecombobox = tqt.TQComboBox(typebox) typebox.setStretchFactor(self.jobfilecombobox,1) self.jobfilecombobox.setEditable(True) self.jobfilecombobox.insertItem("") label.setBuddy(self.jobfilecombobox) - qt.TQObject.connect(self.jobfilecombobox, qt.SIGNAL("textChanged(const QString&)"), self.jobfilecomboboxChanged) + tqt.TQObject.connect(self.jobfilecombobox, tqt.SIGNAL("textChanged(const TQString&)"), self.jobfilecomboboxChanged) import os import re @@ -145,22 +145,22 @@ def runGuiApp(copycenter, name): if os.path.isfile(file) and re.search(".+\\.copycenterjob.xml$",f): self.jobfilecombobox.insertItem(file) - loadbtn = qt.TQPushButton(typebox) + loadbtn = tqt.TQPushButton(typebox) loadbtn.setText("Open...") - qt.TQObject.connect(loadbtn, qt.SIGNAL("clicked()"), self.openClicked) - savebtn = qt.TQPushButton(typebox) + tqt.TQObject.connect(loadbtn, tqt.SIGNAL("clicked()"), self.openClicked) + savebtn = tqt.TQPushButton(typebox) savebtn.setText("Save...") - qt.TQObject.connect(savebtn, qt.SIGNAL("clicked()"), self.saveClicked) + tqt.TQObject.connect(savebtn, tqt.SIGNAL("clicked()"), self.saveClicked) - self.listview = qt.TQListView(self) + self.listview = tqt.TQListView(self) self.listview.setAllColumnsShowFocus(True) self.listview.setSorting(-1) - self.listview.setDefaultRenameAction(qt.TQListView.Reject) + self.listview.setDefaultRenameAction(tqt.TQListView.Reject) self.listview.header().setClickEnabled(False) self.listview.addColumn("Name") self.listview.addColumn("Value") - qt.TQObject.connect(self.listview, qt.SIGNAL("doubleClicked(QListViewItem*, const QPoint&, int)"), self.doubleClicked) - #qt.TQObject.connect(self.listview, qt.SIGNAL("itemRenamed(QListViewItem*, int, const QString&)"), self.itemRenamed) + tqt.TQObject.connect(self.listview, tqt.SIGNAL("doubleClicked(TQListViewItem*, const TQPoint&, int)"), self.doubleClicked) + #tqt.TQObject.connect(self.listview, tqt.SIGNAL("itemRenamed(TQListViewItem*, int, const TQString&)"), self.itemRenamed) def doubleClicked(self, **args): print("CopyJobWidget.doubleClicked") @@ -190,12 +190,12 @@ def runGuiApp(copycenter, name): raise Exception("The XML-file \"%s\" does not contain a valid copy-job." % filename) sourcepluginname = str(sourcenode.getAttribute('plugin')) - if not self.dialog.sourcedata.combobox.listBox().findItem(sourcepluginname,qt.TQt.ExactMatch): + if not self.dialog.sourcedata.combobox.listBox().findItem(sourcepluginname,tqt.TQt.ExactMatch): raise Exception("There exists no plugin with the name \"%s\"." % sourcepluginname) self.dialog.sourcedata.combobox.setCurrentText(sourcepluginname) destinationpluginname = str(destinationnode.getAttribute('plugin')) - if not self.dialog.destinationdata.combobox.listBox().findItem(destinationpluginname,qt.TQt.ExactMatch): + if not self.dialog.destinationdata.combobox.listBox().findItem(destinationpluginname,tqt.TQt.ExactMatch): raise Exception("There exists no plugin with the name \"%s\"." % destinationpluginname) self.dialog.destinationdata.combobox.setCurrentText(destinationpluginname) @@ -206,7 +206,7 @@ def runGuiApp(copycenter, name): def openClicked(self): text = str(self.jobfilecombobox.currentText()) if text == "": text = self.dialog.copycenter.homepath - filename = str(qt.TQFileDialog.getOpenFileName(text,"*.copycenterjob.xml;;*",self.dialog)) + filename = str(tqt.TQFileDialog.getOpenFileName(text,"*.copycenterjob.xml;;*",self.dialog)) if filename != "": self.jobfilecombobox.setCurrentText(filename) def escape(self,s): @@ -225,7 +225,7 @@ def runGuiApp(copycenter, name): if text == "": import os text = os.path.join(self.dialog.copycenter.homepath,"default.copycenterjob.xml") - filename = str(qt.TQFileDialog.getSaveFileName(text,"*.copycenterjob.xml;;*",self.dialog)) + filename = str(tqt.TQFileDialog.getSaveFileName(text,"*.copycenterjob.xml;;*",self.dialog)) if str(filename) == "": return f = open(filename, "w") f.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") @@ -240,40 +240,40 @@ def runGuiApp(copycenter, name): def addItem(self, pluginimpl, afteritem = None, parentitem = None): #print "CopyJobWidget.addItem" - class ListViewItem(qt.TQListViewItem): + class ListViewItem(tqt.TQListViewItem): def __init__(self, pluginimpl, listview, parentitem = None, afteritem = None): self.pluginimpl = pluginimpl if parentitem == None: - qt.TQListViewItem.__init__(self,listview) + tqt.TQListViewItem.__init__(self,listview) self.setOpen(True) else: if afteritem == None: - qt.TQListViewItem.__init__(self,parentitem) + tqt.TQListViewItem.__init__(self,parentitem) else: - qt.TQListViewItem.__init__(self,parentitem,afteritem) + tqt.TQListViewItem.__init__(self,parentitem,afteritem) self.setRenameEnabled(1,True) def startRename(self, columnindex): - qt.TQListViewItem.startRename(self,columnindex) - #lineedit = self.listView().viewport().child("qt_renamebox") + tqt.TQListViewItem.startRename(self,columnindex) + #lineedit = self.listView().viewport().child("tqt_renamebox") #if lineedit: - # regexp = qt.TQRegExp("^[_A-Z]+[_A-Z0-9]*$", False) - # v = qt.TQRegExpValidator(regexp, self.listView()); + # regexp = tqt.TQRegExp("^[_A-Z]+[_A-Z0-9]*$", False) + # v = tqt.TQRegExpValidator(regexp, self.listView()); # lineedit.setValidator(v) def okRename(self, columnindex): if columnindex == 1: n = str(self.text(0)) if n not in self.pluginimpl.options: raise Exception("No such option \"%s\"" % n) - qt.TQListViewItem.okRename(self,columnindex) - v = str(qt.TQListViewItem.text(self,1)) + tqt.TQListViewItem.okRename(self,columnindex) + v = str(tqt.TQListViewItem.text(self,1)) print("Option \"%s\" has value \"%s\" now." % (n,v)) self.pluginimpl.options[n] = v def text(self, columnindex): if columnindex == 1: - if qt.TQListViewItem.text(self,0).contains("password"): - return "*" * len(str(qt.TQListViewItem.text(self,1))) - return qt.TQListViewItem.text(self,columnindex) + if tqt.TQListViewItem.text(self,0).contains("password"): + return "*" * len(str(tqt.TQListViewItem.text(self,1))) + return tqt.TQListViewItem.text(self,columnindex) return ListViewItem(pluginimpl, self.listview, parentitem, afteritem) def updateItem(self,pluginname,pluginimpl): @@ -303,47 +303,47 @@ def runGuiApp(copycenter, name): #-------------------------------------------------------------------- - class ProgressDialog(qt.TQDialog): + class ProgressDialog(tqt.TQDialog): def __init__(self, dialog): self.dialog = dialog self.starttime = None - qt.TQDialog.__init__(self, dialog, "ProgressDialog", 1) + tqt.TQDialog.__init__(self, dialog, "ProgressDialog", 1) self.setCaption("Copying...") - layout = qt.TQVBoxLayout(self) - box = qt.TQVBox(self) + layout = tqt.TQVBoxLayout(self) + box = tqt.TQVBox(self) box.setSpacing(6) box.setMargin(6) layout.addWidget(box) - self.textbrowser = qt.TQTextBrowser(box) - self.textbrowser.setWordWrap(qt.TQTextEdit.WidgetWidth) - self.textbrowser.setTextFormat(qt.TQt.RichText) - statusbox = qt.TQFrame(box) - layout = qt.TQGridLayout(statusbox,4,2,0,2) - layout.addWidget(qt.TQLabel("Number of records done:",statusbox),0,0) + self.textbrowser = tqt.TQTextBrowser(box) + self.textbrowser.setWordWrap(tqt.TQTextEdit.WidgetWidth) + self.textbrowser.setTextFormat(tqt.TQt.RichText) + statusbox = tqt.TQFrame(box) + layout = tqt.TQGridLayout(statusbox,4,2,0,2) + layout.addWidget(tqt.TQLabel("Number of records done:",statusbox),0,0) self.donecounter = 0 - self.donelabel = qt.TQLabel("-",statusbox) + self.donelabel = tqt.TQLabel("-",statusbox) layout.addWidget(self.donelabel,0,1) - layout.addWidget(qt.TQLabel("Successfully copied records:",statusbox),1,0) + layout.addWidget(tqt.TQLabel("Successfully copied records:",statusbox),1,0) self.successcounter = 0 - self.successlabel = qt.TQLabel("-",statusbox) + self.successlabel = tqt.TQLabel("-",statusbox) layout.addWidget(self.successlabel,1,1) - layout.addWidget(qt.TQLabel("Failed to copy records:",statusbox),2,0) + layout.addWidget(tqt.TQLabel("Failed to copy records:",statusbox),2,0) self.failedcounter = 0 - self.failedlabel = qt.TQLabel("-",statusbox) + self.failedlabel = tqt.TQLabel("-",statusbox) layout.addWidget(self.failedlabel,2,1) - layout.addWidget(qt.TQLabel("Elapsed time in seconds:",statusbox),3,0) - self.elapsedlabel = qt.TQLabel("-",statusbox) + layout.addWidget(tqt.TQLabel("Elapsed time in seconds:",statusbox),3,0) + self.elapsedlabel = tqt.TQLabel("-",statusbox) layout.addWidget(self.elapsedlabel,3,1) - btnbox = qt.TQHBox(box) + btnbox = tqt.TQHBox(box) btnbox.setSpacing(6) - self.donebtn = qt.TQPushButton(btnbox) + self.donebtn = tqt.TQPushButton(btnbox) self.donebtn.setText("Done") self.donebtn.setEnabled(False) - qt.TQObject.connect(self.donebtn,qt.SIGNAL("clicked()"),self.close) - self.cancelbtn = qt.TQPushButton(btnbox) + tqt.TQObject.connect(self.donebtn,tqt.SIGNAL("clicked()"),self.close) + self.cancelbtn = tqt.TQPushButton(btnbox) self.cancelbtn.setText("Cancel") - qt.TQObject.connect(self.cancelbtn,qt.SIGNAL("clicked()"),self.close) - box.setMinimumSize( qt.TQSize(500,380) ) + tqt.TQObject.connect(self.cancelbtn,tqt.SIGNAL("clicked()"),self.close) + box.setMinimumSize( tqt.TQSize(500,380) ) def updateStates(self): if self.starttime != None: @@ -359,11 +359,11 @@ def runGuiApp(copycenter, name): def writeSuccess(self, record, rowcount): self.donecounter += rowcount self.successcounter += rowcount - qt.tqApp.processEvents() + tqt.tqApp.processEvents() def writeFailed(self, record): self.donecounter += 1 self.failedcounter += 1 - qt.tqApp.processEvents() + tqt.tqApp.processEvents() def startCopy(self): try: @@ -373,9 +373,9 @@ def runGuiApp(copycenter, name): copierer.writeSuccess = self.writeSuccess copierer.writeFailed = self.writeFailed - self.starttime = qt.TQTime() - self.updatetimer = qt.TQTimer(self) - qt.TQObject.connect(self.updatetimer,qt.SIGNAL("timeout()"),self.updateStates) + self.starttime = tqt.TQTime() + self.updatetimer = tqt.TQTimer(self) + tqt.TQObject.connect(self.updatetimer,tqt.SIGNAL("timeout()"),self.updateStates) # Initialize the source sourcename = self.dialog.getSourcePluginName() @@ -397,7 +397,7 @@ def runGuiApp(copycenter, name): self.starttime.start() self.updatetimer.start(500) - qt.tqApp.processEvents() + tqt.tqApp.processEvents() # Copy the records self.textbrowser.append("<hr><i>Copy the records...</i>") @@ -426,13 +426,13 @@ def runGuiApp(copycenter, name): self.starttime = None def show(self): - qt.TQDialog.show(self) - qt.TQTimer.singleShot(10,self.startCopy) - qt.tqApp.processEvents() + tqt.TQDialog.show(self) + tqt.TQTimer.singleShot(10,self.startCopy) + tqt.tqApp.processEvents() def closeEvent(self, closeevent): if not self.dialog.getSourcePluginImpl().isFinished(): - if qt.TQMessageBox.warning(self,"Abort?","Abort the copy?",qt.TQMessageBox.Yes,qt.TQMessageBox.No) != qt.TQMessageBox.Yes: + if tqt.TQMessageBox.warning(self,"Abort?","Abort the copy?",tqt.TQMessageBox.Yes,tqt.TQMessageBox.No) != tqt.TQMessageBox.Yes: closeevent.ignore() return self.dialog.getSourcePluginImpl().finish() @@ -441,35 +441,35 @@ def runGuiApp(copycenter, name): #-------------------------------------------------------------------- - class DataSelector(qt.TQVGroupBox): + class DataSelector(tqt.TQVGroupBox): def __init__(self, plugintype, title, caption, parent, dialog, items): self.plugintype = plugintype self.pluginimpl = None self.dialog = dialog self.mainbox = None - qt.TQVGroupBox.__init__(self,title,parent) + tqt.TQVGroupBox.__init__(self,title,parent) self.setInsideMargin(6) self.setInsideSpacing(0) - typebox = qt.TQHBox(self) - label = qt.TQLabel(caption,typebox) - self.combobox = qt.TQComboBox(typebox) + typebox = tqt.TQHBox(self) + label = tqt.TQLabel(caption,typebox) + self.combobox = tqt.TQComboBox(typebox) for item in items: self.combobox.insertItem(str(item)) label.setBuddy(self.combobox) typebox.setStretchFactor(self.combobox,1) - self.scrollview = qt.TQScrollView(self) + self.scrollview = tqt.TQScrollView(self) try: - self.scrollview.setResizePolicy(qt.TQScrollView.AutoOne) - self.scrollview.setFrameStyle(qt.TQFrame.NoFrame); - self.scrollview.setResizePolicy(qt.TQScrollView.AutoOneFit); + self.scrollview.setResizePolicy(tqt.TQScrollView.AutoOne) + self.scrollview.setFrameStyle(tqt.TQFrame.NoFrame); + self.scrollview.setResizePolicy(tqt.TQScrollView.AutoOneFit); self.scrollview.viewport().setPaletteBackgroundColor(self.paletteBackgroundColor()) except: import traceback print("".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) )) - qt.TQObject.connect(self.combobox, qt.SIGNAL("activated(int)"), self.activated) + tqt.TQObject.connect(self.combobox, tqt.SIGNAL("activated(int)"), self.activated) def updatePlugin(self): print("DataSelector.updatePlugin") @@ -490,7 +490,7 @@ def runGuiApp(copycenter, name): def updateMainBox(self): print("DataSelector.updateMainBox") self.removeMainBox() - self.mainbox = qt.TQVBox( self.scrollview.viewport() ) + self.mainbox = tqt.TQVBox( self.scrollview.viewport() ) self.mainbox.setSpacing(2) if self.pluginimpl != None: try: @@ -498,7 +498,7 @@ def runGuiApp(copycenter, name): except: import traceback print("".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) )) - self.mainbox.setStretchFactor(qt.TQWidget(self.mainbox), 1) + self.mainbox.setStretchFactor(tqt.TQWidget(self.mainbox), 1) self.mainbox.show() self.scrollview.addChild(self.mainbox) @@ -509,7 +509,7 @@ def runGuiApp(copycenter, name): def maybeUpdate(self): print("DataSelector.maybeUpdate") self.removeMainBox() - qt.TQTimer.singleShot(50, self.activated) + tqt.TQTimer.singleShot(50, self.activated) def maybeDone(self): print("DataSelector.maybeDone") @@ -519,30 +519,30 @@ def runGuiApp(copycenter, name): #-------------------------------------------------------------------- - class Dialog(qt.TQDialog): + class Dialog(tqt.TQDialog): def __init__(self, copycenter, parent): self.copycenter = copycenter - from TQt import qt + from TQt import tqt import os import sys self.ListViewDialog = ListViewDialog - qt.TQDialog.__init__(self, parent, "Dialog", 1, qt.TQt.WDestructiveClose) + tqt.TQDialog.__init__(self, parent, "Dialog", 1, tqt.TQt.WDestructiveClose) self.setCaption("Copy Center") - layout = qt.TQVBoxLayout(self) - box = qt.TQVBox(self) + layout = tqt.TQVBoxLayout(self) + box = tqt.TQVBox(self) box.setMargin(6) box.setSpacing(6) layout.addWidget(box) - self.tab = qt.TQTabWidget(box) + self.tab = tqt.TQTabWidget(box) self.tab.setMargin(6) box.setStretchFactor(self.tab,1) self.jobsbox = CopyJobWidget(self,self.tab) self.tab.addTab(self.jobsbox,"Jobs") - self.splitter = qt.TQSplitter(self.tab) + self.splitter = tqt.TQSplitter(self.tab) sourceplugins = [] destinationplugins = [] @@ -565,26 +565,26 @@ def runGuiApp(copycenter, name): "Destination:", # caption self.splitter, self, destinationplugins) - btnbox = qt.TQHBox(box) + btnbox = tqt.TQHBox(box) btnbox.setSpacing(6) - okbtn = qt.TQPushButton(btnbox) + okbtn = tqt.TQPushButton(btnbox) okbtn.setText("Start Copy") okbtn.setDefault(True) - qt.TQObject.connect(okbtn,qt.SIGNAL("clicked()"),self.startCopy) - cancelbtn = qt.TQPushButton(btnbox) + tqt.TQObject.connect(okbtn,tqt.SIGNAL("clicked()"),self.startCopy) + 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.tab.addTab(self.splitter,"Copy") self.tab.setCurrentPage(1) - self.helpbrowser = qt.TQTextBrowser(self.tab) + self.helpbrowser = tqt.TQTextBrowser(self.tab) self.helpbrowser.setLinkUnderline(False) self.helpbrowser.setUndoRedoEnabled(False) self.tab.addTab(self.helpbrowser,"Help") - qt.TQObject.connect(self.tab,qt.SIGNAL("currentChanged(QWidget*)"),self.currentTabChanged) + tqt.TQObject.connect(self.tab,tqt.SIGNAL("currentChanged(TQWidget*)"),self.currentTabChanged) - box.setMinimumSize( qt.TQSize(760,500) ) + box.setMinimumSize( tqt.TQSize(760,500) ) defaultfile = os.path.join(self.copycenter.homepath,"default.copycenterjob.xml") if os.path.isfile(defaultfile): @@ -627,10 +627,10 @@ def runGuiApp(copycenter, name): #-------------------------------------------------------------------- if name == "__main__": - qtapp = qt.TQApplication(sys.argv) + tqtapp = tqt.TQApplication(sys.argv) else: - qtapp = qt.tqApp - dialog = Dialog(copycenter, qtapp.mainWidget()) + tqtapp = tqt.tqApp + dialog = Dialog(copycenter, tqtapp.mainWidget()) dialog.exec_loop() import os diff --git a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py index 20b81212..ca6a3f6b 100644 --- a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py +++ b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py @@ -197,25 +197,25 @@ class CopyCenterPlugin: self.copycenter = copycenter def createWidget(self, dialog, plugin, parent): - """ Each plugin may provide a qt.TQWidget back to the + """ Each plugin may provide a tqt.TQWidget back to the CopyCenter.py. The widget will be used to configure our plugin settings. """ - from TQt import qt + from TQt import tqt import os import re self.dialog = dialog self.mainbox = None - class ProjectBox(qt.TQHBox): + class ProjectBox(tqt.TQHBox): def __init__(self,main,copycenterplugin,plugin,parent): self.main = main self.copycenterplugin = copycenterplugin self.plugin = plugin - qt.TQHBox.__init__(self,parent) - prjlabel = qt.TQLabel("Project File:",self) - self.prjcombo = qt.TQComboBox(self) + tqt.TQHBox.__init__(self,parent) + prjlabel = tqt.TQLabel("Project File:",self) + self.prjcombo = tqt.TQComboBox(self) self.prjcombo.setEditable(True) self.prjcombo.insertItem("") @@ -226,9 +226,9 @@ class CopyCenterPlugin: self.prjcombo.insertItem(os.path.join("~",f)) prjlabel.setBuddy(self.prjcombo) - prjsavebtn = qt.TQPushButton("...",self) - qt.TQObject.connect(prjsavebtn, qt.SIGNAL("clicked()"),self.buttonClicked) - qt.TQObject.connect(self.prjcombo, qt.SIGNAL("textChanged(const QString&)"), self.main.projectChanged) + prjsavebtn = tqt.TQPushButton("...",self) + tqt.TQObject.connect(prjsavebtn, tqt.SIGNAL("clicked()"),self.buttonClicked) + tqt.TQObject.connect(self.prjcombo, tqt.SIGNAL("textChanged(const TQString&)"), self.main.projectChanged) self.setStretchFactor(self.prjcombo,1) def buttonClicked(self): text = str(self.prjcombo.currentText()) @@ -238,31 +238,31 @@ class CopyCenterPlugin: import os text = os.path.join(self.copycenterplugin.copycenter.homepath,text[2:]) if self.plugin.plugintype == "Source": - filename = qt.TQFileDialog.getOpenFileName(text,"*.kexi *.kexis *.kexic;;*",self.copycenterplugin.dialog) + filename = tqt.TQFileDialog.getOpenFileName(text,"*.kexi *.kexis *.kexic;;*",self.copycenterplugin.dialog) else: # "Destination": - filename = qt.TQFileDialog.getSaveFileName(text,"*.kexi *.kexis *.kexic;;*",self.copycenterplugin.dialog) + filename = tqt.TQFileDialog.getSaveFileName(text,"*.kexi *.kexis *.kexic;;*",self.copycenterplugin.dialog) if str(filename) != "": self.prjcombo.setCurrentText(str(filename)) - class DriverBox(qt.TQVBox): + class DriverBox(tqt.TQVBox): def __init__(self,main,parent): - qt.TQVBox.__init__(self,parent) + tqt.TQVBox.__init__(self,parent) self.main = main self.copycenterplugin = main.copycenterplugin self.plugin = main.plugin self.driver = None - driverbox = qt.TQHBox(self) - driverlabel = qt.TQLabel("Driver:",driverbox) - self.drivercombo = qt.TQComboBox(driverbox) + driverbox = tqt.TQHBox(self) + driverlabel = tqt.TQLabel("Driver:",driverbox) + self.drivercombo = tqt.TQComboBox(driverbox) self.drivercombo.insertItem("") for driver in self.copycenterplugin.drivermanager.driverNames(): self.drivercombo.insertItem(driver) - qt.TQObject.connect(self.drivercombo, qt.SIGNAL("activated(int)"), self.activated) + tqt.TQObject.connect(self.drivercombo, tqt.SIGNAL("activated(int)"), self.activated) driverlabel.setBuddy(self.drivercombo) driverbox.setStretchFactor(self.drivercombo,1) - self.box = qt.TQVBox(self) + self.box = tqt.TQVBox(self) self.mainbox = None def activated(self,index): @@ -281,58 +281,58 @@ class CopyCenterPlugin: self.driver = self.copycenterplugin.drivermanager.driver(drivertext) - mainbox = qt.TQVBox(self.box) + mainbox = tqt.TQVBox(self.box) mainbox.setSpacing(2) if self.driver.isFileDriver(): - filebox = qt.TQHBox(mainbox) - filelabel = qt.TQLabel("File:",filebox) - self.fileedit = qt.TQLineEdit(self.plugin.options['file'],filebox) + filebox = tqt.TQHBox(mainbox) + filelabel = tqt.TQLabel("File:",filebox) + self.fileedit = tqt.TQLineEdit(self.plugin.options['file'],filebox) filelabel.setBuddy(self.fileedit) filebox.setStretchFactor(self.fileedit,1) - filebtn = qt.TQPushButton("...",filebox) - qt.TQObject.connect(filebtn, qt.SIGNAL("clicked()"), self.fileClicked) + filebtn = tqt.TQPushButton("...",filebox) + tqt.TQObject.connect(filebtn, tqt.SIGNAL("clicked()"), self.fileClicked) else: - hostbox = qt.TQHBox(mainbox) - hostlabel = qt.TQLabel("Hostname:",hostbox) - self.hostedit = qt.TQLineEdit(self.plugin.options['hostname'],hostbox) + hostbox = tqt.TQHBox(mainbox) + hostlabel = tqt.TQLabel("Hostname:",hostbox) + self.hostedit = tqt.TQLineEdit(self.plugin.options['hostname'],hostbox) hostlabel.setBuddy(self.hostedit) hostbox.setStretchFactor(self.hostedit,1) - portbox = qt.TQHBox(mainbox) - portlabel = qt.TQLabel("Port:",portbox) - self.portedit = qt.TQLineEdit(self.plugin.options['port'],portbox) + portbox = tqt.TQHBox(mainbox) + portlabel = tqt.TQLabel("Port:",portbox) + self.portedit = tqt.TQLineEdit(self.plugin.options['port'],portbox) portlabel.setBuddy(self.portedit) portbox.setStretchFactor(self.portedit,1) - sockbox = qt.TQHBox(mainbox) - self.sockfilecheckbox = qt.TQCheckBox("Socket File:",sockbox) - qt.TQObject.connect(self.sockfilecheckbox, qt.SIGNAL("toggled(bool)"), self.sockfilecheckboxClicked) - self.sockfilebox = qt.TQHBox(sockbox) - self.sockfileedit = qt.TQLineEdit(self.plugin.options['socketfile'],self.sockfilebox) + sockbox = tqt.TQHBox(mainbox) + self.sockfilecheckbox = tqt.TQCheckBox("Socket File:",sockbox) + tqt.TQObject.connect(self.sockfilecheckbox, tqt.SIGNAL("toggled(bool)"), self.sockfilecheckboxClicked) + self.sockfilebox = tqt.TQHBox(sockbox) + self.sockfileedit = tqt.TQLineEdit(self.plugin.options['socketfile'],self.sockfilebox) self.sockfilebox.setEnabled(False) - sockfilebtn = qt.TQPushButton("...",self.sockfilebox) + sockfilebtn = tqt.TQPushButton("...",self.sockfilebox) self.sockfilecheckbox.setChecked( str(self.plugin.options['usesocketfile']) == str(True) ) - qt.TQObject.connect(sockfilebtn, qt.SIGNAL("clicked()"), self.sockfileClicked) + tqt.TQObject.connect(sockfilebtn, tqt.SIGNAL("clicked()"), self.sockfileClicked) self.sockfilebox.setStretchFactor(self.sockfileedit,1) sockbox.setStretchFactor(self.sockfilebox,1) - userbox = qt.TQHBox(mainbox) - userlabel = qt.TQLabel("Username:",userbox) - self.useredit = qt.TQLineEdit(self.plugin.options['username'],userbox) + userbox = tqt.TQHBox(mainbox) + userlabel = tqt.TQLabel("Username:",userbox) + self.useredit = tqt.TQLineEdit(self.plugin.options['username'],userbox) userlabel.setBuddy(self.useredit) userbox.setStretchFactor(self.useredit,1) - passbox = qt.TQHBox(mainbox) - passlabel = qt.TQLabel("Password:",passbox) - self.passedit = qt.TQLineEdit(self.plugin.options['password'],passbox) - self.passedit.setEchoMode(qt.TQLineEdit.Password) + passbox = tqt.TQHBox(mainbox) + passlabel = tqt.TQLabel("Password:",passbox) + self.passedit = tqt.TQLineEdit(self.plugin.options['password'],passbox) + self.passedit.setEchoMode(tqt.TQLineEdit.Password) passlabel.setBuddy(self.passedit) passbox.setStretchFactor(self.passedit,1) - dbbox = qt.TQHBox(mainbox) - dblabel = qt.TQLabel("Database:",dbbox) - self.dbedit = qt.TQLineEdit(self.plugin.options['database'],dbbox) + dbbox = tqt.TQHBox(mainbox) + dblabel = tqt.TQLabel("Database:",dbbox) + self.dbedit = tqt.TQLineEdit(self.plugin.options['database'],dbbox) dblabel.setBuddy(self.dbedit) dbbox.setStretchFactor(self.dbedit,1) #self.tablecombo.setText("") @@ -347,9 +347,9 @@ class CopyCenterPlugin: text = str(self.fileedit.text()) if text == "": text = self.copycenterplugin.copycenter.homepath if self.plugin.plugintype == "Source": - filename = qt.TQFileDialog.getOpenFileName(text,"*",self.copycenterplugin.dialog) + filename = tqt.TQFileDialog.getOpenFileName(text,"*",self.copycenterplugin.dialog) else: # "Destination": - filename = qt.TQFileDialog.getSaveFileName(text,"*",self.copycenterplugin.dialog) + filename = tqt.TQFileDialog.getSaveFileName(text,"*",self.copycenterplugin.dialog) if str(filename) != "": self.fileedit.setText(str(filename)) def sockfilecheckboxClicked(self,checked): self.sockfilebox.setEnabled(checked) @@ -358,21 +358,21 @@ class CopyCenterPlugin: text = str(self.sockfileedit.text()) if text == "": text = self.copycenterplugin.copycenter.homepath if self.plugin.plugintype == "Source": - filename = qt.TQFileDialog.getOpenFileName(text,"*",self.copycenterplugin.dialog) + filename = tqt.TQFileDialog.getOpenFileName(text,"*",self.copycenterplugin.dialog) else: # "Destination": - filename = qt.TQFileDialog.getSaveFileName(text,"*",self.copycenterplugin.dialog) + filename = tqt.TQFileDialog.getSaveFileName(text,"*",self.copycenterplugin.dialog) if str(filename) != "": self.sockfileedit.setText(str(filename)) - class TableBox(qt.TQHBox): + class TableBox(tqt.TQHBox): def __init__(self,copycenterplugin,plugin,parent): - qt.TQHBox.__init__(self,parent) + tqt.TQHBox.__init__(self,parent) self.copycenterplugin = copycenterplugin self.plugin = plugin - tablelabel = qt.TQLabel("Table:",self) - self.tableedit = qt.TQLineEdit(self.plugin.options['table'],self) - self.tablebtn = qt.TQPushButton("...",self) + tablelabel = tqt.TQLabel("Table:",self) + self.tableedit = tqt.TQLineEdit(self.plugin.options['table'],self) + self.tablebtn = tqt.TQPushButton("...",self) self.tablebtn.setEnabled(False) - qt.TQObject.connect(self.tablebtn, qt.SIGNAL("clicked()"), self.buttonClicked) + tqt.TQObject.connect(self.tablebtn, tqt.SIGNAL("clicked()"), self.buttonClicked) tablelabel.setBuddy(self.tableedit) self.setStretchFactor(self.tableedit,1) def buttonClicked(self): @@ -386,14 +386,14 @@ class CopyCenterPlugin: item = None for table in self.mainwidget.plugin.connection.tableNames(): if item == None: - item = qt.TQListViewItem(self.listview,table) + item = tqt.TQListViewItem(self.listview,table) else: - item = qt.TQListViewItem(self.listview,item,table) + item = tqt.TQListViewItem(self.listview,item,table) if table == text: self.listview.setSelected(item,True) self.listview.ensureItemVisible(item) - qt.TQObject.connect(self.listview, qt.SIGNAL("doubleClicked(QListViewItem*, const QPoint&, int)"), self.okClicked) - qt.TQObject.connect(self.okbtn, qt.SIGNAL("clicked()"), self.okClicked) + tqt.TQObject.connect(self.listview, tqt.SIGNAL("doubleClicked(TQListViewItem*, const TQPoint&, int)"), self.okClicked) + tqt.TQObject.connect(self.okbtn, tqt.SIGNAL("clicked()"), self.okClicked) def okClicked(self): item = self.listview.selectedItem() if item == None: @@ -404,26 +404,26 @@ class CopyCenterPlugin: dialog = TableDialog(self) dialog.show() - class FieldBox(qt.TQHBox): + class FieldBox(tqt.TQHBox): def __init__(self,copycenterplugin,plugin,parent): - qt.TQHBox.__init__(self,parent) + tqt.TQHBox.__init__(self,parent) self.copycenterplugin = copycenterplugin self.plugin = plugin self.tablename = "" - fieldslabel = qt.TQLabel("Fields:",self) - self.fieldsedit = qt.TQLineEdit(self.plugin.options['fields'],self) + fieldslabel = tqt.TQLabel("Fields:",self) + self.fieldsedit = tqt.TQLineEdit(self.plugin.options['fields'],self) self.setStretchFactor(self.fieldsedit,1) fieldslabel.setBuddy(self.fieldsedit) - self.fieldsbtn = qt.TQPushButton("...",self) + self.fieldsbtn = tqt.TQPushButton("...",self) self.fieldsbtn.setEnabled(False) - qt.TQObject.connect(self.fieldsbtn, qt.SIGNAL("clicked()"), self.fieldsClicked) + tqt.TQObject.connect(self.fieldsbtn, tqt.SIGNAL("clicked()"), self.fieldsClicked) def fieldsClicked(self): ListViewDialog = self.copycenterplugin.dialog.ListViewDialog class FieldsDialog(ListViewDialog): def __init__(self, fieldbox): ListViewDialog.__init__(self,fieldbox,"Fields") self.fieldbox = fieldbox - self.listview.setSelectionMode(qt.TQListView.Multi) + self.listview.setSelectionMode(tqt.TQListView.Multi) self.listview.setSorting(-1) self.listview.header().setClickEnabled(False) self.listview.addColumn("Name") @@ -441,7 +441,7 @@ class CopyCenterPlugin: item = self.addItem(( field.name(),field.type(),",".join(opts) ),item) if allfields or field.name() in fieldslist: self.listview.setSelected(item,True) - qt.TQObject.connect(self.okbtn, qt.SIGNAL("clicked()"), self.okClicked) + tqt.TQObject.connect(self.okbtn, tqt.SIGNAL("clicked()"), self.okClicked) def okClicked(self): selitems = [] item = self.listview.firstChild() @@ -461,47 +461,47 @@ class CopyCenterPlugin: return self.fieldsbtn.setEnabled(False) - class MainBox(qt.TQHBox): + class MainBox(tqt.TQHBox): def __init__(self,copycenterplugin,plugin,parent): - qt.TQHBox.__init__(self,parent) + tqt.TQHBox.__init__(self,parent) self.copycenterplugin = copycenterplugin self.plugin = plugin self.prjbox = ProjectBox(self,copycenterplugin,plugin,parent) self.driverbox = DriverBox(self,parent) - statusbar = qt.TQHBox(parent) + statusbar = tqt.TQHBox(parent) statusbar.setSpacing(2) - #self.statuslabel = qt.TQLabel("Disconnected",statusbar) + #self.statuslabel = tqt.TQLabel("Disconnected",statusbar) #statusbar.setStretchFactor(self.statuslabel,1) - statusbar.setStretchFactor(qt.TQWidget(statusbar),1) - self.connectbtn = qt.TQPushButton("Connect",statusbar) + statusbar.setStretchFactor(tqt.TQWidget(statusbar),1) + self.connectbtn = tqt.TQPushButton("Connect",statusbar) self.connectbtn.setEnabled(False) - qt.TQObject.connect(self.connectbtn, qt.SIGNAL("clicked()"),self.connectClicked) - self.disconnectbtn = qt.TQPushButton("Disconnect",statusbar) + tqt.TQObject.connect(self.connectbtn, tqt.SIGNAL("clicked()"),self.connectClicked) + self.disconnectbtn = tqt.TQPushButton("Disconnect",statusbar) self.disconnectbtn.setEnabled(False) - qt.TQObject.connect(self.disconnectbtn, qt.SIGNAL("clicked()"),self.disconnectClicked) + tqt.TQObject.connect(self.disconnectbtn, tqt.SIGNAL("clicked()"),self.disconnectClicked) #self.connectionbox = ConnectionBox(copycenterplugin,plugin,parent) self.tablebox = TableBox(copycenterplugin,plugin,parent) self.fieldbox = FieldBox(copycenterplugin,plugin,parent) - qt.TQObject.connect(self.tablebox.tableedit, qt.SIGNAL("textChanged(const QString&)"), self.fieldbox.tableChanged) + tqt.TQObject.connect(self.tablebox.tableedit, tqt.SIGNAL("textChanged(const TQString&)"), self.fieldbox.tableChanged) if self.plugin.options['project'] != '': self.prjbox.prjcombo.setCurrentText(self.plugin.options['project']) if self.plugin.options['driver'] != '': try: - item = str(self.driverbox.drivercombo.listBox().findItem(self.plugin.options['driver'],qt.TQt.ExactMatch).text()) + item = str(self.driverbox.drivercombo.listBox().findItem(self.plugin.options['driver'],tqt.TQt.ExactMatch).text()) self.driverbox.drivercombo.setCurrentText(item) self.driverbox.activated(item) except: pass if self.plugin.plugintype == "Destination": - #typebox = qt.TQHBox(parent) - #label = qt.TQLabel("Operation:",typebox) - #combobox = qt.TQComboBox(typebox) + #typebox = tqt.TQHBox(parent) + #label = tqt.TQLabel("Operation:",typebox) + #combobox = tqt.TQComboBox(typebox) #combobox.insertItem("Append") #combobox.insertItem("Replace") #combobox.insertItem("Update") @@ -511,17 +511,17 @@ class CopyCenterPlugin: #typebox.setStretchFactor(combobox,1) pass elif self.plugin.plugintype == "Source": - wherebox = qt.TQHBox(parent) - wherelabel = qt.TQLabel("Where:",wherebox) - self.whereedit = qt.TQLineEdit(self.plugin.options['where'],wherebox) + wherebox = tqt.TQHBox(parent) + wherelabel = tqt.TQLabel("Where:",wherebox) + self.whereedit = tqt.TQLineEdit(self.plugin.options['where'],wherebox) - #orderbox = qt.TQHBox(parent) - #orderlabel = qt.TQLabel("Order By:",orderbox) - #orderedit = qt.TQLineEdit("",orderbox) + #orderbox = tqt.TQHBox(parent) + #orderlabel = tqt.TQLabel("Order By:",orderbox) + #orderedit = tqt.TQLineEdit("",orderbox) - #errbox = qt.TQHBox(parent) - #errlabel = qt.TQLabel("On Error:",errbox) - #errcombo = qt.TQComboBox(errbox) + #errbox = tqt.TQHBox(parent) + #errlabel = tqt.TQLabel("On Error:",errbox) + #errcombo = tqt.TQComboBox(errbox) #errcombo.insertItem("Ask") #errcombo.insertItem("Skip") #errcombo.insertItem("Abort") @@ -576,7 +576,7 @@ class CopyCenterPlugin: if self.driverbox.driver.isFileDriver(): file = str(self.driverbox.fileedit.text()) if file == "" or not os.path.isfile(file): - qt.TQMessageBox.critical(self,"Failed to connect","There exists no such database file \"%s\"" % file) + tqt.TQMessageBox.critical(self,"Failed to connect","There exists no such database file \"%s\"" % file) return False connectiondata.setFileName(file) connectiondata.setDatabaseName(file) @@ -592,11 +592,11 @@ class CopyCenterPlugin: connection = self.driverbox.driver.createConnection(connectiondata) print("Trying to connect") if not connection.connect(): - qt.TQMessageBox.critical(self,"Failed to connect",connection.lastError()) + tqt.TQMessageBox.critical(self,"Failed to connect",connection.lastError()) return False print("Use database \"%s\"" % connectiondata.databaseName()) if not connection.useDatabase( connectiondata.databaseName() ): - qt.TQMessageBox.critical(self,"Failed to connect",connection.lastError()) + tqt.TQMessageBox.critical(self,"Failed to connect",connection.lastError()) return False print("dbnames = %s" % connection.databaseNames()) print("tablenames = %s" % connection.tableNames()) @@ -608,7 +608,7 @@ class CopyCenterPlugin: def disconnectClicked(self): if not self.plugin.connection.disconnect(): - qt.TQMessageBox.critical(self,"Failed to disconnect",self.plugin.connection.lastError()) + tqt.TQMessageBox.critical(self,"Failed to disconnect",self.plugin.connection.lastError()) return self.updateConnectButtons() diff --git a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py index 76e544a6..8f983eb5 100644 --- a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py +++ b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py @@ -47,7 +47,7 @@ class CopyCenterPlugin: def __init__(self,copycenterplugin): self._init_(copycenterplugin) self.options = { - 'driver': 'QMYSQL3', #'QMYSQL3','QPSQL7','QODBC3',... + 'driver': 'TQMYSQL3', #'TQMYSQL3','TQPSQL7','TQODBC3',... 'hostname': '127.0.0.1', 'port': 3306, 'username': 'root', #'MyUsername', @@ -61,9 +61,9 @@ class CopyCenterPlugin: self._init(copierer) tablename = str(self.widget.tableedit.text()) wherestatement = str(self.widget.whereedit.text()) - from TQt import qt - from TQt import qtsql - self.cursor = qtsql.TQSqlCursor(tablename,True,self.database) + from TQt import tqt + from TQt import tqtsql + self.cursor = tqtsql.TQSqlCursor(tablename,True,self.database) self.cursor.setFilter(wherestatement) if not self.cursor.select(): raise Exception("Select on cursor failed.<br>%s<br>%s" % ( str(self.cursor.lastError().driverText()),str(self.cursor.lastError().databaseText()) )) @@ -93,7 +93,7 @@ class CopyCenterPlugin: def __init__(self,copycenterplugin): self._init_(copycenterplugin) self.options = { - 'driver': 'QMYSQL3', #'QMYSQL3','QPSQL7','QODBC3',... + 'driver': 'TQMYSQL3', #'TQMYSQL3','TQPSQL7','TQODBC3',... 'hostname': '127.0.0.1', 'port': 3306, 'username': 'root', #'MyUsername', @@ -106,8 +106,8 @@ class CopyCenterPlugin: } def init(self,copierer): self._init(copierer) - from TQt import qt - from TQt import qtsql + from TQt import tqt + from TQt import tqtsql self.fieldlist = [] for fieldname in str(self.widget.fieldedit.text()).split(","): @@ -115,7 +115,7 @@ class CopyCenterPlugin: if fn != "": self.fieldlist.append(fn) tablename = str(self.widget.tableedit.text()) - self.cursor = qtsql.TQSqlCursor(tablename,True,self.database) + self.cursor = tqtsql.TQSqlCursor(tablename,True,self.database) { 0: self.initInsert, 1: self.initUpdate @@ -132,16 +132,16 @@ class CopyCenterPlugin: def writeInsert(self, record): print("insert record: %s" % record) - from TQt import qt + from TQt import tqt cursorrecord = self.cursor.primeInsert() count = len(record) for i in range(len(self.fieldlist)): if i == count: break r = record[i] if r == None: - v = qt.TQVariant() + v = tqt.TQVariant() else: - v = qt.TQVariant(r) + v = tqt.TQVariant(r) cursorrecord.setValue(self.fieldlist[i], v) rowcount = self.cursor.insert() if rowcount < 1: @@ -162,11 +162,11 @@ class CopyCenterPlugin: pkindex = self.cursor.index(self.indexfieldname) if not pkindex: raise Exception("Invalid index-field defined.") self.cursor.setPrimaryIndex(pkindex) - #self.cursor.setMode( qtsql.TQSqlCursor.Insert | qtsql.TQSqlCursor.Update ) + #self.cursor.setMode( tqtsql.TQSqlCursor.Insert | tqtsql.TQSqlCursor.Update ) self.copierer.appendProgressMessage("Update SQL: %s" % str(self.cursor.executedQuery())) def writeUpdate(self, record): - from TQt import qt + from TQt import tqt # determinate the primary-index try: idx = self.fieldlist.index(self.indexfieldname) @@ -192,9 +192,9 @@ class CopyCenterPlugin: if self.indexfieldname != fieldname: # don't update the indexfield! r = record[i] if r == None: - v = qt.TQVariant() + v = tqt.TQVariant() else: - v = qt.TQVariant(r) + v = tqt.TQVariant(r) cursorrecord.setValue(fieldname, v) # Write updated record. rowcount = self.cursor.update() @@ -210,11 +210,11 @@ class CopyCenterPlugin: pass def widget(self,dialog,plugin,parent): - """ Each plugin may provide a qt.TQWidget back to the + """ Each plugin may provide a tqt.TQWidget back to the CopyCenter.py. The widget will be used to configure our plugin settings. """ - from TQt import qt + from TQt import tqt import os self.dialog = dialog @@ -228,14 +228,14 @@ class CopyCenterPlugin: item = None for table in self.mainwidget.plugin.database.tables(): if item == None: - item = qt.TQListViewItem(self.listview,table) + item = tqt.TQListViewItem(self.listview,table) else: - item = qt.TQListViewItem(self.listview,item,table) + item = tqt.TQListViewItem(self.listview,item,table) if table == text: self.listview.setSelected(item,True) self.listview.ensureItemVisible(item) - qt.TQObject.connect(self.listview, qt.SIGNAL("doubleClicked(QListViewItem*, const QPoint&, int)"), self.okClicked) - qt.TQObject.connect(self.okbtn, qt.SIGNAL("clicked()"), self.okClicked) + tqt.TQObject.connect(self.listview, tqt.SIGNAL("doubleClicked(TQListViewItem*, const TQPoint&, int)"), self.okClicked) + tqt.TQObject.connect(self.okbtn, tqt.SIGNAL("clicked()"), self.okClicked) def okClicked(self): item = self.listview.selectedItem() if item == None: @@ -248,7 +248,7 @@ class CopyCenterPlugin: def __init__(self, mainwidget): ListViewDialog.__init__(self,parent,"Fields") self.mainwidget = mainwidget - self.listview.setSelectionMode(qt.TQListView.Multi) + self.listview.setSelectionMode(tqt.TQListView.Multi) self.listview.setSorting(-1) self.listview.header().setClickEnabled(False) self.listview.addColumn("Name") @@ -264,10 +264,10 @@ class CopyCenterPlugin: opts = "" for s in ('Required','Calculated'): #,'Generated'): if getattr(fieldinfo,"is%s" % s)(): opts += "%s " % s - item = self.addItem((fieldinfo.name(), qt.TQVariant.typeToName(fieldinfo.type()), opts),item) + item = self.addItem((fieldinfo.name(), tqt.TQVariant.typeToName(fieldinfo.type()), opts),item) if allfields or fieldinfo.name() in fieldslist: self.listview.setSelected(item,True) - qt.TQObject.connect(self.okbtn, qt.SIGNAL("clicked()"), self.okClicked) + tqt.TQObject.connect(self.okbtn, tqt.SIGNAL("clicked()"), self.okClicked) def okClicked(self): selitems = [] item = self.listview.firstChild() @@ -279,101 +279,101 @@ class CopyCenterPlugin: self.close() - class MainWidget(qt.TQHBox): + class MainWidget(tqt.TQHBox): def __init__(self,plugin,dialog,parent): - from TQt import qt - from TQt import qtsql - qt.TQHBox.__init__(self,parent) + from TQt import tqt + from TQt import tqtsql + tqt.TQHBox.__init__(self,parent) self.dialog = dialog self.plugin = plugin - self.connectionbox = qt.TQVBox(parent) + self.connectionbox = tqt.TQVBox(parent) self.connectionbox.setSpacing(2) - driverbox = qt.TQHBox(self.connectionbox) - driverlabel = qt.TQLabel("Driver:",driverbox) - self.driveredit = qt.TQComboBox(driverbox) - for driver in qtsql.TQSqlDatabase.drivers(): + driverbox = tqt.TQHBox(self.connectionbox) + driverlabel = tqt.TQLabel("Driver:",driverbox) + self.driveredit = tqt.TQComboBox(driverbox) + for driver in tqtsql.TQSqlDatabase.drivers(): self.driveredit.insertItem(driver) if self.plugin.options['driver'] == driver: self.driveredit.setCurrentItem(self.driveredit.count() - 1) driverlabel.setBuddy(self.driveredit) driverbox.setStretchFactor(self.driveredit,1) - hostbox = qt.TQHBox(self.connectionbox) - hostlabel = qt.TQLabel("Hostname:",hostbox) - self.hostedit = qt.TQLineEdit(self.plugin.options['hostname'],hostbox) + hostbox = tqt.TQHBox(self.connectionbox) + hostlabel = tqt.TQLabel("Hostname:",hostbox) + self.hostedit = tqt.TQLineEdit(self.plugin.options['hostname'],hostbox) hostlabel.setBuddy(self.hostedit) hostbox.setStretchFactor(self.hostedit,1) - portbox = qt.TQHBox(self.connectionbox) - portlabel = qt.TQLabel("Port:",portbox) - self.portedit = qt.TQLineEdit(str(self.plugin.options['port']),portbox) + portbox = tqt.TQHBox(self.connectionbox) + portlabel = tqt.TQLabel("Port:",portbox) + self.portedit = tqt.TQLineEdit(str(self.plugin.options['port']),portbox) portlabel.setBuddy(self.portedit) portbox.setStretchFactor(self.portedit,1) - userbox = qt.TQHBox(self.connectionbox) - userlabel = qt.TQLabel("Username:",userbox) - self.useredit = qt.TQLineEdit(self.plugin.options['username'],userbox) + userbox = tqt.TQHBox(self.connectionbox) + userlabel = tqt.TQLabel("Username:",userbox) + self.useredit = tqt.TQLineEdit(self.plugin.options['username'],userbox) userlabel.setBuddy(self.useredit) userbox.setStretchFactor(self.useredit,1) - passbox = qt.TQHBox(self.connectionbox) - passlabel = qt.TQLabel("Password:",passbox) - self.passedit = qt.TQLineEdit(self.plugin.options['password'],passbox) - self.passedit.setEchoMode(qt.TQLineEdit.Password) + passbox = tqt.TQHBox(self.connectionbox) + passlabel = tqt.TQLabel("Password:",passbox) + self.passedit = tqt.TQLineEdit(self.plugin.options['password'],passbox) + self.passedit.setEchoMode(tqt.TQLineEdit.Password) passlabel.setBuddy(self.passedit) passbox.setStretchFactor(self.passedit,1) - dbbox = qt.TQHBox(self.connectionbox) - dblabel = qt.TQLabel("Database:",dbbox) - self.dbedit = qt.TQLineEdit(self.plugin.options['database'],dbbox) + dbbox = tqt.TQHBox(self.connectionbox) + dblabel = tqt.TQLabel("Database:",dbbox) + self.dbedit = tqt.TQLineEdit(self.plugin.options['database'],dbbox) dblabel.setBuddy(self.dbedit) dbbox.setStretchFactor(self.dbedit,1) - statusbar = qt.TQHBox(parent) + statusbar = tqt.TQHBox(parent) statusbar.setSpacing(2) - statusbar.setStretchFactor(qt.TQWidget(statusbar),1) - self.connectbtn = qt.TQPushButton("Connect",statusbar) - qt.TQObject.connect(self.connectbtn, qt.SIGNAL("clicked()"),self.connectClicked) - self.disconnectbtn = qt.TQPushButton("Disconnect",statusbar) + statusbar.setStretchFactor(tqt.TQWidget(statusbar),1) + self.connectbtn = tqt.TQPushButton("Connect",statusbar) + tqt.TQObject.connect(self.connectbtn, tqt.SIGNAL("clicked()"),self.connectClicked) + self.disconnectbtn = tqt.TQPushButton("Disconnect",statusbar) self.disconnectbtn.setEnabled(False) - qt.TQObject.connect(self.disconnectbtn, qt.SIGNAL("clicked()"),self.disconnectClicked) + tqt.TQObject.connect(self.disconnectbtn, tqt.SIGNAL("clicked()"),self.disconnectClicked) - tablebox = qt.TQHBox(parent) - tablelabel = qt.TQLabel("Table:",tablebox) - self.tableedit = qt.TQLineEdit(self.plugin.options['table'],tablebox) - qt.TQObject.connect(self.tableedit, qt.SIGNAL("textChanged(const QString&)"), self.tableEditChanged) - self.tablebtn = qt.TQPushButton("...",tablebox) + tablebox = tqt.TQHBox(parent) + tablelabel = tqt.TQLabel("Table:",tablebox) + self.tableedit = tqt.TQLineEdit(self.plugin.options['table'],tablebox) + tqt.TQObject.connect(self.tableedit, tqt.SIGNAL("textChanged(const TQString&)"), self.tableEditChanged) + self.tablebtn = tqt.TQPushButton("...",tablebox) self.tablebtn.setEnabled(False) - qt.TQObject.connect(self.tablebtn, qt.SIGNAL("clicked()"), self.tableBtnClicked) + tqt.TQObject.connect(self.tablebtn, tqt.SIGNAL("clicked()"), self.tableBtnClicked) tablelabel.setBuddy(self.tableedit) tablebox.setStretchFactor(self.tableedit,1) - fieldbox = qt.TQHBox(parent) - fieldlabel = qt.TQLabel("Fields:",fieldbox) - self.fieldedit = qt.TQLineEdit(self.plugin.options['fields'],fieldbox) - self.fieldbtn = qt.TQPushButton("...",fieldbox) + fieldbox = tqt.TQHBox(parent) + fieldlabel = tqt.TQLabel("Fields:",fieldbox) + self.fieldedit = tqt.TQLineEdit(self.plugin.options['fields'],fieldbox) + self.fieldbtn = tqt.TQPushButton("...",fieldbox) self.fieldbtn.setEnabled(False) - qt.TQObject.connect(self.fieldbtn, qt.SIGNAL("clicked()"), self.fieldBtnClicked) + tqt.TQObject.connect(self.fieldbtn, tqt.SIGNAL("clicked()"), self.fieldBtnClicked) fieldlabel.setBuddy(self.fieldedit) fieldbox.setStretchFactor(self.fieldedit,1) if self.plugin.plugintype == "Source": - box = qt.TQHBox(parent) - wherelabel = qt.TQLabel("Where:",box) - self.whereedit = qt.TQLineEdit(self.plugin.options['where'],box) + box = tqt.TQHBox(parent) + wherelabel = tqt.TQLabel("Where:",box) + self.whereedit = tqt.TQLineEdit(self.plugin.options['where'],box) wherelabel.setBuddy(self.whereedit) box.setStretchFactor(self.whereedit,1) elif self.plugin.plugintype == "Destination": - class OperationBox(qt.TQVBox): + class OperationBox(tqt.TQVBox): def __init__(self, mainwidget, parent): self.mainwidget = mainwidget - qt.TQVBox.__init__(self, parent) - opbox = qt.TQHBox(self) - operationlabel = qt.TQLabel("Operation:",opbox) - self.mainwidget.operationedit = qt.TQComboBox(opbox) + tqt.TQVBox.__init__(self, parent) + opbox = tqt.TQHBox(self) + operationlabel = tqt.TQLabel("Operation:",opbox) + self.mainwidget.operationedit = tqt.TQComboBox(opbox) for op in ('Insert','Update'): self.mainwidget.operationedit.insertItem(op) if self.mainwidget.plugin.options['operation'] == op: @@ -381,7 +381,7 @@ class CopyCenterPlugin: operationlabel.setBuddy(self.mainwidget.operationedit) opbox.setStretchFactor(self.mainwidget.operationedit,1) self.box = None - qt.TQObject.connect(self.mainwidget.operationedit, qt.SIGNAL("activated(int)"), self.operationActivated) + tqt.TQObject.connect(self.mainwidget.operationedit, tqt.SIGNAL("activated(int)"), self.operationActivated) self.operationActivated() def operationActivated(self, **args): if self.box: @@ -391,9 +391,9 @@ class CopyCenterPlugin: def showInsert(self): pass def showUpdate(self): - self.box = qt.TQHBox(self) - indexlabel = qt.TQLabel("Indexfield:", self.box) - self.mainwidget.indexedit = qt.TQLineEdit(self.mainwidget.plugin.options['indexfield'], self.box) + self.box = tqt.TQHBox(self) + indexlabel = tqt.TQLabel("Indexfield:", self.box) + self.mainwidget.indexedit = tqt.TQLineEdit(self.mainwidget.plugin.options['indexfield'], self.box) indexlabel.setBuddy(self.mainwidget.indexedit) self.box.setStretchFactor(self.mainwidget.indexedit,1) { @@ -451,14 +451,14 @@ class CopyCenterPlugin: return True print("trying to connect...") - from TQt import qtsql + from TQt import tqtsql drivername = str(self.driveredit.currentText()) print("drivername: %s" % drivername) connectionname = "CopyCenter%s" % self.plugin.plugintype print("connectionname: %s" % connectionname) - self.plugin.database = qtsql.TQSqlDatabase.addDatabase(drivername,connectionname) + self.plugin.database = tqtsql.TQSqlDatabase.addDatabase(drivername,connectionname) if not self.plugin.database: - qt.TQMessageBox.critical(self,"Failed to connect","<qt>Failed to create database for driver \"%s\"</qt>" % drivername) + tqt.TQMessageBox.critical(self,"Failed to connect","<qt>Failed to create database for driver \"%s\"</qt>" % drivername) return False hostname = str(self.hostedit.text()) @@ -477,7 +477,7 @@ class CopyCenterPlugin: self.plugin.database.setDatabaseName(databasename) if not self.plugin.database.open(): - qt.TQMessageBox.critical(self,"Failed to connect","<qt>%s<br><br>%s</qt>" % (self.plugin.database.lastError().driverText(),self.plugin.database.lastError().databaseText())) + tqt.TQMessageBox.critical(self,"Failed to connect","<qt>%s<br><br>%s</qt>" % (self.plugin.database.lastError().driverText(),self.plugin.database.lastError().databaseText())) return False print("database is opened now!") self.updateConnectState() 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() diff --git a/lib/kformula/prototype/engine.py b/lib/kformula/prototype/engine.py index 4ad207f9..a0d6ab1f 100644 --- a/lib/kformula/prototype/engine.py +++ b/lib/kformula/prototype/engine.py @@ -18,7 +18,7 @@ Boston, MA 02110-1301, USA. """ -from PyTQt.qt import * +from PyTQt.tqt import * class BasicElement: diff --git a/lib/kformula/prototype/main.py b/lib/kformula/prototype/main.py index 953bc060..c5855340 100755 --- a/lib/kformula/prototype/main.py +++ b/lib/kformula/prototype/main.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from TQt.qt import * +from TQt.tqt import * from engine import Widget diff --git a/lib/kformula/prototype/unicode.py b/lib/kformula/prototype/unicode.py index ca495d25..10e0f848 100755 --- a/lib/kformula/prototype/unicode.py +++ b/lib/kformula/prototype/unicode.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from TQt.qt import * +from TQt.tqt import * from xml.sax import saxutils, handler, make_parser class Form1(TQWidget): diff --git a/lib/kformula/scripts/bycodes.py b/lib/kformula/scripts/bycodes.py index fdd84269..24a2954d 100755 --- a/lib/kformula/scripts/bycodes.py +++ b/lib/kformula/scripts/bycodes.py @@ -20,7 +20,7 @@ """ import sys import string -from TQt import qt +from TQt import tqt def decode( fd, font, line ): begin = string.find( line, '"' ) @@ -39,10 +39,10 @@ def decode( fd, font, line ): char_list.append( string.atoi( second, 16 ) ) else: char_list.append( string.atoi ( str, 16 ) ) - fm = qt.TQFontMetrics( qt.TQFont( font ) ) + fm = tqt.TQFontMetrics( tqt.TQFont( font ) ) in_font = True for c in char_list: - if not fm.inFont( qt.TQChar( c ) ): + if not fm.inFont( tqt.TQChar( c ) ): in_font = False fd.write( str + ' ' + str( in_font ) + '\n') @@ -56,7 +56,7 @@ def parse( file, font ): line = fd.readline() if __name__ == '__main__': - a = qt.TQApplication( sys.argv ) + a = tqt.TQApplication( sys.argv ) if len( sys.argv ) == 2: sys.argv.append( 'Arev Sans' ) parse ( sys.argv[1], sys.argv[2] ) diff --git a/lib/kross/python/scripts/gui.py b/lib/kross/python/scripts/gui.py index 693261dd..aa4dc986 100755 --- a/lib/kross/python/scripts/gui.py +++ b/lib/kross/python/scripts/gui.py @@ -184,64 +184,64 @@ class TQtDialog: """ This class is used to wrap PyTQt/PyTDE into a more abstract interface.""" def __init__(self, title): - from TQt import qt + from TQt import tqt - class Dialog(qt.TQDialog): + class Dialog(tqt.TQDialog): def __init__(self, parent = None, name = None, modal = 0, fl = 0): - qt.TQDialog.__init__(self, parent, name, modal, fl) - qt.TQDialog.accept = self.accept - self.layout = qt.TQVBoxLayout(self) + tqt.TQDialog.__init__(self, parent, name, modal, fl) + tqt.TQDialog.accept = self.accept + self.layout = tqt.TQVBoxLayout(self) self.layout.setSpacing(6) self.layout.setMargin(11) - class Label(qt.TQLabel): + class Label(tqt.TQLabel): def __init__(self, dialog, parent, caption): - qt.TQLabel.__init__(self, parent) + tqt.TQLabel.__init__(self, parent) self.setText("<qt>%s</qt>" % caption.replace("\n","<br>")) - class Frame(qt.TQHBox): + class Frame(tqt.TQHBox): def __init__(self, dialog, parent): - qt.TQHBox.__init__(self, parent) + tqt.TQHBox.__init__(self, parent) self.widget = self self.setSpacing(6) - class Edit(qt.TQHBox): + class Edit(tqt.TQHBox): def __init__(self, dialog, parent, caption, text): - qt.TQHBox.__init__(self, parent) + tqt.TQHBox.__init__(self, parent) self.setSpacing(6) - label = qt.TQLabel(caption, self) - self.edit = qt.TQLineEdit(self) + label = tqt.TQLabel(caption, self) + self.edit = tqt.TQLineEdit(self) self.edit.setText( str(text) ) self.setStretchFactor(self.edit, 1) label.setBuddy(self.edit) def get(self): return self.edit.text() - class Button(qt.TQPushButton): + class Button(tqt.TQPushButton): #def __init__(self, *args): def __init__(self, dialog, parent, caption, commandmethod): - #apply(qt.TQPushButton.__init__, (self,) + args) - qt.TQPushButton.__init__(self, parent) + #apply(tqt.TQPushButton.__init__, (self,) + args) + tqt.TQPushButton.__init__(self, parent) self.commandmethod = commandmethod self.setText(caption) - qt.TQObject.connect(self, qt.SIGNAL("clicked()"), self.commandmethod) + tqt.TQObject.connect(self, tqt.SIGNAL("clicked()"), self.commandmethod) - class CheckBox(qt.TQCheckBox): + class CheckBox(tqt.TQCheckBox): def __init__(self, dialog, parent, caption, checked = True): #TkDialog.Widget.__init__(self, dialog, parent) - qt.TQCheckBox.__init__(self, parent) + tqt.TQCheckBox.__init__(self, parent) self.setText(caption) self.setChecked(checked) #def isChecked(self): # return self.isChecked() - class List(qt.TQHBox): + class List(tqt.TQHBox): def __init__(self, dialog, parent, caption, items): - qt.TQHBox.__init__(self, parent) + tqt.TQHBox.__init__(self, parent) self.setSpacing(6) - label = qt.TQLabel(caption, self) - self.combo = qt.TQComboBox(self) + label = tqt.TQLabel(caption, self) + self.combo = tqt.TQComboBox(self) self.setStretchFactor(self.combo, 1) label.setBuddy(self.combo) for item in items: @@ -251,24 +251,24 @@ class TQtDialog: def set(self, index): self.combo.setCurrentItem(index) - class FileChooser(qt.TQHBox): + class FileChooser(tqt.TQHBox): def __init__(self, dialog, parent, caption, initialfile = None, filetypes = None): - #apply(qt.TQHBox.__init__, (self,) + args) - qt.TQHBox.__init__(self, parent) + #apply(tqt.TQHBox.__init__, (self,) + args) + tqt.TQHBox.__init__(self, parent) self.setMinimumWidth(400) self.initialfile = initialfile self.filetypes = filetypes self.setSpacing(6) - label = qt.TQLabel(caption, self) - self.edit = qt.TQLineEdit(self) + label = tqt.TQLabel(caption, self) + self.edit = tqt.TQLineEdit(self) self.edit.setText(self.initialfile) self.setStretchFactor(self.edit, 1) label.setBuddy(self.edit) browsebutton = Button(dialog, self, "...", self.browseButtonClicked) - #qt.TQObject.connect(browsebutton, qt.SIGNAL("clicked()"), self.browseButtonClicked) + #tqt.TQObject.connect(browsebutton, tqt.SIGNAL("clicked()"), self.browseButtonClicked) def get(self): return self.edit.text() @@ -294,9 +294,9 @@ class TQtDialog: import tdefile filename = tdefile.KFileDialog.getOpenFileName(self.initialfile, filtermask, self, "Save to file") except: - print("TQtDialog.FileChooser.browseButtonClicked() qt.TQFileDialog") + print("TQtDialog.FileChooser.browseButtonClicked() tqt.TQFileDialog") # fallback to TQt filedialog - filename = qt.TQFileDialog.getOpenFileName(self.initialfile, filtermask, self, "Save to file") + filename = tqt.TQFileDialog.getOpenFileName(self.initialfile, filtermask, self, "Save to file") if filename != None and filename != "": self.edit.setText(filename) @@ -309,19 +309,19 @@ class TQtDialog: def show(self): result = 1 if self.typename == "okcancel": - result = qt.TQMessageBox.question(self.widget, self.caption, self.message, "&Ok", "&Cancel", "", 1) + result = tqt.TQMessageBox.question(self.widget, self.caption, self.message, "&Ok", "&Cancel", "", 1) else: - qt.TQMessageBox.information(self.widget, self.caption, self.message, "&Ok") + tqt.TQMessageBox.information(self.widget, self.caption, self.message, "&Ok") result = 0 if result == 0: return True return False - self.app = qt.tqApp - self.dialog = Dialog(self.app.mainWidget(), "Dialog", 1, qt.TQt.WDestructiveClose) + self.app = tqt.tqApp + self.dialog = Dialog(self.app.mainWidget(), "Dialog", 1, tqt.TQt.WDestructiveClose) self.dialog.setCaption(title) - self.widget = qt.TQVBox(self.dialog) + self.widget = tqt.TQVBox(self.dialog) self.widget.setSpacing(6) self.dialog.layout.addWidget(self.widget) @@ -335,10 +335,10 @@ class TQtDialog: self.MessageBox = MessageBox def show(self): - from TQt import qt - qt.TQApplication.setOverrideCursor(qt.TQt.arrowCursor) + from TQt import tqt + tqt.TQApplication.setOverrideCursor(tqt.TQt.arrowCursor) self.dialog.exec_loop() - qt.TQApplication.restoreOverrideCursor() + tqt.TQApplication.restoreOverrideCursor() def close(self): print("TQtDialog.close()") diff --git a/lib/kross/test/testgui.py b/lib/kross/test/testgui.py index 0a3cf822..9c2747e8 100644 --- a/lib/kross/test/testgui.py +++ b/lib/kross/test/testgui.py @@ -37,37 +37,37 @@ class TkTest: class TQtTest: def __init__(self): - from TQt import qt + from TQt import tqt - class Button(qt.TQPushButton): + class Button(tqt.TQPushButton): def __init__(self, *args): - qt.TQPushButton.__init__(*(self,) + args) + tqt.TQPushButton.__init__(*(self,) + args) - class ComboBox(qt.TQHBox): + class ComboBox(tqt.TQHBox): def __init__(self, parent, caption, items = []): - qt.TQHBox.__init__(self, parent) + tqt.TQHBox.__init__(self, parent) self.setSpacing(6) - label = qt.TQLabel(str(caption), self) - self.combobox = qt.TQComboBox(self) + label = tqt.TQLabel(str(caption), self) + self.combobox = tqt.TQComboBox(self) self.setStretchFactor(self.combobox, 1) label.setBuddy(self.combobox) for item in items: self.combobox.insertItem( str(item) ) - class FileChooser(qt.TQHBox): + class FileChooser(tqt.TQHBox): def __init__(self, *args): - qt.TQHBox.__init__(*(self,) + args) + tqt.TQHBox.__init__(*(self,) + args) self.defaultfilename = "~/output.html" self.setSpacing(6) - label = qt.TQLabel("File:", self) - self.edit = qt.TQLineEdit(self) + label = tqt.TQLabel("File:", self) + self.edit = tqt.TQLineEdit(self) self.edit.setText(self.defaultfilename) self.setStretchFactor(self.edit, 1) label.setBuddy(self.edit) browsebutton = Button("...", self) - qt.TQObject.connect(browsebutton, qt.SIGNAL("clicked()"), self.browseButtonClicked) + tqt.TQObject.connect(browsebutton, tqt.SIGNAL("clicked()"), self.browseButtonClicked) def file(self): return self.edit.text() @@ -80,22 +80,22 @@ class TQtTest: filename = tdefile.KFileDialog.getOpenFileName(self.defaultfilename, "*.html", self, "Save to file") except: # fallback to TQt filedialog - filename = qt.TQFileDialog.getOpenFileName(self.defaultfilename, "*.html", self, "Save to file") + filename = tqt.TQFileDialog.getOpenFileName(self.defaultfilename, "*.html", self, "Save to file") if filename != None and filename != "": self.edit.setText(filename) - class Dialog(qt.TQDialog): + class Dialog(tqt.TQDialog): def __init__(self, parent = None, name = None, modal = 0, fl = 0): - qt.TQDialog.__init__(self, parent, name, modal, fl) - qt.TQDialog.accept = self.accept + tqt.TQDialog.__init__(self, parent, name, modal, fl) + tqt.TQDialog.accept = self.accept self.setCaption("Export to HTML") #self.layout() - self.layout = qt.TQVBoxLayout(self) + self.layout = tqt.TQVBoxLayout(self) self.layout.setSpacing(6) self.layout.setMargin(11) - infolabel = qt.TQLabel("Export the data of a table or a query to a HTML-file.", self) + infolabel = tqt.TQLabel("Export the data of a table or a query to a HTML-file.", self) self.layout.addWidget(infolabel) source = ComboBox(self, "Datasource:") @@ -107,21 +107,21 @@ class TQtTest: self.filechooser = FileChooser(self) self.layout.addWidget(self.filechooser) - buttonbox = qt.TQHBox(self) + buttonbox = tqt.TQHBox(self) buttonbox.setSpacing(6) self.layout.addWidget(buttonbox) savebutton = Button("Save", buttonbox) - qt.TQObject.connect(savebutton, qt.SIGNAL("clicked()"), self, qt.SLOT("accept()")) - #qt.TQObject.connect(savebutton, qt.SIGNAL("clicked()"), self.exportButtonClicked) + tqt.TQObject.connect(savebutton, tqt.SIGNAL("clicked()"), self, tqt.SLOT("accept()")) + #tqt.TQObject.connect(savebutton, tqt.SIGNAL("clicked()"), self.exportButtonClicked) cancelbutton = Button("Cancel", buttonbox) - qt.TQObject.connect(cancelbutton, qt.SIGNAL("clicked()"), self, qt.SLOT("close()")) + tqt.TQObject.connect(cancelbutton, tqt.SIGNAL("clicked()"), self, tqt.SLOT("close()")) def accept(self): print("ACCEPTTTTTTTT !!!!!!!!!!!!!!!!!!!!!!!!!!!!") - file = qt.TQFile( self.filechooser.file() ) + file = tqt.TQFile( self.filechooser.file() ) #if not file.exists(): # print "File '%s' does not exist." % self.filechooser.file() #else: @@ -137,9 +137,9 @@ class TQtTest: print("=> Dialog.event %s" % e) #self.deleteLater() #support.swapThreadState() # calls appropriate c-function - return qt.TQDialog.event(self, e) + return tqt.TQDialog.event(self, e) - app = qt.tqApp + app = tqt.tqApp dialog = Dialog(app.mainWidget(), "Dialog", 1) dialog.show() |