Anonymous avatar Anonymous committed 673b870

add user configuration, refactor index code

Comments (0)

Files changed (1)

         text-align:center;
 }
 
+nav.main a
+{
+        font-size:1.05em;
+}
+
 h1
 {
         margin-top:0px;
         return value
 
 def get_dir() :
+
         response = ""
 
         # Check for new pygtk: this is new class in PyGtk 2.4
         return response
 
 def prepare(root) :
+
         # create sub directory if it doesnt exist
         outDirectory = os.path.join(
                         root,
         return VAR_TYPES[t]
 
 def proc_type(t) :
+
         if (t not in {PLUGIN:"PROC_PLUG_IN",EXTENSION:"PROC_EXTENSION",TEMPORARY:"PROC_TEMPORARY"}) :
                 return "unknown"
 
         return PROC_TYPES[t]
 
 def table(lst) :
+
         row = dict()
         html = ""
         alt = False
         return Template(TABLE_HTML).safe_substitute({"body":html})
 
 def file_name(name) :
+
         return "%s.html"%(slugify(name))
 
 def plain_table(heading, lst, max_row_length=5):
+
         buf = ""
         buf += Template('\t\t<a id="${heading}"><h4>${heading}</h4></a>\n').safe_substitute({"heading":heading})
         buf += '\t\t<table>\n\t\t\t<tr>\n'
 
         return ns_list
 
-def headings(procs, delimiter="-", minSize=10):
+def make_header_filter(procs):
+
+        def filter_headings(ns):
+
+                lst = filter(lambda name: name.startswith(ns),procs)
+
+                if( 0 == len(lst)):
+                        return None
+
+                for tmp in lst:
+                        procs.remove(tmp)
+
+                return True
+
+        return filter_headings
+
+def headings(procs, delimiter="-", minSize=5):
 
         root = ("root", list())
 
         for node in root[1]:
                 heading_list.extend(namespaces(node, delimiter, minSize))
 
-        return map(lambda s: s + delimiter,heading_list)
+        return filter(make_header_filter(list(procs)),heading_list)
 
-def index(procs) :
-
-        lst = headings(procs)
-
-        buf = '\t\t<hr>\n\t\t<nav class="main">'
-        for heading in lst :
-                buf += Template('<a href="#${heading}-" style="font-size:1.05em;">${heading}</a>').safe_substitute({"heading":heading[:-1]})
-
-                if(heading != lst[-1]):
-                        buf += " &bull; "
-
-        buf += "</nav>\n\t\t<hr>\n"
-
-        for heading in lst :
-                buf += plain_table(heading, filter(lambda name: name.startswith(heading),procs))
-                procs = filter(lambda name: not name.startswith(heading),procs)
-
-        return buf
-
-def dump_pdb() :
+def dump_pdb(minSize, singleFile) :
 
         root = get_dir()
         if("" == root) :
         procs = gimp.pdb.query()
         procs.sort()
 
+        # begin index output
+        heading_list = headings(procs, '-', minSize)
+
+        buf = '\t\t<hr>\n\t\t<nav class="main">'
+        for heading in heading_list :
+                buf += Template('<a href="#${heading}">${heading}</a>').safe_substitute({"heading":heading})
+
+                if(heading != heading_list[-1]):
+                        buf += " &bull; "
+
+        buf += "</nav>\n\t\t<hr>\n"
+
+        for heading in heading_list :
+                buf += plain_table(heading, filter(lambda name: name.startswith(heading),procs))
+                procs = filter(lambda name: not name.startswith(heading),procs)
+        # no u
+
         with open(os.path.join(root,"index.html"), "w+") as f :
-                f.write(Template(INDEX_TEMPLATE).safe_substitute({"date":datetime.now().strftime("%A, %d. %B %Y %I:%M%p"),"body":index(procs)}))
+                f.write(Template(INDEX_TEMPLATE).safe_substitute({"date":datetime.now().strftime("%A, %d. %B %Y %I:%M%p"),"body":buf}))
 
         return None
 
         #image types
         None,
         #params
-        [],
+        [
+                (PF_INT, "scale", "scale", 5),
+                (PF_BOOL, "single-file", "single-file", False)
+        ],
         #results
         [],
         #function
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.