bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def do_lower_child(self, child, sibling=None): if child not in self._children: raise Exception("Actor %s is not a child of %s" % (child, self)) if sibling: if sibling not in self._children: raise Exception("Actor %s is not a child of %s" % (sibling, self)) sibling_index = self._children.index(sibling) child_index = sel... | def do_lower_child(self, child, sibling=None): if child not in self._children: raise Exception("Actor %s is not a child of %s" % (child, self)) if sibling: if sibling not in self._children: raise Exception("Actor %s is not a child of %s" % (sibling, self)) sibling_index = self._children.index(sibling) child_index = sel... | 445,100 |
def __init__(self, horizontal=True, spacing=0.0, border=0.0, bg_ignore_allocation_box=False): clutter.Actor.__init__(self) self.elements = list() self.background = None self.spacing = spacing self.border = border if horizontal == True: self._horizontal = True else: self._horizontal = False if bg_ignore_allocation_box =... | def __init__(self, horizontal=True, spacing=0.0, border=0.0, bg_ignore_allocation_box=True): clutter.Actor.__init__(self) self.elements = list() self.background = None self.spacing = spacing self.border = border if horizontal == True: self._horizontal = True else: self._horizontal = False if bg_ignore_allocation_box ==... | 445,101 |
def do_get_preferred_width(self, for_height): inner_height = for_height - 2*self.border preferred_width = 0 if self._horizontal is False: #find size available for resizable elements resizable_elements = list() resizable_height = inner_height for element in self.elements: if element.get('resizable', 0) != 0: if element[... | def do_get_preferred_width(self, for_height): inner_height = for_height - 2*self.border preferred_width = 0 if self._horizontal is False: #find size available for resizable elements resizable_elements = list() resizable_height = inner_height for element in self.elements: if element.get('resizable', 0) != 0: if element[... | 445,102 |
def do_get_preferred_height(self, for_width): inner_width = for_width - 2*self.border preferred_height = 0 if self._horizontal is True: #find size available for resizable elements resizable_elements = list() resizable_width = inner_width for element in self.elements: if element.get('resizable', 0) != 0: if element['res... | def do_get_preferred_height(self, for_width): inner_width = for_width - 2*self.border preferred_height = 0 if self._horizontal is True: #find size available for resizable elements resizable_elements = list() resizable_width = inner_width for element in self.elements: if element.get('resizable', 0) != 0: if element['res... | 445,103 |
def do_allocate(self, box, flags): main_width = box.x2 - box.x1 main_height = box.y2 - box.y1 inner_width = main_width - 2*self.border inner_height = main_height - 2*self.border #find size available for resizable elements resizable_elements = list() resizable_width = inner_width resizable_height = inner_height for ele... | def do_allocate(self, box, flags): main_width = box.x2 - box.x1 main_height = box.y2 - box.y1 inner_width = main_width - 2*self.border inner_height = main_height - 2*self.border #find size available for resizable elements resizable_elements = list() resizable_width = inner_width resizable_height = inner_height for ele... | 445,104 |
def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | def __paint_rectangle(self, width, height, color, border_color=None): radius_size = 2*self._radius if radius_size <= width and radius_size <= height: radius = self._radius elif radius_size > width and radius_size <= height: radius = width / 2.0 elif radius_size <= width and radius_size > height: radius = height / 2.0 e... | 445,105 |
def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | 445,106 |
def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | 445,107 |
def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, width -... | 445,108 |
def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | 445,109 |
def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | def __paint_rectangle(self, width, height, color, border_color=None): if border_color is not None and self._border_width > 0.0: cogl.path_round_rectangle(0, 0, width, height, self._radius, 1) cogl.path_close() cogl.set_source_color(border_color) cogl.path_fill() w = self._border_width cogl.path_round_rectangle(w, w, w... | 445,110 |
def __init__(self, min, max, default, increment=1, text=None, factor=None): Box.__init__(self, horizontal=True, spacing=5, border=5) | def __init__(self, min, max, default, increment=1, text=None, factor=None): Box.__init__(self, horizontal=True, spacing=5, border=5) | 445,111 |
def update(self): if self.factor is not None: value_to_display = float(self.value * self.factor) else: value_to_display = float(self.value) decimal = round(float(value_to_display) - int(value_to_display), 1) if decimal == 0.0: self.value_btn.props.text = str(int(value_to_display)) elif decimal == 1.0: self.value_btn.pr... | def update(self): self.update_rounded_value() self.emit('value_updated', self.value) | 445,112 |
def set_line_alignment(self, alignement): if alignement == 'center': self.label.set_line_alignment(1) elif alignement == 'right': self.label.set_line_alignment(2) elif alignement == 'left': self.label.set_line_alignment(3) | def set_line_alignment(self, alignment): if alignment == 'center': self._alignment = 'center' self.label.set_line_alignment(1) elif alignement == 'right': self.label.set_line_alignment(2) elif alignement == 'left': self.label.set_line_alignment(3) | 445,113 |
def set_line_alignment(self, alignement): if alignement == 'center': self.label.set_line_alignment(1) elif alignement == 'right': self.label.set_line_alignment(2) elif alignement == 'left': self.label.set_line_alignment(3) | def set_line_alignment(self, alignement): if alignement == 'center': self.label.set_line_alignment(1) elif alignment == 'right': self._alignment = 'right' self.label.set_line_alignment(2) elif alignement == 'left': self.label.set_line_alignment(3) | 445,114 |
def set_line_alignment(self, alignement): if alignement == 'center': self.label.set_line_alignment(1) elif alignement == 'right': self.label.set_line_alignment(2) elif alignement == 'left': self.label.set_line_alignment(3) | def set_line_alignment(self, alignement): if alignement == 'center': self.label.set_line_alignment(1) elif alignement == 'right': self.label.set_line_alignment(2) elif alignment == 'left': self._alignment = 'left' self.label.set_line_alignment(3) | 445,115 |
def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding rect_box = clutter.ActorBox() rect_box.x1 = 0 rect_box.y1 = 0 rect_box.x2 = btn_width rect_box.y2 = btn_height self.rect.allocate(rect_box, fla... | def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding rect_box = clutter.ActorBox() rect_box.x1 = 0 rect_box.y1 = 0 rect_box.x2 = btn_width rect_box.y2 = btn_height self.rect.allocate(rect_box, fla... | 445,116 |
def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding rect_box = clutter.ActorBox() rect_box.x1 = 0 rect_box.y1 = 0 rect_box.x2 = btn_width rect_box.y2 = btn_height self.rect.allocate(rect_box, fla... | def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding rect_box = clutter.ActorBox() rect_box.x1 = 0 rect_box.y1 = 0 rect_box.x2 = btn_width rect_box.y2 = btn_height self.rect.allocate(rect_box, fla... | 445,117 |
def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding rect_box = clutter.ActorBox() rect_box.x1 = 0 rect_box.y1 = 0 rect_box.x2 = btn_width rect_box.y2 = btn_height self.rect.allocate(rect_box, fla... | def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding rect_box = clutter.ActorBox() rect_box.x1 = 0 rect_box.y1 = 0 rect_box.x2 = btn_width rect_box.y2 = btn_height self.rect.allocate(rect_box, fla... | 445,118 |
def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding rect_box = clutter.ActorBox() rect_box.x1 = 0 rect_box.y1 = 0 rect_box.x2 = btn_width rect_box.y2 = btn_height self.rect.allocate(rect_box, fla... | def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding rect_box = clutter.ActorBox() rect_box.x1 = 0 rect_box.y1 = 0 rect_box.x2 = btn_width rect_box.y2 = btn_height self.rect.allocate(rect_box, fla... | 445,119 |
def set_inner_color(self, color): if self.rect is not None: self.rect.set_color(color) else: self.rect.set_color(color) | def set_inner_color(self, color): if self.rect is not None: self.rect.set_color(color) | 445,120 |
def set_icon_allocate(self, boolean): if boolean and not self._icon_allocate: self._icon_allocate = True self.icon.show() self.queue_relayout() elif not boolean and self._icon_allocate: self._icon_allocate = False self.icon.hide() self.queue_relayout() | def set_icon_allocate(self, boolean): if boolean and not self._icon_allocate: self._icon_allocate = True if self.has_icon(): self.icon.show() self.queue_relayout() elif not boolean and self._icon_allocate: self._icon_allocate = False self.icon.hide() self.queue_relayout() | 445,121 |
def add_option(self, name, hname, icon_path=None): new_option = OptionLine(name, hname, padding=(self._padding.x, self._padding.y), spacing=self._spacing.x, icon_path=icon_path, icon_height=self.icon_height, enable_background=False, font=self.font, font_color=self.font_color, color=self.option_color, border_color='#000... | def add_option(self, name, hname, icon_path=None): new_option = OptionLine(name, hname, padding=(self._padding.x, self._padding.y), spacing=self._spacing.x, icon_path=icon_path, icon_height=self.icon_height, enable_background=False, font=self.font, font_color=self.font_color, color=self.option_color, border_color='#000... | 445,122 |
def do_destroy(self): self.unparent() if hasattr(self, '_hidder'): if self._hidder is not None: self._hidder.unparent() self._hidder.destroy() self._hidder = None if hasattr(self, '_background'): if self._background is not None: self._background.unparent() self._background.destroy() self._background = None if hasattr(s... | def do_destroy(self): self.unparent() if hasattr(self, '_hidder'): if self._hidder is not None: self._hidder.unparent() self._hidder.destroy() self._hidder = None if hasattr(self, '_background'): if self._background is not None: self._background.unparent() self._background.destroy() self._background = None if hasattr(s... | 445,123 |
def set_inner_color(self, color): self.rect.set_color(color) | def set_inner_color(self, color): if self.rect is not None: self.rect.set_color(color) | 445,124 |
def do_allocate(self, box, flags): width = box.x2 - box.x1 height = box.y2 - box.y1 inner_width = width - 2*self._margin.x - 2*self._padding.x inner_height = height - 2*self._margin.y - 2*self._padding.y columns_widths = [0 for k in range(len(self._columns))] rows_heights = [0 for k in range(len(self._rows))] # find ... | def do_allocate(self, box, flags): width = box.x2 - box.x1 height = box.y2 - box.y1 inner_width = width - 2*self._margin.x - 2*self._padding.x inner_height = height - 2*self._margin.y - 2*self._padding.y columns_widths = [0 for k in range(len(self._columns))] rows_heights = [0 for k in range(len(self._rows))] # find ... | 445,125 |
def do_allocate(self, box, flags): width = box.x2 - box.x1 height = box.y2 - box.y1 inner_width = width - 2*self._margin.x - 2*self._padding.x inner_height = height - 2*self._margin.y - 2*self._padding.y columns_widths = [0 for k in range(len(self._columns))] rows_heights = [0 for k in range(len(self._rows))] # find ... | def do_allocate(self, box, flags): width = box.x2 - box.x1 height = box.y2 - box.y1 inner_width = width - 2*self._margin.x - 2*self._padding.x inner_height = height - 2*self._margin.y - 2*self._padding.y columns_widths = [0 for k in range(len(self._columns))] rows_heights = [0 for k in range(len(self._rows))] # find ... | 445,126 |
def do_allocate(self, box, flags): width = box.x2 - box.x1 height = box.y2 - box.y1 inner_width = width - 2*self._margin.x - 2*self._padding.x inner_height = height - 2*self._margin.y - 2*self._padding.y columns_widths = [0 for k in range(len(self._columns))] rows_heights = [0 for k in range(len(self._rows))] # find ... | def do_allocate(self, box, flags): width = box.x2 - box.x1 height = box.y2 - box.y1 inner_width = width - 2*self._margin.x - 2*self._padding.x inner_height = height - 2*self._margin.y - 2*self._padding.y columns_widths = [0 for k in range(len(self._columns))] rows_heights = [0 for k in range(len(self._rows))] # find ... | 445,127 |
def do_allocate(self, box, flags): width = box.x2 - box.x1 height = box.y2 - box.y1 inner_width = width - 2*self._margin.x - 2*self._padding.x inner_height = height - 2*self._margin.y - 2*self._padding.y columns_widths = [0 for k in range(len(self._columns))] rows_heights = [0 for k in range(len(self._rows))] # find ... | def do_allocate(self, box, flags): width = box.x2 - box.x1 height = box.y2 - box.y1 inner_width = width - 2*self._margin.x - 2*self._padding.x inner_height = height - 2*self._margin.y - 2*self._padding.y columns_widths = [0 for k in range(len(self._columns))] rows_heights = [0 for k in range(len(self._rows))] # find ... | 445,128 |
def _allocate_rect(self, base_x, base_y, width, height, flags): rect_box = clutter.ActorBox() rect_box.x1 = 0 rect_box.y1 = 0 rect_box.x2 = width rect_box.y2 = height self.rect.allocate(rect_box, flags) | def _allocate_rect(self, base_x, base_y, width, height, flags): rect_box = clutter.ActorBox() rect_box.x1 = base_x + 0 rect_box.y1 = base_y + 0 rect_box.x2 = base_x + width rect_box.y2 = base_y + height self.rect.allocate(rect_box, flags) | 445,129 |
def do_paint(self): (x1, y1, x2, y2) = self.get_allocation_box() | def do_paint(self): (x1, y1, x2, y2) = self.get_allocation_box() | 445,130 |
def do_paint(self): (x1, y1, x2, y2) = self.get_allocation_box() | def do_paint(self): (x1, y1, x2, y2) = self.get_allocation_box() | 445,131 |
def callback_position(self, source, position): self.clipper_position=position self.queue_relayout() | def callback_position(self, source, position): self.clipper_position = position self.queue_relayout() | 445,132 |
def do_allocate (self, box, flags): box_width = box.x2 - box.x1 box_height = box.y2 - box.y1 if self.expand == True: position = self.clipper_position * (self.actor.get_preferred_size()[3] - box_height) self.actor.set_anchor_point(0,position) self.actor.set_clip(0,position,box_width,box_height) objbox = clutter.ActorBo... | def do_allocate (self, box, flags): box_width = box.x2 - box.x1 box_height = box.y2 - box.y1 if self.expand == True: position = self.clipper_position * (self.actor.get_preferred_size()[3] - box_height) self.actor.set_anchor_point(0, int(position)) self.actor.set_clip(0, int(position), box_width, box_height) objbox = c... | 445,133 |
def do_allocate (self, box, flags): box_width = box.x2 - box.x1 box_height = box.y2 - box.y1 if self.expand == True: position = self.clipper_position * (self.actor.get_preferred_size()[3] - box_height) self.actor.set_anchor_point(0,position) self.actor.set_clip(0,position,box_width,box_height) objbox = clutter.ActorBo... | def do_allocate (self, box, flags): box_width = box.x2 - box.x1 box_height = box.y2 - box.y1 if self.expand == True: position = self.clipper_position * (self.actor.get_preferred_size()[3] - box_height) self.actor.set_anchor_point(0, int(position)) self.actor.set_clip(0, int(position), box_width, box_height) objbox = c... | 445,134 |
def do_foreach(self, func, data=None): children = (self.actor,) for child in children : func(child, data) | def do_foreach(self, func, data=None): func(self.actor, data) | 445,135 |
def do_paint(self): children = (self.actor,) for child in children : child.paint() | def do_paint(self): children = (self.actor,) for child in children : child.paint() | 445,136 |
def do_pick(self, color): children = (self.actor,) for child in children : child.paint() | def do_pick(self, color): children = (self.actor,) for child in children : child.paint() | 445,137 |
def do_destroy(self): self.unparent() if hasattr(self, 'title_actor'): if self.title_actor: self.title_actor.unparent() self.title_actor.destroy() self.title_actor = None if hasattr(self, '_default_title_actor'): if self.default_title_actor: self.default_title_actor.unparent() self.default_title_actor.destroy() self.de... | def do_destroy(self): self.unparent() if hasattr(self, 'title_actor'): if self.title_actor: self.title_actor.unparent() self.title_actor.destroy() self.title_actor = None if hasattr(self, 'default_title_actor'): if self.default_title_actor: self.default_title_actor.unparent() self.default_title_actor.destroy() self.def... | 445,138 |
def on_scroll_move(self, source, event): if self.h == False : if self.last_event_y is None: return clutter.grab_pointer(self.scroller) self.last_event_y = event.y - self.get_transformed_position()[1] - self.padding scroller_position = event.y - self.get_transformed_position()[1] - self.padding self.scroller_position_pe... | def on_scroll_move(self, source, event): if self.h == False : if self.last_event_y is None: return clutter.grab_pointer(self.scroller) self.last_event_y = event.y - self.get_transformed_position()[1] - self.padding - self.scroller_height/2 scroller_position = event.y - self.get_transformed_position()[1] - self.padding ... | 445,139 |
def on_scroll_move(self, source, event): if self.h == False : if self.last_event_y is None: return clutter.grab_pointer(self.scroller) self.last_event_y = event.y - self.get_transformed_position()[1] - self.padding scroller_position = event.y - self.get_transformed_position()[1] - self.padding self.scroller_position_pe... | def on_scroll_move(self, source, event): if self.h == False : if self.last_event_y is None: return clutter.grab_pointer(self.scroller) self.last_event_y = event.y - self.get_transformed_position()[1] - self.padding scroller_position = event.y - self.get_transformed_position()[1] - self.padding self.scroller_position_pe... | 445,140 |
def __init__(self, actor=None, padding=0, spacing=0): HBox.__init__(self, spacing=spacing, padding=padding) self._max_width = 0 self._max_height = 0 self._actor = actor if self._actor: self.add_element(self._actor, 'actor', expand=True, resizable=1.0) self._scrollbar = Scrollbar() self._clipper = Clipper(expand=True) ... | def def on_show_scrolled(self, panel, event): if not self.contents_have_been_shown: self.contents_have_been_shown = True else: self._actor.props.visible = self.props.visible __init__(self, def on_show_scrolled(self, panel, event): if not self.contents_have_been_shown: self.contents_have_been_shown = True else: self._a... | 445,141 |
def do_get_preferred_width(self, for_height): preferred = max(self._auto_scroll.get_preferred_width(for_height)[1], self._selected_option.get_preferred_width(for_height)[1]) return preferred, preferred | def do_get_preferred_width(self, for_height): preferred = self._selected_option.get_preferred_width(for_height)[1] return preferred, preferred | 445,142 |
def get_safe_value(self, value): if value > self.max*self.factor: value = self.max elif value < self.min*self.factor: value = self.min return value | def get_safe_value(self, value): if value > self.max*self.factor: value = int(self.max*self.factor) elif value < self.min*self.factor: value = self.min return value | 445,143 |
def get_safe_value(self, value): if value > self.max*self.factor: value = self.max elif value < self.min*self.factor: value = self.min return value | def get_safe_value(self, value): if value > self.max*self.factor: value = self.max elif value < self.min*self.factor: value = int(self.min*self.factor) return value | 445,144 |
def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding # round rect rbox = clutter.ActorBox() rbox.x1 = 0 rbox.y1 = 0 rbox.x2 = btn_width rbox.y2 = btn_height self.rect.allocate(rbox, flags) # labe... | def do_allocate(self, box, flags): btn_width = box.x2 - box.x1 btn_height = box.y2 - box.y1 inner_width = btn_width - 2*self.padding inner_height = btn_height - 2*self.padding # round rect rbox = clutter.ActorBox() rbox.x1 = 0 rbox.y1 = 0 rbox.x2 = btn_width rbox.y2 = btn_height self.rect.allocate(rbox, flags) # labe... | 445,145 |
def _allocate_label(self, base_x, base_y, width, height, flags): inner_width = width - 2*self.padding inner_height = height - 2*self.padding self.label.set_text(self._text) self._multiline = False if self._line_wrap: if self.label.get_preferred_height(for_width = inner_width)[1] > self.label.get_preferred_size()[3]: i... | def _allocate_label(self, base_x, base_y, width, height, flags): inner_width = width - 2*self.padding inner_height = height - 2*self.padding self.label.set_text(self._text) self._multiline = False if self._line_wrap: if self.label.get_preferred_height(for_width = inner_width)[1] > self.label.get_preferred_size()[3]: i... | 445,146 |
def _allocate_label(self, base_x, base_y, width, height, flags): inner_width = width - 2*self.padding inner_height = height - 2*self.padding self.label.set_text(self._text) self._multiline = False if self._line_wrap: if self.label.get_preferred_height(for_width = inner_width)[1] > self.label.get_preferred_size()[3]: i... | def _allocate_label(self, base_x, base_y, width, height, flags): inner_width = width - 2*self.padding inner_height = height - 2*self.padding self.label.set_text(self._text) self._multiline = False if self._line_wrap: if self.label.get_preferred_height(for_width = inner_width)[1] > self.label.get_preferred_size()[3]: i... | 445,147 |
def _allocate_label(self, base_x, base_y, width, height, flags): inner_width = width - 2*self.padding inner_height = height - 2*self.padding self.label.set_text(self._text) self._multiline = False if self._line_wrap: if self.label.get_preferred_height(for_width = inner_width)[1] > self.label.get_preferred_size()[3]: i... | def _allocate_label(self, base_x, base_y, width, height, flags): inner_width = width - 2*self.padding inner_height = height - 2*self.padding self.label.set_text(self._text) self._multiline = False if self._line_wrap: if self.label.get_preferred_height(for_width = inner_width)[1] > self.label.get_preferred_size()[3]: i... | 445,148 |
def _allocate_rect(self, base_x, base_y, width, height, flags): rect_box = clutter.ActorBox() rect_box.x1 = base_x + 0 rect_box.y1 = base_y + 0 rect_box.x2 = base_x + width rect_box.y2 = base_y + height self.rect.allocate(rect_box, flags) | def _allocate_rect(self, base_x, base_y, width, height, flags): rect_box = clutter.ActorBox() rect_box.x1 = base_x rect_box.y1 = base_y rect_box.x2 = base_x + width rect_box.y2 = base_y + height self.rect.allocate(rect_box, flags) | 445,149 |
def __init__(self, align='center', border=0, expand=False, keep_ratio=True, pick_enabled=True): clutter.Actor.__init__(self) if align == 'top_left': self.align = 'top_left' elif align == 'top': self.align = 'top' elif align == 'top_right': self.align = 'top_right' elif align == 'left': self.align = 'left' elif align ==... | def __init__(self, align='center', border=0, expand=False, keep_ratio=True, pick_enabled=False): clutter.Actor.__init__(self) if align == 'top_left': self.align = 'top_left' elif align == 'top': self.align = 'top' elif align == 'top_right': self.align = 'top_right' elif align == 'left': self.align = 'left' elif align =... | 445,150 |
def do_pick(self, color): if self.pick_enabled == False: self.element.do_pick(color) else: clutter.Actor.do_pick(self, color) | def do_pick(self, color): if self.pick_enabled: self.do_paint() else: clutter.Actor.do_pick(self, color) | 445,151 |
def do_allocate(self, box, flags): main_width = box.x2 - box.x1 main_height = box.y2 - box.y1 inner_width = main_width - 2*self.border inner_height = main_height - 2*self.border #box background if self.background: bgbox = clutter.ActorBox() bgbox.x1 = 0 bgbox.y1 = 0 bgbox.x2 = main_width bgbox.y2 = main_height self.ba... | def do_allocate(self, box, flags): main_width = box.x2 - box.x1 main_height = box.y2 - box.y1 inner_width = main_width - 2*self.border inner_height = main_height - 2*self.border #box background if self.background: bgbox = clutter.ActorBox() bgbox.x1 = 0 bgbox.y1 = 0 bgbox.x2 = main_width bgbox.y2 = main_height self.ba... | 445,152 |
def get_safe_value(self, value): if value > self.max: value = self.max elif value < self.min: value = self.min return value | def get_safe_value(self, value): if value > self.max*self.factor: value = self.max elif value < self.min: value = self.min return value | 445,153 |
def get_safe_value(self, value): if value > self.max: value = self.max elif value < self.min: value = self.min return value | def get_safe_value(self, value): if value > self.max: value = self.max elif value < self.min*self.factor: value = self.min return value | 445,154 |
def select_option(self, option_name, silent=True): for option in self.options: if option.name == option_name and option != self.selected: last_selection = self.selected self.selected.hide_background() self.selected.set_icon(self.selected_icon) self.selected = option self.selected.show_background() if self.opened == Tru... | def select_option(self, option_name, silent=True): for option in self.options: if option.name == option_name and option != self.selected: last_selection = self.selected self.selected.hide_background() self.selected.set_icon(self.selected_icon) self.selected = option self.selected.show_background() if self.opened == Tru... | 445,155 |
def _on_button_press(self, widget, event): | def _on_button_press(self, widget, event): | 445,156 |
def new_child(self, content_type, title, index=None): """Add a new node under this node""" path = self.get_path() newpath = get_valid_unique_filename(path, title) node = self._notebook.new_node(content_type, newpath, self, {}) | def new_child(self, content_type, title, index=None): """Add a new node under this node""" path = self.get_path() newpath = get_valid_unique_filename(path, title) node = self._notebook.new_node(content_type, newpath, self, {}) | 445,157 |
def duplicate(self, parent, index=None, recurse=False): """Duplicate a node to a new parent""" | def duplicate(self, parent, index=None, recurse=False): """Duplicate a node to a new parent""" | 445,158 |
def duplicate(self, parent, index=None, recurse=False): """Duplicate a node to a new parent""" | def duplicate(self, parent, index=None, recurse=False): """Duplicate a node to a new parent""" | 445,159 |
def duplicate(self, parent, index=None, recurse=False): """Duplicate a node to a new parent""" | def duplicate(self, parent, index=None, recurse=False): """Duplicate a node to a new parent""" | 445,160 |
def _on_close(self): """Callback for window close""" | def_on_close(self):"""Callbackforwindowclose""" | 445,161 |
def close(self): """Close the window""" | def close(self): """Close the window""" | 445,162 |
def upgrade_user_pref_dir(old_user_pref_dir, new_user_pref_dir): """Moves preference data from old location to new one""" import sys # move user preference directory shutil.copytree(old_user_pref_dir, new_user_pref_dir) # rename takenote.xml to keepnote.xml newfile = os.path.join(new_user_pref_dir, USER_PREF_FILE) o... | def upgrade_user_pref_dir(old_user_pref_dir, new_user_pref_dir): """Moves preference data from old location to new one""" import sys # move user preference directory shutil.copytree(old_user_pref_dir, new_user_pref_dir) # rename takenote.xml to keepnote.xml newfile = os.path.join(new_user_pref_dir, USER_PREF_FILE) o... | 445,163 |
def import_ncd_file(window,file): # is this really an .ncd file? counter = 10 fd = open(file,r'r') ncd_identified = True #False ncd_identifier = r'<meta name="generator" content="NoteCase 1.9.8">' while counter>=0: pre_data = fd.readline() if pre_data[:len(ncd_identifier)] == ncd_identifier: ncd_identified = True count... | def import_ncd_file(window,file): # is this really an .ncd file? counter = 10 fd = open(file,r'r') ncd_identified = True #False ncd_identifier = r'<meta name="generator" content="NoteCase 1.9.8">' while counter>=0: pre_data = fd.readline() if pre_data[:len(ncd_identifier)] == ncd_identifier: ncd_identified = True count... | 445,164 |
def walk(node): if node.get_attr("expanded"): for child in node.get_children(): walk(child) | def walk(node): if node.get_attr("expanded"): for child in node.get_children(): walk(child) | 445,165 |
def _do_paste_html(self, clipboard, selection_data, data): """Paste HTML into buffer""" html = parse_utf(selection_data.data) | def _do_paste_html(self, clipboard, selection_data, data): """Paste HTML into buffer""" html = parse_utf(selection_data.data) | 445,166 |
def _do_paste_html(self, clipboard, selection_data, data): """Paste HTML into buffer""" html = parse_utf(selection_data.data) | def _do_paste_html(self, clipboard, selection_data, data): """Paste HTML into buffer""" html = parse_utf(selection_data.data) | 445,167 |
def _get_ui(self): """Returns the UI XML""" # NOTE: I use a dummy menubar popup_menus so that I can have # accelerators on the menus. It is a hack. | def _get_ui(self): """Returns the UI XML""" # NOTE: I use a dummy menubar popup_menus so that I can have # accelerators on the menus. It is a hack. | 445,168 |
def _get_ui(self): """Returns the UI XML""" # NOTE: I use a dummy menubar popup_menus so that I can have # accelerators on the menus. It is a hack. | def _get_ui(self): """Returns the UI XML""" # NOTE: I use a dummy menubar popup_menus so that I can have # accelerators on the menus. It is a hack. | 445,169 |
def take_screenshot(self, filename): """Take a screenshot and save it to 'filename'""" | def take_screenshot(self, filename): """Take a screenshot and save it to 'filename'""" | 445,170 |
def new_tab(self, viewer=None): """Open a new tab with a viewer""" if viewer is None: viewer = self._default_viewer(self._app, self._main_window) self._tabs.append_page(viewer, gtk.Label(_("(Untitled)"))) self._tabs.set_tab_reorderable(viewer, True) viewer.show_all() | def new_tab(self, viewer=None): """Open a new tab with a viewer""" if viewer is None: viewer = self._default_viewer(self._app, self._main_window) self._tabs.append_page(viewer, gtk.Label(_("(Untitled)"))) self._tabs.set_tab_reorderable(viewer, True) viewer.show_all() | 445,171 |
def add_ui(self, window, use_minitoolbar): self.editor_menus.add_ui(window, use_minitoolbar=self._app.pref.use_minitoolbar) | defself._textview.get_image_menu().set_accel_group(window.get_accel_group()) add_ui(self,self._textview.get_image_menu().set_accel_group(window.get_accel_group()) window,self._textview.get_image_menu().set_accel_group(window.get_accel_group()) use_minitoolbar):self._textview.get_image_menu().set_accel_group(window.g... | 445,172 |
def make_image_menu(self, menu): """image context menu""" | def make_image_menu(self, menu): """image context menu""" | 445,173 |
def enable_spell_check(self, enabled=True): """Enables/disables spell check""" if not self.can_spell_check(): return if enabled: if self._spell_checker is None: self._spell_checker = gtkspell.Spell(self) else: if self._spell_checker is not None: self._spell_checker.detach() self._spell_checker = None | def enable_spell_check(self, enabled=True): """Enables/disables spell check""" if not self.can_spell_check(): return if enabled: if self._spell_checker is None: try: self._spell_checker = gtkspell.Spell(self) except Exception: self._spell_checker = None else: if self._spell_checker is not None: self._spell_checker.de... | 445,174 |
def is_spell_check_enabled(self): """Returns True if spell check is enabled""" return self._spell_checker != None | def is_spell_check_enabled(self): """Returns True if spell check is enabled""" return self._spell_checker is not None | 445,175 |
def show(self): self.dialog = gtk.Window(gtk.WINDOW_TOPLEVEL) self.dialog.connect("delete-event", lambda d,r: self.dialog.destroy()) self.dialog.set_default_size(400, 400) | defself.dialog.ptr = self show(self):self.dialog.ptr = self self.dialogself.dialog.ptr = self =self.dialog.ptr = self gtk.Window(gtk.WINDOW_TOPLEVEL)self.dialog.ptr = self self.dialog.connect("delete-event",self.dialog.ptr = self lambdaself.dialog.ptr = self d,r:self.dialog.ptr = self self.dialog.destroy())self.dialog.... | 445,176 |
def output_text(self, text, mode="normal"): """Output text to output buffer""" buf = self.output.get_buffer() | def output_text(self, text, mode="normal"): """Output text to output buffer""" buf = self.output.get_buffer() | 445,177 |
def close(self, save=True): """Close notebook""" | def close(self, save=True): """Close notebook""" | 445,178 |
def on_insert_image(self): """Displays the Insert Image Dialog""" if self._page is None: return | def on_insert_image(self): """Displays the Insert Image Dialog""" if self._page is None: return | 445,179 |
def on_insert_image(self): """Displays the Insert Image Dialog""" if self._page is None: return | def on_insert_image(self): """Displays the Insert Image Dialog""" if self._page is None: return | 445,180 |
def new_viewer(self): """Creates a new viewer for this window""" | def new_viewer(self): """Creates a new viewer for this window""" | 445,181 |
def on_view_node_external_app(self, app, node=None, kind=None): """View a node with an external app""" # TODO: try to clean up | def on_view_node_external_app(self, app, node=None, kind=None): """View a node with an external app""" # TODO: try to clean up | 445,182 |
def view_image(self, image_filename): current_page = self.get_current_page() if current_page is None: return | def view_image(self, image_filename): current_page = self.get_current_page() if current_page is None: return | 445,183 |
def _on_edit_image(self, menuitem): """Edit image in Image Editor""" | def _on_edit_image(self, menuitem): """Edit image in Image Editor""" | 445,184 |
def _on_edit_image(self, menuitem): """Edit image in Image Editor""" | def _on_edit_image(self, menuitem): """Edit image in Image Editor""" | 445,185 |
def _on_save_image_as(self, menuitem): """Save image as a new file""" | def _on_save_image_as(self, menuitem): """Save image as a new file""" | 445,186 |
def make_toolbar(self): # configure toolbar toolbar = self._uimanager.get_widget('/main_tool_bar') toolbar.set_orientation(gtk.ORIENTATION_HORIZONTAL) toolbar.set_style(gtk.TOOLBAR_ICONS) toolbar.set_border_width(0) | def make_toolbar(self): # configure toolbar toolbar = self._uimanager.get_widget('/main_tool_bar') toolbar.set_orientation(gtk.ORIENTATION_HORIZONTAL) toolbar.set_style(gtk.TOOLBAR_ICONS) toolbar.set_border_width(0) | 445,187 |
def remove_viewer(self, viewer): | def remove_viewer(self, viewer): | 445,188 |
def new_filename(self, node, new_filename, ext=u"", sep=u" ", number=2, return_number=False, use_number=False, ensure_valid=True, path=None): if path is None: path = self.get_node_path(node) if ext is None: new_filename, ext = os.path.splitext(new_filename) | def new_filename(self, node, new_filename, ext=u"", sep=u" ", number=2, return_number=False, use_number=False, ensure_valid=True, path=None): if path is None: path = self.get_node_path(node) if ext is None: new_filename, ext = os.path.splitext(new_filename) | 445,189 |
def new_filename(self, node, new_filename, ext=u"", sep=u" ", number=2, return_number=False, use_number=False, ensure_valid=True, path=None): if path is None: path = self.get_node_path(node) if ext is None: new_filename, ext = os.path.splitext(new_filename) | def new_filename(self, node, new_filename, ext=u"", sep=u" ", number=2, return_number=False, use_number=False, ensure_valid=True, path=None): if path is None: path = self.get_node_path(node) if ext is None: new_filename, ext = os.path.splitext(new_filename) | 445,190 |
def _setup_icon_menu(self): """Setup the icon menu""" iconmenu = IconMenu() iconmenu.connect("set-icon", lambda w, i: self._app.on_set_icon( i, u"", self.get_selected_nodes()[0])) iconmenu.new_icon.connect("activate", lambda w: self._app.on_new_icon( self.get_selected_nodes()[0], self._notebook, self._main_window)) ic... | def _setup_icon_menu(self): """Setup the icon menu""" iconmenu = IconMenu() iconmenu.connect("set-icon", lambda w, i: self._app.on_set_icon( i, u"", self.get_selected_nodes())) iconmenu.new_icon.connect("activate", lambda w: self._app.on_new_icon( self.get_selected_nodes()[0], self._notebook, self._main_window)) iconm... | 445,191 |
def _setup_icon_menu(self): """Setup the icon menu""" iconmenu = IconMenu() iconmenu.connect("set-icon", lambda w, i: self._app.on_set_icon( i, u"", self.get_selected_nodes()[0])) iconmenu.new_icon.connect("activate", lambda w: self._app.on_new_icon( self.get_selected_nodes()[0], self._notebook, self._main_window)) ic... | def _setup_icon_menu(self): """Setup the icon menu""" iconmenu = IconMenu() iconmenu.connect("set-icon", lambda w, i: self._app.on_set_icon( i, u"", self.get_selected_nodes()[0])) iconmenu.new_icon.connect("activate", lambda w: self._app.on_new_icon( self.get_selected_nodes(), self._notebook, self._main_window)) iconm... | 445,192 |
def _view_new_node(self, node): """View a node particular widget""" self._new_page_occurred = True widget = self.get_focused_widget() if widget == self.treeview: self.treeview.expand_node(node.get_parent()) self.treeview.edit_node(node) elif widget == self.listview: self.listview.expand_node(node.get_parent()) self.... | def _view_new_node(self, node): """View a node particular widget""" self._new_page_occurred = True widget = self.get_focused_widget() if widget == self.treeview: self.treeview.expand_node(node.get_parent()) self.treeview.edit_node(node) else: self.listview.expand_node(node.get_parent()) self.listview.edit_node(node) | 445,193 |
def _on_rename_node(self): """Callback for renaming a node""" nodes = self.get_selected_nodes() | def _on_rename_node(self): """Callback for renaming a node""" nodes = self.get_selected_nodes() | 445,194 |
def insert_html(self, html): """Insert HTML content into Buffer""" | def insert_html(self, html): """Insert HTML content into Buffer""" | 445,195 |
def _restore_windows(self, notebook): """Restore multiple windows for notebook""" # determine whether to open new windows or use this one windows = notebook.pref.get("windows", "ids", define=True) notebook.pref.get("viewers", "ids", define=True) if len(windows) == 1: p = windows.values()[0] old_id = p.get("viewerid", ... | def _restore_windows(self, notebook): """Restore multiple windows for notebook""" # determine whether to open new windows or use this one windows = notebook.pref.get("windows", "ids", define=True) notebook.pref.get("viewers", "ids", define=True) if len(windows) == 1: p = windows.values()[0] old_id = p.get("viewerid", ... | 445,196 |
def close_notebook(self, save=True): """Close the NoteBook""" | def close_notebook(self, save=True): """Close the NoteBook""" | 445,197 |
def setup_menu(self, uimanager): | def setup_menu(self, uimanager): | 445,198 |
def setup_menu(self, uimanager): | def setup_menu(self, uimanager): | 445,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.