def draw(self, context): if len(self.extended_buffer.get_text()) == 0: utils.draw_thought_outline( context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_NORMAL ) else: utils.draw_thought_outline( context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_EXTENDED_CONTENT, ) cwidth = context.get_line_width() context.set_line_width(2) if len(self.points) > 0: for p in self.points: if p.style == STYLE_BEGIN: context.move_to(p.x, p.y) r, g, b = utils.gtk_to_cairo_color(self.foreground_color) context.set_source_rgb(r, g, b) elif p.style == STYLE_END: context.line_to(p.x, p.y) context.stroke() else: context.line_to(p.x, p.y) context.set_line_width(cwidth) context.stroke() return
def draw(self, context): if len(self.extended_buffer.get_text()) == 0: utils.draw_thought_outline(context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_NORMAL) else: utils.draw_thought_outline(context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_EXTENDED_CONTENT) cwidth = context.get_line_width() context.set_line_width(2) if len(self.points) > 0: for p in self.points: if p.style == STYLE_BEGIN: context.move_to(p.x, p.y) r, g, b = utils.gtk_to_cairo_color(self.foreground_color) context.set_source_rgb(r, g, b) elif p.style == STYLE_END: context.line_to(p.x, p.y) context.stroke() else: context.line_to(p.x, p.y) context.set_line_width(cwidth) context.stroke() return
def draw (self, context): if len (self.extended_buffer.get_text()) == 0: utils.draw_thought_outline (context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_NORMAL) else: utils.draw_thought_outline (context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_EXTENDED_CONTENT)
def draw(self, context): if len(self.extended_buffer.get_text()) == 0: utils.draw_thought_outline(context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_NORMAL) else: utils.draw_thought_outline(context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_EXTENDED_CONTENT)
def draw (self, context): if len (self.extended_buffer.get_text()) == 0: utils.draw_thought_outline (context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_NORMAL) else: utils.draw_thought_outline (context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_EXTENDED_CONTENT) if self.pic: context.set_source_pixbuf (self.pic, self.pic_location[0], self.pic_location[1]) context.rectangle (self.pic_location[0], self.pic_location[1], self.width, self.height) context.fill () context.set_source_rgb (0,0,0)
def draw(self, context): if not self.layout: self.recalc_edges() if not self.editing: # We should draw the entire bounding box around ourselves # We should also have our coordinates figured out. If not, scream! if not self.ul or not self.lr: print "Warning: Trying to draw unfinished box " + str( self.identity) + ". Aborting." return style = utils.STYLE_EXTENDED_CONTENT if len(self.extended_buffer.get_text()) == 0: style = utils.STYLE_NORMAL utils.draw_thought_outline(context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, style) else: ux, uy = self.ul if prefs.get_direction() == gtk.TEXT_DIR_LTR: context.move_to(ux, uy + 5) context.line_to(ux, uy) context.line_to(ux + 5, uy) else: lx = self.lr[0] context.move_to(lx, uy + 5) context.line_to(lx, uy) context.line_to(lx - 5, uy) context.stroke() textx, texty = (self.text_location[0], self.text_location[1]) if (self.foreground_color): r, g, b = utils.gtk_to_cairo_color(self.foreground_color) else: r, g, b = utils.default_colors["text"] context.set_source_rgb(r, g, b) context.move_to(textx, texty) context.show_layout(self.layout) if self.editing: if self.preedit: strong, weak = self.layout.get_cursor_pos(self.index + self.preedit[2]) else: strong, weak = self.layout.get_cursor_pos(self.index) (startx, starty, curx, cury) = strong startx /= pango.SCALE starty /= pango.SCALE curx /= pango.SCALE cury /= pango.SCALE context.move_to(textx + startx, texty + starty) context.line_to(textx + startx, texty + starty + cury) context.stroke() context.set_source_rgb(0, 0, 0) context.stroke()
def draw (self, context): if not self.layout: self.recalc_edges () if not self.editing: # We should draw the entire bounding box around ourselves # We should also have our coordinates figured out. If not, scream! if not self.ul or not self.lr: print "Warning: Trying to draw unfinished box "+str(self.identity)+". Aborting." return style = utils.STYLE_EXTENDED_CONTENT if len (self.extended_buffer.get_text()) == 0: style = utils.STYLE_NORMAL utils.draw_thought_outline (context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, style) else: ux, uy = self.ul if prefs.get_direction() == gtk.TEXT_DIR_LTR: context.move_to (ux, uy+5) context.line_to (ux, uy) context.line_to (ux+5, uy) else: lx = self.lr[0] context.move_to (lx, uy+5) context.line_to (lx, uy) context.line_to (lx-5, uy) context.stroke () textx, texty = (self.text_location[0], self.text_location[1]) if (self.foreground_color): r, g, b = utils.gtk_to_cairo_color(self.foreground_color) else: r, g ,b = utils.default_colors["text"] context.set_source_rgb (r, g, b) context.move_to (textx, texty) context.show_layout (self.layout) if self.editing: if self.preedit: strong, weak = self.layout.get_cursor_pos (self.index + self.preedit[2]) else: strong, weak = self.layout.get_cursor_pos (self.index) (startx, starty, curx,cury) = strong startx /= pango.SCALE starty /= pango.SCALE curx /= pango.SCALE cury /= pango.SCALE context.move_to (textx + startx, texty + starty) context.line_to (textx + startx, texty + starty + cury) context.stroke () context.set_source_rgb (0,0,0) context.stroke ()
def draw(self, context): if len(self.extended_buffer.get_text()) == 0: utils.draw_thought_outline(context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_NORMAL) else: utils.draw_thought_outline(context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_EXTENDED_CONTENT) if self.pic: context.set_source_pixbuf(self.pic, self.pic_location[0], self.pic_location[1]) context.rectangle(self.pic_location[0], self.pic_location[1], self.width, self.height) context.fill() context.set_source_rgb(0, 0, 0)