From 78c216cd61ab96f7476ce194323517b73b8ee04c Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 10 Sep 2011 16:41:47 +0200 Subject: Added a help message for the first run --- src/config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/config.py') diff --git a/src/config.py b/src/config.py index 801d0b38..9661158e 100644 --- a/src/config.py +++ b/src/config.py @@ -124,6 +124,18 @@ class Config(RawConfigParser): return self.write_in_file(section, option, value) + def set(self, option, value, section=DEFSECTION): + """ + Set the value of an option temporarily + """ + try: + RawConfigParser.set(self, section, option, value) + except NoSectionError: + pass + + +firstrun = False + # creates the configuration directory if it doesn't exist # and copy the default config in it CONFIG_HOME = environ.get("XDG_CONFIG_HOME") @@ -137,6 +149,7 @@ except OSError: if not path.isfile(path.join(CONFIG_PATH, 'poezio.cfg')): copy2(path.join(path.dirname(__file__), '../data/default_config.cfg'), path.join(CONFIG_PATH, 'poezio.cfg')) + firstrun = True parser = OptionParser() parser.add_option("-f", "--file", dest="filename", default=path.join(CONFIG_PATH, 'poezio.cfg'), @@ -145,3 +158,5 @@ parser.add_option("-d", "--debug", dest="debug", help="The file where debug will be written", metavar="DEBUG_FILE") (options, args) = parser.parse_args() config = Config(options.filename) +if firstrun: + config.set('firstrun', True) -- cgit v1.2.3