Ejemplo n.º 1
0
class Hints(QGraphicsItem):

    def __init__(self, x_offset, y_offset):
        super(Hints, self).__init__()

        self.x_offset = x_offset
        self.y_offset = y_offset

        self.path = None
        self.setup_display()

    def setup_display(self, step=0):
        steps = ["Press Alt: matching commits mode",
                 "Keep pressing Alt and hover over a commit",
                 "That way you can see all the commits that have the same name"]
        self.path = QPainterPath()

        self.font = QFont()
        self.font.setFamily("Helvetica")
        self.font.setPointSize(FONT_SIZE)
        self.path.addText(
            self.x_offset,
            self.y_offset,
            self.font, QString(steps[step]))

    def boundingRect(self):
        return self.path.boundingRect()

    def shape(self):
        return self.path

    def paint(self, painter, option, widget=None):
        painter.setPen(Qt.NoPen)
        painter.setBrush(QBrush(BLACK))
        painter.drawPath(self.path)
Ejemplo n.º 2
0
    def paint(self, painter, styleoptions, widget=None):
        try:
            width, realsize, label, fontsize = self._calc_size()
        except ZeroDivisionError:
            return

        mapunits = self.canvas.mapUnits()

        # painter.drawRect(self.boundingRect())
        array = QPolygon()
        canvasheight = self.canvas.height()
        canvaswidth = self.canvas.width()
        margin = 20
        originy = 0
        originx = 0

        self.setPos(margin, canvasheight - margin)

        x1, y1 = originx, originy
        x2, y2 = originx, originy + self.ticksize
        x3, y3 = originx + width, originy + self.ticksize
        midx, midy = originx + width /2, originy + self.ticksize / 2
        x4, y4 = originx + width, originy

        for pen in self.pens:
            painter.setPen(pen)
            # Drwa the scale bar
            painter.drawLine(x1, y1, x2, y2)
            painter.drawLine(x2, y2, x3, y3)
            painter.drawLine(x3, y3, x4, y4)
            painter.drawLine(midx, midy, midx, y1)

        # Draw the text
        fontwidth = self.metrics.width("0")
        fontheight = self.metrics.height()
        fontheight /= 2
        fontwidth /= 2
        path = QPainterPath()
        point = QPointF(x1 - fontwidth, y1 - fontheight)
        path.addText(point, self.font, "0")
        painter.setPen(self.whitepen)
        painter.setBrush(self.blackbrush)
        painter.setRenderHints(QPainter.Antialiasing)
        painter.setFont(self.font)
        painter.drawPath(path)

        fontwidth = self.metrics.width(label)
        fontheight = self.metrics.height()
        fontheight /= 2
        fontwidth /= 2
        point = QPointF(x4 - fontwidth, y4 - fontheight)
        path.addText(point, self.font, label)
        painter.drawPath(path)
Ejemplo n.º 3
0
    def paint(self, painter, styleoptions, widget=None):
        try:
            width, realsize, label, fontsize = self._calc_size()
        except ZeroDivisionError:
            return

        mapunits = self.canvas.mapUnits()

        # painter.drawRect(self.boundingRect())
        array = QPolygon()
        canvasheight = self.canvas.height()
        canvaswidth = self.canvas.width()
        margin = 20
        originy = 0
        originx = 0

        self.setPos(margin, canvasheight - margin)

        x1, y1 = originx, originy
        x2, y2 = originx, originy + self.ticksize
        x3, y3 = originx + width, originy + self.ticksize
        midx, midy = originx + width / 2, originy + self.ticksize / 2
        x4, y4 = originx + width, originy

        for pen in self.pens:
            painter.setPen(pen)
            # Drwa the scale bar
            painter.drawLine(x1, y1, x2, y2)
            painter.drawLine(x2, y2, x3, y3)
            painter.drawLine(x3, y3, x4, y4)
            painter.drawLine(midx, midy, midx, y1)

        # Draw the text
        fontwidth = self.metrics.width("0")
        fontheight = self.metrics.height()
        fontheight /= 2
        fontwidth /= 2
        path = QPainterPath()
        point = QPointF(x1 - fontwidth, y1 - fontheight)
        path.addText(point, self.font, "0")
        painter.setPen(self.whitepen)
        painter.setBrush(self.blackbrush)
        painter.setRenderHints(QPainter.Antialiasing)
        painter.setFont(self.font)
        painter.drawPath(path)

        fontwidth = self.metrics.width(label)
        fontheight = self.metrics.height()
        fontheight /= 2
        fontwidth /= 2
        point = QPointF(x4 - fontwidth, y4 - fontheight)
        path.addText(point, self.font, label)
        painter.drawPath(path)
