diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/plugins/scripting/scripts/copycenter | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/plugins/scripting/scripts/copycenter')
3 files changed, 81 insertions, 81 deletions
diff --git a/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py b/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py index 3718512f..3a2734aa 100644 --- a/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py +++ b/kexi/plugins/scripting/scripts/copycenter/CopyCenter.py @@ -89,14 +89,14 @@ def runGuiApp(copycenter, name): #-------------------------------------------------------------------- class ListViewDialog(qt.QDialog): - def __init__(self, parent, caption): - qt.QDialog.__init__(self, parent, "ProgressDialog", 1) - self.parent = parent + def __init__(self, tqparent, caption): + qt.QDialog.__init__(self, tqparent, "ProgressDialog", 1) + self.tqparent = tqparent self.setCaption(caption) - layout = qt.QVBoxLayout(self) + tqlayout = qt.QVBoxLayout(self) box = qt.QVBox(self) box.setMargin(2) - layout.addWidget(box) + tqlayout.addWidget(box) self.listview = qt.QListView(box) self.listview.setAllColumnsShowFocus(True) self.listview.header().setStretchEnabled(True,0) @@ -124,9 +124,9 @@ def runGuiApp(copycenter, name): #-------------------------------------------------------------------- class CopyJobWidget(qt.QVBox): - def __init__(self,dialog,parent): + def __init__(self,dialog,tqparent): self.dialog = dialog - qt.QVBox.__init__(self,parent) + qt.QVBox.__init__(self,tqparent) self.setSpacing(6) typebox = qt.QHBox(self) typebox.setSpacing(6) @@ -165,7 +165,7 @@ def runGuiApp(copycenter, name): def doubleClicked(self, **args): print "CopyJobWidget.doubleClicked" item = self.listview.selectedItem() - if item and item.parent(): item.startRename(1) + if item and item.tqparent(): item.startRename(1) def readOptions(self,domnode,plugininst): print "CopyJobWidget.readOptions plugintype=\"%s\"" % plugininst.plugintype @@ -210,13 +210,13 @@ def runGuiApp(copycenter, name): if filename != "": self.jobfilecombobox.setCurrentText(filename) def escape(self,s): - return s.replace("&", "&").replace("'", "'").replace("<", "<").replace(">", ">").replace('"', """) + return s.tqreplace("&", "&").tqreplace("'", "'").tqreplace("<", "<").tqreplace(">", ">").tqreplace('"', """) def writeOptions(self,writer,pluginname,plugininst): print "CopyJobWidget.writeOptions" writer.write("<%s plugin=\"%s\">\n" % (plugininst.plugintype, pluginname)) for optionname in plugininst.options: - value = self.escape( unicode(plugininst.options[optionname]).encode("utf-8") ) + value = self.escape( tqunicode(plugininst.options[optionname]).encode("utf-8") ) writer.write("\t<%s value=\"%s\" />\n" % (optionname,value)) writer.write("</%s>\n" % plugininst.plugintype) @@ -238,19 +238,19 @@ def runGuiApp(copycenter, name): f.close() print "File \%s\" successfully written." % filename - def addItem(self, pluginimpl, afteritem = None, parentitem = None): + def addItem(self, pluginimpl, afteritem = None, tqparentitem = None): #print "CopyJobWidget.addItem" class ListViewItem(qt.QListViewItem): - def __init__(self, pluginimpl, listview, parentitem = None, afteritem = None): + def __init__(self, pluginimpl, listview, tqparentitem = None, afteritem = None): self.pluginimpl = pluginimpl - if parentitem == None: + if tqparentitem == None: qt.QListViewItem.__init__(self,listview) self.setOpen(True) else: if afteritem == None: - qt.QListViewItem.__init__(self,parentitem) + qt.QListViewItem.__init__(self,tqparentitem) else: - qt.QListViewItem.__init__(self,parentitem,afteritem) + qt.QListViewItem.__init__(self,tqparentitem,afteritem) self.setRenameEnabled(1,True) def startRename(self, columnindex): qt.QListViewItem.startRename(self,columnindex) @@ -271,10 +271,10 @@ def runGuiApp(copycenter, name): def text(self, columnindex): if columnindex == 1: - if qt.QListViewItem.text(self,0).contains("password"): + if qt.QListViewItem.text(self,0).tqcontains("password"): return "*" * len(str(qt.QListViewItem.text(self,1))) return qt.QListViewItem.text(self,columnindex) - return ListViewItem(pluginimpl, self.listview, parentitem, afteritem) + return ListViewItem(pluginimpl, self.listview, tqparentitem, afteritem) def updateItem(self,pluginname,pluginimpl): #print "CopyJobWidget.updateItem" @@ -309,31 +309,31 @@ def runGuiApp(copycenter, name): self.starttime = None qt.QDialog.__init__(self, dialog, "ProgressDialog", 1) self.setCaption("Copying...") - layout = qt.QVBoxLayout(self) + tqlayout = qt.QVBoxLayout(self) box = qt.QVBox(self) box.setSpacing(6) box.setMargin(6) - layout.addWidget(box) + tqlayout.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) + tqlayout = qt.QGridLayout(statusbox,4,2,0,2) + tqlayout.addWidget(qt.QLabel("Number of records done:",statusbox),0,0) self.donecounter = 0 self.donelabel = qt.QLabel("-",statusbox) - layout.addWidget(self.donelabel,0,1) - layout.addWidget(qt.QLabel("Successfully copied records:",statusbox),1,0) + tqlayout.addWidget(self.donelabel,0,1) + tqlayout.addWidget(qt.QLabel("Successfully copied records:",statusbox),1,0) self.successcounter = 0 self.successlabel = qt.QLabel("-",statusbox) - layout.addWidget(self.successlabel,1,1) - layout.addWidget(qt.QLabel("Failed to copy records:",statusbox),2,0) + tqlayout.addWidget(self.successlabel,1,1) + tqlayout.addWidget(qt.QLabel("Failed to copy records:",statusbox),2,0) self.failedcounter = 0 self.failedlabel = qt.QLabel("-",statusbox) - layout.addWidget(self.failedlabel,2,1) - layout.addWidget(qt.QLabel("Elapsed time in seconds:",statusbox),3,0) + tqlayout.addWidget(self.failedlabel,2,1) + tqlayout.addWidget(qt.QLabel("Elapsed time in seconds:",statusbox),3,0) self.elapsedlabel = qt.QLabel("-",statusbox) - layout.addWidget(self.elapsedlabel,3,1) + tqlayout.addWidget(self.elapsedlabel,3,1) btnbox = qt.QHBox(box) btnbox.setSpacing(6) self.donebtn = qt.QPushButton(btnbox) @@ -359,11 +359,11 @@ def runGuiApp(copycenter, name): def writeSuccess(self, record, rowcount): self.donecounter += rowcount self.successcounter += rowcount - qt.qApp.processEvents() + qt.tqApp.processEvents() def writeFailed(self, record): self.donecounter += 1 self.failedcounter += 1 - qt.qApp.processEvents() + qt.tqApp.processEvents() def startCopy(self): try: @@ -397,7 +397,7 @@ def runGuiApp(copycenter, name): self.starttime.start() self.updatetimer.start(500) - qt.qApp.processEvents() + qt.tqApp.processEvents() # Copy the records self.textbrowser.append("<hr><i>Copy the records...</i>") @@ -428,7 +428,7 @@ def runGuiApp(copycenter, name): def show(self): qt.QDialog.show(self) qt.QTimer.singleShot(10,self.startCopy) - qt.qApp.processEvents() + qt.tqApp.processEvents() def closeEvent(self, closeevent): if not self.dialog.getSourcePluginImpl().isFinished(): @@ -442,13 +442,13 @@ def runGuiApp(copycenter, name): #-------------------------------------------------------------------- class DataSelector(qt.QVGroupBox): - def __init__(self, plugintype, title, caption, parent, dialog, items): + def __init__(self, plugintype, title, caption, tqparent, dialog, items): self.plugintype = plugintype self.pluginimpl = None self.dialog = dialog self.mainbox = None - qt.QVGroupBox.__init__(self,title,parent) + qt.QVGroupBox.__init__(self,title,tqparent) self.setInsideMargin(6) self.setInsideSpacing(0) @@ -520,7 +520,7 @@ def runGuiApp(copycenter, name): #-------------------------------------------------------------------- class Dialog(qt.QDialog): - def __init__(self, copycenter, parent): + def __init__(self, copycenter, tqparent): self.copycenter = copycenter import qt @@ -528,13 +528,13 @@ def runGuiApp(copycenter, name): import sys self.ListViewDialog = ListViewDialog - qt.QDialog.__init__(self, parent, "Dialog", 1, qt.Qt.WDestructiveClose) + qt.QDialog.__init__(self, tqparent, "Dialog", 1, qt.Qt.WDestructiveClose) self.setCaption("Copy Center") - layout = qt.QVBoxLayout(self) + tqlayout = qt.QVBoxLayout(self) box = qt.QVBox(self) box.setMargin(6) box.setSpacing(6) - layout.addWidget(box) + tqlayout.addWidget(box) self.tab = qt.QTabWidget(box) self.tab.setMargin(6) box.setStretchFactor(self.tab,1) @@ -629,7 +629,7 @@ def runGuiApp(copycenter, name): if name == "__main__": qtapp = qt.QApplication(sys.argv) else: - qtapp = qt.qApp + qtapp = qt.tqApp dialog = Dialog(copycenter, qtapp.mainWidget()) dialog.exec_loop() diff --git a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py index e8241405..85023ee4 100644 --- a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py +++ b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginKexiDB.py @@ -53,9 +53,9 @@ class CopyCenterPlugin: def finish(self): """ Called if reading is finished.""" self.connection.finish() - def createWidget(self, dialog, parent): + def createWidget(self, dialog, tqparent): """ Create and return a widget to modify the plugin settings. """ - return self.copycenterplugin.createWidget(dialog, self, parent) + return self.copycenterplugin.createWidget(dialog, self, tqparent) class Source(Plugin): """ Specialization of the Plugin class to implement the @@ -196,7 +196,7 @@ class CopyCenterPlugin: self.drivermanager = krosskexidb.DriverManager() self.copycenter = copycenter - def createWidget(self, dialog, plugin, parent): + def createWidget(self, dialog, plugin, tqparent): """ Each plugin may provide a qt.QWidget back to the CopyCenter.py. The widget will be used to configure our plugin settings. """ @@ -208,12 +208,12 @@ class CopyCenterPlugin: self.dialog = dialog self.mainbox = None class ProjectBox(qt.QHBox): - def __init__(self,main,copycenterplugin,plugin,parent): + def __init__(self,main,copycenterplugin,plugin,tqparent): self.main = main self.copycenterplugin = copycenterplugin self.plugin = plugin - qt.QHBox.__init__(self,parent) + qt.QHBox.__init__(self,tqparent) prjlabel = qt.QLabel("Project File:",self) self.prjcombo = qt.QComboBox(self) self.prjcombo.setEditable(True) @@ -244,8 +244,8 @@ class CopyCenterPlugin: if str(filename) != "": self.prjcombo.setCurrentText(str(filename)) class DriverBox(qt.QVBox): - def __init__(self,main,parent): - qt.QVBox.__init__(self,parent) + def __init__(self,main,tqparent): + qt.QVBox.__init__(self,tqparent) self.main = main self.copycenterplugin = main.copycenterplugin self.plugin = main.plugin @@ -364,8 +364,8 @@ class CopyCenterPlugin: if str(filename) != "": self.sockfileedit.setText(str(filename)) class TableBox(qt.QHBox): - def __init__(self,copycenterplugin,plugin,parent): - qt.QHBox.__init__(self,parent) + def __init__(self,copycenterplugin,plugin,tqparent): + qt.QHBox.__init__(self,tqparent) self.copycenterplugin = copycenterplugin self.plugin = plugin tablelabel = qt.QLabel("Table:",self) @@ -405,8 +405,8 @@ class CopyCenterPlugin: dialog.show() class FieldBox(qt.QHBox): - def __init__(self,copycenterplugin,plugin,parent): - qt.QHBox.__init__(self,parent) + def __init__(self,copycenterplugin,plugin,tqparent): + qt.QHBox.__init__(self,tqparent) self.copycenterplugin = copycenterplugin self.plugin = plugin self.tablename = "" @@ -462,15 +462,15 @@ class CopyCenterPlugin: self.fieldsbtn.setEnabled(False) class MainBox(qt.QHBox): - def __init__(self,copycenterplugin,plugin,parent): - qt.QHBox.__init__(self,parent) + def __init__(self,copycenterplugin,plugin,tqparent): + qt.QHBox.__init__(self,tqparent) self.copycenterplugin = copycenterplugin self.plugin = plugin - self.prjbox = ProjectBox(self,copycenterplugin,plugin,parent) - self.driverbox = DriverBox(self,parent) + self.prjbox = ProjectBox(self,copycenterplugin,plugin,tqparent) + self.driverbox = DriverBox(self,tqparent) - statusbar = qt.QHBox(parent) + statusbar = qt.QHBox(tqparent) statusbar.setSpacing(2) #self.statuslabel = qt.QLabel("Disconnected",statusbar) #statusbar.setStretchFactor(self.statuslabel,1) @@ -482,9 +482,9 @@ class CopyCenterPlugin: self.disconnectbtn.setEnabled(False) qt.QObject.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) + #self.connectionbox = ConnectionBox(copycenterplugin,plugin,tqparent) + self.tablebox = TableBox(copycenterplugin,plugin,tqparent) + self.fieldbox = FieldBox(copycenterplugin,plugin,tqparent) qt.QObject.connect(self.tablebox.tableedit, qt.SIGNAL("textChanged(const QString&)"), self.fieldbox.tableChanged) if self.plugin.options['project'] != '': @@ -499,7 +499,7 @@ class CopyCenterPlugin: pass if self.plugin.plugintype == "Destination": - #typebox = qt.QHBox(parent) + #typebox = qt.QHBox(tqparent) #label = qt.QLabel("Operation:",typebox) #combobox = qt.QComboBox(typebox) #combobox.insertItem("Append") @@ -511,15 +511,15 @@ class CopyCenterPlugin: #typebox.setStretchFactor(combobox,1) pass elif self.plugin.plugintype == "Source": - wherebox = qt.QHBox(parent) + wherebox = qt.QHBox(tqparent) wherelabel = qt.QLabel("Where:",wherebox) self.whereedit = qt.QLineEdit(self.plugin.options['where'],wherebox) - #orderbox = qt.QHBox(parent) + #orderbox = qt.QHBox(tqparent) #orderlabel = qt.QLabel("Order By:",orderbox) #orderedit = qt.QLineEdit("",orderbox) - #errbox = qt.QHBox(parent) + #errbox = qt.QHBox(tqparent) #errlabel = qt.QLabel("On Error:",errbox) #errcombo = qt.QComboBox(errbox) #errcombo.insertItem("Ask") @@ -640,7 +640,7 @@ class CopyCenterPlugin: pass return "" - mainbox = MainBox(self,plugin,parent) + mainbox = MainBox(self,plugin,tqparent) 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..de553b92 100644 --- a/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py +++ b/kexi/plugins/scripting/scripts/copycenter/CopyCenterPluginQtSQL.py @@ -39,8 +39,8 @@ class CopyCenterPlugin: def finish(self): self.isfinished = True self.widget.disconnectClicked() - def createWidget(self,dialog,parent): - return self.copycenterplugin.widget(dialog, self, parent) + def createWidget(self,dialog,tqparent): + return self.copycenterplugin.widget(dialog, self, tqparent) class Source(Plugin): plugintype = "Source" @@ -84,7 +84,7 @@ class CopyCenterPlugin: return None record = [] for fieldname in self.fieldlist: - record.append( unicode(self.cursor.value(fieldname).toString()).encode("latin-1") ) + record.append( tqunicode(self.cursor.value(fieldname).toString()).encode("latin-1") ) #print "read record: %s" % record return record @@ -145,8 +145,8 @@ class CopyCenterPlugin: cursorrecord.setValue(self.fieldlist[i], v) rowcount = self.cursor.insert() if rowcount < 1: - drv = unicode(self.cursor.lastError().driverText()).encode("latin-1") - db = unicode(self.cursor.lastError().databaseText()).encode("latin-1") + drv = tqunicode(self.cursor.lastError().driverText()).encode("latin-1") + db = tqunicode(self.cursor.lastError().databaseText()).encode("latin-1") print "failed: %s %s" % (drv,db) self.copierer.writeFailed(record) else: @@ -209,7 +209,7 @@ class CopyCenterPlugin: """ Constructor. """ pass - def widget(self,dialog,plugin,parent): + def widget(self,dialog,plugin,tqparent): """ Each plugin may provide a qt.QWidget back to the CopyCenter.py. The widget will be used to configure our plugin settings. """ @@ -246,7 +246,7 @@ class CopyCenterPlugin: class FieldsDialog(ListViewDialog): def __init__(self, mainwidget): - ListViewDialog.__init__(self,parent,"Fields") + ListViewDialog.__init__(self,tqparent,"Fields") self.mainwidget = mainwidget self.listview.setSelectionMode(qt.QListView.Multi) self.listview.setSorting(-1) @@ -280,14 +280,14 @@ class CopyCenterPlugin: class MainWidget(qt.QHBox): - def __init__(self,plugin,dialog,parent): + def __init__(self,plugin,dialog,tqparent): import qt import qtsql - qt.QHBox.__init__(self,parent) + qt.QHBox.__init__(self,tqparent) self.dialog = dialog self.plugin = plugin - self.connectionbox = qt.QVBox(parent) + self.connectionbox = qt.QVBox(tqparent) self.connectionbox.setSpacing(2) driverbox = qt.QHBox(self.connectionbox) @@ -331,7 +331,7 @@ class CopyCenterPlugin: dblabel.setBuddy(self.dbedit) dbbox.setStretchFactor(self.dbedit,1) - statusbar = qt.QHBox(parent) + statusbar = qt.QHBox(tqparent) statusbar.setSpacing(2) statusbar.setStretchFactor(qt.QWidget(statusbar),1) self.connectbtn = qt.QPushButton("Connect",statusbar) @@ -340,7 +340,7 @@ class CopyCenterPlugin: self.disconnectbtn.setEnabled(False) qt.QObject.connect(self.disconnectbtn, qt.SIGNAL("clicked()"),self.disconnectClicked) - tablebox = qt.QHBox(parent) + tablebox = qt.QHBox(tqparent) 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) @@ -350,7 +350,7 @@ class CopyCenterPlugin: tablelabel.setBuddy(self.tableedit) tablebox.setStretchFactor(self.tableedit,1) - fieldbox = qt.QHBox(parent) + fieldbox = qt.QHBox(tqparent) fieldlabel = qt.QLabel("Fields:",fieldbox) self.fieldedit = qt.QLineEdit(self.plugin.options['fields'],fieldbox) self.fieldbtn = qt.QPushButton("...",fieldbox) @@ -360,7 +360,7 @@ class CopyCenterPlugin: fieldbox.setStretchFactor(self.fieldedit,1) if self.plugin.plugintype == "Source": - box = qt.QHBox(parent) + box = qt.QHBox(tqparent) wherelabel = qt.QLabel("Where:",box) self.whereedit = qt.QLineEdit(self.plugin.options['where'],box) wherelabel.setBuddy(self.whereedit) @@ -368,9 +368,9 @@ class CopyCenterPlugin: elif self.plugin.plugintype == "Destination": class OperationBox(qt.QVBox): - def __init__(self, mainwidget, parent): + def __init__(self, mainwidget, tqparent): self.mainwidget = mainwidget - qt.QVBox.__init__(self, parent) + qt.QVBox.__init__(self, tqparent) opbox = qt.QHBox(self) operationlabel = qt.QLabel("Operation:",opbox) self.mainwidget.operationedit = qt.QComboBox(opbox) @@ -401,7 +401,7 @@ class CopyCenterPlugin: 1: showUpdate, }[ self.mainwidget.operationedit.currentItem() ](self) if self.box != None: self.box.show() - OperationBox(self,parent) + OperationBox(self,tqparent) def tableEditChanged(self,text): if self.plugin.database != None and self.plugin.database.isOpen(): @@ -491,5 +491,5 @@ class CopyCenterPlugin: print "database is closed now!" self.updateConnectState() - plugin.widget = MainWidget(plugin,self.dialog,parent) + plugin.widget = MainWidget(plugin,self.dialog,tqparent) return plugin.widget |