def __init__(self): self.__v_adj = HSVValueSlider() self.__v_adj.vertical = True v_align = Gtk.Alignment(xalign=1, yalign=0, xscale=0, yscale=1) v_align.add(self.__v_adj) self.__hs_adj = HSVHueSaturationWheel() table = Gtk.Table(n_rows=1, n_columns=2) row = 0 xopts = Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND yopts = Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND table.attach(v_align, 0, 1, row, row + 1, Gtk.AttachOptions.FILL, yopts, 3, 3) table.attach(self.__hs_adj, 1, 2, row, row + 1, xopts, yopts, 3, 3) self.__table = table
def __init__(self): super(HSVSquare, self).__init__() self._faces = ['h', 's', 'v'] self.__square = _HSVSquareInnerSquare(self) self.__ring = _HSVSquareOuterRing(self) s_align = Gtk.Alignment( xalign=0.5, yalign=0.5, xscale=0.54, yscale=0.54, ) plz_be_square = Gtk.AspectFrame() plz_be_square.set_shadow_type(Gtk.ShadowType.NONE) s_align.add(plz_be_square) plz_be_square.add(self.__square) self.__ring.add(s_align) self.pack_start(self.__ring, True, True, 0)
def __init__(self): self._faces = ['h', 's', 'v'] button = borderless_button( icon_name='mypaint-hsv-rotate-symbolic', size=Gtk.IconSize.MENU, tooltip=_("Rotate cube (show different axes)")) button.connect("clicked", lambda *a: self.tumble()) self.__slice = HSVCubeSlice(self) self.__slider = HSVCubeSlider(self) s_align = Gtk.Alignment(xalign=0.5, yalign=0, xscale=0, yscale=1) s_align.add(self.__slider) table = Gtk.Table(n_rows=2, n_columns=2) xopts = Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND yopts = Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND table.attach(s_align, 0, 1, 0, 1, Gtk.AttachOptions.FILL, yopts, 3, 3) table.attach(button, 0, 1, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL, 3, 3) table.attach(self.__slice, 1, 2, 0, 2, xopts, yopts, 3, 3) self.__table = table self._update_tooltips()
def _init_widgets(self): # Icon preview and edit TDW self._tdw = tileddrawwidget.TiledDrawWidget() self._tdw.set_model(self._model) self._tdw.set_size_request(brushmanager.PREVIEW_W * self._SCALE, brushmanager.PREVIEW_H * self._SCALE) self._tdw.scale = 1 # it will be corrected later self._tdw.scroll_on_allocate = False self._tdw.pixelize_threshold = 0 tdw_align = Gtk.Alignment(xalign=0.5, yalign=0.0, xscale=0.0, yscale=0.0) tdw_align.add(self._tdw) self.attach(tdw_align, 0, 0, 1, 1) ctrlr = CanvasController(self._tdw) ctrlr.init_pointer_events() ctrlr.modes.default_mode_class = FreehandMode # Brush name label lbl = Gtk.Label() lbl.set_alignment(0.5, 0.0) lbl.set_justify(Gtk.Justification.CENTER) lbl_tmpl = self._ICON_PREVIEWING_TMPL lbl.set_markup(lbl_tmpl % (lib.xml.escape(self._NO_BRUSH_NAME), )) self.attach(lbl, 0, 1, 1, 1) self.brush_name_label = lbl # Action buttons button_box = Gtk.VButtonBox() button_box.set_homogeneous(False) button_box.set_layout(Gtk.ButtonBoxStyle.START) button_box.set_spacing(4) b = self._make_image_button( # TRANSLATORS: begin editing a brush's preview icon _('Edit'), "mypaint-freehand-symbolic", self._edit_cb) b.set_tooltip_text(_("Begin editing this preview icon")) button_box.pack_start(b, False, True, 0) self._edit_button = b b = self._make_image_button( # TRANSLATORS: revert edits to a brush icon _('Revert'), "mypaint-document-revert-symbolic", self._revert_cb) b.set_tooltip_text(_("Discard changes, and cancel editing")) button_box.pack_start(b, False, True, 0) button_box.set_child_secondary(b, False) self._revert_button = b b = self._make_image_button( # TRANSLATORS: clear the brush preview icon being edited _('Clear'), "mypaint-clear-all-symbolic", self._clear_cb) b.set_tooltip_text(_("Clear the preview icon")) button_box.pack_start(b, False, True, 0) self._clear_button = b b = self._make_image_button( # TRANSLATORS: set the brush icon to a built-in default _('Auto'), "mypaint-document-new-symbolic", self._default_cb) b.set_tooltip_text(_("Use the default icon")) button_box.pack_start(b, False, True, 0) self._default_button = b b = self._make_image_button( # TRANSLATORS: save edits to a brush icon _('Save'), "mypaint-document-save-symbolic", self._save_cb) b.set_tooltip_text(_("Save this preview icon, and finish editing")) button_box.pack_start(b, False, True, 0) button_box.set_child_secondary(b, True) self._save_button = b self.attach(button_box, 1, 0, 1, 2) self.connect_after("show", self._show_cb) mb = self._bm.selected_brush preview = mb.preview self._set_preview_pixbuf(preview) name = mb.name if name is None: name = self._NO_BRUSH_NAME self.brush_name_label.set_markup(lbl_tmpl % (lib.xml.escape(name), ))
def __init__(self): CombinedAdjusterPage.__init__(self) grid = Gtk.Grid() grid.set_size_request(150, -1) grid.set_row_spacing(6) grid.set_column_spacing(0) grid.set_border_width(6) self._sliders = [] #: List of slider widgets. grid.set_valign(0.5) grid.set_halign(0.5) grid.set_hexpand(True) grid.set_vexpand(False) row_defs = [ ( C_("color sliders panel: red/green/blue: slider label", "R"), RGBRedSlider, 0, ), ( C_("color sliders panel: red/green/blue: slider label", "G"), RGBGreenSlider, 0, ), ( C_("color sliders panel: red/green/blue: slider label", "B"), RGBBlueSlider, 0, ), ( C_("color sliders panel: hue/chroma/luma: slider label", "H"), HCYHueSlider, 12, ), ( C_("color sliders panel: hue/chroma/luma: slider label", "C"), HCYChromaSlider, 0, ), ( C_("color sliders panel: hue/chroma/luma: slider label", "Y"), HCYLumaSlider, 0, ), ] row = 0 for row_def in row_defs: label_text, adj_class, margin_top = row_def label = Gtk.Label() label.set_text(label_text) label.set_tooltip_text(adj_class.STATIC_TOOLTIP_TEXT) label.set_vexpand(True) label.set_hexpand(False) label.set_valign(0.0) label.set_margin_top(margin_top) label.set_margin_start(3) label.set_margin_end(3) adj = adj_class() adj.set_size_request(100, 22) adj.set_vexpand(False) adj.set_hexpand(True) adj.set_margin_top(margin_top) adj.set_margin_left(3) adj.set_margin_right(3) adj.set_valign(0.0) self._sliders.append(adj) grid.attach(label, 0, row, 1, 1) grid.attach(adj, 1, row, 1, 1) row += 1 align = Gtk.Alignment( xalign=0.5, yalign=0.5, xscale=1.0, yscale=0.0, ) align.add(grid) self._page_widget = align #: Page's layout widget