Ejemplo n.º 4
0
    def setup_display(self, x_offset, y_offset):
        path = QPainterPath()

        self.rect = QRectF(x_offset + 0,
                      y_offset + 0,
                      COMMIT_WIDTH, COMMIT_HEIGHT)
        path.addRoundedRect(self.rect, 10, 10)

        self.font = QFont()
        self.font.setFamily("Helvetica")
        self.font.setPointSize(FONT_SIZE)
        path.addText(
            x_offset + (COMMIT_WIDTH - len(self.commit.name()) * (FONT_SIZE - 4)) / 2 + 4,
            y_offset + (COMMIT_HEIGHT + FONT_SIZE) / 2 ,
            self.font, QString(self.commit.name()))
        return path
Ejemplo n.º 5
0
 def createAxisLabelPixmap(self):
     pixmap = QPixmap(250, 250)
     pixmap.fill(self.backgroundColor)
     painter = QPainter()
     painter.begin(pixmap)
     font = QFont()
     font.setBold(True)
     font.setPixelSize(250 - 30)
     path = QPainterPath()
     path.addText(QPointF(50, 250 - 50), font, self.axis)
     brush = QBrush(self.foregroundColor)
     painter.setBrush(brush)
     painter.drawPath(path)
     painter.setFont(font)
     painter.end()
     pixmap = pixmap.scaled(QSize(self.labelsWidth, self.labelsheight), Qt.KeepAspectRatio, Qt.SmoothTransformation)
     return pixmap
Ejemplo n.º 6
0
 def createAxisLabelPixmap(self):
     pixmap = QPixmap(250, 250)
     pixmap.fill(self.backgroundColor)
     painter = QPainter()
     painter.begin(pixmap)
     font = QFont()
     font.setBold(True)
     font.setPixelSize(250 - 30)
     path = QPainterPath()
     path.addText(QPointF(50, 250 - 50), font, self.axis)
     brush = QBrush(self.foregroundColor)
     painter.setBrush(brush)
     painter.drawPath(path)
     painter.setFont(font)
     painter.end()
     pixmap = pixmap.scaled(QSize(self.labelsWidth, self.labelsheight),
                            Qt.KeepAspectRatio, Qt.SmoothTransformation)
     return pixmap
Ejemplo n.º 7
0
def _get_pos_widget(name, backgroundColor, foregroundColor):
    label = QLabel()
    label.setAttribute(Qt.WA_TransparentForMouseEvents, True)

    pixmap = QPixmap(25*10, 25*10)
    pixmap.fill(backgroundColor)
    painter = QPainter()
    painter.begin(pixmap)
    pen = QPen(foregroundColor)
    painter.setPen(pen)
    painter.setRenderHint(QPainter.Antialiasing)
    font = QFont()
    font.setBold(True)
    font.setPixelSize(25*10-30)
    path = QPainterPath()
    path.addText(QPointF(50, 25*10-50), font, name)
    brush = QBrush(foregroundColor)
    painter.setBrush(brush)
    painter.drawPath(path)
    painter.setFont(font)
    painter.end()
    pixmap = pixmap.scaled(QSize(20,20),
                           Qt.KeepAspectRatio,
                           Qt.SmoothTransformation)
    label.setPixmap(pixmap)

    spinbox = QSpinBox()
    spinbox.setAttribute(Qt.WA_TransparentForMouseEvents, True)
    spinbox.setEnabled(False)
    spinbox.setAlignment(Qt.AlignCenter)
    spinbox.setToolTip("{0} Spin Box".format(name))
    spinbox.setButtonSymbols(QAbstractSpinBox.NoButtons)
    spinbox.setMaximumHeight(20)
    spinbox.setMaximum(9999)
    font = spinbox.font()
    font.setPixelSize(14)
    spinbox.setFont(font)
    sheet = TEMPLATE.format(foregroundColor.name(),
                            backgroundColor.name())
    spinbox.setStyleSheet(sheet)
    return label, spinbox
