Exemplo n.º 1
0
 def write_xml(self, frames, file_name):
     for frame in frames:
         frame_elem = etree.Element("frame")
         frame_elem.set("duration", str(frame.duration))
         tile_count = 0
         row = etree.Element("row")
         row_text = ""
         for color in frame.tile_colors:
             tile_count += 1
             row_text += str(QColor.fromRgb(*color).name()[1:])
             if tile_count == self.width:
                 tile_count = 0
                 row.text = row_text
                 frame_elem.append(row)
                 row = etree.Element("row")
                 row_text = ""
         self.blm_root.append(frame_elem)
     tree = etree.ElementTree(self.blm_root)
     tree.write(file_name)
Exemplo n.º 2
0
def parse_color(match):
    if match.group("hexcolor"):
        return QColor(match.group("hexcolor"))
    elif match.group("rgbfunc"):
        return QColor.fromRgb(int(match.group("r")), int(match.group("g")), int(match.group("b")))
Exemplo n.º 3
0
# the character prepended to tag values when searching
TAG_QUERY_CHAR = '#'

# unsafe filename characters, being pretty strict
UNSAFE_CHARS = '<>:"/\|?*#'

# the unicode end of text character
# http://www.fileformat.info/info/unicode/char/0003/index.htm
# This signifies where the note content ends and any metadata begins
END_OF_TEXT = '\u0003'  # Only applies to pre 0.2 versions

# the YAML bracket that splits the files metadata
YAML_BRACKET = '---'

# colors
MOTOME_BLUE = QColor.fromRgb(38, 87, 127, a=255)
MOTOME_LTBLUE = QColor.fromRgb(145, 177, 203, a=255)
MOTOME_GRYBLUE = QColor.fromRgb(89, 122, 148, a=255)
MOTOME_BRTBLUE = QColor.fromRgb(61, 139, 203, a=255)
HIGHLIGHT_COLOR = QColor.fromRgb(255, 255, 153, a=255)

# diff status template, to show when at current note record
STATUS_TEMPLATE = """
<html>
    <body>
        <p>
            {notename}
        </p>
        <p>
            This is the latest version.
        </p>
Exemplo n.º 4
0
 def testRepr(self):
     c = QColor.fromRgb(1, 2, 3, 4)
     s = c.spec()
     self.assertEqual(repr(s), repr(QColor.Rgb))
Exemplo n.º 5
0
 def Gray(self):
     return color_type(htmlCol="#777",qbrush=QBrush(QColor.fromRgb(0x77,0x77,0x77)))
Exemplo n.º 6
0
 def Blue(self):
     return color_type(htmlCol="#00f",qbrush=QBrush(QColor.fromRgb(0,0,0xff)))
Exemplo n.º 7
0
 def Green(self):
     return color_type(htmlCol="#070",qbrush=QBrush(QColor.fromRgb(0,0x77,0)))
Exemplo n.º 8
0
 def Red(self):
     return color_type(htmlCol="#000",qbrush=QBrush(QColor.fromRgb(0xff,0,0)))
Exemplo n.º 9
0
 def Black(self):
     return color_type(htmlCol="#000", qbrush=QBrush(QColor.fromRgb(0,0,0)))
Exemplo n.º 10
0
def rgb_color(rgb):
    return QColor.fromRgb(rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff)
Exemplo n.º 11
0
# the character prepended to tag values when searching
TAG_QUERY_CHAR = '#'

# unsafe filename characters, being pretty strict
UNSAFE_CHARS = '<>:"/\|?*#'

# the unicode end of text character
# http://www.fileformat.info/info/unicode/char/0003/index.htm
# This signifies where the note content ends and any metadata begins
END_OF_TEXT = '\u0003'  # Only applies to pre 0.2 versions

# the YAML bracket that splits the files metadata
YAML_BRACKET = '---'

# colors
MOTOME_BLUE = QColor.fromRgb(38, 87, 127, a=255)
MOTOME_LTBLUE = QColor.fromRgb(145, 177, 203, a=255)
MOTOME_GRYBLUE = QColor.fromRgb(89, 122, 148, a=255)
MOTOME_BRTBLUE = QColor.fromRgb(61, 139, 203, a=255)
HIGHLIGHT_COLOR = QColor.fromRgb(255, 255, 153, a=255)

# diff status template, to show when at current note record
STATUS_TEMPLATE = """
<html>
    <body>
        <p>
            {notename}
        </p>
        <p>
            This is the latest version.
        </p>
Exemplo n.º 12
0
 def __init__(self):
     QGLWidget.__init__(self)
     self.camera = Camera(self)
     self.mouse = Mouse(self)
     self.clear_color = QColor.fromRgb(255, 255, 255)
Exemplo n.º 13
0
 def testRepr(self):
     c = QColor.fromRgb(1, 2, 3, 4)
     s = c.spec()
     self.assertEqual(repr(s), repr(QColor.Rgb))
Exemplo n.º 14
0
 def mouseMoveEvent(self, event):
     pos = event.globalPos()
     rgb = self.image.pixel(pos)
     color = QColor.fromRgb(rgb)
     if self.owner:
         self.owner.setColor(color)