Пример #1
0
    def __init__(self, parent, prefpanel):
        CMS_Tab.__init__(self, parent, prefpanel)

        self.intents = INTENTS.keys()
        self.intents.sort()
        self.intents_names = []
        for item in self.intents:
            self.intents_names.append(INTENTS[item])

        panel = wal.VPanel(self.panel)

        #Intents panel
        int_panel = wal.LabeledPanel(panel, _('Rendering intents'))
        grid = wal.GridPanel(int_panel, vgap=5, hgap=5)

        grid.pack(wal.Label(grid, _('Display/RGB intent:')))
        self.display = wal.Combolist(grid, items=self.intents_names)
        self.display.set_active(self.intents.index(config.cms_rgb_intent))
        grid.pack(self.display)

        grid.pack(wal.Label(grid, _('Printer/CMYK intent:')))
        self.printer = wal.Combolist(grid, items=self.intents_names)
        self.printer.set_active(self.intents.index(config.cms_cmyk_intent))
        grid.pack(self.printer)

        int_panel.pack(grid, align_center=False, padding_all=10)
        panel.pack(int_panel, fill=True)

        #Simulate printer panel
        txt = _('Simulate printer on the screen')
        self.simulate_check = wal.Checkbox(panel,
                                           txt,
                                           config.cms_proofing,
                                           onclick=self.activate_simulation)

        sm_panel = wal.LabeledPanel(panel, widget=self.simulate_check)

        txt = _('Mark colors that are out of the printer gamut')
        self.outcolors_check = wal.Checkbox(sm_panel,
                                            txt,
                                            config.cms_gamutcheck,
                                            onclick=self.activate_outcolors)
        sm_panel.pack(self.outcolors_check, align_center=False, padding_all=5)

        clrpanel = wal.HPanel(sm_panel)
        clrpanel.pack((20, 1))
        self.alarm_label = wal.Label(clrpanel, _('Alarm color:'))
        clrpanel.pack(self.alarm_label, padding=5)
        self.color_btn = wal.ColorButton(clrpanel, config.cms_alarmcodes)
        clrpanel.pack(self.color_btn)
        sm_panel.pack(clrpanel, align_center=False, padding_all=2)

        txt = _('Separation for SPOT colors')
        self.separation_check = wal.Checkbox(sm_panel,
                                             txt,
                                             config.cms_proof_for_spot,
                                             onclick=self.activate_outcolors)
        sm_panel.pack(self.separation_check, align_center=False, padding_all=5)

        panel.pack(sm_panel, fill=True, padding=5)

        #Bottom checks
        txt = _('Use Blackpoint Compensation')
        self.bpc_check = wal.Checkbox(panel, txt, config.cms_bpc_flag)
        panel.pack(self.bpc_check, align_center=False)

        txt = _('Use Black preserving transforms')
        self.bpt_check = wal.Checkbox(panel, txt, config.cms_bpt_flag)
        panel.pack(self.bpt_check, align_center=False)

        self.panel.pack(panel, fill=True, padding_all=5)
        self.activate_simulation()
