|
|
|
@ -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
|
|
|
|
|