Esempio n. 1
0
File: map.py Progetto: jfarrimo/sabx
    def process_options(self):
        """
        Save the dirs and setup for the input and output files.
        """
        def _save_options(self):
            self.template_data['marker_dir'] = self.options.marker_dir
            self.template_data['image_dir'] = self.options.image_dir
            self.template_data['css_dir'] = self.options.css_dir
            self.template_data['js_dir'] = self.options.js_dir
            self.template_data['base_dir'] = self.options.base_dir
            self.template_data['analytics'] = self.options.analytics

        def _setup_input_file(self):
            if self.options.in_file:
                self.in_file = open(self.options.in_file, "r")
            else:
                self.in_file = sys.stdin

        def _setup_output_file(self):
            if self.options.out_file:
                self.filebase = \
                    os.path.splitext(os.path.basename(self.options.out_file))[0]
                self.filebase = self.filebase.replace("-print", "")
            else:
                self.filebase = "stdout"

        TemplateProcessor.process_options(self)
        _save_options(self)
        _setup_input_file(self)
        _setup_output_file(self)
Esempio n. 2
0
File: osm.py Progetto: jfarrimo/sabx
 def process_options(self):
     """
     Setup for the input file.
     """
     TemplateProcessor.process_options(self)
     if self.options.in_file:
         self.in_file = open(self.options.in_file, "r")
     else:
         self.in_file = sys.stdin
Esempio n. 3
0
 def process_template(self):
     """
     Generate a template file for each ride in the rideset.
     """
     out_base = self.options.out_file
     for index in range(len(self.template_data['ride_list'])):
         self.template_data['route_index'] = index
         self.options.out_file = "%s_%s.xml" % (out_base, index)
         TemplateProcessor.process_template(self)
Esempio n. 4
0
File: osm.py Progetto: jfarrimo/sabx
    def __init__(self, template_file=None, man=None):
        """
        Add command-line option for input file.

        @param template_file: name of template file to process
        @type template_file: C{string}
        @param man: man page text
        @type man: C{string}
        """
        TemplateProcessor.__init__(self, template_file, man)

        self.parser.add_option("-i", "--infile", dest="in_file",
                               help="input sabx data from FILE", 
                               metavar="FILE")
Esempio n. 5
0
    def __init__(self, template_file=None, man=None):
        """
        Add C{optparse} options for the infile and the index.  Seed
        template_data with uuid.

        @param template_file: (optional) file name of template file
        @type template_file: C{string}
        @param man: (optional) extended program help
        @type man: C{string}
        """
        TemplateProcessor.__init__(self, template_file, man)

        self.parser.add_option("-i", "--infile", dest="in_file",
                               help="input tcx data from FILE", 
                               metavar="FILE")
        self.parser.add_option("-n", "--index", dest="start_index",
                               type="int", default=1, 
                               help="starting point index")

        self.template_data['uuid'] = uuid.uuid4()
Esempio n. 6
0
File: map.py Progetto: jfarrimo/sabx
    def __init__(self, template_file=None, man=None):
        """
        Add command-line options to set the input file and various directories
        the templates need to know about.

        @param template_file: name of template file to process
        @type template_file: C{string}
        @param man: man page text
        @type man: C{string}
        """
        TemplateProcessor.__init__(self, template_file, man)

        # input file
        self.parser.add_option("-i", "--infile", dest="in_file",
                               help="input sabx data from FILE", 
                               metavar="FILE")

        # directories
        self.parser.add_option("-r", "--marker-dir", dest="marker_dir",
                               help="relative web directory for marker files", 
                               metavar="MARKERDIR", default=".")
        self.parser.add_option("-g", "--image-dir", dest="image_dir",
                               help="relative web directory for image files", 
                               metavar="IMAGEDIR", default=".")
        self.parser.add_option("-c", "--css-dir", dest="css_dir",
                               help="relative web directory for css files", 
                               metavar="CSSDIR", default=".")
        self.parser.add_option("-j", "--js-dir", dest="js_dir",
                               help="relative web directory for javascript files", 
                               metavar="JSDIR", default=".")
        self.parser.add_option("-b", "--base-dir", dest="base_dir",
                               help="relative base web directory", 
                               metavar="BASEDIR", default=".")
        self.parser.add_option("-a", "--analytics-key", dest="analytics",
                               help="Google analytics key", 
                               metavar="ANALYTICS", default="")