Пример #2
0
    def build(self):
        txt = _('Create new document on start')
        self.newdoc = wal.Checkbox(self, txt, config.new_doc_on_start)
        self.pack(self.newdoc, align_center=False, start_padding=5)

        if wal.is_msw(): self.pack((5, 5))

        txt = _('Make backup on document save')
        self.backup = wal.Checkbox(self, txt, config.make_backup)
        self.pack(self.backup, align_center=False)

        if wal.is_msw(): self.pack((5, 5))

        txt = _('Make backup on export')
        self.expbackup = wal.Checkbox(self, txt, config.make_export_backup)
        self.pack(self.expbackup, align_center=False)

        if wal.is_msw(): self.pack((5, 5))

        grid = wal.GridPanel(self, rows=2, cols=3, hgap=5, vgap=3)
        grid.pack(wal.Label(grid, _('History log size:')))
        self.hist_size = wal.IntSpin(grid, config.history_size, (10, 1000))
        grid.pack(self.hist_size)
        grid.pack(wal.Label(grid, _('records')))
        grid.pack(wal.Label(grid, _('History menu size:')))
        self.hist_menu_size = wal.IntSpin(grid, config.history_list_size,
                                          (5, 20))
        grid.pack(self.hist_menu_size)
        grid.pack(wal.Label(grid, _('records')))
        self.pack(grid, align_center=False, padding=5)

        if wal.is_msw(): self.pack((5, 5))

        txt = _('Make font cache on start')
        self.fcache = wal.Checkbox(self, txt, config.make_font_cache_on_start)
        self.pack(self.fcache, align_center=False)

        if wal.is_msw(): self.pack((5, 5))

        txt = _('Show quick access buttons')
        self.stub_buttons = wal.Checkbox(self, txt, config.show_stub_buttons)
        self.pack(self.stub_buttons, align_center=False)

        if wal.is_msw(): self.pack((5, 5))

        if not config.is_mac():
            txt = _('Use overlay for spinbox widgets (*)')
            self.spin_overlay = wal.Checkbox(self, txt, config.spin_overlay)
            self.pack(self.spin_overlay, align_center=False)

        if wal.is_gtk():
            txt = _('Separate spin in spinbox widgets (*)')
            self.spin_sep = wal.Checkbox(self, txt, config.spin_sep)
            self.pack(self.spin_sep, align_center=False)

        if wal.is_unity():
            txt = _('Unity related features')
            self.pack(wal.Label(grid, txt, fontsize=2, fontbold=True),
                      start_padding=10)
            self.pack(wal.HLine(self), fill=True, padding=2)

            txt = _('Use Unity Global Menu (*)')
            self.ubuntu_gm = wal.Checkbox(self, txt, config.ubuntu_global_menu)
            self.pack(self.ubuntu_gm, align_center=False)

            txt = _('Allow overlay for scrollbars (*)')
            self.ubuntu_overlay = wal.Checkbox(self, txt,
                                               config.ubuntu_scrollbar_overlay)
            self.pack(self.ubuntu_overlay, align_center=False)

        if not config.is_mac():
            self.pack(wal.HPanel(self), expand=True, fill=True)
            txt = _('(*) - These options require application restart')
            self.pack(wal.Label(grid, txt, fontsize=-1), align_center=False)

        self.built = True
Пример #3
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()
Пример #4
0
    def build(self):

        self.nb = wal.Notebook(self)

        # ========Palette options
        pal_opt = wal.VPanel(self.nb)
        pal_opt.pack((10, 10))

        grid = wal.GridPanel(self, hgap=5, vgap=5)
        grid.add_growable_col(1)

        txt = _('Current palette:')
        grid.pack(wal.Label(grid, txt))

        pal_list = self.get_palette_list()
        self.pal = wal.Combolist(grid,
                                 items=pal_list,
                                 onchange=self.change_palette)
        current_palette = self.get_current_palette()
        current_palette_name = current_palette.model.name
        self.pal.set_active(pal_list.index(current_palette_name))
        grid.pack(self.pal, fill=True)

        txt = _('Palette orientation:')
        grid.pack(wal.Label(grid, txt))
        self.pal_orient = wal.Combolist(grid, items=PAL_ORIENT)
        self.pal_orient.set_active(config.palette_orientation)
        grid.pack(self.pal_orient)

        pal_opt.pack(grid, fill=True, padding_all=5)

        btm_panel = wal.HPanel(pal_opt)
        pal_opt.pack(btm_panel, expand=True, fill=True)

        cell_panel = wal.VPanel(btm_panel)
        btm_panel.pack(cell_panel, expand=True, fill=True, padding_all=5)

        # ===
        txt = _('Vertical palette')
        vcell_panel = wal.LabeledPanel(cell_panel, text=txt)

        grid = wal.GridPanel(vcell_panel, cols=4, hgap=5, vgap=2)

        grid.pack((15, 1))
        grid.pack(wal.Label(grid, _('Cell width:')))
        self.vcell_width = wal.IntSpin(grid, config.palette_vcell_width,
                                       (10, 20))
        self.vcell_width.set_enable(False)
        grid.pack(self.vcell_width)
        grid.pack(wal.Label(grid, _('px')))

        grid.pack((15, 1))
        grid.pack(wal.Label(grid, _('Cell height:')))
        self.vcell_height = wal.IntSpin(grid, config.palette_vcell_height,
                                        (10, 100))
        grid.pack(self.vcell_height)
        grid.pack(wal.Label(grid, _('px')))

        vcell_panel.pack(grid, align_center=False, padding_all=5)
        cell_panel.pack(vcell_panel, fill=True)

        # ===
        txt = _('Horizontal palette')
        hcell_panel = wal.LabeledPanel(cell_panel, text=txt)

        grid = wal.GridPanel(hcell_panel, cols=4, hgap=5, vgap=2)

        grid.pack((15, 1))
        grid.pack(wal.Label(grid, _('Cell width:')))
        self.hcell_width = wal.IntSpin(grid, config.palette_hcell_width,
                                       (10, 100))
        grid.pack(self.hcell_width)
        grid.pack(wal.Label(grid, _('px')))

        grid.pack((15, 1))
        grid.pack(wal.Label(grid, _('Cell height:')))
        self.hcell_height = wal.IntSpin(grid, config.palette_hcell_height,
                                        (10, 20))
        self.hcell_height.set_enable(False)
        grid.pack(self.hcell_height)
        grid.pack(wal.Label(grid, _('px')))

        hcell_panel.pack(grid, align_center=False, padding_all=5)
        cell_panel.pack(hcell_panel, fill=True, padding=5)
        # ===

        txt = _('Expand short palettes')
        self.expand = wal.Checkbox(cell_panel, txt, config.palette_expand)
        cell_panel.pack(self.expand, align_center=False)

        self.palviewer = PaletteViewer(btm_panel, self.app.default_cms,
                                       current_palette)
        btm_panel.pack(self.palviewer, fill=True, padding_all=5)

        self.nb.add_page(pal_opt, _('Palette options'))

        # ========Palette management
        self.nb.add_page(PaletteManager(self.app, self, self.nb),
                         _('Palette management'))

        self.pack(self.nb, expand=True, fill=True)
        self.built = True
