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)
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")))
# 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>
def testRepr(self): c = QColor.fromRgb(1, 2, 3, 4) s = c.spec() self.assertEqual(repr(s), repr(QColor.Rgb))
def Gray(self): return color_type(htmlCol="#777",qbrush=QBrush(QColor.fromRgb(0x77,0x77,0x77)))
def Blue(self): return color_type(htmlCol="#00f",qbrush=QBrush(QColor.fromRgb(0,0,0xff)))
def Green(self): return color_type(htmlCol="#070",qbrush=QBrush(QColor.fromRgb(0,0x77,0)))
def Red(self): return color_type(htmlCol="#000",qbrush=QBrush(QColor.fromRgb(0xff,0,0)))
def Black(self): return color_type(htmlCol="#000", qbrush=QBrush(QColor.fromRgb(0,0,0)))
def rgb_color(rgb): return QColor.fromRgb(rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff)
# 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>
def __init__(self): QGLWidget.__init__(self) self.camera = Camera(self) self.mouse = Mouse(self) self.clear_color = QColor.fromRgb(255, 255, 255)
def testRepr(self): c = QColor.fromRgb(1, 2, 3, 4) s = c.spec() self.assertEqual(repr(s), repr(QColor.Rgb))
def mouseMoveEvent(self, event): pos = event.globalPos() rgb = self.image.pixel(pos) color = QColor.fromRgb(rgb) if self.owner: self.owner.setColor(color)