diff options
Diffstat (limited to 'lib/kross/test/testgui.py')
-rw-r--r-- | lib/kross/test/testgui.py | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/lib/kross/test/testgui.py b/lib/kross/test/testgui.py index b6f6a28e..b5efb8dc 100644 --- a/lib/kross/test/testgui.py +++ b/lib/kross/test/testgui.py @@ -18,7 +18,7 @@ class TkTest: self.button1 = Tkinter.Button(self.mainframe, text="Button1", command=self.callback1) self.button1.pack(side=Tkinter.LEFT) - + self.button2 = Tkinter.Button(self.mainframe, text="Button2", command=self.callback2) self.button2.pack(side=Tkinter.LEFT) @@ -35,39 +35,39 @@ class TkTest: import tkMessageBox tkMessageBox.showinfo("Callback2", "Callback2 called.") -class QtTest: +class TQtTest: def __init__(self): - import qt + from TQt import qt - class Button(qt.QPushButton): + class Button(qt.TQPushButton): def __init__(self, *args): - apply(qt.QPushButton.__init__, (self,) + args) + apply(qt.TQPushButton.__init__, (self,) + args) - class ComboBox(qt.QHBox): + class ComboBox(qt.TQHBox): def __init__(self, parent, caption, items = []): - qt.QHBox.__init__(self, parent) + qt.TQHBox.__init__(self, parent) self.setSpacing(6) - label = qt.QLabel(str(caption), self) - self.combobox = qt.QComboBox(self) + label = qt.TQLabel(str(caption), self) + self.combobox = qt.TQComboBox(self) self.setStretchFactor(self.combobox, 1) label.setBuddy(self.combobox) for item in items: self.combobox.insertItem( str(item) ) - class FileChooser(qt.QHBox): + class FileChooser(qt.TQHBox): def __init__(self, *args): - apply(qt.QHBox.__init__, (self,) + args) + apply(qt.TQHBox.__init__, (self,) + args) self.defaultfilename = "~/output.html" - - self.setSpacing(6) - label = qt.QLabel("File:", self) - self.edit = qt.QLineEdit(self) + + self.setSpacing(6) + label = qt.TQLabel("File:", self) + self.edit = qt.TQLineEdit(self) self.edit.setText(self.defaultfilename) self.setStretchFactor(self.edit, 1) label.setBuddy(self.edit) - + browsebutton = Button("...", self) - qt.QObject.connect(browsebutton, qt.SIGNAL("clicked()"), self.browseButtonClicked) + qt.TQObject.connect(browsebutton, qt.SIGNAL("clicked()"), self.browseButtonClicked) def file(self): return self.edit.text() @@ -79,23 +79,23 @@ class QtTest: import tdefile filename = tdefile.KFileDialog.getOpenFileName(self.defaultfilename, "*.html", self, "Save to file") except: - # fallback to Qt filedialog - filename = qt.QFileDialog.getOpenFileName(self.defaultfilename, "*.html", self, "Save to file") + # fallback to TQt filedialog + filename = qt.TQFileDialog.getOpenFileName(self.defaultfilename, "*.html", self, "Save to file") if filename != None and filename != "": self.edit.setText(filename) - class Dialog(qt.QDialog): + class Dialog(qt.TQDialog): def __init__(self, parent = None, name = None, modal = 0, fl = 0): - qt.QDialog.__init__(self, parent, name, modal, fl) - qt.QDialog.accept = self.accept + qt.TQDialog.__init__(self, parent, name, modal, fl) + qt.TQDialog.accept = self.accept self.setCaption("Export to HTML") #self.layout() - - self.layout = qt.QVBoxLayout(self) + + self.layout = qt.TQVBoxLayout(self) self.layout.setSpacing(6) self.layout.setMargin(11) - infolabel = qt.QLabel("Export the data of a table or a query to a HTML-file.", self) + infolabel = qt.TQLabel("Export the data of a table or a query to a HTML-file.", self) self.layout.addWidget(infolabel) source = ComboBox(self, "Datasource:") @@ -107,21 +107,21 @@ class QtTest: self.filechooser = FileChooser(self) self.layout.addWidget(self.filechooser) - buttonbox = qt.QHBox(self) + buttonbox = qt.TQHBox(self) buttonbox.setSpacing(6) self.layout.addWidget(buttonbox) savebutton = Button("Save", buttonbox) - qt.QObject.connect(savebutton, qt.SIGNAL("clicked()"), self, qt.SLOT("accept()")) - #qt.QObject.connect(savebutton, qt.SIGNAL("clicked()"), self.exportButtonClicked) + qt.TQObject.connect(savebutton, qt.SIGNAL("clicked()"), self, qt.SLOT("accept()")) + #qt.TQObject.connect(savebutton, qt.SIGNAL("clicked()"), self.exportButtonClicked) cancelbutton = Button("Cancel", buttonbox) - qt.QObject.connect(cancelbutton, qt.SIGNAL("clicked()"), self, qt.SLOT("close()")) - + qt.TQObject.connect(cancelbutton, qt.SIGNAL("clicked()"), self, qt.SLOT("close()")) + def accept(self): print "ACCEPTTTTTTTT !!!!!!!!!!!!!!!!!!!!!!!!!!!!" - - file = qt.QFile( self.filechooser.file() ) + + file = qt.TQFile( self.filechooser.file() ) #if not file.exists(): # print "File '%s' does not exist." % self.filechooser.file() #else: @@ -136,14 +136,14 @@ class QtTest: def event(self, e): print "=> Dialog.event %s" % e #self.deleteLater() - #support.swapThreadState() # calls appropriate c-function - return qt.QDialog.event(self, e) + #support.swapThreadState() # calls appropriate c-function + return qt.TQDialog.event(self, e) - app = qt.tqApp + app = qt.tqApp dialog = Dialog(app.mainWidget(), "Dialog", 1) dialog.show() print "################## BEGIN" #TkTest() -QtTest() +TQtTest() print "################## END" |