Пример #5
0
    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)
Пример #6
0
 def build(self):
     self.pack(wal.HPanel(self), fill=True, expand=True)
     self.pack(PaletteSwatch(self, self.cms, [], (250, 150)))
     txt = _('Empty pattern selected')
     self.pack(wal.Label(self, txt), padding=10)
     self.pack(wal.HPanel(self), fill=True, expand=True)
Пример #7
0
    def build(self):
        self.pack(wal.Label(self, _('Size (px):'), fontbold=True))

        grid = wal.GridPanel(self, rows=3, cols=4, hgap=10, vgap=5)

        # Ruler size
        grid.pack(wal.Label(grid, _('Ruler:')))
        self.ruler_size = wal.IntSpin(grid,
                                      config.ruler_size, (15, 30),
                                      onchange=self.update_ruler)
        grid.pack(self.ruler_size)

        # Ruler font size
        grid.pack(wal.Label(grid, _('Ruler font:')))
        self.ruler_font_size = wal.IntSpin(grid,
                                           config.ruler_font_size, (5, 8),
                                           onchange=self.update_ruler)
        grid.pack(self.ruler_font_size)

        # Small tick size
        grid.pack(wal.Label(grid, _('Small tick:')))
        self.ruler_small_tick = wal.IntSpin(grid,
                                            config.ruler_small_tick, (2, 30),
                                            onchange=self.update_ruler)
        grid.pack(self.ruler_small_tick)

        # Large tick size
        grid.pack(wal.Label(grid, _('Large tick:')))
        self.ruler_large_tick = wal.IntSpin(grid,
                                            config.ruler_large_tick, (2, 30),
                                            onchange=self.update_ruler)
        grid.pack(self.ruler_large_tick)

        self.pack(grid, padding_all=10)

        self.pack(wal.Label(self, _('Text shift (px):'), fontbold=True))

        grid = wal.GridPanel(self, rows=1, cols=4, hgap=10, vgap=5)

        # Vertical text shift
        grid.pack(wal.Label(grid, _('Vertical:')))
        self.ruler_text_vshift = wal.IntSpin(grid,
                                             config.ruler_text_vshift, (0, 30),
                                             onchange=self.update_ruler)
        grid.pack(self.ruler_text_vshift)

        # Horizontal text shift
        grid.pack(wal.Label(grid, _('Horizontal:')))
        self.ruler_text_hshift = wal.IntSpin(grid,
                                             config.ruler_text_hshift, (0, 30),
                                             onchange=self.update_ruler)
        grid.pack(self.ruler_text_hshift)

        self.pack(grid, padding_all=10)

        grid = wal.GridPanel(self, hgap=15, vgap=5)

        # Ruler bg color
        grid.pack(wal.Label(grid, _('Ruler background color:')))
        self.bg_btn = wal.ColorButton(grid,
                                      config.ruler_bg,
                                      onchange=self.update_ruler)
        grid.pack(self.bg_btn)

        # Ruler fg color
        grid.pack(wal.Label(grid, _('Ruler mark color:')))
        self.fg_btn = wal.ColorButton(grid,
                                      config.ruler_fg,
                                      onchange=self.update_ruler)
        grid.pack(self.fg_btn)

        self.pack(grid, padding_all=15)

        # Testing ruler
        self.pack(wal.Label(self, _('Ruler preview:'), fontbold=True),
                  padding_all=10)
        panel = wal.HPanel(self)
        panel.add((360, 1))
        panel.set_bg(wal.UI_COLORS['disabled_text'])
        self.pack(panel)

        self.ruler = RulerTest(self, self)
        self.pack(self.ruler)

        self.built = True