Ejemplo n.º 8
0
def _get_pos_widget(name, backgroundColor, foregroundColor):
    label = QLabel()
    label.setAttribute(Qt.WA_TransparentForMouseEvents, True)

    pixmap = QPixmap(25*10, 25*10)
    pixmap.fill(backgroundColor)
    painter = QPainter()
    painter.begin(pixmap)
    pen = QPen(foregroundColor)
    painter.setPen(pen)
    painter.setRenderHint(QPainter.Antialiasing)
    font = QFont()
    font.setBold(True)
    font.setPixelSize(25*10-30)
    path = QPainterPath()
    path.addText(QPointF(50, 25*10-50), font, name)
    brush = QBrush(foregroundColor)
    painter.setBrush(brush)
    painter.drawPath(path)
    painter.setFont(font)
    painter.end()
    pixmap = pixmap.scaled(QSize(20,20),
                           Qt.KeepAspectRatio,
                           Qt.SmoothTransformation)
    label.setPixmap(pixmap)

    spinbox = QSpinBox()
    spinbox.setAttribute(Qt.WA_TransparentForMouseEvents, True)
    spinbox.setEnabled(False)
    spinbox.setAlignment(Qt.AlignCenter)
    spinbox.setToolTip("{0} Spin Box".format(name))
    spinbox.setButtonSymbols(QAbstractSpinBox.NoButtons)
    spinbox.setMaximumHeight(20)
    spinbox.setMaximum(9999)
    font = spinbox.font()
    font.setPixelSize(14)
    spinbox.setFont(font)
    sheet = TEMPLATE.format(foregroundColor.name(),
                            backgroundColor.name())
    spinbox.setStyleSheet(sheet)
    return label, spinbox
Ejemplo n.º 9
0
    def paint (self, painter, style, widget=None):
        assert isinstance(painter, QPainter)

        if self.isSelected():
            brush = QBrush(Qt.green)
        else:
            brush = QBrush(Qt.white)

        pen = QPen(Qt.black)

        circle_path = QPainterPath()
        circle_path.addEllipse(self.boundingRect())
        painter.fillPath(circle_path, brush)
        painter.strokePath(circle_path, pen)

        text_path = QPainterPath()
        text_path.addText(0, 0, QFont(), str(self.node))
        box = text_path.boundingRect()
        text_path.translate(-box.center())

        painter.fillPath(text_path, QBrush(Qt.black))
def gen_font(font_configs,
             font_type=FONT_TYPES.font01,
             img_width=1024,
             draw_outlines=False):
    img_height = HEIGHT_FACTOR

    seen_chars = []

    game_font = GameFont(width=img_width)
    painter = QPainter(game_font.trans)

    text_brush = QtGui.QBrush(QColor(255, 255, 255, 255))
    painter.setBrush(text_brush)

    outline_brush = QtGui.QBrush()
    outline_pen = QtGui.QPen(QColor(255, 0, 0, 255),
                             1,
                             style=Qt.Qt.DotLine,
                             join=Qt.Qt.MiterJoin)

    x_pos = 0
    y_pos = 0

    line_height = LINE_HEIGHT[font_type]

    for config in font_configs:
        font = QFont(config.family, config.size, config.weight, italic=False)
        font.setKerning(False)
        metric = QFontMetrics(font)

        painter.setFont(font)
        painter.setRenderHint(QPainter.TextAntialiasing, True)
        painter.setRenderHint(QPainter.Antialiasing, True)

        text_pen = painter.pen()
        text_pen.setBrush(QColor(255, 255, 255, 255))
        text_pen.setWidthF(config.pen_size)
        text_pen.setCapStyle(config.pen_cap)
        text_pen.setJoinStyle(config.pen_join)
        text_pen.setStyle(Qt.Qt.SolidLine if config.use_pen else Qt.Qt.NoPen)
        painter.setPen(text_pen)

        for char in sorted(config.chars):

            if char in seen_chars:
                continue
            else:
                seen_chars.append(char)

            # If we want a character to represent something it's not.
            char_to_print = char

            if char in config.subs:
                char_to_print = config.subs[char]

            char_w = metric.width(char_to_print)

            if x_pos + char_w > img_width:
                x_pos = 0
                y_pos += line_height + config.y_margin

            if y_pos < 0:
                y_pos = 0

            if y_pos + line_height > MAX_HEIGHT:
                _LOGGER.warning(
                    "Ran out of vertical space. Generated font does not include all characters."
                )
                break

            game_font.font_data.data.append({
                'char': char,
                'x': x_pos,
                'y': y_pos,
                'w': char_w,
                'h': line_height,
                'y_shift': config.y_shift
            })

            path = QPainterPath()
            path.addText(x_pos + config.x_offset,
                         y_pos + metric.ascent() + config.y_offset, font,
                         char_to_print)
            painter.drawPath(path)

            if draw_outlines:
                painter.setBrush(outline_brush)
                painter.setPen(outline_pen)
                painter.setRenderHint(QPainter.Antialiasing, False)

                painter.drawRect(x_pos, y_pos, char_w, line_height)

                painter.setRenderHint(QPainter.Antialiasing, True)
                painter.setBrush(text_brush)
                painter.setPen(text_pen)

            x_pos += char_w + config.x_margin

    painter.end()

    painter = QPainter(game_font.opaque)
    painter.drawImage(game_font.opaque.rect(), game_font.trans,
                      game_font.trans.rect())
    painter.end()

    # Crop our images so they only take up as much space as they need.
    final_height = int(
        math.ceil(float(y_pos + line_height) / float(HEIGHT_FACTOR)) *
        HEIGHT_FACTOR)
    game_font.trans = game_font.trans.copy(0, 0, img_width, final_height)
    game_font.opaque = game_font.opaque.copy(0, 0, img_width, final_height)

    return game_font


