Gnumed.timelinelib.config.arguments

Package Gnumed :: Package timelinelib :: Package config :: Module arguments |
[frames] | no frames]

# Source Code for Module Gnumed.timelinelib.config.arguments

     1  # Copyright (C) 2009, 2010, 2011  Rickard Lindberg, Roger Lindberg
     2  #
     3  # This file is part of Timeline.
     4  #
     5  # Timeline is free software: you can redistribute it and/or modify
     6  # it under the terms of the GNU General Public License as published by
     7  # the Free Software Foundation, either version 3 of the License, or
     8  # (at your option) any later version.
     9  #
    10  # Timeline is distributed in the hope that it will be useful,
    11  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  # GNU General Public License for more details.
    14  #
    15  # You should have received a copy of the GNU General Public License
    16  # along with Timeline.  If not, see <http://www.gnu.org/licenses/>.
    17
    18
    19  from optparse import OptionParser
    20  import os.path
    21
    22  from timelinelib.meta.version import get_version
    23
    24  import wx
    25
    26
    27 -class ApplicationArguments(object):
    28
    29 -    def __init__(self):
    30          version_string = "%prog " + get_version()
    31          self.option_parser = OptionParser(
    32              usage="%prog [options] [filename]",
    33              version=version_string)
    34          self.option_parser.add_option(
    35              "-c", "--config-file", dest="config_file_path", default=None,
    36              help="Path to config file")
    37
    38 -    def parse_from(self, arguments):
    39          (self.options, self.arguments) = self.option_parser.parse_args(arguments)
    40
    41 -    def get_files(self):
    42          return self.arguments
    43
    44 -    def get_config_file_path(self):
    45          if self.options.config_file_path:
    46              return self.options.config_file_path
    47          else:
    48              return os.path.join(
    49                  wx.StandardPaths.Get().GetUserConfigDir(),
    50                  ".thetimelineproj.cfg")
    51