Beispiel #1
0
 def dot(self):
     """ Emits a colourful character. """
     x = c = 0
     try:
         x, y, c = self.gen.next()
         if x == 0:
             width = get_terminal_width()
             if width != self.width:
                 self.init()
     except StopIteration:
         kwargs = self.kwargs
         self.zoom_location += 1
         self.zoom_location %= len(self.zoom_locations)
         loc = self.zoom_locations[self.zoom_location]
         kwargs.update({
             "x_pos": loc[0],
             "y_pos": loc[1],
             "distance": loc[2]
         })
         self.colour_range = loc[3]
         #global colour_range
         #print colour_range, loc[2]
         #colour_range = None
         return self.restart()
     print_pixel(c, self.colour_range, self.invert)
     if x == self.width - 1:
         print >> sys.stderr
Beispiel #2
0
 def dot(self):
     """ Emits a colourful character. """
     x = c = 0
     try:
         x, y, c = self.gen.next()
         if x == 0:
             width = get_terminal_width()
             if width != self.width:
                 self.init()
     except StopIteration:
         if DEBUG and self.interesting_coordinates:
             print >>sys.stderr, "Interesting coordinates:", self.interesting_coordinates
             self.interesting_coordinates = []
         kwargs = self.kwargs
         self.zoom_location += 1
         self.zoom_location %= len(self.zoom_locations)
         loc = self.zoom_locations[self.zoom_location]
         kwargs.update({"x_pos": loc[0], "y_pos": loc[1], "distance": loc[2]})
         self.max_colour = loc[3]
         if DEBUG:
             # Only used for debugging new locations:
             print "Colour range", self.colour_range
         self.colour_range = None
         self.restart()
         return
     if self.print_pixel(c, self.invert):
         self.interesting_coordinates.append(dict(x=(x, self.mandelbrot.x_range[x]),
                                                  y=(y, self.mandelbrot.y_range[y])))
     if x == self.width - 1:
         print >>sys.stderr
 def dot(self):
     """ Emits a colourful character. """
     x = c = 0
     try:
         x, y, c = self.gen.next()
         if x == 0:
             width = get_terminal_width()
             if width != self.width:
                 self.init()
     except StopIteration:
         kwargs = self.kwargs
         self.zoom_location += 1
         self.zoom_location %= len(self.zoom_locations)
         loc = self.zoom_locations[self.zoom_location]
         kwargs.update({"x_pos": loc[0], "y_pos": loc[1], "distance": loc[2]})
         self.colour_range = loc[3]
         # global colour_range
         # print colour_range, loc[2]
         # colour_range = None
         return self.restart()
     print_pixel(c, self.colour_range, self.invert)
     if x == self.width - 1:
         print >> sys.stderr
 def init(self):
     self.width = get_terminal_width() or 80  # in some envs, the py lib doesnt default the width correctly
     self.mandelbrot = Mandelbrot(width=(self.width or 1), **self.kwargs)
     self.mandelbrot.init()
     self.gen = self.mandelbrot.generate()
Beispiel #5
0
from py.io import ansi_print, get_terminal_width
import re

def rec(p):
    return p.check(dotfile=0)

parser = py.std.optparse.OptionParser(usage=__doc__)
parser.add_option("-i", "--ignore-case", action="store_true", dest="ignorecase",
                  help="ignore case distinctions")
parser.add_option("-C", "--context", action="store", type="int", dest="context",
            default=0, help="How many lines of output to show")
parser.add_option("-g", "--glob", action="store", type="string", dest="glob",
            default="*.py",
            help="glob-pattern for which files to consider")

terminal_width = get_terminal_width()

def find_indexes(search_line, string):
    indexes = []
    before = 0
    while 1:
        i = search_line.find(string, before)
        if i == -1:
            break
        indexes.append(i)
        before = i + len(string)
    return indexes

def main():
    (options, args) = parser.parse_args()
    if len(args) == 2:
Beispiel #6
0
 def init(self):
     self.width = get_terminal_width(
     ) or 80  # in some envs, the py lib doesnt default the width correctly
     self.mandelbrot = Mandelbrot(width=(self.width or 1), **self.kwargs)
     self.mandelbrot.init()
     self.gen = self.mandelbrot.generate()