[Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatters/HTML/Pages DirBrowse.py,1.10,1.11 FileDetails.py,1.5,1.6 FileIndexer.py,1.5,1.6 FileListing.py,1.4,1.5 FileSource.py,1.6,1.7

Stefan Seefeld stefan at synopsis.fresco.org
Fri Nov 14 17:39:06 UTC 2003


Update of /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Pages
In directory frida:/tmp/cvs-serv32357/Synopsis/Formatters/HTML/Pages

Modified Files:
	DirBrowse.py FileDetails.py FileIndexer.py FileListing.py 
	FileSource.py 
Log Message:
more work to eliminate the config object

Index: DirBrowse.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Pages/DirBrowse.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -d -r1.10 -r1.11
--- DirBrowse.py	14 Nov 2003 14:51:09 -0000	1.10
+++ DirBrowse.py	14 Nov 2003 17:39:04 -0000	1.11
@@ -10,7 +10,6 @@
 from Synopsis.Processor import Parametrized
 from Synopsis import AST, Util
 from Synopsis.Formatters.HTML.Page import Page
-from Synopsis.Formatters.HTML.core import config
 from Synopsis.Formatters.HTML.Tags import *
 
 import os, stat, os.path, string, time
@@ -19,6 +18,8 @@ class DirBrowse(Page):
    """A page that shows the entire contents of directories, in a form similar
    to LXR."""
 
+   exclude = Parameter([], 'TODO: define an exclusion mechanism (glob based ?)')
+
    def filename(self):
       """since FileTree generates a whole file hierarchy, this method returns the current filename,
       which may change over the lifetime of this object"""
@@ -46,12 +47,9 @@ class DirBrowse(Page):
 
       self.__filename = self.processor.file_layout.nameOfSpecial('dir')
       self.__title = 'Directory Listing'
-      self.__base = config.base_dir
-      self.__start = config.start_dir
-      self.__exclude_globs = config.exclude_globs
+      self.__start = self.__base = processor.output
       #if not self.__base: return
-      config.set_main_page(self.__filename)
-      self.__filename = self.processor.file_layout.nameOfSpecial('dir')
+      processor.set_main_page(self.__filename)
       self.processor.addRootPage(self.__filename, 'Files', 'main', 2)
 
    def register_filenames(self, start):
@@ -61,12 +59,12 @@ class DirBrowse(Page):
          dir = dirs.pop(0)
          for entry in os.listdir(os.path.abspath(dir)):
             # Check if entry is in exclude list
-            exclude = 0
-            for re in self.__exclude_globs:
-               if re.match(entry):
-                  exclude = 1
-            if exclude:
-               continue
+            #exclude = 0
+            #for re in self.__exclude_globs:
+            #   if re.match(entry):
+            #      exclude = 1
+            #if exclude:
+            #   continue
             entry_path = os.path.join(dir, entry)
             info = os.stat(entry_path)
             if not stat.S_ISDIR(info[stat.ST_MODE]):
@@ -122,12 +120,12 @@ class DirBrowse(Page):
       dirs = []
       for entry in entries:
          # Check if entry is in exclude list
-         exclude = 0
-         for re in self.__exclude_globs:
-            if re.match(entry):
-               exclude = 1
-         if exclude:
-            continue
+         #exclude = 0
+         #for re in self.__exclude_globs:
+         #   if re.match(entry):
+         #      exclude = 1
+         #if exclude:
+         #   continue
          entry_path = os.path.join(path, entry)
          info = os.stat(entry_path)
          if stat.S_ISDIR(info[stat.ST_MODE]):

Index: FileDetails.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Pages/FileDetails.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -d -r1.5 -r1.6
--- FileDetails.py	14 Nov 2003 14:51:09 -0000	1.5
+++ FileDetails.py	14 Nov 2003 17:39:04 -0000	1.6
@@ -10,8 +10,8 @@
 from Synopsis.Processor import Parameter
 from Synopsis import AST, Util
 from Synopsis.Formatters.HTML.Page import Page
-from Synopsis.Formatters.HTML.core import config
 from Synopsis.Formatters.HTML.Tags import *
+from Synopsis.Formatters.HTML.Pages.FileSource import *
 
 import os
 
@@ -26,7 +26,8 @@ class FileDetails(Page):
       Page.register(self, processor)
       self.__filename = ''
       self.__title = ''
-      self.__link_source = ('FileSource' in config.pages)
+      self.__link_source = processor.has_page(FileSource)
+      print 'link source', self.__link_source
 
    def filename(self):
       """since FileTree generates a whole file hierarchy, this method returns the current filename,

Index: FileIndexer.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Pages/FileIndexer.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -d -r1.5 -r1.6
--- FileIndexer.py	14 Nov 2003 14:51:09 -0000	1.5
+++ FileIndexer.py	14 Nov 2003 17:39:04 -0000	1.6
@@ -10,7 +10,6 @@
 from Synopsis.Processor import Parameter
 from Synopsis import AST, Util
 from Synopsis.Formatters.HTML.Page import Page
-from Synopsis.Formatters.HTML.core import config
 from Synopsis.Formatters.HTML.Tags import *
 
 import os
@@ -26,8 +25,8 @@ class FileIndexer(Page):
       Page.register(self, processor)
       self.__filename = ''
       self.__title = ''
-      self.__link_source = ('FileSource' in config.pages)
-      self.__link_details = ('FileDetails' in config.pages)
+      self.__link_source = processor.has_page('FileSource')
+      self.__link_details = processor.has_page('FileDetails')
 
    def filename(self):
       """since FileTree generates a whole file hierarchy, this method returns the current filename,
@@ -77,7 +76,7 @@ class FileIndexer(Page):
          link = rel(self.filename(),
                     self.processor.file_layout.nameOfFileDetails(filename))
          self.write(href(link, '[File Details]', target="main")+'<br>')
-      comments = config.comments
+      comments = self.processor.comments
 
       self.write('<b>Declarations:</b><br>')
       # Sort items (by name)

Index: FileListing.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Pages/FileListing.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -d -r1.4 -r1.5
--- FileListing.py	14 Nov 2003 14:51:09 -0000	1.4
+++ FileListing.py	14 Nov 2003 17:39:04 -0000	1.5
@@ -11,7 +11,6 @@ from Synopsis.Processor import Parameter
 from Synopsis import AST, Util
 from Synopsis.FileTree import FileTree
 from Synopsis.Formatters.HTML.Page import Page
-from Synopsis.Formatters.HTML.core import config
 from Synopsis.Formatters.HTML.Tags import *
 
 import os
@@ -28,11 +27,11 @@ class FileListing(Page):
       self.__filename = self.processor.file_layout.nameOfSpecial('FileListing')
       self.__title = 'Files'
 
-      config.set_main_page(self.filename())
+      processor.set_main_page(self.filename())
       # Reset filename in case we got main page status
       self.__filename = self.processor.file_layout.nameOfSpecial('FileListing')
       self.processor.addRootPage(self.filename(), self.title(), "contents", 2)
-      config.set_contents_page(self.filename())
+      processor.set_contents_page(self.filename())
 
    def filename(self):
       """Returns the filename"""
@@ -60,7 +59,7 @@ class FileListing(Page):
       self.write(self.processor.formatHeader(self.filename(), 2))
       self.tree.start_tree()
       # recursively visit all nodes
-      self.processFileTreeNode(config.fileTree.root())
+      self.processFileTreeNode(processor.fileTree.root())
       self.tree.end_tree()
       self.end_file()
 

Index: FileSource.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Pages/FileSource.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -d -r1.6 -r1.7
--- FileSource.py	14 Nov 2003 14:51:09 -0000	1.6
+++ FileSource.py	14 Nov 2003 17:39:04 -0000	1.7
@@ -10,7 +10,6 @@
 from Synopsis.Processor import Parameter
 from Synopsis import AST, Util
 from Synopsis.Formatters.HTML.Page import Page
-from Synopsis.Formatters.HTML.core import config
 from Synopsis.Formatters.HTML.Tags import *
 
 import time, os
@@ -24,23 +23,14 @@ except ImportError:
 class FileSource(Page):
    """A module for creating a page for each file with hyperlinked source"""
 
+   links_path = Parameter('./%s-links', '')
+   scope = Parameter('', '')
    toc_in = Parameter([], 'list of table of content files to use for symbol lookup')
 
    def register(self, processor):
 
       Page.register(self, processor)
-      # Try old name first for backwards compatibility
-      if hasattr(config.obj, 'FilePages'): myconfig = config.obj.FilePages
-      else: myconfig = config.obj.FileSource
-      self.__linkpath = myconfig.links_path
-      self.__toclist = self.toc_in
-      self.__scope = myconfig.scope
-      # We will NOT be in the Manual directory  TODO - use FileLayout for this
-      self.__toclist = map(lambda x: ''+x, self.__toclist)
-      if hasattr(myconfig, 'use_toc'):
-         self.__tocfrom = myconfig.use_toc
-      else:
-         self.__tocfrom = config.default_toc
+      self.__toclist = map(lambda x: ''+x, self.toc_in)
 
    def filename(self):
       """since FileSource generates a whole file hierarchy, this method returns the current filename,
@@ -76,7 +66,7 @@ class FileSource(Page):
       for file in self.processor.ast.files().values():
          if file.is_main():
             filename = file.filename()
-            filename = os.path.join(config.base_dir, filename)
+            filename = os.path.join(self.processor.output, filename)
             filename = self.processor.file_layout.nameOfFileSource(filename)
             #print "Registering",filename
             self.processor.register_filename(filename, self, file)
@@ -86,7 +76,7 @@ class FileSource(Page):
 
       # Start page
       filename = file.filename()
-      filename = os.path.join(config.base_dir, filename)
+      filename = os.path.join(self.processor.output, filename)
       self.__filename = self.processor.file_layout.nameOfFileSource(filename)
       #name = list(node.path)
       #while len(name) and name[0] == '..': del name[0]
@@ -96,7 +86,6 @@ class FileSource(Page):
 
       # Massage toc list to prefix '../../.....' to any relative entry.
       prefix = rel(self.filename(), '')
-      toc_to_change = config.toc_out
       toclist = list(self.__toclist)
       for index in range(len(toclist)):
          if '|' not in toclist[index]:
@@ -118,10 +107,10 @@ class FileSource(Page):
          # Call link module
          f_out = os.path.join(self.processor.output, self.__filename) + '-temp'
          f_in = file.full_filename()
-         f_link = self.__linkpath%source
+         f_link = self.linkpath%source
          #print "file: %s    link: %s    out: %s"%(f_in, f_link, f_out)
          try:
-            link.link(toclist, f_in, f_out, f_link, self.__scope) #, config.types)
+            link.link(toclist, f_in, f_out, f_link, self.scope) #, config.types)
          except link.error, msg:
             print "An error occurred:",msg
          try:





More information about the Synopsis-changes mailing list