File: DialogFilters.py

package info (click to toggle)
scribes 0.4~r543-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 6,836 kB
  • ctags: 6,779
  • sloc: python: 32,963; perl: 2,747; xml: 2,233; sh: 847; makefile: 597
file content (28 lines) | stat: -rw-r--r-- 1,060 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from gettext import gettext as _

def create_filter(name="", mime="", pattern=""):
	from gtk import FileFilter
	filefilter = FileFilter()
	filefilter.set_name(name)
	filefilter.add_mime_type(mime)
	if pattern: filefilter.add_pattern(pattern)
	return filefilter

def create_filter_list():
	filter_list = [
		create_filter(_("Text Documents"), "text/plain"),
		create_filter(_("Python Documents"), "text/x-python"),
		create_filter(_("Ruby Documents"), "text/x-ruby"),
		create_filter(_("Perl Documents"), "text/x-perl"),
		create_filter(_("C Documents"), "text/csrc"),
		create_filter(_("C++ Documents"), "text/c++src"),
		create_filter(_("C# Documents"), "text/csharp"),
		create_filter(_("Java Documents"), "text/x-java"),
		create_filter(_("PHP Documents"), "text/x-php"),
		create_filter(_("HTML Documents"), "text/html"),
		create_filter(_("XML Documents"), "text/xml"),
		create_filter(_("Haskell Documents"), "text/x-haskell"),
		create_filter(_("Scheme Documents"), "text/x-scheme"),
		create_filter(_("All Documents"), "", "*"),
	]
	return filter_list