Changeset 297
- Timestamp:
- 06/10/06 17:34:49 (2 years ago)
- Files:
-
- trunk/po/es.po (modified) (2 diffs)
- trunk/po/mesk.pot (modified) (2 diffs)
- trunk/src/main.py (modified) (5 diffs)
- trunk/src/mesk/log.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/po/es.po
r291 r297 8 8 "Project-Id-Version: 0.1.1\n" 9 9 "Report-Msgid-Bugs-To: \n" 10 "POT-Creation-Date: 2006-06-10 1 5:42-0600\n"10 "POT-Creation-Date: 2006-06-10 17:32-0600\n" 11 11 "PO-Revision-Date: 2006-04-15 17:38-0600\n" 12 12 "Last-Translator: Travis Shirk <travis@pobox.com>\n" … … 237 237 msgstr "Error: no puede abrir %s para la lectura" 238 238 239 #: ../src/main.py:64 240 msgid "Select a specific profile other than the default" 239 #: ../src/main.py:51 240 #, fuzzy 241 msgid "Select a specific profile." 241 242 msgstr "Seleccione un perfil especÃfico con excepción del defecto" 242 243 244 #: ../src/main.py:54 245 #, fuzzy 246 msgid "" 247 "Select the amount of terminal logging. May be CRITICAL, ERROR, WARNING, " 248 "INFO, VERBOSE, or DEBUG" 249 msgstr "" 250 "Registración llano. Puede ser CRITICAL, ERROR, WARNING, INFO, VERBOSE, o " 251 "DEBUG" 252 243 253 #. TODO: Run version upgrade migration routines 244 #: ../src/main.py:9 3254 #: ../src/main.py:90 245 255 #, python-format 246 256 msgid "Upgrading config version %s to %s" 247 257 msgstr "Aumento de la versión %s de los config a %s" 248 258 249 #: ../src/main.py:11 3259 #: ../src/main.py:110 250 260 msgid "Session management disabled (no gnome.ui module)" 251 261 msgstr "La gerencia de la sesión inhabilitó (ningún módulo de gnome.ui)" trunk/po/mesk.pot
r291 r297 9 9 "Project-Id-Version: PACKAGE VERSION\n" 10 10 "Report-Msgid-Bugs-To: \n" 11 "POT-Creation-Date: 2006-06-10 1 5:42-0600\n"11 "POT-Creation-Date: 2006-06-10 17:32-0600\n" 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 236 236 msgstr "" 237 237 238 #: ../src/main.py:64 239 msgid "Select a specific profile other than the default" 238 #: ../src/main.py:51 239 msgid "Select a specific profile." 240 msgstr "" 241 242 #: ../src/main.py:54 243 msgid "" 244 "Select the amount of terminal logging. May be CRITICAL, ERROR, WARNING, " 245 "INFO, VERBOSE, or DEBUG" 240 246 msgstr "" 241 247 242 248 #. TODO: Run version upgrade migration routines 243 #: ../src/main.py:9 3249 #: ../src/main.py:90 244 250 #, python-format 245 251 msgid "Upgrading config version %s to %s" 246 252 msgstr "" 247 253 248 #: ../src/main.py:11 3254 #: ../src/main.py:110 249 255 msgid "Session management disabled (no gnome.ui module)" 250 256 msgstr "" trunk/src/main.py
r291 r297 27 27 28 28 import mesk 29 _ = mesk.common.i18n._ 29 30 import mesk.plugin 30 31 31 from main_window import MainWindow32 32 from optparse import OptionParser 33 33 … … 35 35 from mesk.info import APP_VERSION 36 36 37 _ = mesk.common.i18n._38 class MeskApp:39 def __init__(self):40 '''Constructor'''41 42 def run(self, opts, args):43 self.opts = opts44 self.args = args45 46 self.main_window = MainWindow()47 self.main_window.show()48 49 # Initialize plugin manager50 plugin_mgr = mesk.plugin.PluginMgr(mesk.config.get(mesk.CONFIG_MAIN,51 'plugins_dir'))52 mesk.plugin.set_manager(plugin_mgr)53 54 37 ### Main function ### 55 38 def main(): … … 58 41 59 42 # Parse command line 60 # FIXME: gst is intercepting --help and not showing the real help 61 cmd_line = OptionParser(usage='%s [options]' % APP_NAME.lower(), 62 version='%s %s' % (APP_NAME, APP_VERSION)) 43 version_str = '%s %s %s\n%s' % \ 44 (APP_NAME, APP_VERSION, 45 "(C) Copyright 2006 Travis Shirk <travis@pobox.com>", 46 "This program comes with ABSOLUTELY NO WARRANTY! See " 47 "COPYING for details.") 48 cmd_line = OptionParser(usage = '%s [options]' % APP_NAME.lower(), 49 version = version_str) 63 50 cmd_line.add_option('-p', '--profile', dest='profile', 64 help=_('Select a specific profile other than ' 65 'the default'), 66 metavar='PROFILE', default='') 51 help=_('Select a specific profile.'), 52 metavar='name', default='') 53 cmd_line.add_option('-l', '--log-level', dest='log_level', 54 help=_('Select the amount of terminal logging. May be ' 55 'CRITICAL, ERROR, WARNING, INFO, VERBOSE, or ' 56 'DEBUG'), 57 metavar='level', default='') 67 58 68 59 (opts, args) = cmd_line.parse_args() … … 86 77 # Initialize logging 87 78 mesk.log.init(mesk.config) 79 if opts.log_level: 80 lvl = mesk.log.string_to_level(opts.log_level) 81 if lvl is None: 82 mesk.log.error('Invalid log level: %s' % opts.log_level) 83 return 1 84 mesk.log.set_logging_level(lvl) 88 85 89 86 # Update config version … … 144 141 mesk.log.debug('Exiting: %d' % retval) 145 142 return retval 143 144 class MeskApp: 145 def __init__(self): 146 '''Constructor''' 147 148 def run(self, opts, args): 149 self.opts = opts 150 self.args = args 151 152 # This results in an import of gst, which during initialization will 153 # look for command line arguments and handle them, preventing --help 154 # from displaying our usage. Delaying until now for this reason. 155 from main_window import MainWindow 156 157 self.main_window = MainWindow() 158 self.main_window.show() 159 160 # Initialize plugin manager 161 plugin_mgr = mesk.plugin.PluginMgr(mesk.config.get(mesk.CONFIG_MAIN, 162 'plugins_dir')) 163 mesk.plugin.set_manager(plugin_mgr) 164 165 ### Main ### 146 166 if __name__ == "__main__": 147 sys.exit(main()) ;167 sys.exit(main()) trunk/src/mesk/log.py
r127 r297 30 30 logging.getLogger().addHandler(console) 31 31 32 logging.getLogger().setLevel(get_logging_level(config))32 set_logging_level(get_logging_level(config)) 33 33 34 34 VERBOSE = 15 … … 41 41 '<%(name)s>:[%(levelname)s] %(message)s') 42 42 43 def get_logging_level(config): 44 lvl = config.get('mesk', 'log_level') 45 if lvl == 'INFO': 43 def get_logging_level(config = None): 44 if config is None: 45 return logging.getLogger().getLevel() 46 else: 47 lvl = config.get('mesk', 'log_level') 48 return string_to_level(lvl) 49 50 def string_to_level(lvl): 51 if lvl.upper() == 'INFO': 46 52 return logging.INFO 47 elif lvl == 'WARNING':48 return logging.WAR RANTY49 elif lvl == 'ERROR':53 elif lvl.upper() == 'WARNING': 54 return logging.WARNING 55 elif lvl.upper() == 'ERROR': 50 56 return logging.ERROR 51 elif lvl == 'CRITICAL':57 elif lvl.upper() == 'CRITICAL': 52 58 return logging.CRITICAL 53 elif lvl == 'DEBUG':59 elif lvl.upper() == 'DEBUG': 54 60 return logging.DEBUG 55 61 # Custom levels 56 elif lvl == 'VERBOSE':62 elif lvl.upper() == 'VERBOSE': 57 63 return VERBOSE 58 64 return None 65 66 67 def set_logging_level(level): 68 logging.getLogger().setLevel(level)