Пример #8
0
    def build(self):
        self.page_format = self.doc.methods.get_default_page_format()
        self.formats = [
            _('Custom'),
        ] + uc2const.PAGE_FORMAT_NAMES
        self.pack((5, 10))

        # ---
        hpanel = wal.HPanel(self)
        hpanel.pack((5, 5))
        label = wal.Label(hpanel, _('Default page:'))
        hpanel.pack(label)
        hpanel.pack((5, 5))
        self.page_combo = wal.Combolist(self,
                                        items=self.formats,
                                        onchange=self.page_combo_changed)
        index = 0
        state = True
        if self.page_format[0] in uc2const.PAGE_FORMAT_NAMES:
            index = self.formats.index(self.page_format[0])
            state = False
        self.page_combo.set_active(index)

        hpanel.pack(self.page_combo)

        hpanel.pack((15, 5))

        self.orient_keeper = wal.HToggleKeeper(self,
                                               ORIENTS,
                                               ORIENTS_ICONS,
                                               ORIENTS_NAMES,
                                               on_change=self.orient_changed)
        self.orient_keeper.set_mode(self.page_format[2])
        hpanel.pack(self.orient_keeper)

        self.pack(hpanel, fill=True)

        self.pack((5, 5))

        # ---
        w, h = self.page_format[1]
        hpanel = wal.HPanel(self)
        dx = label.get_size()[0] + 10
        hpanel.pack((dx, 5))

        self.page_width = UnitSpin(self.app,
                                   hpanel,
                                   w,
                                   onchange=self.page_spin_changed)
        hpanel.pack(self.page_width)
        hpanel.pack(get_bmp(self, icons.CTX_W_ON_H), padding=5)
        self.page_height = UnitSpin(self.app,
                                    hpanel,
                                    h,
                                    onchange=self.page_spin_changed)
        hpanel.pack(self.page_height)
        hpanel.pack(StaticUnitLabel(self.app, hpanel), padding=5)
        self.page_width.set_enable(state)
        self.page_height.set_enable(state)

        self.pack(hpanel, fill=True)
        self.pack(wal.HLine(self), padding_all=5, fill=True)

        # ---
        hpanel = wal.HPanel(self)
        hpanel.pack((5, 5))
        self.desktop_bg = self.doc.methods.get_desktop_bg()

        grid = wal.GridPanel(hpanel, 3, 3, 5, 5)
        grid.add_growable_col(2)

        grid.pack(wal.Label(hpanel, _('Desktop:')))
        self.desktop_color_btn = wal.ColorButton(hpanel, self.desktop_bg)
        grid.pack(self.desktop_color_btn)
        grid.pack(CBMiniPalette(grid,
                                onclick=self.desktop_color_btn.set_value))

        self.page_fill = self.doc.methods.get_page_fill()
        if self.page_fill[0] == FILL_SOLID:
            color1 = self.page_fill[1]
            color2 = [1.0, 1.0, 1.0]
        else:
            color1 = self.page_fill[1][0]
            color2 = self.page_fill[1][1]

        grid.pack(wal.Label(hpanel, _('Page:')))
        self.page_color1_btn = wal.ColorButton(hpanel, color1)
        grid.pack(self.page_color1_btn)
        grid.pack(CBMiniPalette(grid, onclick=self.page_color1_btn.set_value))

        grid.pack((5, 5))
        self.page_color2_btn = wal.ColorButton(hpanel, color2)
        grid.pack(self.page_color2_btn)
        self.colors2 = CBMiniPalette(grid,
                                     onclick=self.page_color2_btn.set_value)
        grid.pack(self.colors2)
        if not self.page_fill[0] == FILL_PATTERN:
            self.page_color2_btn.set_enable(False)
            self.colors2.set_enable(False)

        hpanel.pack(grid, fill=True)
        hpanel.pack((5, 5))
        self.pack(hpanel, fill=True)

        # ---
        vpanel = wal.VPanel(self)
        if wal.IS_MSW: vpanel.pack((5, 5))

        self.pattern_check = wal.Checkbox(vpanel,
                                          _('Use pattern for page fill'),
                                          self.page_fill[0] == FILL_PATTERN,
                                          onclick=self.pattern_check_changed)
        vpanel.pack(self.pattern_check, align_center=False)

        if wal.IS_MSW: vpanel.pack((5, 5))

        self.border_flag = self.doc.methods.get_page_border()
        self.border_check = wal.Checkbox(vpanel, _('Show page border'),
                                         self.border_flag)
        vpanel.pack(self.border_check, align_center=False)
        self.pack(vpanel, fill=True, padding_all=5)
