summaryrefslogtreecommitdiffstats
path: root/kexi
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2023-01-21 21:52:20 +0100
committerSlávek Banko <slavek.banko@axis.cz>2023-01-22 01:58:18 +0100
commit135d005014a1e85295af4e379f026a361537ae5f (patch)
treec70f25a5248237a5c4676c928fd400b10aa7a641 /kexi
parent596d0f7b9ed99de0814acfb835cc8945cee37405 (diff)
downloadkoffice-135d005014a1e85295af4e379f026a361537ae5f.tar.gz
koffice-135d005014a1e85295af4e379f026a361537ae5f.zip
Update python scripts for PyTQt.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'kexi')
-rw-r--r--kexi/plugins/scripting/scripts/copycenter/CopyCenter.py212
-rw-r--r--kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py202
-rw-r--r--kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py180
3 files changed, 297 insertions, 297 deletions
diff --git a/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py b/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py
index f244ae39..edcc2891 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):
- import qt
+ from TQt import qt
import sys
#--------------------------------------------------------------------
- class ListViewDialog(qt.QDialog):
+ class ListViewDialog(qt.TQDialog):
def __init__(self, parent, caption):
- qt.QDialog.__init__(self, parent, "ProgressDialog", 1)
+ qt.TQDialog.__init__(self, parent, "ProgressDialog", 1)
self.parent = parent
self.setCaption(caption)
- layout = qt.QVBoxLayout(self)
- box = qt.QVBox(self)
+ layout = qt.TQVBoxLayout(self)
+ box = qt.TQVBox(self)
box.setMargin(2)
layout.addWidget(box)
- self.listview = qt.QListView(box)
+ self.listview = qt.TQListView(box)
self.listview.setAllColumnsShowFocus(True)
self.listview.header().setStretchEnabled(True,0)
- btnbox = qt.QHBox(box)
+ btnbox = qt.TQHBox(box)
btnbox.setMargin(6)
btnbox.setSpacing(6)
- self.okbtn = qt.QPushButton(btnbox)
+ self.okbtn = qt.TQPushButton(btnbox)
self.okbtn.setText("Ok")
- #qt.QObject.connect(okbtn, qt.SIGNAL("clicked()"), self.okClicked)
- self.cancelbtn = qt.QPushButton(btnbox)
+ #qt.TQObject.connect(okbtn, qt.SIGNAL("clicked()"), self.okClicked)
+ self.cancelbtn = qt.TQPushButton(btnbox)
self.cancelbtn.setText("Cancel")
- qt.QObject.connect(self.cancelbtn, qt.SIGNAL("clicked()"), self.close)
- box.setMinimumSize(qt.QSize(460,380))
+ qt.TQObject.connect(self.cancelbtn, qt.SIGNAL("clicked()"), self.close)
+ box.setMinimumSize(qt.TQSize(460,380))
def addItem(self,valuelist,afteritem = None):
if afteritem == None:
- item = qt.QListViewItem(self.listview)
+ item = qt.TQListViewItem(self.listview)
else:
- item = qt.QListViewItem(self.listview,afteritem)
+ item = qt.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.QVBox):
+ class CopyJobWidget(qt.TQVBox):
def __init__(self,dialog,parent):
self.dialog = dialog
- qt.QVBox.__init__(self,parent)
+ qt.TQVBox.__init__(self,parent)
self.setSpacing(6)
- typebox = qt.QHBox(self)
+ typebox = qt.TQHBox(self)
typebox.setSpacing(6)
- label = qt.QLabel("Job File:",typebox)
- self.jobfilecombobox = qt.QComboBox(typebox)
+ label = qt.TQLabel("Job File:",typebox)
+ self.jobfilecombobox = qt.TQComboBox(typebox)
typebox.setStretchFactor(self.jobfilecombobox,1)
self.jobfilecombobox.setEditable(True)
self.jobfilecombobox.insertItem("")
label.setBuddy(self.jobfilecombobox)
- qt.QObject.connect(self.jobfilecombobox, qt.SIGNAL("textChanged(const QString&)"), self.jobfilecomboboxChanged)
+ qt.TQObject.connect(self.jobfilecombobox, qt.SIGNAL("textChanged(const QString&)"), 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.QPushButton(typebox)
+ loadbtn = qt.TQPushButton(typebox)
loadbtn.setText("Open...")
- qt.QObject.connect(loadbtn, qt.SIGNAL("clicked()"), self.openClicked)
- savebtn = qt.QPushButton(typebox)
+ qt.TQObject.connect(loadbtn, qt.SIGNAL("clicked()"), self.openClicked)
+ savebtn = qt.TQPushButton(typebox)
savebtn.setText("Save...")
- qt.QObject.connect(savebtn, qt.SIGNAL("clicked()"), self.saveClicked)
+ qt.TQObject.connect(savebtn, qt.SIGNAL("clicked()"), self.saveClicked)
- self.listview = qt.QListView(self)
+ self.listview = qt.TQListView(self)
self.listview.setAllColumnsShowFocus(True)
self.listview.setSorting(-1)
- self.listview.setDefaultRenameAction(qt.QListView.Reject)
+ self.listview.setDefaultRenameAction(qt.TQListView.Reject)
self.listview.header().setClickEnabled(False)
self.listview.addColumn("Name")
self.listview.addColumn("Value")
- qt.QObject.connect(self.listview, qt.SIGNAL("doubleClicked(QListViewItem*, const QPoint&, int)"), self.doubleClicked)
- #qt.QObject.connect(self.listview, qt.SIGNAL("itemRenamed(QListViewItem*, int, const QString&)"), self.itemRenamed)
+ 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)
def doubleClicked(self, **args):
print "CopyJobWidget.doubleClicked"
@@ -188,14 +188,14 @@ def runGuiApp(copycenter, name):
destinationnode = elements.getElementsByTagName("Destination")[0]
except:
raise "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.Qt.ExactMatch):
+ if not self.dialog.sourcedata.combobox.listBox().findItem(sourcepluginname,qt.TQt.ExactMatch):
raise "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.Qt.ExactMatch):
+ if not self.dialog.destinationdata.combobox.listBox().findItem(destinationpluginname,qt.TQt.ExactMatch):
raise "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.QFileDialog.getOpenFileName(text,"*.copycenterjob.xml;;*",self.dialog))
+ filename = str(qt.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.QFileDialog.getSaveFileName(text,"*.copycenterjob.xml;;*",self.dialog))
+ filename = str(qt.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.QListViewItem):
+ class ListViewItem(qt.TQListViewItem):
def __init__(self, pluginimpl, listview, parentitem = None, afteritem = None):
self.pluginimpl = pluginimpl
if parentitem == None:
- qt.QListViewItem.__init__(self,listview)
+ qt.TQListViewItem.__init__(self,listview)
self.setOpen(True)
else:
if afteritem == None:
- qt.QListViewItem.__init__(self,parentitem)
+ qt.TQListViewItem.__init__(self,parentitem)
else:
- qt.QListViewItem.__init__(self,parentitem,afteritem)
+ qt.TQListViewItem.__init__(self,parentitem,afteritem)
self.setRenameEnabled(1,True)
def startRename(self, columnindex):
- qt.QListViewItem.startRename(self,columnindex)
+ qt.TQListViewItem.startRename(self,columnindex)
#lineedit = self.listView().viewport().child("qt_renamebox")
#if lineedit:
- # regexp = qt.QRegExp("^[_A-Z]+[_A-Z0-9]*$", False)
- # v = qt.QRegExpValidator(regexp, self.listView());
+ # regexp = qt.TQRegExp("^[_A-Z]+[_A-Z0-9]*$", False)
+ # v = qt.TQRegExpValidator(regexp, self.listView());
# lineedit.setValidator(v)
def okRename(self, columnindex):
if columnindex == 1:
n = str(self.text(0))
if not self.pluginimpl.options.has_key(n):
raise "No such option \"%s\"" % n
- qt.QListViewItem.okRename(self,columnindex)
- v = str(qt.QListViewItem.text(self,1))
+ qt.TQListViewItem.okRename(self,columnindex)
+ v = str(qt.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.QListViewItem.text(self,0).contains("password"):
- return "*" * len(str(qt.QListViewItem.text(self,1)))
- return qt.QListViewItem.text(self,columnindex)
+ if qt.TQListViewItem.text(self,0).contains("password"):
+ return "*" * len(str(qt.TQListViewItem.text(self,1)))
+ return qt.TQListViewItem.text(self,columnindex)
return ListViewItem(pluginimpl, self.listview, parentitem, afteritem)
def updateItem(self,pluginname,pluginimpl):
@@ -289,7 +289,7 @@ def runGuiApp(copycenter, name):
afteritem.setText(1,str(pluginimpl.options[i]))
print "CopyJobWidget.updateItem Added item with name \"%s\" and value \"%s\"" % (str(i),str(pluginimpl.options[i]))
pass
-
+
def maybeUpdate(self):
print "CopyJobWidget.maybeUpdate"
self.listview.clear()
@@ -303,47 +303,47 @@ def runGuiApp(copycenter, name):
#--------------------------------------------------------------------
- class ProgressDialog(qt.QDialog):
+ class ProgressDialog(qt.TQDialog):
def __init__(self, dialog):
self.dialog = dialog
self.starttime = None
- qt.QDialog.__init__(self, dialog, "ProgressDialog", 1)
+ qt.TQDialog.__init__(self, dialog, "ProgressDialog", 1)
self.setCaption("Copying...")
- layout = qt.QVBoxLayout(self)
- box = qt.QVBox(self)
+ layout = qt.TQVBoxLayout(self)
+ box = qt.TQVBox(self)
box.setSpacing(6)
box.setMargin(6)
layout.addWidget(box)
- self.textbrowser = qt.QTextBrowser(box)
- self.textbrowser.setWordWrap(qt.QTextEdit.WidgetWidth)
- self.textbrowser.setTextFormat(qt.Qt.RichText)
- statusbox = qt.QFrame(box)
- layout = qt.QGridLayout(statusbox,4,2,0,2)
- layout.addWidget(qt.QLabel("Number of records done:",statusbox),0,0)
+ 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.donecounter = 0
- self.donelabel = qt.QLabel("-",statusbox)
+ self.donelabel = qt.TQLabel("-",statusbox)
layout.addWidget(self.donelabel,0,1)
- layout.addWidget(qt.QLabel("Successfully copied records:",statusbox),1,0)
+ layout.addWidget(qt.TQLabel("Successfully copied records:",statusbox),1,0)
self.successcounter = 0
- self.successlabel = qt.QLabel("-",statusbox)
+ self.successlabel = qt.TQLabel("-",statusbox)
layout.addWidget(self.successlabel,1,1)
- layout.addWidget(qt.QLabel("Failed to copy records:",statusbox),2,0)
+ layout.addWidget(qt.TQLabel("Failed to copy records:",statusbox),2,0)
self.failedcounter = 0
- self.failedlabel = qt.QLabel("-",statusbox)
+ self.failedlabel = qt.TQLabel("-",statusbox)
layout.addWidget(self.failedlabel,2,1)
- layout.addWidget(qt.QLabel("Elapsed time in seconds:",statusbox),3,0)
- self.elapsedlabel = qt.QLabel("-",statusbox)
+ layout.addWidget(qt.TQLabel("Elapsed time in seconds:",statusbox),3,0)
+ self.elapsedlabel = qt.TQLabel("-",statusbox)
layout.addWidget(self.elapsedlabel,3,1)
- btnbox = qt.QHBox(box)
+ btnbox = qt.TQHBox(box)
btnbox.setSpacing(6)
- self.donebtn = qt.QPushButton(btnbox)
+ self.donebtn = qt.TQPushButton(btnbox)
self.donebtn.setText("Done")
self.donebtn.setEnabled(False)
- qt.QObject.connect(self.donebtn,qt.SIGNAL("clicked()"),self.close)
- self.cancelbtn = qt.QPushButton(btnbox)
+ qt.TQObject.connect(self.donebtn,qt.SIGNAL("clicked()"),self.close)
+ self.cancelbtn = qt.TQPushButton(btnbox)
self.cancelbtn.setText("Cancel")
- qt.QObject.connect(self.cancelbtn,qt.SIGNAL("clicked()"),self.close)
- box.setMinimumSize( qt.QSize(500,380) )
+ qt.TQObject.connect(self.cancelbtn,qt.SIGNAL("clicked()"),self.close)
+ box.setMinimumSize( qt.TQSize(500,380) )
def updateStates(self):
if self.starttime != None:
@@ -373,9 +373,9 @@ def runGuiApp(copycenter, name):
copierer.writeSuccess = self.writeSuccess
copierer.writeFailed = self.writeFailed
- self.starttime = qt.QTime()
- self.updatetimer = qt.QTimer(self)
- qt.QObject.connect(self.updatetimer,qt.SIGNAL("timeout()"),self.updateStates)
+ self.starttime = qt.TQTime()
+ self.updatetimer = qt.TQTimer(self)
+ qt.TQObject.connect(self.updatetimer,qt.SIGNAL("timeout()"),self.updateStates)
# Initialize the source
sourcename = self.dialog.getSourcePluginName()
@@ -426,13 +426,13 @@ def runGuiApp(copycenter, name):
self.starttime = None
def show(self):
- qt.QDialog.show(self)
- qt.QTimer.singleShot(10,self.startCopy)
+ qt.TQDialog.show(self)
+ qt.TQTimer.singleShot(10,self.startCopy)
qt.tqApp.processEvents()
def closeEvent(self, closeevent):
if not self.dialog.getSourcePluginImpl().isFinished():
- if qt.QMessageBox.warning(self,"Abort?","Abort the copy?",qt.QMessageBox.Yes,qt.QMessageBox.No) != qt.QMessageBox.Yes:
+ if qt.TQMessageBox.warning(self,"Abort?","Abort the copy?",qt.TQMessageBox.Yes,qt.TQMessageBox.No) != qt.TQMessageBox.Yes:
closeevent.ignore()
return
self.dialog.getSourcePluginImpl().finish()
@@ -441,35 +441,35 @@ def runGuiApp(copycenter, name):
#--------------------------------------------------------------------
- class DataSelector(qt.QVGroupBox):
+ class DataSelector(qt.TQVGroupBox):
def __init__(self, plugintype, title, caption, parent, dialog, items):
self.plugintype = plugintype
self.pluginimpl = None
self.dialog = dialog
self.mainbox = None
- qt.QVGroupBox.__init__(self,title,parent)
+ qt.TQVGroupBox.__init__(self,title,parent)
self.setInsideMargin(6)
self.setInsideSpacing(0)
- typebox = qt.QHBox(self)
- label = qt.QLabel(caption,typebox)
- self.combobox = qt.QComboBox(typebox)
+ typebox = qt.TQHBox(self)
+ label = qt.TQLabel(caption,typebox)
+ self.combobox = qt.TQComboBox(typebox)
for item in items:
self.combobox.insertItem(str(item))
label.setBuddy(self.combobox)
typebox.setStretchFactor(self.combobox,1)
- self.scrollview = qt.QScrollView(self)
+ self.scrollview = qt.TQScrollView(self)
try:
- self.scrollview.setResizePolicy(qt.QScrollView.AutoOne)
- self.scrollview.setFrameStyle(qt.QFrame.NoFrame);
- self.scrollview.setResizePolicy(qt.QScrollView.AutoOneFit);
+ self.scrollview.setResizePolicy(qt.TQScrollView.AutoOne)
+ self.scrollview.setFrameStyle(qt.TQFrame.NoFrame);
+ self.scrollview.setResizePolicy(qt.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.QObject.connect(self.combobox, qt.SIGNAL("activated(int)"), self.activated)
+ qt.TQObject.connect(self.combobox, qt.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.QVBox( self.scrollview.viewport() )
+ self.mainbox = qt.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.QWidget(self.mainbox), 1)
+ self.mainbox.setStretchFactor(qt.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.QTimer.singleShot(50, self.activated)
+ qt.TQTimer.singleShot(50, self.activated)
def maybeDone(self):
print "DataSelector.maybeDone"
@@ -519,30 +519,30 @@ def runGuiApp(copycenter, name):
#--------------------------------------------------------------------
- class Dialog(qt.QDialog):
+ class Dialog(qt.TQDialog):
def __init__(self, copycenter, parent):
self.copycenter = copycenter
- import qt
+ from TQt import qt
import os
import sys
self.ListViewDialog = ListViewDialog
- qt.QDialog.__init__(self, parent, "Dialog", 1, qt.Qt.WDestructiveClose)
+ qt.TQDialog.__init__(self, parent, "Dialog", 1, qt.TQt.WDestructiveClose)
self.setCaption("Copy Center")
- layout = qt.QVBoxLayout(self)
- box = qt.QVBox(self)
+ layout = qt.TQVBoxLayout(self)
+ box = qt.TQVBox(self)
box.setMargin(6)
box.setSpacing(6)
layout.addWidget(box)
- self.tab = qt.QTabWidget(box)
+ self.tab = qt.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.QSplitter(self.tab)
+ self.splitter = qt.TQSplitter(self.tab)
sourceplugins = []
destinationplugins = []
@@ -565,27 +565,27 @@ def runGuiApp(copycenter, name):
"Destination:", # caption
self.splitter, self, destinationplugins)
- btnbox = qt.QHBox(box)
+ btnbox = qt.TQHBox(box)
btnbox.setSpacing(6)
- okbtn = qt.QPushButton(btnbox)
+ okbtn = qt.TQPushButton(btnbox)
okbtn.setText("Start Copy")
okbtn.setDefault(True)
- qt.QObject.connect(okbtn,qt.SIGNAL("clicked()"),self.startCopy)
- cancelbtn = qt.QPushButton(btnbox)
+ qt.TQObject.connect(okbtn,qt.SIGNAL("clicked()"),self.startCopy)
+ cancelbtn = qt.TQPushButton(btnbox)
cancelbtn.setText("Cancel")
- qt.QObject.connect(cancelbtn,qt.SIGNAL("clicked()"),self.close)
+ qt.TQObject.connect(cancelbtn,qt.SIGNAL("clicked()"),self.close)
self.tab.addTab(self.splitter,"Copy")
self.tab.setCurrentPage(1)
- self.helpbrowser = qt.QTextBrowser(self.tab)
+ self.helpbrowser = qt.TQTextBrowser(self.tab)
self.helpbrowser.setLinkUnderline(False)
self.helpbrowser.setUndoRedoEnabled(False)
self.tab.addTab(self.helpbrowser,"Help")
- qt.QObject.connect(self.tab,qt.SIGNAL("currentChanged(QWidget*)"),self.currentTabChanged)
+ qt.TQObject.connect(self.tab,qt.SIGNAL("currentChanged(QWidget*)"),self.currentTabChanged)
+
+ box.setMinimumSize( qt.TQSize(760,500) )
- box.setMinimumSize( qt.QSize(760,500) )
-
defaultfile = os.path.join(self.copycenter.homepath,"default.copycenterjob.xml")
if os.path.isfile(defaultfile):
print "Reading default copy job file: %s" % defaultfile
@@ -619,7 +619,7 @@ def runGuiApp(copycenter, name):
fh = open(file,'r')
self.helpbrowser.setText( fh.read() )
fh.close()
-
+
def startCopy(self):
dlg = ProgressDialog(self)
dlg.show()
@@ -627,7 +627,7 @@ def runGuiApp(copycenter, name):
#--------------------------------------------------------------------
if name == "__main__":
- qtapp = qt.QApplication(sys.argv)
+ qtapp = qt.TQApplication(sys.argv)
else:
qtapp = qt.tqApp
dialog = Dialog(copycenter, qtapp.mainWidget())
diff --git a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py
index e8241405..0b78bfa1 100644
--- a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py
+++ b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py
@@ -99,7 +99,7 @@ class CopyCenterPlugin:
def tableNames(self): return self.kexidbconnection.tableNames()
def hasTableName(self,tablename): return tablename in self.kexidbconnection.tableNames()
def tableSchema(self,tablename): return self.kexidbconnection.tableSchema(tablename)
-
+
def init(self,copierer):
self.copierer = copierer
if self.kexidbconnection == None:
@@ -197,25 +197,25 @@ class CopyCenterPlugin:
self.copycenter = copycenter
def createWidget(self, dialog, plugin, parent):
- """ Each plugin may provide a qt.QWidget back to the
+ """ Each plugin may provide a qt.TQWidget back to the
CopyCenter.py. The widget will be used to configure our
plugin settings. """
- import qt
+ from TQt import qt
import os
import re
self.dialog = dialog
self.mainbox = None
- class ProjectBox(qt.QHBox):
+ class ProjectBox(qt.TQHBox):
def __init__(self,main,copycenterplugin,plugin,parent):
self.main = main
self.copycenterplugin = copycenterplugin
self.plugin = plugin
- qt.QHBox.__init__(self,parent)
- prjlabel = qt.QLabel("Project File:",self)
- self.prjcombo = qt.QComboBox(self)
+ qt.TQHBox.__init__(self,parent)
+ prjlabel = qt.TQLabel("Project File:",self)
+ self.prjcombo = qt.TQComboBox(self)
self.prjcombo.setEditable(True)
self.prjcombo.insertItem("")
@@ -224,11 +224,11 @@ class CopyCenterPlugin:
file = os.path.join(path,f)
if os.path.isfile(file) and re.search(".+\\.(kexi|kexis|kexic)$",f):
self.prjcombo.insertItem(os.path.join("~",f))
-
+
prjlabel.setBuddy(self.prjcombo)
- prjsavebtn = qt.QPushButton("...",self)
- qt.QObject.connect(prjsavebtn, qt.SIGNAL("clicked()"),self.buttonClicked)
- qt.QObject.connect(self.prjcombo, qt.SIGNAL("textChanged(const QString&)"), self.main.projectChanged)
+ 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)
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.QFileDialog.getOpenFileName(text,"*.kexi *.kexis *.kexic;;*",self.copycenterplugin.dialog)
+ filename = qt.TQFileDialog.getOpenFileName(text,"*.kexi *.kexis *.kexic;;*",self.copycenterplugin.dialog)
else: # "Destination":
- filename = qt.QFileDialog.getSaveFileName(text,"*.kexi *.kexis *.kexic;;*",self.copycenterplugin.dialog)
+ filename = qt.TQFileDialog.getSaveFileName(text,"*.kexi *.kexis *.kexic;;*",self.copycenterplugin.dialog)
if str(filename) != "": self.prjcombo.setCurrentText(str(filename))
- class DriverBox(qt.QVBox):
+ class DriverBox(qt.TQVBox):
def __init__(self,main,parent):
- qt.QVBox.__init__(self,parent)
+ qt.TQVBox.__init__(self,parent)
self.main = main
self.copycenterplugin = main.copycenterplugin
self.plugin = main.plugin
self.driver = None
- driverbox = qt.QHBox(self)
- driverlabel = qt.QLabel("Driver:",driverbox)
- self.drivercombo = qt.QComboBox(driverbox)
+ driverbox = qt.TQHBox(self)
+ driverlabel = qt.TQLabel("Driver:",driverbox)
+ self.drivercombo = qt.TQComboBox(driverbox)
self.drivercombo.insertItem("")
for driver in self.copycenterplugin.drivermanager.driverNames():
self.drivercombo.insertItem(driver)
- qt.QObject.connect(self.drivercombo, qt.SIGNAL("activated(int)"), self.activated)
+ qt.TQObject.connect(self.drivercombo, qt.SIGNAL("activated(int)"), self.activated)
driverlabel.setBuddy(self.drivercombo)
driverbox.setStretchFactor(self.drivercombo,1)
-
- self.box = qt.QVBox(self)
+
+ self.box = qt.TQVBox(self)
self.mainbox = None
def activated(self,index):
@@ -281,58 +281,58 @@ class CopyCenterPlugin:
self.driver = self.copycenterplugin.drivermanager.driver(drivertext)
- mainbox = qt.QVBox(self.box)
+ mainbox = qt.TQVBox(self.box)
mainbox.setSpacing(2)
if self.driver.isFileDriver():
- filebox = qt.QHBox(mainbox)
- filelabel = qt.QLabel("File:",filebox)
- self.fileedit = qt.QLineEdit(self.plugin.options['file'],filebox)
+ filebox = qt.TQHBox(mainbox)
+ filelabel = qt.TQLabel("File:",filebox)
+ self.fileedit = qt.TQLineEdit(self.plugin.options['file'],filebox)
filelabel.setBuddy(self.fileedit)
filebox.setStretchFactor(self.fileedit,1)
- filebtn = qt.QPushButton("...",filebox)
- qt.QObject.connect(filebtn, qt.SIGNAL("clicked()"), self.fileClicked)
+ filebtn = qt.TQPushButton("...",filebox)
+ qt.TQObject.connect(filebtn, qt.SIGNAL("clicked()"), self.fileClicked)
else:
- hostbox = qt.QHBox(mainbox)
- hostlabel = qt.QLabel("Hostname:",hostbox)
- self.hostedit = qt.QLineEdit(self.plugin.options['hostname'],hostbox)
+ hostbox = qt.TQHBox(mainbox)
+ hostlabel = qt.TQLabel("Hostname:",hostbox)
+ self.hostedit = qt.TQLineEdit(self.plugin.options['hostname'],hostbox)
hostlabel.setBuddy(self.hostedit)
hostbox.setStretchFactor(self.hostedit,1)
- portbox = qt.QHBox(mainbox)
- portlabel = qt.QLabel("Port:",portbox)
- self.portedit = qt.QLineEdit(self.plugin.options['port'],portbox)
+ portbox = qt.TQHBox(mainbox)
+ portlabel = qt.TQLabel("Port:",portbox)
+ self.portedit = qt.TQLineEdit(self.plugin.options['port'],portbox)
portlabel.setBuddy(self.portedit)
portbox.setStretchFactor(self.portedit,1)
- sockbox = qt.QHBox(mainbox)
- self.sockfilecheckbox = qt.QCheckBox("Socket File:",sockbox)
- qt.QObject.connect(self.sockfilecheckbox, qt.SIGNAL("toggled(bool)"), self.sockfilecheckboxClicked)
- self.sockfilebox = qt.QHBox(sockbox)
- self.sockfileedit = qt.QLineEdit(self.plugin.options['socketfile'],self.sockfilebox)
+ 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)
self.sockfilebox.setEnabled(False)
- sockfilebtn = qt.QPushButton("...",self.sockfilebox)
+ sockfilebtn = qt.TQPushButton("...",self.sockfilebox)
self.sockfilecheckbox.setChecked( str(self.plugin.options['usesocketfile']) == str(True) )
- qt.QObject.connect(sockfilebtn, qt.SIGNAL("clicked()"), self.sockfileClicked)
+ qt.TQObject.connect(sockfilebtn, qt.SIGNAL("clicked()"), self.sockfileClicked)
self.sockfilebox.setStretchFactor(self.sockfileedit,1)
sockbox.setStretchFactor(self.sockfilebox,1)
- userbox = qt.QHBox(mainbox)
- userlabel = qt.QLabel("Username:",userbox)
- self.useredit = qt.QLineEdit(self.plugin.options['username'],userbox)
+ userbox = qt.TQHBox(mainbox)
+ userlabel = qt.TQLabel("Username:",userbox)
+ self.useredit = qt.TQLineEdit(self.plugin.options['username'],userbox)
userlabel.setBuddy(self.useredit)
userbox.setStretchFactor(self.useredit,1)
- passbox = qt.QHBox(mainbox)
- passlabel = qt.QLabel("Password:",passbox)
- self.passedit = qt.QLineEdit(self.plugin.options['password'],passbox)
- self.passedit.setEchoMode(qt.QLineEdit.Password)
+ passbox = qt.TQHBox(mainbox)
+ passlabel = qt.TQLabel("Password:",passbox)
+ self.passedit = qt.TQLineEdit(self.plugin.options['password'],passbox)
+ self.passedit.setEchoMode(qt.TQLineEdit.Password)
passlabel.setBuddy(self.passedit)
passbox.setStretchFactor(self.passedit,1)
- dbbox = qt.QHBox(mainbox)
- dblabel = qt.QLabel("Database:",dbbox)
- self.dbedit = qt.QLineEdit(self.plugin.options['database'],dbbox)
+ dbbox = qt.TQHBox(mainbox)
+ dblabel = qt.TQLabel("Database:",dbbox)
+ self.dbedit = qt.TQLineEdit(self.plugin.options['database'],dbbox)
dblabel.setBuddy(self.dbedit)
dbbox.setStretchFactor(self.dbedit,1)
#self.tablecombo.setText("")
@@ -347,32 +347,32 @@ class CopyCenterPlugin:
text = str(self.fileedit.text())
if text == "": text = self.copycenterplugin.copycenter.homepath
if self.plugin.plugintype == "Source":
- filename = qt.QFileDialog.getOpenFileName(text,"*",self.copycenterplugin.dialog)
+ filename = qt.TQFileDialog.getOpenFileName(text,"*",self.copycenterplugin.dialog)
else: # "Destination":
- filename = qt.QFileDialog.getSaveFileName(text,"*",self.copycenterplugin.dialog)
+ filename = qt.TQFileDialog.getSaveFileName(text,"*",self.copycenterplugin.dialog)
if str(filename) != "": self.fileedit.setText(str(filename))
def sockfilecheckboxClicked(self,checked):
self.sockfilebox.setEnabled(checked)
-
+
def sockfileClicked(self):
text = str(self.sockfileedit.text())
if text == "": text = self.copycenterplugin.copycenter.homepath
if self.plugin.plugintype == "Source":
- filename = qt.QFileDialog.getOpenFileName(text,"*",self.copycenterplugin.dialog)
+ filename = qt.TQFileDialog.getOpenFileName(text,"*",self.copycenterplugin.dialog)
else: # "Destination":
- filename = qt.QFileDialog.getSaveFileName(text,"*",self.copycenterplugin.dialog)
+ filename = qt.TQFileDialog.getSaveFileName(text,"*",self.copycenterplugin.dialog)
if str(filename) != "": self.sockfileedit.setText(str(filename))
- class TableBox(qt.QHBox):
+ class TableBox(qt.TQHBox):
def __init__(self,copycenterplugin,plugin,parent):
- qt.QHBox.__init__(self,parent)
+ qt.TQHBox.__init__(self,parent)
self.copycenterplugin = copycenterplugin
self.plugin = plugin
- tablelabel = qt.QLabel("Table:",self)
- self.tableedit = qt.QLineEdit(self.plugin.options['table'],self)
- self.tablebtn = qt.QPushButton("...",self)
+ tablelabel = qt.TQLabel("Table:",self)
+ self.tableedit = qt.TQLineEdit(self.plugin.options['table'],self)
+ self.tablebtn = qt.TQPushButton("...",self)
self.tablebtn.setEnabled(False)
- qt.QObject.connect(self.tablebtn, qt.SIGNAL("clicked()"), self.buttonClicked)
+ qt.TQObject.connect(self.tablebtn, qt.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.QListViewItem(self.listview,table)
+ item = qt.TQListViewItem(self.listview,table)
else:
- item = qt.QListViewItem(self.listview,item,table)
+ item = qt.TQListViewItem(self.listview,item,table)
if table == text:
self.listview.setSelected(item,True)
self.listview.ensureItemVisible(item)
- qt.QObject.connect(self.listview, qt.SIGNAL("doubleClicked(QListViewItem*, const QPoint&, int)"), self.okClicked)
- qt.QObject.connect(self.okbtn, qt.SIGNAL("clicked()"), self.okClicked)
+ qt.TQObject.connect(self.listview, qt.SIGNAL("doubleClicked(QListViewItem*, const QPoint&, int)"), self.okClicked)
+ qt.TQObject.connect(self.okbtn, qt.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.QHBox):
+ class FieldBox(qt.TQHBox):
def __init__(self,copycenterplugin,plugin,parent):
- qt.QHBox.__init__(self,parent)
+ qt.TQHBox.__init__(self,parent)
self.copycenterplugin = copycenterplugin
self.plugin = plugin
self.tablename = ""
- fieldslabel = qt.QLabel("Fields:",self)
- self.fieldsedit = qt.QLineEdit(self.plugin.options['fields'],self)
+ fieldslabel = qt.TQLabel("Fields:",self)
+ self.fieldsedit = qt.TQLineEdit(self.plugin.options['fields'],self)
self.setStretchFactor(self.fieldsedit,1)
fieldslabel.setBuddy(self.fieldsedit)
- self.fieldsbtn = qt.QPushButton("...",self)
+ self.fieldsbtn = qt.TQPushButton("...",self)
self.fieldsbtn.setEnabled(False)
- qt.QObject.connect(self.fieldsbtn, qt.SIGNAL("clicked()"), self.fieldsClicked)
+ qt.TQObject.connect(self.fieldsbtn, qt.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.QListView.Multi)
+ self.listview.setSelectionMode(qt.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.QObject.connect(self.okbtn, qt.SIGNAL("clicked()"), self.okClicked)
+ qt.TQObject.connect(self.okbtn, qt.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.QHBox):
+ class MainBox(qt.TQHBox):
def __init__(self,copycenterplugin,plugin,parent):
- qt.QHBox.__init__(self,parent)
+ qt.TQHBox.__init__(self,parent)
self.copycenterplugin = copycenterplugin
self.plugin = plugin
self.prjbox = ProjectBox(self,copycenterplugin,plugin,parent)
self.driverbox = DriverBox(self,parent)
- statusbar = qt.QHBox(parent)
+ statusbar = qt.TQHBox(parent)
statusbar.setSpacing(2)
- #self.statuslabel = qt.QLabel("Disconnected",statusbar)
+ #self.statuslabel = qt.TQLabel("Disconnected",statusbar)
#statusbar.setStretchFactor(self.statuslabel,1)
- statusbar.setStretchFactor(qt.QWidget(statusbar),1)
- self.connectbtn = qt.QPushButton("Connect",statusbar)
+ statusbar.setStretchFactor(qt.TQWidget(statusbar),1)
+ self.connectbtn = qt.TQPushButton("Connect",statusbar)
self.connectbtn.setEnabled(False)
- qt.QObject.connect(self.connectbtn, qt.SIGNAL("clicked()"),self.connectClicked)
- self.disconnectbtn = qt.QPushButton("Disconnect",statusbar)
+ qt.TQObject.connect(self.connectbtn, qt.SIGNAL("clicked()"),self.connectClicked)
+ self.disconnectbtn = qt.TQPushButton("Disconnect",statusbar)
self.disconnectbtn.setEnabled(False)
- qt.QObject.connect(self.disconnectbtn, qt.SIGNAL("clicked()"),self.disconnectClicked)
+ qt.TQObject.connect(self.disconnectbtn, qt.SIGNAL("clicked()"),self.disconnectClicked)
#self.connectionbox = ConnectionBox(copycenterplugin,plugin,parent)
self.tablebox = TableBox(copycenterplugin,plugin,parent)
self.fieldbox = FieldBox(copycenterplugin,plugin,parent)
- qt.QObject.connect(self.tablebox.tableedit, qt.SIGNAL("textChanged(const QString&)"), self.fieldbox.tableChanged)
+ qt.TQObject.connect(self.tablebox.tableedit, qt.SIGNAL("textChanged(const QString&)"), 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.Qt.ExactMatch).text())
+ item = str(self.driverbox.drivercombo.listBox().findItem(self.plugin.options['driver'],qt.TQt.ExactMatch).text())
self.driverbox.drivercombo.setCurrentText(item)
self.driverbox.activated(item)
except:
pass
if self.plugin.plugintype == "Destination":
- #typebox = qt.QHBox(parent)
- #label = qt.QLabel("Operation:",typebox)
- #combobox = qt.QComboBox(typebox)
+ #typebox = qt.TQHBox(parent)
+ #label = qt.TQLabel("Operation:",typebox)
+ #combobox = qt.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.QHBox(parent)
- wherelabel = qt.QLabel("Where:",wherebox)
- self.whereedit = qt.QLineEdit(self.plugin.options['where'],wherebox)
+ wherebox = qt.TQHBox(parent)
+ wherelabel = qt.TQLabel("Where:",wherebox)
+ self.whereedit = qt.TQLineEdit(self.plugin.options['where'],wherebox)
- #orderbox = qt.QHBox(parent)
- #orderlabel = qt.QLabel("Order By:",orderbox)
- #orderedit = qt.QLineEdit("",orderbox)
+ #orderbox = qt.TQHBox(parent)
+ #orderlabel = qt.TQLabel("Order By:",orderbox)
+ #orderedit = qt.TQLineEdit("",orderbox)
- #errbox = qt.QHBox(parent)
- #errlabel = qt.QLabel("On Error:",errbox)
- #errcombo = qt.QComboBox(errbox)
+ #errbox = qt.TQHBox(parent)
+ #errlabel = qt.TQLabel("On Error:",errbox)
+ #errcombo = qt.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.QMessageBox.critical(self,"Failed to connect","There exists no such database file \"%s\"" % file)
+ qt.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.QMessageBox.critical(self,"Failed to connect",connection.lastError())
+ qt.TQMessageBox.critical(self,"Failed to connect",connection.lastError())
return False
print "Use database \"%s\"" % connectiondata.databaseName()
if not connection.useDatabase( connectiondata.databaseName() ):
- qt.QMessageBox.critical(self,"Failed to connect",connection.lastError())
+ qt.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.QMessageBox.critical(self,"Failed to disconnect",self.plugin.connection.lastError())
+ qt.TQMessageBox.critical(self,"Failed to disconnect",self.plugin.connection.lastError())
return
self.updateConnectButtons()
@@ -639,7 +639,7 @@ class CopyCenterPlugin:
except:
pass
return ""
-
+
mainbox = MainBox(self,plugin,parent)
plugin.widget = mainbox
return mainbox
diff --git a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py
index 985d757d..40d1a317 100644
--- a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py
+++ b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py
@@ -1,5 +1,5 @@
"""
-CopyCenterPlugin to provide 'QtSQL'.
+CopyCenterPlugin to provide 'TQtSQL'.
Description:
This python-script is a plugin for the CopyCenter.py.
@@ -12,12 +12,12 @@ GPL v2 or higher.
"""
class CopyCenterPlugin:
- """ The CopyCenterPlugin to provide 'QtSQL' to CopyCenter.py """
+ """ The CopyCenterPlugin to provide 'TQtSQL' to CopyCenter.py """
- name = "QtSQL Database"
+ name = "TQtSQL Database"
""" The name this plugin has. The name should be unique and
will be used for displaying a caption. """
-
+
class Plugin:
def _init_(self,copycenterplugin):
self.copycenterplugin = copycenterplugin
@@ -52,7 +52,7 @@ class CopyCenterPlugin:
'port': 3306,
'username': 'root', #'MyUsername',
'password': '', #'MySecretPassword',
- 'database': '', #'MyQtSQLDatabase',
+ 'database': '', #'MyTQtSQLDatabase',
'table': '', #'table1',
'fields': '', #'f1,f2',
'where': '',
@@ -61,9 +61,9 @@ class CopyCenterPlugin:
self._init(copierer)
tablename = str(self.widget.tableedit.text())
wherestatement = str(self.widget.whereedit.text())
- import qt
- import qtsql
- self.cursor = qtsql.QSqlCursor(tablename,True,self.database)
+ from TQt import qt
+ from TQt import qtsql
+ self.cursor = qtsql.TQSqlCursor(tablename,True,self.database)
self.cursor.setFilter(wherestatement)
if not self.cursor.select():
raise "Select on cursor failed.<br>%s<br>%s" % ( str(self.cursor.lastError().driverText()),str(self.cursor.lastError().databaseText()) )
@@ -98,7 +98,7 @@ class CopyCenterPlugin:
'port': 3306,
'username': 'root', #'MyUsername',
'password': '', #'MySecretPassword',
- 'database': '', #'MyQtSQLDatabase',
+ 'database': '', #'MyTQtSQLDatabase',
'table': '', #'table2',
'fields': '', #'field1,field2',
'operation': 'Insert', #'Insert','Update'...
@@ -106,8 +106,8 @@ class CopyCenterPlugin:
}
def init(self,copierer):
self._init(copierer)
- import qt
- import qtsql
+ from TQt import qt
+ from TQt import qtsql
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.QSqlCursor(tablename,True,self.database)
+ self.cursor = qtsql.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
- import qt
+ from TQt import qt
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.QVariant()
+ v = qt.TQVariant()
else:
- v = qt.QVariant(r)
+ v = qt.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 "Invalid index-field defined."
self.cursor.setPrimaryIndex(pkindex)
- #self.cursor.setMode( qtsql.QSqlCursor.Insert | qtsql.QSqlCursor.Update )
+ #self.cursor.setMode( qtsql.TQSqlCursor.Insert | qtsql.TQSqlCursor.Update )
self.copierer.appendProgressMessage("Update SQL: %s" % str(self.cursor.executedQuery()))
def writeUpdate(self, record):
- import qt
+ from TQt import qt
# 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.QVariant()
+ v = qt.TQVariant()
else:
- v = qt.QVariant(r)
+ v = qt.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.QWidget back to the
+ """ Each plugin may provide a qt.TQWidget back to the
CopyCenter.py. The widget will be used to configure our
plugin settings. """
- import qt
+ from TQt import qt
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.QListViewItem(self.listview,table)
+ item = qt.TQListViewItem(self.listview,table)
else:
- item = qt.QListViewItem(self.listview,item,table)
+ item = qt.TQListViewItem(self.listview,item,table)
if table == text:
self.listview.setSelected(item,True)
self.listview.ensureItemVisible(item)
- qt.QObject.connect(self.listview, qt.SIGNAL("doubleClicked(QListViewItem*, const QPoint&, int)"), self.okClicked)
- qt.QObject.connect(self.okbtn, qt.SIGNAL("clicked()"), self.okClicked)
+ qt.TQObject.connect(self.listview, qt.SIGNAL("doubleClicked(QListViewItem*, const QPoint&, int)"), self.okClicked)
+ qt.TQObject.connect(self.okbtn, qt.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.QListView.Multi)
+ self.listview.setSelectionMode(qt.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.QVariant.typeToName(fieldinfo.type()), opts),item)
+ item = self.addItem((fieldinfo.name(), qt.TQVariant.typeToName(fieldinfo.type()), opts),item)
if allfields or fieldinfo.name() in fieldslist:
self.listview.setSelected(item,True)
- qt.QObject.connect(self.okbtn, qt.SIGNAL("clicked()"), self.okClicked)
+ qt.TQObject.connect(self.okbtn, qt.SIGNAL("clicked()"), self.okClicked)
def okClicked(self):
selitems = []
item = self.listview.firstChild()
@@ -279,101 +279,101 @@ class CopyCenterPlugin:
self.close()
- class MainWidget(qt.QHBox):
+ class MainWidget(qt.TQHBox):
def __init__(self,plugin,dialog,parent):
- import qt
- import qtsql
- qt.QHBox.__init__(self,parent)
+ from TQt import qt
+ from TQt import qtsql
+ qt.TQHBox.__init__(self,parent)
self.dialog = dialog
self.plugin = plugin
- self.connectionbox = qt.QVBox(parent)
+ self.connectionbox = qt.TQVBox(parent)
self.connectionbox.setSpacing(2)
- driverbox = qt.QHBox(self.connectionbox)
- driverlabel = qt.QLabel("Driver:",driverbox)
- self.driveredit = qt.QComboBox(driverbox)
- for driver in qtsql.QSqlDatabase.drivers():
+ driverbox = qt.TQHBox(self.connectionbox)
+ driverlabel = qt.TQLabel("Driver:",driverbox)
+ self.driveredit = qt.TQComboBox(driverbox)
+ for driver in qtsql.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.QHBox(self.connectionbox)
- hostlabel = qt.QLabel("Hostname:",hostbox)
- self.hostedit = qt.QLineEdit(self.plugin.options['hostname'],hostbox)
+ hostbox = qt.TQHBox(self.connectionbox)
+ hostlabel = qt.TQLabel("Hostname:",hostbox)
+ self.hostedit = qt.TQLineEdit(self.plugin.options['hostname'],hostbox)
hostlabel.setBuddy(self.hostedit)
hostbox.setStretchFactor(self.hostedit,1)
-
- portbox = qt.QHBox(self.connectionbox)
- portlabel = qt.QLabel("Port:",portbox)
- self.portedit = qt.QLineEdit(str(self.plugin.options['port']),portbox)
+
+ portbox = qt.TQHBox(self.connectionbox)
+ portlabel = qt.TQLabel("Port:",portbox)
+ self.portedit = qt.TQLineEdit(str(self.plugin.options['port']),portbox)
portlabel.setBuddy(self.portedit)
portbox.setStretchFactor(self.portedit,1)
- userbox = qt.QHBox(self.connectionbox)
- userlabel = qt.QLabel("Username:",userbox)
- self.useredit = qt.QLineEdit(self.plugin.options['username'],userbox)
+ userbox = qt.TQHBox(self.connectionbox)
+ userlabel = qt.TQLabel("Username:",userbox)
+ self.useredit = qt.TQLineEdit(self.plugin.options['username'],userbox)
userlabel.setBuddy(self.useredit)
userbox.setStretchFactor(self.useredit,1)
-
- passbox = qt.QHBox(self.connectionbox)
- passlabel = qt.QLabel("Password:",passbox)
- self.passedit = qt.QLineEdit(self.plugin.options['password'],passbox)
- self.passedit.setEchoMode(qt.QLineEdit.Password)
+
+ 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)
passlabel.setBuddy(self.passedit)
passbox.setStretchFactor(self.passedit,1)
- dbbox = qt.QHBox(self.connectionbox)
- dblabel = qt.QLabel("Database:",dbbox)
- self.dbedit = qt.QLineEdit(self.plugin.options['database'],dbbox)
+ dbbox = qt.TQHBox(self.connectionbox)
+ dblabel = qt.TQLabel("Database:",dbbox)
+ self.dbedit = qt.TQLineEdit(self.plugin.options['database'],dbbox)
dblabel.setBuddy(self.dbedit)
dbbox.setStretchFactor(self.dbedit,1)
-
- statusbar = qt.QHBox(parent)
+
+ statusbar = qt.TQHBox(parent)
statusbar.setSpacing(2)
- statusbar.setStretchFactor(qt.QWidget(statusbar),1)
- self.connectbtn = qt.QPushButton("Connect",statusbar)
- qt.QObject.connect(self.connectbtn, qt.SIGNAL("clicked()"),self.connectClicked)
- self.disconnectbtn = qt.QPushButton("Disconnect",statusbar)
+ 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)
self.disconnectbtn.setEnabled(False)
- qt.QObject.connect(self.disconnectbtn, qt.SIGNAL("clicked()"),self.disconnectClicked)
+ qt.TQObject.connect(self.disconnectbtn, qt.SIGNAL("clicked()"),self.disconnectClicked)
- tablebox = qt.QHBox(parent)
- tablelabel = qt.QLabel("Table:",tablebox)
- self.tableedit = qt.QLineEdit(self.plugin.options['table'],tablebox)
- qt.QObject.connect(self.tableedit, qt.SIGNAL("textChanged(const QString&)"), self.tableEditChanged)
- self.tablebtn = qt.QPushButton("...",tablebox)
+ 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)
self.tablebtn.setEnabled(False)
- qt.QObject.connect(self.tablebtn, qt.SIGNAL("clicked()"), self.tableBtnClicked)
+ qt.TQObject.connect(self.tablebtn, qt.SIGNAL("clicked()"), self.tableBtnClicked)
tablelabel.setBuddy(self.tableedit)
tablebox.setStretchFactor(self.tableedit,1)
- fieldbox = qt.QHBox(parent)
- fieldlabel = qt.QLabel("Fields:",fieldbox)
- self.fieldedit = qt.QLineEdit(self.plugin.options['fields'],fieldbox)
- self.fieldbtn = qt.QPushButton("...",fieldbox)
+ fieldbox = qt.TQHBox(parent)
+ fieldlabel = qt.TQLabel("Fields:",fieldbox)
+ self.fieldedit = qt.TQLineEdit(self.plugin.options['fields'],fieldbox)
+ self.fieldbtn = qt.TQPushButton("...",fieldbox)
self.fieldbtn.setEnabled(False)
- qt.QObject.connect(self.fieldbtn, qt.SIGNAL("clicked()"), self.fieldBtnClicked)
+ qt.TQObject.connect(self.fieldbtn, qt.SIGNAL("clicked()"), self.fieldBtnClicked)
fieldlabel.setBuddy(self.fieldedit)
fieldbox.setStretchFactor(self.fieldedit,1)
if self.plugin.plugintype == "Source":
- box = qt.QHBox(parent)
- wherelabel = qt.QLabel("Where:",box)
- self.whereedit = qt.QLineEdit(self.plugin.options['where'],box)
+ box = qt.TQHBox(parent)
+ wherelabel = qt.TQLabel("Where:",box)
+ self.whereedit = qt.TQLineEdit(self.plugin.options['where'],box)
wherelabel.setBuddy(self.whereedit)
box.setStretchFactor(self.whereedit,1)
elif self.plugin.plugintype == "Destination":
-
- class OperationBox(qt.QVBox):
+
+ class OperationBox(qt.TQVBox):
def __init__(self, mainwidget, parent):
self.mainwidget = mainwidget
- qt.QVBox.__init__(self, parent)
- opbox = qt.QHBox(self)
- operationlabel = qt.QLabel("Operation:",opbox)
- self.mainwidget.operationedit = qt.QComboBox(opbox)
+ qt.TQVBox.__init__(self, parent)
+ opbox = qt.TQHBox(self)
+ operationlabel = qt.TQLabel("Operation:",opbox)
+ self.mainwidget.operationedit = qt.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.QObject.connect(self.mainwidget.operationedit, qt.SIGNAL("activated(int)"), self.operationActivated)
+ qt.TQObject.connect(self.mainwidget.operationedit, qt.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.QHBox(self)
- indexlabel = qt.QLabel("Indexfield:", self.box)
- self.mainwidget.indexedit = qt.QLineEdit(self.mainwidget.plugin.options['indexfield'], self.box)
+ self.box = qt.TQHBox(self)
+ indexlabel = qt.TQLabel("Indexfield:", self.box)
+ self.mainwidget.indexedit = qt.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..."
- import qtsql
+ from TQt import qtsql
drivername = str(self.driveredit.currentText())
print "drivername: %s" % drivername
connectionname = "CopyCenter%s" % self.plugin.plugintype
print "connectionname: %s" % connectionname
- self.plugin.database = qtsql.QSqlDatabase.addDatabase(drivername,connectionname)
+ self.plugin.database = qtsql.TQSqlDatabase.addDatabase(drivername,connectionname)
if not self.plugin.database:
- qt.QMessageBox.critical(self,"Failed to connect","<qt>Failed to create database for driver \"%s\"</qt>" % drivername)
+ qt.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.QMessageBox.critical(self,"Failed to connect","<qt>%s<br><br>%s</qt>" % (self.plugin.database.lastError().driverText(),self.plugin.database.lastError().databaseText()))
+ qt.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()