def __init__(self, parent, prefpanel): CMS_Tab.__init__(self, parent, prefpanel) txt = _('Activate Color Management') panel = wal.VPanel(self) hp = wal.HPanel(panel) self.cms_check = wal.Checkbox(hp, txt, config.cms_use, onclick=self.activate_cms) hp.pack(self.cms_check) panel.pack(hp, fill=True, padding_all=3) self.banner = wal.VPanel(panel) self.banner.set_bg(wal.DARK_GRAY) bmp = get_bmp(self.banner, icons.PD_PREFS_CMS_BANNER) self.banner.pack(bmp, padding=2) panel.pack(self.banner, expand=True, fill=True) txt = _( 'Note: If Color Management is not activated all colors ' 'will be processed using simple calculation procedures. Therefore ' 'resulted color values will be not accurate.') fontsize = -3 if wal.is_msw(): fontsize = -1 label = wal.Label(self, txt, fontsize=fontsize) label.set_enable(False) if wal.is_msw(): label.wrap(430) panel.pack(label, fill=True, padding_all=5) self.pack(panel, fill=True, expand=True)
def __init__(self, parent, cms, color=None): self.cms = cms if not color: color = get_registration_black() wal.VPanel.__init__(self, parent, True) if wal.is_msw(): self.set_bg(wal.GRAY) inner_panel = wal.VPanel(self) inner_panel.set_bg(wal.WHITE) nf = wal.VPanel(inner_panel) nf.set_bg(wal.BLACK) self.name_field = wal.Label(nf, '???', fontbold=True, fg=wal.WHITE) nf.pack(self.name_field, padding_all=3) vf = wal.VPanel(inner_panel) vf.set_bg(wal.WHITE) self.color_type = wal.Label(vf, '???', fontbold=True, fontsize=-1) self.line1 = wal.Label(vf, '???', fontsize=-1) self.line2 = wal.Label(vf, '???', fontsize=-1) vf.pack(self.color_type, padding_all=3) vf.pack(self.line1, padding_all=1) vf.pack(self.line2, padding_all=1) self.color_swatch = AlphaColorSwatch(inner_panel, self.cms, color, (180, 100), border='') inner_panel.pack(nf, fill=True) inner_panel.pack(vf, fill=True) inner_panel.pack(self.color_swatch, fill=True, expand=True) padding = 0 if wal.is_msw(): padding = 1 self.pack(inner_panel, fill=True, expand=True, padding_all=padding) self.layout()
def __init__(self, parent, prefpanel): CMS_Tab.__init__(self, parent, prefpanel) txt = _('Activate Color Management') panel = wal.VPanel(self) hp = wal.HPanel(panel) self.cms_check = wal.Checkbox(hp, txt, config.cms_use, onclick=self.activate_cms) hp.pack(self.cms_check) panel.pack(hp, fill=True, padding_all=3) self.banner = wal.VPanel(panel) self.banner.set_bg(wal.DARK_GRAY) bmp = get_bmp(self.banner, icons.PD_PREFS_CMS_BANNER) self.banner.pack(bmp, padding=2) panel.pack(self.banner, expand=True, fill=True) txt = _('Note: If Color Management is not activated all colors ' 'will be processed using simple calculation procedures. Therefore ' 'resulted color values will be not accurate.') fontsize = -3 if wal.is_msw(): fontsize = -1 label = wal.Label(self, txt, fontsize=fontsize) label.set_enable(False) if wal.is_msw():label.wrap(430) panel.pack(label, fill=True, padding_all=5) self.pack(panel, fill=True, expand=True)
def __init__(self, parent, action): self.action = action value = False art_id = action.get_artid() art_size = wal.DEF_SIZE text = '' tooltip = action.get_tooltip_text() padding = 0 decoration_padding = 3 if wal.is_msw(): decoration_padding = 2 wal.ImageToggleButton.__init__(self, parent, value, art_id, art_size, text, tooltip, padding, decoration_padding, True, onchange=action.do_call) self.action.register(self)
def get_printsys(self): if wal.is_msw(): from sk1.printing.msw_print import MSW_PS return MSW_PS(self.app, physical_only=True) else: from sk1.printing.cups_print import CUPS_PS return CUPS_PS(physical_only=True)
def __init__(self, mw): if wal.is_msw(): FONTSIZE[0] = 0 elif not FONTSIZE[0]: FONTSIZE[0] = str(wal.get_system_fontsize()[1]) self.mw = mw wal.HPanel.__init__(self, mw) self.pack((5, 20)) self.mouse_info = MouseMonitor(self.mw.app, self) self.pack(self.mouse_info) self.mouse_info.hide() self.snap_monitor = SnapMonitor(self.mw.app, self) self.pack(self.snap_monitor) self.page_info = PageMonitor(self.mw.app, self) self.pack(self.page_info) self.page_info.hide() info_panel = wal.HPanel(self) info_panel.pack(get_bmp(info_panel, icons.PD_APP_STATUS)) info_panel.pack((5, 3)) self.info = wal.Label(info_panel, text='', fontsize=FONTSIZE[0]) info_panel.pack(self.info) self.pack(info_panel, expand=True) self.clr_monitor = ColorMonitor(self.mw.app, self) self.pack(self.clr_monitor) self.clr_monitor.hide() events.connect(events.APP_STATUS, self._on_event)
def __init__(self, presenter, parent, style=HORIZONTAL): self.presenter = presenter self.eventloop = presenter.eventloop self.style = style HPanel.__init__(self, parent) if not VFONT: load_font() size = config.ruler_size self.add((size, size)) self.default_cursor = self.GetCursor() if self.style == HORIZONTAL: self.guide_cursor = self.presenter.app.cursors[modes.HGUIDE_MODE] else: self.guide_cursor = self.presenter.app.cursors[modes.VGUIDE_MODE] self.SetBackgroundColour(wx.WHITE) self.set_double_buffered() self.Bind(wx.EVT_PAINT, self._on_paint, self) self.Bind(wx.EVT_LEFT_DOWN, self.mouse_down) self.Bind(wx.EVT_LEFT_UP, self.mouse_up) self.Bind(wx.EVT_MOTION, self.mouse_move) self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self.capture_lost) self.eventloop.connect(self.eventloop.VIEW_CHANGED, self.repaint) events.connect(events.CONFIG_MODIFIED, self.check_config) if wal.is_msw(): self.SetDoubleBuffered(True) if is_mac(): self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self._repaint_after) self.timer.Start(50)
def paint(self): w, h = self.get_size() shift = 0 if wal.is_msw(): shift = 1 if self.surface is None: self.surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w - shift, h - shift) self.width = w self.height = h elif self.width <> w or self.height <> h: self.surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w - shift, h - shift) self.width = w self.height = h self.ctx = cairo.Context(self.surface) self.ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)) self.ctx.set_source_rgb(*config.ruler_bg) self.ctx.paint() self.ctx.set_antialias(cairo.ANTIALIAS_NONE) self.ctx.set_line_width(1.0) self.ctx.set_dash([]) self.ctx.set_source_rgb(*config.ruler_fg) if self.horizontal: self.hrender(w, h) else: self.vrender(w, h) self.draw_bitmap(wal.copy_surface_to_bitmap(self.surface))
def __init__(self, parent, action): self.action = action art_id = action.get_artid() art_size = wal.DEF_SIZE text = '' tooltip = action.get_tooltip_text() padding = 0 decoration_padding = 3 native = True if wal.is_msw(): decoration_padding = 2 native = False wal.ImageButton.__init__(self, parent, art_id, art_size, text, tooltip, padding, decoration_padding, True, native, onclick=action.do_call) self.action.register(self)
def create_artprovider(): if is_msw(): provider = WinArtProvider() elif is_mac(): provider = MacArtProvider() else: provider = LinuxArtProvider() wx.ArtProvider_Push(provider) return provider
def __init__(self, parent, owner, colorspace): self.owner = owner self.colorspace = colorspace txt = _('Add/remove %s profiles') % (colorspace) art_size = wal.SIZE_16 decoration_padding = 6 if wal.is_msw(): decoration_padding = 4 wal.ImageButton.__init__(self, parent, icons.PD_EDIT, art_size=art_size, decoration_padding=decoration_padding, tooltip=txt, flat=False, onclick=self.action)
def paint(self): self.set_stroke(cms.val_255(self.color), 1.0, config.guide_line_dash) w, h = self.get_size() for item in (0.4, 0.5, 0.8): self.draw_line(int(item * w), 0, int(item * w), h) for item in (0.3, 0.7): self.draw_line(0, int(item * h), w, int(item * h)) if wal.is_msw(): self.set_stroke(wal.GRAY) self.set_fill() self.draw_rect(0, 0, w, h)
def build(self): self.splitter = wal.Splitter(self.panel) self.panel.pack(self.splitter, expand=True, fill=True) if not PREFS_DATA: PREFS_DATA.append(PrefsAppItem(PREFS_APP)) # PREFS_DATA.append(PrefsDocItem(PREFS_DOC)) for item in PREFS_DATA: item.init_prefs(self.app, self) self.tree = wal.TreeWidget(self.splitter, data=PREFS_DATA, on_select=self.on_select) self.container = wal.HPanel(self.splitter) self.splitter.split_vertically(self.tree, self.container, 200) self.splitter.set_min_size(150) if not wal.is_msw(): self.tree.set_indent(5) self.tree.expand_all()
def __init__(self, parent, printer, app): self.app = app self.printer = printer wal.VPanel.__init__(self, parent) hpanel = wal.HPanel(self) icon_name = icons.PD_PRINTER_LASER if self.printer.is_color(): icon_name = icons.PD_PRINTER_INKJET icon = get_icon(icon_name, size=wal.DEF_SIZE) hpanel.pack(wal.Bitmap(hpanel, icon), padding=10) self.prnmode_panel = PrintModePanel(hpanel, self.printer) hpanel.pack(self.prnmode_panel, fill=True, expand=True) self.pack(hpanel, fill=True) self.pack((5, 5)) self.paper_panel = PaperPanel(self, self.printer, self.app) self.pack(self.paper_panel, fill=True) self.pack((5, 5)) hpanel = wal.HPanel(self) self.orient_panel = OrientPanel(hpanel, self.printer, self.app) hpanel.pack(self.orient_panel, fill=True, expand=True) hpanel.pack((5, 5)) self.margins_panel = MarginsPanel(hpanel, self.printer, self.app) hpanel.pack(self.margins_panel, fill=True, expand=True) self.pack(hpanel, fill=True, expand=True) text = _("Note: To adjust specific printer options " "you could " "use system configuration tools like 'system-config-printer'") label = wal.Label(self, text, fontsize=-2) if wal.is_msw(): label.wrap(380) label.set_enable(False) self.pack(label, fill=True, padding_all=5, align_center=False) self.panels = [ self.prnmode_panel, self.paper_panel, self.orient_panel, self.margins_panel ]
def __init__(self, parent, printer, app): self.app = app self.printer = printer wal.VPanel.__init__(self, parent) hpanel = wal.HPanel(self) icon_name = icons.PD_PRINTER_LASER if self.printer.is_color(): icon_name = icons.PD_PRINTER_INKJET icon = get_icon(icon_name, size=wal.DEF_SIZE) hpanel.pack(wal.Bitmap(hpanel, icon), padding=10) self.prnmode_panel = PrintModePanel(hpanel, self.printer) hpanel.pack(self.prnmode_panel, fill=True, expand=True) self.pack(hpanel, fill=True) self.pack((5, 5)) self.paper_panel = PaperPanel(self, self.printer, self.app) self.pack(self.paper_panel, fill=True) self.pack((5, 5)) hpanel = wal.HPanel(self) self.orient_panel = OrientPanel(hpanel, self.printer, self.app) hpanel.pack(self.orient_panel, fill=True, expand=True) hpanel.pack((5, 5)) self.margins_panel = MarginsPanel(hpanel, self.printer, self.app) hpanel.pack(self.margins_panel, fill=True, expand=True) self.pack(hpanel, fill=True, expand=True) text = _("Note: To adjust specific printer options " "you could " "use system configuration tools like 'system-config-printer'") label = wal.Label(self, text, fontsize=-2) if wal.is_msw(): label.wrap(380) label.set_enable(False) self.pack(label, fill=True, padding_all=5, align_center=False) self.panels = [self.prnmode_panel, self.paper_panel, self.orient_panel, self.margins_panel]
def __init__(self, parent, action): self.action = action art_id = action.get_artid() art_size = wal.DEF_SIZE text = '' tooltip = action.get_tooltip_text() padding = 0 decoration_padding = 3 native = True if wal.is_msw(): decoration_padding = 2 if wal.is_winxp(): native = False wal.ImageButton.__init__(self, parent, art_id, art_size, text, tooltip, padding, decoration_padding, True, native, onclick=action.do_call) self.action.register(self)
def paint(self): w, h = self.get_size() shift = 0 if wal.is_msw(): shift = 1 fmt = cairo.FORMAT_RGB24 self.surface = cairo.ImageSurface(fmt, w - shift, h - shift) self.ctx = cairo.Context(self.surface) self.ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)) self.ctx.set_source_rgb(*self.prefs.bg_btn.get_value()) self.ctx.paint() self.ctx.set_antialias(cairo.ANTIALIAS_NONE) self.ctx.set_line_width(1.0) self.ctx.set_dash([]) self.ctx.set_source_rgb(*self.prefs.fg_btn.get_value()) self.ctx.move_to(0, h) self.ctx.line_to(w, h) small_l = self.prefs.ruler_small_tick.get_value() for item in SMALL_TICKS: self.ctx.move_to(item, h - small_l) self.ctx.line_to(item, h - 1) large_l = self.prefs.ruler_large_tick.get_value() for pos, txt in TEXT_TICKS: self.ctx.move_to(pos, h - large_l) self.ctx.line_to(pos, h - 1) self.ctx.stroke() vshift = self.prefs.ruler_text_vshift.get_value() hshift = self.prefs.ruler_text_hshift.get_value() for pos, txt in TEXT_TICKS: for character in txt: data = self.font[character] position = int(pos) + hshift self.ctx.set_source_surface(data[1], position, vshift) self.ctx.paint() pos += data[0] self.draw_surface(self.surface)
def paint(self): w, h = self.get_size() shift = 0 if wal.is_msw():shift = 1 fmt = cairo.FORMAT_RGB24 self.surface = cairo.ImageSurface(fmt, w - shift, h - shift) self.ctx = cairo.Context(self.surface) self.ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)) self.ctx.set_source_rgb(*self.prefs.bg_btn.get_value()) self.ctx.paint() self.ctx.set_antialias(cairo.ANTIALIAS_NONE) self.ctx.set_line_width(1.0) self.ctx.set_dash([]) self.ctx.set_source_rgb(*self.prefs.fg_btn.get_value()) self.ctx.move_to(0, h) self.ctx.line_to(w, h) small_l = self.prefs.ruler_small_tick.get_value() for item in SMALL_TICKS: self.ctx.move_to(item, h - small_l) self.ctx.line_to(item, h - 1) large_l = self.prefs.ruler_large_tick.get_value() for pos, txt in TEXT_TICKS: self.ctx.move_to(pos, h - large_l) self.ctx.line_to(pos, h - 1) self.ctx.stroke() vshift = self.prefs.ruler_text_vshift.get_value() hshift = self.prefs.ruler_text_hshift.get_value() for pos, txt in TEXT_TICKS: for character in txt: data = self.font[character] position = int(pos) + hshift self.ctx.set_source_surface(data[1], position, vshift) self.ctx.paint() pos += data[0] self.draw_surface(self.surface)
def build_toolbar(self): self.tb = self.mw.CreateToolBar(wal.TBFLAGS) icon_size = config.toolbar_icon_size self.tb.SetToolBitmapSize(config.toolbar_size) # if wal.is_win7(): # self.tb.SetBackgroundColour('#D3DAED') if wal.is_mac(): for items in BUTTONS: if not items is None: if len(items) == 1: action = self.mw.app.actions[items[0]] button = MacTB_ActionButton(self.tb, action) else: actions = [] for item in items: actions.append(self.mw.app.actions[item]) button = MacTB_ActionNestedButtons(self.tb, actions) self.tb.AddControl(button) else: for items in BUTTONS: if items is None: self.tb.AddSeparator() else: for item in items: action = self.mw.app.actions[item] aid = action.action_id label_txt = action.get_tooltip_text() hlp_txt = action.get_descr_text() bmp = action.get_icon(icon_size, wal.ART_TOOLBAR) if not bmp: continue if wal.is_msw(): self.tb.AddLabelTool(aid, label_txt, bmp, bmpDisabled=wal.disabled_bmp(bmp), shortHelp=hlp_txt) else: self.tb.AddLabelTool(aid, label_txt, bmp, shortHelp=hlp_txt) action.register_as_tool(self.tb) self.tb.Realize()
def paint(self): w, h = self.get_size() shift = 0 if wal.is_msw():shift = 1 if self.surface is None: self.surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w - shift, h - shift) self.width = w self.height = h elif self.width <> w or self.height <> h: self.surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w - shift, h - shift) self.width = w self.height = h self.ctx = cairo.Context(self.surface) self.ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)) self.ctx.set_source_rgb(*config.ruler_bg) self.ctx.paint() self.ctx.set_antialias(cairo.ANTIALIAS_NONE) self.ctx.set_line_width(1.0) self.ctx.set_dash([]) self.ctx.set_source_rgb(*config.ruler_fg) if self.horizontal: self.hrender(w, h) else: self.vrender(w, h) self.draw_bitmap(wal.copy_surface_to_bitmap(self.surface))
def build(self): self.panels = {} panel = wal.HPanel(self) self.solid_keeper = wal.HToggleKeeper(panel, SOLID_MODES, SOLID_MODE_ICONS, SOLID_MODE_NAMES, self.on_mode_change) panel.pack(self.solid_keeper) panel.pack(wal.HPanel(panel), fill=True, expand=True) self.rule_keeper = FillRuleKeeper(panel) panel.pack(self.rule_keeper) if not self.use_rule: self.rule_keeper.set_visible(False) self.pack(panel, fill=True, padding_all=5) self.pack(wal.HLine(self), fill=True) for item in SOLID_MODES: self.panels[item] = SOLID_MODE_CLASSES[item](self, self.app) if wal.is_msw(): self.pack(self.panels[item], fill=True, expand=True, padding_all=5) self.layout() self.panels[item].hide() self.remove(self.panels[item]) else: self.panels[item].hide()
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) if wal.is_msw(): panel.pack((5, 5)) 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()
def on_print(self): parent = self if wal.is_msw(): parent = self.canvas if self.printer.run_printdlg(parent, self.printout): self.on_close()
def on_print(self): parent = self if wal.is_msw():parent = self.canvas if self.printer.run_printdlg(parent, self.printout): self.on_close()
def mouse_enter(self, enent): if wal.is_msw(): self.SetFocus()
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), spin_overlay=config.spin_overlay) 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), spin_overlay=config.spin_overlay) 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 config.is_ubuntu(): txt = _('Ubuntu 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
def capture_mouse(self): if wal.is_msw(): self.CaptureMouse() self.mouse_captured = True
def __init__(self, parent, prefpanel): CMS_Tab.__init__(self, parent, prefpanel) txt = _('Colorspace profiles') self.pack(wal.Label(self, txt, fontbold=True), padding=2) self.pack(wal.HLine(self), fill=True, padding_all=2) grid = wal.GridPanel(self, rows=10, cols=3, hgap=5, vgap=5) grid.add_growable_col(1) self.cs_widgets = {} self.cs_profiles = {} self.cs_config_profiles = {} self.cs_config = {COLOR_RGB:config.cms_rgb_profile, COLOR_CMYK:config.cms_cmyk_profile, COLOR_LAB:config.cms_lab_profile, COLOR_GRAY:config.cms_gray_profile, COLOR_DISPLAY:config.cms_display_profile} for colorspace in COLORSPACES[:-1]: txt = _('%s profile:') % colorspace grid.pack(wal.Label(grid, txt)) combo = wal.Combolist(grid, items=[]) self.cs_widgets[colorspace] = combo grid.pack(combo, fill=True) self.update_combo(colorspace) grid.pack(ManageButton(grid, self, colorspace)) self.pack(grid, fill=True, padding_all=5) txt = _('Hardware profiles') self.pack(wal.Label(self, txt, fontbold=True), padding=2) self.pack(wal.HLine(self), fill=True, padding_all=2) grid = wal.GridPanel(self, cols=3, hgap=5, vgap=5) grid.add_growable_col(1) txt = _('Display profile:') grid.pack(wal.Label(grid, txt)) combo = wal.Combolist(grid, items=[]) self.cs_widgets[COLOR_DISPLAY] = combo grid.pack(combo, fill=True) self.update_combo(COLOR_DISPLAY) grid.pack(ManageButton(grid, self, COLOR_DISPLAY)) self.pack(grid, fill=True, padding_all=5) txt = _('Use display profile') self.display_check = wal.Checkbox(self, txt, config.cms_use_display_profile, onclick=self.activate_display) self.pack(self.display_check, align_center=False) txt = _('Note: Display profile affects on ' 'document screen representation only. The profile for your ' 'hardware you can get either from monitor manufacture or ' 'calibrating monitor (preferred option) or download ' 'from ICC Profile Taxi service: ') fontsize = -3 if wal.is_msw(): fontsize = -1 label = wal.Label(self, txt, fontsize=fontsize) label.set_enable(False) if wal.is_msw(): label.wrap(430) self.pack(label, fill=True, padding_all=5) self.pack(wal.HtmlLabel(self, 'http://icc.opensuse.org/')) self.activate_display()
def get_printsys(app): if wal.is_msw(): from sk1.printing.msw_print import MSW_PS return MSW_PS(app) from sk1.printing.cups_print import CUPS_PS return CUPS_PS()
def _on_paint(self, event): w, h = self.panel.GetSize() self.rect = wx.Rect(0, 0, w, h) pdc = wx.PaintDC(self.panel) try: dc = wx.GCDC(pdc) except: dc = pdc pdc.BeginDrawing() dc.BeginDrawing() #----- colors definition border_color = const.UI_COLORS['hover_solid_border'] bg_color = const.UI_COLORS['bg'] light_bg_color = const.mix_colors((255, 255, 255), bg_color, 100) dark_bg_color = const.mix_colors((0, 0, 0), bg_color, 5) grad_start = wx.Colour(0, 0, 0, 10) grad_end = wx.Colour(0, 0, 0, 0) if self.active: #----- draw border pdc.SetBrush(wx.TRANSPARENT_BRUSH) pdc.SetPen(wx.Pen(wx.Colour(*border_color), 1)) pdc.DrawRoundedRectangle(-3, 0, w, h, 3.0) #----- draw icon y = TAB_PADDING x = (TAB_WIDTH - self.icon.GetSize()[1]) / 2 dc.DrawBitmap(self.icon, x, y, True) #----- draw text y += 3 + self.icon.GetSize()[0] txt_h = self._get_text_size(self.text, self.active)[1] x = (TAB_WIDTH - txt_h) / 2 + txt_h if is_msw(): x += 3 font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) if config.tabs_use_bold: font.SetWeight(wx.FONTWEIGHT_BOLD) if config.tabs_fontsize: if font.IsUsingSizeInPixels(): font.SetPixelSize(config.tabs_fontsize) else: font.SetPointSize(config.tabs_fontsize) pdc.SetFont(font) pdc.DrawRotatedText(self.text, x, y, 270) #----- draw button y += self._get_text_size(self.text, self.active)[0] x = (TAB_WIDTH - self.inactive_close_but.GetSize()[0]) / 2 if not self.active: x -= 1 if self.but_active: dc.DrawBitmap(self.close_but, x, y, True) if self.but_pressed: dc.DrawBitmap(self.close_but, x, y, True) else: dc.DrawBitmap(self.inactive_close_but, x, y, True) but_w, but_h = self.inactive_close_but.GetSize() self.but_rect = wx.Rect(x, y, but_w, but_h) else: #----- draw border pdc.SetBrush(wx.TRANSPARENT_BRUSH) pdc.SetPen(wx.Pen(wx.Colour(*border_color), 1)) pdc.DrawRoundedRectangle(-5, 0, w, h, 3.0) pdc.SetPen( wx.Pen(wx.Colour(*const.UI_COLORS['hover_solid_border']), 1)) pdc.DrawLine(0, 0, 0, h) #----- draw icon y = TAB_PADDING x = (TAB_WIDTH - self.icon.GetSize()[1]) / 2 - 1 dc.DrawBitmap(self.icon, x, y, True) #----- draw text y += 3 + self.icon.GetSize()[0] txt_h = self._get_text_size(self.text, self.active)[1] x = (TAB_WIDTH - txt_h) / 2 + txt_h - 1 if is_msw(): x += 3 font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) if config.tabs_fontsize: if font.IsUsingSizeInPixels(): font.SetPixelSize(config.tabs_fontsize) else: font.SetPointSize(config.tabs_fontsize) pdc.SetFont(font) pdc.DrawRotatedText(self.text, x, y, 270) #----- draw button y += self._get_text_size(self.text, self.active)[0] x = (TAB_WIDTH - self.inactive_close_but.GetSize()[0]) / 2 if not self.active: x -= 1 if self.but_active: dc.DrawBitmap(self.close_but, x, y, True) if self.but_pressed: dc.DrawBitmap(self.close_but, x, y, True) else: dc.DrawBitmap(self.inactive_close_but, x, y, True) but_w, but_h = self.inactive_close_but.GetSize() self.but_rect = wx.Rect(x, y, but_w, but_h) #----- shadow color1 = wx.Colour(0, 0, 0, 20) color2 = wx.Colour(0, 0, 0, 0) rect = wx.Rect(0, 0, w / 2, h) dc.GradientFillLinear(rect, color1, color2, nDirection=wx.EAST) if not pdc == dc: dc.EndDrawing() pdc.EndDrawing() else: dc.EndDrawing() pdc = dc = None
def _get_bitmap(self): if not self.enabled and wal.is_msw(): return wal.disabled_bmp(self.icons_dict[self.state][0]) return self.icons_dict[self.state][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)
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)
def __init__(self, parent, prefpanel): CMS_Tab.__init__(self, parent, prefpanel) txt = _('Colorspace profiles') self.pack(wal.Label(self, txt, fontbold=True), padding=2) self.pack(wal.HLine(self), fill=True, padding_all=2) grid = wal.GridPanel(self, rows=10, cols=3, hgap=5, vgap=5) grid.add_growable_col(1) self.cs_widgets = {} self.cs_profiles = {} self.cs_config_profiles = {} self.cs_config = { COLOR_RGB: config.cms_rgb_profile, COLOR_CMYK: config.cms_cmyk_profile, COLOR_LAB: config.cms_lab_profile, COLOR_GRAY: config.cms_gray_profile, COLOR_DISPLAY: config.cms_display_profile } for colorspace in COLORSPACES[:-1]: txt = _('%s profile:') % colorspace grid.pack(wal.Label(grid, txt)) combo = wal.Combolist(grid, items=[]) self.cs_widgets[colorspace] = combo grid.pack(combo, fill=True) self.update_combo(colorspace) grid.pack(ManageButton(grid, self, colorspace)) self.pack(grid, fill=True, padding_all=5) txt = _('Hardware profiles') self.pack(wal.Label(self, txt, fontbold=True), padding=2) self.pack(wal.HLine(self), fill=True, padding_all=2) grid = wal.GridPanel(self, cols=3, hgap=5, vgap=5) grid.add_growable_col(1) txt = _('Display profile:') grid.pack(wal.Label(grid, txt)) combo = wal.Combolist(grid, items=[]) self.cs_widgets[COLOR_DISPLAY] = combo grid.pack(combo, fill=True) self.update_combo(COLOR_DISPLAY) grid.pack(ManageButton(grid, self, COLOR_DISPLAY)) self.pack(grid, fill=True, padding_all=5) txt = _('Use display profile') self.display_check = wal.Checkbox(self, txt, config.cms_use_display_profile, onclick=self.activate_display) self.pack(self.display_check, align_center=False) txt = _('Note: Display profile affects on ' 'document screen representation only. The profile for your ' 'hardware you can get either from monitor manufacture or ' 'calibrating monitor (preferred option) or download ' 'from ICC Profile Taxi service: ') fontsize = -3 if wal.is_msw(): fontsize = -1 label = wal.Label(self, txt, fontsize=fontsize) label.set_enable(False) if wal.is_msw(): label.wrap(430) self.pack(label, fill=True, padding_all=5) self.pack(wal.HtmlLabel(self, 'http://icc.opensuse.org/')) self.activate_display()
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
def _on_paint(self, event): w, h = self.panel.GetSize() self.rect = wx.Rect(0, 0, w, h) pdc = wx.PaintDC(self.panel) try:dc = wx.GCDC(pdc) except:dc = pdc pdc.BeginDrawing() dc.BeginDrawing() #----- colors definition border_color = const.UI_COLORS['hover_solid_border'] bg_color = const.UI_COLORS['bg'] light_bg_color = const.mix_colors((255, 255, 255), bg_color, 100) dark_bg_color = const.mix_colors((0, 0, 0), bg_color, 5) grad_start = wx.Colour(0, 0, 0, 10) grad_end = wx.Colour(0, 0, 0, 0) if self.active: #----- draw border pdc.SetBrush(wx.TRANSPARENT_BRUSH) pdc.SetPen(wx.Pen(wx.Colour(*border_color), 1)) pdc.DrawRoundedRectangle(-3, 0, w, h, 3.0) #----- draw icon y = TAB_PADDING x = (TAB_WIDTH - self.icon.GetSize()[1]) / 2 dc.DrawBitmap(self.icon, x, y, True) #----- draw text y += 3 + self.icon.GetSize()[0] txt_h = self._get_text_size(self.text, self.active)[1] x = (TAB_WIDTH - txt_h) / 2 + txt_h - 2 if is_msw(): x += 3 font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) if config.tabs_use_bold: font.SetWeight(wx.FONTWEIGHT_BOLD) if config.tabs_fontsize: if font.IsUsingSizeInPixels(): font.SetPixelSize(config.tabs_fontsize) else: font.SetPointSize(config.tabs_fontsize) pdc.SetFont(font) pdc.DrawRotatedText(self.text, x, y, 270) #----- draw button y += self._get_text_size(self.text, self.active)[0] x = (TAB_WIDTH - self.inactive_close_but.GetSize()[0]) / 2 if not self.active:x -= 1 if self.but_active: dc.DrawBitmap(self.close_but, x, y, True) if self.but_pressed: dc.DrawBitmap(self.close_but, x, y, True) else: dc.DrawBitmap(self.inactive_close_but, x, y, True) but_w, but_h = self.inactive_close_but.GetSize() self.but_rect = wx.Rect(x, y, but_w, but_h) else: #----- draw border pdc.SetBrush(wx.TRANSPARENT_BRUSH) pdc.SetPen(wx.Pen(wx.Colour(*border_color), 1)) pdc.DrawRoundedRectangle(-5, 0, w, h, 3.0) pdc.SetPen(wx.Pen(wx.Colour(*const.UI_COLORS['hover_solid_border']), 1)) pdc.DrawLine(0, 0, 0, h) #----- draw icon y = TAB_PADDING x = (TAB_WIDTH - self.icon.GetSize()[1]) / 2 - 1 dc.DrawBitmap(self.icon, x, y, True) #----- draw text y += 3 + self.icon.GetSize()[0] txt_h = self._get_text_size(self.text, self.active)[1] x = (TAB_WIDTH - txt_h) / 2 + txt_h - 3 if is_msw(): x += 3 font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) if config.tabs_fontsize: if font.IsUsingSizeInPixels(): font.SetPixelSize(config.tabs_fontsize) else: font.SetPointSize(config.tabs_fontsize) pdc.SetFont(font) pdc.DrawRotatedText(self.text, x, y, 270) #----- draw button y += self._get_text_size(self.text, self.active)[0] x = (TAB_WIDTH - self.inactive_close_but.GetSize()[0]) / 2 if not self.active:x -= 1 if self.but_active: dc.DrawBitmap(self.close_but, x, y, True) if self.but_pressed: dc.DrawBitmap(self.close_but, x, y, True) else: dc.DrawBitmap(self.inactive_close_but, x, y, True) but_w, but_h = self.inactive_close_but.GetSize() self.but_rect = wx.Rect(x, y, but_w, but_h) #----- shadow color1 = wx.Colour(0, 0, 0, 20) color2 = wx.Colour(0, 0, 0, 0) rect = wx.Rect(0, 0, w / 2, h) dc.GradientFillLinear(rect, color1, color2, nDirection=wx.EAST) if not pdc == dc: dc.EndDrawing() pdc.EndDrawing() else: dc.EndDrawing() pdc = dc = None