# if __name__ == '__main__':

# app = QtGui.QApplication(sys.argv)

# chars = load_text(CHAR_LIST)
# We can't have dupes, and why not put them in order while we're at it?
# chars = sorted(make_unique(chars))

# game_font = gen_font(chars)
# game_font.save(SAVE_AS)

### EOF ###
Ejemplo n.º 11
0
    def rebuildMonth(self):
        """
        Rebuilds the current item in month mode.
        """
        scene = self.scene()
        if (not scene):
            return

        start_date = self.dateStart()
        end_date = self.dateEnd()
        min_date = scene.minimumDate()
        max_date = scene.maximumDate()

        # make sure our item is visible
        if (not (min_date <= end_date and start_date <= max_date)):
            self.hide()
            self.setPath(QPainterPath())
            return

        # make sure we have valid range information
        if (start_date < min_date):
            start_date = min_date
            start_inrange = False
        else:
            start_inrange = True

        if (max_date < end_date):
            end_date = max_date
            end_inrange = False
        else:
            end_inrange = True

        start_rect = scene.dateRect(start_date)
        end_rect = scene.dateRect(end_date)

        if (not (start_rect.isValid() and end_rect.isValid())):
            self.hide()
            return

        # rebuild an all day path
        path = QPainterPath()
        self.setPos(0, 0)

        pad = 2
        offset = 18
        height = 16

        min_left = 10
        max_right = scene.width() - 16
        delta_h = start_rect.height()

        # draw the all day event
        if (self.isAllDay()):
            top = start_rect.top()
            left = start_rect.left() + 3
            first = start_inrange

            while (top <= end_rect.top()):
                sub_path = QPainterPath()

                # calculate the end position
                if (end_rect.top() - 2 <= top and end_inrange):
                    at_end = True
                    right = end_rect.right() - pad
                else:
                    at_end = False
                    right = max_right

                if (first):
                    sub_path.moveTo(left, top + offset)
                    text_left = left + 4
                else:
                    sub_path.moveTo(left + height / 2, top + offset)
                    text_left = left + height / 2 + 2

                if (at_end):
                    sub_path.lineTo(right, top + offset)
                    sub_path.lineTo(right, top + offset + height)
                else:
                    sub_path.lineTo(right - height / 2, top + offset)
                    sub_path.lineTo(right, top + offset + height / 2)
                    sub_path.lineTo(right - height / 2, top + offset + height)

                if (first):
                    sub_path.lineTo(left, top + offset + height)
                    sub_path.lineTo(left, top + offset)
                else:
                    sub_path.lineTo(left + height / 2, top + offset + height)
                    sub_path.lineTo(left, top + offset + height / 2)
                    sub_path.lineTo(left + height / 2, top + offset)

                path.addPath(sub_path)

                data = (text_left, top + offset + 1, right, height,
                        Qt.AlignLeft | Qt.AlignVCenter, self.title())

                self._textData.append(data)

                left = min_left
                top += delta_h
                first = False
        else:
            text = '%s: (%s)' % (self.timeStart().toString('h:mm ap'),
                                 self.title())

            font = scene.font()
            left = start_rect.left() + 2 * pad
            top = start_rect.top() + offset

            path.addText(left, top + height / 2, font, text)

        # setup the path for this item
        self.setPath(path)
        self.show()

        # make sure there are no collisions
        while (self.collidingItems()):
            self.setPos(self.pos().x(), self.pos().y() + height + 2)

            # hide the item if out of the visible scope
            if (delta_h - offset <= self.pos().y() + height):
                self.hide()
                break