Пример #9
0
    def build(self):
        self.printsys = self.get_printsys()
        self.prn_list = self.printsys.get_printer_names()
        if self.prn_list:
            self.active_printer = self.printsys.get_default_printer()
            hpanel = wal.HPanel(self)
            hpanel.pack(wal.Label(hpanel, _('Printer:')))
            hpanel.pack((5, 5))
            self.prn_combo = wal.Combolist(hpanel,
                                           items=self.prn_list,
                                           onchange=self.set_data)
            hpanel.pack(self.prn_combo, fill=True, expand=True)
            index = self.prn_list.index(self.active_printer.get_name())
            self.prn_combo.set_active(index)
            self.pack(hpanel, fill=True, padding_all=5)

            self.pack((10, 10))

            # ---Panels
            self.insp = self.app.insp
            units = uc2const.UNIT_MM
            if self.insp.is_doc():
                units = self.app.current_doc.model.doc_units
            units_text = uc2const.unit_short_names[units]

            # ---Shift panel
            shifts = self.active_printer.shifts
            hpanel = wal.HPanel(self)
            txt = _('Printing shift') + ' (%s)' % units_text
            spanel = wal.LabeledPanel(hpanel, text=txt)
            spanel.pack((1, 1), expand=True)

            grid = wal.GridPanel(spanel, 2, 2, 5, 5)

            grid.pack(wal.Label(grid, _('Horizontal shift:')))
            self.hshift = StaticUnitSpin(self.app,
                                         grid,
                                         shifts[0],
                                         can_be_negative=True,
                                         onchange=self.save_data,
                                         onenter=self.save_data)
            grid.pack(self.hshift)

            grid.pack(wal.Label(grid, _('Vertical shift:')))
            self.vshift = StaticUnitSpin(self.app,
                                         grid,
                                         shifts[1],
                                         can_be_negative=True,
                                         onchange=self.save_data,
                                         onenter=self.save_data)
            grid.pack(self.vshift)

            spanel.pack(grid, padding_all=5)
            spanel.pack((1, 1), expand=True)

            hpanel.pack(spanel, fill=True, expand=True)

            hpanel.pack((5, 5))

            # ---Margin panel
            txt = _('Printing margins') + ' (%s)' % units_text
            mpanel = wal.LabeledPanel(hpanel, text=txt)
            mpanel.pack((5, 5))

            mrgs = self.active_printer.margins
            self.top_spin = StaticUnitSpin(self.app,
                                           mpanel,
                                           mrgs[0],
                                           onchange=self.save_data,
                                           onenter=self.save_data)
            mpanel.pack(self.top_spin)

            mpanel.pack((5, 5))

            hp = wal.HPanel(self)
            self.left_spin = StaticUnitSpin(self.app,
                                            hp,
                                            mrgs[3],
                                            onchange=self.save_data,
                                            onenter=self.save_data)
            hp.pack(self.left_spin)
            hp.pack((5, 5))
            self.right_spin = StaticUnitSpin(self.app,
                                             hp,
                                             mrgs[1],
                                             onchange=self.save_data,
                                             onenter=self.save_data)
            hp.pack(self.right_spin)

            mpanel.pack(hp)

            mpanel.pack((5, 5))

            self.bottom_spin = StaticUnitSpin(self.app,
                                              mpanel,
                                              mrgs[2],
                                              onchange=self.save_data,
                                              onenter=self.save_data)
            mpanel.pack(self.bottom_spin)

            mpanel.pack((10, 10))
            # ---

            hpanel.pack(mpanel, fill=True, expand=True)

            self.pack(hpanel, fill=True)

            self.pack((10, 10))

            # ---Calibration page
            text = _("To measure real print area and vertical/horizontal "
                     "printing shift just print calibration page on the "
                     "A4/Letter sheet.")

            label = wal.Label(self, text)
            label.wrap(470)
            self.pack(label, fill=True, padding_all=5, align_center=False)

            self.a4_calibrate_btn = wal.Button(
                self,
                _('Print A4 calibration page'),
                onclick=self.print_calibration_a4)
            self.pack(self.a4_calibrate_btn)

            self.pack((5, 5))

            self.letter_calibrate_btn = wal.Button(
                self,
                _('Print Letter calibration page'),
                onclick=self.print_calibration_letter)
            self.pack(self.letter_calibrate_btn)

            self.pack((5, 5))

        else:
            self.pack((5, 5), expand=True)
            self.pack(get_bmp(self, icons.PD_NO_PRINTERS), padding=10)
            self.pack(wal.Label(self, _('Cannot found installed printers!')))
            self.pack((10, 10))
            self.pack((5, 5), expand=True)
        self.built = True
