Ejemplo n.º 1
0
def usage():
    templatetools.print_usage('quickly edit')


def help():
    print _(
        """A convenience command to open all of your python files in your project 
directory in your default editor, ready for editing.

If you put yourself EDITOR or SELECTED_EDITOR environment variable, this latter
will be used. Also, if you configured sensible-editor, this one will be
choosed.""")


templatetools.handle_additional_parameters(sys.argv, help, usage=usage)

filelist = []
for root, dirs, files in os.walk('./'):
    for name in files:
        hide_path = root.endswith('_lib')
        py = name.endswith('.py')
        if py and not hide_path and name not in ('setup.py'):
            filelist.append(os.path.join(root, name))

# if config not already loaded
if not configurationhandler.project_config:
    configurationhandler.loadConfig()

# add launcher which does not end with .py for older projects (pre-lib split)
project_name = configurationhandler.project_config['project']
Ejemplo n.º 2
0
    templatetools.print_usage(_('quickly create <template> <project-name>'))
def help():
    print _("""This will create and run a new project, including Python code, 
Glade files, and packaging files to make the project work. After
creating the project, get started by:

1. Changing your working directory to the new project:
$ cd path/to/project-name

2. Edit the UI with Glade:
$ quickly design

3. Edit the Python code:
$ quickly edit
""")
templatetools.handle_additional_parameters(sys.argv, help, usage=usage)


path_and_project = sys.argv[1].split('/')
project_name = path_and_project[-1]

try:
    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)
Ejemplo n.º 3
0
    else:
        header_file_path = flicense_name
    try:
        for line in file(header_file_path, 'r'):
            license_content += line
    except (OSError, IOError), e:
        if header_file_path == flicense_name:
            msg = _("%s file was not found. It is compulsory for user defined license") % flicense_name
        else:
            msg = _("Header of %s license not found. Quickly installation corrupted?") % header_file_path
        raise LicenceError(msg)

    copy_license_to_files(license_content)


if __name__ == "__main__":

    templatetools.handle_additional_parameters(sys.argv, help, shell_completion)
    license = None
    if len(sys.argv) > 2:
        print _("This command only take one optional argument: License\nUsage is: quickly license <license>")
        sys.exit(4)
    if len(sys.argv) == 2:
        license = sys.argv[1]
    try:
        licensing(license)
    except LicenceError, error_message:
        print(error_message)
        sys.exit(1)