def __new__(cls, name, bases, dct): ret = type.__new__(cls, name, bases, dct) for name in dir(ret.__styles): value = getattr(ret.__styles, name) value_type = type(value) gtk.widget_class_install_style_property(ret, ( name.replace("_", "-"), value_type, name.replace("_", "-"), value.__doc__.strip(), gobject.PARAM_READABLE)) gobject.type_register(ret) return ret
def do_button_press_event(self, event): if event.button == 1: y_start = self.allocation.y - self._scroll_y - self._y_offset total_height = self._scroll_height - self._h_offset fraction = (event.y + y_start) / total_height adj = self._scrolladj val = fraction * adj.upper - adj.page_size / 2 upper = adj.upper - adj.page_size adj.set_value(max(min(upper, val), adj.lower)) return True return False def do_size_request(self, request): request.width = self.style_get_property('width') gtk.widget_class_install_style_property(DiffMap, ('width', float, 'Width', 'Width of the bar', 0.0, gobject.G_MAXFLOAT, 20, gobject.PARAM_READABLE)) gtk.widget_class_install_style_property(DiffMap, ('x-padding', float, 'Width-wise padding', 'Padding to be left between left and ' 'right edges and change blocks', 0.0, gobject.G_MAXFLOAT, 3.5, gobject.PARAM_READABLE))
if keyval == keysyms.space and state == CONTROL_MASK: if self.cursor: self.model.invert_selection(self.cursor) self._queue_path_draw(self.cursor) return True return False def refresh(self, full=True): if full: self.update_item_cache() self.needed_full_redraw = True self.queue_draw() gobject.type_register(FmdIconView) gtk.widget_class_install_style_property(FmdIconView, ('hspacing', gobject.TYPE_INT, 'Horizontal spacing', 'Horizontal spacing between items', gobject.G_MININT, gobject.G_MAXINT, 10, gobject.PARAM_READWRITE)) gtk.widget_class_install_style_property(FmdIconView, ('vspacing', gobject.TYPE_INT, 'Vertical spacing', 'Vertical spacing between items', gobject.G_MININT, gobject.G_MAXINT, 2, gobject.PARAM_READWRITE)) gtk.widget_class_install_style_property(FmdIconView, ('margin', gobject.TYPE_INT, 'Margin', 'Margin to view boundaries', gobject.G_MININT, gobject.G_MAXINT, 3, gobject.PARAM_READWRITE))
tmp_height = height * perc_size / 100 y1 = tmp_height # Draw color = colors[counter & 1] context.set_source_rgb(*color) context.set_line_width(1) context.rectangle(0, stepper_size + prev_height, 15, y1 + prev_height) context.fill_preserve() context.set_source_rgb(*darken(color)) context.stroke() prev_height += tmp_height counter += 1 def do_size_request(self, request): request.width = self.style_get_property('width') gtk.widget_class_install_style_property(SectionsBar, ('width', float, 'Width', 'Width of the bar', 0.0, gobject.G_MAXFLOAT, 20, gobject.PARAM_READABLE)) gtk.widget_class_install_style_property(SectionsBar, ('x-padding', float, 'Width-wise padding', 'Padding to be left between left and ' 'right edges and change blocks', 0.0, gobject.G_MAXFLOAT, 2.5, gobject.PARAM_READABLE))