Пример #10
0
    def __init__(self, app, parent):
        self.app = app
        self.mw = parent
        wal.VPanel.__init__(self, parent)

        self.ctxpanel = AppCtxPanel(self.app, self)
        self.doc_tabs = DocTabPanel(app, self,
                                    config.ui_style != appconst.GUI_CLASSIC)

        if config.ui_style == appconst.GUI_CLASSIC:
            if not wal.IS_MAC:
                self.pack(wal.HLine(self), fill=True)
            self.pack(self.ctxpanel, fill=True, padding=1)
            self.pack(self.doc_tabs, fill=True)

        if config.ui_style == appconst.GUI_TABBED:
            self.pack(self.doc_tabs, fill=True)
            self.pack(self.ctxpanel, fill=True, padding=2)
            self.pack(wal.PLine(self), fill=True)

        # ===== Main part
        hpanel = wal.HPanel(self)
        self.pack(hpanel, expand=True, fill=True)

        # ----- Tools
        self.tools = AppTools(self.app, hpanel)
        hpanel.pack(self.tools, fill=True, padding_all=2)
        hpanel.pack(wal.PLine(hpanel), fill=True)

        self.splitter = wal.Splitter(hpanel)

        # ----- Doc Area
        self.grid_panel = wal.GridPanel(self.splitter)
        self.grid_panel.add_growable_col(1)
        self.grid_panel.add_growable_row(1)
        self.corner = RulerSurface(self.app, self.grid_panel)
        self.grid_panel.add(self.corner)
        self.hruler = HRulerSurface(self.app, self.grid_panel)
        self.grid_panel.pack(self.hruler, fill=True)
        self.vruler = VRulerSurface(self.app, self.grid_panel)
        self.grid_panel.pack(self.vruler, fill=True)

        int_grid = wal.GridPanel(self.grid_panel)
        int_grid.add_growable_col(0)
        int_grid.add_growable_row(0)
        self.canvas = CanvasSurface(self.app, int_grid)
        int_grid.pack(self.canvas, fill=True)
        self.vscroll = wal.ScrollBar(int_grid)
        int_grid.pack(self.vscroll, fill=True)
        self.hscroll = wal.ScrollBar(int_grid, vertical=False)
        int_grid.pack(self.hscroll, fill=True)
        self.viewer = wal.VPanel(int_grid)
        int_grid.pack(self.viewer, fill=True)

        self.canvas.set_scrolls(self.hscroll, self.vscroll)
        self.grid_panel.pack(int_grid, fill=True)

        # ----- Doc Area End
        self.plg_area = PlgArea(self.app, self.splitter)
        self.app.mdiarea = self
        self.app.plg_area = self.plg_area

        self.splitter.split_vertically(self.grid_panel, self.plg_area)
        self.splitter.set_min_size(200)
        self.splitter.set_sash_gravity(1.0)
        self.splitter.unsplit()
        hpanel.pack(self.splitter, expand=True, fill=True)

        # ----- Vertical Palette panel
        self.vp_panel = wal.HPanel(hpanel)
        self.vp_panel.pack(wal.PLine(self.vp_panel), fill=True)
        vpalette_panel = AppVPalette(self.vp_panel, self.app)
        self.vp_panel.pack(vpalette_panel, fill=True, padding=2)
        hpanel.pack(self.vp_panel, fill=True)
        if config.palette_orientation == uc2const.HORIZONTAL:
            self.vp_panel.hide()

        # ----- Horizontal Palette panel
        self.hp_panel = wal.VPanel(self)
        self.hp_panel.pack(wal.PLine(self.hp_panel), fill=True)
        hpalette_panel = AppHPalette(self.hp_panel, self.app)
        self.hp_panel.pack(hpalette_panel, fill=True, padding=2)
        self.pack(self.hp_panel, fill=True)

        self.change_palette()

        # ----- Status bar
        self.pack(wal.PLine(self), fill=True)
        self.statusbar = AppStatusbar(self)
        self.pack(self.statusbar, fill=True, padding=2)

        self.layout()
        events.connect(events.CONFIG_MODIFIED, self.config_update)
