示例#1
0
文件: common.py 项目: rcook/mma
parts of MMA. It is safe to load the whole works with:

    from MMA.common import *

without side effects (yeah, right).

"""

from random import randrange
import sys
from . import gbl
from textwrap import wrap

# having the term width is nice for pretty print error/warning
from MMA.termsize import getTerminalSize
termwidth = getTerminalSize()[0] - 1


def prettyPrint(msg):
    """ Simple formatter for error/warning messages."""

    for a in wrap(msg, termwidth, initial_indent='', subsequent_indent='    '):
        print(a)


def error(msg):
    """ Print an error message and exit.

        If the global line number is >=0 then print the line number
        as well.
    """
示例#2
0
# ###################################
# # MMA plugin utilities            #
# #                                 #
# # written by Ignazio Di Napoli    #
# # <*****@*****.**>           #
# ###################################

import textwrap, traceback, sys, re
from collections import defaultdict

from MMA.common import error, warning
from MMA.macro import macros
import MMA.gbl as gbl

from MMA.termsize import getTerminalSize
termwidth = getTerminalSize()[0]-1

try:
    basestring
except NameError:
    basestring = str
  

# ###################################
# # Plugin configuration            #
# ###################################

class _pluginInfo (object):
    def __init__(self):
        self.NAME = None
        self.DESCRIPTION = ""