~nskaggs/phablet-tools/phablet-click-test-setup-py2-removal

« back to all changes in this revision

Viewing changes to phablet-config

  • Committer: CI bot
  • Author(s): Michael Terry
  • Date: 2014-06-20 18:50:45 UTC
  • mfrom: (283.1.5 welcome-wizard)
  • Revision ID: ps-jenkins@lists.canonical.com-20140620185045-hr311lyrvgg4cyhg
Add support for "phablet-config welcome-wizard --enable" or "phablet-config welcome-wizard --disable".  Note that you'll need ubuntu-system-settings-wizard installed for this to mean anything. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
190
190
        adb.shell(setter)
191
191
 
192
192
 
 
193
def _handle_welcome_wizard(adb, args):
 
194
    config_dir = '/home/phablet/.config/ubuntu-system-settings'
 
195
    ran_file = config_dir + '/wizard-has-run'
 
196
 
 
197
    enabled = adb.shell('ls %s' % ran_file).strip() != ran_file
 
198
    if args.enable and enabled:
 
199
        print('already enabled')
 
200
    elif not args.enable and not enabled:
 
201
        print('already disabled')
 
202
    elif args.enable:
 
203
        adb.shell('rm %s' % ran_file)
 
204
    else:
 
205
        adb.shell('sudo -u phablet mkdir -p %s' % config_dir)
 
206
        adb.shell('sudo -u phablet touch %s' % ran_file)
 
207
 
 
208
 
193
209
def parse_arguments():
194
210
    parser = argparse.ArgumentParser(
195
211
        description='Set up different configuration options on a device.')
236
252
                    help='enable edges intro')
237
253
    ei.add_argument('--disable', action='store_false', required=False,
238
254
                    help='disable edges intro')
 
255
 
 
256
    ei = sub.add_parser('welcome-wizard',
 
257
                        help='Enable/disable the welcome wizard.')
 
258
    ei.set_defaults(func=_handle_welcome_wizard)
 
259
    ei = ei.add_mutually_exclusive_group(required=True)
 
260
    ei.add_argument('--enable', action='store_true', required=False,
 
261
                    help='enable welcome wizard')
 
262
    ei.add_argument('--disable', action='store_false', required=False,
 
263
                    help='disable welcome wizard')
239
264
    return parser.parse_args()
240
265
 
241
266