def __init__(self, parent, app):
        self.app = app
        wal.HPanel.__init__(self, parent)
        self.pack((1, 1))

        self.palette = Palette(self.panel, self.app,
                               on_left_click=self.app.proxy.fill_selected,
                               on_right_click=self.app.proxy.stroke_selected,
                               onmin=self.left_enable,
                               onmax=self.right_enable)

        tip = _('Scroll palette to left')
        self.left_but = wal.ImageButton(self.panel, icons.ARROW_LEFT,
                                        tooltip=tip, decoration_padding=4,
                                        native=wal.IS_GTK,
                                        onclick=self.palette.scroll_start,
                                        repeat=True)
        self.pack(self.left_but)

        tip = _('Empty pattern')
        self.no_color = wal.ImageLabel(self.panel, icons.NO_COLOR, tooltip=tip,
                                       onclick=self.set_no_fill,
                                       onrightclick=self.set_no_stroke)
        self.pack(self.no_color)

        self.pack(self.palette, expand=True, padding=1)

        tip = _('Scroll palette to right')
        self.right_but = wal.ImageButton(self.panel, icons.ARROW_RIGHT,
                                         tooltip=tip, decoration_padding=4,
                                         native=wal.IS_GTK,
                                         onclick=self.palette.scroll_end,
                                         repeat=True)
        self.pack(self.right_but)
Example #2
0
	def __init__(self, parent, dlg, cms, pattern_def, onchange=None):
		self.dlg = dlg
		self.app = dlg.app
		self.cms = cms
		self.pattern_def = deepcopy(pattern_def)
		self.callback = onchange
		wal.HPanel.__init__(self, parent)
		left_panel = wal.VPanel(self)
		self.pattern_swatch = PatternSwatch(left_panel, self.cms, pattern_def)
		left_panel.pack(self.pattern_swatch)

		button_panel = wal.HPanel(left_panel)
		txt = _('Load pattern from file')
		button_panel.pack(wal.ImageButton(self, icons.PD_OPEN, wal.SIZE_16,
				tooltip=txt, flat=False, onclick=self.load_pattern),
				padding=1)
		txt = _('Save pattern into file')
		button_panel.pack(wal.ImageButton(self, icons.PD_FILE_SAVE, wal.SIZE_16,
				tooltip=txt, flat=False, onclick=self.save_pattern),
				padding=1)
		left_panel.pack(button_panel, padding=2)

		self.pack(left_panel, fill=True)

		right_panel = wal.VPanel(self)

		self.pattern_color_editor = PatternColorEditor(right_panel, dlg, cms,
								pattern_def[2], onchange=self.color_changed)
		right_panel.pack(self.pattern_color_editor, padding=5)

		self.trafo_editor = PatternTrafoEditor(right_panel, dlg.app,
											onchange=self.trafo_changed)
		right_panel.pack(self.trafo_editor, padding=5)

		self.pack(right_panel, fill=True, expand=True)
Example #3
0
	def __init__(self, parent, app):
		self.app = app
		wal.VPanel.__init__(self, parent)
		self.pack((1, 1))


		self.palette = Palette(self.panel, self.app, hpal=False,
							on_left_click=self.app.proxy.fill_selected,
							on_right_click=self.app.proxy.stroke_selected,
							onmin=self.left_enable,
							onmax=self.right_enable)

		native = False
		if wal.is_gtk(): native = True

		tip = _('Scroll palette to top')
		self.left_but = wal.ImageButton(self.panel, icons.ARROW_TOP, tooltip=tip,
								decoration_padding=4, native=native,
								onclick=self.palette.scroll_start, repeat=True)
		self.pack(self.left_but)

		tip = _('Empty pattern')
		self.no_color = wal.ImageLabel(self.panel, icons.NO_COLOR, tooltip=tip,
								 onclick=self.set_no_fill,
								 onrightclick=self.set_no_stroke)

		self.pack(self.no_color)

		self.pack(self.palette, expand=True, padding=1)

		tip = _('Scroll palette to bottom')
		self.right_but = wal.ImageButton(self.panel, icons.ARROW_BOTTOM, tooltip=tip,
								decoration_padding=4, native=native,
								onclick=self.palette.scroll_end, repeat=True)
		self.pack(self.right_but)
