# HG changeset patch # User Nicolas Chauvat # Date 1248012659 -7200 # Node ID 8bfb99d7bbcc5e424a120a5441bae9a86b19181e # Parent e3093fc12a00da3be27787f6d0e0de16da3c54b0 [cw-ctl] improve dialog messages diff -r e3093fc12a00 -r 8bfb99d7bbcc devtools/devctl.py --- a/devtools/devctl.py Sat Jul 18 22:58:30 2009 +0200 +++ b/devtools/devctl.py Sun Jul 19 16:10:59 2009 +0200 @@ -19,7 +19,7 @@ from logilab.common.textutils import get_csv from logilab.common.clcommands import register_commands -from cubicweb import CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage +from cubicweb import CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage, underline_title from cubicweb.__pkginfo__ import version as cubicwebversion from cubicweb.toolsutils import Command, confirm, copy_skeleton from cubicweb.web.webconfig import WebConfiguration @@ -304,11 +304,10 @@ # cleanup rm(tempdir) # instructions pour la suite - print '*' * 72 - print 'you can now edit the following files:' + print '-> regenerated CubicWeb\'s .po catalogs.' + print '\nYou can now edit the following files:' print '* ' + '\n* '.join(toedit) - print - print "then you'll have to update cubes catalogs using the i18ncube command" + print 'when you are done, run "cubicweb-ctl i18ncube yourcube".' class UpdateTemplateCatalogCommand(Command): @@ -341,10 +340,10 @@ traceback.print_exc() print '-> Error while updating catalogs for cube', cubedir # instructions pour la suite - print '*' * 72 - print 'you can now edit the following files:' + print '-> regenerated this cube\'s .po catalogs.' + print '\nYou can now edit the following files:' print '* ' + '\n* '.join(toedit) - + print 'when you are done, run "cubicweb-ctl i18ninstance yourinstance".' def update_cube_catalogs(cubedir): import shutil @@ -356,8 +355,7 @@ cube = basename(normpath(cubedir)) tempdir = mktemp() mkdir(tempdir) - print '*' * 72 - print '-> updating cube %s' % cube + print underline_title('Updating i18n catalogs for cube %s' % cube) chdir(cubedir) potfiles = [join('i18n', scfile) for scfile in ('entities.pot',) if exists(join('i18n', scfile))] diff -r e3093fc12a00 -r 8bfb99d7bbcc server/__init__.py --- a/server/__init__.py Sat Jul 18 22:58:30 2009 +0200 +++ b/server/__init__.py Sun Jul 19 16:10:59 2009 +0200 @@ -45,7 +45,8 @@ assert len(repo.sources) == 1, repo.sources schema = repo.schema sourcescfg = config.sources() - print '-> creating tables...' + _title = '-> creating tables ' + print _title, source = sourcescfg['system'] driver = source['db-driver'] sqlcnx = repo.system_source.get_connection() @@ -68,7 +69,7 @@ schemasql = sqlschema(schema, driver) #skip_entities=[str(e) for e in schema.entities() # if not repo.system_source.support_entity(str(e))]) - sqlexec(schemasql, execute) + sqlexec(schemasql, execute, pbtitle=_title) # install additional driver specific sql files for fpath in glob(join(config.schemas_lib_dir(), '*.sql.%s' % driver)): print '-> installing', fpath @@ -140,7 +141,7 @@ config.bootstrap_schema = bootstrap_schema config.consider_user_state = True config.set_language = True - print '-> application %s initialized.' % config.appid + print '-> database for application %s initialized.' % config.appid def initialize_schema(config, schema, mhandler, event='create'): diff -r e3093fc12a00 -r 8bfb99d7bbcc server/schemaserial.py --- a/server/schemaserial.py Sat Jul 18 22:58:30 2009 +0200 +++ b/server/schemaserial.py Sun Jul 19 16:10:59 2009 +0200 @@ -277,12 +277,13 @@ """synchronize schema and permissions in the database according to current schema """ - print '-> storing the schema in the database...' + _title = '-> storing the schema in the database ' + print _title, eschemas = schema.entities() aller = eschemas + schema.relations() if not verbose: pb_size = len(aller) + len(CONSTRAINTS) + len([x for x in eschemas if x.specializes()]) - pb = ProgressBar(pb_size) + pb = ProgressBar(pb_size, title=_title) for cstrtype in CONSTRAINTS: rql = 'INSERT CWConstraintType X: X name "%s"' % cstrtype if verbose: diff -r e3093fc12a00 -r 8bfb99d7bbcc server/sqlutils.py --- a/server/sqlutils.py Sat Jul 18 22:58:30 2009 +0200 +++ b/server/sqlutils.py Sun Jul 19 16:10:59 2009 +0200 @@ -29,7 +29,7 @@ SQL_PREFIX = 'cw_' -def sqlexec(sqlstmts, cursor_or_execute, withpb=True, delimiter=';'): +def sqlexec(sqlstmts, cursor_or_execute, withpb=True, pbtitle='', delimiter=';'): """execute sql statements ignoring DROP/ CREATE GROUP or USER statements error. If a cnx is given, commit at each statement """ @@ -39,7 +39,7 @@ execute = cursor_or_execute sqlstmts = sqlstmts.split(delimiter) if withpb: - pb = ProgressBar(len(sqlstmts)) + pb = ProgressBar(len(sqlstmts), title=pbtitle) for sql in sqlstmts: sql = sql.strip() if withpb: