def get_history_entries(self): ret = [] for item in self.history: path = item[1] unicode_path = path_unicode(path) filename = path_unicode(os.path.basename(path)) timestamp = datetime.datetime.fromtimestamp(item[2]) timestr = timestamp.strftime('%Y-%m-%d %H:%M:%S') ret.append([item[0], filename, unicode_path, path, timestr]) ret.reverse() return ret
def save(self, filename=None): if self.filename and filename is None: filename = self.filename if len(self.__dict__) == 0 or filename == None: return try: fileobj = open(filename, 'w') except: print 'ERROR>>> cannot write preferences into %s' % filename return writer = XMLGenerator(out=fileobj, encoding=self.system_encoding) writer.startDocument() defaults = XmlConfigParser.__dict__ items = self.__dict__.items() items.sort() writer.startElement('preferences', {}) writer.characters('\n') for key, value in items: if defaults.has_key(key) and defaults[key] == value: continue if key in ['filename', 'app']: continue writer.characters('\t') writer.startElement('%s' % key, {}) str_value = path_unicode(value.__str__()) if isinstance(value, str): str_value = "'%s'" % (escape_quote(str_value)) writer.characters(str_value) writer.endElement('%s' % key) writer.characters('\n') writer.endElement('preferences') writer.endDocument() fileobj.close
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 get_menu_entries(self): entries = [] if not self.history: return entries i = 1 counter = 0 ret = [] while counter < config.history_list_size: item = self.history[-i] if not item[1] in entries: path = item[1] entries.append(path) filename = os.path.basename(path) ret.append([path_unicode(filename + ' [' + path + ']'), path]) counter += 1 i += 1 if i > len(self.history):break return ret
def get_menu_entries(self): entries = [] if not self.history: return entries i = 1 counter = 0 ret = [] while counter < config.history_list_size: item = self.history[-i] if not item[1] in entries: path = item[1] entries.append(path) filename = os.path.basename(path) ret.append([path_unicode(filename + ' [' + path + ']'), path]) counter += 1 i += 1 if i > len(self.history): break return ret
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 save(self, filename=None): if self.filename and filename is None: filename = self.filename if len(self.__dict__) == 0 or filename == None: return try: fileobj = open(filename, 'w') except: print 'ERROR>>> cannot write preferences into %s' % filename return defaults = SerializedConfig.__dict__ items = self.__dict__.items() items.sort() for key, value in items: if defaults.has_key(key) and defaults[key] == value: continue if key in ['filename', 'app']: continue line = path_unicode('%s = %s\n' % (key, value.__repr__())) fileobj.write(line) fileobj.close()
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 save(self, filename=None): if self.filename and filename is None: filename = self.filename if len(self.__dict__) == 0 or filename is None: return try: fileobj = get_fileptr(filename, True) except Exception: return defaults = SerializedConfig.__dict__ items = self.__dict__.items() items.sort() for key, value in items: if key in defaults and defaults[key] == value: continue if key in ['filename', 'app']: continue line = path_unicode('%s = %s\n' % (key, value.__repr__())) fileobj.write(line) fileobj.close()
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)