'Redraws all the graph.
This implements a generator which has a rather strange protocol
implemented in "draw_handler".
* When the generator yields True a new generator is created and we
start calling that one, so all the code after a "yield True" is run
won\'t be called
* When the generator yields False it will be called again'

def _redraw_all(self):

    if (self.gc is None):
        (yield True)
    try:
        len_all_messages = len(self.all_messages)
    except NoSuchTableException:
        (yield True)
    except MalformedDBException:
        (yield True)
    if (len_all_messages < 2):
        (yield True)
    try:
        pan = (self.all_messages[(-1)][0] - self.all_messages[0][0])
    except IndexError:
        (yield True)
    self.window.clear()
    (w, h) = self.window.get_size()
    tspan = (pan / self.timeGrouping)
    usableWidth = ((w - MDER) - self.realLeftMargin)
    if (tspan > usableWidth):
        self.timeGrouping = ((self.timeGrouping * int((tspan / usableWidth))) + 1)
        tspan = (pan / self.timeGrouping)
    elif ((tspan < (usableWidth // 2)) and (self.timeGrouping > 2)):
        self.timeGrouping //= 2
        tspan = (pan / self.timeGrouping)
    txts = ['', 'Vulns', 'Info', '', 'Debug']
    maxw = 0
    for txt in txts:
        self.pangolayout.set_text(txt)
        (tw, th) = self.pangolayout.get_pixel_size()
        if (tw > maxw):
            maxw = tw
    lm = self.realLeftMargin = ((int(maxw) + MIZQ) + 8)
    self.gc.set_rgb_fg_color(colors.whitesmoke)
    self.window.draw_rectangle(self.gc, True, lm, MSUP, ((w - MDER) - lm), ((h - MINF) - MSUP))
    self.gc.set_rgb_fg_color(colors.black)
    self.window.draw_line(self.gc, lm, MSUP, lm, ((h - MINF) + 10))
    self.window.draw_line(self.gc, lm, (h - MINF), (w - MDER), (h - MINF))
    for (x, timepoint) in self._calculateXTicks(((w - lm) - MDER)):
        posx = (x + lm)
        self.window.draw_line(self.gc, posx, ((h - MINF) + 5), posx, (h - MINF))
        self.pangolayout.set_text(timepoint)
        (tw, th) = self.pangolayout.get_pixel_size()
        self.window.draw_layout(self.gc, (posx - (tw // 2)), ((h - MINF) + 10), self.pangolayout)
    self.pangolayout.set_text('[s]')
    (tw, th) = self.pangolayout.get_pixel_size()
    self.window.draw_layout(self.gc, ((w - MDER) + 5), ((h - MINF) - (th // 2)), self.pangolayout)
    sep = (((h - MSUP) - MINF) / 4)
    self.posHorizItems = {}
    self.maxItemHeight = {}
    posyant = MSUP
    for (i, txt) in enumerate(txts):
        if (not txt):
            continue
        posy = int((MSUP + (i * sep)))
        self.posHorizItems[txt] = posy
        self.maxItemHeight[txt] = ((posy - posyant) - 1)
        posyant = posy
        self.window.draw_line(self.gc, (lm - 5), posy, lm, posy)
        self.pangolayout.set_text(txt)
        (tw, th) = self.pangolayout.get_pixel_size()
        self.window.draw_layout(self.gc, ((lm - tw) - 8), (posy - (th // 2)), self.pangolayout)
    countingPixel = 0
    pixelQuant = 0
    mesind = 0
    while True:
        for (mmseg, mtype, sever) in itertools.islice(self.all_messages, mesind, None, None):
            mesind += 1
            pixel = ((mmseg - self.timeBase) // self.timeGrouping)
            posx = (self.realLeftMargin + pixel)
            if (posx > (w - MDER)):
                (yield True)
            if (mtype == 'debug'):
                if (pixel == countingPixel):
                    pixelQuant += 1
                else:
                    countingPixel = pixel
                    self._drawItem_debug(posx, pixelQuant)
                    pixelQuant = 1
            elif (mtype == 'information'):
                self._drawItem_info(posx)
            elif (mtype == 'vulnerability'):
                self._drawItem_vuln(posx, sever)
        (yield False)