Example #4
0
    def __init__(self, app, parent):
        self.app = app
        self.parent = parent
        wal.HPanel.__init__(self, parent)

        native = False
        if wal.IS_GTK:
            native = True

        callback = self.app.proxy.goto_start
        self.start_but = wal.ImageButton(
            self.panel, icons.PD_PM_ARROW_START,
            tooltip=_('Go to fist page'),
            decoration_padding=4,
            native=native,
            onclick=callback)
        self.pack(self.start_but)

        callback = self.app.proxy.previous_page
        self.prev_but = wal.ImageButton(
            self.panel,
            icons.PD_PM_ARROW_LEFT,
            tooltip=_('Go to previous page'),
            decoration_padding=4,
            native=native,
            onclick=callback)
        self.pack(self.prev_but)

        self.page_txt = wal.Label(self.panel, text=' ', fontsize=FONTSIZE[0])
        self.pack(self.page_txt)

        callback = self.app.proxy.next_page
        self.next_but = wal.ImageButton(
            self.panel,
            icons.PD_PM_ARROW_RIGHT,
            tooltip=_('Go to next page'),
            decoration_padding=4,
            native=native,
            onclick=callback)
        self.pack(self.next_but)

        callback = self.app.proxy.goto_end
        self.end_but = wal.ImageButton(
            self.panel,
            icons.PD_PM_ARROW_END,
            tooltip=_('Go to last page'),
            decoration_padding=4,
            native=native,
            onclick=callback)
        self.pack(self.end_but)

        self.pack(wal.VLine(self.panel), fill=True, padding=4)
        events.connect(events.NO_DOCS, self.hide_monitor)
        events.connect(events.DOC_CHANGED, self.update)
        events.connect(events.DOC_MODIFIED, self.update)
        events.connect(events.PAGE_CHANGED, self.update)
Example #5
0
    def __init__(self,
                 parent,
                 dlg,
                 cms,
                 color=deepcopy(sk2_const.CMYK_BLACK),
                 tooltip='',
                 onchange=None):
        self.dlg = dlg
        self.cms = cms
        self.color = color
        self.callback = onchange
        wal.HPanel.__init__(self, parent)

        self.swatch = AlphaColorSwatch(self,
                                       self.cms,
                                       self.color, (40, 20),
                                       'news',
                                       onclick=self.edit_color)
        self.pack(self.swatch)

        self.pack(wal.ImageButton(self,
                                  icons.PD_EDIT,
                                  wal.SIZE_16,
                                  tooltip=tooltip,
                                  flat=False,
                                  onclick=self.edit_color),
                  padding=5)
Example #6
0
    def build_ui(self):
        self.icon = get_icon(PLUGIN_ICON)
        self.panel.pack(wal.Label(self.panel, _('Layers'), fontbold=True),
                        padding=3)
        self.panel.pack(wal.HLine(self.panel), fill=True)

        pnl = wal.HPanel(self.panel)
        self.layer_new = wal.ImageButton(pnl,
                                         icons.PD_LAYER_NEW,
                                         tooltip=_('Create new layer'),
                                         onclick=self.new_layer)
        self.layer_to_bottom = wal.ImageButton(
            pnl,
            icons.PD_LOWER_TO_BOTTOM,
            tooltip=_('Move layer to bottom'),
            onclick=self.lower_layer_to_bottom)
        self.layer_lower = wal.ImageButton(pnl,
                                           icons.PD_LOWER,
                                           tooltip=_('Move layer down'),
                                           onclick=self.lower_layer)
        self.layer_raise = wal.ImageButton(pnl,
                                           icons.PD_RAISE,
                                           tooltip=_('Move layer up'),
                                           onclick=self.raise_layer)
        self.layer_to_top = wal.ImageButton(pnl,
                                            icons.PD_RAISE_TO_TOP,
                                            tooltip=_('Move layer to top'),
                                            onclick=self.raise_layer_to_top)
        self.layer_delete = wal.ImageButton(pnl,
                                            icons.PD_LAYER_DELETE,
                                            tooltip=_('Delete layer'),
                                            onclick=self.delete_layer)
        self.layer_edit = wal.ImageButton(pnl,
                                          icons.PD_EDIT,
                                          tooltip=_('Rename layer'),
                                          onclick=self.rename_layer)
        pnl.pack(self.layer_new)
        pnl.pack(self.layer_to_bottom)
        pnl.pack(self.layer_lower)
        pnl.pack(self.layer_raise)
        pnl.pack(self.layer_to_top)
        pnl.pack(self.layer_delete)
        pnl.pack(self.layer_edit)
        self.panel.pack(pnl)

        bmp = [make_artid(item) for item in BITMAPS]
        pnl = wal.VPanel(self.panel, border=True)
        self.viewer = wal.LayerList(pnl,
                                    self.get_data(),
                                    bmp,
                                    on_select=self.update,
                                    on_change=self.changed,
                                    on_double_click=self.rename_layer)
        pnl.pack(self.viewer, fill=True, expand=True)
        self.panel.pack(pnl, padding_all=3, fill=True, expand=True)

        events.connect(events.DOC_CHANGED, self.update)
        events.connect(events.DOC_MODIFIED, self.update)
        events.connect(events.PAGE_CHANGED, self.update)
        self.update()
Example #7
0
    def __init__(self):
        wal.MainWindow.__init__(self)
        self.set_size(SIZE)

        btn = wal.ImageButton(self,
                              text='Test image button',
                              flat=False,
                              onclick=self.click)
        self.pack(btn, padding=10)
