diff options
author | mathieui <mathieui@mathieui.net> | 2011-09-10 16:41:47 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-09-10 16:41:47 +0200 |
commit | 78c216cd61ab96f7476ce194323517b73b8ee04c (patch) | |
tree | d97563999abf93fe036015d5192b5413319a904e /src | |
parent | 62233527c5536b30f30221750975b93a055d1d28 (diff) | |
download | poezio-78c216cd61ab96f7476ce194323517b73b8ee04c.tar.gz poezio-78c216cd61ab96f7476ce194323517b73b8ee04c.tar.bz2 poezio-78c216cd61ab96f7476ce194323517b73b8ee04c.tar.xz poezio-78c216cd61ab96f7476ce194323517b73b8ee04c.zip |
Added a help message for the first run
Diffstat (limited to 'src')
-rw-r--r-- | src/config.py | 15 | ||||
-rw-r--r-- | src/core.py | 8 |
2 files changed, 23 insertions, 0 deletions
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) diff --git a/src/core.py b/src/core.py index 4691c54f..a8fa65a5 100644 --- a/src/core.py +++ b/src/core.py @@ -189,6 +189,14 @@ class Core(object): default_tab.on_gain_focus() self.tabs.append(default_tab) self.information(_('Welcome to poezio!')) + if config.get('firstrun', ''): + self.information(_( + 'It seems that it is the first time you start poezio.\n' + \ + 'The configuration help is here: http://dev.louiz.org/project/poezio/doc/HowToConfigure\n' + \ + 'And the documentation for users is here: http://dev.louiz.org/project/poezio/doc/HowToUse\n' + \ + 'By default, you are in poezio’s chatroom, where you can ask for help or tell us how great it is.\n' + \ + 'Just press Ctrl-n.' \ + )) self.refresh_window() def resize_global_information_win(self): |