Пример #11
0
    def __init__(self,
                 parent,
                 app,
                 trafo=[] + sk2const.NORMAL_TRAFO,
                 transforms=[] + sk2const.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,
                                     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,
                                     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,
                                     onchange=self.changes,
                                     onenter=self.changes)
        grid.pack(self.shear_x)
        grid.pack(wal.Label(grid, u'°'))

        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,
                                     onchange=self.changes,
                                     onenter=self.changes)
        grid.pack(self.shear_y)
        grid.pack(wal.Label(grid, u'°'))

        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,
                                    onchange=self.changes,
                                    onenter=self.changes)
        rot_panel.pack(self.rotate, padding=3)
        rot_panel.pack(wal.Label(rot_panel, u'°'))

        self.pack(rot_panel, padding=5)

        self.set_trafo(trafo, transforms)
Пример #12
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,
                               art_size=wal.SIZE_16,
                               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)
        self.layout()
Пример #13
0
    def build_ui(self):
        self.icon = get_icon(PLUGIN_ICON)

        self.config = IconizerConfig()
        config_dir = self.app.appdata.app_config_dir
        config_file = os.path.join(config_dir, 'iconizer_config.xml')
        self.config.load(config_file)

        self.panel.pack((5, 5))
        hpanel = wal.HPanel(self.panel)
        hpanel.pack(wal.Label(hpanel, _('Background:')))
        self.bg_color_btn = wal.ColorButton(hpanel,
                                            self.config.bg_color,
                                            onchange=self.update,
                                            silent=False)
        hpanel.pack((5, 5))
        hpanel.pack(self.bg_color_btn)
        self.panel.pack(hpanel, padding=5)

        self.pallete = CBMiniPalette(self.panel,
                                     COLORS,
                                     onclick=self.bg_color_btn.set_value)
        self.panel.pack(self.pallete)

        self.panel.pack((10, 10))

        self.viewer = ImageViewer(self.panel, self.config.bg_color)
        self.panel.pack(self.viewer)

        self.panel.pack((10, 10))

        check_panel = wal.VPanel(self.panel)

        self.border_check = wal.Checkbox(check_panel,
                                         _('Show image border'),
                                         value=self.config.draw_border,
                                         onclick=self.update)
        check_panel.pack(self.border_check, align_center=False)

        self.sel_check = wal.Checkbox(check_panel,
                                      _('Draw selected only'),
                                      value=self.config.draw_selected,
                                      onclick=self.update)
        check_panel.pack(self.sel_check, align_center=False)

        self.panel.pack(check_panel)

        self.apply_btn = wal.Button(self.panel,
                                    _('Save image'),
                                    onclick=self.apply_action)
        self.panel.pack(self.apply_btn, fill=True, padding_all=5)

        self.panel.pack((5, 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.timer = wal.CanvasTimer(self.panel,
                                     delay=REFRESH_DELAY,
                                     on_timer=self.repaint)
Пример #14
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=_('Layer to bottom'),
            onclick=self.lower_layer_to_bottom)
        self.layer_lower = wal.ImageButton(pnl,
                                           icons.PD_LOWER,
                                           tooltip=_('Lower layer'),
                                           onclick=self.lower_layer)
        self.layer_raise = wal.ImageButton(pnl,
                                           icons.PD_RAISE,
                                           tooltip=_('Raise layer'),
                                           onclick=self.raise_layer)
        self.layer_to_top = wal.ImageButton(pnl,
                                            icons.PD_RAISE_TO_TOP,
                                            tooltip=_('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 = []
        for item in BITMAPS:
            bmp.append(make_artid(item))
        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)
        self.update()
Пример #15
0
    def __init__(self, app, parent):
        self.app = app
        self.mw = parent
        self.docareas = []
        wal.VPanel.__init__(self, parent)

        if not wal.IS_MAC:
            self.pack(wal.HLine(self), fill=True)

        # ----- Context panel
        self.ctxpanel = AppCtxPanel(self.app, self)
        self.pack(self.ctxpanel, fill=True, padding=1)

        # ----- Doc tabs
        self.dtp = DocTabsPanel(self)
        self.doc_tabs = self.dtp.doc_tabs
        self.pack(self.dtp, fill=True)

        hpanel = wal.HPanel(self)
        self.pack(hpanel, expand=True, fill=True)

        # ----- Tools
        self.tools = AppTools(self.app, hpanel)
        hpanel.pack(self.tools, fill=True, padding_all=2)
        hpanel.pack(wal.PLine(hpanel), fill=True)

        self.splitter = wal.Splitter(hpanel)
        self.doc_keeper = wal.VPanel(self.splitter)
        self.doc_keeper.SetBackgroundColour(wal.WHITE)
        self.plg_area = PlgArea(self.app, self.splitter)
        self.app.mdiarea = self
        self.app.plg_area = self.plg_area

        self.splitter.split_vertically(self.doc_keeper, self.plg_area)
        self.splitter.set_min_size(200)
        self.splitter.set_sash_gravity(1.0)
        self.splitter.unsplit()
        hpanel.pack(self.splitter, expand=True, fill=True)

        # ----- Vertical Palette panel
        self.vp_panel = wal.HPanel(hpanel)
        self.vp_panel.pack(wal.PLine(self.vp_panel), fill=True)
        vpalette_panel = AppVPalette(self.vp_panel, self.app)
        self.vp_panel.pack(vpalette_panel, fill=True, padding=2)
        hpanel.pack(self.vp_panel, fill=True, start_padding=2)
        if config.palette_orientation == uc2const.HORIZONTAL:
            self.vp_panel.hide()

        # ----- Horizontal Palette panel
        self.hp_panel = wal.VPanel(self)
        self.hp_panel.pack(wal.PLine(self.hp_panel), fill=True)
        hpalette_panel = AppHPalette(self.hp_panel, self.app)
        self.hp_panel.pack(hpalette_panel, fill=True, padding=2)
        self.pack(self.hp_panel, fill=True)

        self.change_palette()

        # ----- Status bar
        self.pack(wal.PLine(self), fill=True)
        self.statusbar = AppStatusbar(self)
        self.pack(self.statusbar, fill=True, padding=2)

        self.layout()
        events.connect(events.CONFIG_MODIFIED, self.config_update)