00001
00002
00003 import Kross, os
00004
00005
00006
00007
00008
00009
00010
00011
00012 print "1................"
00013 forms = Kross.module("forms")
00014 print "2................"
00015 print "===================================> %s" % forms
00016 print dir(forms)
00017
00018 dialog = forms.createDialog("TestGuiFormDialog")
00019 dialog.setButtons("Ok|Cancel")
00020 dialog.setFaceType("List")
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 page3 = dialog.addPage("Options","Options","configure")
00053 uifile = os.path.join( self.currentPath(), "testguiform.ui" )
00054 widget3 = forms.createWidgetFromUIFile(page3, uifile)
00055
00056 page1 = dialog.addPage("File","Import From Image File","fileopen")
00057 widget1 = forms.createFileWidget(page1, "kfiledialog:///mytestthingy1")
00058
00059 widget1.setMode("Opening")
00060 widget1.setFilter("*.cpp|C++ Source Files\n*.h|Header files")
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 print "######################################## self.currentPath=\"%s\"" % self.currentPath()
00076
00077 result = dialog.exec_loop()
00078 if result:
00079 print "===> result=%s" % dialog.result()
00080
00081 def getOption(widget, optionname, optionlist):
00082 try:
00083 childwidget = widget[ optionname ]
00084 for option in optionlist:
00085 radiobutton = childwidget[ option ]
00086 if radiobutton.checked:
00087 return option
00088 except:
00089 import sys, traceback
00090 raise "\n".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) )
00091 raise "No such option \"%s\"" % optionname
00092
00093 colorspace = getOption(optionswidget, "Colorspace", ["RGB","CMYK"])
00094 destination = getOption(optionswidget, "Destination", ["NewLayer","ActiveLayer"])
00095 size = getOption(optionswidget, "Size", ["Resize","Scale","Ignore"])
00096
00097 print "===> colorspace=%s destination=%s size=%s" % (colorspace,destination,size)
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 print dir(dialog)
00116 dialog.delayedDestruct();