Debian Codegraph @

fltk/test/file_browser.py

raw symbols SCIP
1 #
2 # "$Id: file_browser.py 495 2013-03-30 09:39:45Z andreasheld $"
3 #
4 # File chooser test program for pyFLTK the Python bindings
5 # for the Fast Light Tool Kit (FLTK).
6 #
7 # FLTK copyright 1998-1999 by Bill Spitzak and others.
8 # pyFLTK copyright 2003 by Andreas Held and others.
9 #
10 # This library is free software you can redistribute it and/or
11 # modify it under the terms of the GNU Library General Public
12 # License, version 2.0 as published by the Free Software Foundation.
13 #
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Library General Public License for more details.
18 #
19 # You should have received a copy of the GNU Library General Public
20 # License along with this library if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 # USA.
23 #
24 # Please report all bugs and problems to "[email protected]".
25 #
26
27 from fltk import *
28
29 fb = None
30 directory = "./"
31
32
33 def SortCB(widget):
34 method = widget.value()
35 print("Sorting: ", method)
36
37 if method == "FL_NUMERICSORT":
38 fb.load(directory, FL_NUMERICSORT)
39 elif method == "FL_ALPHASORT":
40 fb.load(directory, FL_ALPHASORT)
41 elif method == "FL_CASENUMERICSORT":
42 fb.load(directory, FL_CASENUMERICSORT)
43 elif method == "FL_CASEALPHASORT":
44 fb.load(directory, FL_CASEALPHASORT)
45 else:
46 print("Wrong sorting method!")
47
48
49 if __name__=='__main__':
50 win = Fl_Window(100, 100, 300, 400, "File Browser")
51 fb = Fl_File_Browser(50,50,200,200)
52 fb.load(directory, FL_NUMERICSORT)
53 ic = Fl_Input_Choice(50, 280, 200, 25, "Sorting:")
54 ic.align(FL_ALIGN_TOP | FL_ALIGN_LEFT)
55 ic.add("FL_NUMERICSORT")
56 ic.add("FL_ALPHASORT")
57 ic.add("FL_CASENUMERICSORT")
58 ic.add("FL_CASEALPHASORT")
59 ic.value(0)
60 ic.callback(SortCB)
61
62 win.show()
63
64 Fl.run()