diff options
Diffstat (limited to 'lib/kross/python/scripts/gui.py')
-rwxr-xr-x | lib/kross/python/scripts/gui.py | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/lib/kross/python/scripts/gui.py b/lib/kross/python/scripts/gui.py index 997e9849..9dc8a799 100755 --- a/lib/kross/python/scripts/gui.py +++ b/lib/kross/python/scripts/gui.py @@ -43,43 +43,43 @@ class TkDialog: self.widget = mainframe.widget class Widget: - def __init__(self, dialog, tqparent): + def __init__(self, dialog, parent): self.dialog = dialog - self.tqparent = tqparent + self.parent = parent #def setVisible(self, visibled): pass #def setEnabled(self, enabled): pass class Frame(Widget): - def __init__(self, dialog, tqparent): - #TkDialog.Widget.__init__(self, dialog, tqparent) + def __init__(self, dialog, parent): + #TkDialog.Widget.__init__(self, dialog, parent) import Tkinter - self.widget = Tkinter.Frame(tqparent) + self.widget = Tkinter.Frame(parent) self.widget.pack() class Label(Widget): - def __init__(self, dialog, tqparent, caption): - #TkDialog.Widget.__init__(self, dialog, tqparent) + def __init__(self, dialog, parent, caption): + #TkDialog.Widget.__init__(self, dialog, parent) import Tkinter - self.widget = Tkinter.Label(tqparent, text=caption) + self.widget = Tkinter.Label(parent, text=caption) self.widget.pack(side=Tkinter.TOP) class CheckBox(Widget): - def __init__(self, dialog, tqparent, caption, checked = True): - #TkDialog.Widget.__init__(self, dialog, tqparent) + def __init__(self, dialog, parent, caption, checked = True): + #TkDialog.Widget.__init__(self, dialog, parent) import Tkinter self.checkstate = Tkinter.IntVar() self.checkstate.set(checked) - self.widget = Tkinter.Checkbutton(tqparent, text=caption, variable=self.checkstate) + self.widget = Tkinter.Checkbutton(parent, text=caption, variable=self.checkstate) self.widget.pack(side=Tkinter.TOP) def isChecked(self): return self.checkstate.get() class List(Widget): - def __init__(self, dialog, tqparent, caption, items): - #TkDialog.Widget.__init__(self, dialog, tqparent) + def __init__(self, dialog, parent, caption, items): + #TkDialog.Widget.__init__(self, dialog, parent) import Tkinter - listframe = Tkinter.Frame(tqparent) + listframe = Tkinter.Frame(parent) listframe.pack() Tkinter.Label(listframe, text=caption).pack(side=Tkinter.LEFT) @@ -94,10 +94,10 @@ class TkDialog: self.variable.set( self.items[index] ) class Button(Widget): - def __init__(self, dialog, tqparent, caption, commandmethod): - #TkDialog.Widget.__init__(self, dialog, tqparent) + def __init__(self, dialog, parent, caption, commandmethod): + #TkDialog.Widget.__init__(self, dialog, parent) import Tkinter - self.widget = Tkinter.Button(tqparent, text=caption, command=self.doCommand) + self.widget = Tkinter.Button(parent, text=caption, command=self.doCommand) self.commandmethod = commandmethod self.widget.pack(side=Tkinter.LEFT) def doCommand(self): @@ -114,10 +114,10 @@ class TkDialog: #self.dialog.root.destroy() class Edit(Widget): - def __init__(self, dialog, tqparent, caption, text): - #TkDialog.Widget.__init__(self, dialog, tqparent) + def __init__(self, dialog, parent, caption, text): + #TkDialog.Widget.__init__(self, dialog, parent) import Tkinter - self.widget = Tkinter.Frame(tqparent) + self.widget = Tkinter.Frame(parent) self.widget.pack() label = Tkinter.Label(self.widget, text=caption) label.pack(side=Tkinter.LEFT) @@ -129,8 +129,8 @@ class TkDialog: return self.entrytext.get() class FileChooser(Edit): - def __init__(self, dialog, tqparent, caption, initialfile = None, filetypes = None): - TkDialog.Edit.__init__(self, dialog, tqparent, caption, initialfile) + def __init__(self, dialog, parent, caption, initialfile = None, filetypes = None): + TkDialog.Edit.__init__(self, dialog, parent, caption, initialfile) import Tkinter self.initialfile = initialfile @@ -187,27 +187,27 @@ class QtDialog: import qt class Dialog(qt.QDialog): - def __init__(self, tqparent = None, name = None, modal = 0, fl = 0): - qt.QDialog.__init__(self, tqparent, name, modal, fl) + def __init__(self, parent = None, name = None, modal = 0, fl = 0): + qt.QDialog.__init__(self, parent, name, modal, fl) qt.QDialog.accept = self.accept self.tqlayout = qt.QVBoxLayout(self) self.tqlayout.setSpacing(6) self.tqlayout.setMargin(11) class Label(qt.QLabel): - def __init__(self, dialog, tqparent, caption): - qt.QLabel.__init__(self, tqparent) + def __init__(self, dialog, parent, caption): + qt.QLabel.__init__(self, parent) self.setText("<qt>%s</qt>" % caption.replace("\n","<br>")) class Frame(qt.QHBox): - def __init__(self, dialog, tqparent): - qt.QHBox.__init__(self, tqparent) + def __init__(self, dialog, parent): + qt.QHBox.__init__(self, parent) self.widget = self self.setSpacing(6) class Edit(qt.QHBox): - def __init__(self, dialog, tqparent, caption, text): - qt.QHBox.__init__(self, tqparent) + def __init__(self, dialog, parent, caption, text): + qt.QHBox.__init__(self, parent) self.setSpacing(6) label = qt.QLabel(caption, self) self.edit = qt.QLineEdit(self) @@ -219,26 +219,26 @@ class QtDialog: class Button(qt.QPushButton): #def __init__(self, *args): - def __init__(self, dialog, tqparent, caption, commandmethod): + def __init__(self, dialog, parent, caption, commandmethod): #apply(qt.QPushButton.__init__, (self,) + args) - qt.QPushButton.__init__(self, tqparent) + qt.QPushButton.__init__(self, parent) self.commandmethod = commandmethod self.setText(caption) qt.QObject.connect(self, qt.SIGNAL("clicked()"), self.commandmethod) class CheckBox(qt.QCheckBox): - def __init__(self, dialog, tqparent, caption, checked = True): - #TkDialog.Widget.__init__(self, dialog, tqparent) - qt.QCheckBox.__init__(self, tqparent) + def __init__(self, dialog, parent, caption, checked = True): + #TkDialog.Widget.__init__(self, dialog, parent) + qt.QCheckBox.__init__(self, parent) self.setText(caption) self.setChecked(checked) #def isChecked(self): # return self.isChecked() class List(qt.QHBox): - def __init__(self, dialog, tqparent, caption, items): - qt.QHBox.__init__(self, tqparent) + def __init__(self, dialog, parent, caption, items): + qt.QHBox.__init__(self, parent) self.setSpacing(6) label = qt.QLabel(caption, self) self.combo = qt.QComboBox(self) @@ -252,9 +252,9 @@ class QtDialog: self.combo.setCurrentItem(index) class FileChooser(qt.QHBox): - def __init__(self, dialog, tqparent, caption, initialfile = None, filetypes = None): + def __init__(self, dialog, parent, caption, initialfile = None, filetypes = None): #apply(qt.QHBox.__init__, (self,) + args) - qt.QHBox.__init__(self, tqparent) + qt.QHBox.__init__(self, parent) self.setMinimumWidth(400) self.initialfile = initialfile @@ -274,29 +274,29 @@ class QtDialog: return self.edit.text() def browseButtonClicked(self): - filtertqmask = "" + filtermask = "" import types if isinstance(self.filetypes, types.TupleType): for ft in self.filetypes: if len(ft) == 1: - filtertqmask += "%s\n" % (ft[0]) + filtermask += "%s\n" % (ft[0]) if len(ft) == 2: - filtertqmask += "%s|%s (%s)\n" % (ft[1],ft[0],ft[1]) - if filtertqmask == "": - filtertqmask = "All files (*.*)" + filtermask += "%s|%s (%s)\n" % (ft[1],ft[0],ft[1]) + if filtermask == "": + filtermask = "All files (*.*)" else: - filtertqmask = filtertqmask[:-1] + filtermask = filtermask[:-1] filename = None try: print "QtDialog.FileChooser.browseButtonClicked() kfile.KFileDialog" # try to use the kfile module included in pykde import kfile - filename = kfile.KFileDialog.getOpenFileName(self.initialfile, filtertqmask, self, "Save to file") + filename = kfile.KFileDialog.getOpenFileName(self.initialfile, filtermask, self, "Save to file") except: print "QtDialog.FileChooser.browseButtonClicked() qt.QFileDialog" # fallback to Qt filedialog - filename = qt.QFileDialog.getOpenFileName(self.initialfile, filtertqmask, self, "Save to file") + filename = qt.QFileDialog.getOpenFileName(self.initialfile, filtermask, self, "Save to file") if filename != None and filename != "": self.edit.setText(filename) |