Ejemplo n.º 12
0
 def rebuildMonth( self ):
     """
     Rebuilds the current item in month mode.
     """
     scene = self.scene()
     if ( not scene ):
         return
     
     start_date  = self.dateStart()
     end_date    = self.dateEnd()
     min_date    = scene.minimumDate()
     max_date    = scene.maximumDate()
     
     # make sure our item is visible
     if ( not (min_date <= end_date and start_date <= max_date)):
         self.hide()
         self.setPath(QPainterPath())
         return
     
     # make sure we have valid range information
     if ( start_date < min_date ):
         start_date    = min_date
         start_inrange = False
     else:
         start_inrange = True
     
     if ( max_date < end_date ):
         end_date     = max_date
         end_inrange  = False
     else:
         end_inrange  = True
     
     start_rect = scene.dateRect(start_date)
     end_rect   = scene.dateRect(end_date)
     
     if ( not (start_rect.isValid() and end_rect.isValid()) ):
         self.hide()
         return
     
     # rebuild an all day path
     path = QPainterPath()
     self.setPos(0, 0)
     
     pad         = 2
     offset      = 18
     height      = 16
     
     min_left    = 10
     max_right   = scene.width() - 16
     delta_h     = start_rect.height()
     
     # draw the all day event
     if ( self.isAllDay() ):
         top   = start_rect.top()
         left  = start_rect.left() + 3
         first = start_inrange
         
         while ( top <= end_rect.top() ):
             sub_path  = QPainterPath()
             
             # calculate the end position
             if ( end_rect.top() - 2 <= top and end_inrange ):
                 at_end = True
                 right = end_rect.right() - pad
             else:
                 at_end = False
                 right = max_right
             
             if ( first ):
                 sub_path.moveTo(left, top + offset)
                 text_left = left + 4
             else:
                 sub_path.moveTo(left + height / 2, top + offset)
                 text_left = left + height / 2 + 2
             
             if ( at_end ):
                 sub_path.lineTo(right, top + offset)
                 sub_path.lineTo(right, top + offset + height)
             else:
                 sub_path.lineTo(right - height / 2, top + offset)
                 sub_path.lineTo(right, top + offset + height / 2)
                 sub_path.lineTo(right - height / 2, top + offset + height)
             
             if ( first ):
                 sub_path.lineTo(left, top + offset + height)
                 sub_path.lineTo(left, top + offset)
             else:
                 sub_path.lineTo(left + height / 2, top + offset + height)
                 sub_path.lineTo(left, top + offset + height / 2)
                 sub_path.lineTo(left + height / 2, top + offset)
             
             path.addPath(sub_path)
             
             data = (text_left,
                     top + offset + 1,
                     right,
                     height,
                     Qt.AlignLeft | Qt.AlignVCenter,
                     self.title())
             
             self._textData.append(data)
             
             left = min_left
             top += delta_h
             first = False
     else:
         text = '%s: (%s)' % (self.timeStart().toString('h:mm ap'), 
                              self.title())
         
         font   = scene.font()
         left   = start_rect.left() + 2 * pad
         top    = start_rect.top() + offset
         
         path.addText(left, top + height / 2, font, text)
     
     # setup the path for this item
     self.setPath(path)
     self.show()
     
     # make sure there are no collisions
     while ( self.collidingItems() ):
         self.setPos(self.pos().x(), self.pos().y() + height + 2)
         
         # hide the item if out of the visible scope
         if ( delta_h - offset <= self.pos().y() + height ):
             self.hide()
             break
