def add(options): if len(argv) != 2: templatetools.print_usage(options['indicator']) sys.exit(4) abs_template_path = templatetools.get_template_path_from_project() abs_command_path = os.path.abspath(os.path.dirname(sys.argv[0])) if not configurationhandler.project_config: configurationhandler.loadConfig() project_name = configurationhandler.project_config['project'] template_python_dir = os.path.join(abs_template_path, 'store', 'python') # take files from command directory if don't exist python_file = os.path.join(template_python_dir, 'indicator.py') python_name = templatetools.python_name(project_name) target_python_dir = python_name project_sentence_name, project_camel_case_name = \ templatetools.conventional_names(project_name) substitutions = (("project_name", project_name), ("python_name", python_name)) templatetools.file_from_template(template_python_dir, "indicator.py", target_python_dir, substitutions)
def add(options): if len(argv) != 2: templatetools.print_usage(options['indicator']) sys.exit(4) abs_template_path = templatetools.get_template_path_from_project() abs_command_path = os.path.abspath(os.path.dirname(sys.argv[0])) if not configurationhandler.project_config: configurationhandler.loadConfig() project_name = configurationhandler.project_config['project'] template_python_dir = os.path.join(abs_template_path, 'store', 'python') # take files from command directory if don't exist python_file = os.path.join(template_python_dir, 'indicator.py') python_name = templatetools.python_name(project_name) target_python_dir = python_name project_sentence_name, project_camel_case_name = \ templatetools.conventional_names(project_name) substitutions = (("project_name",project_name), ( "python_name",python_name)) templatetools.file_from_template(template_python_dir, "indicator.py", target_python_dir, substitutions)
if not configurationhandler.project_config: configurationhandler.loadConfig() project_name = configurationhandler.project_config['project'] template_help_dir = os.path.join(abs_template_path, 'store', 'data', 'mallard') # take files from command directory if don't exist help_page = os.path.join(template_help_dir, 't_o_p_i_c.page') if not os.path.isfile(help_page): template_help_dir = os.path.join(abs_command_path, 'store', 'data', 'mallard') help_page = os.path.join(template_help_dir, 't_o_p_i_c.page') target_help_dir = os.path.join('help', 'C') if not os.path.exists(target_help_dir): os.makedirs(target_help_dir) python_name = templatetools.python_name(topic_name) sentence_name, cc_name = templatetools.conventional_names(topic_name) substitutions = ( ('t_o_p_i_c', topic_name), ('sentence_name', sentence_name), ) templatetools.file_from_template(template_help_dir, 't_o_p_i_c.page', target_help_dir, substitutions)
# check that project name follow quickly rules and reformat it. try: project_name = templatetools.quickly_name(project_name) except templatetools.bad_project_name, e: print(e) sys.exit(1) os.chdir(project_name) # get origin path pathname = templatetools.get_template_path_from_project() abs_path_project_root = os.path.join(pathname, 'project_root') python_name = templatetools.python_name(project_name) sentence_name, camel_case_name = templatetools.conventional_names(project_name) # Calculate the SWF's dimensions try: width, height = SWF.dimensions(swf) except SWF.SWFNotASWF: print "File '%s' does not seem to be a SWF. Terminating." sys.exit(7) except SWF.SWFNoDimensions: print "(Could not read size from SWF file; defaulting to 640x480. You should edit bin/%s with the correct size.)" % project_name width, height = (640, 480) substitutions = (("project_name",project_name), ("camel_case_name",camel_case_name), ("python_name",python_name),
'dialog_camel_case_nameDialog.py') if len([file_exist for file_exist in origin_ui_file_list if os.path.isfile(file_exist)]) != len(origin_ui_file_list): template_ui_dir = os.path.join(abs_command_path, 'store', 'data', 'ui') if not os.path.isfile(python_file): template_python_dir = os.path.join(abs_command_path, 'store', 'python') target_ui_dir = os.path.join('data', 'ui') python_name = templatetools.python_name(project_name) target_python_dir = python_name dialog_python_name = templatetools.python_name(dialog_name) dialog_sentence_name, dialog_camel_case_name = \ templatetools.conventional_names(dialog_name) project_sentence_name, project_camel_case_name = \ templatetools.conventional_names(project_name) dialog_name = dialog_name.replace('-','_') substitutions = (("project_name",project_name), ("dialog_name",dialog_name), ("dialog_python_name",dialog_python_name), ("dialog_camel_case_name",dialog_camel_case_name), ("project_camel_case_name",project_camel_case_name), ("project_sentence_name",project_sentence_name), ("dialog_sentence_name",dialog_sentence_name), ("python_name",python_name)) templatetools.file_from_template(template_ui_dir, "dialog_camel_case_nameDialog.ui",
if not configurationhandler.project_config: configurationhandler.loadConfig() project_name = configurationhandler.project_config['project'] template_help_dir = os.path.join(abs_template_path, 'store', 'data', 'mallard') # take files from command directory if don't exist help_page = os.path.join(template_help_dir, 'g_u_i_d_e.page') if not os.path.isfile(help_page): template_help_dir = os.path.join(abs_command_path, 'store', 'data', 'mallard') help_page = os.path.join(template_help_dir, 'g_u_i_d_e.page') target_help_dir = os.path.join('help', 'C') if not os.path.exists(target_help_dir): os.makedirs(target_help_dir) python_name = templatetools.python_name(guide_name) sentence_name, cc_name = templatetools.conventional_names(guide_name) substitutions = ( ('g_u_i_d_e', guide_name), ('sentence_name', sentence_name), ) templatetools.file_from_template(template_help_dir, 'g_u_i_d_e.page', target_help_dir, substitutions)
project_name = configurationhandler.project_config['project'] template_help_dir = os.path.join(abs_template_path, 'store', 'data', 'mallard') # take files from command directory if don't exist help_page = os.path.join(template_help_dir, 'g_u_i_d_e.page') if not os.path.isfile(help_page): template_help_dir = os.path.join(abs_command_path, 'store', 'data', 'mallard') help_page = os.path.join(template_help_dir, 'g_u_i_d_e.page') target_help_dir = os.path.join('help', 'C') if not os.path.exists(target_help_dir): os.makedirs(target_help_dir) python_name = templatetools.python_name(guide_name) sentence_name, cc_name = templatetools.conventional_names(guide_name) substitutions = ( ('g_u_i_d_e', guide_name), ('sentence_name', sentence_name), ) templatetools.file_from_template(template_help_dir, 'g_u_i_d_e.page', target_help_dir, substitutions)
project_name = configurationhandler.project_config['project'] template_help_dir = os.path.join(abs_template_path, 'store', 'data', 'mallard') # take files from command directory if don't exist help_page = os.path.join(template_help_dir, 't_o_p_i_c.page') if not os.path.isfile(help_page): template_help_dir = os.path.join(abs_command_path, 'store', 'data', 'mallard') help_page = os.path.join(template_help_dir, 't_o_p_i_c.page') target_help_dir = os.path.join('help', 'C') if not os.path.exists(target_help_dir): os.makedirs(target_help_dir) python_name = templatetools.python_name(topic_name) sentence_name, cc_name = templatetools.conventional_names(topic_name) substitutions = ( ('t_o_p_i_c', topic_name), ('sentence_name', sentence_name), ) templatetools.file_from_template(template_help_dir, 't_o_p_i_c.page', target_help_dir, substitutions)
project_name = templatetools.quickly_name(project_name) except: # user friendly message already caught in pre_create sys.exit(1) if len(path_and_project) > 1: os.chdir(str(os.path.sep).join(path_and_project[0:-1])) os.chdir(project_name) # get origin path pathname = templatetools.get_template_path_from_project() abs_path_project_root = os.path.join(pathname, 'project_root') python_name = templatetools.python_name(project_name) sentence_name, camel_case_name = templatetools.conventional_names(project_name) substitutions = (("project_name",project_name), ("camel_case_name",camel_case_name), ("python_name",python_name), ("sentence_name",sentence_name),) for root, dirs, files in os.walk(abs_path_project_root): try: relative_dir = root.split('project_root/')[1] except: relative_dir = "" # python dir should be replace by python_name (project "pythonified" name) if relative_dir.startswith('python'): relative_dir = relative_dir.replace('python', python_name)