def build(self): grid = wal.GridPanel(self, 2, 5, 2, 2) grid.pack(get_bmp(grid, make_artid('h-sign'))) self.h_spin = wal.FloatSpin(grid, 100.0, (0.01, 10000.0), 1.0, onchange=self.on_reset) grid.pack(self.h_spin) grid.pack(wal.Label(grid, '%')) grid.pack((5, 5)) self.h_mirror = wal.ImageToggleButton(grid, False, make_artid('h-mirror'), tooltip=_('Horizontal mirror'), flat=False) grid.pack(self.h_mirror) grid.pack(get_bmp(grid, make_artid('v-sign'))) self.v_spin = wal.FloatSpin(grid, 100.0, (0.01, 10000.0), 1.0, onchange=self.height_changed) grid.pack(self.v_spin) grid.pack(wal.Label(grid, '%')) grid.pack((5, 5)) self.v_mirror = wal.ImageToggleButton(grid, False, make_artid('v-mirror'), tooltip=_('Vertical mirror'), flat=False) grid.pack(self.v_mirror) self.pack(grid, align_center=False, padding=5) self.proportion = wal.Checkbox(self, _('Keep ratio'), True) self.pack(self.proportion, align_center=False, padding=5) self.active_widgets = [self.h_spin, self.h_mirror, self.v_spin, self.v_mirror, self.proportion]
def __init__(self, parent, cms, color=None, onchange=None): wal.GridPanel.__init__(self, parent, 5, 4, 3, 5) self.cms = cms if color: self.color = color else: self.color = [uc2const.COLOR_CMYK, [0.0, 0.0, 0.0, 1.0], 1.0, ''] if onchange: self.callback = onchange self.color_sliders = [] self.color_spins = [] labels = ['C:', 'M:', 'Y:', 'K:'] for item in labels: self.pack(wal.Label(self, item)) self.color_sliders.append(ColoredSlider(self, onchange=self.on_slider_change)) self.pack(self.color_sliders[-1]) self.color_spins.append(wal.FloatSpin(self, range_val=(0.0, 100.0), width=5, onchange=self.on_change, onenter=self.on_change)) self.pack(self.color_spins[-1]) self.pack(wal.Label(self, '%')) self.pack(wal.Label(self, 'A:')) self.alpha_slider = ColoredAlphaSlider(self, onchange=self.on_slider_change) self.pack(self.alpha_slider) self.alpha_spin = wal.FloatSpin(self, range_val=(0.0, 100.0), width=5, onchange=self.on_change, onenter=self.on_change) self.pack(self.alpha_spin) self.pack(wal.Label(self, '%'))
def __init__(self): wal.MainWindow.__init__(self) self.set_size(SIZE) self.spin = wal.FloatSpin(self, 5, (0,30), width=4, onchange=self.on_change, onenter=self.on_enter) self.pack(self.spin) self.spin2 = wal.FloatSpin(self, 5, (0,100), digits=4) self.pack(self.spin2)
def build(self): panel = wal.HPanel(self) self.pack(panel, padding=5, fill=True) label = wal.Label(panel, _("Insert:")) panel.pack(label, padding=5) self.page_num = wal.FloatSpin(panel, 1, (1, 100), 1, 0, width=5, spin_overlay=config.spin_overlay) panel.pack(self.page_num, padding=5) label = wal.Label(panel, _("page(s)")) panel.pack(label, padding=5) panel = wal.HPanel(self) self.pack(panel, padding=5) margin = 0 if not wal.is_gtk(): margin = 3 panel.pack((5, 5)) vpanel = wal.VPanel(panel) panel.pack(vpanel, padding=5) self.before_opt = wal.Radiobutton(vpanel, _('Before'), group=True) vpanel.pack(self.before_opt, padding=margin, fill=True) self.after_opt = wal.Radiobutton(vpanel, _('After')) vpanel.pack(self.after_opt, padding=margin, fill=True) self.after_opt.set_value(True) label = wal.Label(panel, _("page No.:")) panel.pack(label, padding=5) pages = self.presenter.get_pages() page_num = len(pages) current_page = pages.index(self.presenter.active_page) + 1 self.page_index = wal.FloatSpin(panel, current_page, (1, page_num), 1, 0, width=5, spin_overlay=config.spin_overlay) panel.pack(self.page_index, padding=5)
def __init__(self, parent, dlg, cms, stops, sel_stop=0, onposition=None, oncolor=None): self.dlg = dlg self.cms = cms self.stops = stops self.selected_stop = sel_stop self.pos_callback = onposition self.color_callback = oncolor wal.LabeledPanel.__init__(self, parent, text=_('Gradient stop')) grid = wal.GridPanel(self, cols=3, vgap=5, hgap=5) grid.pack(wal.Label(grid, _('Color value:'))) clr = self.stops[self.selected_stop][1] txt = _('Change stop color') self.swatch = PDColorButton(grid, self.dlg, self.cms, clr, txt, onchange=self.edit_color) grid.pack(self.swatch) grid.pack((1, 1)) grid.pack(wal.Label(grid, _('Position:'))) self.position = wal.FloatSpin(grid, range_val=(0.0, 100.0), step=1.0, onchange=self.pos_changed, onenter=self.pos_changed) grid.pack(self.position) grid.pack(wal.Label(grid, '%')) self.pack(grid, align_center=False, padding_all=10)
def build(self): label = wal.Label(self, _("Delete page No.:")) self.pack(label, padding=5) pages = self.presenter.get_pages() page_num = len(pages) current_page = pages.index(self.presenter.active_page) + 1 self.spin = wal.FloatSpin(self, current_page, (1, page_num), 1, 0) self.pack(self.spin, padding=5)
def build_ui(self): self.icon = get_icon(PLUGIN_ICON) panel = wal.VPanel(self.panel) panel.pack(wal.Label(panel, _('Text position on path')), padding_all=5) hp = wal.HPanel(panel) hp.pack(wal.Label(hp, _('Base point:'))) self.base_point = wal.FloatSpin(hp, value=50.0, range_val=(0.0, 100.0), step=1.0) hp.pack(self.base_point, padding=5) hp.pack(wal.Label(hp, _('%'))) panel.pack(hp, padding=5) self.align_keeper = wal.HToggleKeeper(panel, TEXT_ALIGNS, TEXT_ALIGN_ICONS, TEXT_ALIGN_TEXTS, on_change=self.update_bmp) panel.pack(self.align_keeper) self.align_keeper.set_mode(TEXT_ALIGNS[1]) border = wal.VPanel(panel) color = wal.GRAY if wal.is_gtk(): color = wal.UI_COLORS['pressed_border'] border.set_bg(color) self.pic_panel = wal.VPanel(border) self.pic_panel.set_bg(wal.WHITE) self.bmp = get_bmp(self.pic_panel, TEXT_ALIGN_PICS[TEXT_ALIGNS[1]]) self.pic_panel.pack(self.bmp, padding_all=5) border.pack(self.pic_panel, padding_all=1) panel.pack(border, padding=10) self.other_side = wal.Checkbox(panel, _('Place on other side'), onclick=self.update_bmp) panel.pack(self.other_side, padding=5) self.apply_btn = wal.Button(panel, _('Apply'), onclick=self.action) panel.pack(self.apply_btn, padding=5, fill=True) self.panel.pack(panel, fill=True, padding_all=5) self.panel.pack(wal.HLine(self.panel), fill=True) events.connect(events.DOC_CHANGED, self.update) events.connect(events.SELECTION_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update) self.update()
def __init__(self, parent, app, trafo=[] + sk2_const.NORMAL_TRAFO, onchange=None): self.app = app self.callback = onchange wal.VPanel.__init__(self, parent) self.pack(wal.Label(self, _('Transformation matrix:')), padding=5) grid = wal.GridPanel(self, 3, 5, 3, 1) #---M11 grid.pack(wal.Label(grid, 'm11:')) self.m11 = wal.FloatSpin(grid, range_val=(-1000000.0, 1000000.0), step=0.01, width=7, onchange=self.changes, onenter=self.changes) grid.pack(self.m11) grid.pack((5, 5)) #---M12 grid.pack(wal.Label(grid, 'm12:')) self.m12 = wal.FloatSpin(grid, range_val=(-1000000.0, 1000000.0), step=0.01, width=7, onchange=self.changes, onenter=self.changes) grid.pack(self.m12) #---M21 grid.pack(wal.Label(grid, 'm21:')) self.m21 = wal.FloatSpin(grid, range_val=(-1000000.0, 1000000.0), step=0.01, width=7, onchange=self.changes, onenter=self.changes) grid.pack(self.m21) grid.pack((5, 5)) #---M22 grid.pack(wal.Label(grid, 'm22:')) self.m22 = wal.FloatSpin(grid, range_val=(-1000000.0, 1000000.0), step=0.01, width=7, onchange=self.changes, onenter=self.changes) grid.pack(self.m22) #---dx grid.pack(wal.Label(grid, 'dx:')) self.dx = wal.FloatSpin(grid, range_val=(-1000000.0, 1000000.0), step=0.01, width=7, onchange=self.changes, onenter=self.changes) grid.pack(self.dx) grid.pack((5, 5)) #---dy grid.pack(wal.Label(grid, 'dy:')) self.dy = wal.FloatSpin(grid, range_val=(-1000000.0, 1000000.0), step=0.01, width=7, onchange=self.changes, onenter=self.changes) grid.pack(self.dy) self.pack(grid)
def build(self): label = wal.Label(self, _("Page No.:")) self.pack(label, padding=5) pages = self.presenter.get_pages() page_num = len(pages) current_page = pages.index(self.presenter.active_page) + 1 self.spin = wal.FloatSpin(self, current_page, (1, page_num), 1, 0, width=5, spin_overlay=config.spin_overlay) self.pack(self.spin, padding=5)
def __init__(self, parent, cms_ref, color=None, onchange=None): wal.VPanel.__init__(self, parent) self.cms = cms_ref if color: self.color = color else: self.color = get_registration_black() if onchange: self.callback = onchange name_panel = wal.HPanel(self) name_panel.pack(wal.Label(name_panel, 'Name:'), padding=5) self.name_field = wal.Entry(name_panel, width=30, onchange=self.on_change) name_panel.pack(self.name_field) self.pack(name_panel, padding_all=5) grid = wal.GridPanel(self, 3, 4, 3, 5) grid.pack((1, 1)) self.rgb_txt = wal.Label(grid, '---') grid.pack(self.rgb_txt) grid.pack((1, 1)) grid.pack((1, 1)) grid.pack((1, 1)) self.cmyk_txt = wal.Label(grid, '---') grid.pack(self.cmyk_txt) grid.pack((1, 1)) grid.pack((1, 1)) grid.pack(wal.Label(grid, 'A:')) self.alpha_slider = ColoredAlphaSlider(grid, onchange=self.on_slider_change) grid.pack(self.alpha_slider) self.alpha_spin = wal.FloatSpin(grid, range_val=(0.0, 100.0), onchange=self.on_change, onenter=self.on_change) grid.pack(self.alpha_spin) grid.pack(wal.Label(self, '%')) self.pack(grid)
def build(self): bmp = get_bmp(self, icons.CTX_ROUNDED_RECT, _('Rounded rectangle')) self.pack(bmp, padding=2) self.slider = wal.Slider(self, 0, (0, 100), onchange=self.slider_changes, on_final_change=self.slider_final_changes) self.pack(self.slider, padding=2) self.num_spin = wal.FloatSpin(self, 0, (0.0, 100.0), 1.0, 0, onchange=self.changes) self.pack(self.num_spin, padding=2) self.switch = RectAngleSwitch(self, onchange=self.switch_changed) self.pack(self.switch, padding=3) self.switch.hide() self.keep_ratio = RatioToggle(self, onchange=self.lock_changed) self.pack(self.keep_ratio, padding=3)
def build(self): self.pack((5, 5)) self.geom = self.doc.methods.get_grid_values() hpanel = wal.HPanel(self) txt = _('Grid origin') origin_panel = wal.LabeledPanel(hpanel, text=txt) grid = wal.GridPanel(origin_panel, 2, 3, 5, 5) grid.pack(wal.Label(grid, 'X:')) self.x_val = UnitSpin(self.app, grid, self.geom[0]) grid.pack(self.x_val) grid.pack(StaticUnitLabel(self.app, grid)) grid.pack(wal.Label(grid, 'Y:')) self.y_val = UnitSpin(self.app, grid, self.geom[1]) grid.pack(self.y_val) grid.pack(StaticUnitLabel(self.app, grid)) origin_panel.pack(grid, padding_all=5) hpanel.pack(origin_panel, padding_all=5, fill=True, expand=True) txt = _('Grid frequency') freq_panel = wal.LabeledPanel(hpanel, text=txt) grid = wal.GridPanel(origin_panel, 2, 3, 5, 5) grid.pack(wal.Label(grid, 'dX:')) self.dx_val = UnitSpin(self.app, grid, self.geom[2]) grid.pack(self.dx_val) grid.pack(StaticUnitLabel(self.app, grid)) grid.pack(wal.Label(grid, 'dY:')) self.dy_val = UnitSpin(self.app, grid, self.geom[3]) grid.pack(self.dy_val) grid.pack(StaticUnitLabel(self.app, grid)) freq_panel.pack(grid, padding_all=5) hpanel.pack(freq_panel, padding_all=5, fill=True, expand=True) self.pack(hpanel, fill=True) self.pack((5, 5)) color_panel = wal.HPanel(self) color_panel.pack((10, 10)) vpanel = wal.VPanel(color_panel) hpanel = wal.HPanel(vpanel) hpanel.pack(wal.Label(hpanel, _('Grid color:'))) hpanel.pack((10, 5)) self.color = self.doc.methods.get_grid_rgba_color() self.grid_color_btn = wal.ColorButton(hpanel, self.color[:3], onchange=self.on_change) hpanel.pack(self.grid_color_btn) vpanel.pack(hpanel, fill=True) hpanel = wal.HPanel(vpanel) hpanel.pack(wal.Label(hpanel, _('Grid opacity:'))) hpanel.pack((10, 5)) self.alpha_spin = wal.FloatSpin(hpanel, self.color[3] * 100.0, range_val=(0.0, 100.0), onchange=self.on_spin_change, onenter=self.on_spin_change) hpanel.pack(self.alpha_spin) hpanel.pack(wal.Label(hpanel, '%'), padding=3) vpanel.pack(hpanel, fill=True, padding=5) self.alpha_slider = wal.Slider(vpanel, int(self.color[3] * 100.0), range_val=(0, 100), onchange=self.on_slider_change) vpanel.pack(self.alpha_slider, fill=True, padding=5) val = self.doc.methods.is_grid_visible() self.show_grid_check = wal.Checkbox(vpanel, _('Show grid on canvas'), val) vpanel.pack(self.show_grid_check, fill=True, padding=5) color_panel.pack(vpanel) color_panel.pack((10, 10)) preview_panel = wal.VPanel(color_panel) preview_panel.pack(wal.Label(hpanel, _('Grid preview:'))) preview_panel.pack((5, 5)) self.grid_preview = GridPreview(preview_panel, self.color) preview_panel.pack(self.grid_preview, fill=True, expand=True) color_panel.pack(preview_panel, fill=True, expand=True) color_panel.pack((10, 10)) self.pack(color_panel, fill=True)
def __init__(self, parent, dlg, new_stroke): self.dlg = dlg self.app = dlg.app self.stroke = new_stroke wal.VPanel.__init__(self, parent) self.pack((30, 30)) p = wal.HPanel(self) p.pack(wal.Label(p, _('Stroke width:')), padding=5) self.width_spin = UnitSpin(self.app, p, self.stroke[1], step=0.1) p.pack(self.width_spin) p.pack(StaticUnitLabel(self.app, p), padding=5) self.pack(p) self.pack((20, 20)) p = wal.HPanel(self) p.pack(wal.Label(p, _('Dashes:')), padding=5) self.dashes = DashChoice(p, self.stroke[3]) p.pack(self.dashes) txt = _('Edit dash pattern') p.pack(wal.ImageButton(p, icons.PD_EDIT, tooltip=txt, flat=False, onclick=self.edit_dash), padding=5) self.pack(p) grid = wal.GridPanel(self, vgap=15, hgap=15) caps_p = wal.LabeledPanel(grid, _('Caps:')) self.caps = CapChoice(caps_p, self.stroke[4]) caps_p.pack(self.caps, align_center=False, padding_all=10) grid.pack(caps_p) join_p = wal.LabeledPanel(grid, _('Join:')) self.join = JoinChoice(join_p, self.stroke[5]) join_p.pack(self.join, align_center=False, padding_all=10) grid.pack(join_p) self.pack(grid, padding_all=10) p = wal.HPanel(self) p.pack(wal.Label(p, _('Miter limit:')), padding=5) self.miter_limit = wal.FloatSpin(p, self.stroke[6], range_val=(0.0, 1000.0), digits=5) p.pack(self.miter_limit) self.pack(p) p = wal.HPanel(self) self.behind = wal.NumCheckbox(p, _('Behind fill'), self.stroke[7]) p.pack(self.behind) p.pack((30, 10)) self.scalable = wal.NumCheckbox(p, _('Scalable stroke'), self.stroke[8]) p.pack(self.scalable) self.pack(p, padding=10)
def __init__(self, parent, dlg, new_stroke): self.dlg = dlg self.app = dlg.app self.stroke = new_stroke wal.VPanel.__init__(self, parent) hp = wal.HPanel(self) width_p = wal.LabeledPanel(hp, _('Width:')) p = wal.HPanel(width_p) self.width_spin = UnitSpin(self.app, p, self.stroke[1], step=0.1) p.pack(self.width_spin) p.pack((5, 5)) p.pack(StaticUnitLabel(self.app, p)) width_p.pack(p, padding_all=5) hp.pack(width_p, fill=True) hp.pack((5, 5)) arrow_p = wal.LabeledPanel(hp, _('Markers:')) p = wal.HPanel(arrow_p) end, start = [], [] if self.stroke[9]: end, start = self.stroke[9] self.end_arrow = ArrowChoice(p, arrow=end, end=True) self.end_arrow.set_arrow(end) p.pack(self.end_arrow) p.pack((5, 5)) self.start_arrow = ArrowChoice(p, arrow=start) self.start_arrow.set_arrow(start) p.pack(self.start_arrow) arrow_p.pack(p) hp.pack(arrow_p, expand=True, fill=True) self.pack(hp, fill=True, padding_all=10) p = wal.HPanel(self) p.pack(wal.Label(p, _('Dashes:')), padding=5) self.dashes = DashChoice(p, self.stroke[3]) p.pack(self.dashes) txt = _('Edit dash pattern') p.pack(wal.ImageButton(p, icons.PD_EDIT, art_size=wal.SIZE_16, tooltip=txt, flat=False, onclick=self.edit_dash), padding=5) self.pack(p) grid = wal.GridPanel(self, rows=1, cols=3, vgap=15, hgap=15) grid.add_growable_col(2) caps_p = wal.LabeledPanel(grid, _('Caps:')) self.caps = CapChoice(caps_p, self.stroke[4]) caps_p.pack(self.caps, align_center=False, padding_all=10) grid.pack(caps_p) join_p = wal.LabeledPanel(grid, _('Join:')) self.join = JoinChoice(join_p, self.stroke[5]) join_p.pack(self.join, align_center=False, padding_all=10) grid.pack(join_p) opt_p = wal.LabeledPanel(grid, _('Options:')) p = wal.HPanel(opt_p) p.pack(wal.Label(p, _('Miter limit:')), padding=5) self.miter_limit = wal.FloatSpin(p, self.stroke[6], range_val=(0.0, 1000.0), digits=5) p.pack(self.miter_limit) opt_p.pack(p, align_center=False, padding_all=10) p = wal.VPanel(opt_p) self.behind = wal.NumCheckbox(p, _('Behind fill'), self.stroke[7]) p.pack(self.behind, align_center=False) self.scalable = wal.NumCheckbox(p, _('Scalable stroke'), self.stroke[8]) p.pack(self.scalable, align_center=False, padding=10) opt_p.pack(p, align_center=False, padding_all=10) grid.pack(opt_p, fill=True) self.pack(grid, padding_all=10, fill=True) self.layout()
def __init__(self, parent, app, trafo=[] + sk2_const.NORMAL_TRAFO, transforms=[] + sk2_const.PATTERN_TRANSFORMS, onchange=None): self.app = app self.callback = onchange wal.VPanel.__init__(self, parent) grid = wal.GridPanel(self, 3, 7, 3, 2) #---Origin X txt = _('Horizontal origin shift') grid.pack(get_bmp(grid, icons.PD_PATTERN_ORIGIN_X, txt)) self.origin_x = UnitSpin(app, grid, can_be_negative=True, onchange=self.changes, onenter=self.changes) grid.pack(self.origin_x) grid.pack(StaticUnitLabel(app, grid)) grid.pack((10, 5)) #---Origin Y txt = _('Vertical origin shift') grid.pack(get_bmp(grid, icons.PD_PATTERN_ORIGIN_Y, txt)) self.origin_y = UnitSpin(app, grid, can_be_negative=True, onchange=self.changes, onenter=self.changes) grid.pack(self.origin_y) grid.pack(StaticUnitLabel(app, grid)) #---Scale X txt = _('Scale horizontally') grid.pack(get_bmp(grid, icons.PD_PATTERN_SCALE_X, txt)) self.scale_x = wal.FloatSpin(grid, range_val=(-1000000.0, 1000000.0), step=1.0, width=5, onchange=self.changes, onenter=self.changes) grid.pack(self.scale_x) grid.pack(wal.Label(grid, '%')) grid.pack((10, 5)) #---Scale Y txt = _('Scale vertically') grid.pack(get_bmp(grid, icons.PD_PATTERN_SCALE_Y, txt)) self.scale_y = wal.FloatSpin(grid, range_val=(-1000000.0, 1000000.0), step=1.0, width=5, onchange=self.changes, onenter=self.changes) grid.pack(self.scale_y) grid.pack(wal.Label(grid, '%')) #---Shear X txt = _('Shear horizontally') grid.pack(get_bmp(grid, icons.PD_PATTERN_SHEAR_X, txt)) self.shear_x = wal.FloatSpin(grid, range_val=(0.0, 85.0), step=1.0, width=5, onchange=self.changes, onenter=self.changes) grid.pack(self.shear_x) grid.pack(wal.Label(grid, '°')) grid.pack((10, 5)) #---Shear X txt = _('Shear vertically') grid.pack(get_bmp(grid, icons.PD_PATTERN_SHEAR_Y, txt)) self.shear_y = wal.FloatSpin(grid, range_val=(0.0, 85.0), step=1.0, width=5, onchange=self.changes, onenter=self.changes) grid.pack(self.shear_y) grid.pack(wal.Label(grid, '°')) self.pack(grid) #---Rotate rot_panel = wal.HPanel(self) txt = _('Rotate pattern') rot_panel.pack(get_bmp(rot_panel, icons.PD_PATTERN_ROTATE, txt)) self.rotate = wal.FloatSpin(rot_panel, range_val=(-360.0, 360.0), step=1.0, width=5, onchange=self.changes, onenter=self.changes) rot_panel.pack(self.rotate, padding=3) rot_panel.pack(wal.Label(rot_panel, '°')) self.pack(rot_panel, padding=5) self.set_trafo(trafo, transforms)