def gen_font(font_configs, font_type = FONT_TYPES.font01, img_width = 1024, draw_outlines = False):
  img_height = HEIGHT_FACTOR
  
  seen_chars = []
  
  game_font = GameFont(width = img_width)
  painter = QPainter(game_font.trans)
  
  text_brush = QtGui.QBrush(QColor(255, 255, 255, 255))
  painter.setBrush(text_brush)
  
  outline_brush = QtGui.QBrush()
  outline_pen   = QtGui.QPen(QColor(255, 0, 0, 255), 1, style = Qt.Qt.DotLine, join = Qt.Qt.MiterJoin)
  
  x_pos = 0
  y_pos = 0
  
  line_height = LINE_HEIGHT[font_type]
  
  for config in font_configs:
    font = QFont(config.family, config.size, config.weight, italic = False)
    font.setKerning(False)
    metric = QFontMetrics(font)
    
    painter.setFont(font)
    painter.setRenderHint(QPainter.TextAntialiasing, True)
    painter.setRenderHint(QPainter.Antialiasing, True)
    
    text_pen = painter.pen()
    text_pen.setBrush(QColor(255, 255, 255, 255))
    text_pen.setWidthF(config.pen_size)
    text_pen.setCapStyle(config.pen_cap)
    text_pen.setJoinStyle(config.pen_join)
    text_pen.setStyle(Qt.Qt.SolidLine if config.use_pen else Qt.Qt.NoPen)
    painter.setPen(text_pen)
    
    for char in sorted(config.chars):
      
      if char in seen_chars:
        continue
      else:
        seen_chars.append(char)
      
      # If we want a character to represent something it's not.
      char_to_print = char
      
      if char in config.subs:
        char_to_print = config.subs[char]
      
      char_w = metric.width(char_to_print)
      
      if x_pos + char_w > img_width:
        x_pos = 0
        y_pos += line_height + config.y_margin
      
      if y_pos < 0:
        y_pos = 0
    
      if y_pos + line_height > MAX_HEIGHT:
        _LOGGER.warning("Ran out of vertical space. Generated font does not include all characters.")
        break
    
      game_font.font_data.data.append({'char': char, 'x': x_pos, 'y': y_pos, 'w': char_w, 'h': line_height, 'y_shift': config.y_shift})
      
      path = QPainterPath()
      path.addText(x_pos + config.x_offset, y_pos + metric.ascent() + config.y_offset, font, char_to_print)
      painter.drawPath(path)
      
      if draw_outlines:
        painter.setBrush(outline_brush)
        painter.setPen(outline_pen)
        painter.setRenderHint(QPainter.Antialiasing, False)
        
        painter.drawRect(x_pos, y_pos, char_w, line_height)
        
        painter.setRenderHint(QPainter.Antialiasing, True)
        painter.setBrush(text_brush)
        painter.setPen(text_pen)
      
      x_pos += char_w + config.x_margin
  
  painter.end()
  
  painter = QPainter(game_font.opaque)
  painter.drawImage(game_font.opaque.rect(), game_font.trans, game_font.trans.rect())
  painter.end()
  
  # Crop our images so they only take up as much space as they need.
  final_height = int(math.ceil(float(y_pos + line_height) / float(HEIGHT_FACTOR)) * HEIGHT_FACTOR)
  game_font.trans   = game_font.trans.copy(0, 0, img_width, final_height)
  game_font.opaque  = game_font.opaque.copy(0, 0, img_width, final_height)
  
  return game_font

# if __name__ == '__main__':
  
  # app = QtGui.QApplication(sys.argv)
  
  # chars = load_text(CHAR_LIST)
  # We can't have dupes, and why not put them in order while we're at it?
  # chars = sorted(make_unique(chars))
  
  # game_font = gen_font(chars)
  # game_font.save(SAVE_AS)

