def draw_pattern(self): w, h = self.get_size() pattern = self.fill[2] surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w, h) ctx = cairo.Context(surface) self.draw_cairo_background(ctx) bmpstr = b64decode(pattern[1]) if self.cms.app.current_doc: config = self.cms.app.current_doc.model.config else: config = sk2_config.SK2_Config() config_file = os.path.join(self.cms.app.appdata.app_config_dir, 'sk2_config.xml') config.load(config_file) image_obj = sk2_model.Pixmap(config) libimg.set_image_data(self.cms, image_obj, bmpstr) libimg.flip_left_to_right(image_obj) if pattern[0] == sk2_const.PATTERN_IMG and len(pattern) > 2: image_obj.style[3] = deepcopy(pattern[2]) libimg.update_image(self.cms, image_obj) sp = cairo.SurfacePattern(image_obj.cache_cdata) sp.set_extend(cairo.EXTEND_REPEAT) trafo = [-1.0, 0.0, 0.0, 1.0, 0.0, 0.0] if len(pattern) > 3: trafo = libgeom.multiply_trafo(pattern[3], trafo) pattern_matrix = cairo.Matrix(*trafo) pattern_matrix.invert() sp.set_matrix(pattern_matrix) ctx.set_source(sp) ctx.rectangle(0, 0, w, h) ctx.fill() image_obj.cache_cdata = None self.gc_draw_bitmap(wal.copy_surface_to_bitmap(surface), 0, 0)
def __init__(self, path, cfgdir='~'): self.path = path wal.Application.__init__(self) UCApplication.__init__(self, path, cfgdir) if wal.IS_WINXP: msg = _('WindowsXP platform is obsolete and not supported!') dialogs.error_dialog(self.mw, 'sK1', msg) sys.exit() self.appdata = AppData(self, cfgdir) config.load(self.appdata.app_config) config.resource_dir = os.path.join(path_unicode(self.path), 'share') log_level = config.log_level self.log_filepath = os.path.join(self.appdata.app_config_dir, 'sk1.log') config_logging(self.log_filepath, log_level) sys.stderr = StreamLogger() LOG.info('Logging started') self.update_wal() plg_dir = os.path.join(self.path, 'share', 'pd_plugins') custom_plg_dir = self.appdata.plugin_dir config.plugin_dirs = [plg_dir, custom_plg_dir] sys.path.insert(1, self.appdata.app_config) sys.path.insert(1, os.path.join(self.path, 'share')) config.app = self LOG.info('Config is updated') self.history = AppHistoryManager(self) self.artprovider = create_artprovider() self.cursors = modes.get_cursors() self.proxy = AppProxy(self) self.insp = AppInspector(self) self.plugins = app_plugins.scan_plugins(self) self.actions = app_actions.create_actions(self) self.default_cms = AppColorManager(self) self.palettes = AppPaletteManager(self) self.clipboard = AppClipboard(self) self.mw = AppMainWindow(self) self.mw.set_global_shortcuts(self.actions) self.proxy.update() self.insp.update() LOG.info('Application is initialized') uc2.events.connect(uc2.events.MESSAGES, self.uc2_event_logging) events.connect(events.APP_STATUS, self.sk1_event_logging) if wal.IS_WX2: events.emit(events.NO_DOCS) if config.make_font_cache_on_start: generate_fcache()
def __init__(self, path, cfgdir='~'): self.path = path wal.Application.__init__(self) UCApplication.__init__(self, path, cfgdir) if wal.is_winxp(): msg = _('WindowsXP platform is obsolete and not supported!') dialogs.error_dialog(self.mw, 'sK1', msg) sys.exit() self.appdata = AppData(self, cfgdir) config.load(self.appdata.app_config) config.resource_dir = os.path.join(path_unicode(self.path), 'share') self.update_wal() plg_dir = os.path.join(self.path, 'share', 'pd_plugins') custom_plg_dir = self.appdata.plugin_dir config.plugin_dirs = [plg_dir, custom_plg_dir] sys.path.insert(1, self.appdata.app_config) sys.path.insert(1, os.path.join(self.path, 'share')) config.app = self self.history = AppHistoryManager(self) self.artprovider = create_artprovider() self.cursors = modes.get_cursors() self.proxy = AppProxy(self) self.insp = AppInspector(self) self.plugins = app_plugins.scan_plugins(self) self.actions = app_actions.create_actions(self) self.default_cms = AppColorManager(self) self.palettes = AppPaletteManager(self) self.clipboard = AppClipboard(self) self.mw = AppMainWindow(self) self.mw.set_global_shortcuts(self.actions) self.proxy.update() self.insp.update() if wal.is_wx2(): events.emit(events.NO_DOCS) if config.make_font_cache_on_start: generate_fcache()
def __init__(self, path, cfgdir='~'): self.path = path wal.Application.__init__(self) UCApplication.__init__(self, path, cfgdir) if wal.is_winxp(): msg = _('WindowsXP platform is obsolete and not supported!') dialogs.error_dialog(self.mw, 'sK1', msg) sys.exit() self.appdata = AppData(self, cfgdir) config.load(self.appdata.app_config) config.resource_dir = os.path.join(path_unicode(self.path), 'share') plg_dir = os.path.join(self.path, 'share', 'pd_plugins') custom_plg_dir = self.appdata.plugin_dir config.plugin_dirs = [plg_dir, custom_plg_dir] sys.path.insert(1, self.appdata.app_config) sys.path.insert(1, os.path.join(self.path, 'share')) config.app = self self.history = AppHistoryManager(self) self.artprovider = create_artprovider() self.cursors = modes.get_cursors() self.proxy = AppProxy(self) self.insp = AppInspector(self) self.plugins = app_plugins.scan_plugins(self) self.actions = app_actions.create_actions(self) self.default_cms = AppColorManager(self) self.palettes = AppPaletteManager(self) self.clipboard = AppClipboard(self) self.mw = AppMainWindow(self) self.mw.set_global_shortcuts(self.actions) self.proxy.update() self.insp.update() if wal.is_wx2(): events.emit(events.NO_DOCS) if config.make_font_cache_on_start: generate_fcache()
def __init__(self, path): self.path = path wal.Application.__init__(self) UCApplication.__init__(self, path) self.appdata = AppData(self) config.load(self.appdata.app_config) config.resource_dir = os.path.join(path_unicode(self.path), 'share') plg_dir = os.path.join(self.path, 'share', 'pd_plugins') custom_plg_dir = self.appdata.plugin_dir config.plugin_dirs = [plg_dir, custom_plg_dir] sys.path.insert(1, self.appdata.app_config) sys.path.insert(1, os.path.join(self.path, 'share')) config.app = self self.history = AppHistoryManager(self) self.artprovider = create_artprovider() self.cursors = modes.get_cursors() self.proxy = AppProxy(self) self.insp = AppInspector(self) self.plugins = app_plugins.scan_plugins(self) self.actions = app_actions.create_actions(self) self.default_cms = AppColorManager(self) self.palettes = AppPaletteManager(self) self.clipboard = AppClipboard(self) self.mw = AppMainWindow(self) self.mw.set_global_shortcuts(self.actions) self.proxy.update() self.insp.update() events.emit(events.NO_DOCS)