Example #8
0
    def __init__(self, app, prefpanel, parent):
        self.app = app
        self.prefpanel = prefpanel
        wal.HPanel.__init__(self, parent)

        data = self.get_palette_list()
        self.pal_list = wal.SimpleList(self,
                                       data,
                                       on_select=self.change_palette)
        self.pack(self.pal_list, expand=True, fill=True, padding_all=5)

        self.pal_viewer = PaletteViewer(self, self.app.default_cms)
        self.pack(self.pal_viewer, fill=True, padding_all=5)

        btn_box = wal.VPanel(self)
        self.pack(btn_box, fill=True, padding_all=5)

        btn_box.pack(wal.Button(btn_box,
                                _('Import'),
                                onclick=self.import_palette),
                     fill=True,
                     end_padding=5)

        btn_box.pack(wal.Button(btn_box,
                                _('Export'),
                                onclick=self.export_palette),
                     fill=True,
                     end_padding=5)

        self.remove_btn = wal.Button(btn_box,
                                     _('Remove'),
                                     onclick=self.remove_palette)
        btn_box.pack(self.remove_btn, fill=True, end_padding=5)

        self.edit_btn = wal.Button(btn_box,
                                   _('Edit info'),
                                   onclick=self.edit_info)
        btn_box.pack(self.edit_btn, fill=True, end_padding=5)

        btn_box.pack(wal.VPanel(btn_box), fill=True, expand=True)

        btn_box.pack(wal.ImageButton(btn_box,
                                     icons.PD_DOWNLOAD48,
                                     tooltip=_('Download more palettes'),
                                     flat=False,
                                     onclick=self.download_more),
                     fill=True,
                     end_padding=5)

        #		btn_box.pack(CollectionButton(btn_box, self.app, self,
        #							self.prefpanel.dlg), fill=True, end_padding=5)

        self.update_palette_list()
Example #9
0
    def __init__(self, parent, dlg, cms, stops, onchange=None):
        self.dlg = dlg
        self.cms = cms
        self.stops = deepcopy(stops)
        if onchange:
            self.callback = onchange
        wal.VPanel.__init__(self, parent)
        self.pack((5, 5))
        self.viewer = GradientViewer(self,
                                     self.cms,
                                     self.stops,
                                     onclick=self.insert_stop)
        self.pack(self.viewer)
        self.stop_editor = StopsEditor(self,
                                       self.stops,
                                       onchange=self.set_selected_stop,
                                       onmove=self.change_stop_position)
        self.pack(self.stop_editor)
        self.pack((5, 5))

        hpanel = wal.HPanel(self)
        self.stop_panel = StopPanel(hpanel,
                                    self.dlg,
                                    self.cms,
                                    self.stops,
                                    onposition=self.change_stop_position,
                                    oncolor=self.update_colors)
        hpanel.pack((5, 5))
        hpanel.pack(self.stop_panel)
        hpanel.pack((5, 5))

        vpanel = wal.VPanel(hpanel)
        selpanel = wal.HPanel(vpanel)

        txt = _('Select first stop')
        self.go_first = wal.ImageButton(selpanel,
                                        icons.PD_GOTO_FIRST,
                                        wal.SIZE_16,
                                        tooltip=txt,
                                        flat=False,
                                        onclick=self.select_first)
        selpanel.pack(self.go_first, padding=5)

        txt = _('Select previous stop')
        self.go_prev = wal.ImageButton(selpanel,
                                       icons.PD_GO_BACK,
                                       wal.SIZE_16,
                                       tooltip=txt,
                                       flat=False,
                                       onclick=self.select_prev)
        selpanel.pack(self.go_prev, padding=5)

        txt = _('Select next stop')
        self.go_next = wal.ImageButton(selpanel,
                                       icons.PD_GO_FORWARD,
                                       wal.SIZE_16,
                                       tooltip=txt,
                                       flat=False,
                                       onclick=self.select_next)
        selpanel.pack(self.go_next, padding=5)

        txt = _('Select last stop')
        self.go_last = wal.ImageButton(selpanel,
                                       icons.PD_GOTO_LAST,
                                       wal.SIZE_16,
                                       tooltip=txt,
                                       flat=False,
                                       onclick=self.select_last)
        selpanel.pack(self.go_last, padding=5)

        vpanel.pack(selpanel)

        bpanel = wal.HPanel(vpanel)

        txt = _('Add stop')
        self.add_button = wal.ImageButton(bpanel,
                                          icons.PD_ADD,
                                          wal.SIZE_16,
                                          tooltip=txt,
                                          flat=False,
                                          onclick=self.add_stop)
        bpanel.pack(self.add_button, padding=5)

        txt = _('Delete selected stop')
        self.del_button = wal.ImageButton(bpanel,
                                          icons.PD_REMOVE,
                                          wal.SIZE_16,
                                          tooltip=txt,
                                          flat=False,
                                          onclick=self.delete_selected)
        bpanel.pack(self.del_button)

        txt = _('Reverse gradient')
        bpanel.pack(wal.Button(vpanel,
                               _('Reverse'),
                               tooltip=txt,
                               onclick=self.reverse_gradient),
                    padding=15)

        vpanel.pack(bpanel, padding=5)

        txt = _('Keep gradient vector')
        self.keep_vector = wal.Checkbox(vpanel, txt, True)
        vpanel.pack(self.keep_vector)

        hpanel.pack(vpanel, fill=True, expand=True, padding=5)

        self.pack(hpanel, fill=True)

        self.update()
Example #10
0
    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()