### EOF ###
Ejemplo n.º 14
0
 def createQuadViewStatusBar(self, xbackgroundColor, xforegroundColor, ybackgroundColor, yforegroundColor, zbackgroundColor, zforegroundColor, graybackgroundColor, grayforegroundColor):             
     
     self.xLabel = QLabel()
     self.xLabel.setAttribute(Qt.WA_TransparentForMouseEvents, True)
     self.addWidget(self.xLabel)
     pixmap = QPixmap(25*10, 25*10)
     pixmap.fill(xbackgroundColor)
     painter = QPainter()
     painter.begin(pixmap)
     pen = QPen(xforegroundColor)
     painter.setPen(pen)
     painter.setRenderHint(QPainter.Antialiasing)
     font = QFont()
     font.setBold(True)
     font.setPixelSize(25*10-30)
     path = QPainterPath()
     path.addText(QPointF(50, 25*10-50), font, "X")
     brush = QBrush(xforegroundColor)
     painter.setBrush(brush)
     painter.drawPath(path)        
     painter.setFont(font)
     painter.end()
     pixmap = pixmap.scaled(QSize(20,20),Qt.KeepAspectRatio, Qt.SmoothTransformation)
     self.xLabel.setPixmap(pixmap)
     self.xSpinBox = QSpinBox()
     self.xSpinBox.setAttribute(Qt.WA_TransparentForMouseEvents, True)
     self.xSpinBox.setEnabled(False)
     self.xSpinBox.setAlignment(Qt.AlignCenter)
     self.xSpinBox.setToolTip("xSpinBox")
     self.xSpinBox.setButtonSymbols(QAbstractSpinBox.NoButtons)
     self.xSpinBox.setMaximumHeight(20)
     self.xSpinBox.setMaximum(9999)
     font = self.xSpinBox.font()
     font.setPixelSize(14)
     self.xSpinBox.setFont(font)
     self.xSpinBox.setStyleSheet("QSpinBox { color: " + str(xforegroundColor.name()) + "; font: bold; background-color: " + str(xbackgroundColor.name()) + "; border:0;}")
     self.addWidget(self.xSpinBox)
     
     self.yLabel = QLabel()
     self.yLabel.setAttribute(Qt.WA_TransparentForMouseEvents, True)
     self.addWidget(self.yLabel)
     pixmap = QPixmap(25*10, 25*10)
     pixmap.fill(ybackgroundColor)
     painter = QPainter()
     painter.begin(pixmap)
     pen = QPen(yforegroundColor)
     painter.setPen(pen)
     painter.setRenderHint(QPainter.Antialiasing)
     font = QFont()
     font.setBold(True)
     font.setPixelSize(25*10-30)
     path = QPainterPath()
     path.addText(QPointF(50, 25*10-50), font, "Y")
     brush = QBrush(yforegroundColor)
     painter.setBrush(brush)
     painter.drawPath(path)        
     painter.setFont(font)
     painter.end()
     pixmap = pixmap.scaled(QSize(20,20),Qt.KeepAspectRatio, Qt.SmoothTransformation)
     self.yLabel.setPixmap(pixmap)
     self.ySpinBox = QSpinBox()
     self.ySpinBox.setAttribute(Qt.WA_TransparentForMouseEvents, True)
     self.ySpinBox.setEnabled(False)
     self.ySpinBox.setAlignment(Qt.AlignCenter)
     self.ySpinBox.setToolTip("ySpinBox")
     self.ySpinBox.setButtonSymbols(QAbstractSpinBox.NoButtons)
     self.ySpinBox.setMaximumHeight(20)
     self.ySpinBox.setMaximum(9999)
     font = self.ySpinBox.font()
     font.setPixelSize(14)
     self.ySpinBox.setFont(font)
     self.ySpinBox.setStyleSheet("QSpinBox { color: " + str(yforegroundColor.name()) + "; font: bold; background-color: " + str(ybackgroundColor.name()) + "; border:0;}")
     self.addWidget(self.ySpinBox)
     
     self.zLabel = QLabel()
     self.zLabel.setAttribute(Qt.WA_TransparentForMouseEvents, True)
     self.addWidget(self.zLabel)
     pixmap = QPixmap(25*10, 25*10)
     pixmap.fill(zbackgroundColor)
     painter = QPainter()
     painter.begin(pixmap)
     pen = QPen(zforegroundColor)
     painter.setPen(pen)
     painter.setRenderHint(QPainter.Antialiasing)
     font = QFont()
     font.setBold(True)
     font.setPixelSize(25*10-30)
     path = QPainterPath()
     path.addText(QPointF(50, 25*10-50), font, "Z")
     brush = QBrush(zforegroundColor)
     painter.setBrush(brush)
     painter.drawPath(path)        
     painter.setFont(font)
     painter.end()
     pixmap = pixmap.scaled(QSize(20,20),Qt.KeepAspectRatio, Qt.SmoothTransformation)
     self.zLabel.setPixmap(pixmap)
     self.zSpinBox = QSpinBox()
     self.zSpinBox.setAttribute(Qt.WA_TransparentForMouseEvents, True)
     self.zSpinBox.setEnabled(False)
     self.zSpinBox.setAlignment(Qt.AlignCenter)
     self.zSpinBox.setToolTip("zSpinBox")
     self.zSpinBox.setButtonSymbols(QAbstractSpinBox.NoButtons)
     self.zSpinBox.setMaximumHeight(20)
     self.zSpinBox.setMaximum(9999)
     font = self.zSpinBox.font()
     font.setPixelSize(14)
     self.zSpinBox.setFont(font)
     self.zSpinBox.setStyleSheet("QSpinBox { color: " + str(zforegroundColor.name()) + "; font: bold; background-color: " + str(zbackgroundColor.name()) + "; border:0;}")
     self.addWidget(self.zSpinBox)
     
     self.addSpacing(4)
     
     self.grayScaleLabel = QLabel()
     self.grayScaleLabel.setAttribute(Qt.WA_TransparentForMouseEvents, True)
     self.addWidget(self.grayScaleLabel)
     pixmap = QPixmap(610, 250)
     pixmap.fill(graybackgroundColor)
     painter = QPainter()
     painter.begin(pixmap)
     pen = QPen(grayforegroundColor)
     painter.setPen(pen)
     painter.setRenderHint(QPainter.Antialiasing)
     font = QFont()
     font.setBold(True)
     font.setPixelSize(25*10-30)
     path = QPainterPath()
     path.addText(QPointF(50, 25*10-50), font, "Gray")
     brush = QBrush(grayforegroundColor)
     painter.setBrush(brush)
     painter.drawPath(path)        
     painter.setFont(font)
     painter.end()
     pixmap = pixmap.scaled(QSize(61,20),Qt.KeepAspectRatio, Qt.SmoothTransformation)
     
     """
     self.grayScaleLabel.setPixmap(pixmap)
     self.grayScaleSpinBox = QSpinBox()
     self.grayScaleSpinBox.setAttribute(Qt.WA_TransparentForMouseEvents, True)
     self.grayScaleSpinBox.setEnabled(False)
     self.grayScaleSpinBox.setAlignment(Qt.AlignCenter)
     self.grayScaleSpinBox.setToolTip("grayscaleSpinBox")
     self.grayScaleSpinBox.setButtonSymbols(QAbstractSpinBox.NoButtons)
     self.grayScaleSpinBox.setMaximum(255)
     self.grayScaleSpinBox.setMaximumHeight(20)
     self.grayScaleSpinBox.setMaximum(255)
     font = self.grayScaleSpinBox.font()
     font.setPixelSize(14)
     self.grayScaleSpinBox.setFont(font)
     self.grayScaleSpinBox.setStyleSheet("QSpinBox { color: " + str(grayforegroundColor.name()) + "; font: bold; background-color: " + str(graybackgroundColor.name()) + "; border:0;}")
     self.addWidget(self.grayScaleSpinBox)
     """
     
     self.addStretch()
     
     self.positionCheckBox = QCheckBox()
     self.positionCheckBox.setChecked(True)
     self.positionCheckBox.setCheckable(True)
     self.positionCheckBox.setText("Position")
     self.addWidget(self.positionCheckBox)
     
     self.addSpacing(20)
     
     self.channelLabel = QLabel("Channel:")
     self.addWidget(self.channelLabel)
     
     self.channelSpinBox = QSpinBox()
     self.addWidget(self.channelSpinBox)
     self.addSpacing(20)
     
     self.timeLabel = QLabel("Time:")
     self.addWidget(self.timeLabel)
     
     self.timeSpinBox = QSpinBox()
     self.addWidget(self.timeSpinBox)