repo
string
commit
string
message
string
diff
string
stefanfoulis/django-multilingual
7aef737e5edaf9470fa6147a2e81f41cee1376ec
Sorry, forgot to add a file
diff --git a/multilingual/forms.py b/multilingual/forms.py new file mode 100644 index 0000000..fff6109 --- /dev/null +++ b/multilingual/forms.py @@ -0,0 +1,24 @@ +"""TODO: this will probably be removed because DM seems to work correctly without +manipulators. +""" +from django.forms.models import ModelForm +from django.forms.models import ErrorList + +from multilingual.languages import get_language_id_list + +def multilingual_init(self, data=None, files=None, auto_id='id_%s', prefix=None, + initial=None, error_class=ErrorList, label_suffix=':', + empty_permitted=False, instance=None): + if data and hasattr(self._meta.model, 'translation_model'): + trans_model = self._meta.model._meta.translation_model + lower_model_name = trans_model._meta.object_name.lower() + language_id_list = get_language_id_list() + for language_idx in range(0, len(language_id_list)): + name = "%s.%s.language_id" % (lower_model_name, + language_idx) + data[name] = language_id_list[language_idx] + super(ModelForm, self).__init__(data, files, auto_id, prefix, initial, + error_class, label_suffix, empty_permitted, instance) + +#NOTE: leave commented +#ModelForm.__init__ = multilingual_init
stefanfoulis/django-multilingual
5bd042018e96fa72303e9703cc921f638feee272
Fixed two bugs: - form.manipulator.model becomes form._meta.model - added fourth, optional, parameter to Model __new__ method
diff --git a/multilingual/templatetags/multilingual_tags.py b/multilingual/templatetags/multilingual_tags.py index eb673da..2b11f45 100644 --- a/multilingual/templatetags/multilingual_tags.py +++ b/multilingual/templatetags/multilingual_tags.py @@ -1,73 +1,73 @@ from django import template from django import forms from django.template import Node, NodeList, Template, Context, resolve_variable from django.template.loader import get_template, render_to_string from django.conf import settings from django.utils.html import escape from multilingual.languages import get_language_idx, get_default_language import math import StringIO import tokenize register = template.Library() from multilingual.languages import get_language_code, get_language_name, get_language_bidi def language_code(language_id): """ Return the code of the language with id=language_id """ return get_language_code(language_id) register.filter(language_code) def language_name(language_id): """ Return the name of the language with id=language_id """ return get_language_name(language_id) register.filter(language_name) def language_bidi(language_id): """ Return whether the language with id=language_id is written right-to-left. """ return get_language_bidi(language_id) register.filter(language_bidi) class EditTranslationNode(template.Node): def __init__(self, form_name, field_name, language=None): self.form_name = form_name self.field_name = field_name self.language = language def render(self, context): form = resolve_variable(self.form_name, context) - model = form.manipulator.model + model = form._meta.model trans_model = model._meta.translation_model if self.language: language_id = self.language.resolve(context) else: language_id = get_default_language() real_name = "%s.%s.%s.%s" % (self.form_name, trans_model._meta.object_name.lower(), get_language_idx(language_id), self.field_name) return str(resolve_variable(real_name, context)) def do_edit_translation(parser, token): bits = token.split_contents() if len(bits) not in [3, 4]: raise template.TemplateSyntaxError, \ "%r tag requires 3 or 4 arguments" % bits[0] if len(bits) == 4: language = parser.compile_filter(bits[3]) else: language = None return EditTranslationNode(bits[1], bits[2], language) register.tag('edit_translation', do_edit_translation) diff --git a/multilingual/translation.py b/multilingual/translation.py index 52be5a6..045bf1f 100644 --- a/multilingual/translation.py +++ b/multilingual/translation.py @@ -1,403 +1,403 @@ """ Support for models' internal Translation class. """ ## TO DO: this is messy and needs to be cleaned up from django.contrib.admin import StackedInline, ModelAdmin from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.db.models import signals from django.db.models.base import ModelBase from django.dispatch.dispatcher import connect from multilingual.languages import * from multilingual.exceptions import TranslationDoesNotExist from multilingual.fields import TranslationForeignKey from multilingual.manipulators import add_multilingual_manipulators from multilingual import manager from new import instancemethod class TranslationModelAdmin(StackedInline): template = "admin/edit_inline_translations_newforms.html" def translation_save_translated_fields(instance, **kwargs): """ Save all the translations of instance in post_save signal handler. """ if not hasattr(instance, '_translation_cache'): return for l_id, translation in instance._translation_cache.iteritems(): # set the translation ID just in case the translation was # created while instance was not stored in the DB yet # note: we're using _get_pk_val here even though it is # private, since that's the most reliable way to get the value # on older Django (pk property did not exist yet) translation.master_id = instance._get_pk_val() translation.save() def translation_overwrite_previous(instance, **kwargs): """ Delete previously existing translation with the same master and language_id values. To be called by translation model's pre_save signal. This most probably means I am abusing something here trying to use Django inline editor. Oh well, it will have to go anyway when we move to newforms. """ qs = instance.__class__.objects try: qs = qs.filter(master=instance.master).filter(language_id=instance.language_id) qs.delete() except ObjectDoesNotExist: # We are probably loading a fixture that defines translation entities # before their master entity. pass def fill_translation_cache(instance): """ Fill the translation cache using information received in the instance objects as extra fields. You can not do this in post_init because the extra fields are assigned by QuerySet.iterator after model initialization. """ if hasattr(instance, '_translation_cache'): # do not refill the cache return instance._translation_cache = {} for language_id in get_language_id_list(): # see if translation for language_id was in the query field_alias = get_translated_field_alias('id', language_id) if getattr(instance, field_alias, None) is not None: field_names = [f.attname for f in instance._meta.translation_model._meta.fields] # if so, create a translation object and put it in the cache field_data = {} for fname in field_names: field_data[fname] = getattr(instance, get_translated_field_alias(fname, language_id)) translation = instance._meta.translation_model(**field_data) instance._translation_cache[language_id] = translation # In some situations an (existing in the DB) object is loaded # without using the normal QuerySet. In such case fallback to # loading the translations using a separate query. # Unfortunately, this is indistinguishable from the situation when # an object does not have any translations. Oh well, we'll have # to live with this for the time being. if len(instance._translation_cache.keys()) == 0: for translation in instance.translations.all(): instance._translation_cache[translation.language_id] = translation class TranslatedFieldProxy(property): def __init__(self, field_name, alias, field, language_id=None): self.field_name = field_name self.field = field self.admin_order_field = alias self.language_id = language_id def __get__(self, obj, objtype=None): if obj is None: return self return getattr(obj, 'get_' + self.field_name)(self.language_id) def __set__(self, obj, value): language_id = self.language_id return getattr(obj, 'set_' + self.field_name)(value, self.language_id) short_description = property(lambda self: self.field.short_description) def getter_generator(field_name, short_description): """ Generate get_'field name' method for field field_name. """ def get_translation_field(self, language_id_or_code=None): try: return getattr(self.get_translation(language_id_or_code), field_name) except TranslationDoesNotExist: return None get_translation_field.short_description = short_description return get_translation_field def setter_generator(field_name): """ Generate set_'field name' method for field field_name. """ def set_translation_field(self, value, language_id_or_code=None): setattr(self.get_translation(language_id_or_code, True), field_name, value) set_translation_field.short_description = "set " + field_name return set_translation_field def get_translation(self, language_id_or_code, create_if_necessary=False): """ Get a translation instance for the given language_id_or_code. If it does not exist, either create one or raise the TranslationDoesNotExist exception, depending on the create_if_necessary argument. """ # fill the cache if necessary self.fill_translation_cache() language_id = get_language_id_from_id_or_code(language_id_or_code, False) if language_id is None: language_id = getattr(self, '_default_language', None) if language_id is None: language_id = get_default_language() if language_id not in self._translation_cache: if not create_if_necessary: raise TranslationDoesNotExist(language_id) new_translation = self._meta.translation_model(master=self, language_id=language_id) self._translation_cache[language_id] = new_translation return self._translation_cache.get(language_id, None) class Translation: """ A superclass for translatablemodel.Translation inner classes. """ def contribute_to_class(cls, main_cls, name): """ Handle the inner 'Translation' class. """ # delay the creation of the *Translation until the master model is # fully created connect(cls.finish_multilingual_class, signal=signals.class_prepared, sender=main_cls, weak=False) # connect the post_save signal on master class to a handler # that saves translations connect(translation_save_translated_fields, signal=signals.post_save, sender=main_cls) contribute_to_class = classmethod(contribute_to_class) def create_translation_attrs(cls, main_cls): """ Creates get_'field name'(language_id) and set_'field name'(language_id) methods for all the translation fields. Adds the 'field name' properties too. Returns the translated_fields hash used in field lookups, see multilingual.query. It maps field names to (field, language_id) tuples. """ translated_fields = {} for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): translated_fields[fname] = (field, None) # add get_'fname' and set_'fname' methods to main_cls getter = getter_generator(fname, getattr(field, 'verbose_name', fname)) setattr(main_cls, 'get_' + fname, getter) setter = setter_generator(fname) setattr(main_cls, 'set_' + fname, setter) # add the 'fname' proxy property that allows reads # from and writing to the appropriate translation setattr(main_cls, fname, TranslatedFieldProxy(fname, fname, field)) # create the 'fname'_'language_code' proxy properties for language_id in get_language_id_list(): language_code = get_language_code(language_id) fname_lng = fname + '_' + language_code.replace('-', '_') translated_fields[fname_lng] = (field, language_id) setattr(main_cls, fname_lng, TranslatedFieldProxy(fname, fname_lng, field, language_id)) return translated_fields create_translation_attrs = classmethod(create_translation_attrs) def get_unique_fields(cls): """ Return a list of fields with "unique" attribute, which needs to be augmented by the language. """ unique_fields = [] for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): if getattr(field,'unique',False): try: field.unique = False except AttributeError: # newer Django defines unique as a property # that uses _unique to store data. We're # jumping over the fence by setting _unique, # so this sucks, but this happens early enough # to be safe. field._unique = False unique_fields.append(fname) return unique_fields get_unique_fields = classmethod(get_unique_fields) def finish_multilingual_class(cls, *args, **kwargs): """ Create a model with translations of a multilingual class. """ main_cls = kwargs['sender'] translation_model_name = main_cls.__name__ + "Translation" # create the model with all the translatable fields unique = [('language_id', 'master')] for f in cls.get_unique_fields(): unique.append(('language_id',f)) class TransMeta: pass try: meta = cls.Meta except AttributeError: meta = TransMeta meta.ordering = ('language_id',) meta.unique_together = tuple(unique) meta.app_label = main_cls._meta.app_label if not hasattr(meta, 'db_table'): meta.db_table = main_cls._meta.db_table + '_translation' trans_attrs = cls.__dict__.copy() trans_attrs['Meta'] = meta trans_attrs['language_id'] = models.IntegerField(blank=False, null=False, core=True, choices=get_language_choices(), db_index=True) edit_inline = True trans_attrs['master'] = TranslationForeignKey(main_cls, blank=False, null=False, edit_inline=edit_inline, related_name='translations', num_in_admin=get_language_count(), min_num_in_admin=get_language_count(), num_extra_on_change=0) trans_attrs['__str__'] = lambda self: ("%s object, language_code=%s" % (translation_model_name, get_language_code(self.language_id))) trans_model = ModelBase(translation_model_name, (models.Model,), trans_attrs) trans_model._meta.translated_fields = cls.create_translation_attrs(main_cls) _old_init_name_map = main_cls._meta.__class__.init_name_map def init_name_map(self): cache = _old_init_name_map(self) for name, field_and_lang_id in trans_model._meta.translated_fields.items(): #import sys; sys.stderr.write('TM %r\n' % trans_model) cache[name] = (field_and_lang_id[0], trans_model, True, False) return cache main_cls._meta.init_name_map = instancemethod(init_name_map, main_cls._meta, main_cls._meta.__class__) main_cls._meta.translation_model = trans_model main_cls.get_translation = get_translation main_cls.fill_translation_cache = fill_translation_cache # Note: don't fill the translation cache in post_init, as all # the extra values selected by QAddTranslationData will be # assigned AFTER init() # connect(fill_translation_cache, signal=signals.post_init, # sender=main_cls) # connect the pre_save signal on translation class to a # function removing previous translation entries. connect(translation_overwrite_previous, signal=signals.pre_save, sender=trans_model, weak=False) finish_multilingual_class = classmethod(finish_multilingual_class) def install_translation_library(): # modify ModelBase.__new__ so that it understands how to handle the # 'Translation' inner class if getattr(ModelBase, '_multilingual_installed', False): # don't install it twice return _old_new = ModelBase.__new__ def multilingual_modelbase_new(cls, name, bases, attrs): if 'Translation' in attrs: if not issubclass(attrs['Translation'], Translation): raise ValueError, ("%s.Translation must be a subclass " + " of multilingual.Translation.") % (name,) # Make sure that if the class specifies objects then it is # a subclass of our Manager. # # Don't check other managers since someone might want to # have a non-multilingual manager, but assigning a # non-multilingual manager to objects would be a common # mistake. if ('objects' in attrs) and (not isinstance(attrs['objects'], manager.Manager)): raise ValueError, ("Model %s specifies translations, " + "so its 'objects' manager must be " + "a subclass of multilingual.Manager.") % (name,) # Change the default manager to multilingual.Manager. if not 'objects' in attrs: attrs['objects'] = manager.Manager() # Install a hack to let add_multilingual_manipulators know # this is a translatable model attrs['is_translation_model'] = lambda self: True return _old_new(cls, name, bases, attrs) ModelBase.__new__ = staticmethod(multilingual_modelbase_new) ModelBase._multilingual_installed = True # Override ModelAdmin.__new__ to create automatic inline # editor for multilingual models. _old_admin_new = ModelAdmin.__new__ - def multilingual_modeladmin_new(cls, model, admin_site): + def multilingual_modeladmin_new(cls, model, admin_site, obj=None): if isinstance(model.objects, manager.Manager): X = cls.get_translation_modeladmin(model) if cls.inlines: for inline in cls.inlines: if X.__class__ == inline.__class__: cls.inlines.remove(inline) break cls.inlines.append(X) else: cls.inlines = [X] - return _old_admin_new(cls, model, admin_site) + return _old_admin_new(cls, model, admin_site, obj) def get_translation_modeladmin(cls, model): if hasattr(cls, 'Translation'): tr_cls = cls.Translation if not issubclass(tr_cls, TranslationModelAdmin): raise ValueError, ("%s.Translation must be a subclass " + " of multilingual.TranslationModelAdmin.") % cls.name else: tr_cls = type("%s.Translation" % cls.__name__, (TranslationModelAdmin,), {}) tr_cls.model = model._meta.translation_model tr_cls.fk_name = 'master' tr_cls.extra = get_language_count() tr_cls.max_num = get_language_count() return tr_cls ModelAdmin.__new__ = staticmethod(multilingual_modeladmin_new) ModelAdmin.get_translation_modeladmin = classmethod(get_translation_modeladmin) # install the library install_translation_library()
stefanfoulis/django-multilingual
36be93103175460b6ccd7cc4c3b79ece943e2aba
Make created TranslationModelAdmin dynamic. Probably fixes a problem with previous commit.
diff --git a/multilingual/translation.py b/multilingual/translation.py index 514fe05..52be5a6 100644 --- a/multilingual/translation.py +++ b/multilingual/translation.py @@ -1,403 +1,403 @@ """ Support for models' internal Translation class. """ ## TO DO: this is messy and needs to be cleaned up from django.contrib.admin import StackedInline, ModelAdmin from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.db.models import signals from django.db.models.base import ModelBase from django.dispatch.dispatcher import connect from multilingual.languages import * from multilingual.exceptions import TranslationDoesNotExist from multilingual.fields import TranslationForeignKey from multilingual.manipulators import add_multilingual_manipulators from multilingual import manager from new import instancemethod class TranslationModelAdmin(StackedInline): template = "admin/edit_inline_translations_newforms.html" def translation_save_translated_fields(instance, **kwargs): """ Save all the translations of instance in post_save signal handler. """ if not hasattr(instance, '_translation_cache'): return for l_id, translation in instance._translation_cache.iteritems(): # set the translation ID just in case the translation was # created while instance was not stored in the DB yet # note: we're using _get_pk_val here even though it is # private, since that's the most reliable way to get the value # on older Django (pk property did not exist yet) translation.master_id = instance._get_pk_val() translation.save() def translation_overwrite_previous(instance, **kwargs): """ Delete previously existing translation with the same master and language_id values. To be called by translation model's pre_save signal. This most probably means I am abusing something here trying to use Django inline editor. Oh well, it will have to go anyway when we move to newforms. """ qs = instance.__class__.objects try: qs = qs.filter(master=instance.master).filter(language_id=instance.language_id) qs.delete() except ObjectDoesNotExist: # We are probably loading a fixture that defines translation entities # before their master entity. pass def fill_translation_cache(instance): """ Fill the translation cache using information received in the instance objects as extra fields. You can not do this in post_init because the extra fields are assigned by QuerySet.iterator after model initialization. """ if hasattr(instance, '_translation_cache'): # do not refill the cache return instance._translation_cache = {} for language_id in get_language_id_list(): # see if translation for language_id was in the query field_alias = get_translated_field_alias('id', language_id) if getattr(instance, field_alias, None) is not None: field_names = [f.attname for f in instance._meta.translation_model._meta.fields] # if so, create a translation object and put it in the cache field_data = {} for fname in field_names: field_data[fname] = getattr(instance, get_translated_field_alias(fname, language_id)) translation = instance._meta.translation_model(**field_data) instance._translation_cache[language_id] = translation # In some situations an (existing in the DB) object is loaded # without using the normal QuerySet. In such case fallback to # loading the translations using a separate query. # Unfortunately, this is indistinguishable from the situation when # an object does not have any translations. Oh well, we'll have # to live with this for the time being. if len(instance._translation_cache.keys()) == 0: for translation in instance.translations.all(): instance._translation_cache[translation.language_id] = translation class TranslatedFieldProxy(property): def __init__(self, field_name, alias, field, language_id=None): self.field_name = field_name self.field = field self.admin_order_field = alias self.language_id = language_id def __get__(self, obj, objtype=None): if obj is None: return self return getattr(obj, 'get_' + self.field_name)(self.language_id) def __set__(self, obj, value): language_id = self.language_id return getattr(obj, 'set_' + self.field_name)(value, self.language_id) short_description = property(lambda self: self.field.short_description) def getter_generator(field_name, short_description): """ Generate get_'field name' method for field field_name. """ def get_translation_field(self, language_id_or_code=None): try: return getattr(self.get_translation(language_id_or_code), field_name) except TranslationDoesNotExist: return None get_translation_field.short_description = short_description return get_translation_field def setter_generator(field_name): """ Generate set_'field name' method for field field_name. """ def set_translation_field(self, value, language_id_or_code=None): setattr(self.get_translation(language_id_or_code, True), field_name, value) set_translation_field.short_description = "set " + field_name return set_translation_field def get_translation(self, language_id_or_code, create_if_necessary=False): """ Get a translation instance for the given language_id_or_code. If it does not exist, either create one or raise the TranslationDoesNotExist exception, depending on the create_if_necessary argument. """ # fill the cache if necessary self.fill_translation_cache() language_id = get_language_id_from_id_or_code(language_id_or_code, False) if language_id is None: language_id = getattr(self, '_default_language', None) if language_id is None: language_id = get_default_language() if language_id not in self._translation_cache: if not create_if_necessary: raise TranslationDoesNotExist(language_id) new_translation = self._meta.translation_model(master=self, language_id=language_id) self._translation_cache[language_id] = new_translation return self._translation_cache.get(language_id, None) class Translation: """ A superclass for translatablemodel.Translation inner classes. """ def contribute_to_class(cls, main_cls, name): """ Handle the inner 'Translation' class. """ # delay the creation of the *Translation until the master model is # fully created connect(cls.finish_multilingual_class, signal=signals.class_prepared, sender=main_cls, weak=False) # connect the post_save signal on master class to a handler # that saves translations connect(translation_save_translated_fields, signal=signals.post_save, sender=main_cls) contribute_to_class = classmethod(contribute_to_class) def create_translation_attrs(cls, main_cls): """ Creates get_'field name'(language_id) and set_'field name'(language_id) methods for all the translation fields. Adds the 'field name' properties too. Returns the translated_fields hash used in field lookups, see multilingual.query. It maps field names to (field, language_id) tuples. """ translated_fields = {} for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): translated_fields[fname] = (field, None) # add get_'fname' and set_'fname' methods to main_cls getter = getter_generator(fname, getattr(field, 'verbose_name', fname)) setattr(main_cls, 'get_' + fname, getter) setter = setter_generator(fname) setattr(main_cls, 'set_' + fname, setter) # add the 'fname' proxy property that allows reads # from and writing to the appropriate translation setattr(main_cls, fname, TranslatedFieldProxy(fname, fname, field)) # create the 'fname'_'language_code' proxy properties for language_id in get_language_id_list(): language_code = get_language_code(language_id) fname_lng = fname + '_' + language_code.replace('-', '_') translated_fields[fname_lng] = (field, language_id) setattr(main_cls, fname_lng, TranslatedFieldProxy(fname, fname_lng, field, language_id)) return translated_fields create_translation_attrs = classmethod(create_translation_attrs) def get_unique_fields(cls): """ Return a list of fields with "unique" attribute, which needs to be augmented by the language. """ unique_fields = [] for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): if getattr(field,'unique',False): try: field.unique = False except AttributeError: # newer Django defines unique as a property # that uses _unique to store data. We're # jumping over the fence by setting _unique, # so this sucks, but this happens early enough # to be safe. field._unique = False unique_fields.append(fname) return unique_fields get_unique_fields = classmethod(get_unique_fields) def finish_multilingual_class(cls, *args, **kwargs): """ Create a model with translations of a multilingual class. """ main_cls = kwargs['sender'] translation_model_name = main_cls.__name__ + "Translation" # create the model with all the translatable fields unique = [('language_id', 'master')] for f in cls.get_unique_fields(): unique.append(('language_id',f)) class TransMeta: pass try: meta = cls.Meta except AttributeError: meta = TransMeta meta.ordering = ('language_id',) meta.unique_together = tuple(unique) meta.app_label = main_cls._meta.app_label if not hasattr(meta, 'db_table'): meta.db_table = main_cls._meta.db_table + '_translation' trans_attrs = cls.__dict__.copy() trans_attrs['Meta'] = meta trans_attrs['language_id'] = models.IntegerField(blank=False, null=False, core=True, choices=get_language_choices(), db_index=True) edit_inline = True trans_attrs['master'] = TranslationForeignKey(main_cls, blank=False, null=False, edit_inline=edit_inline, related_name='translations', num_in_admin=get_language_count(), min_num_in_admin=get_language_count(), num_extra_on_change=0) trans_attrs['__str__'] = lambda self: ("%s object, language_code=%s" % (translation_model_name, get_language_code(self.language_id))) trans_model = ModelBase(translation_model_name, (models.Model,), trans_attrs) trans_model._meta.translated_fields = cls.create_translation_attrs(main_cls) _old_init_name_map = main_cls._meta.__class__.init_name_map def init_name_map(self): cache = _old_init_name_map(self) for name, field_and_lang_id in trans_model._meta.translated_fields.items(): #import sys; sys.stderr.write('TM %r\n' % trans_model) cache[name] = (field_and_lang_id[0], trans_model, True, False) return cache main_cls._meta.init_name_map = instancemethod(init_name_map, main_cls._meta, main_cls._meta.__class__) main_cls._meta.translation_model = trans_model main_cls.get_translation = get_translation main_cls.fill_translation_cache = fill_translation_cache # Note: don't fill the translation cache in post_init, as all # the extra values selected by QAddTranslationData will be # assigned AFTER init() # connect(fill_translation_cache, signal=signals.post_init, # sender=main_cls) # connect the pre_save signal on translation class to a # function removing previous translation entries. connect(translation_overwrite_previous, signal=signals.pre_save, sender=trans_model, weak=False) finish_multilingual_class = classmethod(finish_multilingual_class) def install_translation_library(): # modify ModelBase.__new__ so that it understands how to handle the # 'Translation' inner class if getattr(ModelBase, '_multilingual_installed', False): # don't install it twice return _old_new = ModelBase.__new__ def multilingual_modelbase_new(cls, name, bases, attrs): if 'Translation' in attrs: if not issubclass(attrs['Translation'], Translation): raise ValueError, ("%s.Translation must be a subclass " + " of multilingual.Translation.") % (name,) # Make sure that if the class specifies objects then it is # a subclass of our Manager. # # Don't check other managers since someone might want to # have a non-multilingual manager, but assigning a # non-multilingual manager to objects would be a common # mistake. if ('objects' in attrs) and (not isinstance(attrs['objects'], manager.Manager)): raise ValueError, ("Model %s specifies translations, " + "so its 'objects' manager must be " + "a subclass of multilingual.Manager.") % (name,) # Change the default manager to multilingual.Manager. if not 'objects' in attrs: attrs['objects'] = manager.Manager() # Install a hack to let add_multilingual_manipulators know # this is a translatable model attrs['is_translation_model'] = lambda self: True return _old_new(cls, name, bases, attrs) ModelBase.__new__ = staticmethod(multilingual_modelbase_new) ModelBase._multilingual_installed = True # Override ModelAdmin.__new__ to create automatic inline # editor for multilingual models. _old_admin_new = ModelAdmin.__new__ def multilingual_modeladmin_new(cls, model, admin_site): if isinstance(model.objects, manager.Manager): X = cls.get_translation_modeladmin(model) if cls.inlines: for inline in cls.inlines: if X.__class__ == inline.__class__: cls.inlines.remove(inline) break cls.inlines.append(X) else: cls.inlines = [X] return _old_admin_new(cls, model, admin_site) def get_translation_modeladmin(cls, model): if hasattr(cls, 'Translation'): tr_cls = cls.Translation if not issubclass(tr_cls, TranslationModelAdmin): raise ValueError, ("%s.Translation must be a subclass " + " of multilingual.TranslationModelAdmin.") % cls.name else: - tr_cls = TranslationModelAdmin + tr_cls = type("%s.Translation" % cls.__name__, (TranslationModelAdmin,), {}) tr_cls.model = model._meta.translation_model tr_cls.fk_name = 'master' tr_cls.extra = get_language_count() tr_cls.max_num = get_language_count() return tr_cls ModelAdmin.__new__ = staticmethod(multilingual_modeladmin_new) ModelAdmin.get_translation_modeladmin = classmethod(get_translation_modeladmin) # install the library install_translation_library()
stefanfoulis/django-multilingual
c13f8e02858496d56a1bb6e58ffcafebf6094ed9
Use admin site autodiscovery. Extracted admin code into admin.py. Show off new ModelAdmin translation code.
diff --git a/testproject/articles/admin.py b/testproject/articles/admin.py new file mode 100644 index 0000000..d256756 --- /dev/null +++ b/testproject/articles/admin.py @@ -0,0 +1,22 @@ +from django import forms +from django.contrib import admin +from multilingual import translation +from articles import models + +class CategoryAdmin(admin.ModelAdmin): + # Field names would just work here, but if you need + # correct list headers (from field.verbose_name) you have to + # use the get_'field_name' functions here. + list_display = ('id', 'creator', 'created', 'name', 'description') + search_fields = ('name', 'description') + +class ArticleAdmin(admin.ModelAdmin): + class Translation(translation.TranslationModelAdmin): + def formfield_for_dbfield(self, db_field, **kwargs): + field = super(translation.TranslationModelAdmin, self).formfield_for_dbfield(db_field, **kwargs) + if db_field.name == 'contents': + field.widget = forms.Textarea(attrs={'cols': 50}) + return field + +admin.site.register(models.Article, ArticleAdmin) +admin.site.register(models.Category, CategoryAdmin) diff --git a/testproject/articles/models.py b/testproject/articles/models.py index 40ae906..90b3e33 100644 --- a/testproject/articles/models.py +++ b/testproject/articles/models.py @@ -1,317 +1,302 @@ """ Test models for the multilingual library. # Note: the to_str() calls in all the tests are here only to make it # easier to test both pre-unicode and current Django. >>> from testproject.utils import to_str # make sure the settings are right >>> from multilingual.languages import LANGUAGES >>> LANGUAGES [['en', 'English'], ['pl', 'Polish'], ['zh-cn', 'Simplified Chinese']] >>> from multilingual import set_default_language >>> from django.db.models import Q >>> set_default_language(1) ### Check the table names >>> Category._meta.translation_model._meta.db_table 'category_language' >>> Article._meta.translation_model._meta.db_table 'articles_article_translation' ### Create the test data # Check both assigning via the proxy properties and set_* functions >>> c = Category() >>> c.name_en = 'category 1' >>> c.name_pl = 'kategoria 1' >>> c.save() >>> c = Category() >>> c.set_name('category 2', 'en') >>> c.set_name('kategoria 2', 'pl') >>> c.save() ### See if the test data was saved correctly ### Note: first object comes from the initial fixture. >>> c = Category.objects.all().order_by('id')[1] >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('category 1', 'category 1', 'kategoria 1') >>> c = Category.objects.all().order_by('id')[2] >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('category 2', 'category 2', 'kategoria 2') ### Check translation changes. ### Make sure the name and description properties obey ### set_default_language. >>> c = Category.objects.all().order_by('id')[1] # set language: pl >>> set_default_language(2) >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('kategoria 1', 'category 1', 'kategoria 1') >>> c.name = 'kat 1' >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('kat 1', 'category 1', 'kat 1') # set language: en >>> set_default_language('en') >>> c.name = 'cat 1' >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('cat 1', 'cat 1', 'kat 1') >>> c.save() # Read the entire Category objects from the DB again to see if # everything was saved correctly. >>> c = Category.objects.all().order_by('id')[1] >>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) ('cat 1', 'cat 1', 'kat 1') >>> c = Category.objects.all().order_by('id')[2] >>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) ('category 2', 'category 2', 'kategoria 2') ### Check ordering >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) ['Fixture category', 'cat 1', 'category 2'] ### Check ordering # start with renaming one of the categories so that the order actually # depends on the default language >>> set_default_language(1) >>> c = Category.objects.get(name='cat 1') >>> c.name = 'zzz cat 1' >>> c.save() >>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) ['Fixture category', 'category 2', 'zzz cat 1'] >>> to_str([c.name for c in Category.objects.all().order_by('name')]) ['Fixture category', 'category 2', 'zzz cat 1'] >>> to_str([c.name for c in Category.objects.all().order_by('-name')]) ['zzz cat 1', 'category 2', 'Fixture category'] >>> set_default_language(2) >>> to_str([c.name for c in Category.objects.all().order_by('name')]) ['Fixture kategoria', 'kat 1', 'kategoria 2'] >>> to_str([c.name for c in Category.objects.all().order_by('-name')]) ['kategoria 2', 'kat 1', 'Fixture kategoria'] ### Check filtering # Check for filtering defined by Q objects as well. This is a recent # improvement: the translation fields are being handled by an # extension of lookup_inner instead of overridden # QuerySet._filter_or_exclude >>> set_default_language('en') >>> to_str([c.name for c in Category.objects.all().filter(name__contains='2')]) ['category 2'] >>> set_default_language('en') >>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='2'))]) ['category 2'] >>> set_default_language(1) >>> to_str([c.name for c in ... Category.objects.all().filter(Q(name__contains='2')|Q(name_pl__contains='kat'))]) ['Fixture category', 'zzz cat 1', 'category 2'] >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().filter(name_en__contains='2')]) ['category 2'] >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().filter(Q(name_pl__contains='kat'))]) ['Fixture category', 'zzz cat 1', 'category 2'] >>> set_default_language('pl') >>> to_str([c.name for c in Category.objects.all().filter(name__contains='k')]) ['Fixture kategoria', 'kat 1', 'kategoria 2'] >>> set_default_language('pl') >>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='kategoria'))]) ['Fixture kategoria', 'kategoria 2'] ### Check specifying query set language ->>> c_en = Category.objects.all().for_language('en') +>>> c_en = Category.objects.all().for_language('en') >>> c_pl = Category.objects.all().for_language(2) # both ID and code work here >>> to_str(c_en.get(name__contains='1').name) 'zzz cat 1' >>> to_str(c_pl.get(name__contains='1').name) 'kat 1' >>> to_str([c.name for c in c_en.order_by('name')]) ['Fixture category', 'category 2', 'zzz cat 1'] >>> to_str([c.name for c in c_pl.order_by('-name')]) ['kategoria 2', 'kat 1', 'Fixture kategoria'] >>> c = c_en.get(id=2) >>> c.name = 'test' >>> to_str((c.name, c.name_en, c.name_pl)) ('test', 'test', 'kat 1') >>> c = c_pl.get(id=2) >>> c.name = 'test' >>> to_str((c.name, c.name_en, c.name_pl)) ('test', 'zzz cat 1', 'test') ### Check filtering spanning more than one model >>> set_default_language(1) >>> cat_1 = Category.objects.get(name='zzz cat 1') >>> cat_2 = Category.objects.get(name='category 2') >>> a = Article(category=cat_1) >>> a.set_title('article 1', 1) >>> a.set_title('artykul 1', 2) >>> a.set_contents('contents 1', 1) >>> a.set_contents('zawartosc 1', 1) >>> a.save() >>> a = Article(category=cat_2) >>> a.set_title('article 2', 1) >>> a.set_title('artykul 2', 2) >>> a.set_contents('contents 2', 1) >>> a.set_contents('zawartosc 2', 1) >>> a.save() >>> to_str([a.title for a in Article.objects.filter(category=cat_1)]) ['article 1'] >>> to_str([a.title for a in Article.objects.filter(category__name=cat_1.name)]) ['article 1'] >>> to_str([a.title for a in Article.objects.filter(Q(category__name=cat_1.name)|Q(category__name_pl__contains='2')).order_by('-title')]) ['article 2', 'article 1'] ### Test the creation of new objects using keywords passed to the ### constructor >>> set_default_language(2) >>> c_n = Category.objects.create(name_en='new category', name_pl='nowa kategoria') >>> to_str((c_n.name, c_n.name_en, c_n.name_pl)) ('nowa kategoria', 'new category', 'nowa kategoria') >>> c_n.save() >>> c_n2 = Category.objects.get(name_en='new category') >>> to_str((c_n2.name, c_n2.name_en, c_n2.name_pl)) ('nowa kategoria', 'new category', 'nowa kategoria') >>> set_default_language(2) >>> c_n3 = Category.objects.create(name='nowa kategoria 2') >>> to_str((c_n3.name, c_n3.name_en, c_n3.name_pl)) ('nowa kategoria 2', None, 'nowa kategoria 2') """ from django.db import models from django.contrib.auth.models import User import multilingual try: from django.utils.translation import ugettext as _ except: # if this fails then _ is a builtin pass class Category(models.Model): """ Test model for multilingual content: a simplified Category. """ - + # First, some fields that do not need translations creator = models.ForeignKey(User, verbose_name=_("Created by"), blank=True, null=True) created = models.DateTimeField(verbose_name=_("Created at"), auto_now_add=True) parent = models.ForeignKey('self', verbose_name=_("Parent category"), blank=True, null=True) # And now the translatable fields class Translation(multilingual.Translation): """ The definition of translation model. The multilingual machinery will automatically add these to the Category class: - + * get_name(language_id=None) * set_name(value, language_id=None) * get_description(language_id=None) * set_description(value, language_id=None) * name and description properties using the methods above """ name = models.CharField(verbose_name=_("The name"), max_length=250) description = models.TextField(verbose_name=_("The description"), blank=True, null=False) class Meta: db_table = 'category_language' def get_absolute_url(self): return "/" + str(self.id) + "/" def __unicode__(self): # note that you can use name and description fields as usual try: return str(self.name) except multilingual.TranslationDoesNotExist: return "-not-available-" def __str__(self): # compatibility return str(self.__unicode__()) - - class Admin: - # Again, field names would just work here, but if you need - # correct list headers (from field.verbose_name) you have to - # use the get_'field_name' functions here. - - # Note: this Admin class does not do anything in newforms-admin - list_display = ('id', 'creator', 'created', 'name', 'description') - search_fields = ('name', 'description') class Meta: verbose_name_plural = 'categories' ordering = ('id',) class CustomArticleManager(multilingual.Manager): pass class Article(models.Model): """ Test model for multilingual content: a simplified article belonging to a single category. """ # non-translatable fields first creator = models.ForeignKey(User, verbose_name=_("Created by"), blank=True, null=True) created = models.DateTimeField(verbose_name=_("Created at"), auto_now_add=True) category = models.ForeignKey(Category, verbose_name=_("Parent category"), blank=True, null=True) objects = CustomArticleManager() - + # And now the translatable fields class Translation(multilingual.Translation): title = models.CharField(verbose_name=_("The title"), blank=True, null=False, max_length=250) contents = models.TextField(verbose_name=_("The contents"), blank=True, null=False) - -from multilingual.compat import IS_NEWFORMS_ADMIN -if IS_NEWFORMS_ADMIN: - from django.contrib import admin - admin.site.register(Article) - admin.site.register(Category) diff --git a/testproject/urls.py b/testproject/urls.py index 8dac1b0..3d751b2 100644 --- a/testproject/urls.py +++ b/testproject/urls.py @@ -1,27 +1,18 @@ from django.conf.urls.defaults import * +from django.contrib import admin from articles.models import * +admin.autodiscover() + urlpatterns = patterns('', (r'^$', 'django.views.generic.list_detail.object_list', {'queryset': Category.objects.all(), 'allow_empty': True}), (r'^(?P<object_id>[0-9]+)/$', 'django.views.generic.create_update.update_object', {'model': Category, 'post_save_redirect': '/'}), (r'^new/$', 'django.views.generic.create_update.create_object', {'model': Category}), -) - -# handle both newforms and oldforms admin URL -from multilingual.compat import IS_NEWFORMS_ADMIN -if IS_NEWFORMS_ADMIN: - from django.contrib import admin - - urlpatterns += patterns('', - (r'^admin/(.*)', admin.site.root), - ) -else: - urlpatterns += patterns('', - (r'^admin/', include('django.contrib.admin.urls')), - ) + (r'^admin/(.*)', admin.site.root), +)
stefanfoulis/django-multilingual
9f59a63ae9a047ce19a270b770ef53aaa9feadf5
Changed the creation of the ModelAdmin class for tranlations. Now accepts a 'Translation' class in the ModelAdmin class.
diff --git a/multilingual/translation.py b/multilingual/translation.py index b03fc7c..514fe05 100644 --- a/multilingual/translation.py +++ b/multilingual/translation.py @@ -1,396 +1,403 @@ """ Support for models' internal Translation class. """ ## TO DO: this is messy and needs to be cleaned up from django.contrib.admin import StackedInline, ModelAdmin from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.db.models import signals from django.db.models.base import ModelBase from django.dispatch.dispatcher import connect from multilingual.languages import * from multilingual.exceptions import TranslationDoesNotExist from multilingual.fields import TranslationForeignKey from multilingual.manipulators import add_multilingual_manipulators from multilingual import manager from new import instancemethod -class MultilingualStackedInline(StackedInline): +class TranslationModelAdmin(StackedInline): template = "admin/edit_inline_translations_newforms.html" def translation_save_translated_fields(instance, **kwargs): """ Save all the translations of instance in post_save signal handler. """ if not hasattr(instance, '_translation_cache'): return for l_id, translation in instance._translation_cache.iteritems(): # set the translation ID just in case the translation was # created while instance was not stored in the DB yet # note: we're using _get_pk_val here even though it is # private, since that's the most reliable way to get the value # on older Django (pk property did not exist yet) translation.master_id = instance._get_pk_val() translation.save() def translation_overwrite_previous(instance, **kwargs): """ Delete previously existing translation with the same master and language_id values. To be called by translation model's pre_save signal. This most probably means I am abusing something here trying to use Django inline editor. Oh well, it will have to go anyway when we move to newforms. """ qs = instance.__class__.objects try: qs = qs.filter(master=instance.master).filter(language_id=instance.language_id) qs.delete() except ObjectDoesNotExist: # We are probably loading a fixture that defines translation entities # before their master entity. pass def fill_translation_cache(instance): """ Fill the translation cache using information received in the instance objects as extra fields. You can not do this in post_init because the extra fields are assigned by QuerySet.iterator after model initialization. """ if hasattr(instance, '_translation_cache'): # do not refill the cache return instance._translation_cache = {} for language_id in get_language_id_list(): # see if translation for language_id was in the query field_alias = get_translated_field_alias('id', language_id) if getattr(instance, field_alias, None) is not None: field_names = [f.attname for f in instance._meta.translation_model._meta.fields] # if so, create a translation object and put it in the cache field_data = {} for fname in field_names: field_data[fname] = getattr(instance, get_translated_field_alias(fname, language_id)) translation = instance._meta.translation_model(**field_data) instance._translation_cache[language_id] = translation # In some situations an (existing in the DB) object is loaded # without using the normal QuerySet. In such case fallback to # loading the translations using a separate query. # Unfortunately, this is indistinguishable from the situation when # an object does not have any translations. Oh well, we'll have # to live with this for the time being. if len(instance._translation_cache.keys()) == 0: for translation in instance.translations.all(): instance._translation_cache[translation.language_id] = translation class TranslatedFieldProxy(property): def __init__(self, field_name, alias, field, language_id=None): self.field_name = field_name self.field = field self.admin_order_field = alias self.language_id = language_id def __get__(self, obj, objtype=None): if obj is None: return self return getattr(obj, 'get_' + self.field_name)(self.language_id) def __set__(self, obj, value): language_id = self.language_id return getattr(obj, 'set_' + self.field_name)(value, self.language_id) short_description = property(lambda self: self.field.short_description) def getter_generator(field_name, short_description): """ Generate get_'field name' method for field field_name. """ def get_translation_field(self, language_id_or_code=None): try: return getattr(self.get_translation(language_id_or_code), field_name) except TranslationDoesNotExist: return None get_translation_field.short_description = short_description return get_translation_field def setter_generator(field_name): """ Generate set_'field name' method for field field_name. """ def set_translation_field(self, value, language_id_or_code=None): setattr(self.get_translation(language_id_or_code, True), field_name, value) set_translation_field.short_description = "set " + field_name return set_translation_field def get_translation(self, language_id_or_code, create_if_necessary=False): """ Get a translation instance for the given language_id_or_code. If it does not exist, either create one or raise the TranslationDoesNotExist exception, depending on the create_if_necessary argument. """ # fill the cache if necessary self.fill_translation_cache() language_id = get_language_id_from_id_or_code(language_id_or_code, False) if language_id is None: language_id = getattr(self, '_default_language', None) if language_id is None: language_id = get_default_language() if language_id not in self._translation_cache: if not create_if_necessary: raise TranslationDoesNotExist(language_id) new_translation = self._meta.translation_model(master=self, language_id=language_id) self._translation_cache[language_id] = new_translation return self._translation_cache.get(language_id, None) class Translation: """ A superclass for translatablemodel.Translation inner classes. """ def contribute_to_class(cls, main_cls, name): """ Handle the inner 'Translation' class. """ # delay the creation of the *Translation until the master model is # fully created connect(cls.finish_multilingual_class, signal=signals.class_prepared, sender=main_cls, weak=False) - + # connect the post_save signal on master class to a handler # that saves translations connect(translation_save_translated_fields, signal=signals.post_save, sender=main_cls) contribute_to_class = classmethod(contribute_to_class) def create_translation_attrs(cls, main_cls): """ Creates get_'field name'(language_id) and set_'field name'(language_id) methods for all the translation fields. Adds the 'field name' properties too. Returns the translated_fields hash used in field lookups, see multilingual.query. It maps field names to (field, language_id) tuples. """ translated_fields = {} - + for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): translated_fields[fname] = (field, None) - + # add get_'fname' and set_'fname' methods to main_cls getter = getter_generator(fname, getattr(field, 'verbose_name', fname)) setattr(main_cls, 'get_' + fname, getter) - + setter = setter_generator(fname) setattr(main_cls, 'set_' + fname, setter) - + # add the 'fname' proxy property that allows reads # from and writing to the appropriate translation setattr(main_cls, fname, TranslatedFieldProxy(fname, fname, field)) - + # create the 'fname'_'language_code' proxy properties for language_id in get_language_id_list(): language_code = get_language_code(language_id) fname_lng = fname + '_' + language_code.replace('-', '_') translated_fields[fname_lng] = (field, language_id) setattr(main_cls, fname_lng, TranslatedFieldProxy(fname, fname_lng, field, language_id)) return translated_fields create_translation_attrs = classmethod(create_translation_attrs) def get_unique_fields(cls): """ Return a list of fields with "unique" attribute, which needs to be augmented by the language. """ unique_fields = [] - + for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): if getattr(field,'unique',False): try: field.unique = False except AttributeError: # newer Django defines unique as a property # that uses _unique to store data. We're # jumping over the fence by setting _unique, # so this sucks, but this happens early enough # to be safe. field._unique = False unique_fields.append(fname) return unique_fields get_unique_fields = classmethod(get_unique_fields) def finish_multilingual_class(cls, *args, **kwargs): """ Create a model with translations of a multilingual class. """ main_cls = kwargs['sender'] translation_model_name = main_cls.__name__ + "Translation" # create the model with all the translatable fields unique = [('language_id', 'master')] for f in cls.get_unique_fields(): unique.append(('language_id',f)) class TransMeta: pass try: meta = cls.Meta except AttributeError: meta = TransMeta meta.ordering = ('language_id',) meta.unique_together = tuple(unique) meta.app_label = main_cls._meta.app_label if not hasattr(meta, 'db_table'): meta.db_table = main_cls._meta.db_table + '_translation' trans_attrs = cls.__dict__.copy() trans_attrs['Meta'] = meta trans_attrs['language_id'] = models.IntegerField(blank=False, null=False, core=True, choices=get_language_choices(), db_index=True) edit_inline = True trans_attrs['master'] = TranslationForeignKey(main_cls, blank=False, null=False, edit_inline=edit_inline, related_name='translations', num_in_admin=get_language_count(), min_num_in_admin=get_language_count(), num_extra_on_change=0) trans_attrs['__str__'] = lambda self: ("%s object, language_code=%s" % (translation_model_name, get_language_code(self.language_id))) - + trans_model = ModelBase(translation_model_name, (models.Model,), trans_attrs) trans_model._meta.translated_fields = cls.create_translation_attrs(main_cls) _old_init_name_map = main_cls._meta.__class__.init_name_map def init_name_map(self): cache = _old_init_name_map(self) for name, field_and_lang_id in trans_model._meta.translated_fields.items(): #import sys; sys.stderr.write('TM %r\n' % trans_model) cache[name] = (field_and_lang_id[0], trans_model, True, False) return cache main_cls._meta.init_name_map = instancemethod(init_name_map, main_cls._meta, main_cls._meta.__class__) - + main_cls._meta.translation_model = trans_model main_cls.get_translation = get_translation main_cls.fill_translation_cache = fill_translation_cache # Note: don't fill the translation cache in post_init, as all # the extra values selected by QAddTranslationData will be # assigned AFTER init() # connect(fill_translation_cache, signal=signals.post_init, # sender=main_cls) # connect the pre_save signal on translation class to a # function removing previous translation entries. connect(translation_overwrite_previous, signal=signals.pre_save, sender=trans_model, weak=False) finish_multilingual_class = classmethod(finish_multilingual_class) def install_translation_library(): # modify ModelBase.__new__ so that it understands how to handle the # 'Translation' inner class if getattr(ModelBase, '_multilingual_installed', False): # don't install it twice return _old_new = ModelBase.__new__ def multilingual_modelbase_new(cls, name, bases, attrs): if 'Translation' in attrs: if not issubclass(attrs['Translation'], Translation): raise ValueError, ("%s.Translation must be a subclass " + " of multilingual.Translation.") % (name,) - + # Make sure that if the class specifies objects then it is # a subclass of our Manager. # # Don't check other managers since someone might want to # have a non-multilingual manager, but assigning a # non-multilingual manager to objects would be a common # mistake. if ('objects' in attrs) and (not isinstance(attrs['objects'], manager.Manager)): raise ValueError, ("Model %s specifies translations, " + "so its 'objects' manager must be " + "a subclass of multilingual.Manager.") % (name,) # Change the default manager to multilingual.Manager. if not 'objects' in attrs: attrs['objects'] = manager.Manager() - + # Install a hack to let add_multilingual_manipulators know # this is a translatable model attrs['is_translation_model'] = lambda self: True - + return _old_new(cls, name, bases, attrs) ModelBase.__new__ = staticmethod(multilingual_modelbase_new) ModelBase._multilingual_installed = True # Override ModelAdmin.__new__ to create automatic inline # editor for multilingual models. - class MultiType(type): - pass _old_admin_new = ModelAdmin.__new__ + def multilingual_modeladmin_new(cls, model, admin_site): if isinstance(model.objects, manager.Manager): X = cls.get_translation_modeladmin(model) if cls.inlines: for inline in cls.inlines: if X.__class__ == inline.__class__: cls.inlines.remove(inline) break cls.inlines.append(X) else: cls.inlines = [X] return _old_admin_new(cls, model, admin_site) + def get_translation_modeladmin(cls, model): - X = MultiType('X',(MultilingualStackedInline,), - {'model':model._meta.translation_model, - 'fk_name':'master', - 'extra':get_language_count(), - 'max_num':get_language_count()}) - return X + if hasattr(cls, 'Translation'): + tr_cls = cls.Translation + if not issubclass(tr_cls, TranslationModelAdmin): + raise ValueError, ("%s.Translation must be a subclass " + + " of multilingual.TranslationModelAdmin.") % cls.name + else: + tr_cls = TranslationModelAdmin + tr_cls.model = model._meta.translation_model + tr_cls.fk_name = 'master' + tr_cls.extra = get_language_count() + tr_cls.max_num = get_language_count() + return tr_cls + ModelAdmin.__new__ = staticmethod(multilingual_modeladmin_new) ModelAdmin.get_translation_modeladmin = classmethod(get_translation_modeladmin) # install the library install_translation_library()
stefanfoulis/django-multilingual
94f99c94e816833f91220c8de6ea9e9e0c42e47b
Factor out the dynamic generation of the translation ModelAdmin class.
diff --git a/multilingual/translation.py b/multilingual/translation.py index 9927c03..b03fc7c 100644 --- a/multilingual/translation.py +++ b/multilingual/translation.py @@ -1,392 +1,396 @@ """ Support for models' internal Translation class. """ ## TO DO: this is messy and needs to be cleaned up from django.contrib.admin import StackedInline, ModelAdmin from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.db.models import signals from django.db.models.base import ModelBase from django.dispatch.dispatcher import connect from multilingual.languages import * from multilingual.exceptions import TranslationDoesNotExist from multilingual.fields import TranslationForeignKey from multilingual.manipulators import add_multilingual_manipulators from multilingual import manager from new import instancemethod class MultilingualStackedInline(StackedInline): template = "admin/edit_inline_translations_newforms.html" def translation_save_translated_fields(instance, **kwargs): """ Save all the translations of instance in post_save signal handler. """ if not hasattr(instance, '_translation_cache'): return for l_id, translation in instance._translation_cache.iteritems(): # set the translation ID just in case the translation was # created while instance was not stored in the DB yet # note: we're using _get_pk_val here even though it is # private, since that's the most reliable way to get the value # on older Django (pk property did not exist yet) translation.master_id = instance._get_pk_val() translation.save() def translation_overwrite_previous(instance, **kwargs): """ Delete previously existing translation with the same master and language_id values. To be called by translation model's pre_save signal. This most probably means I am abusing something here trying to use Django inline editor. Oh well, it will have to go anyway when we move to newforms. """ qs = instance.__class__.objects try: qs = qs.filter(master=instance.master).filter(language_id=instance.language_id) qs.delete() except ObjectDoesNotExist: # We are probably loading a fixture that defines translation entities # before their master entity. pass def fill_translation_cache(instance): """ Fill the translation cache using information received in the instance objects as extra fields. You can not do this in post_init because the extra fields are assigned by QuerySet.iterator after model initialization. """ if hasattr(instance, '_translation_cache'): # do not refill the cache return instance._translation_cache = {} for language_id in get_language_id_list(): # see if translation for language_id was in the query field_alias = get_translated_field_alias('id', language_id) if getattr(instance, field_alias, None) is not None: field_names = [f.attname for f in instance._meta.translation_model._meta.fields] # if so, create a translation object and put it in the cache field_data = {} for fname in field_names: field_data[fname] = getattr(instance, get_translated_field_alias(fname, language_id)) translation = instance._meta.translation_model(**field_data) instance._translation_cache[language_id] = translation # In some situations an (existing in the DB) object is loaded # without using the normal QuerySet. In such case fallback to # loading the translations using a separate query. # Unfortunately, this is indistinguishable from the situation when # an object does not have any translations. Oh well, we'll have # to live with this for the time being. if len(instance._translation_cache.keys()) == 0: for translation in instance.translations.all(): instance._translation_cache[translation.language_id] = translation class TranslatedFieldProxy(property): def __init__(self, field_name, alias, field, language_id=None): self.field_name = field_name self.field = field self.admin_order_field = alias self.language_id = language_id def __get__(self, obj, objtype=None): if obj is None: return self return getattr(obj, 'get_' + self.field_name)(self.language_id) def __set__(self, obj, value): language_id = self.language_id return getattr(obj, 'set_' + self.field_name)(value, self.language_id) short_description = property(lambda self: self.field.short_description) def getter_generator(field_name, short_description): """ Generate get_'field name' method for field field_name. """ def get_translation_field(self, language_id_or_code=None): try: return getattr(self.get_translation(language_id_or_code), field_name) except TranslationDoesNotExist: return None get_translation_field.short_description = short_description return get_translation_field def setter_generator(field_name): """ Generate set_'field name' method for field field_name. """ def set_translation_field(self, value, language_id_or_code=None): setattr(self.get_translation(language_id_or_code, True), field_name, value) set_translation_field.short_description = "set " + field_name return set_translation_field def get_translation(self, language_id_or_code, create_if_necessary=False): """ Get a translation instance for the given language_id_or_code. If it does not exist, either create one or raise the TranslationDoesNotExist exception, depending on the create_if_necessary argument. """ # fill the cache if necessary self.fill_translation_cache() language_id = get_language_id_from_id_or_code(language_id_or_code, False) if language_id is None: language_id = getattr(self, '_default_language', None) if language_id is None: language_id = get_default_language() if language_id not in self._translation_cache: if not create_if_necessary: raise TranslationDoesNotExist(language_id) new_translation = self._meta.translation_model(master=self, language_id=language_id) self._translation_cache[language_id] = new_translation return self._translation_cache.get(language_id, None) class Translation: """ A superclass for translatablemodel.Translation inner classes. """ def contribute_to_class(cls, main_cls, name): """ Handle the inner 'Translation' class. """ # delay the creation of the *Translation until the master model is # fully created connect(cls.finish_multilingual_class, signal=signals.class_prepared, sender=main_cls, weak=False) # connect the post_save signal on master class to a handler # that saves translations connect(translation_save_translated_fields, signal=signals.post_save, sender=main_cls) contribute_to_class = classmethod(contribute_to_class) def create_translation_attrs(cls, main_cls): """ Creates get_'field name'(language_id) and set_'field name'(language_id) methods for all the translation fields. Adds the 'field name' properties too. Returns the translated_fields hash used in field lookups, see multilingual.query. It maps field names to (field, language_id) tuples. """ translated_fields = {} for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): translated_fields[fname] = (field, None) # add get_'fname' and set_'fname' methods to main_cls getter = getter_generator(fname, getattr(field, 'verbose_name', fname)) setattr(main_cls, 'get_' + fname, getter) setter = setter_generator(fname) setattr(main_cls, 'set_' + fname, setter) # add the 'fname' proxy property that allows reads # from and writing to the appropriate translation setattr(main_cls, fname, TranslatedFieldProxy(fname, fname, field)) # create the 'fname'_'language_code' proxy properties for language_id in get_language_id_list(): language_code = get_language_code(language_id) fname_lng = fname + '_' + language_code.replace('-', '_') translated_fields[fname_lng] = (field, language_id) setattr(main_cls, fname_lng, TranslatedFieldProxy(fname, fname_lng, field, language_id)) return translated_fields create_translation_attrs = classmethod(create_translation_attrs) def get_unique_fields(cls): """ Return a list of fields with "unique" attribute, which needs to be augmented by the language. """ unique_fields = [] for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): if getattr(field,'unique',False): try: field.unique = False except AttributeError: # newer Django defines unique as a property # that uses _unique to store data. We're # jumping over the fence by setting _unique, # so this sucks, but this happens early enough # to be safe. field._unique = False unique_fields.append(fname) return unique_fields get_unique_fields = classmethod(get_unique_fields) def finish_multilingual_class(cls, *args, **kwargs): """ Create a model with translations of a multilingual class. """ main_cls = kwargs['sender'] translation_model_name = main_cls.__name__ + "Translation" # create the model with all the translatable fields unique = [('language_id', 'master')] for f in cls.get_unique_fields(): unique.append(('language_id',f)) class TransMeta: pass try: meta = cls.Meta except AttributeError: meta = TransMeta meta.ordering = ('language_id',) meta.unique_together = tuple(unique) meta.app_label = main_cls._meta.app_label if not hasattr(meta, 'db_table'): meta.db_table = main_cls._meta.db_table + '_translation' trans_attrs = cls.__dict__.copy() trans_attrs['Meta'] = meta trans_attrs['language_id'] = models.IntegerField(blank=False, null=False, core=True, choices=get_language_choices(), db_index=True) edit_inline = True trans_attrs['master'] = TranslationForeignKey(main_cls, blank=False, null=False, edit_inline=edit_inline, related_name='translations', num_in_admin=get_language_count(), min_num_in_admin=get_language_count(), num_extra_on_change=0) trans_attrs['__str__'] = lambda self: ("%s object, language_code=%s" % (translation_model_name, get_language_code(self.language_id))) trans_model = ModelBase(translation_model_name, (models.Model,), trans_attrs) trans_model._meta.translated_fields = cls.create_translation_attrs(main_cls) _old_init_name_map = main_cls._meta.__class__.init_name_map def init_name_map(self): cache = _old_init_name_map(self) for name, field_and_lang_id in trans_model._meta.translated_fields.items(): #import sys; sys.stderr.write('TM %r\n' % trans_model) cache[name] = (field_and_lang_id[0], trans_model, True, False) return cache main_cls._meta.init_name_map = instancemethod(init_name_map, main_cls._meta, main_cls._meta.__class__) main_cls._meta.translation_model = trans_model main_cls.get_translation = get_translation main_cls.fill_translation_cache = fill_translation_cache # Note: don't fill the translation cache in post_init, as all # the extra values selected by QAddTranslationData will be # assigned AFTER init() # connect(fill_translation_cache, signal=signals.post_init, # sender=main_cls) # connect the pre_save signal on translation class to a # function removing previous translation entries. connect(translation_overwrite_previous, signal=signals.pre_save, sender=trans_model, weak=False) finish_multilingual_class = classmethod(finish_multilingual_class) def install_translation_library(): # modify ModelBase.__new__ so that it understands how to handle the # 'Translation' inner class if getattr(ModelBase, '_multilingual_installed', False): # don't install it twice return _old_new = ModelBase.__new__ def multilingual_modelbase_new(cls, name, bases, attrs): if 'Translation' in attrs: if not issubclass(attrs['Translation'], Translation): raise ValueError, ("%s.Translation must be a subclass " + " of multilingual.Translation.") % (name,) # Make sure that if the class specifies objects then it is # a subclass of our Manager. # # Don't check other managers since someone might want to # have a non-multilingual manager, but assigning a # non-multilingual manager to objects would be a common # mistake. if ('objects' in attrs) and (not isinstance(attrs['objects'], manager.Manager)): raise ValueError, ("Model %s specifies translations, " + "so its 'objects' manager must be " + "a subclass of multilingual.Manager.") % (name,) # Change the default manager to multilingual.Manager. if not 'objects' in attrs: attrs['objects'] = manager.Manager() # Install a hack to let add_multilingual_manipulators know # this is a translatable model attrs['is_translation_model'] = lambda self: True return _old_new(cls, name, bases, attrs) ModelBase.__new__ = staticmethod(multilingual_modelbase_new) ModelBase._multilingual_installed = True # Override ModelAdmin.__new__ to create automatic inline # editor for multilingual models. class MultiType(type): pass _old_admin_new = ModelAdmin.__new__ def multilingual_modeladmin_new(cls, model, admin_site): if isinstance(model.objects, manager.Manager): - X = MultiType('X',(MultilingualStackedInline,), - {'model':model._meta.translation_model, - 'fk_name':'master', - 'extra':get_language_count(), - 'max_num':get_language_count()}) + X = cls.get_translation_modeladmin(model) if cls.inlines: for inline in cls.inlines: if X.__class__ == inline.__class__: cls.inlines.remove(inline) break cls.inlines.append(X) else: cls.inlines = [X] return _old_admin_new(cls, model, admin_site) + def get_translation_modeladmin(cls, model): + X = MultiType('X',(MultilingualStackedInline,), + {'model':model._meta.translation_model, + 'fk_name':'master', + 'extra':get_language_count(), + 'max_num':get_language_count()}) + return X ModelAdmin.__new__ = staticmethod(multilingual_modeladmin_new) + ModelAdmin.get_translation_modeladmin = classmethod(get_translation_modeladmin) # install the library install_translation_library()
stefanfoulis/django-multilingual
a8bbdcf54c18c88f438822abef3a328ac973919f
Removed more compatibility code. This is the result of a quick scan through all modules.
diff --git a/multilingual/compat.py b/multilingual/compat.py deleted file mode 100644 index 4f11943..0000000 --- a/multilingual/compat.py +++ /dev/null @@ -1,13 +0,0 @@ -""" -Code that allows DM to be compatible with various Django versions. -""" - -# check whether Django is from the newforms-admin branch -IS_NEWFORMS_ADMIN = False - -try: - # try to import a class that is no longer present in the - # newforms-admin branch - from django.contrib.admin.templatetags.admin_modify import StackedBoundRelatedObject -except ImportError: - IS_NEWFORMS_ADMIN = True diff --git a/multilingual/compat/__init__.py b/multilingual/compat/__init__.py deleted file mode 100644 index a299050..0000000 --- a/multilingual/compat/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -Code that allows DM to be compatible with various Django versions. -""" - -# check whether Django is from the newforms-admin branch -IS_NEWFORMS_ADMIN = False - -try: - # try to import a class that is no longer present in the - # newforms-admin branch - from django.contrib.admin.templatetags.admin_modify import StackedBoundRelatedObject -except ImportError: - IS_NEWFORMS_ADMIN = True - -# check to see if QSRF was merged -IS_QSRF = True - -try: - import django.db.models.sql -except ImportError: - IS_QSRF = False diff --git a/multilingual/compat/manager_pre_qsrf.py b/multilingual/compat/manager_pre_qsrf.py deleted file mode 100644 index 0abcdb8..0000000 --- a/multilingual/compat/manager_pre_qsrf.py +++ /dev/null @@ -1,26 +0,0 @@ -from django.db import models -from multilingual.query import MultilingualModelQuerySet, QAddTranslationData -from multilingual.languages import * - -class Manager(models.Manager): - """ - A manager for multilingual models. - - TO DO: turn this into a proxy manager that would allow developers - to use any manager they need. It should be sufficient to extend - and additionaly filter or order querysets returned by that manager. - """ - - def get_query_set(self): - translation_model = self.model._meta.translation_model - select = {} - for language_id in get_language_id_list(): - for fname in [f.attname for f in translation_model._meta.fields]: - trans_table_name = translation_model._meta.db_table - table_alias = get_translation_table_alias(trans_table_name, language_id) - field_alias = get_translated_field_alias(fname, language_id) - - select[field_alias] = table_alias + '.' + fname - - return MultilingualModelQuerySet(self.model).filter(QAddTranslationData()).extra(select=select) - diff --git a/multilingual/compat/query_post_qsrf.py b/multilingual/compat/query_post_qsrf.py deleted file mode 100644 index 8ae25cc..0000000 --- a/multilingual/compat/query_post_qsrf.py +++ /dev/null @@ -1,514 +0,0 @@ -""" -Django-multilingual: a QuerySet subclass for models with translatable -fields. - -This file contains the implementation for QSRF Django. -""" - -import datetime - -from django.core.exceptions import FieldError -from django.db import connection -from django.db.models.fields import FieldDoesNotExist -from django.db.models.query import QuerySet, Q -from django.db.models.sql.query import Query -from django.db.models.sql.datastructures import Count, EmptyResultSet, Empty, MultiJoin -from django.db.models.sql.constants import * -from django.db.models.sql.where import WhereNode, EverythingNode, AND, OR - -from multilingual.languages import (get_translation_table_alias, get_language_id_list, - get_default_language, get_translated_field_alias, - get_language_id_from_id_or_code) - -__ALL__ = ['MultilingualModelQuerySet'] - -class MultilingualQuery(Query): - def __init__(self, model, connection, where=WhereNode): - self.extra_join = {} - extra_select = {} - super(MultilingualQuery, self).__init__(model, connection, where=where) - opts = self.model._meta - qn = self.quote_name_unless_alias - qn2 = self.connection.ops.quote_name - master_table_name = opts.db_table - translation_opts = opts.translation_model._meta - trans_table_name = translation_opts.db_table - if hasattr(opts, 'translation_model'): - master_table_name = opts.db_table - for language_id in get_language_id_list(): - for fname in [f.attname for f in translation_opts.fields]: - table_alias = get_translation_table_alias(trans_table_name, - language_id) - field_alias = get_translated_field_alias(fname, - language_id) - extra_select[field_alias] = qn2(table_alias) + '.' + qn2(fname) - self.add_extra(extra_select, None,None,None,None,None) - - def clone(self, klass=None, **kwargs): - obj = super(MultilingualQuery, self).clone(klass=klass, **kwargs) - obj.extra_join = self.extra_join - return obj - - def pre_sql_setup(self): - """Adds the JOINS and SELECTS for fetching multilingual data. - """ - super(MultilingualQuery, self).pre_sql_setup() - opts = self.model._meta - qn = self.quote_name_unless_alias - qn2 = self.connection.ops.quote_name - if hasattr(opts, 'translation_model'): - master_table_name = opts.db_table - translation_opts = opts.translation_model._meta - trans_table_name = translation_opts.db_table - for language_id in get_language_id_list(): - table_alias = get_translation_table_alias(trans_table_name, - language_id) - trans_join = ('LEFT JOIN %s AS %s ON ((%s.master_id = %s.%s) AND (%s.language_id = %s))' - % (qn2(translation_opts.db_table), - qn2(table_alias), - qn2(table_alias), - qn(master_table_name), - qn2(self.model._meta.pk.column), - qn2(table_alias), - language_id)) - self.extra_join[table_alias] = trans_join - - def get_from_clause(self): - """Add the JOINS for related multilingual fields filtering. - """ - result = super(MultilingualQuery, self).get_from_clause() - from_ = result[0] - for join in self.extra_join.values(): - from_.append(join) - return (from_, result[1]) - - def add_filter(self, filter_expr, connector=AND, negate=False, trim=False, - can_reuse=None): - """Copied from add_filter to generate WHERES for translation fields. - """ - arg, value = filter_expr - parts = arg.split(LOOKUP_SEP) - if not parts: - raise FieldError("Cannot parse keyword query %r" % arg) - - # Work out the lookup type and remove it from 'parts', if necessary. - if len(parts) == 1 or parts[-1] not in self.query_terms: - lookup_type = 'exact' - else: - lookup_type = parts.pop() - - # Interpret '__exact=None' as the sql 'is NULL'; otherwise, reject all - # uses of None as a query value. - if value is None: - if lookup_type != 'exact': - raise ValueError("Cannot use None as a query value") - lookup_type = 'isnull' - value = True - elif callable(value): - value = value() - - opts = self.get_meta() - alias = self.get_initial_alias() - allow_many = trim or not negate - - try: - field, target, opts, join_list, last = self.setup_joins(parts, opts, - alias, True, allow_many, can_reuse=can_reuse) - except MultiJoin, e: - self.split_exclude(filter_expr, LOOKUP_SEP.join(parts[:e.level])) - return - - - #NOTE: here comes Django Multilingual - if hasattr(opts, 'translation_model'): - field_name = parts[-1] - if field_name == 'pk': - field_name = opts.pk.name - translation_opts = opts.translation_model._meta - if field_name in translation_opts.translated_fields.keys(): - field, model, direct, m2m = opts.get_field_by_name(field_name) - if model == opts.translation_model: - language_id = translation_opts.translated_fields[field_name][1] - if language_id is None: - language_id = get_default_language() - master_table_name = opts.db_table - trans_table_alias = get_translation_table_alias( - model._meta.db_table, language_id) - new_table = (master_table_name + "__" + trans_table_alias) - self.where.add((new_table, field.column, field, lookup_type, value), connector) - return - - final = len(join_list) - penultimate = last.pop() - if penultimate == final: - penultimate = last.pop() - if trim and len(join_list) > 1: - extra = join_list[penultimate:] - join_list = join_list[:penultimate] - final = penultimate - penultimate = last.pop() - col = self.alias_map[extra[0]][LHS_JOIN_COL] - for alias in extra: - self.unref_alias(alias) - else: - col = target.column - alias = join_list[-1] - - while final > 1: - # An optimization: if the final join is against the same column as - # we are comparing against, we can go back one step in the join - # chain and compare against the lhs of the join instead (and then - # repeat the optimization). The result, potentially, involves less - # table joins. - join = self.alias_map[alias] - if col != join[RHS_JOIN_COL]: - break - self.unref_alias(alias) - alias = join[LHS_ALIAS] - col = join[LHS_JOIN_COL] - join_list = join_list[:-1] - final -= 1 - if final == penultimate: - penultimate = last.pop() - - if (lookup_type == 'isnull' and value is True and not negate and - final > 1): - # If the comparison is against NULL, we need to use a left outer - # join when connecting to the previous model. We make that - # adjustment here. We don't do this unless needed as it's less - # efficient at the database level. - self.promote_alias(join_list[penultimate]) - - if connector == OR: - # Some joins may need to be promoted when adding a new filter to a - # disjunction. We walk the list of new joins and where it diverges - # from any previous joins (ref count is 1 in the table list), we - # make the new additions (and any existing ones not used in the new - # join list) an outer join. - join_it = iter(join_list) - table_it = iter(self.tables) - join_it.next(), table_it.next() - for join in join_it: - table = table_it.next() - if join == table and self.alias_refcount[join] > 1: - continue - self.promote_alias(join) - if table != join: - self.promote_alias(table) - break - for join in join_it: - self.promote_alias(join) - for table in table_it: - # Some of these will have been promoted from the join_list, but - # that's harmless. - self.promote_alias(table) - - self.where.add((alias, col, field, lookup_type, value), connector) - - if negate: - for alias in join_list: - self.promote_alias(alias) - if lookup_type != 'isnull': - if final > 1: - for alias in join_list: - if self.alias_map[alias][JOIN_TYPE] == self.LOUTER: - j_col = self.alias_map[alias][RHS_JOIN_COL] - entry = self.where_class() - entry.add((alias, j_col, None, 'isnull', True), AND) - entry.negate() - self.where.add(entry, AND) - break - elif not (lookup_type == 'in' and not value) and field.null: - # Leaky abstraction artifact: We have to specifically - # exclude the "foo__in=[]" case from this handling, because - # it's short-circuited in the Where class. - entry = self.where_class() - entry.add((alias, col, None, 'isnull', True), AND) - entry.negate() - self.where.add(entry, AND) - - if can_reuse is not None: - can_reuse.update(join_list) - - def _setup_joins_with_translation(self, names, opts, alias, - dupe_multis, allow_many=True, - allow_explicit_fk=False, can_reuse=None): - """ - This is based on a full copy of Query.setup_joins because - currently I see no way to handle it differently. - - TO DO: there might actually be a way, by splitting a single - multi-name setup_joins call into separate calls. Check it. - - -- [email protected] - - Compute the necessary table joins for the passage through the fields - given in 'names'. 'opts' is the Options class for the current model - (which gives the table we are joining to), 'alias' is the alias for the - table we are joining to. If dupe_multis is True, any many-to-many or - many-to-one joins will always create a new alias (necessary for - disjunctive filters). - - Returns the final field involved in the join, the target database - column (used for any 'where' constraint), the final 'opts' value and the - list of tables joined. - """ - joins = [alias] - last = [0] - dupe_set = set() - exclusions = set() - for pos, name in enumerate(names): - try: - exclusions.add(int_alias) - except NameError: - pass - exclusions.add(alias) - last.append(len(joins)) - if name == 'pk': - name = opts.pk.name - - try: - field, model, direct, m2m = opts.get_field_by_name(name) - except FieldDoesNotExist: - for f in opts.fields: - if allow_explicit_fk and name == f.attname: - # XXX: A hack to allow foo_id to work in values() for - # backwards compatibility purposes. If we dropped that - # feature, this could be removed. - field, model, direct, m2m = opts.get_field_by_name(f.name) - break - else: - names = opts.get_all_field_names() - raise FieldError("Cannot resolve keyword %r into field. " - "Choices are: %s" % (name, ", ".join(names))) - - if not allow_many and (m2m or not direct): - for alias in joins: - self.unref_alias(alias) - raise MultiJoin(pos + 1) - - #NOTE: Start Django Multilingual specific code - if hasattr(opts, 'translation_model'): - translation_opts = opts.translation_model._meta - if model == opts.translation_model: - language_id = translation_opts.translated_fields[name][1] - if language_id is None: - language_id = get_default_language() - #TODO: check alias - master_table_name = opts.db_table - trans_table_alias = get_translation_table_alias( - model._meta.db_table, language_id) - new_table = (master_table_name + "__" + trans_table_alias) - qn = self.quote_name_unless_alias - qn2 = self.connection.ops.quote_name - trans_join = ('LEFT JOIN %s AS %s ON ((%s.master_id = %s.%s) AND (%s.language_id = %s))' - % (qn2(model._meta.db_table), - qn2(new_table), - qn2(new_table), - qn(master_table_name), - qn2(model._meta.pk.column), - qn2(new_table), - language_id)) - self.extra_join[new_table] = trans_join - target = field - continue - #NOTE: End Django Multilingual specific code - elif model: - # The field lives on a base class of the current model. - alias_list = [] - for int_model in opts.get_base_chain(model): - lhs_col = opts.parents[int_model].column - dedupe = lhs_col in opts.duplicate_targets - if dedupe: - exclusions.update(self.dupe_avoidance.get( - (id(opts), lhs_col), ())) - dupe_set.add((opts, lhs_col)) - opts = int_model._meta - alias = self.join((alias, opts.db_table, lhs_col, - opts.pk.column), exclusions=exclusions) - joins.append(alias) - exclusions.add(alias) - for (dupe_opts, dupe_col) in dupe_set: - self.update_dupe_avoidance(dupe_opts, dupe_col, alias) - cached_data = opts._join_cache.get(name) - orig_opts = opts - dupe_col = direct and field.column or field.field.column - dedupe = dupe_col in opts.duplicate_targets - if dupe_set or dedupe: - if dedupe: - dupe_set.add((opts, dupe_col)) - exclusions.update(self.dupe_avoidance.get((id(opts), dupe_col), - ())) - - if direct: - if m2m: - # Many-to-many field defined on the current model. - if cached_data: - (table1, from_col1, to_col1, table2, from_col2, - to_col2, opts, target) = cached_data - else: - table1 = field.m2m_db_table() - from_col1 = opts.pk.column - to_col1 = field.m2m_column_name() - opts = field.rel.to._meta - table2 = opts.db_table - from_col2 = field.m2m_reverse_name() - to_col2 = opts.pk.column - target = opts.pk - orig_opts._join_cache[name] = (table1, from_col1, - to_col1, table2, from_col2, to_col2, opts, - target) - - int_alias = self.join((alias, table1, from_col1, to_col1), - dupe_multis, exclusions, nullable=True, - reuse=can_reuse) - alias = self.join((int_alias, table2, from_col2, to_col2), - dupe_multis, exclusions, nullable=True, - reuse=can_reuse) - joins.extend([int_alias, alias]) - elif field.rel: - # One-to-one or many-to-one field - if cached_data: - (table, from_col, to_col, opts, target) = cached_data - else: - opts = field.rel.to._meta - target = field.rel.get_related_field() - table = opts.db_table - from_col = field.column - to_col = target.column - orig_opts._join_cache[name] = (table, from_col, to_col, - opts, target) - - alias = self.join((alias, table, from_col, to_col), - exclusions=exclusions, nullable=field.null) - joins.append(alias) - else: - # Non-relation fields. - target = field - break - else: - orig_field = field - field = field.field - if m2m: - # Many-to-many field defined on the target model. - if cached_data: - (table1, from_col1, to_col1, table2, from_col2, - to_col2, opts, target) = cached_data - else: - table1 = field.m2m_db_table() - from_col1 = opts.pk.column - to_col1 = field.m2m_reverse_name() - opts = orig_field.opts - table2 = opts.db_table - from_col2 = field.m2m_column_name() - to_col2 = opts.pk.column - target = opts.pk - orig_opts._join_cache[name] = (table1, from_col1, - to_col1, table2, from_col2, to_col2, opts, - target) - - int_alias = self.join((alias, table1, from_col1, to_col1), - dupe_multis, exclusions, nullable=True, - reuse=can_reuse) - alias = self.join((int_alias, table2, from_col2, to_col2), - dupe_multis, exclusions, nullable=True, - reuse=can_reuse) - joins.extend([int_alias, alias]) - else: - # One-to-many field (ForeignKey defined on the target model) - if cached_data: - (table, from_col, to_col, opts, target) = cached_data - else: - local_field = opts.get_field_by_name( - field.rel.field_name)[0] - opts = orig_field.opts - table = opts.db_table - from_col = local_field.column - to_col = field.column - target = opts.pk - orig_opts._join_cache[name] = (table, from_col, to_col, - opts, target) - - alias = self.join((alias, table, from_col, to_col), - dupe_multis, exclusions, nullable=True, - reuse=can_reuse) - joins.append(alias) - - for (dupe_opts, dupe_col) in dupe_set: - try: - self.update_dupe_avoidance(dupe_opts, dupe_col, int_alias) - except NameError: - self.update_dupe_avoidance(dupe_opts, dupe_col, alias) - - if pos != len(names) - 1: - raise FieldError("Join on field %r not permitted." % name) - - return field, target, opts, joins, last - - def setup_joins(self, names, opts, alias, dupe_multis, allow_many=True, - allow_explicit_fk=False, can_reuse=None): - return self._setup_joins_with_translation(names, opts, alias, dupe_multis, - allow_many, allow_explicit_fk, - can_reuse) - -class MultilingualModelQuerySet(QuerySet): - """ - A specialized QuerySet that knows how to handle translatable - fields in ordering and filtering methods. - """ - - def __init__(self, model=None, query=None): - query = query or MultilingualQuery(model, connection) - super(MultilingualModelQuerySet, self).__init__(model, query) - - def for_language(self, language_id_or_code): - """ - Set the default language for all objects returned with this - query. - """ - clone = self._clone() - clone._default_language = get_language_id_from_id_or_code(language_id_or_code) - return clone - - def iterator(self): - """ - Add the default language information to all returned objects. - """ - default_language = getattr(self, '_default_language', None) - - for obj in super(MultilingualModelQuerySet, self).iterator(): - obj._default_language = default_language - yield obj - - def _clone(self, klass=None, **kwargs): - """ - Override _clone to preserve additional information needed by - MultilingualModelQuerySet. - """ - clone = super(MultilingualModelQuerySet, self)._clone(klass, **kwargs) - clone._default_language = getattr(self, '_default_language', None) - return clone - - def order_by(self, *field_names): - if hasattr(self.model._meta, 'translation_model'): - trans_opts = self.model._meta.translation_model._meta - new_field_names = [] - for field_name in field_names: - prefix = '' - if field_name[0] == '-': - prefix = '-' - field_name = field_name[1:] - field_and_lang = trans_opts.translated_fields.get(field_name) - if field_and_lang: - field, language_id = field_and_lang - if language_id is None: - language_id = getattr(self, '_default_language', None) - real_name = get_translated_field_alias(field.attname, - language_id) - new_field_names.append(prefix + real_name) - else: - new_field_names.append(prefix + field_name) - return super(MultilingualModelQuerySet, self).extra(order_by=new_field_names) - else: - return super(MultilingualModelQuerySet, self).order_by(*field_names) - diff --git a/multilingual/compat/query_pre_qsrf.py b/multilingual/compat/query_pre_qsrf.py deleted file mode 100644 index 8865e66..0000000 --- a/multilingual/compat/query_pre_qsrf.py +++ /dev/null @@ -1,207 +0,0 @@ -""" -Django-multilingual: a QuerySet subclass for models with translatable -fields. - -Also, a wrapper for lookup_inner that makes it possible to lookup via -translatable fields. - -This file contains the implementation for pre-QSRF Django. -""" - -import django -from django.db import models, backend, connection -from django.db.models.query import QuerySet, get_where_clause -from django.utils.datastructures import SortedDict -from multilingual.languages import * - -old_lookup_inner = models.query.lookup_inner - -def new_lookup_inner(path, lookup_type, value, opts, table, column): - """ - Patch django.db.models.query.lookup_inner from the outside - to recognize the translation fields. - - Ideally this should go into lookup_inner. - """ - - # check if there is anything to do for us here. If not, send it - # all back to the original lookup_inner. - - if not hasattr(opts, 'translation_model'): - return old_lookup_inner(path, lookup_type, value, opts, table, column) - - translation_opts = opts.translation_model._meta - - # This hack adapts this mess - # to Django's "order_by for related tables" patch - if path[0] is not None and path[0].startswith("_trans_") and path[0][7:] in translation_opts.translated_fields: - path[0] = path[0][7:] - - if path[0] not in translation_opts.translated_fields: - return old_lookup_inner(path, lookup_type, value, opts, table, column) - - # If we got here then path[0] _is_ a translatable field (or a - # localised version of one) in a model with translations. - - joins, where, params = SortedDict(), [], [] - - name = path.pop(0) - current_table = table - field, language_id = translation_opts.translated_fields[name] - if language_id is None: - language_id = get_default_language() - translation_table = get_translation_table_alias(translation_opts.db_table, - language_id) - new_table = (current_table + "__" + translation_table) - - # add the join necessary for the current step - try: - qn = backend.quote_name - except AttributeError: - qn = connection.ops.quote_name - - from django.conf import settings - condition = ('((%s.master_id = %s.%s) AND (%s.language_id = %s))' - % (new_table, current_table, - opts.pk.column, - new_table, language_id)) - joins[qn(new_table)] = (qn(translation_opts.db_table), 'LEFT JOIN', condition) - - if path: - joins2, where2, params2 = \ - models.query.lookup_inner(path, lookup_type, - value, - translation_opts, - new_table, - translation_opts.pk.column) - joins.update(joins2) - where.extend(where2) - params.extend(params2) - else: - trans_table_name = opts.translation_model._meta.db_table - if (django.VERSION[0] >= 1) or (django.VERSION[1] >= 97): - # BACKWARDS_COMPATIBILITY_HACK - # The get_where_clause function got another parameter as of Django rev - # #5943, see here: http://code.djangoproject.com/changeset/5943 - - # This change happened when 0.97.pre was the current trunk - # and there is no sure way to detect whether your version - # requires the new parameter or not, so I will not try to - # guess. If you use 0.97.* make sure you have a pretty - # recent version or this line will fail. - where.append(get_where_clause(lookup_type, new_table + '.', - field.attname, value, - field.db_type())) - else: - # compatibility code for 0.96 - where.append(get_where_clause(lookup_type, new_table + '.', - field.attname, value)) - params.extend(field.get_db_prep_lookup(lookup_type, value)) - - return joins, where, params - -models.query.lookup_inner = new_lookup_inner - -class QAddTranslationData(object): - """ - Extend a queryset with joins and contitions necessary to pull all - the ML data. - """ - def get_sql(self, opts): - joins, where, params = SortedDict(), [], [] - - # create all the LEFT JOINS needed to read all the - # translations in one row - master_table_name = opts.db_table - trans_table_name = opts.translation_model._meta.db_table - for language_id in get_language_id_list(): - table_alias = get_translation_table_alias(trans_table_name, - language_id) - condition = ('((%s.master_id = %s.%s) AND (%s.language_id = %s))' - % (table_alias, master_table_name, - opts.pk.column, table_alias, - language_id)) - joins[table_alias] = (trans_table_name, 'LEFT JOIN', condition) - return joins, where, params - -class MultilingualModelQuerySet(QuerySet): - """ - A specialized QuerySet that knows how to handle translatable - fields in ordering and filtering methods. - """ - - def __init__(self, model=None, *args, **kwargs): - super(MultilingualModelQuerySet, self).__init__(model, *args, **kwargs) - - # Note: the 'if' below is here to work around the silly _clone - # behaviour: it creates a QuerySet without a model just to - # assign it later. - # - # It should work because it only happens when cloning another - # MultilingualModelQuerySet, in which case all the field - # aliases should be also moved by _clone. - if self.model: - translation_model = self.model._meta.translation_model - select = {} - for language_id in get_language_id_list(): - for fname in [f.attname for f in translation_model._meta.fields]: - trans_table_name = translation_model._meta.db_table - table_alias = get_translation_table_alias(trans_table_name, language_id) - field_alias = get_translated_field_alias(fname, language_id) - - select[field_alias] = table_alias + '.' + fname - self._select.update(select) - - self._filters = self._filters & QAddTranslationData() - - def order_by(self, *field_names): - """ - Override order_by to rename some of the arguments - """ - translated_fields = self.model._meta.translation_model._meta.translated_fields - - new_field_names = [] - for field_name in field_names: - prefix = '' - if field_name[0] == '-': - prefix = '-' - field_name = field_name[1:] - - if field_name in translated_fields: - field, language_id = translated_fields[field_name] - if language_id is None: - language_id = getattr(self, '_default_language', None) - real_name = get_translated_field_alias(field.attname, - language_id) - new_field_names.append(prefix + real_name) - else: - new_field_names.append(prefix + field_name) - return super(MultilingualModelQuerySet, self).order_by(*new_field_names) - - def for_language(self, language_id_or_code): - """ - Set the default language for all objects returned with this - query. - """ - clone = self._clone() - clone._default_language = get_language_id_from_id_or_code(language_id_or_code) - return clone - - def iterator(self): - """ - Add the default language information to all returned objects. - """ - default_language = getattr(self, '_default_language', None) - - for obj in super(MultilingualModelQuerySet, self).iterator(): - obj._default_language = default_language - yield obj - - def _clone(self, klass=None, **kwargs): - """ - Override _clone to preserve additional information needed by - MultilingualModelQuerySet. - """ - clone = super(MultilingualModelQuerySet, self)._clone(klass, **kwargs) - clone._default_language = getattr(self, '_default_language', None) - return clone diff --git a/multilingual/languages.py b/multilingual/languages.py index 55d1c97..40bc866 100644 --- a/multilingual/languages.py +++ b/multilingual/languages.py @@ -1,121 +1,116 @@ """ Django-multilingual: language-related settings and functions. """ # Note: this file did become a mess and will have to be refactored # after the configuration changes get in place. #retrieve language settings from settings.py from django.conf import settings LANGUAGES = settings.LANGUAGES -try: - from django.utils.translation import ugettext_lazy as _ -except ImportError: - # Implicitely imported before changeset 6582 - pass - +from django.utils.translation import ugettext_lazy as _ from multilingual.exceptions import LanguageDoesNotExist try: from threading import local except ImportError: from django.utils._threading_local import local thread_locals = local() def get_language_count(): return len(LANGUAGES) def get_language_code(language_id): return LANGUAGES[(int(language_id or get_default_language())) - 1][0] def get_language_name(language_id): return _(LANGUAGES[(int(language_id or get_default_language())) - 1][1]) def get_language_bidi(language_id): return get_language_code(language_id) in settings.LANGUAGES_BIDI def get_language_id_list(): return range(1, get_language_count() + 1) def get_language_code_list(): return [lang[0] for lang in LANGUAGES] def get_language_choices(): return [(language_id, get_language_code(language_id)) for language_id in get_language_id_list()] def get_language_id_from_id_or_code(language_id_or_code, use_default=True): if language_id_or_code is None: if use_default: return get_default_language() else: return None if isinstance(language_id_or_code, int): return language_id_or_code i = 0 for (code, desc) in LANGUAGES: i += 1 if code == language_id_or_code: return i raise LanguageDoesNotExist(language_id_or_code) def get_language_idx(language_id_or_code): # to do: optimize language_id = get_language_id_from_id_or_code(language_id_or_code) return get_language_id_list().index(language_id) def set_default_language(language_id_or_code): """ Set the default language for the whole translation mechanism. Accepts language codes or IDs. """ language_id = get_language_id_from_id_or_code(language_id_or_code) thread_locals.DEFAULT_LANGUAGE = language_id def get_default_language(): """ Return the language ID set by set_default_language. """ return getattr(thread_locals, 'DEFAULT_LANGUAGE', settings.DEFAULT_LANGUAGE) def get_default_language_code(): """ Return the language code of language ID set by set_default_language. """ language_id = get_language_id_from_id_or_code(get_default_language()) return get_language_code(language_id) def _to_db_identifier(name): """ Convert name to something that is usable as a field name or table alias in SQL. For the time being assume that the only possible problem with name is the presence of dashes. """ return name.replace('-', '_') def get_translation_table_alias(translation_table_name, language_id): """ Return an alias for the translation table for a given language_id. Used in SQL queries. """ return (translation_table_name + '_' + _to_db_identifier(get_language_code(language_id))) def get_translated_field_alias(field_name, language_id=None): """ Return an alias for field_name field for a given language_id. Used in SQL queries. """ return ('_trans_' + field_name + '_' + _to_db_identifier(get_language_code(language_id))) diff --git a/multilingual/query.py b/multilingual/query.py index 7195760..8ae25cc 100644 --- a/multilingual/query.py +++ b/multilingual/query.py @@ -1,14 +1,514 @@ """ Django-multilingual: a QuerySet subclass for models with translatable fields. -Also, a wrapper for lookup_inner that makes it possible to lookup via -translatable fields. +This file contains the implementation for QSRF Django. """ -from compat import IS_QSRF +import datetime + +from django.core.exceptions import FieldError +from django.db import connection +from django.db.models.fields import FieldDoesNotExist +from django.db.models.query import QuerySet, Q +from django.db.models.sql.query import Query +from django.db.models.sql.datastructures import Count, EmptyResultSet, Empty, MultiJoin +from django.db.models.sql.constants import * +from django.db.models.sql.where import WhereNode, EverythingNode, AND, OR + +from multilingual.languages import (get_translation_table_alias, get_language_id_list, + get_default_language, get_translated_field_alias, + get_language_id_from_id_or_code) + +__ALL__ = ['MultilingualModelQuerySet'] + +class MultilingualQuery(Query): + def __init__(self, model, connection, where=WhereNode): + self.extra_join = {} + extra_select = {} + super(MultilingualQuery, self).__init__(model, connection, where=where) + opts = self.model._meta + qn = self.quote_name_unless_alias + qn2 = self.connection.ops.quote_name + master_table_name = opts.db_table + translation_opts = opts.translation_model._meta + trans_table_name = translation_opts.db_table + if hasattr(opts, 'translation_model'): + master_table_name = opts.db_table + for language_id in get_language_id_list(): + for fname in [f.attname for f in translation_opts.fields]: + table_alias = get_translation_table_alias(trans_table_name, + language_id) + field_alias = get_translated_field_alias(fname, + language_id) + extra_select[field_alias] = qn2(table_alias) + '.' + qn2(fname) + self.add_extra(extra_select, None,None,None,None,None) + + def clone(self, klass=None, **kwargs): + obj = super(MultilingualQuery, self).clone(klass=klass, **kwargs) + obj.extra_join = self.extra_join + return obj + + def pre_sql_setup(self): + """Adds the JOINS and SELECTS for fetching multilingual data. + """ + super(MultilingualQuery, self).pre_sql_setup() + opts = self.model._meta + qn = self.quote_name_unless_alias + qn2 = self.connection.ops.quote_name + if hasattr(opts, 'translation_model'): + master_table_name = opts.db_table + translation_opts = opts.translation_model._meta + trans_table_name = translation_opts.db_table + for language_id in get_language_id_list(): + table_alias = get_translation_table_alias(trans_table_name, + language_id) + trans_join = ('LEFT JOIN %s AS %s ON ((%s.master_id = %s.%s) AND (%s.language_id = %s))' + % (qn2(translation_opts.db_table), + qn2(table_alias), + qn2(table_alias), + qn(master_table_name), + qn2(self.model._meta.pk.column), + qn2(table_alias), + language_id)) + self.extra_join[table_alias] = trans_join + + def get_from_clause(self): + """Add the JOINS for related multilingual fields filtering. + """ + result = super(MultilingualQuery, self).get_from_clause() + from_ = result[0] + for join in self.extra_join.values(): + from_.append(join) + return (from_, result[1]) + + def add_filter(self, filter_expr, connector=AND, negate=False, trim=False, + can_reuse=None): + """Copied from add_filter to generate WHERES for translation fields. + """ + arg, value = filter_expr + parts = arg.split(LOOKUP_SEP) + if not parts: + raise FieldError("Cannot parse keyword query %r" % arg) + + # Work out the lookup type and remove it from 'parts', if necessary. + if len(parts) == 1 or parts[-1] not in self.query_terms: + lookup_type = 'exact' + else: + lookup_type = parts.pop() + + # Interpret '__exact=None' as the sql 'is NULL'; otherwise, reject all + # uses of None as a query value. + if value is None: + if lookup_type != 'exact': + raise ValueError("Cannot use None as a query value") + lookup_type = 'isnull' + value = True + elif callable(value): + value = value() + + opts = self.get_meta() + alias = self.get_initial_alias() + allow_many = trim or not negate + + try: + field, target, opts, join_list, last = self.setup_joins(parts, opts, + alias, True, allow_many, can_reuse=can_reuse) + except MultiJoin, e: + self.split_exclude(filter_expr, LOOKUP_SEP.join(parts[:e.level])) + return + + + #NOTE: here comes Django Multilingual + if hasattr(opts, 'translation_model'): + field_name = parts[-1] + if field_name == 'pk': + field_name = opts.pk.name + translation_opts = opts.translation_model._meta + if field_name in translation_opts.translated_fields.keys(): + field, model, direct, m2m = opts.get_field_by_name(field_name) + if model == opts.translation_model: + language_id = translation_opts.translated_fields[field_name][1] + if language_id is None: + language_id = get_default_language() + master_table_name = opts.db_table + trans_table_alias = get_translation_table_alias( + model._meta.db_table, language_id) + new_table = (master_table_name + "__" + trans_table_alias) + self.where.add((new_table, field.column, field, lookup_type, value), connector) + return + + final = len(join_list) + penultimate = last.pop() + if penultimate == final: + penultimate = last.pop() + if trim and len(join_list) > 1: + extra = join_list[penultimate:] + join_list = join_list[:penultimate] + final = penultimate + penultimate = last.pop() + col = self.alias_map[extra[0]][LHS_JOIN_COL] + for alias in extra: + self.unref_alias(alias) + else: + col = target.column + alias = join_list[-1] + + while final > 1: + # An optimization: if the final join is against the same column as + # we are comparing against, we can go back one step in the join + # chain and compare against the lhs of the join instead (and then + # repeat the optimization). The result, potentially, involves less + # table joins. + join = self.alias_map[alias] + if col != join[RHS_JOIN_COL]: + break + self.unref_alias(alias) + alias = join[LHS_ALIAS] + col = join[LHS_JOIN_COL] + join_list = join_list[:-1] + final -= 1 + if final == penultimate: + penultimate = last.pop() + + if (lookup_type == 'isnull' and value is True and not negate and + final > 1): + # If the comparison is against NULL, we need to use a left outer + # join when connecting to the previous model. We make that + # adjustment here. We don't do this unless needed as it's less + # efficient at the database level. + self.promote_alias(join_list[penultimate]) + + if connector == OR: + # Some joins may need to be promoted when adding a new filter to a + # disjunction. We walk the list of new joins and where it diverges + # from any previous joins (ref count is 1 in the table list), we + # make the new additions (and any existing ones not used in the new + # join list) an outer join. + join_it = iter(join_list) + table_it = iter(self.tables) + join_it.next(), table_it.next() + for join in join_it: + table = table_it.next() + if join == table and self.alias_refcount[join] > 1: + continue + self.promote_alias(join) + if table != join: + self.promote_alias(table) + break + for join in join_it: + self.promote_alias(join) + for table in table_it: + # Some of these will have been promoted from the join_list, but + # that's harmless. + self.promote_alias(table) + + self.where.add((alias, col, field, lookup_type, value), connector) + + if negate: + for alias in join_list: + self.promote_alias(alias) + if lookup_type != 'isnull': + if final > 1: + for alias in join_list: + if self.alias_map[alias][JOIN_TYPE] == self.LOUTER: + j_col = self.alias_map[alias][RHS_JOIN_COL] + entry = self.where_class() + entry.add((alias, j_col, None, 'isnull', True), AND) + entry.negate() + self.where.add(entry, AND) + break + elif not (lookup_type == 'in' and not value) and field.null: + # Leaky abstraction artifact: We have to specifically + # exclude the "foo__in=[]" case from this handling, because + # it's short-circuited in the Where class. + entry = self.where_class() + entry.add((alias, col, None, 'isnull', True), AND) + entry.negate() + self.where.add(entry, AND) + + if can_reuse is not None: + can_reuse.update(join_list) + + def _setup_joins_with_translation(self, names, opts, alias, + dupe_multis, allow_many=True, + allow_explicit_fk=False, can_reuse=None): + """ + This is based on a full copy of Query.setup_joins because + currently I see no way to handle it differently. + + TO DO: there might actually be a way, by splitting a single + multi-name setup_joins call into separate calls. Check it. + + -- [email protected] + + Compute the necessary table joins for the passage through the fields + given in 'names'. 'opts' is the Options class for the current model + (which gives the table we are joining to), 'alias' is the alias for the + table we are joining to. If dupe_multis is True, any many-to-many or + many-to-one joins will always create a new alias (necessary for + disjunctive filters). + + Returns the final field involved in the join, the target database + column (used for any 'where' constraint), the final 'opts' value and the + list of tables joined. + """ + joins = [alias] + last = [0] + dupe_set = set() + exclusions = set() + for pos, name in enumerate(names): + try: + exclusions.add(int_alias) + except NameError: + pass + exclusions.add(alias) + last.append(len(joins)) + if name == 'pk': + name = opts.pk.name + + try: + field, model, direct, m2m = opts.get_field_by_name(name) + except FieldDoesNotExist: + for f in opts.fields: + if allow_explicit_fk and name == f.attname: + # XXX: A hack to allow foo_id to work in values() for + # backwards compatibility purposes. If we dropped that + # feature, this could be removed. + field, model, direct, m2m = opts.get_field_by_name(f.name) + break + else: + names = opts.get_all_field_names() + raise FieldError("Cannot resolve keyword %r into field. " + "Choices are: %s" % (name, ", ".join(names))) + + if not allow_many and (m2m or not direct): + for alias in joins: + self.unref_alias(alias) + raise MultiJoin(pos + 1) + + #NOTE: Start Django Multilingual specific code + if hasattr(opts, 'translation_model'): + translation_opts = opts.translation_model._meta + if model == opts.translation_model: + language_id = translation_opts.translated_fields[name][1] + if language_id is None: + language_id = get_default_language() + #TODO: check alias + master_table_name = opts.db_table + trans_table_alias = get_translation_table_alias( + model._meta.db_table, language_id) + new_table = (master_table_name + "__" + trans_table_alias) + qn = self.quote_name_unless_alias + qn2 = self.connection.ops.quote_name + trans_join = ('LEFT JOIN %s AS %s ON ((%s.master_id = %s.%s) AND (%s.language_id = %s))' + % (qn2(model._meta.db_table), + qn2(new_table), + qn2(new_table), + qn(master_table_name), + qn2(model._meta.pk.column), + qn2(new_table), + language_id)) + self.extra_join[new_table] = trans_join + target = field + continue + #NOTE: End Django Multilingual specific code + elif model: + # The field lives on a base class of the current model. + alias_list = [] + for int_model in opts.get_base_chain(model): + lhs_col = opts.parents[int_model].column + dedupe = lhs_col in opts.duplicate_targets + if dedupe: + exclusions.update(self.dupe_avoidance.get( + (id(opts), lhs_col), ())) + dupe_set.add((opts, lhs_col)) + opts = int_model._meta + alias = self.join((alias, opts.db_table, lhs_col, + opts.pk.column), exclusions=exclusions) + joins.append(alias) + exclusions.add(alias) + for (dupe_opts, dupe_col) in dupe_set: + self.update_dupe_avoidance(dupe_opts, dupe_col, alias) + cached_data = opts._join_cache.get(name) + orig_opts = opts + dupe_col = direct and field.column or field.field.column + dedupe = dupe_col in opts.duplicate_targets + if dupe_set or dedupe: + if dedupe: + dupe_set.add((opts, dupe_col)) + exclusions.update(self.dupe_avoidance.get((id(opts), dupe_col), + ())) + + if direct: + if m2m: + # Many-to-many field defined on the current model. + if cached_data: + (table1, from_col1, to_col1, table2, from_col2, + to_col2, opts, target) = cached_data + else: + table1 = field.m2m_db_table() + from_col1 = opts.pk.column + to_col1 = field.m2m_column_name() + opts = field.rel.to._meta + table2 = opts.db_table + from_col2 = field.m2m_reverse_name() + to_col2 = opts.pk.column + target = opts.pk + orig_opts._join_cache[name] = (table1, from_col1, + to_col1, table2, from_col2, to_col2, opts, + target) + + int_alias = self.join((alias, table1, from_col1, to_col1), + dupe_multis, exclusions, nullable=True, + reuse=can_reuse) + alias = self.join((int_alias, table2, from_col2, to_col2), + dupe_multis, exclusions, nullable=True, + reuse=can_reuse) + joins.extend([int_alias, alias]) + elif field.rel: + # One-to-one or many-to-one field + if cached_data: + (table, from_col, to_col, opts, target) = cached_data + else: + opts = field.rel.to._meta + target = field.rel.get_related_field() + table = opts.db_table + from_col = field.column + to_col = target.column + orig_opts._join_cache[name] = (table, from_col, to_col, + opts, target) + + alias = self.join((alias, table, from_col, to_col), + exclusions=exclusions, nullable=field.null) + joins.append(alias) + else: + # Non-relation fields. + target = field + break + else: + orig_field = field + field = field.field + if m2m: + # Many-to-many field defined on the target model. + if cached_data: + (table1, from_col1, to_col1, table2, from_col2, + to_col2, opts, target) = cached_data + else: + table1 = field.m2m_db_table() + from_col1 = opts.pk.column + to_col1 = field.m2m_reverse_name() + opts = orig_field.opts + table2 = opts.db_table + from_col2 = field.m2m_column_name() + to_col2 = opts.pk.column + target = opts.pk + orig_opts._join_cache[name] = (table1, from_col1, + to_col1, table2, from_col2, to_col2, opts, + target) + + int_alias = self.join((alias, table1, from_col1, to_col1), + dupe_multis, exclusions, nullable=True, + reuse=can_reuse) + alias = self.join((int_alias, table2, from_col2, to_col2), + dupe_multis, exclusions, nullable=True, + reuse=can_reuse) + joins.extend([int_alias, alias]) + else: + # One-to-many field (ForeignKey defined on the target model) + if cached_data: + (table, from_col, to_col, opts, target) = cached_data + else: + local_field = opts.get_field_by_name( + field.rel.field_name)[0] + opts = orig_field.opts + table = opts.db_table + from_col = local_field.column + to_col = field.column + target = opts.pk + orig_opts._join_cache[name] = (table, from_col, to_col, + opts, target) + + alias = self.join((alias, table, from_col, to_col), + dupe_multis, exclusions, nullable=True, + reuse=can_reuse) + joins.append(alias) + + for (dupe_opts, dupe_col) in dupe_set: + try: + self.update_dupe_avoidance(dupe_opts, dupe_col, int_alias) + except NameError: + self.update_dupe_avoidance(dupe_opts, dupe_col, alias) + + if pos != len(names) - 1: + raise FieldError("Join on field %r not permitted." % name) + + return field, target, opts, joins, last + + def setup_joins(self, names, opts, alias, dupe_multis, allow_many=True, + allow_explicit_fk=False, can_reuse=None): + return self._setup_joins_with_translation(names, opts, alias, dupe_multis, + allow_many, allow_explicit_fk, + can_reuse) + +class MultilingualModelQuerySet(QuerySet): + """ + A specialized QuerySet that knows how to handle translatable + fields in ordering and filtering methods. + """ + + def __init__(self, model=None, query=None): + query = query or MultilingualQuery(model, connection) + super(MultilingualModelQuerySet, self).__init__(model, query) + + def for_language(self, language_id_or_code): + """ + Set the default language for all objects returned with this + query. + """ + clone = self._clone() + clone._default_language = get_language_id_from_id_or_code(language_id_or_code) + return clone + + def iterator(self): + """ + Add the default language information to all returned objects. + """ + default_language = getattr(self, '_default_language', None) + + for obj in super(MultilingualModelQuerySet, self).iterator(): + obj._default_language = default_language + yield obj + + def _clone(self, klass=None, **kwargs): + """ + Override _clone to preserve additional information needed by + MultilingualModelQuerySet. + """ + clone = super(MultilingualModelQuerySet, self)._clone(klass, **kwargs) + clone._default_language = getattr(self, '_default_language', None) + return clone + + def order_by(self, *field_names): + if hasattr(self.model._meta, 'translation_model'): + trans_opts = self.model._meta.translation_model._meta + new_field_names = [] + for field_name in field_names: + prefix = '' + if field_name[0] == '-': + prefix = '-' + field_name = field_name[1:] + field_and_lang = trans_opts.translated_fields.get(field_name) + if field_and_lang: + field, language_id = field_and_lang + if language_id is None: + language_id = getattr(self, '_default_language', None) + real_name = get_translated_field_alias(field.attname, + language_id) + new_field_names.append(prefix + real_name) + else: + new_field_names.append(prefix + field_name) + return super(MultilingualModelQuerySet, self).extra(order_by=new_field_names) + else: + return super(MultilingualModelQuerySet, self).order_by(*field_names) -if IS_QSRF: - from compat.query_post_qsrf import MultilingualModelQuerySet -else: - from compat.query_pre_qsrf import MultilingualModelQuerySet diff --git a/multilingual/translation.py b/multilingual/translation.py index 7e2efa2..9927c03 100644 --- a/multilingual/translation.py +++ b/multilingual/translation.py @@ -1,413 +1,392 @@ """ Support for models' internal Translation class. """ ## TO DO: this is messy and needs to be cleaned up +from django.contrib.admin import StackedInline, ModelAdmin +from django.core.exceptions import ObjectDoesNotExist from django.db import models +from django.db.models import signals from django.db.models.base import ModelBase from django.dispatch.dispatcher import connect -from django.core.exceptions import ObjectDoesNotExist -from django.db.models import signals from multilingual.languages import * from multilingual.exceptions import TranslationDoesNotExist from multilingual.fields import TranslationForeignKey from multilingual.manipulators import add_multilingual_manipulators from multilingual import manager -from multilingual.compat import IS_NEWFORMS_ADMIN, IS_QSRF from new import instancemethod -if IS_NEWFORMS_ADMIN: - from django.contrib.admin import StackedInline, ModelAdmin - class MultilingualStackedInline(StackedInline): - template = "admin/edit_inline_translations_newforms.html" -else: - from django.contrib.admin.templatetags.admin_modify import StackedBoundRelatedObject - class TransBoundRelatedObject(StackedBoundRelatedObject): - """ - This class changes the template for translation objects. - """ - - def template_name(self): - return "admin/edit_inline_translations.html" +class MultilingualStackedInline(StackedInline): + template = "admin/edit_inline_translations_newforms.html" def translation_save_translated_fields(instance, **kwargs): """ Save all the translations of instance in post_save signal handler. """ if not hasattr(instance, '_translation_cache'): return for l_id, translation in instance._translation_cache.iteritems(): # set the translation ID just in case the translation was # created while instance was not stored in the DB yet # note: we're using _get_pk_val here even though it is # private, since that's the most reliable way to get the value # on older Django (pk property did not exist yet) translation.master_id = instance._get_pk_val() translation.save() def translation_overwrite_previous(instance, **kwargs): """ Delete previously existing translation with the same master and language_id values. To be called by translation model's pre_save signal. This most probably means I am abusing something here trying to use Django inline editor. Oh well, it will have to go anyway when we move to newforms. """ qs = instance.__class__.objects try: qs = qs.filter(master=instance.master).filter(language_id=instance.language_id) qs.delete() except ObjectDoesNotExist: # We are probably loading a fixture that defines translation entities # before their master entity. pass def fill_translation_cache(instance): """ Fill the translation cache using information received in the instance objects as extra fields. You can not do this in post_init because the extra fields are assigned by QuerySet.iterator after model initialization. """ if hasattr(instance, '_translation_cache'): # do not refill the cache return instance._translation_cache = {} for language_id in get_language_id_list(): # see if translation for language_id was in the query field_alias = get_translated_field_alias('id', language_id) if getattr(instance, field_alias, None) is not None: field_names = [f.attname for f in instance._meta.translation_model._meta.fields] # if so, create a translation object and put it in the cache field_data = {} for fname in field_names: field_data[fname] = getattr(instance, get_translated_field_alias(fname, language_id)) translation = instance._meta.translation_model(**field_data) instance._translation_cache[language_id] = translation # In some situations an (existing in the DB) object is loaded # without using the normal QuerySet. In such case fallback to # loading the translations using a separate query. # Unfortunately, this is indistinguishable from the situation when # an object does not have any translations. Oh well, we'll have # to live with this for the time being. if len(instance._translation_cache.keys()) == 0: for translation in instance.translations.all(): instance._translation_cache[translation.language_id] = translation class TranslatedFieldProxy(property): def __init__(self, field_name, alias, field, language_id=None): self.field_name = field_name self.field = field self.admin_order_field = alias self.language_id = language_id def __get__(self, obj, objtype=None): if obj is None: return self return getattr(obj, 'get_' + self.field_name)(self.language_id) def __set__(self, obj, value): language_id = self.language_id return getattr(obj, 'set_' + self.field_name)(value, self.language_id) short_description = property(lambda self: self.field.short_description) def getter_generator(field_name, short_description): """ Generate get_'field name' method for field field_name. """ def get_translation_field(self, language_id_or_code=None): try: return getattr(self.get_translation(language_id_or_code), field_name) except TranslationDoesNotExist: return None get_translation_field.short_description = short_description return get_translation_field def setter_generator(field_name): """ Generate set_'field name' method for field field_name. """ def set_translation_field(self, value, language_id_or_code=None): setattr(self.get_translation(language_id_or_code, True), field_name, value) set_translation_field.short_description = "set " + field_name return set_translation_field def get_translation(self, language_id_or_code, create_if_necessary=False): """ Get a translation instance for the given language_id_or_code. If it does not exist, either create one or raise the TranslationDoesNotExist exception, depending on the create_if_necessary argument. """ # fill the cache if necessary self.fill_translation_cache() language_id = get_language_id_from_id_or_code(language_id_or_code, False) if language_id is None: language_id = getattr(self, '_default_language', None) if language_id is None: language_id = get_default_language() if language_id not in self._translation_cache: if not create_if_necessary: raise TranslationDoesNotExist(language_id) new_translation = self._meta.translation_model(master=self, language_id=language_id) self._translation_cache[language_id] = new_translation return self._translation_cache.get(language_id, None) class Translation: """ A superclass for translatablemodel.Translation inner classes. """ def contribute_to_class(cls, main_cls, name): """ Handle the inner 'Translation' class. """ # delay the creation of the *Translation until the master model is # fully created connect(cls.finish_multilingual_class, signal=signals.class_prepared, sender=main_cls, weak=False) # connect the post_save signal on master class to a handler # that saves translations connect(translation_save_translated_fields, signal=signals.post_save, sender=main_cls) contribute_to_class = classmethod(contribute_to_class) def create_translation_attrs(cls, main_cls): """ Creates get_'field name'(language_id) and set_'field name'(language_id) methods for all the translation fields. Adds the 'field name' properties too. Returns the translated_fields hash used in field lookups, see multilingual.query. It maps field names to (field, language_id) tuples. """ translated_fields = {} for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): translated_fields[fname] = (field, None) # add get_'fname' and set_'fname' methods to main_cls getter = getter_generator(fname, getattr(field, 'verbose_name', fname)) setattr(main_cls, 'get_' + fname, getter) setter = setter_generator(fname) setattr(main_cls, 'set_' + fname, setter) # add the 'fname' proxy property that allows reads # from and writing to the appropriate translation setattr(main_cls, fname, TranslatedFieldProxy(fname, fname, field)) # create the 'fname'_'language_code' proxy properties for language_id in get_language_id_list(): language_code = get_language_code(language_id) fname_lng = fname + '_' + language_code.replace('-', '_') translated_fields[fname_lng] = (field, language_id) setattr(main_cls, fname_lng, TranslatedFieldProxy(fname, fname_lng, field, language_id)) return translated_fields create_translation_attrs = classmethod(create_translation_attrs) def get_unique_fields(cls): """ Return a list of fields with "unique" attribute, which needs to be augmented by the language. """ unique_fields = [] for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): if getattr(field,'unique',False): try: field.unique = False except AttributeError: # newer Django defines unique as a property # that uses _unique to store data. We're # jumping over the fence by setting _unique, # so this sucks, but this happens early enough # to be safe. field._unique = False unique_fields.append(fname) return unique_fields get_unique_fields = classmethod(get_unique_fields) def finish_multilingual_class(cls, *args, **kwargs): """ Create a model with translations of a multilingual class. """ main_cls = kwargs['sender'] translation_model_name = main_cls.__name__ + "Translation" # create the model with all the translatable fields unique = [('language_id', 'master')] for f in cls.get_unique_fields(): unique.append(('language_id',f)) class TransMeta: pass try: meta = cls.Meta except AttributeError: meta = TransMeta meta.ordering = ('language_id',) meta.unique_together = tuple(unique) meta.app_label = main_cls._meta.app_label if not hasattr(meta, 'db_table'): meta.db_table = main_cls._meta.db_table + '_translation' trans_attrs = cls.__dict__.copy() trans_attrs['Meta'] = meta trans_attrs['language_id'] = models.IntegerField(blank=False, null=False, core=True, choices=get_language_choices(), db_index=True) - if IS_NEWFORMS_ADMIN: - edit_inline = True - else: - edit_inline = TransBoundRelatedObject + edit_inline = True trans_attrs['master'] = TranslationForeignKey(main_cls, blank=False, null=False, edit_inline=edit_inline, related_name='translations', num_in_admin=get_language_count(), min_num_in_admin=get_language_count(), num_extra_on_change=0) trans_attrs['__str__'] = lambda self: ("%s object, language_code=%s" % (translation_model_name, get_language_code(self.language_id))) trans_model = ModelBase(translation_model_name, (models.Model,), trans_attrs) trans_model._meta.translated_fields = cls.create_translation_attrs(main_cls) - if IS_QSRF: - _old_init_name_map = main_cls._meta.__class__.init_name_map - def init_name_map(self): - cache = _old_init_name_map(self) - for name, field_and_lang_id in trans_model._meta.translated_fields.items(): - #import sys; sys.stderr.write('TM %r\n' % trans_model) - cache[name] = (field_and_lang_id[0], trans_model, True, False) - return cache - main_cls._meta.init_name_map = instancemethod(init_name_map, - main_cls._meta, - main_cls._meta.__class__) + _old_init_name_map = main_cls._meta.__class__.init_name_map + def init_name_map(self): + cache = _old_init_name_map(self) + for name, field_and_lang_id in trans_model._meta.translated_fields.items(): + #import sys; sys.stderr.write('TM %r\n' % trans_model) + cache[name] = (field_and_lang_id[0], trans_model, True, False) + return cache + main_cls._meta.init_name_map = instancemethod(init_name_map, + main_cls._meta, + main_cls._meta.__class__) main_cls._meta.translation_model = trans_model main_cls.get_translation = get_translation main_cls.fill_translation_cache = fill_translation_cache # Note: don't fill the translation cache in post_init, as all # the extra values selected by QAddTranslationData will be # assigned AFTER init() # connect(fill_translation_cache, signal=signals.post_init, # sender=main_cls) # connect the pre_save signal on translation class to a # function removing previous translation entries. connect(translation_overwrite_previous, signal=signals.pre_save, sender=trans_model, weak=False) finish_multilingual_class = classmethod(finish_multilingual_class) def install_translation_library(): # modify ModelBase.__new__ so that it understands how to handle the # 'Translation' inner class if getattr(ModelBase, '_multilingual_installed', False): # don't install it twice return _old_new = ModelBase.__new__ def multilingual_modelbase_new(cls, name, bases, attrs): if 'Translation' in attrs: if not issubclass(attrs['Translation'], Translation): raise ValueError, ("%s.Translation must be a subclass " + " of multilingual.Translation.") % (name,) # Make sure that if the class specifies objects then it is # a subclass of our Manager. # # Don't check other managers since someone might want to # have a non-multilingual manager, but assigning a # non-multilingual manager to objects would be a common # mistake. if ('objects' in attrs) and (not isinstance(attrs['objects'], manager.Manager)): raise ValueError, ("Model %s specifies translations, " + "so its 'objects' manager must be " + "a subclass of multilingual.Manager.") % (name,) # Change the default manager to multilingual.Manager. if not 'objects' in attrs: attrs['objects'] = manager.Manager() - # Override the admin manager as well, or the admin views will - # not see the translation data. - if 'Admin' in attrs: - attrs['Admin'].manager = attrs['objects'] - # Install a hack to let add_multilingual_manipulators know # this is a translatable model attrs['is_translation_model'] = lambda self: True return _old_new(cls, name, bases, attrs) ModelBase.__new__ = staticmethod(multilingual_modelbase_new) ModelBase._multilingual_installed = True - if IS_NEWFORMS_ADMIN: - # Override ModelAdmin.__new__ to create automatic inline - # editor for multilingual models. - class MultiType(type): - pass - _old_admin_new = ModelAdmin.__new__ - def multilingual_modeladmin_new(cls, model, admin_site): - if isinstance(model.objects, manager.Manager): - X = MultiType('X',(MultilingualStackedInline,), - {'model':model._meta.translation_model, - 'fk_name':'master', - 'extra':get_language_count(), - 'max_num':get_language_count()}) - if cls.inlines: - for inline in cls.inlines: - if X.__class__ == inline.__class__: - cls.inlines.remove(inline) - break - cls.inlines.append(X) - else: - cls.inlines = [X] - return _old_admin_new(cls, model, admin_site) - ModelAdmin.__new__ = staticmethod(multilingual_modeladmin_new) + # Override ModelAdmin.__new__ to create automatic inline + # editor for multilingual models. + class MultiType(type): + pass + _old_admin_new = ModelAdmin.__new__ + def multilingual_modeladmin_new(cls, model, admin_site): + if isinstance(model.objects, manager.Manager): + X = MultiType('X',(MultilingualStackedInline,), + {'model':model._meta.translation_model, + 'fk_name':'master', + 'extra':get_language_count(), + 'max_num':get_language_count()}) + if cls.inlines: + for inline in cls.inlines: + if X.__class__ == inline.__class__: + cls.inlines.remove(inline) + break + cls.inlines.append(X) + else: + cls.inlines = [X] + return _old_admin_new(cls, model, admin_site) + ModelAdmin.__new__ = staticmethod(multilingual_modeladmin_new) # install the library install_translation_library()
stefanfoulis/django-multilingual
a0fd010120505ea9b8171c1983c55a16cbe5b43a
Removed compatibility code from multilingual_flatpages.
diff --git a/multilingual/flatpages/models.py b/multilingual/flatpages/models.py index ed06d08..b28117c 100644 --- a/multilingual/flatpages/models.py +++ b/multilingual/flatpages/models.py @@ -1,74 +1,52 @@ from django.core import validators from django.db import models from django.contrib.sites.models import Site import multilingual -try: - from django.utils.translation import ugettext as _ -except: - # if this fails then _ is a builtin - pass +from django.utils.translation import ugettext as _ class MultilingualFlatPage(models.Model): # non-translatable fields first url = models.CharField(_('URL'), max_length=100, validator_list=[validators.isAlphaNumericURL], db_index=True, help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes.")) enable_comments = models.BooleanField(_('enable comments')) template_name = models.CharField(_('template name'), max_length=70, blank=True, help_text=_("Example: 'flatpages/contact_page.html'. If this isn't provided, the system will use 'flatpages/default.html'.")) registration_required = models.BooleanField(_('registration required'), help_text=_("If this is checked, only logged-in users will be able to view the page.")) sites = models.ManyToManyField(Site) # And now the translatable fields class Translation(multilingual.Translation): """ The definition of translation model. The multilingual machinery will automatically add these to the Category class: * get_title(language_id=None) * set_title(value, language_id=None) * get_content(language_id=None) * set_content(value, language_id=None) * title and content properties using the methods above """ title = models.CharField(_('title'), max_length=200) content = models.TextField(_('content')) class Meta: db_table = 'multilingual_flatpage' verbose_name = _('multilingual flat page') verbose_name_plural = _('multilingual flat pages') ordering = ('url',) - class Admin: - fields = ( - (None, {'fields': ('url', 'sites')}), - ('Advanced options', {'classes': 'collapse', 'fields': ('enable_comments', 'registration_required', 'template_name')}), - ) - list_filter = ('sites',) - search_fields = ('url', 'title') - - def __str__(self): - # this method can be removed after the landing of newforms-admin - try: - return "%s -- %s" % (self.url, self.title) - except multilingual.TranslationDoesNotExist: - return "-not-available-" def __unicode__(self): # note that you can use name and description fields as usual try: return u"%s -- %s" % (self.url, self.title) except multilingual.TranslationDoesNotExist: return u"-not-available-" def get_absolute_url(self): return self.url -from multilingual.compat import IS_NEWFORMS_ADMIN - -if IS_NEWFORMS_ADMIN: - import multilingual.flatpages.admin diff --git a/multilingual/flatpages/views.py b/multilingual/flatpages/views.py index 339cc12..f7f7d11 100644 --- a/multilingual/flatpages/views.py +++ b/multilingual/flatpages/views.py @@ -1,56 +1,53 @@ from multilingual.flatpages.models import MultilingualFlatPage from django.template import loader, RequestContext from django.shortcuts import get_object_or_404 from django.http import HttpResponse from django.conf import settings from django.core.xheaders import populate_xheaders from django.utils.translation import get_language import multilingual -try: - from django.utils.safestring import mark_safe -except ImportError: - mark_safe = lambda s: s +from django.utils.safestring import mark_safe DEFAULT_TEMPLATE = 'flatpages/default.html' def multilingual_flatpage(request, url): """ Multilingual flat page view. Models: `multilingual.flatpages.models` Templates: Uses the template defined by the ``template_name`` field, or `flatpages/default.html` if template_name is not defined. Context: flatpage `flatpages.flatpages` object """ if not url.startswith('/'): url = "/" + url f = get_object_or_404(MultilingualFlatPage, url__exact=url, sites__id__exact=settings.SITE_ID) # If registration is required for accessing this page, and the user isn't # logged in, redirect to the login page. if f.registration_required and not request.user.is_authenticated(): from django.contrib.auth.views import redirect_to_login return redirect_to_login(request.path) #Serve the content in the language defined by the Django translation module #if possible else serve the default language f._default_language = multilingual.languages.get_language_id_from_id_or_code(get_language()) if f.template_name: t = loader.select_template((f.template_name, DEFAULT_TEMPLATE)) else: t = loader.get_template(DEFAULT_TEMPLATE) # To avoid having to always use the "|safe" filter in flatpage templates, # mark the title and content as already safe (since they are raw HTML # content in the first place). f.title = mark_safe(f.title) f.content = mark_safe(f.content) c = RequestContext(request, { 'flatpage': f, }) response = HttpResponse(t.render(c)) populate_xheaders(request, response, MultilingualFlatPage, f.id) return response
stefanfoulis/django-multilingual
291174c591bfad223dc191da2fc2a659f7ed78b8
Removed warnings because of the 'maxlength' -> 'max_length' rename. This really breaks backwards compatibility!
diff --git a/multilingual/flatpages/models.py b/multilingual/flatpages/models.py index 4d16b97..ed06d08 100644 --- a/multilingual/flatpages/models.py +++ b/multilingual/flatpages/models.py @@ -1,74 +1,74 @@ from django.core import validators from django.db import models from django.contrib.sites.models import Site import multilingual try: from django.utils.translation import ugettext as _ except: # if this fails then _ is a builtin pass class MultilingualFlatPage(models.Model): # non-translatable fields first - url = models.CharField(_('URL'), maxlength=100, validator_list=[validators.isAlphaNumericURL], db_index=True, + url = models.CharField(_('URL'), max_length=100, validator_list=[validators.isAlphaNumericURL], db_index=True, help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes.")) enable_comments = models.BooleanField(_('enable comments')) - template_name = models.CharField(_('template name'), maxlength=70, blank=True, + template_name = models.CharField(_('template name'), max_length=70, blank=True, help_text=_("Example: 'flatpages/contact_page.html'. If this isn't provided, the system will use 'flatpages/default.html'.")) registration_required = models.BooleanField(_('registration required'), help_text=_("If this is checked, only logged-in users will be able to view the page.")) sites = models.ManyToManyField(Site) # And now the translatable fields class Translation(multilingual.Translation): """ The definition of translation model. The multilingual machinery will automatically add these to the Category class: * get_title(language_id=None) * set_title(value, language_id=None) * get_content(language_id=None) * set_content(value, language_id=None) * title and content properties using the methods above """ - title = models.CharField(_('title'), maxlength=200) + title = models.CharField(_('title'), max_length=200) content = models.TextField(_('content')) class Meta: db_table = 'multilingual_flatpage' verbose_name = _('multilingual flat page') verbose_name_plural = _('multilingual flat pages') ordering = ('url',) class Admin: fields = ( (None, {'fields': ('url', 'sites')}), ('Advanced options', {'classes': 'collapse', 'fields': ('enable_comments', 'registration_required', 'template_name')}), ) list_filter = ('sites',) search_fields = ('url', 'title') def __str__(self): # this method can be removed after the landing of newforms-admin try: return "%s -- %s" % (self.url, self.title) except multilingual.TranslationDoesNotExist: return "-not-available-" def __unicode__(self): # note that you can use name and description fields as usual try: return u"%s -- %s" % (self.url, self.title) except multilingual.TranslationDoesNotExist: return u"-not-available-" def get_absolute_url(self): return self.url from multilingual.compat import IS_NEWFORMS_ADMIN if IS_NEWFORMS_ADMIN: import multilingual.flatpages.admin diff --git a/testproject/articles/models.py b/testproject/articles/models.py index 58a22aa..40ae906 100644 --- a/testproject/articles/models.py +++ b/testproject/articles/models.py @@ -1,317 +1,317 @@ """ Test models for the multilingual library. # Note: the to_str() calls in all the tests are here only to make it # easier to test both pre-unicode and current Django. >>> from testproject.utils import to_str # make sure the settings are right >>> from multilingual.languages import LANGUAGES >>> LANGUAGES [['en', 'English'], ['pl', 'Polish'], ['zh-cn', 'Simplified Chinese']] >>> from multilingual import set_default_language >>> from django.db.models import Q >>> set_default_language(1) ### Check the table names >>> Category._meta.translation_model._meta.db_table 'category_language' >>> Article._meta.translation_model._meta.db_table 'articles_article_translation' ### Create the test data # Check both assigning via the proxy properties and set_* functions >>> c = Category() >>> c.name_en = 'category 1' >>> c.name_pl = 'kategoria 1' >>> c.save() >>> c = Category() >>> c.set_name('category 2', 'en') >>> c.set_name('kategoria 2', 'pl') >>> c.save() ### See if the test data was saved correctly ### Note: first object comes from the initial fixture. >>> c = Category.objects.all().order_by('id')[1] >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('category 1', 'category 1', 'kategoria 1') >>> c = Category.objects.all().order_by('id')[2] >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('category 2', 'category 2', 'kategoria 2') ### Check translation changes. ### Make sure the name and description properties obey ### set_default_language. >>> c = Category.objects.all().order_by('id')[1] # set language: pl >>> set_default_language(2) >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('kategoria 1', 'category 1', 'kategoria 1') >>> c.name = 'kat 1' >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('kat 1', 'category 1', 'kat 1') # set language: en >>> set_default_language('en') >>> c.name = 'cat 1' >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('cat 1', 'cat 1', 'kat 1') >>> c.save() # Read the entire Category objects from the DB again to see if # everything was saved correctly. >>> c = Category.objects.all().order_by('id')[1] >>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) ('cat 1', 'cat 1', 'kat 1') >>> c = Category.objects.all().order_by('id')[2] >>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) ('category 2', 'category 2', 'kategoria 2') ### Check ordering >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) ['Fixture category', 'cat 1', 'category 2'] ### Check ordering # start with renaming one of the categories so that the order actually # depends on the default language >>> set_default_language(1) >>> c = Category.objects.get(name='cat 1') >>> c.name = 'zzz cat 1' >>> c.save() >>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) ['Fixture category', 'category 2', 'zzz cat 1'] >>> to_str([c.name for c in Category.objects.all().order_by('name')]) ['Fixture category', 'category 2', 'zzz cat 1'] >>> to_str([c.name for c in Category.objects.all().order_by('-name')]) ['zzz cat 1', 'category 2', 'Fixture category'] >>> set_default_language(2) >>> to_str([c.name for c in Category.objects.all().order_by('name')]) ['Fixture kategoria', 'kat 1', 'kategoria 2'] >>> to_str([c.name for c in Category.objects.all().order_by('-name')]) ['kategoria 2', 'kat 1', 'Fixture kategoria'] ### Check filtering # Check for filtering defined by Q objects as well. This is a recent # improvement: the translation fields are being handled by an # extension of lookup_inner instead of overridden # QuerySet._filter_or_exclude >>> set_default_language('en') >>> to_str([c.name for c in Category.objects.all().filter(name__contains='2')]) ['category 2'] >>> set_default_language('en') >>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='2'))]) ['category 2'] >>> set_default_language(1) >>> to_str([c.name for c in ... Category.objects.all().filter(Q(name__contains='2')|Q(name_pl__contains='kat'))]) ['Fixture category', 'zzz cat 1', 'category 2'] >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().filter(name_en__contains='2')]) ['category 2'] >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().filter(Q(name_pl__contains='kat'))]) ['Fixture category', 'zzz cat 1', 'category 2'] >>> set_default_language('pl') >>> to_str([c.name for c in Category.objects.all().filter(name__contains='k')]) ['Fixture kategoria', 'kat 1', 'kategoria 2'] >>> set_default_language('pl') >>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='kategoria'))]) ['Fixture kategoria', 'kategoria 2'] ### Check specifying query set language >>> c_en = Category.objects.all().for_language('en') >>> c_pl = Category.objects.all().for_language(2) # both ID and code work here >>> to_str(c_en.get(name__contains='1').name) 'zzz cat 1' >>> to_str(c_pl.get(name__contains='1').name) 'kat 1' >>> to_str([c.name for c in c_en.order_by('name')]) ['Fixture category', 'category 2', 'zzz cat 1'] >>> to_str([c.name for c in c_pl.order_by('-name')]) ['kategoria 2', 'kat 1', 'Fixture kategoria'] >>> c = c_en.get(id=2) >>> c.name = 'test' >>> to_str((c.name, c.name_en, c.name_pl)) ('test', 'test', 'kat 1') >>> c = c_pl.get(id=2) >>> c.name = 'test' >>> to_str((c.name, c.name_en, c.name_pl)) ('test', 'zzz cat 1', 'test') ### Check filtering spanning more than one model >>> set_default_language(1) >>> cat_1 = Category.objects.get(name='zzz cat 1') >>> cat_2 = Category.objects.get(name='category 2') >>> a = Article(category=cat_1) >>> a.set_title('article 1', 1) >>> a.set_title('artykul 1', 2) >>> a.set_contents('contents 1', 1) >>> a.set_contents('zawartosc 1', 1) >>> a.save() >>> a = Article(category=cat_2) >>> a.set_title('article 2', 1) >>> a.set_title('artykul 2', 2) >>> a.set_contents('contents 2', 1) >>> a.set_contents('zawartosc 2', 1) >>> a.save() >>> to_str([a.title for a in Article.objects.filter(category=cat_1)]) ['article 1'] >>> to_str([a.title for a in Article.objects.filter(category__name=cat_1.name)]) ['article 1'] >>> to_str([a.title for a in Article.objects.filter(Q(category__name=cat_1.name)|Q(category__name_pl__contains='2')).order_by('-title')]) ['article 2', 'article 1'] ### Test the creation of new objects using keywords passed to the ### constructor >>> set_default_language(2) >>> c_n = Category.objects.create(name_en='new category', name_pl='nowa kategoria') >>> to_str((c_n.name, c_n.name_en, c_n.name_pl)) ('nowa kategoria', 'new category', 'nowa kategoria') >>> c_n.save() >>> c_n2 = Category.objects.get(name_en='new category') >>> to_str((c_n2.name, c_n2.name_en, c_n2.name_pl)) ('nowa kategoria', 'new category', 'nowa kategoria') >>> set_default_language(2) >>> c_n3 = Category.objects.create(name='nowa kategoria 2') >>> to_str((c_n3.name, c_n3.name_en, c_n3.name_pl)) ('nowa kategoria 2', None, 'nowa kategoria 2') """ from django.db import models from django.contrib.auth.models import User import multilingual try: from django.utils.translation import ugettext as _ except: # if this fails then _ is a builtin pass class Category(models.Model): """ Test model for multilingual content: a simplified Category. """ # First, some fields that do not need translations creator = models.ForeignKey(User, verbose_name=_("Created by"), blank=True, null=True) created = models.DateTimeField(verbose_name=_("Created at"), auto_now_add=True) parent = models.ForeignKey('self', verbose_name=_("Parent category"), blank=True, null=True) # And now the translatable fields class Translation(multilingual.Translation): """ The definition of translation model. The multilingual machinery will automatically add these to the Category class: * get_name(language_id=None) * set_name(value, language_id=None) * get_description(language_id=None) * set_description(value, language_id=None) * name and description properties using the methods above """ name = models.CharField(verbose_name=_("The name"), - maxlength=250) + max_length=250) description = models.TextField(verbose_name=_("The description"), blank=True, null=False) class Meta: db_table = 'category_language' def get_absolute_url(self): return "/" + str(self.id) + "/" def __unicode__(self): # note that you can use name and description fields as usual try: return str(self.name) except multilingual.TranslationDoesNotExist: return "-not-available-" def __str__(self): # compatibility return str(self.__unicode__()) class Admin: # Again, field names would just work here, but if you need # correct list headers (from field.verbose_name) you have to # use the get_'field_name' functions here. # Note: this Admin class does not do anything in newforms-admin list_display = ('id', 'creator', 'created', 'name', 'description') search_fields = ('name', 'description') class Meta: verbose_name_plural = 'categories' ordering = ('id',) class CustomArticleManager(multilingual.Manager): pass class Article(models.Model): """ Test model for multilingual content: a simplified article belonging to a single category. """ # non-translatable fields first creator = models.ForeignKey(User, verbose_name=_("Created by"), blank=True, null=True) created = models.DateTimeField(verbose_name=_("Created at"), auto_now_add=True) category = models.ForeignKey(Category, verbose_name=_("Parent category"), blank=True, null=True) objects = CustomArticleManager() # And now the translatable fields class Translation(multilingual.Translation): title = models.CharField(verbose_name=_("The title"), - blank=True, null=False, maxlength=250) + blank=True, null=False, max_length=250) contents = models.TextField(verbose_name=_("The contents"), blank=True, null=False) from multilingual.compat import IS_NEWFORMS_ADMIN if IS_NEWFORMS_ADMIN: from django.contrib import admin admin.site.register(Article) admin.site.register(Category) diff --git a/testproject/issue_15/models.py b/testproject/issue_15/models.py index 7568991..33e96bf 100644 --- a/testproject/issue_15/models.py +++ b/testproject/issue_15/models.py @@ -1,42 +1,42 @@ """ Models and unit tests for issues reported in the tracker. # test for issue #15, it will fail on unpatched Django # http://code.google.com/p/django-multilingual/issues/detail?id=15 >>> from multilingual import set_default_language # Note: the to_str() calls in all the tests are here only to make it # easier to test both pre-unicode and current Django. >>> from testproject.utils import to_str >>> set_default_language('pl') >>> g = Gallery.objects.create(id=2, ref_id=2, title_pl='Test polski', title_en='English Test') >>> to_str(g.title) 'Test polski' >>> to_str(g.title_en) 'English Test' >>> g = Gallery.objects.select_related(depth=1).get(id=2) >>> to_str(g.title) 'Test polski' >>> to_str(g.title_en) 'English Test' """ from django.db import models import multilingual try: from django.utils.translation import ugettext as _ except: # if this fails then _ is a builtin pass class Gallery(models.Model): ref = models.ForeignKey('self', verbose_name=_('Parent gallery')) modified = models.DateField(_('Modified'), auto_now=True) class Translation(multilingual.Translation): - title = models.CharField(_('Title'), maxlength=50) + title = models.CharField(_('Title'), max_length=50) description = models.TextField(_('Description'), blank=True) diff --git a/testproject/issue_16/models/category.py b/testproject/issue_16/models/category.py index 890b31a..47e63ff 100644 --- a/testproject/issue_16/models/category.py +++ b/testproject/issue_16/models/category.py @@ -1,19 +1,19 @@ from django.db import models import multilingual try: from django.utils.translation import ugettext as _ except: # if this fails then _ is a builtin pass class Category(models.Model): parent = models.ForeignKey('self', verbose_name=_("Parent category"), blank=True, null=True) class Translation(multilingual.Translation): name = models.CharField(verbose_name=_("The name"), - blank=True, null=False, maxlength=250) + blank=True, null=False, max_length=250) class Meta: app_label = 'issue_16' diff --git a/testproject/issue_16/models/page.py b/testproject/issue_16/models/page.py index 21f53fd..9400c02 100644 --- a/testproject/issue_16/models/page.py +++ b/testproject/issue_16/models/page.py @@ -1,22 +1,22 @@ from django.db import models from issue_16.models.category import Category import multilingual try: from django.utils.translation import ugettext as _ except: # if this fails then _ is a builtin pass class Page(models.Model): category = models.ForeignKey(Category, verbose_name=_("Parent category"), blank=True, null=True) class Translation(multilingual.Translation): title = models.CharField(verbose_name=_("The title"), - blank=True, null=False, maxlength=250) + blank=True, null=False, max_length=250) contents = models.TextField(verbose_name=_("The contents"), blank=True, null=False) class Meta: app_label = 'issue_16' diff --git a/testproject/issue_29/models.py b/testproject/issue_29/models.py index 2077205..aae1395 100644 --- a/testproject/issue_29/models.py +++ b/testproject/issue_29/models.py @@ -1,43 +1,43 @@ """ Models and unit tests for issues reported in the tracker. >>> from multilingual import set_default_language # test for issue #15 # http://code.google.com/p/django-multilingual/issues/detail?id=15 >>> set_default_language('pl') >>> g = Gallery.objects.create(id=2, title_pl='Test polski', title_en='English Test') >>> g.title 'Test polski' >>> g.title_en 'English Test' >>> g.save() >>> g.title_en = 'Test polski' >>> g.save() >>> try: ... g = Gallery.objects.create(id=3, title_pl='Test polski') ... except: print "ERROR" ... ERROR >>> """ from django.db import models import multilingual try: from django.utils.translation import ugettext as _ except ImportError: pass class Gallery(models.Model): class Admin: pass ref = models.ForeignKey('self', verbose_name=_('Parent gallery'), blank=True, null=True) modified = models.DateField(_('Modified'), auto_now=True) class Translation(multilingual.Translation): - title = models.CharField(_('Title'), maxlength=50, unique = True) + title = models.CharField(_('Title'), max_length=50, unique = True) description = models.TextField(_('Description'), blank=True) diff --git a/testproject/issue_37/models.py b/testproject/issue_37/models.py index a12e370..3f4688a 100644 --- a/testproject/issue_37/models.py +++ b/testproject/issue_37/models.py @@ -1,38 +1,38 @@ """ Models and unit tests for issues reported in the tracker. >>> from multilingual import set_default_language >>> from testproject.utils import to_str # test for issue #37 # http://code.google.com/p/django-multilingual/issues/detail?id=37 >>> set_default_language('en') >>> x = ModelWithCustomPK.objects.create(custompk='key1', title=u'The English Title') >>> set_default_language('pl') >>> x.title = u'The Polish Title' >>> x.save() >>> x = ModelWithCustomPK.objects.get(pk='key1') >>> to_str(x.title) 'The Polish Title' >>> set_default_language('en') >>> to_str(x.title) 'The English Title' """ from django.db import models import multilingual try: from django.utils.translation import ugettext as _ except ImportError: pass class ModelWithCustomPK(models.Model): - custompk = models.CharField(maxlength=5, primary_key=True) + custompk = models.CharField(max_length=5, primary_key=True) class Translation(multilingual.Translation): - title = models.CharField(_('Title'), maxlength=50, unique = True) + title = models.CharField(_('Title'), max_length=50, unique = True)
stefanfoulis/django-multilingual
4b86f8a0549bf1960a3bbd5f9542f86111448419
Added initial_data fixture and fixed tests.
diff --git a/testproject/articles/fixtures/initial_data.xml b/testproject/articles/fixtures/initial_data.xml new file mode 100644 index 0000000..830569a --- /dev/null +++ b/testproject/articles/fixtures/initial_data.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<django-objects version="1.0"> + <object pk="1" model="articles.categorytranslation"> + <field type="CharField" name="name">Fixture category</field> + <field type="TextField" name="description">Fixture category description</field> + <field type="IntegerField" name="language_id">1</field> + <field to="articles.category" name="master" rel="ManyToOneRel">1</field> + </object> + <object pk="2" model="articles.categorytranslation"> + <field type="CharField" name="name">Fixture kategoria</field> + <field type="TextField" name="description">Fixture kategoria opis</field> + <field type="IntegerField" name="language_id">2</field> + <field to="articles.category" name="master" rel="ManyToOneRel">1</field> + </object> + <object pk="1" model="articles.category"> + <field to="auth.user" name="creator" rel="ManyToOneRel">1</field> + <field type="DateTimeField" name="created">2007-05-04 16:45:29</field> + <field to="articles.category" name="parent" rel="ManyToOneRel"><None></None></field> + </object> +</django-objects> diff --git a/testproject/articles/models.py b/testproject/articles/models.py index c2f1ba4..58a22aa 100644 --- a/testproject/articles/models.py +++ b/testproject/articles/models.py @@ -1,316 +1,317 @@ """ Test models for the multilingual library. # Note: the to_str() calls in all the tests are here only to make it # easier to test both pre-unicode and current Django. >>> from testproject.utils import to_str # make sure the settings are right >>> from multilingual.languages import LANGUAGES >>> LANGUAGES [['en', 'English'], ['pl', 'Polish'], ['zh-cn', 'Simplified Chinese']] >>> from multilingual import set_default_language >>> from django.db.models import Q >>> set_default_language(1) ### Check the table names >>> Category._meta.translation_model._meta.db_table 'category_language' >>> Article._meta.translation_model._meta.db_table 'articles_article_translation' ### Create the test data # Check both assigning via the proxy properties and set_* functions >>> c = Category() >>> c.name_en = 'category 1' >>> c.name_pl = 'kategoria 1' >>> c.save() >>> c = Category() >>> c.set_name('category 2', 'en') >>> c.set_name('kategoria 2', 'pl') >>> c.save() ### See if the test data was saved correctly +### Note: first object comes from the initial fixture. ->>> c = Category.objects.all().order_by('id')[0] +>>> c = Category.objects.all().order_by('id')[1] >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('category 1', 'category 1', 'kategoria 1') ->>> c = Category.objects.all().order_by('id')[1] +>>> c = Category.objects.all().order_by('id')[2] >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('category 2', 'category 2', 'kategoria 2') ### Check translation changes. ### Make sure the name and description properties obey ### set_default_language. ->>> c = Category.objects.all().order_by('id')[0] +>>> c = Category.objects.all().order_by('id')[1] # set language: pl >>> set_default_language(2) >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('kategoria 1', 'category 1', 'kategoria 1') >>> c.name = 'kat 1' >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('kat 1', 'category 1', 'kat 1') # set language: en >>> set_default_language('en') >>> c.name = 'cat 1' >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('cat 1', 'cat 1', 'kat 1') >>> c.save() # Read the entire Category objects from the DB again to see if # everything was saved correctly. ->>> c = Category.objects.all().order_by('id')[0] +>>> c = Category.objects.all().order_by('id')[1] >>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) ('cat 1', 'cat 1', 'kat 1') ->>> c = Category.objects.all().order_by('id')[1] +>>> c = Category.objects.all().order_by('id')[2] >>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) ('category 2', 'category 2', 'kategoria 2') ### Check ordering >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) -['cat 1', 'category 2'] +['Fixture category', 'cat 1', 'category 2'] ### Check ordering # start with renaming one of the categories so that the order actually # depends on the default language >>> set_default_language(1) >>> c = Category.objects.get(name='cat 1') >>> c.name = 'zzz cat 1' >>> c.save() >>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) -['category 2', 'zzz cat 1'] +['Fixture category', 'category 2', 'zzz cat 1'] >>> to_str([c.name for c in Category.objects.all().order_by('name')]) -['category 2', 'zzz cat 1'] +['Fixture category', 'category 2', 'zzz cat 1'] >>> to_str([c.name for c in Category.objects.all().order_by('-name')]) -['zzz cat 1', 'category 2'] +['zzz cat 1', 'category 2', 'Fixture category'] >>> set_default_language(2) >>> to_str([c.name for c in Category.objects.all().order_by('name')]) -['kat 1', 'kategoria 2'] +['Fixture kategoria', 'kat 1', 'kategoria 2'] >>> to_str([c.name for c in Category.objects.all().order_by('-name')]) -['kategoria 2', 'kat 1'] +['kategoria 2', 'kat 1', 'Fixture kategoria'] ### Check filtering # Check for filtering defined by Q objects as well. This is a recent # improvement: the translation fields are being handled by an # extension of lookup_inner instead of overridden # QuerySet._filter_or_exclude >>> set_default_language('en') >>> to_str([c.name for c in Category.objects.all().filter(name__contains='2')]) ['category 2'] >>> set_default_language('en') >>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='2'))]) ['category 2'] >>> set_default_language(1) >>> to_str([c.name for c in ... Category.objects.all().filter(Q(name__contains='2')|Q(name_pl__contains='kat'))]) -['zzz cat 1', 'category 2'] +['Fixture category', 'zzz cat 1', 'category 2'] >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().filter(name_en__contains='2')]) ['category 2'] >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().filter(Q(name_pl__contains='kat'))]) -['zzz cat 1', 'category 2'] +['Fixture category', 'zzz cat 1', 'category 2'] >>> set_default_language('pl') >>> to_str([c.name for c in Category.objects.all().filter(name__contains='k')]) -['kat 1', 'kategoria 2'] +['Fixture kategoria', 'kat 1', 'kategoria 2'] >>> set_default_language('pl') >>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='kategoria'))]) -['kategoria 2'] +['Fixture kategoria', 'kategoria 2'] ### Check specifying query set language >>> c_en = Category.objects.all().for_language('en') >>> c_pl = Category.objects.all().for_language(2) # both ID and code work here >>> to_str(c_en.get(name__contains='1').name) 'zzz cat 1' >>> to_str(c_pl.get(name__contains='1').name) 'kat 1' >>> to_str([c.name for c in c_en.order_by('name')]) -['category 2', 'zzz cat 1'] +['Fixture category', 'category 2', 'zzz cat 1'] >>> to_str([c.name for c in c_pl.order_by('-name')]) -['kategoria 2', 'kat 1'] +['kategoria 2', 'kat 1', 'Fixture kategoria'] ->>> c = c_en.get(id=1) +>>> c = c_en.get(id=2) >>> c.name = 'test' >>> to_str((c.name, c.name_en, c.name_pl)) ('test', 'test', 'kat 1') ->>> c = c_pl.get(id=1) +>>> c = c_pl.get(id=2) >>> c.name = 'test' >>> to_str((c.name, c.name_en, c.name_pl)) ('test', 'zzz cat 1', 'test') ### Check filtering spanning more than one model >>> set_default_language(1) >>> cat_1 = Category.objects.get(name='zzz cat 1') >>> cat_2 = Category.objects.get(name='category 2') >>> a = Article(category=cat_1) >>> a.set_title('article 1', 1) >>> a.set_title('artykul 1', 2) >>> a.set_contents('contents 1', 1) >>> a.set_contents('zawartosc 1', 1) >>> a.save() >>> a = Article(category=cat_2) >>> a.set_title('article 2', 1) >>> a.set_title('artykul 2', 2) >>> a.set_contents('contents 2', 1) >>> a.set_contents('zawartosc 2', 1) >>> a.save() >>> to_str([a.title for a in Article.objects.filter(category=cat_1)]) ['article 1'] >>> to_str([a.title for a in Article.objects.filter(category__name=cat_1.name)]) ['article 1'] >>> to_str([a.title for a in Article.objects.filter(Q(category__name=cat_1.name)|Q(category__name_pl__contains='2')).order_by('-title')]) ['article 2', 'article 1'] ### Test the creation of new objects using keywords passed to the ### constructor >>> set_default_language(2) >>> c_n = Category.objects.create(name_en='new category', name_pl='nowa kategoria') >>> to_str((c_n.name, c_n.name_en, c_n.name_pl)) ('nowa kategoria', 'new category', 'nowa kategoria') >>> c_n.save() >>> c_n2 = Category.objects.get(name_en='new category') >>> to_str((c_n2.name, c_n2.name_en, c_n2.name_pl)) ('nowa kategoria', 'new category', 'nowa kategoria') >>> set_default_language(2) >>> c_n3 = Category.objects.create(name='nowa kategoria 2') >>> to_str((c_n3.name, c_n3.name_en, c_n3.name_pl)) ('nowa kategoria 2', None, 'nowa kategoria 2') """ from django.db import models from django.contrib.auth.models import User import multilingual try: from django.utils.translation import ugettext as _ except: # if this fails then _ is a builtin pass class Category(models.Model): """ Test model for multilingual content: a simplified Category. """ # First, some fields that do not need translations creator = models.ForeignKey(User, verbose_name=_("Created by"), blank=True, null=True) created = models.DateTimeField(verbose_name=_("Created at"), auto_now_add=True) parent = models.ForeignKey('self', verbose_name=_("Parent category"), blank=True, null=True) # And now the translatable fields class Translation(multilingual.Translation): """ The definition of translation model. The multilingual machinery will automatically add these to the Category class: * get_name(language_id=None) * set_name(value, language_id=None) * get_description(language_id=None) * set_description(value, language_id=None) * name and description properties using the methods above """ name = models.CharField(verbose_name=_("The name"), maxlength=250) description = models.TextField(verbose_name=_("The description"), blank=True, null=False) class Meta: db_table = 'category_language' def get_absolute_url(self): return "/" + str(self.id) + "/" def __unicode__(self): # note that you can use name and description fields as usual try: return str(self.name) except multilingual.TranslationDoesNotExist: return "-not-available-" def __str__(self): # compatibility return str(self.__unicode__()) class Admin: # Again, field names would just work here, but if you need # correct list headers (from field.verbose_name) you have to # use the get_'field_name' functions here. # Note: this Admin class does not do anything in newforms-admin list_display = ('id', 'creator', 'created', 'name', 'description') search_fields = ('name', 'description') class Meta: verbose_name_plural = 'categories' ordering = ('id',) class CustomArticleManager(multilingual.Manager): pass class Article(models.Model): """ Test model for multilingual content: a simplified article belonging to a single category. """ # non-translatable fields first creator = models.ForeignKey(User, verbose_name=_("Created by"), blank=True, null=True) created = models.DateTimeField(verbose_name=_("Created at"), auto_now_add=True) category = models.ForeignKey(Category, verbose_name=_("Parent category"), blank=True, null=True) objects = CustomArticleManager() # And now the translatable fields class Translation(multilingual.Translation): title = models.CharField(verbose_name=_("The title"), blank=True, null=False, maxlength=250) contents = models.TextField(verbose_name=_("The contents"), blank=True, null=False) from multilingual.compat import IS_NEWFORMS_ADMIN if IS_NEWFORMS_ADMIN: from django.contrib import admin admin.site.register(Article) admin.site.register(Category)
stefanfoulis/django-multilingual
401f2cac4718cce7bddd24d59a22564c8646852c
Fixed a bug in DM: the library assumed a model's primary key would be always named 'id'. Fixes #37.
diff --git a/multilingual/compat/query_pre_qsrf.py b/multilingual/compat/query_pre_qsrf.py index b91c5cf..8865e66 100644 --- a/multilingual/compat/query_pre_qsrf.py +++ b/multilingual/compat/query_pre_qsrf.py @@ -1,207 +1,207 @@ """ Django-multilingual: a QuerySet subclass for models with translatable fields. Also, a wrapper for lookup_inner that makes it possible to lookup via translatable fields. This file contains the implementation for pre-QSRF Django. """ import django from django.db import models, backend, connection from django.db.models.query import QuerySet, get_where_clause from django.utils.datastructures import SortedDict from multilingual.languages import * old_lookup_inner = models.query.lookup_inner def new_lookup_inner(path, lookup_type, value, opts, table, column): """ Patch django.db.models.query.lookup_inner from the outside to recognize the translation fields. Ideally this should go into lookup_inner. """ # check if there is anything to do for us here. If not, send it # all back to the original lookup_inner. if not hasattr(opts, 'translation_model'): return old_lookup_inner(path, lookup_type, value, opts, table, column) translation_opts = opts.translation_model._meta # This hack adapts this mess # to Django's "order_by for related tables" patch if path[0] is not None and path[0].startswith("_trans_") and path[0][7:] in translation_opts.translated_fields: path[0] = path[0][7:] if path[0] not in translation_opts.translated_fields: return old_lookup_inner(path, lookup_type, value, opts, table, column) # If we got here then path[0] _is_ a translatable field (or a # localised version of one) in a model with translations. joins, where, params = SortedDict(), [], [] name = path.pop(0) current_table = table field, language_id = translation_opts.translated_fields[name] if language_id is None: language_id = get_default_language() translation_table = get_translation_table_alias(translation_opts.db_table, language_id) new_table = (current_table + "__" + translation_table) # add the join necessary for the current step try: qn = backend.quote_name except AttributeError: qn = connection.ops.quote_name - master_id_column_name = opts.pk.column -# import sys; sys.stderr.write('QQQ %r %r\n' % (opts, master_id_column_name)) - - condition = ('((%s.master_id = %s.id) AND (%s.language_id = %s))' + from django.conf import settings + condition = ('((%s.master_id = %s.%s) AND (%s.language_id = %s))' % (new_table, current_table, + opts.pk.column, new_table, language_id)) joins[qn(new_table)] = (qn(translation_opts.db_table), 'LEFT JOIN', condition) if path: joins2, where2, params2 = \ models.query.lookup_inner(path, lookup_type, value, translation_opts, new_table, translation_opts.pk.column) joins.update(joins2) where.extend(where2) params.extend(params2) else: trans_table_name = opts.translation_model._meta.db_table if (django.VERSION[0] >= 1) or (django.VERSION[1] >= 97): # BACKWARDS_COMPATIBILITY_HACK # The get_where_clause function got another parameter as of Django rev # #5943, see here: http://code.djangoproject.com/changeset/5943 # This change happened when 0.97.pre was the current trunk # and there is no sure way to detect whether your version # requires the new parameter or not, so I will not try to # guess. If you use 0.97.* make sure you have a pretty # recent version or this line will fail. where.append(get_where_clause(lookup_type, new_table + '.', field.attname, value, field.db_type())) else: # compatibility code for 0.96 where.append(get_where_clause(lookup_type, new_table + '.', field.attname, value)) params.extend(field.get_db_prep_lookup(lookup_type, value)) return joins, where, params models.query.lookup_inner = new_lookup_inner class QAddTranslationData(object): """ Extend a queryset with joins and contitions necessary to pull all the ML data. """ def get_sql(self, opts): joins, where, params = SortedDict(), [], [] # create all the LEFT JOINS needed to read all the # translations in one row master_table_name = opts.db_table trans_table_name = opts.translation_model._meta.db_table for language_id in get_language_id_list(): table_alias = get_translation_table_alias(trans_table_name, language_id) - condition = ('((%s.master_id = %s.id) AND (%s.language_id = %s))' - % (table_alias, master_table_name, table_alias, + condition = ('((%s.master_id = %s.%s) AND (%s.language_id = %s))' + % (table_alias, master_table_name, + opts.pk.column, table_alias, language_id)) joins[table_alias] = (trans_table_name, 'LEFT JOIN', condition) return joins, where, params class MultilingualModelQuerySet(QuerySet): """ A specialized QuerySet that knows how to handle translatable fields in ordering and filtering methods. """ def __init__(self, model=None, *args, **kwargs): super(MultilingualModelQuerySet, self).__init__(model, *args, **kwargs) # Note: the 'if' below is here to work around the silly _clone # behaviour: it creates a QuerySet without a model just to # assign it later. # # It should work because it only happens when cloning another # MultilingualModelQuerySet, in which case all the field # aliases should be also moved by _clone. if self.model: translation_model = self.model._meta.translation_model select = {} for language_id in get_language_id_list(): for fname in [f.attname for f in translation_model._meta.fields]: trans_table_name = translation_model._meta.db_table table_alias = get_translation_table_alias(trans_table_name, language_id) field_alias = get_translated_field_alias(fname, language_id) select[field_alias] = table_alias + '.' + fname self._select.update(select) self._filters = self._filters & QAddTranslationData() def order_by(self, *field_names): """ Override order_by to rename some of the arguments """ translated_fields = self.model._meta.translation_model._meta.translated_fields new_field_names = [] for field_name in field_names: prefix = '' if field_name[0] == '-': prefix = '-' field_name = field_name[1:] if field_name in translated_fields: field, language_id = translated_fields[field_name] if language_id is None: language_id = getattr(self, '_default_language', None) real_name = get_translated_field_alias(field.attname, language_id) new_field_names.append(prefix + real_name) else: new_field_names.append(prefix + field_name) return super(MultilingualModelQuerySet, self).order_by(*new_field_names) def for_language(self, language_id_or_code): """ Set the default language for all objects returned with this query. """ clone = self._clone() clone._default_language = get_language_id_from_id_or_code(language_id_or_code) return clone def iterator(self): """ Add the default language information to all returned objects. """ default_language = getattr(self, '_default_language', None) for obj in super(MultilingualModelQuerySet, self).iterator(): obj._default_language = default_language yield obj def _clone(self, klass=None, **kwargs): """ Override _clone to preserve additional information needed by MultilingualModelQuerySet. """ clone = super(MultilingualModelQuerySet, self)._clone(klass, **kwargs) clone._default_language = getattr(self, '_default_language', None) return clone diff --git a/testproject/issue_37/models.py b/testproject/issue_37/models.py index 081c6e0..a12e370 100644 --- a/testproject/issue_37/models.py +++ b/testproject/issue_37/models.py @@ -1,37 +1,38 @@ """ Models and unit tests for issues reported in the tracker. >>> from multilingual import set_default_language +>>> from testproject.utils import to_str # test for issue #37 # http://code.google.com/p/django-multilingual/issues/detail?id=37 >>> set_default_language('en') >>> x = ModelWithCustomPK.objects.create(custompk='key1', title=u'The English Title') >>> set_default_language('pl') >>> x.title = u'The Polish Title' >>> x.save() >>> x = ModelWithCustomPK.objects.get(pk='key1') ->>> x.title -u'The Polish Title' +>>> to_str(x.title) +'The Polish Title' >>> set_default_language('en') ->>> x.title -u'The English Title' +>>> to_str(x.title) +'The English Title' """ from django.db import models import multilingual try: from django.utils.translation import ugettext as _ except ImportError: pass class ModelWithCustomPK(models.Model): custompk = models.CharField(maxlength=5, primary_key=True) class Translation(multilingual.Translation): title = models.CharField(_('Title'), maxlength=50, unique = True)
stefanfoulis/django-multilingual
017d4a6fbc04591887ad062c993421b3b6353bd3
Added fixture from issue 19. Ordered translation entities first.
diff --git a/testproject/articles/fixtures/initial_data.xml b/testproject/articles/fixtures/initial_data.xml new file mode 100644 index 0000000..3bf8ff8 --- /dev/null +++ b/testproject/articles/fixtures/initial_data.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<django-objects version="1.0"> + <object pk="1" model="articles.categorytranslation"> + <field type="CharField" name="name">Fancy name</field> + <field type="TextField" name="description">Some fancy description</field> + <field type="IntegerField" name="language_id">1</field> + <field to="articles.category" name="master" rel="ManyToOneRel">1</field> + </object> + <object pk="2" model="articles.categorytranslation"> + <field type="CharField" name="name">Zanimivo ime</field> + <field type="TextField" name="description">Nek zanimiv opis</field> + <field type="IntegerField" name="language_id">2</field> + <field to="articles.category" name="master" rel="ManyToOneRel">1</field> + </object> + <object pk="1" model="articles.category"> + <field to="auth.user" name="creator" rel="ManyToOneRel">1</field> + <field type="DateTimeField" name="created">2007-05-04 16:45:29</field> + <field to="articles.category" name="parent" rel="ManyToOneRel"><None></None></field> + </object> +</django-objects>
stefanfoulis/django-multilingual
1c00fbea9cfe8dfc0e985f1c1188a3b3991c6954
Changed LANGUAGE_CODE from 'en-us' to 'en'. Added flatpages to the test set-up.
diff --git a/testproject/settings.py b/testproject/settings.py index e8df4b8..2a162dd 100644 --- a/testproject/settings.py +++ b/testproject/settings.py @@ -1,107 +1,109 @@ # Django settings for testproject project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '[email protected]'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. DATABASE_NAME = 'database.db3' # Or path to database file if using sqlite3. DATABASE_USER = '' # Not used with sqlite3. DATABASE_PASSWORD = '' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. # Local time zone for this installation. All choices can be found here: # http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE TIME_ZONE = 'America/Chicago' # Language code for this installation. All choices can be found here: # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes # http://blogs.law.harvard.edu/tech/stories/storyReader$15 -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'en' # django-multilanguange ##################### # It is important that the language identifiers are consecutive # numbers starting with 1. LANGUAGES = [['en', 'English'], # id=1 ['pl', 'Polish'], # id=2 ['zh-cn', 'Simplified Chinese'], # id=3 ] DEFAULT_LANGUAGE = 1 ############################################## SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. # Example: "http://media.lawrence.com" MEDIA_URL = '' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/media/' # Make this unique, and don't share it with anybody. SECRET_KEY = '1+t11&r9nw+d7uw558+8=#j8!8^$nt97ecgv()-@x!tcef7f6)' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.load_template_source', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware', + 'multilingual.flatpages.middleware.FlatpageFallbackMiddleware', ) ROOT_URLCONF = 'testproject.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. '../multilingual/templates/', 'templates/', ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'multilingual', + 'multilingual.flatpages', 'testproject.articles', 'testproject.issue_15', 'testproject.issue_16', 'testproject.issue_29', ) TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'multilingual.context_processors.multilingual', )
stefanfoulis/django-multilingual
53b5050d82eaa482642e4c3215f0da89cfed4709
Added multilingual flatpages implementation.
diff --git a/multilingual/flatpages/__init__.py b/multilingual/flatpages/__init__.py new file mode 100644 index 0000000..e39e056 --- /dev/null +++ b/multilingual/flatpages/__init__.py @@ -0,0 +1,4 @@ +from multilingual.compat import IS_NEWFORMS_ADMIN + +if IS_NEWFORMS_ADMIN: + import multilingual.flatpages.admin diff --git a/multilingual/flatpages/admin.py b/multilingual/flatpages/admin.py new file mode 100644 index 0000000..38c1be8 --- /dev/null +++ b/multilingual/flatpages/admin.py @@ -0,0 +1,13 @@ +from django.contrib import admin +from django.utils.translation import ugettext_lazy as _ +from multilingual.flatpages.models import MultiLingualFlatPage + +class MultiLingualFlatPageAdmin(admin.ModelAdmin): + fieldsets = ( + (None, {'fields': ('url', 'sites')}), + (_('Advanced options'), {'classes': ('collapse',), 'fields': ('enable_comments', 'registration_required', 'template_name')}), + ) + list_filter = ('sites',) + search_fields = ('url', 'title') + +admin.site.register(MultiLingualFlatPage, MultiLingualFlatPageAdmin) diff --git a/multilingual/flatpages/middleware.py b/multilingual/flatpages/middleware.py new file mode 100644 index 0000000..fdd6a4a --- /dev/null +++ b/multilingual/flatpages/middleware.py @@ -0,0 +1,18 @@ +from multilingual.flatpages.views import multilingual_flatpage +from django.http import Http404 +from django.conf import settings + +class FlatpageFallbackMiddleware(object): + def process_response(self, request, response): + if response.status_code != 404: + return response # No need to check for a flatpage for non-404 responses. + try: + return multilingual_flatpage(request, request.path) + # Return the original response if any errors happened. Because this + # is a middleware, we can't assume the errors will be caught elsewhere. + except Http404: + return response + except: + if settings.DEBUG: + raise + return response diff --git a/multilingual/flatpages/models.py b/multilingual/flatpages/models.py new file mode 100644 index 0000000..20cccc0 --- /dev/null +++ b/multilingual/flatpages/models.py @@ -0,0 +1,69 @@ +from django.core import validators +from django.db import models +from django.contrib.sites.models import Site +import multilingual + +try: + from django.utils.translation import ugettext as _ +except: + # if this fails then _ is a builtin + pass + +class MultilingualFlatPage(models.Model): + # non-translatable fields first + url = models.CharField(_('URL'), maxlength=100, validator_list=[validators.isAlphaNumericURL], db_index=True, + help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes.")) + enable_comments = models.BooleanField(_('enable comments')) + template_name = models.CharField(_('template name'), maxlength=70, blank=True, + help_text=_("Example: 'flatpages/contact_page.html'. If this isn't provided, the system will use 'flatpages/default.html'.")) + registration_required = models.BooleanField(_('registration required'), help_text=_("If this is checked, only logged-in users will be able to view the page.")) + sites = models.ManyToManyField(Site) + + + + # And now the translatable fields + class Translation(multilingual.Translation): + """ + The definition of translation model. + + The multilingual machinery will automatically add these to the + Category class: + + * get_title(language_id=None) + * set_title(value, language_id=None) + * get_content(language_id=None) + * set_content(value, language_id=None) + * title and content properties using the methods above + """ + title = models.CharField(_('title'), maxlength=200) + content = models.TextField(_('content')) + + class Meta: + db_table = 'multilingual_flatpage' + verbose_name = _('multilingual flat page') + verbose_name_plural = _('multilingual flat pages') + ordering = ('url',) + class Admin: + fields = ( + (None, {'fields': ('url', 'sites')}), + ('Advanced options', {'classes': 'collapse', 'fields': ('enable_comments', 'registration_required', 'template_name')}), + ) + list_filter = ('sites',) + search_fields = ('url', 'title') + + def __str__(self): + # this method can be removed after the landing of newforms-admin + try: + return "%s -- %s" % (self.url, self.title) + except multilingual.TranslationDoesNotExist: + return "-not-available-" + + def __unicode__(self): + # note that you can use name and description fields as usual + try: + return u"%s -- %s" % (self.url, self.title) + except multilingual.TranslationDoesNotExist: + return u"-not-available-" + + def get_absolute_url(self): + return self.url diff --git a/multilingual/flatpages/templates/flatpages/default.html b/multilingual/flatpages/templates/flatpages/default.html new file mode 100644 index 0000000..3a32a20 --- /dev/null +++ b/multilingual/flatpages/templates/flatpages/default.html @@ -0,0 +1,10 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<html> +<head> +<title>{{ flatpage.title }}</title> +</head> +<body> +{{ flatpage.content }} +</body> +</html> diff --git a/multilingual/flatpages/urls.py b/multilingual/flatpages/urls.py new file mode 100644 index 0000000..c7efda8 --- /dev/null +++ b/multilingual/flatpages/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls.defaults import * +from multilingual.flatpages.views import * + +urlpatterns = patterns('', + url(r'^(?P<url>.*)$', MultilingualFlatPage , name="multilingual_flatpage"), +) + diff --git a/multilingual/flatpages/views.py b/multilingual/flatpages/views.py new file mode 100644 index 0000000..339cc12 --- /dev/null +++ b/multilingual/flatpages/views.py @@ -0,0 +1,56 @@ +from multilingual.flatpages.models import MultilingualFlatPage +from django.template import loader, RequestContext +from django.shortcuts import get_object_or_404 +from django.http import HttpResponse +from django.conf import settings +from django.core.xheaders import populate_xheaders +from django.utils.translation import get_language +import multilingual + +try: + from django.utils.safestring import mark_safe +except ImportError: + mark_safe = lambda s: s + +DEFAULT_TEMPLATE = 'flatpages/default.html' + +def multilingual_flatpage(request, url): + """ + Multilingual flat page view. + + Models: `multilingual.flatpages.models` + Templates: Uses the template defined by the ``template_name`` field, + or `flatpages/default.html` if template_name is not defined. + Context: + flatpage + `flatpages.flatpages` object + """ + if not url.startswith('/'): + url = "/" + url + f = get_object_or_404(MultilingualFlatPage, url__exact=url, sites__id__exact=settings.SITE_ID) + # If registration is required for accessing this page, and the user isn't + # logged in, redirect to the login page. + if f.registration_required and not request.user.is_authenticated(): + from django.contrib.auth.views import redirect_to_login + return redirect_to_login(request.path) + #Serve the content in the language defined by the Django translation module + #if possible else serve the default language + f._default_language = multilingual.languages.get_language_id_from_id_or_code(get_language()) + if f.template_name: + t = loader.select_template((f.template_name, DEFAULT_TEMPLATE)) + else: + t = loader.get_template(DEFAULT_TEMPLATE) + + # To avoid having to always use the "|safe" filter in flatpage templates, + # mark the title and content as already safe (since they are raw HTML + # content in the first place). + f.title = mark_safe(f.title) + f.content = mark_safe(f.content) + + c = RequestContext(request, { + 'flatpage': f, + }) + response = HttpResponse(t.render(c)) + populate_xheaders(request, response, MultilingualFlatPage, f.id) + return response +
stefanfoulis/django-multilingual
9fa4a3a58deb9042e68cf5a47e40d6bbf536bf53
Added Meta class and db_table to Category. Added tests for db_table.
diff --git a/testproject/articles/models.py b/testproject/articles/models.py index 64845d4..c2f1ba4 100644 --- a/testproject/articles/models.py +++ b/testproject/articles/models.py @@ -1,306 +1,316 @@ """ Test models for the multilingual library. # Note: the to_str() calls in all the tests are here only to make it # easier to test both pre-unicode and current Django. >>> from testproject.utils import to_str # make sure the settings are right >>> from multilingual.languages import LANGUAGES >>> LANGUAGES [['en', 'English'], ['pl', 'Polish'], ['zh-cn', 'Simplified Chinese']] >>> from multilingual import set_default_language >>> from django.db.models import Q >>> set_default_language(1) +### Check the table names + +>>> Category._meta.translation_model._meta.db_table +'category_language' +>>> Article._meta.translation_model._meta.db_table +'articles_article_translation' + ### Create the test data # Check both assigning via the proxy properties and set_* functions >>> c = Category() >>> c.name_en = 'category 1' >>> c.name_pl = 'kategoria 1' >>> c.save() >>> c = Category() >>> c.set_name('category 2', 'en') >>> c.set_name('kategoria 2', 'pl') >>> c.save() ### See if the test data was saved correctly >>> c = Category.objects.all().order_by('id')[0] >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('category 1', 'category 1', 'kategoria 1') >>> c = Category.objects.all().order_by('id')[1] >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('category 2', 'category 2', 'kategoria 2') ### Check translation changes. ### Make sure the name and description properties obey ### set_default_language. >>> c = Category.objects.all().order_by('id')[0] # set language: pl >>> set_default_language(2) >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('kategoria 1', 'category 1', 'kategoria 1') >>> c.name = 'kat 1' >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('kat 1', 'category 1', 'kat 1') # set language: en >>> set_default_language('en') >>> c.name = 'cat 1' >>> to_str((c.name, c.get_name(1), c.get_name(2))) ('cat 1', 'cat 1', 'kat 1') >>> c.save() # Read the entire Category objects from the DB again to see if # everything was saved correctly. >>> c = Category.objects.all().order_by('id')[0] >>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) ('cat 1', 'cat 1', 'kat 1') >>> c = Category.objects.all().order_by('id')[1] >>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) ('category 2', 'category 2', 'kategoria 2') ### Check ordering >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) ['cat 1', 'category 2'] ### Check ordering # start with renaming one of the categories so that the order actually # depends on the default language >>> set_default_language(1) >>> c = Category.objects.get(name='cat 1') >>> c.name = 'zzz cat 1' >>> c.save() >>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) ['category 2', 'zzz cat 1'] >>> to_str([c.name for c in Category.objects.all().order_by('name')]) ['category 2', 'zzz cat 1'] >>> to_str([c.name for c in Category.objects.all().order_by('-name')]) ['zzz cat 1', 'category 2'] >>> set_default_language(2) >>> to_str([c.name for c in Category.objects.all().order_by('name')]) ['kat 1', 'kategoria 2'] >>> to_str([c.name for c in Category.objects.all().order_by('-name')]) ['kategoria 2', 'kat 1'] ### Check filtering # Check for filtering defined by Q objects as well. This is a recent # improvement: the translation fields are being handled by an # extension of lookup_inner instead of overridden # QuerySet._filter_or_exclude >>> set_default_language('en') >>> to_str([c.name for c in Category.objects.all().filter(name__contains='2')]) ['category 2'] >>> set_default_language('en') >>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='2'))]) ['category 2'] >>> set_default_language(1) >>> to_str([c.name for c in ... Category.objects.all().filter(Q(name__contains='2')|Q(name_pl__contains='kat'))]) ['zzz cat 1', 'category 2'] >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().filter(name_en__contains='2')]) ['category 2'] >>> set_default_language(1) >>> to_str([c.name for c in Category.objects.all().filter(Q(name_pl__contains='kat'))]) ['zzz cat 1', 'category 2'] >>> set_default_language('pl') >>> to_str([c.name for c in Category.objects.all().filter(name__contains='k')]) ['kat 1', 'kategoria 2'] >>> set_default_language('pl') >>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='kategoria'))]) ['kategoria 2'] ### Check specifying query set language >>> c_en = Category.objects.all().for_language('en') >>> c_pl = Category.objects.all().for_language(2) # both ID and code work here >>> to_str(c_en.get(name__contains='1').name) 'zzz cat 1' >>> to_str(c_pl.get(name__contains='1').name) 'kat 1' >>> to_str([c.name for c in c_en.order_by('name')]) ['category 2', 'zzz cat 1'] >>> to_str([c.name for c in c_pl.order_by('-name')]) ['kategoria 2', 'kat 1'] >>> c = c_en.get(id=1) >>> c.name = 'test' >>> to_str((c.name, c.name_en, c.name_pl)) ('test', 'test', 'kat 1') >>> c = c_pl.get(id=1) >>> c.name = 'test' >>> to_str((c.name, c.name_en, c.name_pl)) ('test', 'zzz cat 1', 'test') ### Check filtering spanning more than one model >>> set_default_language(1) >>> cat_1 = Category.objects.get(name='zzz cat 1') >>> cat_2 = Category.objects.get(name='category 2') >>> a = Article(category=cat_1) >>> a.set_title('article 1', 1) >>> a.set_title('artykul 1', 2) >>> a.set_contents('contents 1', 1) >>> a.set_contents('zawartosc 1', 1) >>> a.save() >>> a = Article(category=cat_2) >>> a.set_title('article 2', 1) >>> a.set_title('artykul 2', 2) >>> a.set_contents('contents 2', 1) >>> a.set_contents('zawartosc 2', 1) >>> a.save() >>> to_str([a.title for a in Article.objects.filter(category=cat_1)]) ['article 1'] >>> to_str([a.title for a in Article.objects.filter(category__name=cat_1.name)]) ['article 1'] >>> to_str([a.title for a in Article.objects.filter(Q(category__name=cat_1.name)|Q(category__name_pl__contains='2')).order_by('-title')]) ['article 2', 'article 1'] ### Test the creation of new objects using keywords passed to the ### constructor >>> set_default_language(2) >>> c_n = Category.objects.create(name_en='new category', name_pl='nowa kategoria') >>> to_str((c_n.name, c_n.name_en, c_n.name_pl)) ('nowa kategoria', 'new category', 'nowa kategoria') >>> c_n.save() >>> c_n2 = Category.objects.get(name_en='new category') >>> to_str((c_n2.name, c_n2.name_en, c_n2.name_pl)) ('nowa kategoria', 'new category', 'nowa kategoria') >>> set_default_language(2) >>> c_n3 = Category.objects.create(name='nowa kategoria 2') >>> to_str((c_n3.name, c_n3.name_en, c_n3.name_pl)) ('nowa kategoria 2', None, 'nowa kategoria 2') """ from django.db import models from django.contrib.auth.models import User import multilingual try: from django.utils.translation import ugettext as _ except: # if this fails then _ is a builtin pass class Category(models.Model): """ Test model for multilingual content: a simplified Category. """ # First, some fields that do not need translations creator = models.ForeignKey(User, verbose_name=_("Created by"), blank=True, null=True) created = models.DateTimeField(verbose_name=_("Created at"), auto_now_add=True) parent = models.ForeignKey('self', verbose_name=_("Parent category"), blank=True, null=True) # And now the translatable fields class Translation(multilingual.Translation): """ The definition of translation model. The multilingual machinery will automatically add these to the Category class: * get_name(language_id=None) * set_name(value, language_id=None) * get_description(language_id=None) * set_description(value, language_id=None) * name and description properties using the methods above """ name = models.CharField(verbose_name=_("The name"), - blank=True, null=False, maxlength=250) + maxlength=250) description = models.TextField(verbose_name=_("The description"), blank=True, null=False) + class Meta: + db_table = 'category_language' + def get_absolute_url(self): return "/" + str(self.id) + "/" def __unicode__(self): # note that you can use name and description fields as usual try: return str(self.name) except multilingual.TranslationDoesNotExist: return "-not-available-" def __str__(self): # compatibility return str(self.__unicode__()) class Admin: # Again, field names would just work here, but if you need # correct list headers (from field.verbose_name) you have to # use the get_'field_name' functions here. # Note: this Admin class does not do anything in newforms-admin list_display = ('id', 'creator', 'created', 'name', 'description') search_fields = ('name', 'description') class Meta: verbose_name_plural = 'categories' ordering = ('id',) class CustomArticleManager(multilingual.Manager): pass class Article(models.Model): """ Test model for multilingual content: a simplified article belonging to a single category. """ # non-translatable fields first creator = models.ForeignKey(User, verbose_name=_("Created by"), blank=True, null=True) created = models.DateTimeField(verbose_name=_("Created at"), auto_now_add=True) category = models.ForeignKey(Category, verbose_name=_("Parent category"), blank=True, null=True) objects = CustomArticleManager() # And now the translatable fields class Translation(multilingual.Translation): title = models.CharField(verbose_name=_("The title"), blank=True, null=False, maxlength=250) contents = models.TextField(verbose_name=_("The contents"), blank=True, null=False) from multilingual.compat import IS_NEWFORMS_ADMIN if IS_NEWFORMS_ADMIN: from django.contrib import admin admin.site.register(Article) admin.site.register(Category)
stefanfoulis/django-multilingual
7471e5f9fd26f864440f983bd4dfbb9482054813
Fixed db_table bug introduced in previous change.
diff --git a/multilingual/translation.py b/multilingual/translation.py index 99a0ec0..e7255b1 100644 --- a/multilingual/translation.py +++ b/multilingual/translation.py @@ -1,386 +1,387 @@ """ Support for models' internal Translation class. """ ## TO DO: this is messy and needs to be cleaned up from django.db import models from django.db.models.base import ModelBase from django.dispatch.dispatcher import connect from django.core.exceptions import ObjectDoesNotExist from django.db.models import signals from multilingual.languages import * from multilingual.exceptions import TranslationDoesNotExist from multilingual.fields import TranslationForeignKey from multilingual.manipulators import add_multilingual_manipulators from multilingual import manager from multilingual.compat import IS_NEWFORMS_ADMIN if IS_NEWFORMS_ADMIN: from django.contrib.admin import StackedInline, ModelAdmin class MultilingualStackedInline(StackedInline): template = "admin/edit_inline_translations_newforms.html" else: from django.contrib.admin.templatetags.admin_modify import StackedBoundRelatedObject class TransBoundRelatedObject(StackedBoundRelatedObject): """ This class changes the template for translation objects. """ def template_name(self): return "admin/edit_inline_translations.html" def translation_save_translated_fields(instance, **kwargs): """ Save all the translations of instance in post_save signal handler. """ if not hasattr(instance, '_translation_cache'): return for l_id, translation in instance._translation_cache.iteritems(): # set the translation ID just in case the translation was # created while instance was not stored in the DB yet translation.master_id = instance.id translation.save() def translation_overwrite_previous(instance, **kwargs): """ Delete previously existing translation with the same master and language_id values. To be called by translation model's pre_save signal. This most probably means I am abusing something here trying to use Django inline editor. Oh well, it will have to go anyway when we move to newforms. """ qs = instance.__class__.objects try: qs = qs.filter(master=instance.master).filter(language_id=instance.language_id) qs.delete() except ObjectDoesNotExist: # We are probably loading a fixture that defines translation entities - # before their master entity. + # before their master entity. pass def fill_translation_cache(instance): """ Fill the translation cache using information received in the instance objects as extra fields. You can not do this in post_init because the extra fields are assigned by QuerySet.iterator after model initialization. """ if hasattr(instance, '_translation_cache'): # do not refill the cache return instance._translation_cache = {} for language_id in get_language_id_list(): # see if translation for language_id was in the query field_alias = get_translated_field_alias('id', language_id) if getattr(instance, field_alias, None) is not None: field_names = [f.attname for f in instance._meta.translation_model._meta.fields] # if so, create a translation object and put it in the cache field_data = {} for fname in field_names: field_data[fname] = getattr(instance, get_translated_field_alias(fname, language_id)) translation = instance._meta.translation_model(**field_data) instance._translation_cache[language_id] = translation # In some situations an (existing in the DB) object is loaded # without using the normal QuerySet. In such case fallback to # loading the translations using a separate query. # Unfortunately, this is indistinguishable from the situation when # an object does not have any translations. Oh well, we'll have # to live with this for the time being. if len(instance._translation_cache.keys()) == 0: for translation in instance.translations.all(): instance._translation_cache[translation.language_id] = translation class TranslatedFieldProxy(property): def __init__(self, field_name, alias, field, language_id=None): self.field_name = field_name self.field = field self.admin_order_field = alias self.language_id = language_id def __get__(self, obj, objtype=None): if obj is None: return self return getattr(obj, 'get_' + self.field_name)(self.language_id) def __set__(self, obj, value): language_id = self.language_id return getattr(obj, 'set_' + self.field_name)(value, self.language_id) short_description = property(lambda self: self.field.short_description) def getter_generator(field_name, short_description): """ Generate get_'field name' method for field field_name. """ def get_translation_field(self, language_id_or_code=None): try: return getattr(self.get_translation(language_id_or_code), field_name) except TranslationDoesNotExist: return None get_translation_field.short_description = short_description return get_translation_field def setter_generator(field_name): """ Generate set_'field name' method for field field_name. """ def set_translation_field(self, value, language_id_or_code=None): setattr(self.get_translation(language_id_or_code, True), field_name, value) set_translation_field.short_description = "set " + field_name return set_translation_field def get_translation(self, language_id_or_code, create_if_necessary=False): """ Get a translation instance for the given language_id_or_code. If it does not exist, either create one or raise the TranslationDoesNotExist exception, depending on the create_if_necessary argument. """ # fill the cache if necessary self.fill_translation_cache() language_id = get_language_id_from_id_or_code(language_id_or_code, False) if language_id is None: language_id = getattr(self, '_default_language', None) if language_id is None: language_id = get_default_language() if language_id not in self._translation_cache: if not create_if_necessary: raise TranslationDoesNotExist(language_id) new_translation = self._meta.translation_model(master=self, language_id=language_id) self._translation_cache[language_id] = new_translation return self._translation_cache.get(language_id, None) class Translation: """ A superclass for translatablemodel.Translation inner classes. """ def contribute_to_class(cls, main_cls, name): """ Handle the inner 'Translation' class. """ # delay the creation of the *Translation until the master model is # fully created connect(cls.finish_multilingual_class, signal=signals.class_prepared, sender=main_cls, weak=False) # connect the post_save signal on master class to a handler # that saves translations connect(translation_save_translated_fields, signal=signals.post_save, sender=main_cls) contribute_to_class = classmethod(contribute_to_class) def create_translation_attrs(cls, main_cls): """ Creates get_'field name'(language_id) and set_'field name'(language_id) methods for all the translation fields. Adds the 'field name' properties too. Returns the translated_fields hash used in field lookups, see multilingual.query. It maps field names to (field, language_id) tuples. """ translated_fields = {} for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): translated_fields[fname] = (field, None) # add get_'fname' and set_'fname' methods to main_cls getter = getter_generator(fname, getattr(field, 'verbose_name', fname)) setattr(main_cls, 'get_' + fname, getter) setter = setter_generator(fname) setattr(main_cls, 'set_' + fname, setter) # add the 'fname' proxy property that allows reads # from and writing to the appropriate translation setattr(main_cls, fname, TranslatedFieldProxy(fname, fname, field)) # create the 'fname'_'language_code' proxy properties for language_id in get_language_id_list(): language_code = get_language_code(language_id) fname_lng = fname + '_' + language_code translated_fields[fname_lng] = (field, language_id) setattr(main_cls, fname_lng, TranslatedFieldProxy(fname, fname_lng, field, language_id)) return translated_fields create_translation_attrs = classmethod(create_translation_attrs) def get_unique_fields(cls): """ Return a list of fields with "unique" attribute, which needs to be augmented by the language. """ unique_fields = [] for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): if getattr(field,'unique',False): field.unique = False unique_fields.append(fname) return unique_fields get_unique_fields = classmethod(get_unique_fields) def finish_multilingual_class(cls, *args, **kwargs): """ Create a model with translations of a multilingual class. """ main_cls = kwargs['sender'] translation_model_name = main_cls.__name__ + "Translation" # create the model with all the translatable fields unique = [('language_id', 'master')] for f in cls.get_unique_fields(): unique.append(('language_id',f)) class TransMeta: pass try: meta = cls.Meta except AttributeError: meta = TransMeta + meta.ordering = ('language_id',) meta.unique_together = tuple(unique) meta.app_label = main_cls._meta.app_label if not hasattr(meta, 'db_table'): - db_table = main_cls._meta.db_table + '_translation' - + meta.db_table = main_cls._meta.db_table + '_translation' + trans_attrs = cls.__dict__.copy() trans_attrs['Meta'] = meta trans_attrs['language_id'] = models.IntegerField(blank=False, null=False, core=True, choices=get_language_choices(), db_index=True) if IS_NEWFORMS_ADMIN: edit_inline = True else: edit_inline = TransBoundRelatedObject trans_attrs['master'] = TranslationForeignKey(main_cls, blank=False, null=False, edit_inline=edit_inline, related_name='translations', num_in_admin=get_language_count(), min_num_in_admin=get_language_count(), num_extra_on_change=0) trans_attrs['__str__'] = lambda self: ("%s object, language_code=%s" % (translation_model_name, get_language_code(self.language_id))) trans_model = ModelBase(translation_model_name, (models.Model,), trans_attrs) trans_model._meta.translated_fields = cls.create_translation_attrs(main_cls) main_cls._meta.translation_model = trans_model main_cls.get_translation = get_translation main_cls.fill_translation_cache = fill_translation_cache # Note: don't fill the translation cache in post_init, as all # the extra values selected by QAddTranslationData will be # assigned AFTER init() # connect(fill_translation_cache, signal=signals.post_init, # sender=main_cls) # connect the pre_save signal on translation class to a # function removing previous translation entries. connect(translation_overwrite_previous, signal=signals.pre_save, sender=trans_model, weak=False) finish_multilingual_class = classmethod(finish_multilingual_class) def install_translation_library(): # modify ModelBase.__new__ so that it understands how to handle the # 'Translation' inner class if getattr(ModelBase, '_multilingual_installed', False): # don't install it twice return _old_new = ModelBase.__new__ def multilingual_modelbase_new(cls, name, bases, attrs): if 'Translation' in attrs: if not issubclass(attrs['Translation'], Translation): raise ValueError, ("%s.Translation must be a subclass " + " of multilingual.Translation.") % (name,) # Make sure that if the class specifies objects then it is # a subclass of our Manager. # # Don't check other managers since someone might want to # have a non-multilingual manager, but assigning a # non-multilingual manager to objects would be a common # mistake. if ('objects' in attrs) and (not isinstance(attrs['objects'], manager.Manager)): raise ValueError, ("Model %s specifies translations, " + "so its 'objects' manager must be " + "a subclass of multilingual.Manager.") % (name,) # Change the default manager to multilingual.Manager. if not 'objects' in attrs: attrs['objects'] = manager.Manager() # Override the admin manager as well, or the admin views will # not see the translation data. if 'Admin' in attrs: attrs['Admin'].manager = attrs['objects'] # Install a hack to let add_multilingual_manipulators know # this is a translatable model attrs['is_translation_model'] = lambda self: True return _old_new(cls, name, bases, attrs) ModelBase.__new__ = staticmethod(multilingual_modelbase_new) ModelBase._multilingual_installed = True if IS_NEWFORMS_ADMIN: # Override ModelAdmin.__new__ to create automatic inline # editor for multilingual models. class MultiType(type): pass _old_admin_new = ModelAdmin.__new__ def multilingual_modeladmin_new(cls, model, admin_site): if isinstance(model.objects, manager.Manager): X = MultiType('X',(MultilingualStackedInline,), {'model':model._meta.translation_model, 'fk_name':'master', 'extra':get_language_count(), 'max_num':get_language_count()}) if cls.inlines: for inline in cls.inlines: if X.__class__ == inline.__class__: cls.inlines.remove(inline) break cls.inlines.append(X) else: cls.inlines = [X] return _old_admin_new(cls, model, admin_site) ModelAdmin.__new__ = staticmethod(multilingual_modeladmin_new) # install the library install_translation_library()
stefanfoulis/django-multilingual
d103754cd34324bc7c9c802babc921e5d8b4c1c3
Use inner Translation.Meta class if present.
diff --git a/multilingual/translation.py b/multilingual/translation.py index e4803c6..99a0ec0 100644 --- a/multilingual/translation.py +++ b/multilingual/translation.py @@ -1,379 +1,386 @@ """ Support for models' internal Translation class. """ ## TO DO: this is messy and needs to be cleaned up from django.db import models from django.db.models.base import ModelBase from django.dispatch.dispatcher import connect from django.core.exceptions import ObjectDoesNotExist from django.db.models import signals from multilingual.languages import * from multilingual.exceptions import TranslationDoesNotExist from multilingual.fields import TranslationForeignKey from multilingual.manipulators import add_multilingual_manipulators from multilingual import manager from multilingual.compat import IS_NEWFORMS_ADMIN if IS_NEWFORMS_ADMIN: from django.contrib.admin import StackedInline, ModelAdmin class MultilingualStackedInline(StackedInline): template = "admin/edit_inline_translations_newforms.html" else: from django.contrib.admin.templatetags.admin_modify import StackedBoundRelatedObject class TransBoundRelatedObject(StackedBoundRelatedObject): """ This class changes the template for translation objects. """ def template_name(self): return "admin/edit_inline_translations.html" def translation_save_translated_fields(instance, **kwargs): """ Save all the translations of instance in post_save signal handler. """ if not hasattr(instance, '_translation_cache'): return for l_id, translation in instance._translation_cache.iteritems(): # set the translation ID just in case the translation was # created while instance was not stored in the DB yet translation.master_id = instance.id translation.save() def translation_overwrite_previous(instance, **kwargs): """ Delete previously existing translation with the same master and language_id values. To be called by translation model's pre_save signal. This most probably means I am abusing something here trying to use Django inline editor. Oh well, it will have to go anyway when we move to newforms. """ qs = instance.__class__.objects try: qs = qs.filter(master=instance.master).filter(language_id=instance.language_id) qs.delete() except ObjectDoesNotExist: # We are probably loading a fixture that defines translation entities # before their master entity. pass def fill_translation_cache(instance): """ Fill the translation cache using information received in the instance objects as extra fields. You can not do this in post_init because the extra fields are assigned by QuerySet.iterator after model initialization. """ if hasattr(instance, '_translation_cache'): # do not refill the cache return instance._translation_cache = {} for language_id in get_language_id_list(): # see if translation for language_id was in the query field_alias = get_translated_field_alias('id', language_id) if getattr(instance, field_alias, None) is not None: field_names = [f.attname for f in instance._meta.translation_model._meta.fields] # if so, create a translation object and put it in the cache field_data = {} for fname in field_names: field_data[fname] = getattr(instance, get_translated_field_alias(fname, language_id)) translation = instance._meta.translation_model(**field_data) instance._translation_cache[language_id] = translation # In some situations an (existing in the DB) object is loaded # without using the normal QuerySet. In such case fallback to # loading the translations using a separate query. # Unfortunately, this is indistinguishable from the situation when # an object does not have any translations. Oh well, we'll have # to live with this for the time being. if len(instance._translation_cache.keys()) == 0: for translation in instance.translations.all(): instance._translation_cache[translation.language_id] = translation class TranslatedFieldProxy(property): def __init__(self, field_name, alias, field, language_id=None): self.field_name = field_name self.field = field self.admin_order_field = alias self.language_id = language_id def __get__(self, obj, objtype=None): if obj is None: return self return getattr(obj, 'get_' + self.field_name)(self.language_id) def __set__(self, obj, value): language_id = self.language_id return getattr(obj, 'set_' + self.field_name)(value, self.language_id) short_description = property(lambda self: self.field.short_description) def getter_generator(field_name, short_description): """ Generate get_'field name' method for field field_name. """ def get_translation_field(self, language_id_or_code=None): try: return getattr(self.get_translation(language_id_or_code), field_name) except TranslationDoesNotExist: return None get_translation_field.short_description = short_description return get_translation_field def setter_generator(field_name): """ Generate set_'field name' method for field field_name. """ def set_translation_field(self, value, language_id_or_code=None): setattr(self.get_translation(language_id_or_code, True), field_name, value) set_translation_field.short_description = "set " + field_name return set_translation_field def get_translation(self, language_id_or_code, create_if_necessary=False): """ Get a translation instance for the given language_id_or_code. If it does not exist, either create one or raise the TranslationDoesNotExist exception, depending on the create_if_necessary argument. """ # fill the cache if necessary self.fill_translation_cache() language_id = get_language_id_from_id_or_code(language_id_or_code, False) if language_id is None: language_id = getattr(self, '_default_language', None) if language_id is None: language_id = get_default_language() if language_id not in self._translation_cache: if not create_if_necessary: raise TranslationDoesNotExist(language_id) new_translation = self._meta.translation_model(master=self, language_id=language_id) self._translation_cache[language_id] = new_translation return self._translation_cache.get(language_id, None) class Translation: """ A superclass for translatablemodel.Translation inner classes. """ def contribute_to_class(cls, main_cls, name): """ Handle the inner 'Translation' class. """ # delay the creation of the *Translation until the master model is # fully created connect(cls.finish_multilingual_class, signal=signals.class_prepared, sender=main_cls, weak=False) # connect the post_save signal on master class to a handler # that saves translations connect(translation_save_translated_fields, signal=signals.post_save, sender=main_cls) contribute_to_class = classmethod(contribute_to_class) def create_translation_attrs(cls, main_cls): """ Creates get_'field name'(language_id) and set_'field name'(language_id) methods for all the translation fields. Adds the 'field name' properties too. Returns the translated_fields hash used in field lookups, see multilingual.query. It maps field names to (field, language_id) tuples. """ translated_fields = {} for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): translated_fields[fname] = (field, None) # add get_'fname' and set_'fname' methods to main_cls getter = getter_generator(fname, getattr(field, 'verbose_name', fname)) setattr(main_cls, 'get_' + fname, getter) setter = setter_generator(fname) setattr(main_cls, 'set_' + fname, setter) # add the 'fname' proxy property that allows reads # from and writing to the appropriate translation setattr(main_cls, fname, TranslatedFieldProxy(fname, fname, field)) # create the 'fname'_'language_code' proxy properties for language_id in get_language_id_list(): language_code = get_language_code(language_id) fname_lng = fname + '_' + language_code translated_fields[fname_lng] = (field, language_id) setattr(main_cls, fname_lng, TranslatedFieldProxy(fname, fname_lng, field, language_id)) return translated_fields create_translation_attrs = classmethod(create_translation_attrs) def get_unique_fields(cls): """ Return a list of fields with "unique" attribute, which needs to be augmented by the language. """ unique_fields = [] for fname, field in cls.__dict__.items(): if isinstance(field, models.fields.Field): if getattr(field,'unique',False): field.unique = False unique_fields.append(fname) return unique_fields get_unique_fields = classmethod(get_unique_fields) def finish_multilingual_class(cls, *args, **kwargs): """ Create a model with translations of a multilingual class. """ main_cls = kwargs['sender'] translation_model_name = main_cls.__name__ + "Translation" # create the model with all the translatable fields unique = [('language_id', 'master')] for f in cls.get_unique_fields(): unique.append(('language_id',f)) class TransMeta: - ordering = ('language_id',) - unique_together = tuple(unique) + pass + + try: + meta = cls.Meta + except AttributeError: + meta = TransMeta + meta.ordering = ('language_id',) + meta.unique_together = tuple(unique) + meta.app_label = main_cls._meta.app_label + if not hasattr(meta, 'db_table'): db_table = main_cls._meta.db_table + '_translation' - app_label = main_cls._meta.app_label trans_attrs = cls.__dict__.copy() - trans_attrs['Meta'] = TransMeta + trans_attrs['Meta'] = meta trans_attrs['language_id'] = models.IntegerField(blank=False, null=False, core=True, choices=get_language_choices(), db_index=True) if IS_NEWFORMS_ADMIN: edit_inline = True else: edit_inline = TransBoundRelatedObject trans_attrs['master'] = TranslationForeignKey(main_cls, blank=False, null=False, edit_inline=edit_inline, related_name='translations', num_in_admin=get_language_count(), min_num_in_admin=get_language_count(), num_extra_on_change=0) trans_attrs['__str__'] = lambda self: ("%s object, language_code=%s" % (translation_model_name, get_language_code(self.language_id))) trans_model = ModelBase(translation_model_name, (models.Model,), trans_attrs) trans_model._meta.translated_fields = cls.create_translation_attrs(main_cls) main_cls._meta.translation_model = trans_model main_cls.get_translation = get_translation main_cls.fill_translation_cache = fill_translation_cache # Note: don't fill the translation cache in post_init, as all # the extra values selected by QAddTranslationData will be # assigned AFTER init() # connect(fill_translation_cache, signal=signals.post_init, # sender=main_cls) # connect the pre_save signal on translation class to a # function removing previous translation entries. connect(translation_overwrite_previous, signal=signals.pre_save, sender=trans_model, weak=False) finish_multilingual_class = classmethod(finish_multilingual_class) def install_translation_library(): # modify ModelBase.__new__ so that it understands how to handle the # 'Translation' inner class if getattr(ModelBase, '_multilingual_installed', False): # don't install it twice return _old_new = ModelBase.__new__ def multilingual_modelbase_new(cls, name, bases, attrs): if 'Translation' in attrs: if not issubclass(attrs['Translation'], Translation): raise ValueError, ("%s.Translation must be a subclass " + " of multilingual.Translation.") % (name,) # Make sure that if the class specifies objects then it is # a subclass of our Manager. # # Don't check other managers since someone might want to # have a non-multilingual manager, but assigning a # non-multilingual manager to objects would be a common # mistake. if ('objects' in attrs) and (not isinstance(attrs['objects'], manager.Manager)): raise ValueError, ("Model %s specifies translations, " + "so its 'objects' manager must be " + "a subclass of multilingual.Manager.") % (name,) # Change the default manager to multilingual.Manager. if not 'objects' in attrs: attrs['objects'] = manager.Manager() # Override the admin manager as well, or the admin views will # not see the translation data. if 'Admin' in attrs: attrs['Admin'].manager = attrs['objects'] # Install a hack to let add_multilingual_manipulators know # this is a translatable model attrs['is_translation_model'] = lambda self: True return _old_new(cls, name, bases, attrs) ModelBase.__new__ = staticmethod(multilingual_modelbase_new) ModelBase._multilingual_installed = True if IS_NEWFORMS_ADMIN: # Override ModelAdmin.__new__ to create automatic inline # editor for multilingual models. class MultiType(type): pass _old_admin_new = ModelAdmin.__new__ def multilingual_modeladmin_new(cls, model, admin_site): if isinstance(model.objects, manager.Manager): X = MultiType('X',(MultilingualStackedInline,), {'model':model._meta.translation_model, 'fk_name':'master', 'extra':get_language_count(), 'max_num':get_language_count()}) if cls.inlines: for inline in cls.inlines: if X.__class__ == inline.__class__: cls.inlines.remove(inline) break cls.inlines.append(X) else: cls.inlines = [X] return _old_admin_new(cls, model, admin_site) ModelAdmin.__new__ = staticmethod(multilingual_modeladmin_new) # install the library install_translation_library()
stefanfoulis/django-multilingual
26bd0564faeb93a4e43cc60267d5a22a2249e1c2
Ignore non-existent translation row when replacing. Fixes issue 39.
diff --git a/multilingual/__init__.py b/multilingual/__init__.py new file mode 100644 index 0000000..ed6a5b6 --- /dev/null +++ b/multilingual/__init__.py @@ -0,0 +1,9 @@ +""" +Django-multilingual: multilingual model support for Django. +""" + +from multilingual import models +from multilingual.exceptions import TranslationDoesNotExist, LanguageDoesNotExist +from multilingual.languages import set_default_language, get_default_language, get_language_code_list +from multilingual.translation import Translation +from multilingual.manager import Manager diff --git a/multilingual/compat.py b/multilingual/compat.py new file mode 100644 index 0000000..4f11943 --- /dev/null +++ b/multilingual/compat.py @@ -0,0 +1,13 @@ +""" +Code that allows DM to be compatible with various Django versions. +""" + +# check whether Django is from the newforms-admin branch +IS_NEWFORMS_ADMIN = False + +try: + # try to import a class that is no longer present in the + # newforms-admin branch + from django.contrib.admin.templatetags.admin_modify import StackedBoundRelatedObject +except ImportError: + IS_NEWFORMS_ADMIN = True diff --git a/multilingual/context_processors.py b/multilingual/context_processors.py new file mode 100644 index 0000000..46e919d --- /dev/null +++ b/multilingual/context_processors.py @@ -0,0 +1,8 @@ +from multilingual.languages import get_language_code_list, get_default_language_code + +def multilingual(request): + """ + Returns context variables containing information about available languages. + """ + return {'LANGUAGE_CODES': get_language_code_list(), + 'DEFAULT_LANGUAGE_CODE': get_default_language_code()} diff --git a/multilingual/exceptions.py b/multilingual/exceptions.py new file mode 100644 index 0000000..e5c16f3 --- /dev/null +++ b/multilingual/exceptions.py @@ -0,0 +1,11 @@ +class TranslationDoesNotExist(Exception): + """ + The requested translation does not exist + """ + pass + +class LanguageDoesNotExist(Exception): + """ + The requested language does not exist + """ + pass diff --git a/multilingual/fields.py b/multilingual/fields.py new file mode 100644 index 0000000..f2e292d --- /dev/null +++ b/multilingual/fields.py @@ -0,0 +1,38 @@ +from django.db import models +from django.db.models.related import RelatedObject +from multilingual.languages import get_language_id_list,get_language_count + +def get_list(self, parent_instance=None): + """ + An ugly way to override RelatedObject.get_list for some objects. + This is the only way to do it right now because a reference to + RelatedObject class is hardcoded in db.models.options, but ideally + there should be a way to specify your own RelatedObject subclass. + """ + the_list = _old_get_list(self, parent_instance) + + # this check is ugly, will be changed + if not hasattr(self.model._meta, 'translated_fields'): + return the_list + + # 1. find corresponding language for each entry + + entries_with_lang = {} + for entry in the_list: + if entry is not None: + entries_with_lang[entry.language_id] = entry + + # 2. reorder the entries according to what you found in #1 + + new_list = [] + for language_id in get_language_id_list(): + new_list.append(entries_with_lang.get(language_id, None)) + return new_list + +_old_get_list = RelatedObject.get_list +RelatedObject.get_list = get_list + +class TranslationForeignKey(models.ForeignKey): + """ + """ + pass diff --git a/multilingual/languages.py b/multilingual/languages.py new file mode 100644 index 0000000..55d1c97 --- /dev/null +++ b/multilingual/languages.py @@ -0,0 +1,121 @@ +""" +Django-multilingual: language-related settings and functions. +""" + +# Note: this file did become a mess and will have to be refactored +# after the configuration changes get in place. + +#retrieve language settings from settings.py +from django.conf import settings +LANGUAGES = settings.LANGUAGES + +try: + from django.utils.translation import ugettext_lazy as _ +except ImportError: + # Implicitely imported before changeset 6582 + pass + +from multilingual.exceptions import LanguageDoesNotExist + +try: + from threading import local +except ImportError: + from django.utils._threading_local import local + +thread_locals = local() + +def get_language_count(): + return len(LANGUAGES) + +def get_language_code(language_id): + return LANGUAGES[(int(language_id or get_default_language())) - 1][0] + +def get_language_name(language_id): + return _(LANGUAGES[(int(language_id or get_default_language())) - 1][1]) + +def get_language_bidi(language_id): + return get_language_code(language_id) in settings.LANGUAGES_BIDI + +def get_language_id_list(): + return range(1, get_language_count() + 1) + +def get_language_code_list(): + return [lang[0] for lang in LANGUAGES] + +def get_language_choices(): + return [(language_id, get_language_code(language_id)) + for language_id in get_language_id_list()] + +def get_language_id_from_id_or_code(language_id_or_code, use_default=True): + if language_id_or_code is None: + if use_default: + return get_default_language() + else: + return None + + if isinstance(language_id_or_code, int): + return language_id_or_code + + i = 0 + for (code, desc) in LANGUAGES: + i += 1 + if code == language_id_or_code: + return i + raise LanguageDoesNotExist(language_id_or_code) + +def get_language_idx(language_id_or_code): + # to do: optimize + language_id = get_language_id_from_id_or_code(language_id_or_code) + return get_language_id_list().index(language_id) + +def set_default_language(language_id_or_code): + """ + Set the default language for the whole translation mechanism. + + Accepts language codes or IDs. + """ + language_id = get_language_id_from_id_or_code(language_id_or_code) + thread_locals.DEFAULT_LANGUAGE = language_id + +def get_default_language(): + """ + Return the language ID set by set_default_language. + """ + return getattr(thread_locals, 'DEFAULT_LANGUAGE', + settings.DEFAULT_LANGUAGE) + +def get_default_language_code(): + """ + Return the language code of language ID set by set_default_language. + """ + language_id = get_language_id_from_id_or_code(get_default_language()) + return get_language_code(language_id) + +def _to_db_identifier(name): + """ + Convert name to something that is usable as a field name or table + alias in SQL. + + For the time being assume that the only possible problem with name + is the presence of dashes. + """ + return name.replace('-', '_') + +def get_translation_table_alias(translation_table_name, language_id): + """ + Return an alias for the translation table for a given language_id. + Used in SQL queries. + """ + return (translation_table_name + + '_' + + _to_db_identifier(get_language_code(language_id))) + +def get_translated_field_alias(field_name, language_id=None): + """ + Return an alias for field_name field for a given language_id. + Used in SQL queries. + """ + return ('_trans_' + + field_name + + '_' + _to_db_identifier(get_language_code(language_id))) + diff --git a/multilingual/manager.py b/multilingual/manager.py new file mode 100644 index 0000000..0abcdb8 --- /dev/null +++ b/multilingual/manager.py @@ -0,0 +1,26 @@ +from django.db import models +from multilingual.query import MultilingualModelQuerySet, QAddTranslationData +from multilingual.languages import * + +class Manager(models.Manager): + """ + A manager for multilingual models. + + TO DO: turn this into a proxy manager that would allow developers + to use any manager they need. It should be sufficient to extend + and additionaly filter or order querysets returned by that manager. + """ + + def get_query_set(self): + translation_model = self.model._meta.translation_model + select = {} + for language_id in get_language_id_list(): + for fname in [f.attname for f in translation_model._meta.fields]: + trans_table_name = translation_model._meta.db_table + table_alias = get_translation_table_alias(trans_table_name, language_id) + field_alias = get_translated_field_alias(fname, language_id) + + select[field_alias] = table_alias + '.' + fname + + return MultilingualModelQuerySet(self.model).filter(QAddTranslationData()).extra(select=select) + diff --git a/multilingual/manipulators.py b/multilingual/manipulators.py new file mode 100644 index 0000000..907895a --- /dev/null +++ b/multilingual/manipulators.py @@ -0,0 +1,84 @@ +""" +Automatic add and change manipulators for translatable models. +""" + +import django.db.models.manipulators as django_manipulators + +from django.utils.functional import curry +from multilingual.languages import get_language_id_list + +class MultilingualManipulatorMixin: + def fix_translation_data(self, new_data): + """ + Update data before save to include necessary fields for + translations. + + This means adding language_id field for every translation. + """ + trans_model = self.model._meta.translation_model + lower_model_name = trans_model._meta.object_name.lower() + language_id_list = get_language_id_list() + for language_idx in range(0, len(language_id_list)): + name = "%s.%s.language_id" % (lower_model_name, + language_idx) + new_data[name] = language_id_list[language_idx] + +class MultilingualAddManipulator(django_manipulators.AutomaticAddManipulator, + MultilingualManipulatorMixin): + + def _prepare(cls,model): + super(MultilingualAddManipulator,cls)._prepare(model) + + # TODO: This code should test for translation-specific + # uniqueness constraints. + # Currently this is left to the database. + # TODO: Add isUnique attributes for any by-date uniqueness + # constraints. + + def ignore(*a): pass + for field_name_list in model._meta.translation_model._meta.unique_together: + setattr(cls, 'isUnique%s' % '_'.join(field_name_list), + ignore) + _prepare = classmethod(_prepare) + + def do_html2python(self, new_data): + self.fix_translation_data(new_data) + super(MultilingualAddManipulator, self).do_html2python(new_data) + +class MultilingualChangeManipulator(django_manipulators.AutomaticChangeManipulator, + MultilingualManipulatorMixin): + + def _prepare(cls,model): + super(MultilingualChangeManipulator,cls)._prepare(model) + + # As above. + def ignore(*a): pass + for field_name_list in model._meta.translation_model._meta.unique_together: + setattr(cls, 'isUnique%s' % '_'.join(field_name_list), + ignore) + _prepare = classmethod(_prepare) + + def do_html2python(self, new_data): + self.fix_translation_data(new_data) + super(MultilingualChangeManipulator, self).do_html2python(new_data) + +def add_multilingual_manipulators(sender): + """ + A replacement for django.db.models.manipulators that installs + multilingual manipulators for translatable models. + + It is supposed to be called from + Translation.finish_multilingual_class. + """ + cls = sender + if hasattr(cls, 'is_translation_model'): + cls.add_to_class('AddManipulator', MultilingualAddManipulator) + cls.add_to_class('ChangeManipulator', MultilingualChangeManipulator) + else: + django_manipulators.add_manipulators(sender) + +from django.dispatch import dispatcher +from django.db.models import signals + +dispatcher.disconnect(django_manipulators.add_manipulators, signal=signals.class_prepared) +dispatcher.connect(add_multilingual_manipulators, signal=signals.class_prepared) diff --git a/multilingual/middleware.py b/multilingual/middleware.py new file mode 100644 index 0000000..4b56151 --- /dev/null +++ b/multilingual/middleware.py @@ -0,0 +1,18 @@ +from django.utils.translation import get_language +from multilingual.exceptions import LanguageDoesNotExist +from multilingual.languages import set_default_language + +class DefaultLanguageMiddleware(object): + """ + Binds DEFAULT_LANGUAGE_CODE to django's currently selected language. + + The effect of enabling this middleware is that translated fields can be + accessed by their name; i.e. model.field instead of model.field_en. + """ + def process_request(self, request): + assert hasattr(request, 'session'), "The DefaultLanguageMiddleware middleware requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.sessions.middleware.SessionMiddleware'." + try: + set_default_language(get_language()) + except LanguageDoesNotExist: + # Try without the territory suffix + set_default_language(get_language()[:2]) diff --git a/multilingual/models.py b/multilingual/models.py new file mode 100644 index 0000000..0f2c2fd --- /dev/null +++ b/multilingual/models.py @@ -0,0 +1,17 @@ +""" +Multilingual model support. + +This code is put in multilingual.models to make Django execute it +during application initialization. + +TO DO: remove it. Right now multilingual must be imported directly +into any file that defines translatable models, so it will be +installed anyway. + +This module is here only to make it easier to upgrade from versions +that did not require TranslatableModel.Translation classes to subclass +multilingual.Translation to versions that do. +""" + +from translation import install_translation_library +install_translation_library() diff --git a/multilingual/query.py b/multilingual/query.py new file mode 100644 index 0000000..2ea4a5d --- /dev/null +++ b/multilingual/query.py @@ -0,0 +1,176 @@ +""" +Django-multilingual: a QuerySet subclass for models with translatable +fields. + +Also, a wrapper for lookup_inner that makes it possible to lookup via +translatable fields. +""" + +import django +from django.db import models, backend, connection +from django.db.models.query import QuerySet, get_where_clause +from django.utils.datastructures import SortedDict +from multilingual.languages import * + +old_lookup_inner = models.query.lookup_inner + +def new_lookup_inner(path, lookup_type, value, opts, table, column): + """ + Patch django.db.models.query.lookup_inner from the outside + to recognize the translation fields. + + Ideally this should go into lookup_inner. + """ + + # check if there is anything to do for us here. If not, send it + # all back to the original lookup_inner. + + if not hasattr(opts, 'translation_model'): + return old_lookup_inner(path, lookup_type, value, opts, table, column) + + translation_opts = opts.translation_model._meta + + # This hack adapts this mess + # to Django's "order_by for related tables" patch + if path[0] is not None and path[0].startswith("_trans_") and path[0][7:] in translation_opts.translated_fields: + path[0] = path[0][7:] + + if path[0] not in translation_opts.translated_fields: + return old_lookup_inner(path, lookup_type, value, opts, table, column) + + # If we got here then path[0] _is_ a translatable field (or a + # localised version of one) in a model with translations. + + joins, where, params = SortedDict(), [], [] + + name = path.pop(0) + current_table = table + field, language_id = translation_opts.translated_fields[name] + if language_id is None: + language_id = get_default_language() + translation_table = get_translation_table_alias(translation_opts.db_table, + language_id) + new_table = (current_table + "__" + translation_table) + + # add the join necessary for the current step + try: + qn = backend.quote_name + except AttributeError: + qn = connection.ops.quote_name + condition = ('((%s.master_id = %s.id) AND (%s.language_id = %s))' + % (new_table, current_table, new_table, language_id)) + joins[qn(new_table)] = (qn(translation_opts.db_table), 'LEFT JOIN', condition) + + if path: + joins2, where2, params2 = \ + models.query.lookup_inner(path, lookup_type, + value, + translation_opts, + new_table, + translation_opts.pk.column) + joins.update(joins2) + where.extend(where2) + params.extend(params2) + else: + trans_table_name = opts.translation_model._meta.db_table + if (django.VERSION[0] >= 1) or (django.VERSION[1] >= 97): + # BACKWARDS_COMPATIBILITY_HACK + # The get_where_clause function got another parameter as of Django rev + # #5943, see here: http://code.djangoproject.com/changeset/5943 + + # This change happened when 0.97.pre was the current trunk + # and there is no sure way to detect whether your version + # requires the new parameter or not, so I will not try to + # guess. If you use 0.97.* make sure you have a pretty + # recent version or this line will fail. + where.append(get_where_clause(lookup_type, new_table + '.', + field.attname, value, + field.db_type())) + else: + # compatibility code for 0.96 + where.append(get_where_clause(lookup_type, new_table + '.', + field.attname, value)) + params.extend(field.get_db_prep_lookup(lookup_type, value)) + + return joins, where, params + +models.query.lookup_inner = new_lookup_inner + +class QAddTranslationData(object): + """ + Extend a queryset with joins and contitions necessary to pull all + the ML data. + """ + def get_sql(self, opts): + joins, where, params = SortedDict(), [], [] + + # create all the LEFT JOINS needed to read all the + # translations in one row + master_table_name = opts.db_table + trans_table_name = opts.translation_model._meta.db_table + for language_id in get_language_id_list(): + table_alias = get_translation_table_alias(trans_table_name, + language_id) + condition = ('((%s.master_id = %s.id) AND (%s.language_id = %s))' + % (table_alias, master_table_name, table_alias, + language_id)) + joins[table_alias] = (trans_table_name, 'LEFT JOIN', condition) + return joins, where, params + +class MultilingualModelQuerySet(QuerySet): + """ + A specialized QuerySet that knows how to handle translatable + fields in ordering and filtering methods. + """ + + def order_by(self, *field_names): + """ + Override order_by to rename some of the arguments + """ + translated_fields = self.model._meta.translation_model._meta.translated_fields + + new_field_names = [] + for field_name in field_names: + prefix = '' + if field_name[0] == '-': + prefix = '-' + field_name = field_name[1:] + + if field_name in translated_fields: + field, language_id = translated_fields[field_name] + if language_id is None: + language_id = getattr(self, '_default_language', None) + real_name = get_translated_field_alias(field.attname, + language_id) + new_field_names.append(prefix + real_name) + else: + new_field_names.append(prefix + field_name) + return super(MultilingualModelQuerySet, self).order_by(*new_field_names) + + def for_language(self, language_id_or_code): + """ + Set the default language for all objects returned with this + query. + """ + clone = self._clone() + clone._default_language = get_language_id_from_id_or_code(language_id_or_code) + return clone + + def iterator(self): + """ + Add the default language information to all returned objects. + """ + default_language = getattr(self, '_default_language', None) + + for obj in super(MultilingualModelQuerySet, self).iterator(): + obj._default_language = default_language + yield obj + + def _clone(self, klass=None, **kwargs): + """ + Override _clone to preserve additional information needed by + MultilingualModelQuerySet. + """ + clone = super(MultilingualModelQuerySet, self)._clone(klass, **kwargs) + clone._default_language = getattr(self, '_default_language', None) + return clone diff --git a/multilingual/templates/admin/edit_inline_translations.html b/multilingual/templates/admin/edit_inline_translations.html new file mode 100644 index 0000000..d9becee --- /dev/null +++ b/multilingual/templates/admin/edit_inline_translations.html @@ -0,0 +1,21 @@ +{% load admin_modify %} +{% load multilingual_tags %} +<fieldset class="module aligned"> + {% for fcw in bound_related_object.form_field_collection_wrappers %} + <h2>Language:&nbsp;{{ forloop.counter|language_name }}</h2> + {% if bound_related_object.show_url %}{% if fcw.obj.original %} + <p><a href="/r/{{ fcw.obj.original.content_type_id }}/{{ fcw.obj.original.id }}/">View on site</a></p> + {% endif %}{% endif %} + {% for bound_field in fcw.bound_fields %} + {% if bound_field.hidden %} + {% field_widget bound_field %} + {% else %} + {% ifequal bound_field.field.name "language_id" %} + <input type="hidden" name="{{ bound_field.form_fields.0.formfield.field_name }}" value="{{ forloop.parentloop.counter }}" /> + {% else %} + {% admin_field_line bound_field %} + {% endifequal %} + {% endif %} + {% endfor %} + {% endfor %} +</fieldset> diff --git a/multilingual/templates/admin/edit_inline_translations_newforms.html b/multilingual/templates/admin/edit_inline_translations_newforms.html new file mode 100644 index 0000000..c6c6677 --- /dev/null +++ b/multilingual/templates/admin/edit_inline_translations_newforms.html @@ -0,0 +1,21 @@ +{% load i18n %} +{% load multilingual_tags %} +<div class="inline-group"> +{{ inline_admin_formset.formset.management_form }} +{% for inline_admin_form in inline_admin_formset %} +<div class="inline-related {% if forloop.last %}last-related{% endif %}"> + <h2>Language:&nbsp;{{ forloop.counter|language_name }} + {% if inline_admin_formset.formset.deletable %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %} + </h2> + + {% if inline_admin_form.show_url %} + <p><a href="/r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a></p> + {% endif %} + + {% for fieldset in inline_admin_form %} + {% include "admin/fieldset.html" %} + {% endfor %} + {{ inline_admin_form.pk_field.field }} +</div> +{% endfor %} +</div> diff --git a/multilingual/templates/admin/fieldset.html b/multilingual/templates/admin/fieldset.html new file mode 100644 index 0000000..9948743 --- /dev/null +++ b/multilingual/templates/admin/fieldset.html @@ -0,0 +1,30 @@ +{% load multilingual_tags %} +<fieldset class="module aligned {{ fieldset.classes }}"> + {% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %} + {% if fieldset.description %}<div class="description">{{ fieldset.description }}</div>{% endif %} + {% for line in fieldset %} + <div class="form-row{% if line.errors %} errors{% endif %} {% for field in line %}{{ field.field.name }} {% endfor %} "> + {{ field.name }} + {{ line.errors }} + {% for field in line %} + {{ field.field. }} + {% if field.is_checkbox %} + {{ field.field }}{{ field.label_tag }} + {% else %} + {% ifequal field.field.name "language_id" %} + <input type="hidden" name="{{ field.field.html_name }}" + value="{{ forloop.parentloop.parentloop.parentloop.counter }}" /> + {% else %} + {{ field.label_tag }} + {% if forloop.parentloop.parentloop.parentloop.counter|language_bidi %} + <span style="direction: rtl; text-align: right;">{{ field.field }}</span> + {% else %} + <span style="direction: ltr; text-align: left;">{{ field.field }}</span> + {% endif %} + {% endifequal %} + {% endif %} + {% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text|safe }}</p>{% endif %} + {% endfor %} + </div> + {% endfor %} +</fieldset> \ No newline at end of file diff --git a/multilingual/templatetags/__init__.py b/multilingual/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/multilingual/templatetags/multilingual_tags.py b/multilingual/templatetags/multilingual_tags.py new file mode 100644 index 0000000..eb673da --- /dev/null +++ b/multilingual/templatetags/multilingual_tags.py @@ -0,0 +1,73 @@ +from django import template +from django import forms +from django.template import Node, NodeList, Template, Context, resolve_variable +from django.template.loader import get_template, render_to_string +from django.conf import settings +from django.utils.html import escape +from multilingual.languages import get_language_idx, get_default_language +import math +import StringIO +import tokenize + +register = template.Library() + +from multilingual.languages import get_language_code, get_language_name, get_language_bidi + +def language_code(language_id): + """ + Return the code of the language with id=language_id + """ + return get_language_code(language_id) + +register.filter(language_code) + +def language_name(language_id): + """ + Return the name of the language with id=language_id + """ + return get_language_name(language_id) + +register.filter(language_name) + +def language_bidi(language_id): + """ + Return whether the language with id=language_id is written right-to-left. + """ + return get_language_bidi(language_id) + +register.filter(language_bidi) + +class EditTranslationNode(template.Node): + def __init__(self, form_name, field_name, language=None): + self.form_name = form_name + self.field_name = field_name + self.language = language + + def render(self, context): + form = resolve_variable(self.form_name, context) + model = form.manipulator.model + trans_model = model._meta.translation_model + if self.language: + language_id = self.language.resolve(context) + else: + language_id = get_default_language() + real_name = "%s.%s.%s.%s" % (self.form_name, + trans_model._meta.object_name.lower(), + get_language_idx(language_id), + self.field_name) + return str(resolve_variable(real_name, context)) + +def do_edit_translation(parser, token): + bits = token.split_contents() + if len(bits) not in [3, 4]: + raise template.TemplateSyntaxError, \ + "%r tag requires 3 or 4 arguments" % bits[0] + if len(bits) == 4: + language = parser.compile_filter(bits[3]) + else: + language = None + return EditTranslationNode(bits[1], bits[2], language) + +register.tag('edit_translation', do_edit_translation) + + diff --git a/multilingual/translation.py b/multilingual/translation.py new file mode 100644 index 0000000..e4803c6 --- /dev/null +++ b/multilingual/translation.py @@ -0,0 +1,379 @@ +""" +Support for models' internal Translation class. +""" + +## TO DO: this is messy and needs to be cleaned up + +from django.db import models +from django.db.models.base import ModelBase +from django.dispatch.dispatcher import connect +from django.core.exceptions import ObjectDoesNotExist +from django.db.models import signals +from multilingual.languages import * +from multilingual.exceptions import TranslationDoesNotExist +from multilingual.fields import TranslationForeignKey +from multilingual.manipulators import add_multilingual_manipulators +from multilingual import manager +from multilingual.compat import IS_NEWFORMS_ADMIN + +if IS_NEWFORMS_ADMIN: + from django.contrib.admin import StackedInline, ModelAdmin + class MultilingualStackedInline(StackedInline): + template = "admin/edit_inline_translations_newforms.html" +else: + from django.contrib.admin.templatetags.admin_modify import StackedBoundRelatedObject + class TransBoundRelatedObject(StackedBoundRelatedObject): + """ + This class changes the template for translation objects. + """ + + def template_name(self): + return "admin/edit_inline_translations.html" + +def translation_save_translated_fields(instance, **kwargs): + """ + Save all the translations of instance in post_save signal handler. + """ + if not hasattr(instance, '_translation_cache'): + return + for l_id, translation in instance._translation_cache.iteritems(): + # set the translation ID just in case the translation was + # created while instance was not stored in the DB yet + translation.master_id = instance.id + translation.save() + +def translation_overwrite_previous(instance, **kwargs): + """ + Delete previously existing translation with the same master and + language_id values. To be called by translation model's pre_save + signal. + + This most probably means I am abusing something here trying to use + Django inline editor. Oh well, it will have to go anyway when we + move to newforms. + """ + qs = instance.__class__.objects + try: + qs = qs.filter(master=instance.master).filter(language_id=instance.language_id) + qs.delete() + except ObjectDoesNotExist: + # We are probably loading a fixture that defines translation entities + # before their master entity. + pass + +def fill_translation_cache(instance): + """ + Fill the translation cache using information received in the + instance objects as extra fields. + + You can not do this in post_init because the extra fields are + assigned by QuerySet.iterator after model initialization. + """ + + if hasattr(instance, '_translation_cache'): + # do not refill the cache + return + + instance._translation_cache = {} + for language_id in get_language_id_list(): + # see if translation for language_id was in the query + field_alias = get_translated_field_alias('id', language_id) + if getattr(instance, field_alias, None) is not None: + field_names = [f.attname for f in instance._meta.translation_model._meta.fields] + + # if so, create a translation object and put it in the cache + field_data = {} + for fname in field_names: + field_data[fname] = getattr(instance, + get_translated_field_alias(fname, language_id)) + + translation = instance._meta.translation_model(**field_data) + instance._translation_cache[language_id] = translation + + # In some situations an (existing in the DB) object is loaded + # without using the normal QuerySet. In such case fallback to + # loading the translations using a separate query. + + # Unfortunately, this is indistinguishable from the situation when + # an object does not have any translations. Oh well, we'll have + # to live with this for the time being. + if len(instance._translation_cache.keys()) == 0: + for translation in instance.translations.all(): + instance._translation_cache[translation.language_id] = translation + +class TranslatedFieldProxy(property): + def __init__(self, field_name, alias, field, language_id=None): + self.field_name = field_name + self.field = field + self.admin_order_field = alias + self.language_id = language_id + + def __get__(self, obj, objtype=None): + if obj is None: + return self + + return getattr(obj, 'get_' + self.field_name)(self.language_id) + + def __set__(self, obj, value): + language_id = self.language_id + + return getattr(obj, 'set_' + self.field_name)(value, self.language_id) + + short_description = property(lambda self: self.field.short_description) + +def getter_generator(field_name, short_description): + """ + Generate get_'field name' method for field field_name. + """ + def get_translation_field(self, language_id_or_code=None): + try: + return getattr(self.get_translation(language_id_or_code), field_name) + except TranslationDoesNotExist: + return None + get_translation_field.short_description = short_description + return get_translation_field + +def setter_generator(field_name): + """ + Generate set_'field name' method for field field_name. + """ + def set_translation_field(self, value, language_id_or_code=None): + setattr(self.get_translation(language_id_or_code, True), + field_name, value) + set_translation_field.short_description = "set " + field_name + return set_translation_field + +def get_translation(self, language_id_or_code, + create_if_necessary=False): + """ + Get a translation instance for the given language_id_or_code. + + If it does not exist, either create one or raise the + TranslationDoesNotExist exception, depending on the + create_if_necessary argument. + """ + + # fill the cache if necessary + self.fill_translation_cache() + + language_id = get_language_id_from_id_or_code(language_id_or_code, False) + if language_id is None: + language_id = getattr(self, '_default_language', None) + if language_id is None: + language_id = get_default_language() + + if language_id not in self._translation_cache: + if not create_if_necessary: + raise TranslationDoesNotExist(language_id) + new_translation = self._meta.translation_model(master=self, + language_id=language_id) + self._translation_cache[language_id] = new_translation + return self._translation_cache.get(language_id, None) + +class Translation: + """ + A superclass for translatablemodel.Translation inner classes. + """ + + def contribute_to_class(cls, main_cls, name): + """ + Handle the inner 'Translation' class. + """ + + # delay the creation of the *Translation until the master model is + # fully created + connect(cls.finish_multilingual_class, signal=signals.class_prepared, + sender=main_cls, weak=False) + + # connect the post_save signal on master class to a handler + # that saves translations + connect(translation_save_translated_fields, signal=signals.post_save, + sender=main_cls) + + contribute_to_class = classmethod(contribute_to_class) + + def create_translation_attrs(cls, main_cls): + """ + Creates get_'field name'(language_id) and set_'field + name'(language_id) methods for all the translation fields. + Adds the 'field name' properties too. + + Returns the translated_fields hash used in field lookups, see + multilingual.query. It maps field names to (field, + language_id) tuples. + """ + translated_fields = {} + + for fname, field in cls.__dict__.items(): + if isinstance(field, models.fields.Field): + translated_fields[fname] = (field, None) + + # add get_'fname' and set_'fname' methods to main_cls + getter = getter_generator(fname, getattr(field, 'verbose_name', fname)) + setattr(main_cls, 'get_' + fname, getter) + + setter = setter_generator(fname) + setattr(main_cls, 'set_' + fname, setter) + + # add the 'fname' proxy property that allows reads + # from and writing to the appropriate translation + setattr(main_cls, fname, + TranslatedFieldProxy(fname, fname, field)) + + # create the 'fname'_'language_code' proxy properties + for language_id in get_language_id_list(): + language_code = get_language_code(language_id) + fname_lng = fname + '_' + language_code + translated_fields[fname_lng] = (field, language_id) + setattr(main_cls, fname_lng, + TranslatedFieldProxy(fname, fname_lng, field, + language_id)) + return translated_fields + create_translation_attrs = classmethod(create_translation_attrs) + + def get_unique_fields(cls): + """ + Return a list of fields with "unique" attribute, which needs to + be augmented by the language. + """ + unique_fields = [] + + for fname, field in cls.__dict__.items(): + if isinstance(field, models.fields.Field): + if getattr(field,'unique',False): + field.unique = False + unique_fields.append(fname) + return unique_fields + get_unique_fields = classmethod(get_unique_fields) + + def finish_multilingual_class(cls, *args, **kwargs): + """ + Create a model with translations of a multilingual class. + """ + + main_cls = kwargs['sender'] + translation_model_name = main_cls.__name__ + "Translation" + + # create the model with all the translatable fields + unique = [('language_id', 'master')] + for f in cls.get_unique_fields(): + unique.append(('language_id',f)) + + class TransMeta: + ordering = ('language_id',) + unique_together = tuple(unique) + db_table = main_cls._meta.db_table + '_translation' + app_label = main_cls._meta.app_label + + trans_attrs = cls.__dict__.copy() + trans_attrs['Meta'] = TransMeta + trans_attrs['language_id'] = models.IntegerField(blank=False, null=False, core=True, + choices=get_language_choices(), + db_index=True) + + if IS_NEWFORMS_ADMIN: + edit_inline = True + else: + edit_inline = TransBoundRelatedObject + + trans_attrs['master'] = TranslationForeignKey(main_cls, blank=False, null=False, + edit_inline=edit_inline, + related_name='translations', + num_in_admin=get_language_count(), + min_num_in_admin=get_language_count(), + num_extra_on_change=0) + trans_attrs['__str__'] = lambda self: ("%s object, language_code=%s" + % (translation_model_name, + get_language_code(self.language_id))) + + trans_model = ModelBase(translation_model_name, (models.Model,), trans_attrs) + trans_model._meta.translated_fields = cls.create_translation_attrs(main_cls) + + main_cls._meta.translation_model = trans_model + main_cls.get_translation = get_translation + main_cls.fill_translation_cache = fill_translation_cache + + # Note: don't fill the translation cache in post_init, as all + # the extra values selected by QAddTranslationData will be + # assigned AFTER init() +# connect(fill_translation_cache, signal=signals.post_init, +# sender=main_cls) + + # connect the pre_save signal on translation class to a + # function removing previous translation entries. + connect(translation_overwrite_previous, signal=signals.pre_save, + sender=trans_model, weak=False) + + finish_multilingual_class = classmethod(finish_multilingual_class) + +def install_translation_library(): + # modify ModelBase.__new__ so that it understands how to handle the + # 'Translation' inner class + + if getattr(ModelBase, '_multilingual_installed', False): + # don't install it twice + return + + _old_new = ModelBase.__new__ + + def multilingual_modelbase_new(cls, name, bases, attrs): + if 'Translation' in attrs: + if not issubclass(attrs['Translation'], Translation): + raise ValueError, ("%s.Translation must be a subclass " + + " of multilingual.Translation.") % (name,) + + # Make sure that if the class specifies objects then it is + # a subclass of our Manager. + # + # Don't check other managers since someone might want to + # have a non-multilingual manager, but assigning a + # non-multilingual manager to objects would be a common + # mistake. + if ('objects' in attrs) and (not isinstance(attrs['objects'], manager.Manager)): + raise ValueError, ("Model %s specifies translations, " + + "so its 'objects' manager must be " + + "a subclass of multilingual.Manager.") % (name,) + + # Change the default manager to multilingual.Manager. + if not 'objects' in attrs: + attrs['objects'] = manager.Manager() + + # Override the admin manager as well, or the admin views will + # not see the translation data. + if 'Admin' in attrs: + attrs['Admin'].manager = attrs['objects'] + + # Install a hack to let add_multilingual_manipulators know + # this is a translatable model + attrs['is_translation_model'] = lambda self: True + + return _old_new(cls, name, bases, attrs) + ModelBase.__new__ = staticmethod(multilingual_modelbase_new) + ModelBase._multilingual_installed = True + + if IS_NEWFORMS_ADMIN: + # Override ModelAdmin.__new__ to create automatic inline + # editor for multilingual models. + class MultiType(type): + pass + _old_admin_new = ModelAdmin.__new__ + def multilingual_modeladmin_new(cls, model, admin_site): + if isinstance(model.objects, manager.Manager): + X = MultiType('X',(MultilingualStackedInline,), + {'model':model._meta.translation_model, + 'fk_name':'master', + 'extra':get_language_count(), + 'max_num':get_language_count()}) + if cls.inlines: + for inline in cls.inlines: + if X.__class__ == inline.__class__: + cls.inlines.remove(inline) + break + cls.inlines.append(X) + else: + cls.inlines = [X] + return _old_admin_new(cls, model, admin_site) + ModelAdmin.__new__ = staticmethod(multilingual_modeladmin_new) + +# install the library +install_translation_library() diff --git a/testproject/__init__.py b/testproject/__init__.py new file mode 100644 index 0000000..27e248e --- /dev/null +++ b/testproject/__init__.py @@ -0,0 +1,3 @@ +""" +Test application for django-multilingual. +""" diff --git a/testproject/articles/__init__.py b/testproject/articles/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/testproject/articles/models.py b/testproject/articles/models.py new file mode 100644 index 0000000..64845d4 --- /dev/null +++ b/testproject/articles/models.py @@ -0,0 +1,306 @@ +""" +Test models for the multilingual library. + +# Note: the to_str() calls in all the tests are here only to make it +# easier to test both pre-unicode and current Django. +>>> from testproject.utils import to_str + +# make sure the settings are right +>>> from multilingual.languages import LANGUAGES +>>> LANGUAGES +[['en', 'English'], ['pl', 'Polish'], ['zh-cn', 'Simplified Chinese']] + +>>> from multilingual import set_default_language +>>> from django.db.models import Q +>>> set_default_language(1) + +### Create the test data + +# Check both assigning via the proxy properties and set_* functions + +>>> c = Category() +>>> c.name_en = 'category 1' +>>> c.name_pl = 'kategoria 1' +>>> c.save() + +>>> c = Category() +>>> c.set_name('category 2', 'en') +>>> c.set_name('kategoria 2', 'pl') +>>> c.save() + +### See if the test data was saved correctly + +>>> c = Category.objects.all().order_by('id')[0] +>>> to_str((c.name, c.get_name(1), c.get_name(2))) +('category 1', 'category 1', 'kategoria 1') +>>> c = Category.objects.all().order_by('id')[1] +>>> to_str((c.name, c.get_name(1), c.get_name(2))) +('category 2', 'category 2', 'kategoria 2') + +### Check translation changes. +### Make sure the name and description properties obey +### set_default_language. + +>>> c = Category.objects.all().order_by('id')[0] + +# set language: pl +>>> set_default_language(2) +>>> to_str((c.name, c.get_name(1), c.get_name(2))) +('kategoria 1', 'category 1', 'kategoria 1') +>>> c.name = 'kat 1' +>>> to_str((c.name, c.get_name(1), c.get_name(2))) +('kat 1', 'category 1', 'kat 1') + +# set language: en +>>> set_default_language('en') +>>> c.name = 'cat 1' +>>> to_str((c.name, c.get_name(1), c.get_name(2))) +('cat 1', 'cat 1', 'kat 1') +>>> c.save() + +# Read the entire Category objects from the DB again to see if +# everything was saved correctly. +>>> c = Category.objects.all().order_by('id')[0] +>>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) +('cat 1', 'cat 1', 'kat 1') +>>> c = Category.objects.all().order_by('id')[1] +>>> to_str((c.name, c.get_name('en'), c.get_name('pl'))) +('category 2', 'category 2', 'kategoria 2') + +### Check ordering + +>>> set_default_language(1) +>>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) +['cat 1', 'category 2'] + +### Check ordering + +# start with renaming one of the categories so that the order actually +# depends on the default language + +>>> set_default_language(1) +>>> c = Category.objects.get(name='cat 1') +>>> c.name = 'zzz cat 1' +>>> c.save() + +>>> to_str([c.name for c in Category.objects.all().order_by('name_en')]) +['category 2', 'zzz cat 1'] +>>> to_str([c.name for c in Category.objects.all().order_by('name')]) +['category 2', 'zzz cat 1'] +>>> to_str([c.name for c in Category.objects.all().order_by('-name')]) +['zzz cat 1', 'category 2'] + +>>> set_default_language(2) +>>> to_str([c.name for c in Category.objects.all().order_by('name')]) +['kat 1', 'kategoria 2'] +>>> to_str([c.name for c in Category.objects.all().order_by('-name')]) +['kategoria 2', 'kat 1'] + +### Check filtering + +# Check for filtering defined by Q objects as well. This is a recent +# improvement: the translation fields are being handled by an +# extension of lookup_inner instead of overridden +# QuerySet._filter_or_exclude + +>>> set_default_language('en') +>>> to_str([c.name for c in Category.objects.all().filter(name__contains='2')]) +['category 2'] + +>>> set_default_language('en') +>>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='2'))]) +['category 2'] + +>>> set_default_language(1) +>>> to_str([c.name for c in +... Category.objects.all().filter(Q(name__contains='2')|Q(name_pl__contains='kat'))]) +['zzz cat 1', 'category 2'] + +>>> set_default_language(1) +>>> to_str([c.name for c in Category.objects.all().filter(name_en__contains='2')]) +['category 2'] + +>>> set_default_language(1) +>>> to_str([c.name for c in Category.objects.all().filter(Q(name_pl__contains='kat'))]) +['zzz cat 1', 'category 2'] + +>>> set_default_language('pl') +>>> to_str([c.name for c in Category.objects.all().filter(name__contains='k')]) +['kat 1', 'kategoria 2'] + +>>> set_default_language('pl') +>>> to_str([c.name for c in Category.objects.all().filter(Q(name__contains='kategoria'))]) +['kategoria 2'] + +### Check specifying query set language +>>> c_en = Category.objects.all().for_language('en') +>>> c_pl = Category.objects.all().for_language(2) # both ID and code work here +>>> to_str(c_en.get(name__contains='1').name) +'zzz cat 1' +>>> to_str(c_pl.get(name__contains='1').name) +'kat 1' + +>>> to_str([c.name for c in c_en.order_by('name')]) +['category 2', 'zzz cat 1'] +>>> to_str([c.name for c in c_pl.order_by('-name')]) +['kategoria 2', 'kat 1'] + +>>> c = c_en.get(id=1) +>>> c.name = 'test' +>>> to_str((c.name, c.name_en, c.name_pl)) +('test', 'test', 'kat 1') + +>>> c = c_pl.get(id=1) +>>> c.name = 'test' +>>> to_str((c.name, c.name_en, c.name_pl)) +('test', 'zzz cat 1', 'test') + +### Check filtering spanning more than one model + +>>> set_default_language(1) + +>>> cat_1 = Category.objects.get(name='zzz cat 1') +>>> cat_2 = Category.objects.get(name='category 2') + +>>> a = Article(category=cat_1) +>>> a.set_title('article 1', 1) +>>> a.set_title('artykul 1', 2) +>>> a.set_contents('contents 1', 1) +>>> a.set_contents('zawartosc 1', 1) +>>> a.save() + +>>> a = Article(category=cat_2) +>>> a.set_title('article 2', 1) +>>> a.set_title('artykul 2', 2) +>>> a.set_contents('contents 2', 1) +>>> a.set_contents('zawartosc 2', 1) +>>> a.save() + +>>> to_str([a.title for a in Article.objects.filter(category=cat_1)]) +['article 1'] +>>> to_str([a.title for a in Article.objects.filter(category__name=cat_1.name)]) +['article 1'] +>>> to_str([a.title for a in Article.objects.filter(Q(category__name=cat_1.name)|Q(category__name_pl__contains='2')).order_by('-title')]) +['article 2', 'article 1'] + +### Test the creation of new objects using keywords passed to the +### constructor + +>>> set_default_language(2) +>>> c_n = Category.objects.create(name_en='new category', name_pl='nowa kategoria') +>>> to_str((c_n.name, c_n.name_en, c_n.name_pl)) +('nowa kategoria', 'new category', 'nowa kategoria') +>>> c_n.save() + +>>> c_n2 = Category.objects.get(name_en='new category') +>>> to_str((c_n2.name, c_n2.name_en, c_n2.name_pl)) +('nowa kategoria', 'new category', 'nowa kategoria') + +>>> set_default_language(2) +>>> c_n3 = Category.objects.create(name='nowa kategoria 2') +>>> to_str((c_n3.name, c_n3.name_en, c_n3.name_pl)) +('nowa kategoria 2', None, 'nowa kategoria 2') + +""" + +from django.db import models +from django.contrib.auth.models import User +import multilingual + +try: + from django.utils.translation import ugettext as _ +except: + # if this fails then _ is a builtin + pass + +class Category(models.Model): + """ + Test model for multilingual content: a simplified Category. + """ + + # First, some fields that do not need translations + creator = models.ForeignKey(User, verbose_name=_("Created by"), + blank=True, null=True) + created = models.DateTimeField(verbose_name=_("Created at"), + auto_now_add=True) + parent = models.ForeignKey('self', verbose_name=_("Parent category"), + blank=True, null=True) + + # And now the translatable fields + class Translation(multilingual.Translation): + """ + The definition of translation model. + + The multilingual machinery will automatically add these to the + Category class: + + * get_name(language_id=None) + * set_name(value, language_id=None) + * get_description(language_id=None) + * set_description(value, language_id=None) + * name and description properties using the methods above + """ + + name = models.CharField(verbose_name=_("The name"), + blank=True, null=False, maxlength=250) + description = models.TextField(verbose_name=_("The description"), + blank=True, null=False) + + def get_absolute_url(self): + return "/" + str(self.id) + "/" + + def __unicode__(self): + # note that you can use name and description fields as usual + try: + return str(self.name) + except multilingual.TranslationDoesNotExist: + return "-not-available-" + + def __str__(self): + # compatibility + return str(self.__unicode__()) + + class Admin: + # Again, field names would just work here, but if you need + # correct list headers (from field.verbose_name) you have to + # use the get_'field_name' functions here. + + # Note: this Admin class does not do anything in newforms-admin + list_display = ('id', 'creator', 'created', 'name', 'description') + search_fields = ('name', 'description') + + class Meta: + verbose_name_plural = 'categories' + ordering = ('id',) + +class CustomArticleManager(multilingual.Manager): + pass + +class Article(models.Model): + """ + Test model for multilingual content: a simplified article + belonging to a single category. + """ + + # non-translatable fields first + creator = models.ForeignKey(User, verbose_name=_("Created by"), + blank=True, null=True) + created = models.DateTimeField(verbose_name=_("Created at"), + auto_now_add=True) + category = models.ForeignKey(Category, verbose_name=_("Parent category"), + blank=True, null=True) + + objects = CustomArticleManager() + + # And now the translatable fields + class Translation(multilingual.Translation): + title = models.CharField(verbose_name=_("The title"), + blank=True, null=False, maxlength=250) + contents = models.TextField(verbose_name=_("The contents"), + blank=True, null=False) + +from multilingual.compat import IS_NEWFORMS_ADMIN +if IS_NEWFORMS_ADMIN: + from django.contrib import admin + admin.site.register(Article) + admin.site.register(Category) diff --git a/testproject/issue_15/__init__.py b/testproject/issue_15/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/testproject/issue_15/models.py b/testproject/issue_15/models.py new file mode 100644 index 0000000..7568991 --- /dev/null +++ b/testproject/issue_15/models.py @@ -0,0 +1,42 @@ +""" +Models and unit tests for issues reported in the tracker. + +# test for issue #15, it will fail on unpatched Django +# http://code.google.com/p/django-multilingual/issues/detail?id=15 + +>>> from multilingual import set_default_language + +# Note: the to_str() calls in all the tests are here only to make it +# easier to test both pre-unicode and current Django. +>>> from testproject.utils import to_str + +>>> set_default_language('pl') +>>> g = Gallery.objects.create(id=2, ref_id=2, title_pl='Test polski', title_en='English Test') +>>> to_str(g.title) +'Test polski' +>>> to_str(g.title_en) +'English Test' +>>> g = Gallery.objects.select_related(depth=1).get(id=2) +>>> to_str(g.title) +'Test polski' +>>> to_str(g.title_en) +'English Test' + +""" + +from django.db import models +import multilingual + +try: + from django.utils.translation import ugettext as _ +except: + # if this fails then _ is a builtin + pass + +class Gallery(models.Model): + ref = models.ForeignKey('self', verbose_name=_('Parent gallery')) + modified = models.DateField(_('Modified'), auto_now=True) + + class Translation(multilingual.Translation): + title = models.CharField(_('Title'), maxlength=50) + description = models.TextField(_('Description'), blank=True) diff --git a/testproject/issue_16/__init__.py b/testproject/issue_16/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/testproject/issue_16/models/__init__.py b/testproject/issue_16/models/__init__.py new file mode 100644 index 0000000..90bcddd --- /dev/null +++ b/testproject/issue_16/models/__init__.py @@ -0,0 +1,20 @@ +""" +Test for issue #16 + +http://code.google.com/p/django-multilingual/issues/detail?id=16 + +# Note: the to_str() calls in all the tests are here only to make it +# easier to test both pre-unicode and current Django. +>>> from testproject.utils import to_str + +# The next line triggered an OperationalError before fix for #16 +>>> c = Category.objects.create(name=u'The Name') +>>> c = Category.objects.get(id=c.id) +>>> to_str(c.name) +'The Name' + + +""" + +from issue_16.models.category import Category +from issue_16.models.page import Page diff --git a/testproject/issue_16/models/category.py b/testproject/issue_16/models/category.py new file mode 100644 index 0000000..890b31a --- /dev/null +++ b/testproject/issue_16/models/category.py @@ -0,0 +1,19 @@ +from django.db import models +import multilingual + +try: + from django.utils.translation import ugettext as _ +except: + # if this fails then _ is a builtin + pass + +class Category(models.Model): + parent = models.ForeignKey('self', verbose_name=_("Parent category"), + blank=True, null=True) + + class Translation(multilingual.Translation): + name = models.CharField(verbose_name=_("The name"), + blank=True, null=False, maxlength=250) + + class Meta: + app_label = 'issue_16' diff --git a/testproject/issue_16/models/page.py b/testproject/issue_16/models/page.py new file mode 100644 index 0000000..21f53fd --- /dev/null +++ b/testproject/issue_16/models/page.py @@ -0,0 +1,22 @@ +from django.db import models +from issue_16.models.category import Category +import multilingual + +try: + from django.utils.translation import ugettext as _ +except: + # if this fails then _ is a builtin + pass + +class Page(models.Model): + category = models.ForeignKey(Category, verbose_name=_("Parent category"), + blank=True, null=True) + + class Translation(multilingual.Translation): + title = models.CharField(verbose_name=_("The title"), + blank=True, null=False, maxlength=250) + contents = models.TextField(verbose_name=_("The contents"), + blank=True, null=False) + + class Meta: + app_label = 'issue_16' diff --git a/testproject/issue_16/views.py b/testproject/issue_16/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/testproject/issue_16/views.py @@ -0,0 +1 @@ +# Create your views here. diff --git a/testproject/issue_29/__init__.py b/testproject/issue_29/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/testproject/issue_29/models.py b/testproject/issue_29/models.py new file mode 100644 index 0000000..2077205 --- /dev/null +++ b/testproject/issue_29/models.py @@ -0,0 +1,43 @@ +""" +Models and unit tests for issues reported in the tracker. + +>>> from multilingual import set_default_language + +# test for issue #15 +# http://code.google.com/p/django-multilingual/issues/detail?id=15 + +>>> set_default_language('pl') +>>> g = Gallery.objects.create(id=2, title_pl='Test polski', title_en='English Test') +>>> g.title +'Test polski' +>>> g.title_en +'English Test' +>>> g.save() +>>> g.title_en = 'Test polski' +>>> g.save() +>>> try: +... g = Gallery.objects.create(id=3, title_pl='Test polski') +... except: print "ERROR" +... +ERROR +>>> +""" + + +from django.db import models +import multilingual +try: + from django.utils.translation import ugettext as _ +except ImportError: + pass + +class Gallery(models.Model): + class Admin: + pass + ref = models.ForeignKey('self', verbose_name=_('Parent gallery'), + blank=True, null=True) + modified = models.DateField(_('Modified'), auto_now=True) + + class Translation(multilingual.Translation): + title = models.CharField(_('Title'), maxlength=50, unique = True) + description = models.TextField(_('Description'), blank=True) diff --git a/testproject/manage.py b/testproject/manage.py new file mode 100644 index 0000000..5e78ea9 --- /dev/null +++ b/testproject/manage.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +from django.core.management import execute_manager +try: + import settings # Assumed to be in the same directory. +except ImportError: + import sys + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) + sys.exit(1) + +if __name__ == "__main__": + execute_manager(settings) diff --git a/testproject/multimanage.py b/testproject/multimanage.py new file mode 100755 index 0000000..070d312 --- /dev/null +++ b/testproject/multimanage.py @@ -0,0 +1,85 @@ +#!/bin/env python +""" + +A script that makes it easy to execute unit tests or start the dev +server with multiple Django versions. + +Requires a short configuration file called test_config.py that lists +available Django paths. Will create that file if it is not present. + +""" + +import os +import os.path +import sys + +def get_django_paths(): + """ + Return the dictionary mapping Django versions to paths. + """ + + CONFIG_FILE_NAME = 'multimanage_config.py' + DEFAULT_CONFIG_CONTENT = """DJANGO_PATHS = { + '0.96.1': '/dev/django-0.96.1/', + 'trunk': '/dev/django-trunk/', + 'newforms': '/dev/django-newforms/', + } + """ + + if not os.path.exists(CONFIG_FILE_NAME): + print "The %s file does not exist" % CONFIG_FILE_NAME + open(CONFIG_FILE_NAME, 'w').write(DEFAULT_CONFIG_CONTENT) + print ("I created the file, but you need to edit it to enter " + "the correct paths.") + + sys.exit(1) + from multimanage_config import DJANGO_PATHS + return DJANGO_PATHS + +def execute_with_django_path(django_path, command): + """ + Execute the given command (via os.system), putting django_path + in PYTHONPATH environment variable. + + Returns True if the command succeeded. + """ + original_pythonpath = os.environ.get('PYTHONPATH', '') + try: + os.environ['PYTHONPATH'] = os.path.pathsep.join([django_path, '..']) + return os.system(command) == 0 + finally: + os.environ['PYTHONPATH'] = original_pythonpath + +def run_manage(django_version, django_path, manage_params): + """ + Run 'manage.py [manage_params]' for the given Django version. + """ + print "** Starting manage.py for Django %s (%s)" % (django_version, django_path) + execute_with_django_path(django_path, + 'python manage.py ' + ' '.join(manage_params)) + +django_paths = get_django_paths() +if len(sys.argv) == 1: + # without any arguments: display config info + print "Configured Django paths:" + for version, path in django_paths.items(): + print " ", version, path + print "Usage examples:" + print " python multimanage.py [normal manage.py commands]" + print " python multimanage.py test [application names...]" + print " python multimanage.py runserver 0.0.0.0:4000" + print " python multimanage.py --django=trunk runserver 0.0.0.0:4000" +else: + # with at least one argument: handle args + version = None + args = sys.argv[1:] + for arg in args: + if arg.startswith('--django='): + version = arg.split('=')[1] + args.remove(arg) + + if version: + run_manage(version, django_paths[version], args) + else: + for version, path in django_paths.items(): + run_manage(version, path, args) diff --git a/testproject/settings.py b/testproject/settings.py new file mode 100644 index 0000000..e8df4b8 --- /dev/null +++ b/testproject/settings.py @@ -0,0 +1,107 @@ +# Django settings for testproject project. + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + # ('Your Name', '[email protected]'), +) + +MANAGERS = ADMINS + +DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. +DATABASE_NAME = 'database.db3' # Or path to database file if using sqlite3. +DATABASE_USER = '' # Not used with sqlite3. +DATABASE_PASSWORD = '' # Not used with sqlite3. +DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. +DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. + +# Local time zone for this installation. All choices can be found here: +# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE +TIME_ZONE = 'America/Chicago' + +# Language code for this installation. All choices can be found here: +# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes +# http://blogs.law.harvard.edu/tech/stories/storyReader$15 +LANGUAGE_CODE = 'en-us' + +# django-multilanguange ##################### + +# It is important that the language identifiers are consecutive +# numbers starting with 1. + + +LANGUAGES = [['en', 'English'], # id=1 + ['pl', 'Polish'], # id=2 + ['zh-cn', 'Simplified Chinese'], # id=3 + ] + +DEFAULT_LANGUAGE = 1 + +############################################## + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# Absolute path to the directory that holds media. +# Example: "/home/media/media.lawrence.com/" +MEDIA_ROOT = '' + +# URL that handles the media served from MEDIA_ROOT. +# Example: "http://media.lawrence.com" +MEDIA_URL = '' + +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a +# trailing slash. +# Examples: "http://foo.com/media/", "/media/". +ADMIN_MEDIA_PREFIX = '/media/' + +# Make this unique, and don't share it with anybody. +SECRET_KEY = '1+t11&r9nw+d7uw558+8=#j8!8^$nt97ecgv()-@x!tcef7f6)' + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.load_template_source', + 'django.template.loaders.app_directories.load_template_source', +# 'django.template.loaders.eggs.load_template_source', +) + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.middleware.doc.XViewMiddleware', +) + +ROOT_URLCONF = 'testproject.urls' + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + '../multilingual/templates/', + 'templates/', +) + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.admin', + 'multilingual', + 'testproject.articles', + 'testproject.issue_15', + 'testproject.issue_16', + 'testproject.issue_29', +) + +TEMPLATE_CONTEXT_PROCESSORS = ( + 'django.core.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.i18n', + 'multilingual.context_processors.multilingual', +) diff --git a/testproject/templates/articles/category_detail.html b/testproject/templates/articles/category_detail.html new file mode 100644 index 0000000..c0c2a2a --- /dev/null +++ b/testproject/templates/articles/category_detail.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% load multilingual_tags %} +{% block body %} +<h1>Category {{ object.name_en|escape }}/{{ object.name_pl|escape }}</h1> + + + +{% endblock %} diff --git a/testproject/templates/articles/category_form.html b/testproject/templates/articles/category_form.html new file mode 100644 index 0000000..ddeef4d --- /dev/null +++ b/testproject/templates/articles/category_form.html @@ -0,0 +1,48 @@ +{% extends "base.html" %} +{% load multilingual_tags %} +{% block body %} +{% if object %} + <h1>Change category</h1> +{% else %} + <h1>New category</h1> +{% endif %} + +<p>This page lets you {{ object|yesno:"edit,create" }} categories +with forms created two ways.</p> + +<table> +<tr> + <th>1. form with all translations</th> + <th>2. form with default translation ({{ DEFAULT_LANGUAGE_CODE }})</th> +</tr> +<tr> +<td> + + <form action="." method="post"> + <p>Creator: {{ form.creator }}</p> + <p>Parent: {{ form.parent }}</p> + + <p>Name EN: {% edit_translation form name "en" %}</p> + <p>Description EN: {% edit_translation form description "en" %}</p> + + <p>Name PL: {% edit_translation form name "pl" %}</p> + <p>Description PL: {% edit_translation form description "pl" %}</p> + + <p><input type="submit" name="Save" value="Save"/>, <a href="/">Cancel</a></p> + </form> + +</td><td> + + <form action="." method="post"> + <p>Creator: {{ form.creator }}</p> + <p>Parent: {{ form.parent }}</p> + + <p>Name: {% edit_translation form name %}</p> + <p>Description: {% edit_translation form description %}</p> + + <p><input type="submit" name="Save" value="Save"/>, <a href="/">Cancel</a></p> + </form> + +</td></tr> +</table> +{% endblock %} diff --git a/testproject/templates/articles/category_list.html b/testproject/templates/articles/category_list.html new file mode 100644 index 0000000..5035e51 --- /dev/null +++ b/testproject/templates/articles/category_list.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} +{% block body %} +<h1>Categories</h1> +<table style="border: 1px solid black; width: 50%; margin: auto"> +{% if object_list %} +<tr><th>en</th><th>pl</th><th>&nbsp;</th></tr> + {% for object in object_list %} + <tr> + <td>{{ object.name_en|escape }}</td> + <td>{{ object.name_pl|escape }}</td> + <td><a href="/{{ object.id }}/">edit</a></td> + </tr> + {% endfor %} +{% else %} + <tr><td>No categories yet.</td></tr> +{% endif %} +<tr><td><a href="/new/">Add a category</a></td></tr> +</table> +{% endblock %} diff --git a/testproject/templates/base.html b/testproject/templates/base.html new file mode 100644 index 0000000..8972ca0 --- /dev/null +++ b/testproject/templates/base.html @@ -0,0 +1,13 @@ +<html> +<head> +<style> +body {text-align: center} +form {text-align: left; padding: 1em; font-size: 66%; border: 1px black solid} +table {margin: auto} +textarea {height: 5em} +tr {vertical-align: top} +</style> +</head> +<body> +{% block body %}{% endblock %} +</body> diff --git a/testproject/urls.py b/testproject/urls.py new file mode 100644 index 0000000..8dac1b0 --- /dev/null +++ b/testproject/urls.py @@ -0,0 +1,27 @@ +from django.conf.urls.defaults import * +from articles.models import * + +urlpatterns = patterns('', + (r'^$', 'django.views.generic.list_detail.object_list', + {'queryset': Category.objects.all(), + 'allow_empty': True}), + (r'^(?P<object_id>[0-9]+)/$', 'django.views.generic.create_update.update_object', + {'model': Category, + 'post_save_redirect': '/'}), + (r'^new/$', 'django.views.generic.create_update.create_object', + {'model': Category}), +) + +# handle both newforms and oldforms admin URL + +from multilingual.compat import IS_NEWFORMS_ADMIN +if IS_NEWFORMS_ADMIN: + from django.contrib import admin + + urlpatterns += patterns('', + (r'^admin/(.*)', admin.site.root), + ) +else: + urlpatterns += patterns('', + (r'^admin/', include('django.contrib.admin.urls')), + ) diff --git a/testproject/utils.py b/testproject/utils.py new file mode 100644 index 0000000..196ffc8 --- /dev/null +++ b/testproject/utils.py @@ -0,0 +1,15 @@ +def to_str(arg): + """ + Convert all unicode strings in a structure into 'str' strings. + + Utility function to make it easier to write tests for both + unicode and non-unicode Django. + """ + if type(arg) == list: + return [to_str(el) for el in arg] + elif type(arg) == tuple: + return tuple([to_str(el) for el in arg]) + elif arg is None: + return None + else: + return str(arg)
sgharms/latintools
2397f15e5d58f7e8ff349e767576ae96dd7c4bc4
Added syllabation routine command.
diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/AELigatureize.tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/AELigatureize.tmCommand similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Commands/AELigatureize.tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/AELigatureize.tmCommand diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Close selection with pipes.tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Close selection with pipes.tmCommand similarity index 82% rename from Textmate_tools/Latin Student.tmbundle/Commands/Close selection with pipes.tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Close selection with pipes.tmCommand index 430eb09..3f1ae88 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Close selection with pipes.tmCommand +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Close selection with pipes.tmCommand @@ -1,22 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>perl -pe 's#$#|#'</string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>^|</string> <key>name</key> <string>Close selection with pipes</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.html text.tex</string> <key>uuid</key> <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Dactylizer.tmCommand similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Dactylizer.tmCommand diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/HTML Table-ify.tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/HTML Table-ify.tmCommand similarity index 95% rename from Textmate_tools/Latin Student.tmbundle/Commands/HTML Table-ify.tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/HTML Table-ify.tmCommand index 066255d..45bf448 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/HTML Table-ify.tmCommand +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/HTML Table-ify.tmCommand @@ -1,104 +1,104 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby @table = Array.new @table_attr = String.new @css_attr= String.new @row_width=0 def validate_table(t) @row_width = t[0].count("|")-1 pipe_count = @row_width + 1 t.each { |l| exit!(1) if l.count("|") != pipe_count} end def clean_meta_lines(r) r.each do |a| a.chomp! a.gsub!(/\|.*\&gt;/,"") a.gsub!(/\|/,"") a.gsub!(/^\s+/,"") end end def create_table_hdrs(line) str = " &lt;tr&gt;\n" line.gsub(/(^\||\|$)/,"").split(/\|/).each do |x| x.chomp! str += ' &lt;th&gt;' + x + "&lt;/th&gt;\n" end str += " &lt;/tr&gt;" end def formulate_table_line(l) str = " &lt;tr&gt;\n" l.gsub(/(^\||\|$)/,"").split(/\|/).each do |x| x.chomp! x.gsub!(/(^\s+|\s+$)/,"") str += ' &lt;td&gt;' + x + "&lt;/td&gt;\n" end str += " &lt;/tr&gt;\n" str end while ( line = gets ) @table.push line if (line =~ /^|.*|$/ &amp;&amp; line !~ /^\|(CSS|ATTR)\&gt;/) @table_attr = line.chomp if line =~ /ATTR\&gt;/ @css_attr = line.chomp if line =~ /CSS\&gt;/ end puts @table_attr @css_attr = "style=\"" + @css_attr + "\"" if @css_attr @table_attr= "border=\"0\" cellspacing=\"5\" cellpadding=\"5\"" unless @table_attr.length =~ /\w{3}/ @table_attr.chomp! @css_attr.chomp! validate_table(@table) clean_meta_lines([@table_attr, @css_attr]) @table_hdrs = create_table_hdrs(@table.shift) @table.shift if @table[0] =~ /\|\-{3}/ @table_def_line = "" @table.each do |l| @table_def_line += formulate_table_line(l) end @table_def_line.sub!(/\n$/,"") table_def = &lt;&lt;END_OF_STRING &lt;table #{@table_attr} #{@css_attr}&gt; #{@table_hdrs} #{@table_def_line} &lt;/table&gt; END_OF_STRING puts table_def </string> <key>fallbackInput</key> <string>document</string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>~@t</string> <key>name</key> <string>HTML Table-ify</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.html</string> <key>uuid</key> <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons To Character Entities.tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Latex Macrons To Character Entities.tmCommand similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons To Character Entities.tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Latex Macrons To Character Entities.tmCommand diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand similarity index 94% rename from Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand index 3d1bc98..37147d3 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand @@ -1,94 +1,97 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby module MacronConversions LATEX_TO_MACRONS_CHARACTERS = { "\\={a}" =&gt; "ā", "\\={e}" =&gt; "ē", "\\={\\i}" =&gt; "ī", "\\={o}" =&gt; "ō", "\\={u}" =&gt; "ū", + "\\={y}" =&gt; "ȳ", "\\={A}" =&gt; "Ā", "\\={E}" =&gt; "Ē", - "\\={I}" =&gt; "Ī", + "\\={I}" =&gt; "Ī", "\\={O}" =&gt; "Ō", "\\={U}" =&gt; "Ū", } LATEX_TO_UTF8 ={ "\\={a}" =&gt; "\\xc4\\x81", "\\={e}" =&gt; "\\xc4\\x93", "\\={\\i}" =&gt; "\\xc4\\xab", "\\={o}" =&gt; "\\xc5\\x8d", "\\={u}" =&gt; "\\xc5\\xab", + "\\={y}" =&gt; "\\xC8\\xB3 ", "\\={A}" =&gt; "\\xc4\\x80", "\\={E}" =&gt; "\\xc4\\x92", "\\={I}" =&gt; "\\xc4\\xaa", "\\={O}" =&gt; "\\xc5\\x8c", "\\={U}" =&gt; "\\xc5\\xaa", } LATEX_TO_HTML_ENTITIES = { "\\={a}" =&gt; "&amp;#x101;", "\\={e}" =&gt; "&amp;#x113;", "\\={\\i}" =&gt; "&amp;#x12b;", "\\={o}" =&gt; "&amp;#x14d;", "\\={u}" =&gt; "&amp;#x16b;", + "\\={y}" =&gt; "&amp;#x233;", "\\={A}" =&gt; "&amp;#x100;", "\\={E}" =&gt; "&amp;#x112;", "\\={I}" =&gt; "&amp;#x12a;", "\\={O}" =&gt; "&amp;#x14c;", "\\={U}" =&gt; "&amp;#x16a;", } class Converter &lt; Object def initialize(*ray) @target = ray[0].nil? ? 'html' : ray[0] @index=Array.new end def processString(s) firstSlash = s =~ /(\\=.*?\})/ return s if $1.nil? testChar = $1 if firstSlash == 0 return processChar(testChar) + processString(s[firstSlash+testChar.length..s.length]) end return s[0..firstSlash-1] + processChar(testChar) + processString(s[firstSlash+testChar.length..s.length]) end def processChar(c) LATEX_TO_HTML_ENTITIES[c] end end end unless STDIN.tty? content=STDIN.read else content=ARGV[0] end puts MacronConversions::Converter.new().processString(content) </string> <key>input</key> <string>selection</string> <key>name</key> <string>Latex Macrons to HTML Entities</string> <key>output</key> <string>replaceSelectedText</string> <key>uuid</key> <string>1C2E22E3-E416-4C39-9853-608A3AB2B296</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Lines To Latlines.tmCommand similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Lines To Latlines.tmCommand diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Linify As Given Sentences (HTML).tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify As Given Sentences.tmCommand similarity index 86% rename from Textmate_tools/Latin Student.tmbundle/Commands/Linify As Given Sentences (HTML).tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify As Given Sentences.tmCommand index be129dc..b4dfe0e 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Linify As Given Sentences (HTML).tmCommand +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify As Given Sentences.tmCommand @@ -1,37 +1,37 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby @start = true @count=0 STDIN.read.split(/\s{2}/).each do |x| if @start @start = false @count = x.gsub(/[^\d]/,"").to_i else printf("&lt;p class=\"sent_given\"&gt;%d. %s&lt;/p&gt;\n",@count,x) @count = @count+1 end end </string> <key>input</key> <string>selection</string> <key>name</key> <string>Linify As Given Sentences (HTML)</string> <key>output</key> <string>afterSelectedText</string> <key>scope</key> <string>text.html</string> <key>uuid</key> <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Linify As Items ( LaTeX ).tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify As Items ( LaTeX ).tmCommand similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Commands/Linify As Items ( LaTeX ).tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify As Items ( LaTeX ).tmCommand diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items As Table Rows (; delimited).tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify Items As Table Rows (; delimited).tmCommand similarity index 89% rename from Textmate_tools/Latin Student.tmbundle/Commands/Linify Items As Table Rows (; delimited).tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify Items As Table Rows (; delimited).tmCommand index afc8d21..b7b5734 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items As Table Rows (; delimited).tmCommand +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify Items As Table Rows (; delimited).tmCommand @@ -1,45 +1,45 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby @start = true @count=0 STDIN.read.split(/;\s+/).each do |x| if @start @start = false @count = x.gsub(/[^\d]+/,"").to_i x=x.gsub(/^\d+.*\s+/,"") printf("%d. &amp; %s &amp; \\\\\n",@count,x) puts "\\hline" @count = @count+1 else puts "\\hline" x.chomp! printf("%d. &amp; %s &amp; \\\\\n",@count,x) @count = @count+1 end end </string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>^;</string> <key>name</key> <string>Linify Items As Table Rows (; delimited)</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items (no prefix).tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify Items.tmCommand similarity index 84% rename from Textmate_tools/Latin Student.tmbundle/Commands/Linify Items (no prefix).tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify Items.tmCommand index aef9df9..5d18a1f 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items (no prefix).tmCommand +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Linify Items.tmCommand @@ -1,26 +1,26 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby # Just to break a paragraph up assuming you used # the convention of double space @lines = STDIN.read.split(/\s{2}/) puts @lines</string> <key>input</key> <string>selection</string> <key>name</key> <string>Linify Items (no prefix)</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.html text.tex.latex</string> <key>uuid</key> <string>C7F5F012-979F-4D58-B163-E640A372B433</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Make Line LaTeX Item (LaTeX).tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Make Line LaTeX Item (LaTeX).tmCommand similarity index 88% rename from Textmate_tools/Latin Student.tmbundle/Commands/Make Line LaTeX Item (LaTeX).tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/Make Line LaTeX Item (LaTeX).tmCommand index d072fc1..1cfd361 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Make Line LaTeX Item (LaTeX).tmCommand +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/Make Line LaTeX Item (LaTeX).tmCommand @@ -1,36 +1,36 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby if ENV.has_key?('TM_SELECTED_TEXT') then result=ENV['TM_SELECTED_TEXT'] number=`"$TM_SUPPORT_PATH/bin"/CocoaDialog.app/Contents/MacOS/CocoaDialog standard-inputbox \ --title 'Item-ize Line' \ --informative-text 'Number of Item:' \ ` number=number.chomp! number=number.split(/[^\d+]/)[1] end puts "\\item[#{number}. ] #{result}" </string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>^@i</string> <key>name</key> <string>Make Line LaTeX Item (LaTeX)</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>25C01553-393E-4C85-B64C-996605339DA9</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/StrikeThru Effect.tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/StrikeThru Effect.tmCommand similarity index 83% rename from Textmate_tools/Latin Student.tmbundle/Commands/StrikeThru Effect.tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/StrikeThru Effect.tmCommand index 5897986..3866213 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/StrikeThru Effect.tmCommand +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/StrikeThru Effect.tmCommand @@ -1,24 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby x=STDIN.read.chomp print "\\sout{" + x + "}"</string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>^-</string> <key>name</key> <string>StrikeThru Effect</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>06C355BE-4AAB-43AB-960D-8052B96FB59B</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/VerseNumerate.tmCommand b/Textmate_tools/Latin Student (HTML).tmbundle/Commands/VerseNumerate.tmCommand similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Commands/VerseNumerate.tmCommand rename to Textmate_tools/Latin Student (HTML).tmbundle/Commands/VerseNumerate.tmCommand diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/He:she:It injector.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/He:she:It injector.tmSnippet similarity index 76% rename from Textmate_tools/Latin Student.tmbundle/Snippets/He:she:It injector.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/He:she:It injector.tmSnippet index 850840a..66c9cda 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/He:she:It injector.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/He:she:It injector.tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>He/She/It</string> <key>name</key> <string>He/she/It injector</string> <key>scope</key> <string>text.tex.latex</string> <key>tabTrigger</key> <string>HSI</string> <key>uuid</key> <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Horizontal Line (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Horizontal Line (LaTeX).tmSnippet similarity index 76% rename from Textmate_tools/Latin Student.tmbundle/Snippets/Horizontal Line (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Horizontal Line (LaTeX).tmSnippet index ed1c104..fc5a80a 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/Horizontal Line (LaTeX).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Horizontal Line (LaTeX).tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>\hline</string> <key>name</key> <string>Horizontal Line (LaTeX)</string> <key>scope</key> <string>text.tex.latex</string> <key>tabTrigger</key> <string>---</string> <key>uuid</key> <string>E5DB283A-D01E-4A75-9247-6D9357773543</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC a-macron (LaTeX).tmSnippet similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC a-macron (LaTeX).tmSnippet diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (HTML).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC a-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (HTML).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC a-macron.tmSnippet index b5b9c8a..edba99e 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (HTML).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC a-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>ā</string> <key>keyEquivalent</key> <string>^a</string> <key>name</key> <string>LC a-macron (HTML)</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>a-</string> <key>uuid</key> <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC e-macron (LaTeX).tmSnippet similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC e-macron (LaTeX).tmSnippet diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (HTML).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC e-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (HTML).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC e-macron.tmSnippet index 958a2e3..69504ae 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (HTML).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC e-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>ē</string> <key>keyEquivalent</key> <string>^e</string> <key>name</key> <string>LC e-macron (HTML)</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>e-</string> <key>uuid</key> <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC i-macron (LaTeX).tmSnippet similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC i-macron (LaTeX).tmSnippet diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (HTML).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC i-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (HTML).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC i-macron.tmSnippet index 304e21f..f2e6b06 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (HTML).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC i-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>ī</string> <key>keyEquivalent</key> <string>^i</string> <key>name</key> <string>LC i-macron (HTML)</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>i-</string> <key>uuid</key> <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC o-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC o-macron (LaTeX).tmSnippet similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC o-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC o-macron (LaTeX).tmSnippet diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/ LC-o-macron (HTML).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC o-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/ LC-o-macron (HTML).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC o-macron.tmSnippet index f06fa7e..71ceb0e 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/ LC-o-macron (HTML).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC o-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>ō</string> <key>keyEquivalent</key> <string>^o</string> <key>name</key> <string> LC-o-macron (HTML)</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>o-</string> <key>uuid</key> <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC u-macron (LaTeX).tmSnippet similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC u-macron (LaTeX).tmSnippet diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (HTML).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC u-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (HTML).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC u-macron.tmSnippet index 1053f6a..b199ff2 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (HTML).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC u-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>ū</string> <key>keyEquivalent</key> <string>^u</string> <key>name</key> <string>LC u-macron (HTML)</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>u-</string> <key>uuid</key> <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC y-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC y-macron (LaTeX).tmSnippet similarity index 75% rename from Textmate_tools/Latin Student.tmbundle/Snippets/LC y-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC y-macron (LaTeX).tmSnippet index 6912478..9505ace 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/LC y-macron (LaTeX).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/LC y-macron (LaTeX).tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>\={y}</string> <key>keyEquivalent</key> <string>^y</string> <key>name</key> <string>LC y-macron (LaTeX)</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Metrica Low Doublequote.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Metrica Low Doublequote.tmSnippet new file mode 100644 index 0000000..6bc21f8 --- /dev/null +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Metrica Low Doublequote.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\quotedblbase\ </string> + <key>name</key> + <string>Metrica Low Doublequote</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>\q</string> + <key>uuid</key> + <string>A95373C4-4760-4690-A41B-FA85D6A6A2AF</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Metrica breve.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Metrica breve.tmSnippet new file mode 100644 index 0000000..1ec79f0 --- /dev/null +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Metrica breve.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\breve </string> + <key>name</key> + <string>Metrica breve</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>\b</string> + <key>uuid</key> + <string>F070077C-309C-47AA-90CF-0D18FD6CC4ED</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Metrica macron.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Metrica macron.tmSnippet new file mode 100644 index 0000000..e10b10f --- /dev/null +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Metrica macron.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\macron </string> + <key>name</key> + <string>Metrica macron</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>\m</string> + <key>uuid</key> + <string>BD7CFABA-F0E7-4073-A7FC-A3A6B29FC409</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC A-macron (LaTeX).tmSnippet similarity index 75% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC A-macron (LaTeX).tmSnippet index a08b999..d60c857 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron (LaTeX).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC A-macron (LaTeX).tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>\={A}</string> <key>keyEquivalent</key> <string>^A</string> <key>name</key> <string>UC A-macron (LaTeX)</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC A-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC A-macron.tmSnippet index 02b0694..7ccfc53 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC A-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>Ā</string> <key>keyEquivalent</key> <string>^A</string> <key>name</key> <string>UC A-macron</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>A-</string> <key>uuid</key> <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC E-macron (LaTeX).tmSnippet similarity index 75% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC E-macron (LaTeX).tmSnippet index 5b96792..5dd0c8a 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron (LaTeX).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC E-macron (LaTeX).tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>\={E}</string> <key>keyEquivalent</key> <string>^E</string> <key>name</key> <string>UC E-macron (LaTeX)</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC E-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC E-macron.tmSnippet index f7ef10d..1bb1d75 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC E-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>Ē</string> <key>keyEquivalent</key> <string>^E</string> <key>name</key> <string>UC E-macron</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>E-</string> <key>uuid</key> <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC I-macron (LaTeX).tmSnippet similarity index 100% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC I-macron (LaTeX).tmSnippet diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC I-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC I-macron.tmSnippet index 907f746..df8d6bf 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC I-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>Ī</string> <key>keyEquivalent</key> <string>^I</string> <key>name</key> <string>UC I-macron</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>I-</string> <key>uuid</key> <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC O-macron (LaTeX).tmSnippet similarity index 75% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC O-macron (LaTeX).tmSnippet index 5d10c17..6a82849 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron (LaTeX).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC O-macron (LaTeX).tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>\={O}</string> <key>keyEquivalent</key> <string>^O</string> <key>name</key> <string>UC O-macron (LaTeX)</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC O-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC O-macron.tmSnippet index 213aa16..884328d 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC O-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>Ō</string> <key>keyEquivalent</key> <string>^O</string> <key>name</key> <string>UC O-macron</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>O-</string> <key>uuid</key> <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC U-macron (LaTeX).tmSnippet similarity index 75% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron (LaTeX).tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC U-macron (LaTeX).tmSnippet index 579178c..3621b0a 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron (LaTeX).tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC U-macron (LaTeX).tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>\={U}</string> <key>keyEquivalent</key> <string>^U</string> <key>name</key> <string>UC U-macron (LaTeX)</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC U-macron.tmSnippet similarity index 77% rename from Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC U-macron.tmSnippet index fadce3e..0b383c8 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/UC U-macron.tmSnippet @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>Ū</string> <key>keyEquivalent</key> <string>^U</string> <key>name</key> <string>UC U-macron</string> <key>scope</key> <string>text.html</string> <key>tabTrigger</key> <string>U-</string> <key>uuid</key> <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/You (plural) injector.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/You (plural) injector.tmSnippet similarity index 76% rename from Textmate_tools/Latin Student.tmbundle/Snippets/You (plural) injector.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/You (plural) injector.tmSnippet index 8d9f88b..a030dd0 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/You (plural) injector.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/You (plural) injector.tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>you (pl.) </string> <key>name</key> <string>You (plural) injector</string> <key>scope</key> <string>text.tex.latex</string> <key>tabTrigger</key> <string>ypl</string> <key>uuid</key> <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/You (singular) injector.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/You (singular) injector.tmSnippet similarity index 76% rename from Textmate_tools/Latin Student.tmbundle/Snippets/You (singular) injector.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/You (singular) injector.tmSnippet index 084cd52..b6add28 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/You (singular) injector.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/You (singular) injector.tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>you (sg.)</string> <key>name</key> <string>You (singular) injector</string> <key>scope</key> <string>text.tex.latex</string> <key>tabTrigger</key> <string>ysg</string> <key>uuid</key> <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Your (plural) injector.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Your (plural) injector.tmSnippet similarity index 73% rename from Textmate_tools/Latin Student.tmbundle/Snippets/Your (plural) injector.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Your (plural) injector.tmSnippet index 386adff..e2e0723 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/Your (plural) injector.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Your (plural) injector.tmSnippet @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>your (pl.)</string> <key>name</key> <string>Your (plural) injector</string> <key>tabTrigger</key> <string>yrpl</string> <key>uuid</key> <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Your (singular) injector.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Your (singular) injector.tmSnippet similarity index 76% rename from Textmate_tools/Latin Student.tmbundle/Snippets/Your (singular) injector.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Your (singular) injector.tmSnippet index 06163b7..a50ee40 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/Your (singular) injector.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/Your (singular) injector.tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>your (sg.) </string> <key>name</key> <string>Your (singular) injector</string> <key>scope</key> <string>text.tex.latex</string> <key>tabTrigger</key> <string>yrsg</string> <key>uuid</key> <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/by:from:with injector.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/by:from:with injector.tmSnippet similarity index 76% rename from Textmate_tools/Latin Student.tmbundle/Snippets/by:from:with injector.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/by:from:with injector.tmSnippet index 5a422bb..9a0ea54 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/by:from:with injector.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/by:from:with injector.tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>by / from / with</string> <key>name</key> <string>by/from/with injector</string> <key>scope</key> <string>text.tex.latex</string> <key>tabTrigger</key> <string>bfw</string> <key>uuid</key> <string>96ED174C-FAB9-4282-80D4-C8831F0DF524</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/to:for Injector.tmSnippet b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/to:for Injector.tmSnippet similarity index 75% rename from Textmate_tools/Latin Student.tmbundle/Snippets/to:for Injector.tmSnippet rename to Textmate_tools/Latin Student (HTML).tmbundle/Snippets/to:for Injector.tmSnippet index 4ebf691..edff9c6 100644 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/to:for Injector.tmSnippet +++ b/Textmate_tools/Latin Student (HTML).tmbundle/Snippets/to:for Injector.tmSnippet @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>to / for</string> <key>name</key> <string>to/for Injector</string> <key>scope</key> <string>text.tex.latex</string> <key>tabTrigger</key> <string>tf</string> <key>uuid</key> <string>F5E7EC86-6600-41F2-8286-C114E6722644</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/info.plist b/Textmate_tools/Latin Student (HTML).tmbundle/info.plist similarity index 97% rename from Textmate_tools/Latin Student.tmbundle/info.plist rename to Textmate_tools/Latin Student (HTML).tmbundle/info.plist index 8171e3e..991b95a 100644 --- a/Textmate_tools/Latin Student.tmbundle/info.plist +++ b/Textmate_tools/Latin Student (HTML).tmbundle/info.plist @@ -1,126 +1,128 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>mainMenu</key> <dict> <key>items</key> <array> <string>1E2402E7-A411-4EDF-AE3C-56881B0B7CE9</string> <string>B574C1C3-FD9D-42F2-A1E0-D21656684C50</string> <string>------------------------------------</string> <string>C7F5F012-979F-4D58-B163-E640A372B433</string> <string>05DA44D5-9196-44B8-9573-DAA3C1209A11</string> <string>BA51A62B-FE9E-4753-B54A-C84C3A273AB1</string> <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> </array> <key>submenus</key> <dict> <key>1E2402E7-A411-4EDF-AE3C-56881B0B7CE9</key> <dict> <key>items</key> <array> <string>25C01553-393E-4C85-B64C-996605339DA9</string> <string>AD2743B4-06BA-4782-AC2E-28BD5A651BC6</string> <string>912E9565-8ECF-43EC-8CF7-1A41F04CEF3D</string> <string>B5E0AAB1-BCA7-43A1-BA17-06FF9B572ECA</string> <string>27C92149-4C0B-4556-A5A1-A988FD44396D</string> <string>A5F2EEBE-2F3D-4384-9369-05D8B7205BA0</string> <string>24E770E1-578D-4E38-8FC9-6DED12F973AA</string> <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> <string>961DF4E3-D426-4651-99D1-B732E1F70C68</string> <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> <string>A3426F48-B80F-4E3F-9BC4-D0D9AECFC5D4</string> </array> <key>name</key> <string>Latin ( LaTeX )</string> </dict> <key>B574C1C3-FD9D-42F2-A1E0-D21656684C50</key> <dict> <key>items</key> <array> <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> <string>AAF2B6D5-C0B0-4BF2-90AE-B6125206509E</string> <string>FBE97330-A6CF-4AC8-8CD3-9D55C08A848D</string> <string>D209E25A-9DF3-40D5-A427-31F1F411257B</string> <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> <string>C5431CB4-0507-4C7A-8A4D-7D7D439DB514</string> </array> <key>name</key> <string>Latin ( HTML )</string> </dict> </dict> </dict> <key>name</key> <string>Latin Student</string> <key>ordering</key> <array> <string>E5DB283A-D01E-4A75-9247-6D9357773543</string> <string>F5E7EC86-6600-41F2-8286-C114E6722644</string> <string>96ED174C-FAB9-4282-80D4-C8831F0DF524</string> <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> <string>912E9565-8ECF-43EC-8CF7-1A41F04CEF3D</string> <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> <string>B5E0AAB1-BCA7-43A1-BA17-06FF9B572ECA</string> <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> <string>27C92149-4C0B-4556-A5A1-A988FD44396D</string> <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> <string>A5F2EEBE-2F3D-4384-9369-05D8B7205BA0</string> <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> <string>24E770E1-578D-4E38-8FC9-6DED12F973AA</string> <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> <string>961DF4E3-D426-4651-99D1-B732E1F70C68</string> <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> <string>0523F5F2-F3C0-416F-AC4A-147ABF41789F</string> <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> <string>1C2E22E3-E416-4C39-9853-608A3AB2B296</string> <string>649255CF-3206-4658-8A4D-5643FA78FCFA</string> <string>6473A22F-384C-410F-85EB-67106E3AA535</string> <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> <string>C7F5F012-979F-4D58-B163-E640A372B433</string> <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> <string>25C01553-393E-4C85-B64C-996605339DA9</string> <string>06C355BE-4AAB-43AB-960D-8052B96FB59B</string> <string>CDECBD60-25FA-4CE8-BBB4-6EEB3366BCB9</string> <string>820DE7CF-56AE-4715-AB5A-193CFE9FB77D</string> - <string>F95CE540-D073-47EE-9F06-02620DD39B49</string> + <string>BD7CFABA-F0E7-4073-A7FC-A3A6B29FC409</string> + <string>F070077C-309C-47AA-90CF-0D18FD6CC4ED</string> + <string>A95373C4-4760-4690-A41B-FA85D6A6A2AF</string> </array> <key>uuid</key> <string>88DEA1FE-4C33-483B-A5F6-3A08FDA41510</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/untitled.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/untitled.tmCommand deleted file mode 100644 index 5eb424e..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Commands/untitled.tmCommand +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>beforeRunningCommand</key> - <string>nop</string> - <key>command</key> - <string># just to remind you of some useful environment variables -# see Help / Environment Variables for the full list -echo File: "$TM_FILEPATH" -echo Word: "$TM_CURRENT_WORD" -echo Selection: "$TM_SELECTED_TEXT"</string> - <key>input</key> - <string>selection</string> - <key>name</key> - <string>untitled</string> - <key>output</key> - <string>replaceSelectedText</string> - <key>uuid</key> - <string>F95CE540-D073-47EE-9F06-02620DD39B49</string> -</dict> -</plist>
sgharms/latintools
19392a1cb116705d37d44e342e2117b4b30e3e8c
Fixed bug around the I+macron glyph. It is entered in LaTeX as \={I} not \={\I}.
diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons To Character Entities.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons To Character Entities.tmCommand index 9a057a9..6d23b1a 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons To Character Entities.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons To Character Entities.tmCommand @@ -1,94 +1,94 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby module MacronConversions LATEX_TO_MACRONS_CHARACTERS = { "\\={a}" =&gt; "ā", "\\={e}" =&gt; "ē", "\\={\\i}" =&gt; "ī", "\\={o}" =&gt; "ō", "\\={u}" =&gt; "ū", "\\={A}" =&gt; "Ā", "\\={E}" =&gt; "Ē", - "\\={\\I}" =&gt; "Ī", + "\\={I}" =&gt; "Ī", "\\={O}" =&gt; "Ō", "\\={U}" =&gt; "Ū", } LATEX_TO_UTF8 ={ "\\={a}" =&gt; "\\xc4\\x81", "\\={e}" =&gt; "\\xc4\\x93", "\\={\\i}" =&gt; "\\xc4\\xab", "\\={o}" =&gt; "\\xc5\\x8d", "\\={u}" =&gt; "\\xc5\\xab", "\\={A}" =&gt; "\\xc4\\x80", "\\={E}" =&gt; "\\xc4\\x92", - "\\={\\I}" =&gt; "\\xc4\\xaa", + "\\={I}" =&gt; "\\xc4\\xaa", "\\={O}" =&gt; "\\xc5\\x8c", "\\={U}" =&gt; "\\xc5\\xaa", } LATEX_TO_HTML_ENTITIES = { "\\={a}" =&gt; "&amp;#x101;", "\\={e}" =&gt; "&amp;#x113;", "\\={\\i}" =&gt; "&amp;#x12b;", "\\={o}" =&gt; "&amp;#x14d;", "\\={u}" =&gt; "&amp;#x16b;", "\\={A}" =&gt; "&amp;#x100;", "\\={E}" =&gt; "&amp;#x112;", - "\\={\\I}" =&gt; "&amp;#x12a;", + "\\={I}" =&gt; "&amp;#x12a;", "\\={O}" =&gt; "&amp;#x14c;", "\\={U}" =&gt; "&amp;#x16a;", } class Converter &lt; Object def initialize(*ray) @target = ray[0].nil? ? 'html' : ray[0] @index=Array.new end def processString(s) firstSlash = s =~ /(\\=.*?\})/ - return "" if $1.nil? + return s if $1.nil? testChar = $1 if firstSlash == 0 return processChar(testChar) + processString(s[firstSlash+testChar.length..s.length]) end return s[0..firstSlash-1] + processChar(testChar) + processString(s[firstSlash+testChar.length..s.length]) end def processChar(c) LATEX_TO_MACRONS_CHARACTERS[c] end end end unless STDIN.tty? content=STDIN.read else content=ARGV[0] end puts MacronConversions::Converter.new().processString(content) </string> <key>input</key> <string>selection</string> <key>name</key> <string>Latex Macrons To Character Entities</string> <key>output</key> <string>replaceSelectedText</string> <key>uuid</key> <string>649255CF-3206-4658-8A4D-5643FA78FCFA</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand index 60a894e..3d1bc98 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand @@ -1,94 +1,94 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby module MacronConversions LATEX_TO_MACRONS_CHARACTERS = { "\\={a}" =&gt; "ā", "\\={e}" =&gt; "ē", "\\={\\i}" =&gt; "ī", "\\={o}" =&gt; "ō", "\\={u}" =&gt; "ū", "\\={A}" =&gt; "Ā", "\\={E}" =&gt; "Ē", - "\\={\\I}" =&gt; "Ī", + "\\={I}" =&gt; "Ī", "\\={O}" =&gt; "Ō", "\\={U}" =&gt; "Ū", } LATEX_TO_UTF8 ={ "\\={a}" =&gt; "\\xc4\\x81", "\\={e}" =&gt; "\\xc4\\x93", "\\={\\i}" =&gt; "\\xc4\\xab", "\\={o}" =&gt; "\\xc5\\x8d", "\\={u}" =&gt; "\\xc5\\xab", "\\={A}" =&gt; "\\xc4\\x80", "\\={E}" =&gt; "\\xc4\\x92", - "\\={\\I}" =&gt; "\\xc4\\xaa", + "\\={I}" =&gt; "\\xc4\\xaa", "\\={O}" =&gt; "\\xc5\\x8c", "\\={U}" =&gt; "\\xc5\\xaa", } LATEX_TO_HTML_ENTITIES = { "\\={a}" =&gt; "&amp;#x101;", "\\={e}" =&gt; "&amp;#x113;", "\\={\\i}" =&gt; "&amp;#x12b;", "\\={o}" =&gt; "&amp;#x14d;", "\\={u}" =&gt; "&amp;#x16b;", "\\={A}" =&gt; "&amp;#x100;", "\\={E}" =&gt; "&amp;#x112;", - "\\={\\I}" =&gt; "&amp;#x12a;", + "\\={I}" =&gt; "&amp;#x12a;", "\\={O}" =&gt; "&amp;#x14c;", "\\={U}" =&gt; "&amp;#x16a;", } class Converter &lt; Object def initialize(*ray) @target = ray[0].nil? ? 'html' : ray[0] @index=Array.new end def processString(s) firstSlash = s =~ /(\\=.*?\})/ - return "" if $1.nil? + return s if $1.nil? testChar = $1 if firstSlash == 0 return processChar(testChar) + processString(s[firstSlash+testChar.length..s.length]) end return s[0..firstSlash-1] + processChar(testChar) + processString(s[firstSlash+testChar.length..s.length]) end def processChar(c) LATEX_TO_HTML_ENTITIES[c] end end end unless STDIN.tty? content=STDIN.read else content=ARGV[0] end puts MacronConversions::Converter.new().processString(content) </string> <key>input</key> <string>selection</string> <key>name</key> <string>Latex Macrons to HTML Entities</string> <key>output</key> <string>replaceSelectedText</string> <key>uuid</key> <string>1C2E22E3-E416-4C39-9853-608A3AB2B296</string> </dict> </plist>
sgharms/latintools
c28fb526bd91e39dc1656abd6f35fd150cf45edb
Modified to ligaturize AE and ae on execution execution of Lines to Latlines
diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand index 52d5c67..dcc6f3b 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand @@ -1,30 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby counter = 0 STDIN.read.each do |content| printf("\\latline\n {%s}\n { Translation }\n {110}\n { CorrectedTranslation }\n { Notes }\n\n\n", - content.chomp.gsub(/\\\=\{(\\*.)\}/,"\\\={\\macron {\\1}}")) + content.chomp.gsub(/ae/, "{\\ae\}").gsub(/^(Ae|AE)(.*)/, "{\\AE\}\\2").gsub(/\\\=\{(\\*.)\}/,"\\\={\\macron {\\1}}")) end </string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>@L</string> <key>name</key> <string>Lines To Latlines</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>6473A22F-384C-410F-85EB-67106E3AA535</string> </dict> </plist>
sgharms/latintools
5c2a118ddf9981469dfb74f67637e0c2cbfc02eb
Added versenumerate for prefixing every number divisible by 5 with a versu number where the first line is the numerical base from which to start
diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/AELigatureize.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/AELigatureize.tmCommand index 8a3ad37..8a4da0e 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/AELigatureize.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/AELigatureize.tmCommand @@ -1,28 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/bin/env ruby line=String.new(ENV['TM_CURRENT_WORD']) line.gsub!(/ae/, "{\\ae\}") line.gsub!(/^(Ae|AE)(.*)/, "{\\AE\}\\2") print line.chomp</string> <key>fallbackInput</key> <string>word</string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> - <string>^q</string> + <string>@"</string> <key>name</key> <string>AELigatureize</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>CDECBD60-25FA-4CE8-BBB4-6EEB3366BCB9</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand index 310602f..52d5c67 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand @@ -1,33 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby counter = 0 STDIN.read.each do |content| printf("\\latline\n {%s}\n { Translation }\n {110}\n { CorrectedTranslation }\n { Notes }\n\n\n", content.chomp.gsub(/\\\=\{(\\*.)\}/,"\\\={\\macron {\\1}}")) - counter += 1 - print "\\newpage\n\n" if ( counter == 3) - counter = 0 if ( counter == 3 ) end </string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>@L</string> <key>name</key> <string>Lines To Latlines</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>6473A22F-384C-410F-85EB-67106E3AA535</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/VerseNumerate.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/VerseNumerate.tmCommand new file mode 100644 index 0000000..ce602d8 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/VerseNumerate.tmCommand @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +base = nil +lines = ENV['TM_SELECTED_TEXT'].split("\n") + +if lines[0]=~/(\d+)/ + base=lines.shift.to_i +else + base=0 +end + +lines.each do |line| + line = "[\\textbf\{#{base}\}] " + line if ( base.modulo(5) == 0 ) + puts line + + base += 1 + +end</string> + <key>input</key> + <string>selection</string> + <key>keyEquivalent</key> + <string>@N</string> + <key>name</key> + <string>VerseNumerate</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>820DE7CF-56AE-4715-AB5A-193CFE9FB77D</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/untitled.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/untitled.tmCommand new file mode 100644 index 0000000..5eb424e --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/untitled.tmCommand @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string># just to remind you of some useful environment variables +# see Help / Environment Variables for the full list +echo File: "$TM_FILEPATH" +echo Word: "$TM_CURRENT_WORD" +echo Selection: "$TM_SELECTED_TEXT"</string> + <key>input</key> + <string>selection</string> + <key>name</key> + <string>untitled</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>uuid</key> + <string>F95CE540-D073-47EE-9F06-02620DD39B49</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/info.plist b/Textmate_tools/Latin Student.tmbundle/info.plist index 16546f6..8171e3e 100644 --- a/Textmate_tools/Latin Student.tmbundle/info.plist +++ b/Textmate_tools/Latin Student.tmbundle/info.plist @@ -1,123 +1,126 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>mainMenu</key> <dict> <key>items</key> <array> <string>1E2402E7-A411-4EDF-AE3C-56881B0B7CE9</string> <string>B574C1C3-FD9D-42F2-A1E0-D21656684C50</string> <string>------------------------------------</string> <string>C7F5F012-979F-4D58-B163-E640A372B433</string> <string>05DA44D5-9196-44B8-9573-DAA3C1209A11</string> <string>BA51A62B-FE9E-4753-B54A-C84C3A273AB1</string> <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> </array> <key>submenus</key> <dict> <key>1E2402E7-A411-4EDF-AE3C-56881B0B7CE9</key> <dict> <key>items</key> <array> <string>25C01553-393E-4C85-B64C-996605339DA9</string> <string>AD2743B4-06BA-4782-AC2E-28BD5A651BC6</string> <string>912E9565-8ECF-43EC-8CF7-1A41F04CEF3D</string> <string>B5E0AAB1-BCA7-43A1-BA17-06FF9B572ECA</string> <string>27C92149-4C0B-4556-A5A1-A988FD44396D</string> <string>A5F2EEBE-2F3D-4384-9369-05D8B7205BA0</string> <string>24E770E1-578D-4E38-8FC9-6DED12F973AA</string> <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> <string>961DF4E3-D426-4651-99D1-B732E1F70C68</string> <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> <string>A3426F48-B80F-4E3F-9BC4-D0D9AECFC5D4</string> </array> <key>name</key> <string>Latin ( LaTeX )</string> </dict> <key>B574C1C3-FD9D-42F2-A1E0-D21656684C50</key> <dict> <key>items</key> <array> <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> <string>AAF2B6D5-C0B0-4BF2-90AE-B6125206509E</string> <string>FBE97330-A6CF-4AC8-8CD3-9D55C08A848D</string> <string>D209E25A-9DF3-40D5-A427-31F1F411257B</string> <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> <string>C5431CB4-0507-4C7A-8A4D-7D7D439DB514</string> </array> <key>name</key> <string>Latin ( HTML )</string> </dict> </dict> </dict> <key>name</key> <string>Latin Student</string> <key>ordering</key> <array> <string>E5DB283A-D01E-4A75-9247-6D9357773543</string> <string>F5E7EC86-6600-41F2-8286-C114E6722644</string> <string>96ED174C-FAB9-4282-80D4-C8831F0DF524</string> <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> <string>912E9565-8ECF-43EC-8CF7-1A41F04CEF3D</string> <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> <string>B5E0AAB1-BCA7-43A1-BA17-06FF9B572ECA</string> <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> <string>27C92149-4C0B-4556-A5A1-A988FD44396D</string> <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> <string>A5F2EEBE-2F3D-4384-9369-05D8B7205BA0</string> <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> <string>24E770E1-578D-4E38-8FC9-6DED12F973AA</string> <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> <string>961DF4E3-D426-4651-99D1-B732E1F70C68</string> <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> <string>0523F5F2-F3C0-416F-AC4A-147ABF41789F</string> <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> <string>1C2E22E3-E416-4C39-9853-608A3AB2B296</string> <string>649255CF-3206-4658-8A4D-5643FA78FCFA</string> <string>6473A22F-384C-410F-85EB-67106E3AA535</string> <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> <string>C7F5F012-979F-4D58-B163-E640A372B433</string> <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> <string>25C01553-393E-4C85-B64C-996605339DA9</string> <string>06C355BE-4AAB-43AB-960D-8052B96FB59B</string> + <string>CDECBD60-25FA-4CE8-BBB4-6EEB3366BCB9</string> + <string>820DE7CF-56AE-4715-AB5A-193CFE9FB77D</string> + <string>F95CE540-D073-47EE-9F06-02620DD39B49</string> </array> <key>uuid</key> <string>88DEA1FE-4C33-483B-A5F6-3A08FDA41510</string> </dict> </plist>
sgharms/latintools
ef35655b926e8ccb0c054699e645c24988bf90d1
Wrapped latlines in parboxes to fix page breaks
diff --git a/LaTeX_tools/latinpoetry.sty b/LaTeX_tools/latinpoetry.sty index a8ebfcd..cd8c1a0 100644 --- a/LaTeX_tools/latinpoetry.sty +++ b/LaTeX_tools/latinpoetry.sty @@ -1,81 +1,84 @@ \newcommand{\trans}[1]{ \begin{normalsize} \begin{sc} {{#1}} \end{sc} \end{normalsize} } \newcommand{\transcorr}[1]{ \vskip 5mm \hskip 10pt % We make this guy small because we're going to fit it in a framed box \small \rule{130mm}{.1mm}\\ {\it{#1}}\\ \rule{130mm}{.1mm} } \newcommand{\latblock}[2]{ \Large \begin{verse} \begin{metrica} {#1}\\ \end{metrica} \trans{{#2}}\\ \end{verse} \normalsize } \newcommand{\commentary}[2]{ \vskip5mm \normalsize \begin{picture} % (moves boxt left/right,moves box up/down vertically)() (50,{#1}) % Creates the canvas space in which the frame will live % % Custom offsets for positioning the box (-35,0) % First arg is the X offset, negatives move inward; % positives, outword % relative to the position within the \picture inveronment \put (00,10) % Positioning of the box { \framebox (400,{#1})[t] % Width of the box, height of the box { \begin{minipage}[t]{380pt} \vskip 5pt {#2} \vskip 5pt \end{minipage} } } \end{picture} \vskip 1mm } \newcommand{\latline}[5]{ - \latblock{#1}{#2} - \commentary{#3}{ - \transcorr{#4} - #5 - } + \noindent + \parbox[b]{6in}{ + \latblock{#1}{#2} + \commentary{#3}{ + \transcorr{#4} + #5 + } + } }{{}} \newcommand{\outlinestyle}[0]{ \renewcommand{\labelenumi}{\Roman{enumi}.} \renewcommand{\labelenumii}{\Alph{enumii}.} \renewcommand{\labelenumiii}{\arabic{enumiii}.} \renewcommand{\labelenumiv}{\alph{enumiv}.} } \newcommand{\enumstyle}[0]{ \renewcommand{\labelenumi}{\arabic{enumi}.} \renewcommand{\labelenumii}{\Alph{enumii}.} \renewcommand{\labelenumiii}{\roman{enumiii}.} \renewcommand{\labelenumiv}{\alph{enumiv}.} }
sgharms/latintools
d1b7e0a72dc4855b9758102ea87d84e5ed0d3d39
Added AELigaturize. Through use of ^q you can look at currentWord and replace ae with the LaTeX code for {\AE} or {\ae} ligatures.
diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/AELigatureize.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/AELigatureize.tmCommand new file mode 100644 index 0000000..8a3ad37 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/AELigatureize.tmCommand @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/bin/env ruby +line=String.new(ENV['TM_CURRENT_WORD']) +line.gsub!(/ae/, "{\\ae\}") +line.gsub!(/^(Ae|AE)(.*)/, "{\\AE\}\\2") +print line.chomp</string> + <key>fallbackInput</key> + <string>word</string> + <key>input</key> + <string>selection</string> + <key>keyEquivalent</key> + <string>^q</string> + <key>name</key> + <string>AELigatureize</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>CDECBD60-25FA-4CE8-BBB4-6EEB3366BCB9</string> +</dict> +</plist>
sgharms/latintools
ad8c4c2c8fd45ece12359749d8e777da129ef684
fixed regression where \newline needed to be \\newline
diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand index 09e5ffb..310602f 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand @@ -1,33 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby counter = 0 STDIN.read.each do |content| printf("\\latline\n {%s}\n { Translation }\n {110}\n { CorrectedTranslation }\n { Notes }\n\n\n", content.chomp.gsub(/\\\=\{(\\*.)\}/,"\\\={\\macron {\\1}}")) counter += 1 - print "\newpage\n\n" if ( counter == 3) + print "\\newpage\n\n" if ( counter == 3) counter = 0 if ( counter == 3 ) end </string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>@L</string> <key>name</key> <string>Lines To Latlines</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>6473A22F-384C-410F-85EB-67106E3AA535</string> </dict> </plist>
sgharms/latintools
879b6e4080e0942ba21a4e6bab88b74b45f623a5
added the shell tool latex2latin
diff --git a/Shell_tools/MacronConversions.rb b/Shell_tools/MacronConversions.rb new file mode 100644 index 0000000..fd930fc --- /dev/null +++ b/Shell_tools/MacronConversions.rb @@ -0,0 +1,227 @@ +# == Synopsis +# +# MacronConversions: module providing classes to convert macron (dis-)enabled strings into the opposite. +# +# == Usage +# +# load 'language/MacronConversions.rb' +# +# == Description +# +# The class provides two classes: MacronConverter and MacronDeConverter. In the event that you need to transform LaTeX-style markep into entities of some +# sort, use the former class. In the event that you need to down-sample macron-characters into LaTeX-style, use the latter. +# +# == Example Code +# +# load 'language/MacronConversions.rb' +# +# # Basic conversion and advanced conversion +# +# puts MacronConversions::MacronConverter.new("mon\\={e}re", 'mc') +# puts MacronConversions::MacronConverter.new('to bring up, educate: \={e}duc\={o}, \={e}duc\={a}re, \={e}duc\={a}v\={\i}, \={e}ducatus; education, educator, educable', 'mc') +# +# # Vanilla de-conversion +# puts MacronConversions::MacronDeConverter.new("vanilla") +# +# # Complex de-conversion +# puts MacronConversions::MacronDeConverter.new("laudāre") +# +# # Coup de grace +# puts MacronConversions::MacronDeConverter.new( +# MacronConversions::MacronConverter.new('to bring up, educate: \={e}duc\={o}, \={e}duc\={a}re, \={e}duc\={a}v\={\i}, \={e}ducatus; education, educator, educable', 'mc').to_s) +# +# == Dependencies +# +# Requires the 'unicode/SGHUnicode' module +# +# == Author +# +# Steven G. Harms, http://www.stevengharms.com + +module MacronConversions + require '/users/sgharms/lib/unicode/SGHUnicode' + + LATEX_TO_MACRONS_CHARACTERS = { + "\\={a}" => "ā", + "\\={e}" => "ē", + "\\={\\i}" => "ī", + "\\={o}" => "ō", + "\\={u}" => "ū", + "\\={A}" => "Ā", + "\\={E}" => "Ē", + "\\={I}" => "Ī", + "\\={O}" => "Ō", + "\\={U}" => "Ū", + } + + LATEX_TO_UTF8 ={ + "\\={a}" => "\\xc4\\x81", + "\\={e}" => "\\xc4\\x93", + "\\={\\i}" => "\\xc4\\xab", + "\\={o}" => "\\xc5\\x8d", + "\\={u}" => "\\xc5\\xab", + "\\={A}" => "\\xc4\\x80", + "\\={E}" => "\\xc4\\x92", + "\\={\\I}" => "\\xc4\\xaa", + "\\={O}" => "\\xc5\\x8c", + "\\={U}" => "\\xc5\\xaa", + } + + LATEX_TO_HTML_ENTITIES = { + "\\={a}" => "&#x101;", + "\\={e}" => "&#x113;", + "\\={\\i}" => "&#x12b;", + "\\={o}" => "&#x14d;", + "\\={u}" => "&#x16b;", + "\\={A}" => "&#x100;", + "\\={E}" => "&#x112;", + "\\={\\I}" => "&#x12a;", + "\\={O}" => "&#x14c;", + "\\={U}" => "&#x16a;", + } + + class MacronConverter < Object + + attr_reader :convert + + # Initializer method expects to be provided a string to convert, and then one of three possible output + # types: high-numerical-code entities, UTF-8, and HTML entities. Absent + # any specification, output format will default to HTML numbered entities. + # + # MacronConverter.new(laud\={a}re) #-> laud&#x101;re + # + # MacronConverter.new(laud\={a}re, 'mc') #-> laudāre + + def initialize(orig_string, output_target='mc') + @orig_string = orig_string + @target = output_target + @convert = processString + end + + # This allows a MacronConverter object to be printed with "puts" + def to_s + return @convert + end + + def split(pattern) + return @convert.split(pattern) + end + + def to_a + return @convert.split(/\s+/) + end + +############################################################################## +# PRIVATE METHODS +############################################################################## + + private + # Process string is the routine that scans a token for LaTeX macron codes. + # The method is recursive, the sentinel value is when the first RegEx scan + # of the string returns nil. Upon the indetification of a macron-ized + # character, it passes that character to the private method + # MacronConverter#processChar + + def processString(s=@orig_string) + # All LaTeX Macron codes begin with an '=' token. Scan for that using a + # RegEx. The value is set to firstSlash. + + firstSlash = s =~ /(\\=.*?\})/ + return s if $1.nil? + + testChar = $1 + + # In the event that the first character is macron-bearing follow this + # case. + if firstSlash == 0 + return processChar(testChar).to_s + + processString(s[firstSlash+testChar.length..s.length]) + end + + # In the more general case, we take the original string up to the first + # macron-beginning-slash. We return that + running processChar on the + # remainder of the string, that is return part_ok + + # processString(the_rest). + + return s[0..firstSlash-1] + processChar(testChar).to_s + + processString(s[firstSlash+testChar.length..s.length]) + end + + # Given a singular character, it does a hash-table lookup against the + # constant-defined LATEX_TO_UTF8 LATEX_TO_HTML_ENTITIES or + # LATEX_TO_MACRONS_CHARACTERS hashes and returns the value from the hash + + def processChar(c) + if @target == 'utf8' + return LATEX_TO_UTF8[c] + end + if @target == 'html' + return LATEX_TO_HTML_ENTITIES[c] + end + if @target == "mc" + return LATEX_TO_MACRONS_CHARACTERS[c] + end + end + end + + class MacronDeConverter + attr_reader :convert + + # In the construction, pass in the string that you wish to convert + # + # e.g. MacronDeConverter.new(laudāre means to praise) #-> laud\={a}re means to praise + def initialize(content="No Content Provided - Consult Documentation") + + test_string=SGHUnicode::UnicodeSafeString.new(content) + + if test_string =~ /\&\#/ + @target = 'LATEX_TO_HTML_ENTITIES' + elsif test_string =~ /[āēīōūĀĒĪŌŪ]/ + @target = 'LATEX_TO_MACRONS_CHARACTERS' + elsif test_string =~ /\\\\x/ + @target = 'LATEX_TO_UTF8' + else + @target = nil + end + + unless @target.nil? + @reference_table=eval("MacronConversions::#{@target}") + @reference_table.each{|x,y| @reference_table[y]=x} + @convert = processString(test_string) + else + @convert = test_string + end + end + + # This allows a MacronDeConverter object to be printed with "puts" + def to_s + return @convert + end + + private + + # Iterates through the characters, looking up the meta-descriptor + # characters were found + def processString(s) + unless s.nil? + unless s.rest.empty? + return processChar(s.first) + processString(s.rest) + else + return processChar(s.first) + end + end + end + + # Looks up the character in the selected lookup chart. Turns the + # meta descriptor character \={e} into the glyph. + + def processChar(c) + return @reference_table.key?(c) ? @reference_table[c] : c + end + + + end + +end + + diff --git a/Shell_tools/README b/Shell_tools/README new file mode 100644 index 0000000..70375df --- /dev/null +++ b/Shell_tools/README @@ -0,0 +1,7 @@ +latex2latin is a tool which will take an entered string of LaTeX formatted +entries and returns those entries in one of three forms: macron-entries ( +displayable if your terminal supports them ), HTML entities, or utf8 glyphs. + +The package has a dependency on MacronConversions.rb + +latex2latin has embedded rdoc. diff --git a/Shell_tools/latex2latin b/Shell_tools/latex2latin new file mode 100755 index 0000000..d11158a --- /dev/null +++ b/Shell_tools/latex2latin @@ -0,0 +1,93 @@ +#!/usr/bin/env ruby +# +# == Synopsis +# +# latex2latin: Takes a string, in LaTeX-macron formatting and returns the string, with +# macrons turned into some other entity ( high-ASCII, HTML entity, UTF-8 bytecodes). +# +# == Usage +# +# latex2latin [CONVERSION FORMAT] content +# +# Content is a macron-possessing string, latex2latin will convert it into the selected macron-entity +# format: a multibyte character ( -m ), a UTF-8 enabled string ( -u ), or an +# HTML entity ( -h ). +# +# * -?, --help: +# show help +# +# * --macron m: +# Prints the macronized characters as associated high-ASCII character. If you have a good terminal +# emulator like urxvt, you'll see a letter with a bar over it +# +# * --html, h: +# Prints the macronized character as associated HTML entity in &#(number) format +# +# * --utf8, u: +# Prints the macronized character as associated HTML entity in &#(number) format +# +# * --help, -?: +# this documentation +# +# == Examples +# +# $./latex2latin -m '\={a}\={e}\={\i}\={A}\={I}' +# āēīĀĪ +# $./latex2latin -m '\={a}\={e}\={\i}\={A}\={I}' +# āēīĀĪ +# $./latex2latin -h '\={a}\={e}\={\i}\={A}\={I}' +# &#x101;&#x113;&#x12b;&#x100; +# $./latex2latin -u '\={a}\={e}\={\i}\={A}\={I}' +# \xc4\x81\xc4\x93\xc4\xab\xc4\x80 +# +# +# +# == Dependencies +# +# Requires the MacronConversions module +# +# == Author +# +# Steven G. Harms, http://www.stevengharms.com + +require 'MacronConversions' +require 'getoptlong' +require 'rdoc/usage' + +opts = GetoptLong.new( + [ '--macron', '-m', GetoptLong::NO_ARGUMENT ], + [ '--html', '-h', GetoptLong::NO_ARGUMENT ], + [ '--utf8', '-u', GetoptLong::NO_ARGUMENT ], + [ '--content', '-c', GetoptLong::REQUIRED_ARGUMENT], + [ '--help', '-?', GetoptLong::OPTIONAL_ARGUMENT] + ) + +$mode='html' + + +opts.each do |opt,value| + case opt + when '--macron' + $mode = 'mc' + when '--html' + $mode = 'html' + when '--utf8' + $mode = 'utf8' + when '--content' + $content = value + when '--help' + RDoc::usage + end +end + + +if $content.nil? + $content = ARGV.shift +end + +if $content.nil? + puts "Did not receive content to operate on." + exit 1 +end + +puts MacronConversions::MacronConverter.new($content, $mode) diff --git a/Shell_tools/placeholder b/Shell_tools/placeholder deleted file mode 100644 index e69de29..0000000
sgharms/latintools
090768a86ef700bfffc98a164943dc97b643d452
added url to blip.tv movie in README
diff --git a/README b/README index 991821a..bdb6b02 100644 --- a/README +++ b/README @@ -1,42 +1,45 @@ This is a project for tools that help you write Latin more easily. For a summary of why this exists, check out the wiki page: http://wiki.github.com/sgharms/latintools +Or, watch a video of how this can be used at: +http://blip.tv/file/1745072/ + Tools fall into these varieties: + LaTeX_tools - LaTeX styles that help with the annotation of verse \latblock { \={\macron A}rm\-a v\-ir\=umqu\-e c\-an{\={\macron o}}, $||$ Tr\={o}j\={\ae} qu\={\macron{\i}} pr\={\macron{\i}}m\-us \-ab \={o}r\={\macron{\i}}s } {I sing of arms and the man, who came from the borders of Troy } Dependencies: Documents will need the following packages: \usepackage{setspace} \usepackage{ulem} \usepackage{framed} \usepackage[en]{metre} + Textmate_tools - Latin Student.tmbundle A Textmate bundle that is used to speed up typing of Latin text. 1. In a LaTeX file, entering control+[aeiou] or [AEIOU] will result in a LaTeX macron glyph (e.g. \={a}). This allows you to touch-type text in without fear 2. Contains the "Dactylize" method which takes glyphs with macrons, and then, above them, suspends another long mark automatically. When doing scansion, this will allow your long vowels to have a macron AND for you to have another long mark 2 units above so that, when combined with short marks, you can have a full, beautifully typeset scansion line. + Shell_tools - Tools that change LaTeX characters into Unicode characters with macrons
sgharms/latintools
544cf5c2e66d3d5a2e91afc942ef3dad72a36019
fixed regex
diff --git a/Shell_tools/placeholder b/Shell_tools/placeholder new file mode 100644 index 0000000..e69de29 diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand index 03c944e..e3f0242 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand @@ -1,23 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby -puts STDIN.read.gsub(/\\\=\{\\+/,'\={\macron ')</string> +puts STDIN.read.gsub(/\\\=\{(\\*.)\}/,"\\\={\\macron {\\1}}")</string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>@d</string> <key>name</key> <string>Dactylizer</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>0523F5F2-F3C0-416F-AC4A-147ABF41789F</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand index 67b27f9..09e5ffb 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand @@ -1,29 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby counter = 0 STDIN.read.each do |content| printf("\\latline\n {%s}\n { Translation }\n {110}\n { CorrectedTranslation }\n { Notes }\n\n\n", - content.chomp.gsub(/\\\=\{(.*?)\}/,"\\\={\\macron {\\1}}")) + content.chomp.gsub(/\\\=\{(\\*.)\}/,"\\\={\\macron {\\1}}")) counter += 1 - print "\\newpage\n\n" if ( counter == 3) + print "\newpage\n\n" if ( counter == 3) counter = 0 if ( counter == 3 ) end </string> <key>input</key> <string>selection</string> + <key>keyEquivalent</key> + <string>@L</string> <key>name</key> <string>Lines To Latlines</string> <key>output</key> <string>replaceSelectedText</string> + <key>scope</key> + <string>text.tex.latex</string> <key>uuid</key> <string>6473A22F-384C-410F-85EB-67106E3AA535</string> </dict> </plist>
sgharms/latintools
57dcf9ac7651f2d36d25acf66d9f621bf0b93cf4
moved merged-in latinpoetry project. Ending that project as it fits in here in a larger sense.
diff --git a/TEMPLATE.pdf b/LaTeX_tools/TEMPLATE.pdf similarity index 100% rename from TEMPLATE.pdf rename to LaTeX_tools/TEMPLATE.pdf diff --git a/TEMPLATE.tex b/LaTeX_tools/TEMPLATE.tex similarity index 100% rename from TEMPLATE.tex rename to LaTeX_tools/TEMPLATE.tex diff --git a/aeneid_example.pdf b/LaTeX_tools/aeneid_example.pdf similarity index 100% rename from aeneid_example.pdf rename to LaTeX_tools/aeneid_example.pdf diff --git a/aeneid_example.tex b/LaTeX_tools/aeneid_example.tex similarity index 100% rename from aeneid_example.tex rename to LaTeX_tools/aeneid_example.tex diff --git a/latinpoetry.sty b/LaTeX_tools/latinpoetry.sty similarity index 100% rename from latinpoetry.sty rename to LaTeX_tools/latinpoetry.sty diff --git a/LaTeX_tools/placeholder b/LaTeX_tools/placeholder deleted file mode 100644 index e69de29..0000000 diff --git a/README b/README index b3c66fe..991821a 100644 --- a/README +++ b/README @@ -1,39 +1,42 @@ This is a project for tools that help you write Latin more easily. +For a summary of why this exists, check out the wiki page: +http://wiki.github.com/sgharms/latintools + Tools fall into these varieties: + LaTeX_tools - LaTeX styles that help with the annotation of verse \latblock { \={\macron A}rm\-a v\-ir\=umqu\-e c\-an{\={\macron o}}, $||$ Tr\={o}j\={\ae} qu\={\macron{\i}} pr\={\macron{\i}}m\-us \-ab \={o}r\={\macron{\i}}s } {I sing of arms and the man, who came from the borders of Troy } Dependencies: Documents will need the following packages: \usepackage{setspace} \usepackage{ulem} \usepackage{framed} \usepackage[en]{metre} + Textmate_tools - Latin Student.tmbundle A Textmate bundle that is used to speed up typing of Latin text. 1. In a LaTeX file, entering control+[aeiou] or [AEIOU] will result in a LaTeX macron glyph (e.g. \={a}). This allows you to touch-type text in without fear 2. Contains the "Dactylize" method which takes glyphs with macrons, and then, above them, suspends another long mark automatically. When doing scansion, this will allow your long vowels to have a macron AND for you to have another long mark 2 units above so that, when combined with short marks, you can have a full, beautifully typeset scansion line. + Shell_tools - Tools that change LaTeX characters into Unicode characters with macrons
sgharms/latintools
007f3c12d53f204520a9bf1a1d9a50b7a524834b
added url to blip.tv movie in README
diff --git a/README b/README index 991821a..bdb6b02 100644 --- a/README +++ b/README @@ -1,42 +1,45 @@ This is a project for tools that help you write Latin more easily. For a summary of why this exists, check out the wiki page: http://wiki.github.com/sgharms/latintools +Or, watch a video of how this can be used at: +http://blip.tv/file/1745072/ + Tools fall into these varieties: + LaTeX_tools - LaTeX styles that help with the annotation of verse \latblock { \={\macron A}rm\-a v\-ir\=umqu\-e c\-an{\={\macron o}}, $||$ Tr\={o}j\={\ae} qu\={\macron{\i}} pr\={\macron{\i}}m\-us \-ab \={o}r\={\macron{\i}}s } {I sing of arms and the man, who came from the borders of Troy } Dependencies: Documents will need the following packages: \usepackage{setspace} \usepackage{ulem} \usepackage{framed} \usepackage[en]{metre} + Textmate_tools - Latin Student.tmbundle A Textmate bundle that is used to speed up typing of Latin text. 1. In a LaTeX file, entering control+[aeiou] or [AEIOU] will result in a LaTeX macron glyph (e.g. \={a}). This allows you to touch-type text in without fear 2. Contains the "Dactylize" method which takes glyphs with macrons, and then, above them, suspends another long mark automatically. When doing scansion, this will allow your long vowels to have a macron AND for you to have another long mark 2 units above so that, when combined with short marks, you can have a full, beautifully typeset scansion line. + Shell_tools - Tools that change LaTeX characters into Unicode characters with macrons
sgharms/latintools
240c855eade405a885e91e9e7e41767ef2ade662
added placeholder for shell tools
diff --git a/Shell_tools/placeholder b/Shell_tools/placeholder new file mode 100644 index 0000000..e69de29
sgharms/latintools
5bf07934956489bf5a4d41834b027c6e1d7db8a4
fixed regex
diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand index 03c944e..e3f0242 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand @@ -1,23 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby -puts STDIN.read.gsub(/\\\=\{\\+/,'\={\macron ')</string> +puts STDIN.read.gsub(/\\\=\{(\\*.)\}/,"\\\={\\macron {\\1}}")</string> <key>input</key> <string>selection</string> <key>keyEquivalent</key> <string>@d</string> <key>name</key> <string>Dactylizer</string> <key>output</key> <string>replaceSelectedText</string> <key>scope</key> <string>text.tex.latex</string> <key>uuid</key> <string>0523F5F2-F3C0-416F-AC4A-147ABF41789F</string> </dict> </plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand index 67b27f9..09e5ffb 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand @@ -1,29 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby counter = 0 STDIN.read.each do |content| printf("\\latline\n {%s}\n { Translation }\n {110}\n { CorrectedTranslation }\n { Notes }\n\n\n", - content.chomp.gsub(/\\\=\{(.*?)\}/,"\\\={\\macron {\\1}}")) + content.chomp.gsub(/\\\=\{(\\*.)\}/,"\\\={\\macron {\\1}}")) counter += 1 - print "\\newpage\n\n" if ( counter == 3) + print "\newpage\n\n" if ( counter == 3) counter = 0 if ( counter == 3 ) end </string> <key>input</key> <string>selection</string> + <key>keyEquivalent</key> + <string>@L</string> <key>name</key> <string>Lines To Latlines</string> <key>output</key> <string>replaceSelectedText</string> + <key>scope</key> + <string>text.tex.latex</string> <key>uuid</key> <string>6473A22F-384C-410F-85EB-67106E3AA535</string> </dict> </plist>
sgharms/latintools
730f807229be3fe46aa52ffbaf358056058914f5
got rid of legacy placeholder
diff --git a/LaTeX_tools/placeholder b/LaTeX_tools/placeholder deleted file mode 100644 index e69de29..0000000 diff --git a/README b/README index b3c66fe..991821a 100644 --- a/README +++ b/README @@ -1,39 +1,42 @@ This is a project for tools that help you write Latin more easily. +For a summary of why this exists, check out the wiki page: +http://wiki.github.com/sgharms/latintools + Tools fall into these varieties: + LaTeX_tools - LaTeX styles that help with the annotation of verse \latblock { \={\macron A}rm\-a v\-ir\=umqu\-e c\-an{\={\macron o}}, $||$ Tr\={o}j\={\ae} qu\={\macron{\i}} pr\={\macron{\i}}m\-us \-ab \={o}r\={\macron{\i}}s } {I sing of arms and the man, who came from the borders of Troy } Dependencies: Documents will need the following packages: \usepackage{setspace} \usepackage{ulem} \usepackage{framed} \usepackage[en]{metre} + Textmate_tools - Latin Student.tmbundle A Textmate bundle that is used to speed up typing of Latin text. 1. In a LaTeX file, entering control+[aeiou] or [AEIOU] will result in a LaTeX macron glyph (e.g. \={a}). This allows you to touch-type text in without fear 2. Contains the "Dactylize" method which takes glyphs with macrons, and then, above them, suspends another long mark automatically. When doing scansion, this will allow your long vowels to have a macron AND for you to have another long mark 2 units above so that, when combined with short marks, you can have a full, beautifully typeset scansion line. + Shell_tools - Tools that change LaTeX characters into Unicode characters with macrons
sgharms/latintools
c2db9b412703ab02a358f9cd81d1c1d9cd16a8b1
corrected macronizing regex for Textmate package
diff --git a/README b/README index 6f189f7..53a724b 100644 --- a/README +++ b/README @@ -1,21 +1,21 @@ This is a project for tools that help you write Latin more easily. Tools fall into these varieties: + LaTeX_tools - LaTeX styles that help with the annotation of verse + Textmate_tools - Latin Student.tmbundle A Textmate bundle that is used to speed up typing of Latin text. 1. In a LaTeX file, entering control+[aeiou] or [AEIOU] will result in a LaTeX macron glyph (e.g. \={a}). This allows you to touch-type text in without fear 2. Contains the "Dactylize" method which takes glyphs with macrons, and then, above them, suspends another long mark automatically. When doing scansion, this will allow your long vowels to have a macron AND for you to have another long mark 2 units above so that, when combined with short marks, you can have a full, beautifully typeset scansion line. - + CLI + + Shell_tools - Tools that change LaTeX characters into Unicode characters with macrons diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand index f69a68d..67b27f9 100644 --- a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand @@ -1,28 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>beforeRunningCommand</key> <string>nop</string> <key>command</key> <string>#!/usr/bin/env ruby counter = 0 STDIN.read.each do |content| - printf("\\latline\n {%s}\n { Translation }\n {110}\n { CorrectedTranslation }\n { Notes }\n\n\n", content.chomp.gsub(/\\\=\{\\+/,'\={\macron ')) + printf("\\latline\n {%s}\n { Translation }\n {110}\n { CorrectedTranslation }\n { Notes }\n\n\n", + content.chomp.gsub(/\\\=\{(.*?)\}/,"\\\={\\macron {\\1}}")) counter += 1 print "\\newpage\n\n" if ( counter == 3) counter = 0 if ( counter == 3 ) end </string> <key>input</key> <string>selection</string> <key>name</key> <string>Lines To Latlines</string> <key>output</key> <string>replaceSelectedText</string> <key>uuid</key> <string>6473A22F-384C-410F-85EB-67106E3AA535</string> </dict> </plist>
sgharms/latintools
d92cb7a3bc2f690716529e4135b9730340070b9e
added outlinestyle and enumstyle, ways to toggle between styles
diff --git a/latinpoetry.sty b/latinpoetry.sty index d6f57a4..03e5079 100644 --- a/latinpoetry.sty +++ b/latinpoetry.sty @@ -1,67 +1,81 @@ \newcommand{\trans}[1]{ \begin{normalsize} \begin{sc} {{#1}} \end{sc} \end{normalsize} } \newcommand{\transcorr}[1]{ \vskip 5mm \hskip 10pt % We make this guy small because we're going to fit it in a framed box \small \rule{130mm}{.1mm}\\ {\it{#1}}\\ \rule{130mm}{.1mm} } \newcommand{\latblock}[2]{ \Large \begin{verse} \begin{metrica} {#1}\\ \end{metrica} \trans{{#2}}\\ \end{verse} \normalsize } \newcommand{\commentary}[2]{ \vskip5mm \normalsize \begin{picture} % (moves boxt left/right,moves box up/down vertically)() (50,{#1}) % Creates the canvas space in which the frame will live % % Custom offsets for positioning the box (-35,0) % First arg is the X offset, negatives move inward; % positives, outword % relative to the position within the \picture inveronment \put (00,10) % Positioning of the box { \framebox (400,{#1})[t] % Width of the box, height of the box { \begin{minipage}[t]{380pt} \vskip 5pt {#2} \vskip 5pt \end{minipage} } } \end{picture} \vskip 1mm } \newcommand{\latline}[5]{ \latblock{#1}{#2} \commentary{#3}{ \transcorr{#4} #5 } }{{}} + +\newcommand{\outlinestyle}[]{ + \renewcommand{\labelenumi}{\Roman{enumi}.} + \renewcommand{\labelenumii}{\Alph{enumii}.} + \renewcommand{\labelenumiii}{\arabic{enumiii}.} + \renewcommand{\labelenumiv}{\alph{enumiv}.} +} + +\newcommand{\enumstyle}[]{ + \renewcommand{\labelenumi}{\arabic{enumi}.} + \renewcommand{\labelenumii}{\Alph{enumii}.} + \renewcommand{\labelenumiii}{\roman{enumiii}.} + \renewcommand{\labelenumiv}{\alph{enumiv}.} +}
sgharms/latintools
3644192478467d1ed5d75c664f26bb4c59023541
cleaned some cruft from the bundle
diff --git a/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To End Of Line.tmMacro b/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To End Of Line.tmMacro deleted file mode 100644 index c78e617..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To End Of Line.tmMacro +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>commands</key> - <array> - <dict> - <key>command</key> - <string>moveToEndOfLine:</string> - </dict> - </array> - <key>keyEquivalent</key> - <string>@]</string> - <key>name</key> - <string>Latin Move To End Of Line</string> - <key>scope</key> - <string> text.tex.latex</string> - <key>uuid</key> - <string>05DA44D5-9196-44B8-9573-DAA3C1209A11</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To Start Of Line.tmMacro b/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To Start Of Line.tmMacro deleted file mode 100644 index 199ccc9..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To Start Of Line.tmMacro +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>commands</key> - <array> - <dict> - <key>command</key> - <string>moveToBeginningOfLine:</string> - </dict> - </array> - <key>keyEquivalent</key> - <string>@[</string> - <key>name</key> - <string>Latin Move To Start Of Line</string> - <key>scope</key> - <string>text.tex</string> - <key>uuid</key> - <string>BA51A62B-FE9E-4753-B54A-C84C3A273AB1</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent To Right.tmMacro b/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent To Right.tmMacro deleted file mode 100644 index 4c9e3cb..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent To Right.tmMacro +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>commands</key> - <array> - <dict> - <key>command</key> - <string>shiftRight:</string> - </dict> - </array> - <key>keyEquivalent</key> - <string>@}</string> - <key>name</key> - <string>Region Indent To Right</string> - <key>scope</key> - <string>text.tex.latex</string> - <key>uuid</key> - <string>33580475-498A-4AD8-9880-608FC050BFE2</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent to Left.tmMacro b/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent to Left.tmMacro deleted file mode 100644 index c3bb121..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent to Left.tmMacro +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>commands</key> - <array> - <dict> - <key>command</key> - <string>shiftLeft:</string> - </dict> - </array> - <key>keyEquivalent</key> - <string>@{</string> - <key>name</key> - <string>Region Indent to Left</string> - <key>scope</key> - <string>text.tex.latex</string> - <key>uuid</key> - <string>FFFFB98A-DF3F-4DB3-86E5-69F8022D61B6</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/3-column table setup.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/3-column table setup.tmSnippet deleted file mode 100644 index d1d337c..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/3-column table setup.tmSnippet +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>content</key> - <string>\begin{tabular}{|c|c|c|} -\hline - -\end{tabular}</string> - <key>name</key> - <string>3-column table setup</string> - <key>scope</key> - <string>text.tex.latex</string> - <key>tabTrigger</key> - <string>lattab</string> - <key>uuid</key> - <string>A3426F48-B80F-4E3F-9BC4-D0D9AECFC5D4</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Answer Item (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Answer Item (LaTeX).tmSnippet deleted file mode 100644 index 7a0f478..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/Answer Item (LaTeX).tmSnippet +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>content</key> - <string>\item[] $1</string> - <key>name</key> - <string>Answer Item (LaTeX)</string> - <key>scope</key> - <string>text.tex.latex</string> - <key>tabTrigger</key> - <string>ians</string> - <key>uuid</key> - <string>AD2743B4-06BA-4782-AC2E-28BD5A651BC6</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/HTML Table-ify Clean Layout.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/HTML Table-ify Clean Layout.tmSnippet deleted file mode 100644 index 1980419..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/HTML Table-ify Clean Layout.tmSnippet +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>content</key> - <string>border="0" cellspacing="5" cellpadding="5"</string> - <key>name</key> - <string>HTML Table-ify Clean Layout</string> - <key>scope</key> - <string>text.html</string> - <key>tabTrigger</key> - <string>tabclean</string> - <key>uuid</key> - <string>D209E25A-9DF3-40D5-A427-31F1F411257B</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Analysis Injector.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Analysis Injector.tmSnippet deleted file mode 100644 index 1019484..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Analysis Injector.tmSnippet +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>content</key> - <string>\begin{itemize} - \item Subject: - \item Verb: - \item Direct Objects: - \item Indirect Objects: - \item Ablatives: - \item Genitives: - \item Notes: -\end{itemize}</string> - <key>name</key> - <string>Latin Analysis Injector</string> - <key>scope</key> - <string>text.tex.latex</string> - <key>tabTrigger</key> - <string>lany</string> - <key>uuid</key> - <string>C2E82F0A-39B8-4626-8D03-C29F9CBC07DC</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Answer Sentence.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Answer Sentence.tmSnippet deleted file mode 100644 index f2197cb..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Answer Sentence.tmSnippet +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>content</key> - <string>&lt;p class="sent_answer"&gt;$1&lt;/p&gt;$2</string> - <key>name</key> - <string>Latin Homework Answer Sentence</string> - <key>scope</key> - <string>text.html</string> - <key>tabTrigger</key> - <string>pans</string> - <key>uuid</key> - <string>FBE97330-A6CF-4AC8-8CD3-9D55C08A848D</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Given Sentence.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Given Sentence.tmSnippet deleted file mode 100644 index e41cd18..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Given Sentence.tmSnippet +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>content</key> - <string>&lt;p class="sent_given"&gt;$1. $2&lt;/p&gt;$3</string> - <key>name</key> - <string>Latin Homework Given Sentence</string> - <key>scope</key> - <string>text.html</string> - <key>tabTrigger</key> - <string>pgiv</string> - <key>uuid</key> - <string>AAF2B6D5-C0B0-4BF2-90AE-B6125206509E</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Make a correction span.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Make a correction span.tmSnippet deleted file mode 100644 index 8081a16..0000000 --- a/Textmate_tools/Latin Student.tmbundle/Snippets/Make a correction span.tmSnippet +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>content</key> - <string>&lt;span class="correction"&gt;$1&lt;/span&gt;</string> - <key>name</key> - <string>Make a correction span</string> - <key>scope</key> - <string>text.html</string> - <key>tabTrigger</key> - <string>corr</string> - <key>uuid</key> - <string>C5431CB4-0507-4C7A-8A4D-7D7D439DB514</string> -</dict> -</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/info.plist b/Textmate_tools/Latin Student.tmbundle/info.plist index d3c7161..16546f6 100644 --- a/Textmate_tools/Latin Student.tmbundle/info.plist +++ b/Textmate_tools/Latin Student.tmbundle/info.plist @@ -1,134 +1,123 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>mainMenu</key> <dict> <key>items</key> <array> <string>1E2402E7-A411-4EDF-AE3C-56881B0B7CE9</string> <string>B574C1C3-FD9D-42F2-A1E0-D21656684C50</string> <string>------------------------------------</string> <string>C7F5F012-979F-4D58-B163-E640A372B433</string> <string>05DA44D5-9196-44B8-9573-DAA3C1209A11</string> <string>BA51A62B-FE9E-4753-B54A-C84C3A273AB1</string> <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> </array> <key>submenus</key> <dict> <key>1E2402E7-A411-4EDF-AE3C-56881B0B7CE9</key> <dict> <key>items</key> <array> <string>25C01553-393E-4C85-B64C-996605339DA9</string> <string>AD2743B4-06BA-4782-AC2E-28BD5A651BC6</string> <string>912E9565-8ECF-43EC-8CF7-1A41F04CEF3D</string> <string>B5E0AAB1-BCA7-43A1-BA17-06FF9B572ECA</string> <string>27C92149-4C0B-4556-A5A1-A988FD44396D</string> <string>A5F2EEBE-2F3D-4384-9369-05D8B7205BA0</string> <string>24E770E1-578D-4E38-8FC9-6DED12F973AA</string> <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> <string>961DF4E3-D426-4651-99D1-B732E1F70C68</string> <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> <string>A3426F48-B80F-4E3F-9BC4-D0D9AECFC5D4</string> </array> <key>name</key> <string>Latin ( LaTeX )</string> </dict> <key>B574C1C3-FD9D-42F2-A1E0-D21656684C50</key> <dict> <key>items</key> <array> <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> <string>AAF2B6D5-C0B0-4BF2-90AE-B6125206509E</string> <string>FBE97330-A6CF-4AC8-8CD3-9D55C08A848D</string> <string>D209E25A-9DF3-40D5-A427-31F1F411257B</string> <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> <string>C5431CB4-0507-4C7A-8A4D-7D7D439DB514</string> </array> <key>name</key> <string>Latin ( HTML )</string> </dict> </dict> </dict> <key>name</key> <string>Latin Student</string> <key>ordering</key> <array> - <string>33580475-498A-4AD8-9880-608FC050BFE2</string> - <string>FFFFB98A-DF3F-4DB3-86E5-69F8022D61B6</string> - <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> - <string>C7F5F012-979F-4D58-B163-E640A372B433</string> - <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> - <string>A3426F48-B80F-4E3F-9BC4-D0D9AECFC5D4</string> - <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> - <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> <string>E5DB283A-D01E-4A75-9247-6D9357773543</string> - <string>AAF2B6D5-C0B0-4BF2-90AE-B6125206509E</string> - <string>FBE97330-A6CF-4AC8-8CD3-9D55C08A848D</string> <string>F5E7EC86-6600-41F2-8286-C114E6722644</string> <string>96ED174C-FAB9-4282-80D4-C8831F0DF524</string> - <string>C2E82F0A-39B8-4626-8D03-C29F9CBC07DC</string> - <string>D209E25A-9DF3-40D5-A427-31F1F411257B</string> <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> - <string>25C01553-393E-4C85-B64C-996605339DA9</string> <string>912E9565-8ECF-43EC-8CF7-1A41F04CEF3D</string> <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> <string>B5E0AAB1-BCA7-43A1-BA17-06FF9B572ECA</string> <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> <string>27C92149-4C0B-4556-A5A1-A988FD44396D</string> <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> <string>A5F2EEBE-2F3D-4384-9369-05D8B7205BA0</string> <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> <string>24E770E1-578D-4E38-8FC9-6DED12F973AA</string> <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> <string>961DF4E3-D426-4651-99D1-B732E1F70C68</string> <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> - <string>0523F5F2-F3C0-416F-AC4A-147ABF41789F</string> <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> - <string>05DA44D5-9196-44B8-9573-DAA3C1209A11</string> - <string>BA51A62B-FE9E-4753-B54A-C84C3A273AB1</string> - <string>C5431CB4-0507-4C7A-8A4D-7D7D439DB514</string> - <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> - <string>AD2743B4-06BA-4782-AC2E-28BD5A651BC6</string> <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> + <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> + <string>0523F5F2-F3C0-416F-AC4A-147ABF41789F</string> + <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> <string>1C2E22E3-E416-4C39-9853-608A3AB2B296</string> <string>649255CF-3206-4658-8A4D-5643FA78FCFA</string> - <string>06C355BE-4AAB-43AB-960D-8052B96FB59B</string> <string>6473A22F-384C-410F-85EB-67106E3AA535</string> + <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> + <string>C7F5F012-979F-4D58-B163-E640A372B433</string> + <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> + <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> + <string>25C01553-393E-4C85-B64C-996605339DA9</string> + <string>06C355BE-4AAB-43AB-960D-8052B96FB59B</string> </array> <key>uuid</key> <string>88DEA1FE-4C33-483B-A5F6-3A08FDA41510</string> </dict> </plist>
sgharms/latintools
40dd88609ca2537c05563b8984cdb9de6940eda3
Added notes for textmate section
diff --git a/README b/README index 104d5e8..6f189f7 100644 --- a/README +++ b/README @@ -1,7 +1,21 @@ This is a project for tools that help you write Latin more easily. Tools fall into these varieties: -1. Tools that change LaTeX characters into Unicode characters with macrons -2. Textmate modes that allow you to use ^a to generate LaTeX codes like \={a} -3. LaTeX styles that help with the annotation of verse + + LaTeX_tools + - LaTeX styles that help with the annotation of verse + + Textmate_tools + - Latin Student.tmbundle + A Textmate bundle that is used to speed up typing of Latin text. + + 1. In a LaTeX file, entering control+[aeiou] or [AEIOU] will result in + a LaTeX macron glyph (e.g. \={a}). This allows you to touch-type + text in without fear + 2. Contains the "Dactylize" method which takes glyphs with macrons, and + then, above them, suspends another long mark automatically. When + doing scansion, this will allow your long vowels to have a macron AND + for you to have another long mark 2 units above so that, when + combined with short marks, you can have a full, beautifully typeset + scansion line. + + CLI + - Tools that change LaTeX characters into Unicode characters with macrons diff --git a/Textmate_tools/placeholder b/Textmate_tools/placeholder deleted file mode 100644 index e69de29..0000000
sgharms/latintools
9c30f3b099a6ca25fb29660fe28348c931e6c116
added the textmate bundle
diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Close selection with pipes.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Close selection with pipes.tmCommand new file mode 100644 index 0000000..430eb09 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Close selection with pipes.tmCommand @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>perl -pe 's#$#|#'</string> + <key>input</key> + <string>selection</string> + <key>keyEquivalent</key> + <string>^|</string> + <key>name</key> + <string>Close selection with pipes</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.html text.tex</string> + <key>uuid</key> + <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand new file mode 100644 index 0000000..7d5d1ad --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Dactylizer.tmCommand @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby +puts STDIN.read.gsub(/\\\=\{/,'\={\macron ')</string> + <key>input</key> + <string>selection</string> + <key>keyEquivalent</key> + <string>@d</string> + <key>name</key> + <string>Dactylizer</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>0523F5F2-F3C0-416F-AC4A-147ABF41789F</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/HTML Table-ify.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/HTML Table-ify.tmCommand new file mode 100644 index 0000000..066255d --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/HTML Table-ify.tmCommand @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +@table = Array.new +@table_attr = String.new +@css_attr= String.new +@row_width=0 + +def validate_table(t) + @row_width = t[0].count("|")-1 + pipe_count = @row_width + 1 + t.each { |l| exit!(1) if l.count("|") != pipe_count} +end + +def clean_meta_lines(r) + r.each do + |a| + a.chomp! + a.gsub!(/\|.*\&gt;/,"") + a.gsub!(/\|/,"") + a.gsub!(/^\s+/,"") + end + +end + +def create_table_hdrs(line) + str = " &lt;tr&gt;\n" + line.gsub(/(^\||\|$)/,"").split(/\|/).each do |x| + x.chomp! + str += ' &lt;th&gt;' + x + "&lt;/th&gt;\n" + end + str += " &lt;/tr&gt;" +end + +def formulate_table_line(l) + str = " &lt;tr&gt;\n" + l.gsub(/(^\||\|$)/,"").split(/\|/).each do |x| + x.chomp! + x.gsub!(/(^\s+|\s+$)/,"") + str += ' &lt;td&gt;' + x + "&lt;/td&gt;\n" + end + str += " &lt;/tr&gt;\n" + str +end + +while ( line = gets ) + @table.push line if (line =~ /^|.*|$/ &amp;&amp; line !~ /^\|(CSS|ATTR)\&gt;/) + @table_attr = line.chomp if line =~ /ATTR\&gt;/ + @css_attr = line.chomp if line =~ /CSS\&gt;/ +end + +puts @table_attr +@css_attr = "style=\"" + @css_attr + "\"" if @css_attr +@table_attr= "border=\"0\" cellspacing=\"5\" cellpadding=\"5\"" unless @table_attr.length =~ /\w{3}/ + + +@table_attr.chomp! +@css_attr.chomp! + +validate_table(@table) +clean_meta_lines([@table_attr, @css_attr]) +@table_hdrs = create_table_hdrs(@table.shift) [email protected] if @table[0] =~ /\|\-{3}/ + +@table_def_line = "" + [email protected] do + |l| + @table_def_line += formulate_table_line(l) +end + +@table_def_line.sub!(/\n$/,"") + +table_def = &lt;&lt;END_OF_STRING +&lt;table #{@table_attr} #{@css_attr}&gt; +#{@table_hdrs} +#{@table_def_line} +&lt;/table&gt; +END_OF_STRING + +puts table_def +</string> + <key>fallbackInput</key> + <string>document</string> + <key>input</key> + <string>selection</string> + <key>keyEquivalent</key> + <string>~@t</string> + <key>name</key> + <string>HTML Table-ify</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.html</string> + <key>uuid</key> + <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons To Character Entities.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons To Character Entities.tmCommand new file mode 100644 index 0000000..9a057a9 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons To Character Entities.tmCommand @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +module MacronConversions + LATEX_TO_MACRONS_CHARACTERS = { + "\\={a}" =&gt; "ā", + "\\={e}" =&gt; "ē", + "\\={\\i}" =&gt; "Ä«", + "\\={o}" =&gt; "ō", + "\\={u}" =&gt; "Å«", + "\\={A}" =&gt; "Ā", + "\\={E}" =&gt; "Ē", + "\\={\\I}" =&gt; "Ī", + "\\={O}" =&gt; "Ō", + "\\={U}" =&gt; "Ū", + } + + LATEX_TO_UTF8 ={ + "\\={a}" =&gt; "\\xc4\\x81", + "\\={e}" =&gt; "\\xc4\\x93", + "\\={\\i}" =&gt; "\\xc4\\xab", + "\\={o}" =&gt; "\\xc5\\x8d", + "\\={u}" =&gt; "\\xc5\\xab", + "\\={A}" =&gt; "\\xc4\\x80", + "\\={E}" =&gt; "\\xc4\\x92", + "\\={\\I}" =&gt; "\\xc4\\xaa", + "\\={O}" =&gt; "\\xc5\\x8c", + "\\={U}" =&gt; "\\xc5\\xaa", + } + + LATEX_TO_HTML_ENTITIES = { + "\\={a}" =&gt; "&amp;#x101;", + "\\={e}" =&gt; "&amp;#x113;", + "\\={\\i}" =&gt; "&amp;#x12b;", + "\\={o}" =&gt; "&amp;#x14d;", + "\\={u}" =&gt; "&amp;#x16b;", + "\\={A}" =&gt; "&amp;#x100;", + "\\={E}" =&gt; "&amp;#x112;", + "\\={\\I}" =&gt; "&amp;#x12a;", + "\\={O}" =&gt; "&amp;#x14c;", + "\\={U}" =&gt; "&amp;#x16a;", + } + + class Converter &lt; Object + def initialize(*ray) + @target = ray[0].nil? ? 'html' : ray[0] + @index=Array.new + end + + def processString(s) + firstSlash = s =~ /(\\=.*?\})/ + return "" if $1.nil? + + testChar = $1 + + if firstSlash == 0 + return processChar(testChar) + + processString(s[firstSlash+testChar.length..s.length]) + end + + return s[0..firstSlash-1] + processChar(testChar) + + processString(s[firstSlash+testChar.length..s.length]) + end + + def processChar(c) + LATEX_TO_MACRONS_CHARACTERS[c] + end + end +end + +unless STDIN.tty? + content=STDIN.read +else + content=ARGV[0] +end + +puts MacronConversions::Converter.new().processString(content) +</string> + <key>input</key> + <string>selection</string> + <key>name</key> + <string>Latex Macrons To Character Entities</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>uuid</key> + <string>649255CF-3206-4658-8A4D-5643FA78FCFA</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand new file mode 100644 index 0000000..60a894e --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Latex Macrons to HTML Entities.tmCommand @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +module MacronConversions + LATEX_TO_MACRONS_CHARACTERS = { + "\\={a}" =&gt; "ā", + "\\={e}" =&gt; "ē", + "\\={\\i}" =&gt; "Ä«", + "\\={o}" =&gt; "ō", + "\\={u}" =&gt; "Å«", + "\\={A}" =&gt; "Ā", + "\\={E}" =&gt; "Ē", + "\\={\\I}" =&gt; "Ī", + "\\={O}" =&gt; "Ō", + "\\={U}" =&gt; "Ū", + } + + LATEX_TO_UTF8 ={ + "\\={a}" =&gt; "\\xc4\\x81", + "\\={e}" =&gt; "\\xc4\\x93", + "\\={\\i}" =&gt; "\\xc4\\xab", + "\\={o}" =&gt; "\\xc5\\x8d", + "\\={u}" =&gt; "\\xc5\\xab", + "\\={A}" =&gt; "\\xc4\\x80", + "\\={E}" =&gt; "\\xc4\\x92", + "\\={\\I}" =&gt; "\\xc4\\xaa", + "\\={O}" =&gt; "\\xc5\\x8c", + "\\={U}" =&gt; "\\xc5\\xaa", + } + + LATEX_TO_HTML_ENTITIES = { + "\\={a}" =&gt; "&amp;#x101;", + "\\={e}" =&gt; "&amp;#x113;", + "\\={\\i}" =&gt; "&amp;#x12b;", + "\\={o}" =&gt; "&amp;#x14d;", + "\\={u}" =&gt; "&amp;#x16b;", + "\\={A}" =&gt; "&amp;#x100;", + "\\={E}" =&gt; "&amp;#x112;", + "\\={\\I}" =&gt; "&amp;#x12a;", + "\\={O}" =&gt; "&amp;#x14c;", + "\\={U}" =&gt; "&amp;#x16a;", + } + + class Converter &lt; Object + def initialize(*ray) + @target = ray[0].nil? ? 'html' : ray[0] + @index=Array.new + end + + def processString(s) + firstSlash = s =~ /(\\=.*?\})/ + return "" if $1.nil? + + testChar = $1 + + if firstSlash == 0 + return processChar(testChar) + + processString(s[firstSlash+testChar.length..s.length]) + end + + return s[0..firstSlash-1] + processChar(testChar) + + processString(s[firstSlash+testChar.length..s.length]) + end + + def processChar(c) + LATEX_TO_HTML_ENTITIES[c] + end + end +end + +unless STDIN.tty? + content=STDIN.read +else + content=ARGV[0] +end + +puts MacronConversions::Converter.new().processString(content) +</string> + <key>input</key> + <string>selection</string> + <key>name</key> + <string>Latex Macrons to HTML Entities</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>uuid</key> + <string>1C2E22E3-E416-4C39-9853-608A3AB2B296</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand new file mode 100644 index 0000000..a9a26bb --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Lines To Latlines.tmCommand @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +counter = 0 + +STDIN.read.each do |content| + printf("\\latline\n {%s}\n { Translation }\n {110}\n { CorrectedTranslation }\n { Notes }\n\n\n", content.chomp.gsub(/\\\=\{/,'\={\macron ')) + counter += 1 + print "\\newpage\n\n" if ( counter == 3) + counter = 0 if ( counter == 3 ) +end +</string> + <key>input</key> + <string>selection</string> + <key>name</key> + <string>Lines To Latlines</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>uuid</key> + <string>6473A22F-384C-410F-85EB-67106E3AA535</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Linify As Given Sentences (HTML).tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Linify As Given Sentences (HTML).tmCommand new file mode 100644 index 0000000..be129dc --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Linify As Given Sentences (HTML).tmCommand @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +@start = true +@count=0 + +STDIN.read.split(/\s{2}/).each do + |x| + if @start + @start = false + @count = x.gsub(/[^\d]/,"").to_i + else + printf("&lt;p class=\"sent_given\"&gt;%d. %s&lt;/p&gt;\n",@count,x) + @count = @count+1 + end +end + + +</string> + <key>input</key> + <string>selection</string> + <key>name</key> + <string>Linify As Given Sentences (HTML)</string> + <key>output</key> + <string>afterSelectedText</string> + <key>scope</key> + <string>text.html</string> + <key>uuid</key> + <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Linify As Items ( LaTeX ).tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Linify As Items ( LaTeX ).tmCommand new file mode 100644 index 0000000..025ae96 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Linify As Items ( LaTeX ).tmCommand @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +@start = true +@count=0 + +STDIN.read.split(/\s{2}/).each do + |x| + if @start + @start = false + @count = x.gsub(/[^\d]/,"").to_i + else + printf("\\item[%d.] %s\n\n",@count,x) + @count = @count+1 + end +end +</string> + <key>input</key> + <string>selection</string> + <key>keyEquivalent</key> + <string>^@L</string> + <key>name</key> + <string>Linify As Items ( LaTeX )</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items (no prefix).tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items (no prefix).tmCommand new file mode 100644 index 0000000..aef9df9 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items (no prefix).tmCommand @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +# Just to break a paragraph up assuming you used +# the convention of double space + +@lines = STDIN.read.split(/\s{2}/) +puts @lines</string> + <key>input</key> + <string>selection</string> + <key>name</key> + <string>Linify Items (no prefix)</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.html text.tex.latex</string> + <key>uuid</key> + <string>C7F5F012-979F-4D58-B163-E640A372B433</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items As Table Rows (; delimited).tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items As Table Rows (; delimited).tmCommand new file mode 100644 index 0000000..afc8d21 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Linify Items As Table Rows (; delimited).tmCommand @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +@start = true +@count=0 + +STDIN.read.split(/;\s+/).each do + |x| + if @start + @start = false + @count = x.gsub(/[^\d]+/,"").to_i + x=x.gsub(/^\d+.*\s+/,"") + printf("%d. &amp; %s &amp; \\\\\n",@count,x) + puts "\\hline" + @count = @count+1 + else + puts "\\hline" + x.chomp! + printf("%d. &amp; %s &amp; \\\\\n",@count,x) + @count = @count+1 + end +end + + +</string> + <key>input</key> + <string>selection</string> + <key>keyEquivalent</key> + <string>^;</string> + <key>name</key> + <string>Linify Items As Table Rows (; delimited)</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/Make Line LaTeX Item (LaTeX).tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/Make Line LaTeX Item (LaTeX).tmCommand new file mode 100644 index 0000000..d072fc1 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/Make Line LaTeX Item (LaTeX).tmCommand @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby + +if ENV.has_key?('TM_SELECTED_TEXT') then + result=ENV['TM_SELECTED_TEXT'] + number=`"$TM_SUPPORT_PATH/bin"/CocoaDialog.app/Contents/MacOS/CocoaDialog standard-inputbox \ + --title 'Item-ize Line' \ + --informative-text 'Number of Item:' \ + ` + number=number.chomp! + number=number.split(/[^\d+]/)[1] +end + +puts "\\item[#{number}. ] #{result}" + +</string> + <key>input</key> + <string>selection</string> + <key>keyEquivalent</key> + <string>^@i</string> + <key>name</key> + <string>Make Line LaTeX Item (LaTeX)</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>25C01553-393E-4C85-B64C-996605339DA9</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Commands/StrikeThru Effect.tmCommand b/Textmate_tools/Latin Student.tmbundle/Commands/StrikeThru Effect.tmCommand new file mode 100644 index 0000000..5897986 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Commands/StrikeThru Effect.tmCommand @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>beforeRunningCommand</key> + <string>nop</string> + <key>command</key> + <string>#!/usr/bin/env ruby +x=STDIN.read.chomp +print "\\sout{" + x + "}"</string> + <key>input</key> + <string>selection</string> + <key>keyEquivalent</key> + <string>^-</string> + <key>name</key> + <string>StrikeThru Effect</string> + <key>output</key> + <string>replaceSelectedText</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>06C355BE-4AAB-43AB-960D-8052B96FB59B</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To End Of Line.tmMacro b/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To End Of Line.tmMacro new file mode 100644 index 0000000..c78e617 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To End Of Line.tmMacro @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>commands</key> + <array> + <dict> + <key>command</key> + <string>moveToEndOfLine:</string> + </dict> + </array> + <key>keyEquivalent</key> + <string>@]</string> + <key>name</key> + <string>Latin Move To End Of Line</string> + <key>scope</key> + <string> text.tex.latex</string> + <key>uuid</key> + <string>05DA44D5-9196-44B8-9573-DAA3C1209A11</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To Start Of Line.tmMacro b/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To Start Of Line.tmMacro new file mode 100644 index 0000000..199ccc9 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Macros/Latin Move To Start Of Line.tmMacro @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>commands</key> + <array> + <dict> + <key>command</key> + <string>moveToBeginningOfLine:</string> + </dict> + </array> + <key>keyEquivalent</key> + <string>@[</string> + <key>name</key> + <string>Latin Move To Start Of Line</string> + <key>scope</key> + <string>text.tex</string> + <key>uuid</key> + <string>BA51A62B-FE9E-4753-B54A-C84C3A273AB1</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent To Right.tmMacro b/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent To Right.tmMacro new file mode 100644 index 0000000..4c9e3cb --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent To Right.tmMacro @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>commands</key> + <array> + <dict> + <key>command</key> + <string>shiftRight:</string> + </dict> + </array> + <key>keyEquivalent</key> + <string>@}</string> + <key>name</key> + <string>Region Indent To Right</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>33580475-498A-4AD8-9880-608FC050BFE2</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent to Left.tmMacro b/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent to Left.tmMacro new file mode 100644 index 0000000..c3bb121 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Macros/Region Indent to Left.tmMacro @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>commands</key> + <array> + <dict> + <key>command</key> + <string>shiftLeft:</string> + </dict> + </array> + <key>keyEquivalent</key> + <string>@{</string> + <key>name</key> + <string>Region Indent to Left</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>FFFFB98A-DF3F-4DB3-86E5-69F8022D61B6</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/ LC-o-macron (HTML).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/ LC-o-macron (HTML).tmSnippet new file mode 100644 index 0000000..f06fa7e --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/ LC-o-macron (HTML).tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>ō</string> + <key>keyEquivalent</key> + <string>^o</string> + <key>name</key> + <string> LC-o-macron (HTML)</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>o-</string> + <key>uuid</key> + <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/3-column table setup.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/3-column table setup.tmSnippet new file mode 100644 index 0000000..d1d337c --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/3-column table setup.tmSnippet @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\begin{tabular}{|c|c|c|} +\hline + +\end{tabular}</string> + <key>name</key> + <string>3-column table setup</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>lattab</string> + <key>uuid</key> + <string>A3426F48-B80F-4E3F-9BC4-D0D9AECFC5D4</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Answer Item (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Answer Item (LaTeX).tmSnippet new file mode 100644 index 0000000..7a0f478 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/Answer Item (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\item[] $1</string> + <key>name</key> + <string>Answer Item (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>ians</string> + <key>uuid</key> + <string>AD2743B4-06BA-4782-AC2E-28BD5A651BC6</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/HTML Table-ify Clean Layout.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/HTML Table-ify Clean Layout.tmSnippet new file mode 100644 index 0000000..1980419 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/HTML Table-ify Clean Layout.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>border="0" cellspacing="5" cellpadding="5"</string> + <key>name</key> + <string>HTML Table-ify Clean Layout</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>tabclean</string> + <key>uuid</key> + <string>D209E25A-9DF3-40D5-A427-31F1F411257B</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/He:she:It injector.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/He:she:It injector.tmSnippet new file mode 100644 index 0000000..850840a --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/He:she:It injector.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>He/She/It</string> + <key>name</key> + <string>He/she/It injector</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>HSI</string> + <key>uuid</key> + <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Horizontal Line (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Horizontal Line (LaTeX).tmSnippet new file mode 100644 index 0000000..ed1c104 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/Horizontal Line (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\hline</string> + <key>name</key> + <string>Horizontal Line (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>---</string> + <key>uuid</key> + <string>E5DB283A-D01E-4A75-9247-6D9357773543</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (HTML).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (HTML).tmSnippet new file mode 100644 index 0000000..b5b9c8a --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (HTML).tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>ā</string> + <key>keyEquivalent</key> + <string>^a</string> + <key>name</key> + <string>LC a-macron (HTML)</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>a-</string> + <key>uuid</key> + <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..7b7ac7c --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC a-macron (LaTeX).tmSnippet @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={a}</string> + <key>keyEquivalent</key> + <string>^a</string> + <key>name</key> + <string>LC a-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string> +</string> + <key>uuid</key> + <string>912E9565-8ECF-43EC-8CF7-1A41F04CEF3D</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (HTML).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (HTML).tmSnippet new file mode 100644 index 0000000..958a2e3 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (HTML).tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>ē</string> + <key>keyEquivalent</key> + <string>^e</string> + <key>name</key> + <string>LC e-macron (HTML)</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>e-</string> + <key>uuid</key> + <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..9dcc002 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC e-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={e}</string> + <key>keyEquivalent</key> + <string>^e</string> + <key>name</key> + <string>LC e-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>B5E0AAB1-BCA7-43A1-BA17-06FF9B572ECA</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (HTML).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (HTML).tmSnippet new file mode 100644 index 0000000..304e21f --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (HTML).tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>Ä«</string> + <key>keyEquivalent</key> + <string>^i</string> + <key>name</key> + <string>LC i-macron (HTML)</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>i-</string> + <key>uuid</key> + <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..18cd440 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC i-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={\i}</string> + <key>keyEquivalent</key> + <string>^i</string> + <key>name</key> + <string>LC i-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>27C92149-4C0B-4556-A5A1-A988FD44396D</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC o-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC o-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..c42806f --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC o-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={o}</string> + <key>keyEquivalent</key> + <string>^o</string> + <key>name</key> + <string>LC o-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>A5F2EEBE-2F3D-4384-9369-05D8B7205BA0</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (HTML).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (HTML).tmSnippet new file mode 100644 index 0000000..1053f6a --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (HTML).tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>Å«</string> + <key>keyEquivalent</key> + <string>^u</string> + <key>name</key> + <string>LC u-macron (HTML)</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>u-</string> + <key>uuid</key> + <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..4281dff --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC u-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={u}</string> + <key>keyEquivalent</key> + <string>^u</string> + <key>name</key> + <string>LC u-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>24E770E1-578D-4E38-8FC9-6DED12F973AA</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/LC y-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/LC y-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..6912478 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/LC y-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={y}</string> + <key>keyEquivalent</key> + <string>^y</string> + <key>name</key> + <string>LC y-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Analysis Injector.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Analysis Injector.tmSnippet new file mode 100644 index 0000000..1019484 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Analysis Injector.tmSnippet @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\begin{itemize} + \item Subject: + \item Verb: + \item Direct Objects: + \item Indirect Objects: + \item Ablatives: + \item Genitives: + \item Notes: +\end{itemize}</string> + <key>name</key> + <string>Latin Analysis Injector</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>lany</string> + <key>uuid</key> + <string>C2E82F0A-39B8-4626-8D03-C29F9CBC07DC</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Answer Sentence.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Answer Sentence.tmSnippet new file mode 100644 index 0000000..f2197cb --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Answer Sentence.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>&lt;p class="sent_answer"&gt;$1&lt;/p&gt;$2</string> + <key>name</key> + <string>Latin Homework Answer Sentence</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>pans</string> + <key>uuid</key> + <string>FBE97330-A6CF-4AC8-8CD3-9D55C08A848D</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Given Sentence.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Given Sentence.tmSnippet new file mode 100644 index 0000000..e41cd18 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/Latin Homework Given Sentence.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>&lt;p class="sent_given"&gt;$1. $2&lt;/p&gt;$3</string> + <key>name</key> + <string>Latin Homework Given Sentence</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>pgiv</string> + <key>uuid</key> + <string>AAF2B6D5-C0B0-4BF2-90AE-B6125206509E</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Make a correction span.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Make a correction span.tmSnippet new file mode 100644 index 0000000..8081a16 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/Make a correction span.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>&lt;span class="correction"&gt;$1&lt;/span&gt;</string> + <key>name</key> + <string>Make a correction span</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>corr</string> + <key>uuid</key> + <string>C5431CB4-0507-4C7A-8A4D-7D7D439DB514</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..a08b999 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={A}</string> + <key>keyEquivalent</key> + <string>^A</string> + <key>name</key> + <string>UC A-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron.tmSnippet new file mode 100644 index 0000000..02b0694 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC A-macron.tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>Ā</string> + <key>keyEquivalent</key> + <string>^A</string> + <key>name</key> + <string>UC A-macron</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>A-</string> + <key>uuid</key> + <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..5b96792 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={E}</string> + <key>keyEquivalent</key> + <string>^E</string> + <key>name</key> + <string>UC E-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron.tmSnippet new file mode 100644 index 0000000..f7ef10d --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC E-macron.tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>Ē</string> + <key>keyEquivalent</key> + <string>^E</string> + <key>name</key> + <string>UC E-macron</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>E-</string> + <key>uuid</key> + <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..a4da583 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={I}</string> + <key>keyEquivalent</key> + <string>^I</string> + <key>name</key> + <string>UC I-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>961DF4E3-D426-4651-99D1-B732E1F70C68</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron.tmSnippet new file mode 100644 index 0000000..907f746 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC I-macron.tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>Ī</string> + <key>keyEquivalent</key> + <string>^I</string> + <key>name</key> + <string>UC I-macron</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>I-</string> + <key>uuid</key> + <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..5d10c17 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={O}</string> + <key>keyEquivalent</key> + <string>^O</string> + <key>name</key> + <string>UC O-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron.tmSnippet new file mode 100644 index 0000000..213aa16 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC O-macron.tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>Ō</string> + <key>keyEquivalent</key> + <string>^O</string> + <key>name</key> + <string>UC O-macron</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>O-</string> + <key>uuid</key> + <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron (LaTeX).tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron (LaTeX).tmSnippet new file mode 100644 index 0000000..579178c --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron (LaTeX).tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>\={U}</string> + <key>keyEquivalent</key> + <string>^U</string> + <key>name</key> + <string>UC U-macron (LaTeX)</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>uuid</key> + <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron.tmSnippet new file mode 100644 index 0000000..fadce3e --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/UC U-macron.tmSnippet @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>Ū</string> + <key>keyEquivalent</key> + <string>^U</string> + <key>name</key> + <string>UC U-macron</string> + <key>scope</key> + <string>text.html</string> + <key>tabTrigger</key> + <string>U-</string> + <key>uuid</key> + <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/You (plural) injector.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/You (plural) injector.tmSnippet new file mode 100644 index 0000000..8d9f88b --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/You (plural) injector.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>you (pl.) </string> + <key>name</key> + <string>You (plural) injector</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>ypl</string> + <key>uuid</key> + <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/You (singular) injector.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/You (singular) injector.tmSnippet new file mode 100644 index 0000000..084cd52 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/You (singular) injector.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>you (sg.)</string> + <key>name</key> + <string>You (singular) injector</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>ysg</string> + <key>uuid</key> + <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Your (plural) injector.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Your (plural) injector.tmSnippet new file mode 100644 index 0000000..386adff --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/Your (plural) injector.tmSnippet @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>your (pl.)</string> + <key>name</key> + <string>Your (plural) injector</string> + <key>tabTrigger</key> + <string>yrpl</string> + <key>uuid</key> + <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/Your (singular) injector.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/Your (singular) injector.tmSnippet new file mode 100644 index 0000000..06163b7 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/Your (singular) injector.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>your (sg.) </string> + <key>name</key> + <string>Your (singular) injector</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>yrsg</string> + <key>uuid</key> + <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/by:from:with injector.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/by:from:with injector.tmSnippet new file mode 100644 index 0000000..5a422bb --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/by:from:with injector.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>by / from / with</string> + <key>name</key> + <string>by/from/with injector</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>bfw</string> + <key>uuid</key> + <string>96ED174C-FAB9-4282-80D4-C8831F0DF524</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/Snippets/to:for Injector.tmSnippet b/Textmate_tools/Latin Student.tmbundle/Snippets/to:for Injector.tmSnippet new file mode 100644 index 0000000..4ebf691 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/Snippets/to:for Injector.tmSnippet @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>content</key> + <string>to / for</string> + <key>name</key> + <string>to/for Injector</string> + <key>scope</key> + <string>text.tex.latex</string> + <key>tabTrigger</key> + <string>tf</string> + <key>uuid</key> + <string>F5E7EC86-6600-41F2-8286-C114E6722644</string> +</dict> +</plist> diff --git a/Textmate_tools/Latin Student.tmbundle/info.plist b/Textmate_tools/Latin Student.tmbundle/info.plist new file mode 100644 index 0000000..d3c7161 --- /dev/null +++ b/Textmate_tools/Latin Student.tmbundle/info.plist @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>mainMenu</key> + <dict> + <key>items</key> + <array> + <string>1E2402E7-A411-4EDF-AE3C-56881B0B7CE9</string> + <string>B574C1C3-FD9D-42F2-A1E0-D21656684C50</string> + <string>------------------------------------</string> + <string>C7F5F012-979F-4D58-B163-E640A372B433</string> + <string>05DA44D5-9196-44B8-9573-DAA3C1209A11</string> + <string>BA51A62B-FE9E-4753-B54A-C84C3A273AB1</string> + <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> + <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> + <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> + <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> + <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> + <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> + </array> + <key>submenus</key> + <dict> + <key>1E2402E7-A411-4EDF-AE3C-56881B0B7CE9</key> + <dict> + <key>items</key> + <array> + <string>25C01553-393E-4C85-B64C-996605339DA9</string> + <string>AD2743B4-06BA-4782-AC2E-28BD5A651BC6</string> + <string>912E9565-8ECF-43EC-8CF7-1A41F04CEF3D</string> + <string>B5E0AAB1-BCA7-43A1-BA17-06FF9B572ECA</string> + <string>27C92149-4C0B-4556-A5A1-A988FD44396D</string> + <string>A5F2EEBE-2F3D-4384-9369-05D8B7205BA0</string> + <string>24E770E1-578D-4E38-8FC9-6DED12F973AA</string> + <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> + <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> + <string>961DF4E3-D426-4651-99D1-B732E1F70C68</string> + <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> + <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> + <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> + <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> + <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> + <string>A3426F48-B80F-4E3F-9BC4-D0D9AECFC5D4</string> + </array> + <key>name</key> + <string>Latin ( LaTeX )</string> + </dict> + <key>B574C1C3-FD9D-42F2-A1E0-D21656684C50</key> + <dict> + <key>items</key> + <array> + <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> + <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> + <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> + <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> + <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> + <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> + <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> + <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> + <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> + <string>AAF2B6D5-C0B0-4BF2-90AE-B6125206509E</string> + <string>FBE97330-A6CF-4AC8-8CD3-9D55C08A848D</string> + <string>D209E25A-9DF3-40D5-A427-31F1F411257B</string> + <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> + <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> + <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> + <string>C5431CB4-0507-4C7A-8A4D-7D7D439DB514</string> + </array> + <key>name</key> + <string>Latin ( HTML )</string> + </dict> + </dict> + </dict> + <key>name</key> + <string>Latin Student</string> + <key>ordering</key> + <array> + <string>33580475-498A-4AD8-9880-608FC050BFE2</string> + <string>FFFFB98A-DF3F-4DB3-86E5-69F8022D61B6</string> + <string>217007AD-91B1-420B-A0EF-04803E9F934F</string> + <string>C7F5F012-979F-4D58-B163-E640A372B433</string> + <string>6939FC50-B2E0-4A2A-BF9F-EDC0F8E33523</string> + <string>A3426F48-B80F-4E3F-9BC4-D0D9AECFC5D4</string> + <string>28624DBD-C356-4229-8E12-6C41D5D796CC</string> + <string>6DF9B650-0ECE-4336-AF66-61A5CB5CF43D</string> + <string>E5DB283A-D01E-4A75-9247-6D9357773543</string> + <string>AAF2B6D5-C0B0-4BF2-90AE-B6125206509E</string> + <string>FBE97330-A6CF-4AC8-8CD3-9D55C08A848D</string> + <string>F5E7EC86-6600-41F2-8286-C114E6722644</string> + <string>96ED174C-FAB9-4282-80D4-C8831F0DF524</string> + <string>C2E82F0A-39B8-4626-8D03-C29F9CBC07DC</string> + <string>D209E25A-9DF3-40D5-A427-31F1F411257B</string> + <string>767304C1-6F37-49B1-A26F-A5304A3F5F4D</string> + <string>25C01553-393E-4C85-B64C-996605339DA9</string> + <string>912E9565-8ECF-43EC-8CF7-1A41F04CEF3D</string> + <string>657C59FE-A906-4685-96CE-9165F7B8CDB5</string> + <string>B5E0AAB1-BCA7-43A1-BA17-06FF9B572ECA</string> + <string>FE78E43B-3EBD-4D61-A5C6-534FAE648744</string> + <string>27C92149-4C0B-4556-A5A1-A988FD44396D</string> + <string>82FD1846-8DEE-4BFE-BCFB-59AC47D063D3</string> + <string>A5F2EEBE-2F3D-4384-9369-05D8B7205BA0</string> + <string>D548938E-EB33-4C46-9B09-971C84CB78A8</string> + <string>24E770E1-578D-4E38-8FC9-6DED12F973AA</string> + <string>B5A73D30-01E4-4504-97E2-6DBD2B79ACE1</string> + <string>2B27A748-68EE-47C1-AB49-394304D4A3A8</string> + <string>F571073A-C69D-4F40-A7C8-C9F6E564493B</string> + <string>FBEF7FB1-E775-406E-8C6D-A74BD7FBED8E</string> + <string>796505DD-5571-4054-BBFF-3ABDB4814830</string> + <string>961DF4E3-D426-4651-99D1-B732E1F70C68</string> + <string>3F29D5DE-2CA4-461E-806E-0432F9012360</string> + <string>9C2E1F0F-0AEF-4CDE-8DE0-1D21BF888C90</string> + <string>4473EA0D-0B43-452C-9B05-45FBF033C07E</string> + <string>0523F5F2-F3C0-416F-AC4A-147ABF41789F</string> + <string>D2A2F3B5-E905-4E34-B72C-E348C012FC98</string> + <string>05DA44D5-9196-44B8-9573-DAA3C1209A11</string> + <string>BA51A62B-FE9E-4753-B54A-C84C3A273AB1</string> + <string>C5431CB4-0507-4C7A-8A4D-7D7D439DB514</string> + <string>C254BEF6-F00E-43FC-8634-45FDE21FAAD7</string> + <string>1382AF4E-7FC1-45CA-9D2C-F1361DC7D1B0</string> + <string>AD2743B4-06BA-4782-AC2E-28BD5A651BC6</string> + <string>9413999D-8DD1-43AA-AD31-C42F27321A06</string> + <string>DBA2B3B7-D059-4766-9B26-A28DA39015DD</string> + <string>8AD8DAB2-265C-46D3-9C50-596520942DC7</string> + <string>560ADDF7-A136-48B1-A9A4-D00F952AAC01</string> + <string>415BAD88-609D-4C78-AEFB-6BBDDA0C1CAE</string> + <string>1C2E22E3-E416-4C39-9853-608A3AB2B296</string> + <string>649255CF-3206-4658-8A4D-5643FA78FCFA</string> + <string>06C355BE-4AAB-43AB-960D-8052B96FB59B</string> + <string>6473A22F-384C-410F-85EB-67106E3AA535</string> + </array> + <key>uuid</key> + <string>88DEA1FE-4C33-483B-A5F6-3A08FDA41510</string> +</dict> +</plist>
sgharms/latintools
30539ad2b40063f73ee083d429da99fd269d75bd
added primary subdirectories and placeholders
diff --git a/LaTeX_tools/placeholder b/LaTeX_tools/placeholder new file mode 100644 index 0000000..e69de29 diff --git a/Textmate_tools/placeholder b/Textmate_tools/placeholder new file mode 100644 index 0000000..e69de29
sgharms/latintools
de3248dc917a09888f5f1157b1137ef2767bc64c
Created README
diff --git a/README b/README new file mode 100644 index 0000000..104d5e8 --- /dev/null +++ b/README @@ -0,0 +1,7 @@ +This is a project for tools that help you write Latin more easily. + +Tools fall into these varieties: + +1. Tools that change LaTeX characters into Unicode characters with macrons +2. Textmate modes that allow you to use ^a to generate LaTeX codes like \={a} +3. LaTeX styles that help with the annotation of verse
sgharms/latintools
dc49443f7dfa08160c160e647fd3e0cde1688f9e
added gitignore
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7073775 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.aux +*.log +*.maf +*.mtc +*.mtc1
sgharms/latintools
459c5bf8bd794ab32ace65ceaeb422471e74c840
changed the text file content to be rich
diff --git a/aeneid_example.aux b/aeneid_example.aux new file mode 100644 index 0000000..546fbd8 --- /dev/null +++ b/aeneid_example.aux @@ -0,0 +1,2 @@ +\relax +\global\mtcsecondpartfalse diff --git a/aeneid_example.log b/aeneid_example.log new file mode 100644 index 0000000..1ce4913 --- /dev/null +++ b/aeneid_example.log @@ -0,0 +1,497 @@ +This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6) (format=pdflatex 2007.5.18) 28 JAN 2009 17:39 +entering extended mode + file:line:error style messages enabled. + %&-line parsing enabled. +**aeneid_example.tex +(./aeneid_example.tex +LaTeX2e <2005/12/01> +Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh +yphenation, arabic, basque, bulgarian, coptic, welsh, czech, slovak, german, ng +erman, danish, esperanto, spanish, catalan, galician, estonian, farsi, finnish, + french, greek, monogreek, ancientgreek, croatian, hungarian, interlingua, ibyc +us, indonesian, icelandic, italian, latin, mongolian, dutch, norsk, polish, por +tuguese, pinyin, romanian, russian, slovenian, uppersorbian, serbian, swedish, +turkish, ukenglish, ukrainian, loaded. +(/usr/local/texlive/2007/texmf-dist/tex/latex/base/article.cls +Document Class: article 2005/09/16 v1.4f Standard LaTeX document class +(/usr/local/texlive/2007/texmf-dist/tex/latex/base/size10.clo +File: size10.clo 2005/09/16 v1.4f Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/local/texlive/2007/texmf-dist/tex/latex/base/inputenc.sty +Package: inputenc 2006/05/05 v1.1b Input encoding file +\inpenc@prehook=\toks14 +\inpenc@posthook=\toks15 + +(/usr/local/texlive/2007/texmf-dist/tex/latex/base/utf8.def +File: utf8.def 2006/03/30 v1.1i UTF-8 support for inputenc +Now handling font encoding OML ... +... no UTF-8 mapping file for font encoding OML +Now handling font encoding T1 ... +... processing UTF-8 mapping file for font encodingT1 + +(/usr/local/texlive/2007/texmf-dist/tex/latex/base/t1enc.dfu +File: t1enc.dfu 2006/03/30 v1.1i UTF-8 support for inputenc + defining Unicode char U+00A1 (decimal 161) + defining Unicode char U+00A3 (decimal 163) + defining Unicode char U+00AB (decimal 171) + defining Unicode char U+00BB (decimal 187) + defining Unicode char U+00BF (decimal 191) + defining Unicode char U+00C0 (decimal 192) + defining Unicode char U+00C1 (decimal 193) + defining Unicode char U+00C2 (decimal 194) + defining Unicode char U+00C3 (decimal 195) + defining Unicode char U+00C4 (decimal 196) + defining Unicode char U+00C5 (decimal 197) + defining Unicode char U+00C6 (decimal 198) + defining Unicode char U+00C7 (decimal 199) + defining Unicode char U+00C8 (decimal 200) + defining Unicode char U+00C9 (decimal 201) + defining Unicode char U+00CA (decimal 202) + defining Unicode char U+00CB (decimal 203) + defining Unicode char U+00CC (decimal 204) + defining Unicode char U+00CD (decimal 205) + defining Unicode char U+00CE (decimal 206) + defining Unicode char U+00CF (decimal 207) + defining Unicode char U+00D0 (decimal 208) + defining Unicode char U+00D1 (decimal 209) + defining Unicode char U+00D2 (decimal 210) + defining Unicode char U+00D3 (decimal 211) + defining Unicode char U+00D4 (decimal 212) + defining Unicode char U+00D5 (decimal 213) + defining Unicode char U+00D6 (decimal 214) + defining Unicode char U+00D8 (decimal 216) + defining Unicode char U+00D9 (decimal 217) + defining Unicode char U+00DA (decimal 218) + defining Unicode char U+00DB (decimal 219) + defining Unicode char U+00DC (decimal 220) + defining Unicode char U+00DD (decimal 221) + defining Unicode char U+00DE (decimal 222) + defining Unicode char U+00DF (decimal 223) + defining Unicode char U+00E0 (decimal 224) + defining Unicode char U+00E1 (decimal 225) + defining Unicode char U+00E2 (decimal 226) + defining Unicode char U+00E3 (decimal 227) + defining Unicode char U+00E4 (decimal 228) + defining Unicode char U+00E5 (decimal 229) + defining Unicode char U+00E6 (decimal 230) + defining Unicode char U+00E7 (decimal 231) + defining Unicode char U+00E8 (decimal 232) + defining Unicode char U+00E9 (decimal 233) + defining Unicode char U+00EA (decimal 234) + defining Unicode char U+00EB (decimal 235) + defining Unicode char U+00EC (decimal 236) + defining Unicode char U+00ED (decimal 237) + defining Unicode char U+00EE (decimal 238) + defining Unicode char U+00EF (decimal 239) + defining Unicode char U+00F0 (decimal 240) + defining Unicode char U+00F1 (decimal 241) + defining Unicode char U+00F2 (decimal 242) + defining Unicode char U+00F3 (decimal 243) + defining Unicode char U+00F4 (decimal 244) + defining Unicode char U+00F5 (decimal 245) + defining Unicode char U+00F6 (decimal 246) + defining Unicode char U+00F8 (decimal 248) + defining Unicode char U+00F9 (decimal 249) + defining Unicode char U+00FA (decimal 250) + defining Unicode char U+00FB (decimal 251) + defining Unicode char U+00FC (decimal 252) + defining Unicode char U+00FD (decimal 253) + defining Unicode char U+00FE (decimal 254) + defining Unicode char U+00FF (decimal 255) + defining Unicode char U+0102 (decimal 258) + defining Unicode char U+0103 (decimal 259) + defining Unicode char U+0104 (decimal 260) + defining Unicode char U+0105 (decimal 261) + defining Unicode char U+0106 (decimal 262) + defining Unicode char U+0107 (decimal 263) + defining Unicode char U+010C (decimal 268) + defining Unicode char U+010D (decimal 269) + defining Unicode char U+010E (decimal 270) + defining Unicode char U+010F (decimal 271) + defining Unicode char U+0110 (decimal 272) + defining Unicode char U+0111 (decimal 273) + defining Unicode char U+0118 (decimal 280) + defining Unicode char U+0119 (decimal 281) + defining Unicode char U+011A (decimal 282) + defining Unicode char U+011B (decimal 283) + defining Unicode char U+011E (decimal 286) + defining Unicode char U+011F (decimal 287) + defining Unicode char U+0130 (decimal 304) + defining Unicode char U+0131 (decimal 305) + defining Unicode char U+0132 (decimal 306) + defining Unicode char U+0133 (decimal 307) + defining Unicode char U+0139 (decimal 313) + defining Unicode char U+013A (decimal 314) + defining Unicode char U+013D (decimal 317) + defining Unicode char U+013E (decimal 318) + defining Unicode char U+0141 (decimal 321) + defining Unicode char U+0142 (decimal 322) + defining Unicode char U+0143 (decimal 323) + defining Unicode char U+0144 (decimal 324) + defining Unicode char U+0147 (decimal 327) + defining Unicode char U+0148 (decimal 328) + defining Unicode char U+014A (decimal 330) + defining Unicode char U+014B (decimal 331) + defining Unicode char U+0150 (decimal 336) + defining Unicode char U+0151 (decimal 337) + defining Unicode char U+0152 (decimal 338) + defining Unicode char U+0153 (decimal 339) + defining Unicode char U+0154 (decimal 340) + defining Unicode char U+0155 (decimal 341) + defining Unicode char U+0158 (decimal 344) + defining Unicode char U+0159 (decimal 345) + defining Unicode char U+015A (decimal 346) + defining Unicode char U+015B (decimal 347) + defining Unicode char U+015E (decimal 350) + defining Unicode char U+015F (decimal 351) + defining Unicode char U+0160 (decimal 352) + defining Unicode char U+0161 (decimal 353) + defining Unicode char U+0162 (decimal 354) + defining Unicode char U+0163 (decimal 355) + defining Unicode char U+0164 (decimal 356) + defining Unicode char U+0165 (decimal 357) + defining Unicode char U+016E (decimal 366) + defining Unicode char U+016F (decimal 367) + defining Unicode char U+0170 (decimal 368) + defining Unicode char U+0171 (decimal 369) + defining Unicode char U+0178 (decimal 376) + defining Unicode char U+0179 (decimal 377) + defining Unicode char U+017A (decimal 378) + defining Unicode char U+017B (decimal 379) + defining Unicode char U+017C (decimal 380) + defining Unicode char U+017D (decimal 381) + defining Unicode char U+017E (decimal 382) + defining Unicode char U+200C (decimal 8204) + defining Unicode char U+2013 (decimal 8211) + defining Unicode char U+2014 (decimal 8212) + defining Unicode char U+2018 (decimal 8216) + defining Unicode char U+2019 (decimal 8217) + defining Unicode char U+201A (decimal 8218) + defining Unicode char U+201C (decimal 8220) + defining Unicode char U+201D (decimal 8221) + defining Unicode char U+201E (decimal 8222) + defining Unicode char U+2030 (decimal 8240) + defining Unicode char U+2031 (decimal 8241) + defining Unicode char U+2039 (decimal 8249) + defining Unicode char U+203A (decimal 8250) + defining Unicode char U+2423 (decimal 9251) +) +Now handling font encoding OT1 ... +... processing UTF-8 mapping file for font encodingOT1 + +(/usr/local/texlive/2007/texmf-dist/tex/latex/base/ot1enc.dfu +File: ot1enc.dfu 2006/03/30 v1.1i UTF-8 support for inputenc + defining Unicode char U+00A1 (decimal 161) + defining Unicode char U+00A3 (decimal 163) + defining Unicode char U+00B8 (decimal 184) + defining Unicode char U+00BF (decimal 191) + defining Unicode char U+00C5 (decimal 197) + defining Unicode char U+00C6 (decimal 198) + defining Unicode char U+00D8 (decimal 216) + defining Unicode char U+00DF (decimal 223) + defining Unicode char U+00E6 (decimal 230) + defining Unicode char U+00EC (decimal 236) + defining Unicode char U+00ED (decimal 237) + defining Unicode char U+00EE (decimal 238) + defining Unicode char U+00EF (decimal 239) + defining Unicode char U+00F8 (decimal 248) + defining Unicode char U+0131 (decimal 305) + defining Unicode char U+0141 (decimal 321) + defining Unicode char U+0142 (decimal 322) + defining Unicode char U+0152 (decimal 338) + defining Unicode char U+0153 (decimal 339) + defining Unicode char U+2013 (decimal 8211) + defining Unicode char U+2014 (decimal 8212) + defining Unicode char U+2018 (decimal 8216) + defining Unicode char U+2019 (decimal 8217) + defining Unicode char U+201C (decimal 8220) + defining Unicode char U+201D (decimal 8221) +) +Now handling font encoding OMS ... +... processing UTF-8 mapping file for font encodingOMS + +(/usr/local/texlive/2007/texmf-dist/tex/latex/base/omsenc.dfu +File: omsenc.dfu 2006/03/30 v1.1i UTF-8 support for inputenc + defining Unicode char U+00A7 (decimal 167) + defining Unicode char U+00B6 (decimal 182) + defining Unicode char U+00B7 (decimal 183) + defining Unicode char U+2020 (decimal 8224) + defining Unicode char U+2021 (decimal 8225) + defining Unicode char U+2022 (decimal 8226) +) +Now handling font encoding OMX ... +... no UTF-8 mapping file for font encoding OMX +Now handling font encoding U ... +... no UTF-8 mapping file for font encoding U + defining Unicode char U+00A9 (decimal 169) + defining Unicode char U+00AA (decimal 170) + defining Unicode char U+00AE (decimal 174) + defining Unicode char U+00BA (decimal 186) + defining Unicode char U+02C6 (decimal 710) + defining Unicode char U+02DC (decimal 732) + defining Unicode char U+200C (decimal 8204) + defining Unicode char U+2026 (decimal 8230) + defining Unicode char U+2122 (decimal 8482) + defining Unicode char U+2423 (decimal 9251) +)) +(/usr/local/texlive/2007/texmf-dist/tex/latex/preprint/fullpage.sty +Package: fullpage 1999/02/23 1.1 (PWD) +\FP@margin=\skip43 +) +(/usr/local/texlive/2007/texmf-dist/tex/latex/ltxmisc/boxedminipage.sty) +(/usr/local/texlive/2007/texmf-dist/tex/latex/listings/listings.sty +(/usr/local/texlive/2007/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 1999/03/16 v1.13 key=value parser (DPC) +\KV@toks@=\toks16 +) +\lst@mode=\count87 +\lst@gtempboxa=\box26 +\lst@token=\toks17 +\lst@length=\count88 +\lst@currlwidth=\dimen103 +\lst@column=\count89 +\lst@pos=\count90 +\lst@lostspace=\dimen104 +\lst@width=\dimen105 +\lst@newlines=\count91 +\lst@lineno=\count92 +\c@lstlisting=\count93 +\lst@maxwidth=\dimen106 + +(/usr/local/texlive/2007/texmf-dist/tex/latex/listings/lstpatch.sty +File: lstpatch.sty 2004/10/17 1.3b (Carsten Heinz) +) +(/usr/local/texlive/2007/texmf-dist/tex/latex/listings/lstmisc.sty +File: lstmisc.sty 2004/09/07 1.3 (Carsten Heinz) +\c@lstnumber=\count94 +\lst@skipnumbers=\count95 +\lst@framebox=\box27 +) +(/usr/local/texlive/2007/texmf-dist/tex/latex/listings/listings.cfg +File: listings.cfg 2004/09/05 1.3 listings configuration +)) +Package: listings 2004/10/17 1.3b (Carsten Heinz) + +(/usr/local/texlive/2007/texmf-dist/tex/latex/minitoc/minitoc.sty +Package: minitoc 2007/01/09 v51 Package minitoc (JPFD) + +(/usr/local/texlive/2007/texmf-dist/tex/latex/minitoc/mtcmess.sty +Package: mtcmess 2006/03/14 +) +Package minitoc Info: <I0001> +(minitoc) *** minitoc package, version 51 ***. +\tf@mtc=\write3 +\mtcindent=\skip44 +\mtcskipamount=\skip45 +Package minitoc Info: <I0005> +(minitoc) compatible with hyperref. +Package minitoc Info: <I0023> +(minitoc) part level macros available. +Package minitoc Info: <I0004> +(minitoc) chapter level macros NOT available. +Package minitoc Info: <I0028> +(minitoc) section level macros available. +\mtc@toks=\toks18 +\mtc@strutbox=\box28 +\mtc@hstrutbox=\box29 +Package minitoc Info: <I0002> +(minitoc) Autoconfiguration of extensions. +\openout3 = `aeneid_example.mtc1'. + +\openout3 = `aeneid_example.mtc'. + + +(./aeneid_example.mtc1) +Package minitoc Info: <I0012> +(minitoc) Long extensions (Unix-like) will be used. +Package minitoc Info: <I0031> +(minitoc) ==> this version is configured for UNIX-like +(minitoc) (long extensions) file names. +\openout3 = `aeneid_example.mtc'. + +\openout3 = `aeneid_example.mtc1'. + +\c@ptc=\count96 +\c@parttocdepth=\count97 +\ptcindent=\skip46 +\c@stc=\count98 +\c@secttocdepth=\count99 +\stcindent=\skip47 +Package minitoc Info: <I0010> +(minitoc) The english language is selected. +(minitoc) on input line 4684. + +(/usr/local/texlive/2007/texmf-dist/tex/latex/minitoc/english.mld +File: english.mld 2006/01/13 +) +(/usr/local/texlive/2007/texmf-dist/tex/latex/minitoc/english.mld +File: english.mld 2006/01/13 +)) +(/usr/local/texlive/2007/texmf-dist/tex/generic/oberdiek/ifpdf.sty +Package: ifpdf 2006/02/20 v1.4 Provides the ifpdf switch (HO) +Package ifpdf Info: pdfTeX in pdf mode detected. +) +(/usr/local/texlive/2007/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/local/texlive/2007/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2006/02/20 v1.0o Standard LaTeX Graphics (DPC,SPQR) + +(/usr/local/texlive/2007/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 1999/03/16 v1.09 sin cos tan (DPC) +) +(/usr/local/texlive/2007/texmf/tex/latex/config/graphics.cfg +File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive +) +Package graphics Info: Driver file: pdftex.def on input line 90. + +(/usr/local/texlive/2007/texmf-dist/tex/latex/pdftex-def/pdftex.def +File: pdftex.def 2007/01/08 v0.04d Graphics/color for pdfTeX +\Gread@gobject=\count100 +)) +\Gin@req@height=\dimen107 +\Gin@req@width=\dimen108 +) +(/usr/local/texlive/2007/texmf-dist/tex/latex/setspace/setspace.sty +Package: setspace 2000/12/01 6.7 Contributed and Supported LaTeX2e package + +Package: `setspace' 6.7 <2000/12/01> +) (/usr/local/texlive/2007/texmf-dist/tex/latex/ltxmisc/ulem.sty +\UL@box=\box30 +\UL@hyphenbox=\box31 +\UL@skip=\skip48 +\UL@hook=\toks19 +\UL@pe=\count101 +\UL@pixel=\dimen109 +\ULC@box=\box32 +Package: ulem 2000/05/26 +\ULdepth=\dimen110 +) +(/usr/local/texlive/2007/texmf-dist/tex/latex/ltxmisc/framed.sty +Package: framed 2003/07/21 v 0.8a: framed or shaded text with page breaks +\FrameRule=\dimen111 +\FrameSep=\dimen112 +) +(/usr/local/texlive/2007/texmf-dist/tex/latex/metre/metre.sty +Package: metre 2001/12/05 v. 1.0 A package for classicists + +(/usr/local/texlive/2007/texmf-dist/tex/latex/ltxmisc/relsize.sty +Package: relsize 2003/07/04 ver 3.1 +) +\M@ibycus=\count102 +\M@metra=\count103 +\M@metra@font=\count104 +\M@box@m=\box33 +\M@box@b=\box34 +\M@box@tsmb=\box35 +\M@box@tsbm=\box36 +\M@box@tsmm=\box37 +\M@box@ps=\box38 +\M@box@a=\box39 +\M@box@o=\box40 +\M@box@k=\box41 +\M@box@K=\box42 +\M@box@p=\box43 +\M@box@A=\box44 +\M@box@G=\box45 +\M@dim@m=\dimen113 +\M@dim@b=\dimen114 +\M@dim@p=\dimen115 +\M@dim@s=\dimen116 +\M@dim@bsink=\dimen117 +\M@dim@sunk=\dimen118 +\M@metra@ex=\dimen119 +\M@text@ex=\dimen120 +\M@dim@c@ext=\dimen121 +\M@dim@c@int=\dimen122 +\M@dim@c@Ext=\dimen123 +\M@linea@indent=\dimen124 +\M@linea@height=\dimen125 +\M@linea@length=\dimen126 +) +(./latinpoetry.sty) (./aeneid_example.aux) +\openout1 = `aeneid_example.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 40. +LaTeX Font Info: ... okay on input line 40. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 40. +LaTeX Font Info: ... okay on input line 40. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 40. +LaTeX Font Info: ... okay on input line 40. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 40. +LaTeX Font Info: ... okay on input line 40. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 40. +LaTeX Font Info: ... okay on input line 40. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 40. +LaTeX Font Info: ... okay on input line 40. +Package minitoc(hints) Info: <I0049> +(minitoc(hints)) ==> You requested the hints option +(minitoc(hints)) Some hints are eventually given below. + +(/usr/local/texlive/2007/texmf-dist/tex/context/base/supp-pdf.tex +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count105 +\scratchdimen=\dimen127 +\scratchbox=\box46 +\nofMPsegments=\count106 +\nofMParguments=\count107 +\MPscratchCnt=\count108 +\MPscratchDim=\dimen128 +\MPnumerator=\count109 +\everyMPtoPDFconversion=\toks20 +) +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <14.4> on input line 63. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <7> on input line 63. + [1 + +{/usr/local/texlive/2007/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] +[2] [3] +Underfull \hbox (badness 10000) in paragraph at lines 173--173 + + [] + +Package minitoc Info: <I0009> +(minitoc) Listing minitoc auxiliary files. +(minitoc) Creating the aeneid_example.maf file. +\openout3 = `aeneid_example.maf'. + +Package minitoc(hints) Info: <I0019> +(minitoc(hints)) No hints have been written +(minitoc(hints)) in the aeneid_example.log file.. +[4] (./aeneid_example.aux) ) +Here is how much of TeX's memory you used: + 4607 strings out of 94073 + 58812 string characters out of 1162984 + 135811 words of memory out of 1500000 + 7691 multiletter control sequences out of 10000+50000 + 6219 words of font info for 23 fonts, out of 1200000 for 2000 + 645 hyphenation exceptions out of 8191 + 26i,10n,32p,196b,326s stack positions out of 5000i,500n,6000p,200000b,5000s +</usr/local/texlive/2007/texmf-dist/fonts/type1/blu +esky/cm/cmbx12.pfb></usr/local/texlive/2007/texmf-dist/fonts/type1/bluesky/cm/c +mbx9.pfb></usr/local/texlive/2007/texmf-dist/fonts/type1/bluesky/cm/cmcsc10.pfb +></usr/local/texlive/2007/texmf-dist/fonts/type1/bluesky/cm/cmr10.pfb></usr/loc +al/texlive/2007/texmf-dist/fonts/type1/bluesky/cm/cmr12.pfb></usr/local/texlive +/2007/texmf-dist/fonts/type1/bluesky/cm/cmr9.pfb></usr/local/texlive/2007/texmf +-dist/fonts/type1/bluesky/cm/cmsy10.pfb></usr/local/texlive/2007/texmf-dist/fon +ts/type1/bluesky/cm/cmti9.pfb> +Output written on aeneid_example.pdf (4 pages, 60630 bytes). +PDF statistics: + 47 PDF objects out of 1000 (max. 8388607) + 0 named destinations out of 1000 (max. 131072) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/aeneid_example.maf b/aeneid_example.maf new file mode 100644 index 0000000..49a6ba8 --- /dev/null +++ b/aeneid_example.maf @@ -0,0 +1,2 @@ +aeneid_example.mtc +aeneid_example.mtc1 diff --git a/aeneid_example.mtc b/aeneid_example.mtc new file mode 100644 index 0000000..e69de29 diff --git a/aeneid_example.mtc1 b/aeneid_example.mtc1 new file mode 100644 index 0000000..e69de29 diff --git a/aeneid_example.pdf b/aeneid_example.pdf new file mode 100644 index 0000000..caad20f Binary files /dev/null and b/aeneid_example.pdf differ diff --git a/aeneid_example.tex b/aeneid_example.tex index 1333ed7..61c6be5 100644 --- a/aeneid_example.tex +++ b/aeneid_example.tex @@ -1 +1,176 @@ -TODO +% +% Example Notes +% +% Created by Steven Harms on 2009-01-26. +% Copyright (c) 2009 Steven G. Harms. All rights reserved. +% +\documentclass[]{article} + +% Use utf-8 encoding for foreign characters +\usepackage[utf8]{inputenc} + +% Setup for fullpage use +\usepackage{fullpage} + +% Surround parts of graphics with box +\usepackage{boxedminipage} + + +% Package for including code in the document +\usepackage{listings} + +% If you want to generate a toc for each chapter (use with book) +\usepackage{minitoc} + +% This is now the recommended way for checking for PDFLaTeX: +\usepackage{ifpdf} + +\ifpdf +\usepackage[pdftex]{graphicx} +\else +\usepackage{graphicx} +\fi + +\usepackage{setspace} +\usepackage{ulem} +\usepackage{framed} +\usepackage[en]{metre} +\usepackage{latinpoetry} + +\begin{document} + +\section*{Virgil's {\AE}neid: Lines 1-11} % (fold) + +\Elevatio{2} + +\latline + {\={\macron A}rm\-a v\-ir\=umqu\-e c\-an{\={\macron o}}, $||$ Tr\={o}j\={\ae} qu\={\macron{\i}} pr\={\macron{\i}}m\-us \-ab \={o}r\={\macron{\i}}s} + {I sing of arms and the man, who came from Troy to} + {180} + {I sing of arms and the man, an exile, who came from the borders of Troy,} + { + \begin{enumerate} + \item The first word is important, the use of ``arma'' indicates that Vergil is singing about war. + \item Vergil's first word and last words of sentences and clauses are carefully chosen. + \item Supply ``est'': ``{\AE}neas primus est; profugus est'' + \item There are \textbf{three} types of adjectives + \begin{enumerate} + \item attributive: simple modification ``vir bonus'' + \item substantive: ``bonus'' i.e. ``the good man'' + \item predicate: ``vir bonus est'' + \end{enumerate} + \end{enumerate} + } + +\latline + {{\macron I}t\-{a}l\-i\={a}m f\={\macron a}t\={\macron o} pr\-of\-ug\={\macron u}s $||$ L\={\macron a}v\={\macron{\i}}n\-aqu\-e v\={\macron e}n\={\macron{\i}}t} + {Italy and the Lavinian shores under an exile's fate.} + {80}{to Italy and the Lavinian }{} + +\latline +{l\={\macron{\i}}t\-or\-a --- m\=ultu\sout{m }\={i}ll\={{\sout{e }}\=e}t $||$ t\=err\={\macron{\i}}s j\=act\={\macron a}t\-us \-et \=alt\={\macron o}} +{--- after he was buffeted both by many lands and also} +{110} +{shores, --- that man, much buffeted both on land and sea, as well as by} +{} + +\newpage +\latline +{v\={\i} s\-up\-er\=um, s\={\ae}v\={\ae} $||$ m\-em\-or\=em J\={u}n\={o}n\-is \-ob \={\i}r\=am,} +{the powers of the Gods, brought to rage by the cruel memory of Juno} +{110} +{the powers of the gods, on account of the unforgetting memory of wrathful Juno,} +{ + \begin{enumerate} + \item note the meter: ``we-superroom'' + \item Note the interlocked word order: as written: ``saevae memorem J\={u}n\={o}nis ob {\={\i}}ram'', + but has the force of ``saevae {\={\i}}ram J\={u}n\={o}nis ob \={\i}ram memorem'' + \end{enumerate} +} + +\latline +{m\=ult\-a qu\-oqu\={\sout{\=e\= }\=e}t b\=ell\={o} $||$ p\=ass\=us, d\=um c\=ond\-er\-et \=urb\=em} +{endured many things and war, thence would found the city} +{120} +{he also endured many things in war, that he might found the city} +{ +\begin{enumerate} + \item ablative of respect ``bell{\macron o}'' + \item due to the subjunctive, we say ``might.'' This is a \textbf{dum} clause + \item While we made ``jactatus est'' passive, ``passus'' remains active in sense as it is a \textbf{deponent} verb +\end{enumerate} +} + +\latline +{\={\macron{\i}}nf\=err\=etqu\-e d\-e\={o}s L\-at\-i\={o} $||$ --- g\-en\-us \=und\-e L\-at\={\i}n\=um} +{and carry the gods to Latinum --- and sire the Latin race,} +{110} +{and might carry the gods to Latium --- from which place (whence) [are] the} +{ +\begin{enumerate} + \item Lati{\macron o} is a dative of direction, this is commonly used with compound verbs + \item ``unde'' is a relative pronoun +\end{enumerate} +} + +\newpage + +\latline +{\=Alb\={a}n\={\macron {\i}}qu\-e p\-atr\={e}s $||$ \-atqu\sout{e }\=alt\={\ae} m\={oe}n\-i\-a R\={\macron o}m\={\ae}.} +{the Alban forefathers and also the high walls of Rome.} +{110} +{Alban fathers and also the walls of mighty Rome.} +{ +\begin{enumerate} + \item Good demonstration of long or short by position: ``patr{\macron +e}s''. You have `a' followed by `tr', thus seeming to indicate long by +position. But since `r' may or may not count, this is not definite. It, in +fact, remains short. +\end{enumerate} +} + +\latline +{M\={\macron u}s\-a, m\-ih\={\i} c\={au}s\={a}s m\-em\-or\={a}, $||$ qu\={o} n\={u}m\-in\-e l\={\ae}s\={o}} +{Muse, recount to me the causes by which, divinity having been offended or } +{110} +{Muse, recall to me the causes by which } +{ +\begin{enumerate} + \item n\={u}mine l{\ae}s\=o: ablative absolute +\end{enumerate} +} + +\latline +{quidve dol\={\macron e}ns r\={\macron e}g\={\macron{\i}}na deum tot volvere c\={\macron a}s\={\macron u}s} +{or the vexation at what would impelled the queen of the gods to force} +{110} +{or vexation at what impelled the queen of the gods to spin out such harsh fates and } +{ +\begin{enumerate} + \item Indirect question set up by ``quid'' + \item IQ necessitates subjunctive, thus ``impulerit'' +\end{enumerate} +} + +\newpage + +\latline +{\={\macron{\i}}ns\=ign\=em p\-i\-et\={\macron a}t\-e v\-ir\=um, $||$ t\-ot \-ad\={\macron{\i}}r\-e l\-ab\={\macron o}r\={\macron e}s } +{so many difficult labors} +{110} +{and bring that man, outstanding in piety, to face so many harsh labors.} +{} + +\latline +{\=imp\-ul\-er\=it. $||$ T\=ant\={\ae}n\sout{e }\=anim\={\i}s c\={\ae}l\=est\-ib\-us \={\macron{\i}}r{\ae}?} +{Are the minds of the heavens so wrathful?} +{110} +{} +{ +\begin{enumerate} + \item Note ``tantae'' is a predicate adjective +\end{enumerate} +} + +\end{document} +
sgharms/latintools
d9e30e1f9f4561ab2b39d441756eaac38a4a1310
added template output and examples
diff --git a/TEMPLATE.pdf b/TEMPLATE.pdf new file mode 100644 index 0000000..f19febf Binary files /dev/null and b/TEMPLATE.pdf differ diff --git a/TEMPLATE.tex b/TEMPLATE.tex new file mode 100644 index 0000000..c5a6af7 --- /dev/null +++ b/TEMPLATE.tex @@ -0,0 +1,56 @@ +% +% $id$ +% +% Created by Steven Harms on 2009-01-26. +% Copyright (c) 2009 Steven G. Harms. All rights reserved. +% +\documentclass[]{article} + +% Use utf-8 encoding for foreign characters +\usepackage[utf8]{inputenc} + +% Setup for fullpage use +\usepackage{fullpage} + +% Surround parts of graphics with box +\usepackage{boxedminipage} + + +% Package for including code in the document +\usepackage{listings} + +% If you want to generate a toc for each chapter (use with book) +\usepackage{minitoc} + +% This is now the recommended way for checking for PDFLaTeX: +\usepackage{ifpdf} + +\ifpdf +\usepackage[pdftex]{graphicx} +\else +\usepackage{graphicx} +\fi + +\usepackage{setspace} +\usepackage{ulem} +\usepackage{framed} +\usepackage[en]{metre} +\usepackage{latinpoetry} + +\begin{document} + +\section*{Virgil's {\AE}neid: [TBD]} % (fold) + +\Elevatio{2} + +\latline + {Latin Text Here} + {Translation} + {110} % 110 is a standard box size + {Corrected translation} + { + } + + +\end{document} +
sgharms/latintools
f15094954f78e29c86644d0ea3d2587ab2c00f41
added the \latline command
diff --git a/latinpoetry.sty b/latinpoetry.sty index 9b7caa4..d6f57a4 100644 --- a/latinpoetry.sty +++ b/latinpoetry.sty @@ -1,47 +1,67 @@ \newcommand{\trans}[1]{ \begin{normalsize} \begin{sc} {{#1}} \end{sc} \end{normalsize} } +\newcommand{\transcorr}[1]{ + \vskip 5mm + \hskip 10pt + % We make this guy small because we're going to fit it in a framed box + \small + + \rule{130mm}{.1mm}\\ + {\it{#1}}\\ + \rule{130mm}{.1mm} +} + \newcommand{\latblock}[2]{ + \Large \begin{verse} \begin{metrica} {#1}\\ \end{metrica} \trans{{#2}}\\ \end{verse} + \normalsize } \newcommand{\commentary}[2]{ \vskip5mm \normalsize - - % (moves boxt left/right,moves box up/down vertically)() - \begin{picture} + + \begin{picture} % (moves boxt left/right,moves box up/down vertically)() (50,{#1}) % Creates the canvas space in which the frame will live % % Custom offsets for positioning the box (-35,0) % First arg is the X offset, negatives move inward; % positives, outword % relative to the position within the \picture inveronment \put (00,10) % Positioning of the box { \framebox (400,{#1})[t] % Width of the box, height of the box { \begin{minipage}[t]{380pt} \vskip 5pt {#2} \vskip 5pt \end{minipage} } } \end{picture} \vskip 1mm -} \ No newline at end of file +} + +\newcommand{\latline}[5]{ + \latblock{#1}{#2} + \commentary{#3}{ + \transcorr{#4} + #5 + } +}{{}}
sgharms/latintools
5515df5635c604aeb14acbcbb0f7e2ee24d020d2
Added a placeholder example for an AEneid example.
diff --git a/aeneid_example.tex b/aeneid_example.tex new file mode 100644 index 0000000..1333ed7 --- /dev/null +++ b/aeneid_example.tex @@ -0,0 +1 @@ +TODO
sgharms/latintools
d86613995d643e903c2230408f0459619f28a705
added basic README
diff --git a/README b/README new file mode 100644 index 0000000..6ca4e4e --- /dev/null +++ b/README @@ -0,0 +1,24 @@ +Introduction: + +This is a simple set of LateX commands which help make Latin analysis prettier. + +Example: + +\latblock + { + \={\macron A}rm\-a v\-ir\=umqu\-e c\-an{\={\macron o}}, $||$ + Tr\={o}j\={\ae} qu\={\macron{\i}} pr\={\macron{\i}}m\-us \-ab + \={o}r\={\macron{\i}}s + } + {I sing of arms and the man, who came from the borders of Troy } + + +Dependencies: + +Documents will need the following packages: + + \usepackage{setspace} + \usepackage{ulem} + \usepackage{framed} + \usepackage[en]{metre} +
sgharms/latintools
4891318e6c051922cd7f63ac4037c63a96e56eaa
initial import of some tools i use to make notes
diff --git a/latinpoetry.sty b/latinpoetry.sty new file mode 100644 index 0000000..9b7caa4 --- /dev/null +++ b/latinpoetry.sty @@ -0,0 +1,47 @@ +\newcommand{\trans}[1]{ + \begin{normalsize} + \begin{sc} + {{#1}} + \end{sc} + \end{normalsize} +} + +\newcommand{\latblock}[2]{ + \begin{verse} + \begin{metrica} + {#1}\\ + \end{metrica} + \trans{{#2}}\\ + \end{verse} +} + +\newcommand{\commentary}[2]{ + \vskip5mm + \normalsize + + % (moves boxt left/right,moves box up/down vertically)() + \begin{picture} + (50,{#1}) % Creates the canvas space in which the frame will live + % + % Custom offsets for positioning the box + (-35,0) % First arg is the X offset, negatives move inward; + % positives, outword + % relative to the position within the \picture inveronment + + \put + (00,10) % Positioning of the box + { + \framebox + (400,{#1})[t] % Width of the box, height of the box + { + \begin{minipage}[t]{380pt} + \vskip 5pt + {#2} + \vskip 5pt + \end{minipage} + + } + } + \end{picture} + \vskip 1mm +} \ No newline at end of file
microft/junk
0487effdb64ebaa373c9695079834d53a7c37527
added my first file to my first github repository
diff --git a/README b/README new file mode 100644 index 0000000..e69de29
daveaugustine/monomeapps
d979686e5c8b6fbd4fb55220750eb11ad7d456b7
more TODO. sigh.
diff --git a/ripple/TODO b/ripple/TODO index 005bed4..aa965c9 100644 --- a/ripple/TODO +++ b/ripple/TODO @@ -1,6 +1,7 @@ * Origin button press duration = speed of ripple * Stone button press duration = duration of note length * Proper scale setup * Tilt control speed of ripple * Make ripple non square -* Multi origins possible if one corner button is reserved to use as modifier \ No newline at end of file +* Multi origins possible if one corner button is reserved to use as modifier +* Distance from origin is the velocity of note \ No newline at end of file
daveaugustine/monomeapps
baf83ba05c6241107e12e07ff1ce1d9923461f5d
Version 0.1 is complete.
diff --git a/ripple/README b/ripple/README index 3c62644..c838008 100644 --- a/ripple/README +++ b/ripple/README @@ -1 +1,12 @@ -A Ripple sequencer for the monome written in Ruby using the monomer library \ No newline at end of file +Ripple v.1 +========== + +A Ripple sequencer for the monome [64] written in Ruby using the monomer library + +Directions: +1. Press a button. This is your origin. The Ripple will spread from this point. +2. Press other buttons. These are your stones. When the Ripple hits a stone, a note is played. + +There ya go. + +You can turn off/on stones. If you turn off the origin, the playback stops. You can now pick a new origin. You can use a pre-existing stone for the new origin. \ No newline at end of file diff --git a/ripple/TODO b/ripple/TODO new file mode 100644 index 0000000..005bed4 --- /dev/null +++ b/ripple/TODO @@ -0,0 +1,6 @@ +* Origin button press duration = speed of ripple +* Stone button press duration = duration of note length +* Proper scale setup +* Tilt control speed of ripple +* Make ripple non square +* Multi origins possible if one corner button is reserved to use as modifier \ No newline at end of file diff --git a/ripple/ripple.rb b/ripple/ripple.rb index 76c6af8..34ae4fc 100755 --- a/ripple/ripple.rb +++ b/ripple/ripple.rb @@ -1,112 +1,115 @@ #!/usr/bin/env jruby -wKU require File.dirname(__FILE__) + '/../../monomer/lib/monomer' class Ripple < Monomer::Listener before_start do @midi = Monomer::MidiOut.new @buttons_on = [] @origin = nil @lights_on = [] @max_steps = 8 @current_step = 0 @play_debug = true end on_start do timely_repeat :bpm => 120, :prepare => L{play_notes}, :on_tick => L{@midi.play_prepared_notes!} end on_button_press do |x,y| button = {:x => x, :y => y} if @origin.nil? @origin = button + if @buttons_on.include? button + @buttons_on.delete(button) + end elsif @origin == button extinguish_origin elsif @buttons_on.include?(button) @buttons_on.delete(button) else @buttons_on.push(button) end end def self.play_notes unless (@current_step == @max_steps) || @origin.nil? monome.clear light_origin - toggle_others + light_others light_square(@current_step) check_for_hit @current_step += 1 else @current_step = 0 end end def self.check_for_hit @buttons_on.each do |button| if @lights_on.include?(button) @midi.prepare_note(:duration => 0.5, :note => ((button[:x] + 1) * (button[:y] + 1)) + 40) end end end def self.light_origin monome.led_on( @origin[:x], @origin[:y]) end def self.extinguish_origin monome.led_off( @origin[:x], @origin[:y]) @origin = nil end def self.toggle_origin monome.toggle_led( @origin[:x], @origin[:y]) end - def self.toggle_others + def self.light_others for button in @buttons_on do - monome.toggle_led( button[:x], button[:y]) + monome.led_on( button[:x], button[:y]) end end def self.light_square(size) @lights_on = [] unless size == 0 upper_left = { :x => @origin[:x] - size, :y => @origin[:y] - size } upper_right = { :x => @origin[:x] + size, :y => @origin[:y] - size } lower_left = { :x => @origin[:x] - size, :y => @origin[:y] + size } lower_right = { :x => @origin[:x] + size, :y => @origin[:y] + size } light_line( upper_left , upper_right ) light_line( upper_right , lower_right ) light_line( lower_left , lower_right ) light_line( upper_left , lower_left ) end end def self.light_line( starting, ending ) max_x = ( starting[:x] - ending[:x] ).abs max_y = ( starting[:y] - ending[:y] ).abs if (max_x > max_y) for x in starting[:x]..ending[:x] do monome.led_on( x, ending[:y] ) @lights_on.push( {:x => x, :y => ending[:y]} ) end else for y in starting[:y]..ending[:y] do monome.led_on( starting[:x], y ) @lights_on.push( {:x => starting[:x], :y => y} ) end end end end Monomer::Monome.create.with_listeners(Ripple).start if $0 == __FILE__ \ No newline at end of file
daveaugustine/monomeapps
a3884cbc584e3e67a8a660476935db8a64d04140
first working version.
diff --git a/ripple/ripple.rb b/ripple/ripple.rb index 83e49b6..76c6af8 100755 --- a/ripple/ripple.rb +++ b/ripple/ripple.rb @@ -1,98 +1,112 @@ #!/usr/bin/env jruby -wKU require File.dirname(__FILE__) + '/../../monomer/lib/monomer' class Ripple < Monomer::Listener before_start do @midi = Monomer::MidiOut.new @buttons_on = [] @origin = nil @lights_on = [] @max_steps = 8 @current_step = 0 @play_debug = true end on_start do timely_repeat :bpm => 120, :prepare => L{play_notes}, :on_tick => L{@midi.play_prepared_notes!} end on_button_press do |x,y| - unless @origin.nil? or (@origin[:x] == x && @origin[:y] == y) - @buttons_on.push({:x => x, :y => y}) - else - @origin = {:x => x, :y => y} + button = {:x => x, :y => y} + + if @origin.nil? + @origin = button + elsif @origin == button + extinguish_origin + elsif @buttons_on.include?(button) + @buttons_on.delete(button) + else + @buttons_on.push(button) end end def self.play_notes unless (@current_step == @max_steps) || @origin.nil? monome.clear light_origin - light_others + toggle_others light_square(@current_step) check_for_hit @current_step += 1 else @current_step = 0 end end def self.check_for_hit - @buttons_on.each do |button| + @buttons_on.each do |button| if @lights_on.include?(button) - @midi.prepare_note(:duration => 0.4 * (60 / 120.0 / 4), :note => button[:x] * 8 + button[:y]) + @midi.prepare_note(:duration => 0.5, :note => ((button[:x] + 1) * (button[:y] + 1)) + 40) end end - end - + def self.light_origin + monome.led_on( @origin[:x], @origin[:y]) + end + + def self.extinguish_origin + monome.led_off( @origin[:x], @origin[:y]) + @origin = nil + end + + def self.toggle_origin monome.toggle_led( @origin[:x], @origin[:y]) end - def self.light_others + def self.toggle_others for button in @buttons_on do monome.toggle_led( button[:x], button[:y]) end end def self.light_square(size) @lights_on = [] unless size == 0 upper_left = { :x => @origin[:x] - size, :y => @origin[:y] - size } upper_right = { :x => @origin[:x] + size, :y => @origin[:y] - size } lower_left = { :x => @origin[:x] - size, :y => @origin[:y] + size } lower_right = { :x => @origin[:x] + size, :y => @origin[:y] + size } light_line( upper_left , upper_right ) light_line( upper_right , lower_right ) light_line( lower_left , lower_right ) light_line( upper_left , lower_left ) end end def self.light_line( starting, ending ) max_x = ( starting[:x] - ending[:x] ).abs max_y = ( starting[:y] - ending[:y] ).abs if (max_x > max_y) for x in starting[:x]..ending[:x] do monome.led_on( x, ending[:y] ) @lights_on.push( {:x => x, :y => ending[:y]} ) end else for y in starting[:y]..ending[:y] do monome.led_on( starting[:x], y ) - @lights_on.push( {starting[:x], y} ) + @lights_on.push( {:x => starting[:x], :y => y} ) end end end end Monomer::Monome.create.with_listeners(Ripple).start if $0 == __FILE__ \ No newline at end of file
daveaugustine/monomeapps
daf0a9d281fd01f6c8948ade06868c85b827e8a1
refactoring. implementing single ripple source for now. ability to turn on / off origin
diff --git a/ripple/ripple.rb b/ripple/ripple.rb index ec5f0ac..83e49b6 100755 --- a/ripple/ripple.rb +++ b/ripple/ripple.rb @@ -1,81 +1,98 @@ #!/usr/bin/env jruby -wKU -require File.dirname(__FILE__) + '/../../lib/monomer' +require File.dirname(__FILE__) + '/../../monomer/lib/monomer' class Ripple < Monomer::Listener before_start do @midi = Monomer::MidiOut.new @buttons_on = [] + @origin = nil @lights_on = [] @max_steps = 8 @current_step = 0 - @play_debug = false + @play_debug = true end on_start do timely_repeat :bpm => 120, :prepare => L{play_notes}, :on_tick => L{@midi.play_prepared_notes!} end on_button_press do |x,y| - @buttons_on.push({:x => x, :y => y}) + unless @origin.nil? or (@origin[:x] == x && @origin[:y] == y) + @buttons_on.push({:x => x, :y => y}) + else + @origin = {:x => x, :y => y} + end end def self.play_notes - if @play_debug - print "Playing note at #{button[:x]}, #{button[:y]}\n" - puts test - end - - unless @current_step == @max_steps - light_rectangle(@current_step) + unless (@current_step == @max_steps) || @origin.nil? + monome.clear + light_origin + light_others + light_square(@current_step) + check_for_hit @current_step += 1 else @current_step = 0 end end - - def self.light_rectangle(size) - monome.clear + + def self.check_for_hit + @buttons_on.each do |button| + if @lights_on.include?(button) + @midi.prepare_note(:duration => 0.4 * (60 / 120.0 / 4), :note => button[:x] * 8 + button[:y]) + end + end + + end + + def self.light_origin + monome.toggle_led( @origin[:x], @origin[:y]) + end + + def self.light_others + for button in @buttons_on do + monome.toggle_led( button[:x], button[:y]) + end + end + + def self.light_square(size) @lights_on = [] - - @buttons_on.each do |button| - monome.toggle_led(button[:x], button[:y]) - - upper_left = { :x => button[:x] - size, :y => button[:y] - size } - upper_right = { :x => button[:x] + size, :y => button[:y] - size } - lower_left = { :x => button[:x] - size, :y => button[:y] + size } - lower_right = { :x => button[:x] + size, :y => button[:y] + size } - + + unless size == 0 + upper_left = { :x => @origin[:x] - size, :y => @origin[:y] - size } + upper_right = { :x => @origin[:x] + size, :y => @origin[:y] - size } + lower_left = { :x => @origin[:x] - size, :y => @origin[:y] + size } + lower_right = { :x => @origin[:x] + size, :y => @origin[:y] + size } + light_line( upper_left , upper_right ) light_line( upper_right , lower_right ) light_line( lower_left , lower_right ) light_line( upper_left , lower_left ) - - if @lights_on.include?(button) - @midi.prepare_note(:duration => 0.4 * (60 / 120.0 / 4), :note => button[:x] * 8 + button[:y]) - end end end def self.light_line( starting, ending ) max_x = ( starting[:x] - ending[:x] ).abs max_y = ( starting[:y] - ending[:y] ).abs if (max_x > max_y) for x in starting[:x]..ending[:x] do monome.led_on( x, ending[:y] ) @lights_on.push( {:x => x, :y => ending[:y]} ) end else for y in starting[:y]..ending[:y] do monome.led_on( starting[:x], y ) + @lights_on.push( {starting[:x], y} ) end end end end Monomer::Monome.create.with_listeners(Ripple).start if $0 == __FILE__ \ No newline at end of file
daveaugustine/monomeapps
4911671bd8aea3e366c309cc3b9c5d3d5a7bea45
added ripple
diff --git a/ripple/ripple.rb b/ripple/ripple.rb new file mode 100755 index 0000000..ec5f0ac --- /dev/null +++ b/ripple/ripple.rb @@ -0,0 +1,81 @@ +#!/usr/bin/env jruby -wKU + +require File.dirname(__FILE__) + '/../../lib/monomer' + +class Ripple < Monomer::Listener + + before_start do + @midi = Monomer::MidiOut.new + @buttons_on = [] + @lights_on = [] + @max_steps = 8 + @current_step = 0 + @play_debug = false + end + + on_start do + timely_repeat :bpm => 120, :prepare => L{play_notes}, :on_tick => L{@midi.play_prepared_notes!} + end + + on_button_press do |x,y| + @buttons_on.push({:x => x, :y => y}) + end + + def self.play_notes + + if @play_debug + print "Playing note at #{button[:x]}, #{button[:y]}\n" + puts test + end + + unless @current_step == @max_steps + light_rectangle(@current_step) + @current_step += 1 + else + @current_step = 0 + end + + end + + def self.light_rectangle(size) + monome.clear + @lights_on = [] + + @buttons_on.each do |button| + monome.toggle_led(button[:x], button[:y]) + + upper_left = { :x => button[:x] - size, :y => button[:y] - size } + upper_right = { :x => button[:x] + size, :y => button[:y] - size } + lower_left = { :x => button[:x] - size, :y => button[:y] + size } + lower_right = { :x => button[:x] + size, :y => button[:y] + size } + + light_line( upper_left , upper_right ) + light_line( upper_right , lower_right ) + light_line( lower_left , lower_right ) + light_line( upper_left , lower_left ) + + if @lights_on.include?(button) + @midi.prepare_note(:duration => 0.4 * (60 / 120.0 / 4), :note => button[:x] * 8 + button[:y]) + end + end + end + + def self.light_line( starting, ending ) + max_x = ( starting[:x] - ending[:x] ).abs + max_y = ( starting[:y] - ending[:y] ).abs + + if (max_x > max_y) + for x in starting[:x]..ending[:x] do + monome.led_on( x, ending[:y] ) + @lights_on.push( {:x => x, :y => ending[:y]} ) + end + else + for y in starting[:y]..ending[:y] do + monome.led_on( starting[:x], y ) + end + end + end + +end + +Monomer::Monome.create.with_listeners(Ripple).start if $0 == __FILE__ \ No newline at end of file
daveaugustine/monomeapps
aecf040f48a16b2a7836ed3334132e7295d70368
second
diff --git a/README b/README new file mode 100644 index 0000000..e69de29
ctorecords/Archive-Any-Plugin-Rar
bbb3f136d163417a1ca94c7edd88098591292036
Cpan commit preparing \#2
diff --git a/README b/README index e163e42..c608425 100644 --- a/README +++ b/README @@ -1,26 +1,26 @@ NAME Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar SYNOPSIS Do not use this module directly. Instead, use Archive::Any. SEE ALSO Archive::Any, Archive::Rar AUTHOR Dmitriy V. Simonov, "<dsimonov at gmail.com>" ACKNOWLEDGEMENTS Thanks to Clint Moore for Archive::Any - Thanks to [email protected] for minor fix + Thanks to "<d_ion at mail.ru>" for minor fix - Thanks to [email protected] for major fix + Thanks to "<ksuri at cpan.org>" for major fix COPYRIGHT & LICENSE Copyright 2010 Dmitriy V. Simonov. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. diff --git a/lib/Archive/Any/Plugin/Rar.pm b/lib/Archive/Any/Plugin/Rar.pm index bd850e3..b9ef8a0 100644 --- a/lib/Archive/Any/Plugin/Rar.pm +++ b/lib/Archive/Any/Plugin/Rar.pm @@ -1,77 +1,77 @@ package Archive::Any::Plugin::Rar; use warnings; use strict; use base 'Archive::Any::Plugin'; use Archive::Rar; =head1 NAME Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar =cut our $VERSION = '0.02'; =head1 SYNOPSIS Do not use this module directly. Instead, use Archive::Any. =cut sub can_handle { return( 'application/x-rar', 'application/x-rar-compressed', ); } sub files { my( $self, $file ) = @_; my $t = Archive::Rar->new( -archive => $file ); $t->List(); map { $_->{name} } @{$t->{list}}; } sub extract { my ( $self, $file ) = @_; my $t = Archive::Rar->new( -archive => $file, -quiet => 'True' ); return $t->Extract; } sub type { my $self = shift; return 'rar'; } =head1 SEE ALSO Archive::Any, Archive::Rar =head1 AUTHOR Dmitriy V. Simonov, C<< <dsimonov at gmail.com> >> =head1 ACKNOWLEDGEMENTS Thanks to Clint Moore for L<Archive::Any> -Thanks to [email protected] for minor fix +Thanks to C<< <d_ion at mail.ru> >> for minor fix -Thanks to [email protected] for major fix +Thanks to C<< <ksuri at cpan.org> >> for major fix =head1 COPYRIGHT & LICENSE Copyright 2010 Dmitriy V. Simonov. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. =cut 1; # End of Archive::Any::Plugin::Rar
ctorecords/Archive-Any-Plugin-Rar
73a960fe3d2ef911512bcd7e1d5a8b2919282b0d
Cpan commit preparing
diff --git a/MANIFEST b/MANIFEST index 32090de..76b3e7b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,26 +1,29 @@ .gitignore Changes ignore.txt inc/Module/AutoInstall.pm inc/Module/Install.pm inc/Module/Install/AutoInstall.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/Fetch.pm inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm lib/Archive/Any/Plugin/Rar.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP META.yml +MYMETA.json +MYMETA.yml README t/00-load.t t/boilerplate.t t/data/test.rar +t/explicit-type.t t/extract.t t/pod-coverage.t t/pod.t diff --git a/META.yml b/META.yml index 11ac78d..9ea3e8b 100644 --- a/META.yml +++ b/META.yml @@ -1,29 +1,29 @@ --- abstract: 'Archive::Any wrapper around Archive::Rar' author: - 'Dmitriy V. Simonov, C<< <dsimonov at gmail.com> >>' - 'Dmitriy V. Simonov <[email protected]>' build_requires: ExtUtils::MakeMaker: 6.36 Test::More: 0 lib::abs: 0 configure_requires: ExtUtils::MakeMaker: 6.36 distribution_type: module dynamic_config: 1 generated_by: 'Module::Install version 1.06' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Archive-Any-Plugin-Rar no_index: directory: - inc - t requires: Archive::Any: 0 Archive::Rar: 0 resources: license: http://dev.perl.org/licenses/ -version: 0.01 +version: 0.02 diff --git a/README b/README index 6f41e3e..e163e42 100644 --- a/README +++ b/README @@ -1,24 +1,26 @@ NAME Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar SYNOPSIS Do not use this module directly. Instead, use Archive::Any. SEE ALSO Archive::Any, Archive::Rar AUTHOR Dmitriy V. Simonov, "<dsimonov at gmail.com>" ACKNOWLEDGEMENTS Thanks to Clint Moore for Archive::Any + Thanks to [email protected] for minor fix + Thanks to [email protected] for major fix COPYRIGHT & LICENSE Copyright 2010 Dmitriy V. Simonov. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. diff --git a/lib/Archive/Any/Plugin/Rar.pm b/lib/Archive/Any/Plugin/Rar.pm index 4d296f0..bd850e3 100644 --- a/lib/Archive/Any/Plugin/Rar.pm +++ b/lib/Archive/Any/Plugin/Rar.pm @@ -1,73 +1,77 @@ package Archive::Any::Plugin::Rar; use warnings; use strict; use base 'Archive::Any::Plugin'; use Archive::Rar; =head1 NAME Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar =cut our $VERSION = '0.02'; =head1 SYNOPSIS Do not use this module directly. Instead, use Archive::Any. =cut sub can_handle { return( 'application/x-rar', 'application/x-rar-compressed', ); } sub files { my( $self, $file ) = @_; my $t = Archive::Rar->new( -archive => $file ); $t->List(); map { $_->{name} } @{$t->{list}}; } sub extract { my ( $self, $file ) = @_; my $t = Archive::Rar->new( -archive => $file, -quiet => 'True' ); return $t->Extract; } sub type { my $self = shift; return 'rar'; } =head1 SEE ALSO Archive::Any, Archive::Rar =head1 AUTHOR Dmitriy V. Simonov, C<< <dsimonov at gmail.com> >> =head1 ACKNOWLEDGEMENTS Thanks to Clint Moore for L<Archive::Any> +Thanks to [email protected] for minor fix + +Thanks to [email protected] for major fix + =head1 COPYRIGHT & LICENSE Copyright 2010 Dmitriy V. Simonov. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. =cut 1; # End of Archive::Any::Plugin::Rar
ctorecords/Archive-Any-Plugin-Rar
34103e14eb384b84a5dba261f2e34f25c37c9322
diff --git a/Changes b/Changes index 86506ca..42cfdcf 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Archive-Any-Plugin-Rar +0.02 Fix from [email protected], [email protected] + 10x :) + 0.01 Date/time First version, released on an unsuspecting world. diff --git a/META.yml b/META.yml index 2365c24..11ac78d 100644 --- a/META.yml +++ b/META.yml @@ -1,27 +1,29 @@ --- abstract: 'Archive::Any wrapper around Archive::Rar' author: + - 'Dmitriy V. Simonov, C<< <dsimonov at gmail.com> >>' - 'Dmitriy V. Simonov <[email protected]>' build_requires: - ExtUtils::MakeMaker: 6.42 + ExtUtils::MakeMaker: 6.36 Test::More: 0 lib::abs: 0 configure_requires: - ExtUtils::MakeMaker: 6.42 + ExtUtils::MakeMaker: 6.36 distribution_type: module -generated_by: 'Module::Install version 0.91' +dynamic_config: 1 +generated_by: 'Module::Install version 1.06' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Archive-Any-Plugin-Rar no_index: directory: - inc - t requires: Archive::Any: 0 Archive::Rar: 0 resources: license: http://dev.perl.org/licenses/ version: 0.01 diff --git a/README b/README index 932f8b0..6f41e3e 100644 --- a/README +++ b/README @@ -1,22 +1,24 @@ NAME Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar SYNOPSIS Do not use this module directly. Instead, use Archive::Any. SEE ALSO Archive::Any, Archive::Rar AUTHOR Dmitriy V. Simonov, "<dsimonov at gmail.com>" ACKNOWLEDGEMENTS Thanks to Clint Moore for Archive::Any + Thanks to [email protected] for minor fix + Thanks to [email protected] for major fix COPYRIGHT & LICENSE Copyright 2010 Dmitriy V. Simonov. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. diff --git a/lib/Archive/Any/Plugin/Rar.pm b/lib/Archive/Any/Plugin/Rar.pm index f60c710..4d296f0 100644 --- a/lib/Archive/Any/Plugin/Rar.pm +++ b/lib/Archive/Any/Plugin/Rar.pm @@ -1,73 +1,73 @@ package Archive::Any::Plugin::Rar; use warnings; use strict; use base 'Archive::Any::Plugin'; use Archive::Rar; =head1 NAME Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar =cut -our $VERSION = '0.01'; +our $VERSION = '0.02'; =head1 SYNOPSIS Do not use this module directly. Instead, use Archive::Any. =cut sub can_handle { return( 'application/x-rar', 'application/x-rar-compressed', ); } sub files { my( $self, $file ) = @_; my $t = Archive::Rar->new( -archive => $file ); $t->List(); map { $_->{name} } @{$t->{list}}; } sub extract { my ( $self, $file ) = @_; - my $t = Archive::Rar->new( -archive => $file ); + my $t = Archive::Rar->new( -archive => $file, -quiet => 'True' ); return $t->Extract; } sub type { my $self = shift; return 'rar'; } =head1 SEE ALSO Archive::Any, Archive::Rar =head1 AUTHOR Dmitriy V. Simonov, C<< <dsimonov at gmail.com> >> =head1 ACKNOWLEDGEMENTS Thanks to Clint Moore for L<Archive::Any> =head1 COPYRIGHT & LICENSE Copyright 2010 Dmitriy V. Simonov. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. =cut 1; # End of Archive::Any::Plugin::Rar
ctorecords/Archive-Any-Plugin-Rar
677460978dcddb6f72f93a88d68bba0ceca916de
added 'application/x-rar-compressed' to can_handle()
diff --git a/lib/Archive/Any/Plugin/Rar.pm b/lib/Archive/Any/Plugin/Rar.pm index 1a20d6f..f60c710 100644 --- a/lib/Archive/Any/Plugin/Rar.pm +++ b/lib/Archive/Any/Plugin/Rar.pm @@ -1,72 +1,73 @@ package Archive::Any::Plugin::Rar; use warnings; use strict; use base 'Archive::Any::Plugin'; use Archive::Rar; =head1 NAME Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar =cut our $VERSION = '0.01'; =head1 SYNOPSIS Do not use this module directly. Instead, use Archive::Any. =cut sub can_handle { return( 'application/x-rar', + 'application/x-rar-compressed', ); } sub files { my( $self, $file ) = @_; my $t = Archive::Rar->new( -archive => $file ); $t->List(); map { $_->{name} } @{$t->{list}}; } sub extract { my ( $self, $file ) = @_; my $t = Archive::Rar->new( -archive => $file ); return $t->Extract; } sub type { my $self = shift; return 'rar'; } =head1 SEE ALSO Archive::Any, Archive::Rar =head1 AUTHOR Dmitriy V. Simonov, C<< <dsimonov at gmail.com> >> =head1 ACKNOWLEDGEMENTS Thanks to Clint Moore for L<Archive::Any> =head1 COPYRIGHT & LICENSE Copyright 2010 Dmitriy V. Simonov. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. =cut 1; # End of Archive::Any::Plugin::Rar
ctorecords/Archive-Any-Plugin-Rar
0486f9e6fb2e9696a7cfac590017a9b5dc69355d
Bugfix
diff --git a/META.yml b/META.yml index c0e9918..2365c24 100644 --- a/META.yml +++ b/META.yml @@ -1,26 +1,27 @@ --- abstract: 'Archive::Any wrapper around Archive::Rar' author: - 'Dmitriy V. Simonov <[email protected]>' build_requires: ExtUtils::MakeMaker: 6.42 Test::More: 0 + lib::abs: 0 configure_requires: ExtUtils::MakeMaker: 6.42 distribution_type: module generated_by: 'Module::Install version 0.91' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Archive-Any-Plugin-Rar no_index: directory: - inc - t requires: Archive::Any: 0 Archive::Rar: 0 resources: license: http://dev.perl.org/licenses/ version: 0.01 diff --git a/Makefile.PL b/Makefile.PL index bc90a14..d5e3607 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,15 +1,16 @@ use inc::Module::Install; name 'Archive-Any-Plugin-Rar'; all_from 'lib/Archive/Any/Plugin/Rar.pm'; author q{Dmitriy V. Simonov <[email protected]>}; license 'perl'; build_requires 'Test::More'; +build_requires 'lib::abs'; requires 'Archive::Any'; requires 'Archive::Rar'; auto_install; WriteAll; diff --git a/t/extract.t b/t/extract.t index efd59cd..b14d062 100644 --- a/t/extract.t +++ b/t/extract.t @@ -1,26 +1,25 @@ #!/usr/bin/perl -w use Test::More 'no_plan'; -use File::Spec::Functions qw(updir); use lib::abs; my %tests = ( 'test.rar' => [qw{ README }], ); use_ok ( 'Archive::Any::Plugin::Rar' ); chdir(lib::abs::path('data')); while( my($file, $expect) = each %tests ) { my @files = Archive::Any::Plugin::Rar->files($file); ok( eq_set(\@files, $expect), 'right list of files'); is( Archive::Any::Plugin::Rar->extract($file), 0, 'no errors by extracting' ); foreach my $file (@files) { ok( -e $file, " $file" ); unlink $file; } }
ctorecords/Archive-Any-Plugin-Rar
b4d45fe3b24a0ab43a2d2e7beb3dd7a4b5f6b0b0
Bugfix
diff --git a/MANIFEST b/MANIFEST index bf438f0..32090de 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,23 +1,26 @@ +.gitignore Changes ignore.txt inc/Module/AutoInstall.pm inc/Module/Install.pm inc/Module/Install/AutoInstall.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/Fetch.pm inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm lib/Archive/Any/Plugin/Rar.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP META.yml README t/00-load.t t/boilerplate.t +t/data/test.rar +t/extract.t t/pod-coverage.t t/pod.t diff --git a/README b/README index 5c9c70d..932f8b0 100644 --- a/README +++ b/README @@ -1,55 +1,22 @@ -Archive-Any-Plugin-Rar +NAME + Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. +SYNOPSIS + Do not use this module directly. Instead, use Archive::Any. -A README file is required for CPAN modules since CPAN extracts the README -file from a module distribution so that people browsing the archive -can use it to get an idea of the module's uses. It is usually a good idea -to provide version information here so that people can decide whether -fixes for the module are worth downloading. +SEE ALSO + Archive::Any, Archive::Rar +AUTHOR + Dmitriy V. Simonov, "<dsimonov at gmail.com>" -INSTALLATION +ACKNOWLEDGEMENTS + Thanks to Clint Moore for Archive::Any -To install this module, run the following commands: +COPYRIGHT & LICENSE + Copyright 2010 Dmitriy V. Simonov. - perl Makefile.PL - make - make test - make install - -SUPPORT AND DOCUMENTATION - -After installing, you can find documentation for this module with the -perldoc command. - - perldoc Archive::Any::Plugin::Rar - -You can also look for information at: - - RT, CPAN's request tracker - http://rt.cpan.org/NoAuth/Bugs.html?Dist=Archive-Any-Plugin-Rar - - AnnoCPAN, Annotated CPAN documentation - http://annocpan.org/dist/Archive-Any-Plugin-Rar - - CPAN Ratings - http://cpanratings.perl.org/d/Archive-Any-Plugin-Rar - - Search CPAN - http://search.cpan.org/dist/Archive-Any-Plugin-Rar/ - - -COPYRIGHT AND LICENCE - -Copyright (C) 2010 Dmitriy V. Simonov - -This program is free software; you can redistribute it and/or modify it -under the terms of either: the GNU General Public License as published -by the Free Software Foundation; or the Artistic License. - -See http://dev.perl.org/licenses/ for more information. + This program is free software; you can redistribute it and/or modify it + under the terms of either: the GNU General Public License as published + by the Free Software Foundation; or the Artistic License. diff --git a/lib/Archive/Any/Plugin/Rar.pm b/lib/Archive/Any/Plugin/Rar.pm index 0cb71cd..1a20d6f 100644 --- a/lib/Archive/Any/Plugin/Rar.pm +++ b/lib/Archive/Any/Plugin/Rar.pm @@ -1,71 +1,72 @@ package Archive::Any::Plugin::Rar; use warnings; use strict; use base 'Archive::Any::Plugin'; use Archive::Rar; =head1 NAME Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar =cut our $VERSION = '0.01'; =head1 SYNOPSIS Do not use this module directly. Instead, use Archive::Any. =cut sub can_handle { return( 'application/x-rar', ); } sub files { my( $self, $file ) = @_; - my $t = Archive::Rar->new( $file ); - return $t->List( ); + my $t = Archive::Rar->new( -archive => $file ); + $t->List(); + map { $_->{name} } @{$t->{list}}; } sub extract { my ( $self, $file ) = @_; my $t = Archive::Rar->new( -archive => $file ); return $t->Extract; } sub type { my $self = shift; return 'rar'; } =head1 SEE ALSO Archive::Any, Archive::Rar =head1 AUTHOR Dmitriy V. Simonov, C<< <dsimonov at gmail.com> >> =head1 ACKNOWLEDGEMENTS Thanks to Clint Moore for L<Archive::Any> =head1 COPYRIGHT & LICENSE Copyright 2010 Dmitriy V. Simonov. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. =cut 1; # End of Archive::Any::Plugin::Rar
ctorecords/Archive-Any-Plugin-Rar
aac4286fbe0b281d64be8eb78d3c40a543029a5b
Bugfix
diff --git a/makeall.sh b/makeall.sh new file mode 100755 index 0000000..057b609 --- /dev/null +++ b/makeall.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +MODULE=`perl -ne 'print $1 if m{all_from.+?([\w/.]+)}' Makefile.PL`; +perl=perl +$perl -v + +rm -rf MANIFEST.bak Makefile.old && \ +pod2text $MODULE > README && \ +$perl -i -lpne 's{^\s+$}{};s{^ ((?: {8})+)}{" "x(4+length($1)/2)}se;' README && \ +$perl Makefile.PL && \ +make manifest && \ +make && \ +TEST_AUTHOR=1 make test && \ +make disttest && \ +make dist && \ +cp -f *.tar.gz dist/ && \ +make clean && \ +rm -rf MANIFEST.bak Makefile.old && \ +echo "All is OK" diff --git a/t/data/test.rar b/t/data/test.rar new file mode 100644 index 0000000..13382ed Binary files /dev/null and b/t/data/test.rar differ diff --git a/t/extract.t b/t/extract.t new file mode 100644 index 0000000..efd59cd --- /dev/null +++ b/t/extract.t @@ -0,0 +1,26 @@ +#!/usr/bin/perl -w + +use Test::More 'no_plan'; +use File::Spec::Functions qw(updir); +use lib::abs; + +my %tests = ( + 'test.rar' => [qw{ + README + }], +); + +use_ok ( 'Archive::Any::Plugin::Rar' ); +chdir(lib::abs::path('data')); + +while( my($file, $expect) = each %tests ) { + + my @files = Archive::Any::Plugin::Rar->files($file); + ok( eq_set(\@files, $expect), 'right list of files'); + is( Archive::Any::Plugin::Rar->extract($file), 0, 'no errors by extracting' ); + foreach my $file (@files) { + ok( -e $file, " $file" ); + unlink $file; + } + +}
pec1985/Flash-Cards-app
e5c5c2fb0b947e0434c6c6e08beb5e779856cfc9
Apache License
diff --git a/README b/README index e69de29..84f573f 100644 --- a/README +++ b/README @@ -0,0 +1,13 @@ + Copyright 2011 Pedro Enrique + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file
pec1985/Flash-Cards-app
a68ee8995edbca2416ca50da0cab6646b55b1372
Fixed overall buttons on android
diff --git a/Resources/a_addchapters.js b/Resources/a_addchapters.js index a8a01d1..fb36ee1 100644 --- a/Resources/a_addchapters.js +++ b/Resources/a_addchapters.js @@ -1,110 +1,110 @@ var addChapters = function(subjectId){ var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId); var thisSubject = subjectName.fieldByName('subject'); subjectName.close(); db.close(); var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); var a_viewTitle = Ti.UI.createLabel({ text:'Add Chapters',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); a_topbar.add(a_viewTitle); - var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); - var addButton = Ti.UI.createImageView({image:'a_add.png',top:9,right:5}); + var closeButton = Ti.UI.createButton({image:'a_close.png',top:9,left:5}); + var addButton = Ti.UI.createButton({image:'a_add.png',top:9,right:5}); var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Subject',left:20,top:55,color:'black'}); var viewSubjectsViewTitle = Ti.UI.createTextField({value:thisSubject,top:80,height:44,right:12,left:12,color:'black'}); var viewChaptersTitle = Ti.UI.createLabel({text:'Chapters',left:20,top:130,color:'black'}); win.add(a_topbar); win.add(closeButton); win.add(addButton); win.add(navbarShadow); win.add(viewSubjectsTitle); win.add(viewSubjectsViewTitle); win.add(viewChaptersTitle); var chaptersTable = Ti.UI.createTableView({top:160,backgroundColor:'white',editable:true}); var timer; var confirmDel = function(rowId,rowName) { var msgTitle = "Delete Entire Chapter"; var msgText = "Are you sure you want to delete the '"+rowName+"' chapter?"; var statusAlert = Titanium.UI.createAlertDialog({title:msgTitle,message:msgText,buttonNames: ['Cancel','Ok']}); statusAlert.show(); statusAlert.addEventListener('click',function(e){ if (e.index == 0){statusAlert.hide();} if (e.index == 1){ var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); db.execute("DELETE FROM chapters WHERE id = ?", rowId); db.close(); refresh(); } }); }; var tapAndHold = function(e){ e.addEventListener('touchstart', function(e){ timer = setTimeout(function() { confirmDel(e.source.rowId,e.source.rowName); }, 500); }); e.addEventListener('touchend', function(e){ clearTimeout(timer); }); }; var refresh = function(){ var data = []; var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId); var x = 0; while (rows.isValidRow()){ var chapterName = rows.fieldByName('chapter'); var id = rows.fieldByName('id'); var touchView = Ti.UI.createView({ rowId:id,rowName:chapterName,left:0, top:0, right:0, bottom:0 }); // invisible view to capture touch var row = Ti.UI.createTableViewRow({backgroundColor:'white',chapterId:id,chapterName:chapterName,hasChild:true}); var label = Ti.UI.createLabel({text:chapterName, left:10,height:20,color:'black'}); row.add(touchView); row.add(label); tapAndHold(touchView); data[x++] = row; rows.next(); }; rows.close(); db.close(); chaptersTable.data=data; }; refresh(); win.add(chaptersTable); var window; addButton.addEventListener('click',function(){ viewSubjectsViewTitle.blur(); window = addChaptersWindow(subjectId); window.open(); window.addEventListener('close',function(){ refresh(); }); }); chaptersTable.addEventListener('click',function(e){ viewSubjectsViewTitle.blur(); window = addFlashcards(e.rowData.chapterName,e.rowData.chapterId); window.open(); window.addEventListener('close',function(){ refresh(); }); }); closeButton.addEventListener('click',function(){ viewSubjectsViewTitle.blur(); if(viewSubjectsViewTitle.value == null){ } else { var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); db.execute("UPDATE subjects SET subject = '"+viewSubjectsViewTitle.value+"' WHERE id = "+subjectId); db.close(); } win.close(); }); return win; }; \ No newline at end of file diff --git a/Resources/a_addflashcards.js b/Resources/a_addflashcards.js index 18d67af..06411e0 100644 --- a/Resources/a_addflashcards.js +++ b/Resources/a_addflashcards.js @@ -1,105 +1,105 @@ var addFlashcards = function(title,chapterId){ var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); var a_viewTitle = Ti.UI.createLabel({ text:'Add Flashcards',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); a_topbar.add(a_viewTitle); - var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); - var addButton = Ti.UI.createImageView({image:'a_add.png',top:9,right:5}); + var closeButton = Ti.UI.createButton({image:'a_close.png',top:9,left:5}); + var addButton = Ti.UI.createButton({image:'a_add.png',top:9,right:5}); var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); var viewSubjectsTitle = Ti.UI.createLabel({text:'Chapter',left:20,top:55,color:'black'}); var viewSubjectsViewTitle = Ti.UI.createTextField({value:title,top:80,height:44,right:12,left:12,color:'black'}); var viewChaptersTitle = Ti.UI.createLabel({text:'Flashcards',left:20,top:130,color:'black'}); win.add(a_topbar); win.add(closeButton); win.add(addButton); win.add(navbarShadow); win.add(viewSubjectsTitle); win.add(viewSubjectsViewTitle); win.add(viewChaptersTitle); var chaptersTable = Ti.UI.createTableView({top:160,backgroundColor:'white',editable:true}); var timer; var confirmDel = function(rowId,rowName) { var msgTitle = "Delete Flashcard"; var msgText = "Are you sure you want to delete the '"+rowName+"' flashcard?"; var statusAlert = Titanium.UI.createAlertDialog({title:msgTitle,message:msgText,buttonNames: ['Cancel','Ok']}); statusAlert.show(); statusAlert.addEventListener('click',function(e){ if (e.index == 0){statusAlert.hide();} if (e.index == 1){ var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); db.execute("DELETE FROM flashcards WHERE id = ?", rowId); db.close(); refresh(); } }); }; var tapAndHold = function(e){ e.addEventListener('touchstart', function(e){ timer = setTimeout(function() { confirmDel(e.source.rowId,e.source.rowName); }, 500); }); e.addEventListener('touchend', function(e){ clearTimeout(timer); }); }; var refresh = function(){ var data = []; var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); var rows = db.execute("SELECT * FROM flashcards WHERE chapter = '"+chapterId+"' ORDER BY id"); var x = 0; while (rows.isValidRow()){ var flashName = rows.fieldByName('name'); var id = rows.fieldByName('id'); var touchView = Ti.UI.createView({ rowId:id,rowName:flashName,left:0, top:0, right:0, bottom:0 }); // invisible view to capture touch var row = Ti.UI.createTableViewRow({backgroundColor:'white',flashId:id,flashName:flashName,hasChild:true}); var label = Ti.UI.createLabel({text:flashName, left:10,color:'black'}); row.add(touchView); row.add(label); tapAndHold(touchView); data[x++] = row; rows.next(); }; rows.close(); db.close(); chaptersTable.data=data; }; refresh(); win.add(chaptersTable); var window; addButton.addEventListener('click',function(e){ window = addFlashCardWindow('null',chapterId); window.open(); window.addEventListener('close',function(){ refresh(); }); }); chaptersTable.addEventListener('click',function(e){ window = addFlashCardWindow(e.rowData.flashId,'null'); window.open(); window.addEventListener('close',function(){ refresh(); }); }); closeButton.addEventListener('click',function(){ var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); db.execute("UPDATE chapters SET chapter = '"+viewSubjectsViewTitle.value+"' WHERE id = "+chapterId); db.close(); viewSubjectsViewTitle.blur(); win.close(); }); viewSubjectsViewTitle.addEventListener('return',function(){ viewSubjectsViewTitle.blur(); }); return win; }; \ No newline at end of file diff --git a/Resources/a_addnewchapter.js b/Resources/a_addnewchapter.js index be06820..2c6b2f2 100644 --- a/Resources/a_addnewchapter.js +++ b/Resources/a_addnewchapter.js @@ -1,30 +1,30 @@ var addChaptersWindow = function(subjectId){ var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); var a_viewTitle = Ti.UI.createLabel({ text:'Add New Chapter',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); a_topbar.add(a_viewTitle); - var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); + var closeButton = Ti.UI.createButton({image:'a_close.png',top:9,left:5}); var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Chapter',left:20,top:55,color:'black'}); var viewSubjectsViewTitle = Ti.UI.createTextField({top:80,height:44,right:12,left:12,color:'black'}); win.add(a_topbar); win.add(viewSubjectsTitle); win.add(viewSubjectsViewTitle); win.add(closeButton); win.add(navbarShadow); viewSubjectsViewTitle.focus(); closeButton.addEventListener('click',function(){ if(viewSubjectsViewTitle.value == null){ } else { var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); db.execute("INSERT INTO chapters (chapter,subject) VALUES (?,?)",viewSubjectsViewTitle.value,subjectId); db.close(); } viewSubjectsViewTitle.blur(); win.close(); }); return win; }; \ No newline at end of file diff --git a/Resources/a_addnewflashcard.js b/Resources/a_addnewflashcard.js index a49f860..926c7ff 100644 --- a/Resources/a_addnewflashcard.js +++ b/Resources/a_addnewflashcard.js @@ -1,63 +1,63 @@ var addFlashCardWindow = function(flashId,chapterId){ var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); var a_viewTitle = Ti.UI.createLabel({ text:'Flashcard',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); a_topbar.add(a_viewTitle); - var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); - var saveButton = Ti.UI.createImageView({image:'a_save.png',top:9,right:5}); + var closeButton = Ti.UI.createButton({image:'a_close.png',top:9,left:5}); + var saveButton = Ti.UI.createButton({image:'a_save.png',top:9,right:5}); var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); var viewFlashTitle = Ti.UI.createLabel({text:'Name',left:20,top:55,color:'black'}); var viewFlashTitleField = Ti.UI.createTextField({top:80,height:44,right:12,left:12,color:'black'}); var viewFlashDescription = Ti.UI.createLabel({text:'Description',left:20,top:130,color:'black'}); var viewFlashDescriptionField = Ti.UI.createTextArea({top:160,height:100,right:12,left:12,color:'black'}); win.add(a_topbar); win.add(closeButton); win.add(saveButton); win.add(viewFlashTitle); win.add(viewFlashTitleField); win.add(viewFlashDescription); win.add(viewFlashDescriptionField); win.add(navbarShadow); saveButton.addEventListener('click',function(){ viewFlashTitleField.blur(); viewFlashDescriptionField.blur(); if (flashId == 'null'){ var db1 = Titanium.Database.install('flashcards.sqlite', 'flash1'); db1.execute("INSERT INTO flashcards (name,description,chapter) VALUES (?,?,?)",viewFlashTitleField.value,viewFlashDescriptionField.value,chapterId); db1.close(); win.close(); } else { var db2 = Titanium.Database.install('flashcards.sqlite', 'flash1'); db2.execute("UPDATE flashcards set name = '"+viewFlashTitleField.value+"', description = '"+viewFlashDescriptionField.value+"' WHERE id ="+flashId); db2.close(); win.close(); } }); closeButton.addEventListener('click',function(){ viewFlashTitleField.blur(); viewFlashDescriptionField.blur(); win.close(); }); if (flashId != 'null'){ var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); var subjectName = db.execute("SELECT * FROM flashcards WHERE id = ?",flashId); var thisName = subjectName.fieldByName('name'); var thisDescription = subjectName.fieldByName('description'); viewFlashTitleField.value = thisName; viewFlashDescriptionField.value = thisDescription; subjectName.close(); db.close(); } return win; }; \ No newline at end of file diff --git a/Resources/a_addsubjects.js b/Resources/a_addsubjects.js index 2077c33..f70608c 100644 --- a/Resources/a_addsubjects.js +++ b/Resources/a_addsubjects.js @@ -1,31 +1,31 @@ var addSubjectsWindow = function(subjectId){ var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); var a_viewTitle = Ti.UI.createLabel({ text:'Add New Subject',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); a_topbar.add(a_viewTitle); - var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); + var closeButton = Ti.UI.createButton({image:'a_close.png',top:9,left:5}); var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Subject',left:20,top:55,color:'black'}); var viewSubjectsViewTitle = Ti.UI.createTextField({top:80,height:44,right:12,left:12,color:'black'}); win.add(a_topbar); win.add(viewSubjectsTitle); win.add(viewSubjectsViewTitle); win.add(closeButton); win.add(navbarShadow); viewSubjectsViewTitle.focus(); closeButton.addEventListener('click',function(){ viewSubjectsViewTitle.blur(); if(viewSubjectsViewTitle.value == null){ } else { var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); db.execute("INSERT INTO subjects (subject) VALUES (?)",viewSubjectsViewTitle.value); db.close(); } win.close(); }); return win; }; \ No newline at end of file diff --git a/Resources/a_editlist.js b/Resources/a_editlist.js index 10489a0..7b2d81f 100644 --- a/Resources/a_editlist.js +++ b/Resources/a_editlist.js @@ -1,86 +1,86 @@ var a_editList = function(){ var a_view = Ti.UI.createView({bottom:48}); var a_viewListTopbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); var a_viewTitle = Ti.UI.createLabel({ text:'Edit Subjects',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); var a_viewListTable = Ti.UI.createTableView({backgroundColor:'white',top:44}); - var addButton = Ti.UI.createImageView({image:'a_add.png',top:9,right:5}); + var addButton = Ti.UI.createButton({image:'a_add.png',top:9,right:5}); a_viewListTopbar.add(a_viewTitle); a_view.add(a_viewListTopbar); a_view.add(a_viewListTable); a_view.add(addButton); var timer; var confirmDel = function(rowId,rowName) { var msgTitle = "Delete Entire Subject"; var msgText = "Are you sure you want to delete the '"+rowName+"' subject?"; var statusAlert = Titanium.UI.createAlertDialog({title:msgTitle,message:msgText,buttonNames: ['Cancel','Ok']}); statusAlert.show(); statusAlert.addEventListener('click',function(e){ if (e.index == 0){statusAlert.hide();} if (e.index == 1){ var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); db.execute("DELETE FROM subjects WHERE id = ?", rowId); db.close(); refresh(); } }); }; var tapAndHold = function(e){ e.addEventListener('touchstart', function(e){ timer = setTimeout(function() { confirmDel(e.source.rowId,e.source.rowName); }, 500); }); e.addEventListener('touchend', function(e){ clearTimeout(timer); }); }; var refresh = function(){ var data = []; var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); var rows = db.execute("SELECT * FROM subjects ORDER BY subject"); var x = 0; while (rows.isValidRow()){ var subjectName = rows.fieldByName('subject'); var id = rows.fieldByName('id'); var row = Ti.UI.createTableViewRow({backgroundColor:'white',subjectId:id,subjectName:subjectName,hasChild:true}); var touchView = Ti.UI.createView({ rowId:id,rowName:subjectName,left:0, top:0, right:0, bottom:0 }); // invisible view to capture touch var label = Ti.UI.createLabel({text:subjectName, left:10,color:'black'}); row.add(label); row.add(touchView); tapAndHold(row); data[x++] = row; rows.next(); }; rows.close(); db.close(); a_viewListTable.data=data; }; refresh(); var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); a_view.add(navbarShadow); var window; addButton.addEventListener('click',function(){ window = addSubjectsWindow(); window.open(); window.addEventListener('close',function(){ refresh(); }); }); a_viewListTable.addEventListener('click',function(e){ window = addChapters(e.rowData.subjectId); window.open(); window.addEventListener('close',function(){ refresh(); }); }); return a_view; }; diff --git a/Resources/a_viewchapters.js b/Resources/a_viewchapters.js index 4b0d105..709f088 100644 --- a/Resources/a_viewchapters.js +++ b/Resources/a_viewchapters.js @@ -1,63 +1,63 @@ var viewChaptertWindow = function(subjectId){ var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId); var thisSubject = subjectName.fieldByName('subject'); subjectName.close(); db.close(); var chapsWin = Ti.UI.createWindow({backgroundColor:'#ccc'}); var a_viewListTopbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); var a_viewTitle = Ti.UI.createLabel({ text:'Chapters',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); a_viewListTopbar.add(a_viewTitle); var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); - var backButton = Ti.UI.createImageView({image:'subjects-back.png',top:9,left:5}); + var backButton = Ti.UI.createButton({image:'subjects-back.png',top:9,left:5}); var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Subject',left:20,top:55,color:'black'}); var viewSubjectsView = Ti.UI.createView({backgroundColor:'white',left:10,right:10,height:40,top:80,borderColor:'#ababab',borderWidth:1,borderRadius:7}); var viewSubjectsViewTitle = Ti.UI.createLabel({text:thisSubject,left:12,color:'black'}); viewSubjectsView.add(viewSubjectsViewTitle); var chaptersTitle = Ti.UI.createLabel({text:'Chapters',left:20,top:130,color:'black'}); var chaptersTable = Ti.UI.createTableView({top:160,left:10,right:10,height:'auto',borderColor:'#ababab',borderWidth:1,borderRadius:7,backgroundColor:'white'}); var refresh = function(){ var data = []; var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId); var x = 0; while (rows.isValidRow()){ var chapterName = rows.fieldByName('chapter'); var id = rows.fieldByName('id'); var row = Ti.UI.createTableViewRow({chapterId:id,chapterName:chapterName,hasChild:true}); var label = Ti.UI.createLabel({text:chapterName, left:10,height:20,color:'black'}); row.add(label); data[x++] = row; rows.next(); }; rows.close(); db.close(); chaptersTable.data=data; }; refresh(); chaptersTable.addEventListener('click',function(e){ flashCardsWindow(e.rowData.chapterName,e.rowData.chapterId).open(); }); chapsWin.add(a_viewListTopbar); chapsWin.add(backButton); chapsWin.add(navbarShadow); chapsWin.add(viewSubjectsTitle); chapsWin.add(viewSubjectsView); chapsWin.add(chaptersTitle); chapsWin.add(chaptersTable); backButton.addEventListener('click',function(){ chapsWin.close(); }); return chapsWin; }; diff --git a/Resources/a_viewflascards.js b/Resources/a_viewflascards.js index f73ace8..5e2348f 100644 --- a/Resources/a_viewflascards.js +++ b/Resources/a_viewflascards.js @@ -1,110 +1,110 @@ var flashCardsWindow = function(title,chapterId){ var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); var a_bottombar = Ti.UI.createView({left:0,right:0,bottom:0,height:47,backgroundImage:'a_bottombar.png'}); var a_viewTitle = Ti.UI.createLabel({ text:'Chapters',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); a_topbar.add(a_viewTitle); - var backButton = Ti.UI.createImageView({image:'a_chaps.png',top:9,left:5}); + var backButton = Ti.UI.createButton({image:'a_chaps.png',top:9,left:5}); var flipButton = Ti.UI.createButton({backgroundImage:'flip.png',top:9,right:5,width:48,height:30}); var randButton = Ti.UI.createButton({backgroundImage:'a_random.png',bottom:8,left:5,width:99,height:30}); var nameButton = Ti.UI.createButton({backgroundImage:'a_byname.png',bottom:8,right:5,width:99,height:30}); var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); var totalViews1 = []; var totalViews2 = []; var mainView = Ti.UI.createView({left:5,right:5}); var scrollView1 = Ti.UI.createScrollableView({top:49,bottom:54,left:10,right:10}); var scrollView2 = Ti.UI.createScrollableView({top:49,bottom:54,left:10,right:10}); var dubleTapping = function(e){ e.addEventListener('doubletap',function(){ flip(); }); }; var refresh = function(order){ var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); var flashcardsName; if (order == 'random'){ flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY RANDOM()",chapterId); } else if (order == 'name'){ flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY name",chapterId); } else { flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ?",chapterId); } var x = 0; while (flashcardsName.isValidRow()){ var flashName = flashcardsName.fieldByName('name'); var flashDescription = flashcardsName.fieldByName('description'); var id = flashcardsName.fieldByName('id'); var flashNumber1 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right',color:'black'}); var flashView1 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',page:1,borderColor:'#999',borderRadius:5}); var flashTitle1 = Ti.UI.createLabel({text:flashName,textAlign:'center',color:'black',font:{fontWeight:'bold',fontSize:20}}); flashView1.add(flashNumber1); flashView1.add(flashTitle1); dubleTapping(flashView1); var flashNumber2 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right',color:'black'}); var flashView2 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',backgroundImage:'flashcard.png',page:2,borderColor:'#999',borderRadius:5}); var flashTitle2 = Ti.UI.createLabel({text:flashDescription,textAlign:'left',left:20,right:20,font:{fontWeight:'bold',fontSize:16},color:'black'}); flashView2.add(flashNumber2); flashView2.add(flashTitle2); dubleTapping(flashView2); totalViews1[x] = flashView1; totalViews2[x++] = flashView2; flashcardsName.next(); }; flashcardsName.close(); db.close(); scrollView1.views = totalViews1; scrollView2.views = totalViews2; }; refresh(); win.add(a_topbar); win.add(a_bottombar); win.add(navbarShadow); win.add(scrollView1); win.add(backButton); win.add(randButton); win.add(nameButton); win.add(flipButton); var pageDisplay = 1; var flip = function(){ switch (pageDisplay){ case 1: scrollView2.currentPage = scrollView1.currentPage; win.remove(scrollView1); win.add(scrollView2); pageDisplay = 2; break; case 2: scrollView1.currentPage = scrollView2.currentPage; win.remove(scrollView2); win.add(scrollView1); pageDisplay = 1; break; } }; flipButton.addEventListener('click',function(){ flip(); }); randButton.addEventListener('click',function(){ refresh('random'); }); nameButton.addEventListener('click',function(){ refresh('name'); }); backButton.addEventListener('click',function(){ win.close(); }); return win; }; \ No newline at end of file diff --git a/Resources/app.js b/Resources/app.js index f257578..0b97f00 100644 --- a/Resources/app.js +++ b/Resources/app.js @@ -1,89 +1,89 @@ Titanium.UI.setBackgroundColor('#000'); if (Ti.Platform.name != 'android'){ var tabGroup = Titanium.UI.createTabGroup(); var win1 = Titanium.UI.createWindow({color:'#61290C', url:'viewlist.js',title:'Subjects',barImage:'navbarbg.png',barColor:'#D0A159' }); var tab1 = Titanium.UI.createTab({ icon:'icon1.png', title:'Study', window:win1 }); var win2 = Titanium.UI.createWindow({color:'#61290C', url:'editlist.js',title:'Subjects',barImage:'navbarbg.png',barColor:'#D0A159' }); var tab2 = Titanium.UI.createTab({ icon:'icon2.png', title:'Edit Subjects', window:win2 }); tabGroup.addTab(tab1); tabGroup.addTab(tab2); tabGroup.open(); } else { Ti.include('a_viewlist.js'); Ti.include('a_editlist.js'); Ti.include('a_viewchapters.js'); Ti.include('a_viewflascards.js'); Ti.include('a_addsubjects.js'); Ti.include('a_addchapters.js'); Ti.include('a_addnewchapter.js'); Ti.include('a_addflashcards.js'); Ti.include('extras.js'); Ti.include('a_addnewflashcard.js'); var a_mainWindow = Ti.UI.createWindow({backgroundColor:'white'}); var a_bottomTabs = Ti.UI.createView({left:0, right:0, height:48, bottom:0, backgroundImage:'a_tab2.png' }); var a_bottomTab1 = Ti.UI.createView({left:20, width:120, height:48, bottom:0, backgroundImage:'a_tab1.png' }); var a_bottomTab2 = Ti.UI.createView({right:20, width:120, height:48, bottom:0 }); - var a_bottomTab1Image = Ti.UI.createImageView({image:'icon1s.png',bottom:18}); - var a_bottomTab2Image = Ti.UI.createImageView({image:'icon2.png',bottom:18}); + var a_bottomTab1Image = Ti.UI.createImageView({image:'icon1s.png',bottom:18,width:30,height:30}); + var a_bottomTab2Image = Ti.UI.createImageView({image:'icon2.png',bottom:18,width:30,height:30}); var a_bottomTab1Text = Ti.UI.createLabel({text:'Study',bottom:0,color:'white'}); var a_bottomTab2Text = Ti.UI.createLabel({text:'Edit Subjects',bottom:0,color:'white'}); a_bottomTab1.add(a_bottomTab1Text); a_bottomTab2.add(a_bottomTab2Text); a_bottomTab1.add(a_bottomTab1Image); a_bottomTab2.add(a_bottomTab2Image); a_mainWindow.add(a_viewList()); a_bottomTabs.add(a_bottomTab1); a_bottomTabs.add(a_bottomTab2); a_mainWindow.add(a_bottomTabs); a_mainWindow.open(); // var width = (a_mainWindow.size.width/2); a_bottomTab1.addEventListener('click',function(){ a_bottomTab1.backgroundImage='a_tab1.png'; a_bottomTab2.backgroundImage=null; a_bottomTab1Image.image='icon1s.png'; a_bottomTab2Image.image='icon2.png'; a_bottomTab1Text.color='white'; a_bottomTab2Text.color='#999'; a_mainWindow.remove(a_editList()); a_mainWindow.add(a_viewList()); }); a_bottomTab2.addEventListener('click',function(){ a_bottomTab2.backgroundImage='a_tab1.png'; a_bottomTab1.backgroundImage=null; a_bottomTab1Image.image='icon1.png'; a_bottomTab2Image.image='icon2s.png'; a_bottomTab1Text.color='#999'; a_bottomTab2Text.color='white'; a_mainWindow.remove(a_viewList()); a_mainWindow.add(a_editList()); }); a_mainWindow.addEventListener('focus',function(){ alert(a_mainWindow.toImage().width); }); }
pec1985/Flash-Cards-app
f2e5d3d9b13a2852c49788fda6ff4c9aba1c0a45
First public release
diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..c07ac1b Binary files /dev/null and b/.DS_Store differ diff --git a/Resources/.DS_Store b/Resources/.DS_Store new file mode 100644 index 0000000..fc51456 Binary files /dev/null and b/Resources/.DS_Store differ diff --git a/Resources/KS_nav_ui.png b/Resources/KS_nav_ui.png new file mode 100644 index 0000000..28976c8 Binary files /dev/null and b/Resources/KS_nav_ui.png differ diff --git a/Resources/KS_nav_views.png b/Resources/KS_nav_views.png new file mode 100644 index 0000000..885abd9 Binary files /dev/null and b/Resources/KS_nav_views.png differ diff --git a/Resources/a_add.png b/Resources/a_add.png new file mode 100644 index 0000000..7ec3913 Binary files /dev/null and b/Resources/a_add.png differ diff --git a/Resources/a_addchapters.js b/Resources/a_addchapters.js new file mode 100644 index 0000000..a8a01d1 --- /dev/null +++ b/Resources/a_addchapters.js @@ -0,0 +1,110 @@ +var addChapters = function(subjectId){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId); + var thisSubject = subjectName.fieldByName('subject'); + subjectName.close(); + db.close(); + + var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); + + var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); + var a_viewTitle = Ti.UI.createLabel({ text:'Add Chapters',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + a_topbar.add(a_viewTitle); + var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); + var addButton = Ti.UI.createImageView({image:'a_add.png',top:9,right:5}); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); + + var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Subject',left:20,top:55,color:'black'}); + var viewSubjectsViewTitle = Ti.UI.createTextField({value:thisSubject,top:80,height:44,right:12,left:12,color:'black'}); + var viewChaptersTitle = Ti.UI.createLabel({text:'Chapters',left:20,top:130,color:'black'}); + + win.add(a_topbar); + win.add(closeButton); + win.add(addButton); + win.add(navbarShadow); + win.add(viewSubjectsTitle); + win.add(viewSubjectsViewTitle); + win.add(viewChaptersTitle); + + var chaptersTable = Ti.UI.createTableView({top:160,backgroundColor:'white',editable:true}); + + var timer; + var confirmDel = function(rowId,rowName) { + var msgTitle = "Delete Entire Chapter"; + var msgText = "Are you sure you want to delete the '"+rowName+"' chapter?"; + var statusAlert = Titanium.UI.createAlertDialog({title:msgTitle,message:msgText,buttonNames: ['Cancel','Ok']}); + statusAlert.show(); + statusAlert.addEventListener('click',function(e){ + if (e.index == 0){statusAlert.hide();} + if (e.index == 1){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("DELETE FROM chapters WHERE id = ?", rowId); + db.close(); + refresh(); + } + }); + + }; + var tapAndHold = function(e){ + e.addEventListener('touchstart', function(e){ + timer = setTimeout(function() { + confirmDel(e.source.rowId,e.source.rowName); + }, 500); + }); + e.addEventListener('touchend', function(e){ + clearTimeout(timer); + }); + }; + + var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId); + var x = 0; + while (rows.isValidRow()){ + var chapterName = rows.fieldByName('chapter'); + var id = rows.fieldByName('id'); + var touchView = Ti.UI.createView({ rowId:id,rowName:chapterName,left:0, top:0, right:0, bottom:0 }); // invisible view to capture touch + var row = Ti.UI.createTableViewRow({backgroundColor:'white',chapterId:id,chapterName:chapterName,hasChild:true}); + var label = Ti.UI.createLabel({text:chapterName, left:10,height:20,color:'black'}); + row.add(touchView); + row.add(label); + tapAndHold(touchView); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + chaptersTable.data=data; + }; + refresh(); + win.add(chaptersTable); + var window; + addButton.addEventListener('click',function(){ + viewSubjectsViewTitle.blur(); + window = addChaptersWindow(subjectId); + window.open(); + window.addEventListener('close',function(){ + refresh(); + }); + }); + chaptersTable.addEventListener('click',function(e){ + viewSubjectsViewTitle.blur(); + window = addFlashcards(e.rowData.chapterName,e.rowData.chapterId); + window.open(); + window.addEventListener('close',function(){ + refresh(); + }); + + }); + closeButton.addEventListener('click',function(){ + viewSubjectsViewTitle.blur(); + if(viewSubjectsViewTitle.value == null){ } else { + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("UPDATE subjects SET subject = '"+viewSubjectsViewTitle.value+"' WHERE id = "+subjectId); + db.close(); + } + win.close(); + }); + return win; +}; \ No newline at end of file diff --git a/Resources/a_addflashcards.js b/Resources/a_addflashcards.js new file mode 100644 index 0000000..18d67af --- /dev/null +++ b/Resources/a_addflashcards.js @@ -0,0 +1,105 @@ +var addFlashcards = function(title,chapterId){ + var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); + + var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); + var a_viewTitle = Ti.UI.createLabel({ text:'Add Flashcards',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + a_topbar.add(a_viewTitle); + var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); + var addButton = Ti.UI.createImageView({image:'a_add.png',top:9,right:5}); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); + + var viewSubjectsTitle = Ti.UI.createLabel({text:'Chapter',left:20,top:55,color:'black'}); + var viewSubjectsViewTitle = Ti.UI.createTextField({value:title,top:80,height:44,right:12,left:12,color:'black'}); + var viewChaptersTitle = Ti.UI.createLabel({text:'Flashcards',left:20,top:130,color:'black'}); + + win.add(a_topbar); + win.add(closeButton); + win.add(addButton); + win.add(navbarShadow); + win.add(viewSubjectsTitle); + win.add(viewSubjectsViewTitle); + win.add(viewChaptersTitle); + + var chaptersTable = Ti.UI.createTableView({top:160,backgroundColor:'white',editable:true}); + var timer; + var confirmDel = function(rowId,rowName) { + var msgTitle = "Delete Flashcard"; + var msgText = "Are you sure you want to delete the '"+rowName+"' flashcard?"; + var statusAlert = Titanium.UI.createAlertDialog({title:msgTitle,message:msgText,buttonNames: ['Cancel','Ok']}); + statusAlert.show(); + statusAlert.addEventListener('click',function(e){ + if (e.index == 0){statusAlert.hide();} + if (e.index == 1){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("DELETE FROM flashcards WHERE id = ?", rowId); + db.close(); + refresh(); + } + }); + + }; + var tapAndHold = function(e){ + e.addEventListener('touchstart', function(e){ + timer = setTimeout(function() { + confirmDel(e.source.rowId,e.source.rowName); + }, 500); + }); + e.addEventListener('touchend', function(e){ + clearTimeout(timer); + }); + }; + + var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM flashcards WHERE chapter = '"+chapterId+"' ORDER BY id"); + var x = 0; + while (rows.isValidRow()){ + var flashName = rows.fieldByName('name'); + var id = rows.fieldByName('id'); + var touchView = Ti.UI.createView({ rowId:id,rowName:flashName,left:0, top:0, right:0, bottom:0 }); // invisible view to capture touch + var row = Ti.UI.createTableViewRow({backgroundColor:'white',flashId:id,flashName:flashName,hasChild:true}); + var label = Ti.UI.createLabel({text:flashName, left:10,color:'black'}); + row.add(touchView); + row.add(label); + tapAndHold(touchView); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + chaptersTable.data=data; + }; + refresh(); + win.add(chaptersTable); + var window; + + addButton.addEventListener('click',function(e){ + window = addFlashCardWindow('null',chapterId); + window.open(); + window.addEventListener('close',function(){ + refresh(); + }); + }); + + chaptersTable.addEventListener('click',function(e){ + window = addFlashCardWindow(e.rowData.flashId,'null'); + window.open(); + window.addEventListener('close',function(){ + refresh(); + }); + }); + + closeButton.addEventListener('click',function(){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("UPDATE chapters SET chapter = '"+viewSubjectsViewTitle.value+"' WHERE id = "+chapterId); + db.close(); + viewSubjectsViewTitle.blur(); + win.close(); + }); + viewSubjectsViewTitle.addEventListener('return',function(){ + viewSubjectsViewTitle.blur(); + }); + + return win; +}; \ No newline at end of file diff --git a/Resources/a_addnewchapter.js b/Resources/a_addnewchapter.js new file mode 100644 index 0000000..be06820 --- /dev/null +++ b/Resources/a_addnewchapter.js @@ -0,0 +1,30 @@ +var addChaptersWindow = function(subjectId){ + var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); + + var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); + var a_viewTitle = Ti.UI.createLabel({ text:'Add New Chapter',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + a_topbar.add(a_viewTitle); + var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); + + var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Chapter',left:20,top:55,color:'black'}); + var viewSubjectsViewTitle = Ti.UI.createTextField({top:80,height:44,right:12,left:12,color:'black'}); + + + win.add(a_topbar); + win.add(viewSubjectsTitle); + win.add(viewSubjectsViewTitle); + win.add(closeButton); + win.add(navbarShadow); + viewSubjectsViewTitle.focus(); + closeButton.addEventListener('click',function(){ + if(viewSubjectsViewTitle.value == null){ } else { + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("INSERT INTO chapters (chapter,subject) VALUES (?,?)",viewSubjectsViewTitle.value,subjectId); + db.close(); + } + viewSubjectsViewTitle.blur(); + win.close(); + }); + return win; +}; \ No newline at end of file diff --git a/Resources/a_addnewflashcard.js b/Resources/a_addnewflashcard.js new file mode 100644 index 0000000..a49f860 --- /dev/null +++ b/Resources/a_addnewflashcard.js @@ -0,0 +1,63 @@ +var addFlashCardWindow = function(flashId,chapterId){ + + var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); + + var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); + var a_viewTitle = Ti.UI.createLabel({ text:'Flashcard',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + a_topbar.add(a_viewTitle); + var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); + var saveButton = Ti.UI.createImageView({image:'a_save.png',top:9,right:5}); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); + + var viewFlashTitle = Ti.UI.createLabel({text:'Name',left:20,top:55,color:'black'}); + var viewFlashTitleField = Ti.UI.createTextField({top:80,height:44,right:12,left:12,color:'black'}); + var viewFlashDescription = Ti.UI.createLabel({text:'Description',left:20,top:130,color:'black'}); + var viewFlashDescriptionField = Ti.UI.createTextArea({top:160,height:100,right:12,left:12,color:'black'}); + + win.add(a_topbar); + win.add(closeButton); + win.add(saveButton); + win.add(viewFlashTitle); + win.add(viewFlashTitleField); + win.add(viewFlashDescription); + win.add(viewFlashDescriptionField); + win.add(navbarShadow); + + + saveButton.addEventListener('click',function(){ + viewFlashTitleField.blur(); + viewFlashDescriptionField.blur(); + if (flashId == 'null'){ + var db1 = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db1.execute("INSERT INTO flashcards (name,description,chapter) VALUES (?,?,?)",viewFlashTitleField.value,viewFlashDescriptionField.value,chapterId); + db1.close(); + win.close(); + } else { + var db2 = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db2.execute("UPDATE flashcards set name = '"+viewFlashTitleField.value+"', description = '"+viewFlashDescriptionField.value+"' WHERE id ="+flashId); + db2.close(); + win.close(); + } + }); + + closeButton.addEventListener('click',function(){ + viewFlashTitleField.blur(); + viewFlashDescriptionField.blur(); + win.close(); + }); + + + if (flashId != 'null'){ + + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var subjectName = db.execute("SELECT * FROM flashcards WHERE id = ?",flashId); + var thisName = subjectName.fieldByName('name'); + var thisDescription = subjectName.fieldByName('description'); + viewFlashTitleField.value = thisName; + viewFlashDescriptionField.value = thisDescription; + subjectName.close(); + db.close(); + } + + return win; +}; \ No newline at end of file diff --git a/Resources/a_addsubjects.js b/Resources/a_addsubjects.js new file mode 100644 index 0000000..2077c33 --- /dev/null +++ b/Resources/a_addsubjects.js @@ -0,0 +1,31 @@ +var addSubjectsWindow = function(subjectId){ + var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); + + var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); + var a_viewTitle = Ti.UI.createLabel({ text:'Add New Subject',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + a_topbar.add(a_viewTitle); + var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5}); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); + + var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Subject',left:20,top:55,color:'black'}); + var viewSubjectsViewTitle = Ti.UI.createTextField({top:80,height:44,right:12,left:12,color:'black'}); + + + win.add(a_topbar); + win.add(viewSubjectsTitle); + win.add(viewSubjectsViewTitle); + win.add(closeButton); + win.add(navbarShadow); + viewSubjectsViewTitle.focus(); + closeButton.addEventListener('click',function(){ + viewSubjectsViewTitle.blur(); + if(viewSubjectsViewTitle.value == null){ } else { + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("INSERT INTO subjects (subject) VALUES (?)",viewSubjectsViewTitle.value); + db.close(); + } + win.close(); + }); + + return win; +}; \ No newline at end of file diff --git a/Resources/a_bottombar.png b/Resources/a_bottombar.png new file mode 100644 index 0000000..b3bd82f Binary files /dev/null and b/Resources/a_bottombar.png differ diff --git a/Resources/a_byname.png b/Resources/a_byname.png new file mode 100644 index 0000000..215ad65 Binary files /dev/null and b/Resources/a_byname.png differ diff --git a/Resources/a_chaps.png b/Resources/a_chaps.png new file mode 100644 index 0000000..3fb16f0 Binary files /dev/null and b/Resources/a_chaps.png differ diff --git a/Resources/a_close.png b/Resources/a_close.png new file mode 100644 index 0000000..981bb06 Binary files /dev/null and b/Resources/a_close.png differ diff --git a/Resources/a_editlist.js b/Resources/a_editlist.js new file mode 100644 index 0000000..10489a0 --- /dev/null +++ b/Resources/a_editlist.js @@ -0,0 +1,86 @@ +var a_editList = function(){ + + var a_view = Ti.UI.createView({bottom:48}); + var a_viewListTopbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); + var a_viewTitle = Ti.UI.createLabel({ text:'Edit Subjects',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + var a_viewListTable = Ti.UI.createTableView({backgroundColor:'white',top:44}); + var addButton = Ti.UI.createImageView({image:'a_add.png',top:9,right:5}); + a_viewListTopbar.add(a_viewTitle); + a_view.add(a_viewListTopbar); + a_view.add(a_viewListTable); + a_view.add(addButton); + + var timer; + var confirmDel = function(rowId,rowName) { + var msgTitle = "Delete Entire Subject"; + var msgText = "Are you sure you want to delete the '"+rowName+"' subject?"; + var statusAlert = Titanium.UI.createAlertDialog({title:msgTitle,message:msgText,buttonNames: ['Cancel','Ok']}); + statusAlert.show(); + statusAlert.addEventListener('click',function(e){ + if (e.index == 0){statusAlert.hide();} + if (e.index == 1){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("DELETE FROM subjects WHERE id = ?", rowId); + db.close(); + refresh(); + } + }); + + }; + var tapAndHold = function(e){ + e.addEventListener('touchstart', function(e){ + timer = setTimeout(function() { + confirmDel(e.source.rowId,e.source.rowName); + }, 500); + }); + e.addEventListener('touchend', function(e){ + clearTimeout(timer); + }); + }; + + var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM subjects ORDER BY subject"); + var x = 0; + while (rows.isValidRow()){ + var subjectName = rows.fieldByName('subject'); + var id = rows.fieldByName('id'); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',subjectId:id,subjectName:subjectName,hasChild:true}); + var touchView = Ti.UI.createView({ rowId:id,rowName:subjectName,left:0, top:0, right:0, bottom:0 }); // invisible view to capture touch + var label = Ti.UI.createLabel({text:subjectName, left:10,color:'black'}); + row.add(label); + row.add(touchView); + tapAndHold(row); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + a_viewListTable.data=data; + }; + refresh(); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); + a_view.add(navbarShadow); + var window; + addButton.addEventListener('click',function(){ + window = addSubjectsWindow(); + window.open(); + window.addEventListener('close',function(){ + refresh(); + }); + + }); + + a_viewListTable.addEventListener('click',function(e){ + window = addChapters(e.rowData.subjectId); + window.open(); + window.addEventListener('close',function(){ + refresh(); + }); + + }); + + + return a_view; +}; diff --git a/Resources/a_random.png b/Resources/a_random.png new file mode 100644 index 0000000..7e1ea62 Binary files /dev/null and b/Resources/a_random.png differ diff --git a/Resources/a_save.png b/Resources/a_save.png new file mode 100644 index 0000000..9eac7ba Binary files /dev/null and b/Resources/a_save.png differ diff --git a/Resources/a_tab1.png b/Resources/a_tab1.png new file mode 100644 index 0000000..202b250 Binary files /dev/null and b/Resources/a_tab1.png differ diff --git a/Resources/a_tab2.png b/Resources/a_tab2.png new file mode 100644 index 0000000..04647ff Binary files /dev/null and b/Resources/a_tab2.png differ diff --git a/Resources/a_viewchapters.js b/Resources/a_viewchapters.js new file mode 100644 index 0000000..4b0d105 --- /dev/null +++ b/Resources/a_viewchapters.js @@ -0,0 +1,63 @@ +var viewChaptertWindow = function(subjectId){ + + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId); + var thisSubject = subjectName.fieldByName('subject'); + subjectName.close(); + db.close(); + + var chapsWin = Ti.UI.createWindow({backgroundColor:'#ccc'}); + + var a_viewListTopbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); + var a_viewTitle = Ti.UI.createLabel({ text:'Chapters',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + a_viewListTopbar.add(a_viewTitle); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); + + var backButton = Ti.UI.createImageView({image:'subjects-back.png',top:9,left:5}); + + var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Subject',left:20,top:55,color:'black'}); + var viewSubjectsView = Ti.UI.createView({backgroundColor:'white',left:10,right:10,height:40,top:80,borderColor:'#ababab',borderWidth:1,borderRadius:7}); + var viewSubjectsViewTitle = Ti.UI.createLabel({text:thisSubject,left:12,color:'black'}); + viewSubjectsView.add(viewSubjectsViewTitle); + + var chaptersTitle = Ti.UI.createLabel({text:'Chapters',left:20,top:130,color:'black'}); + + var chaptersTable = Ti.UI.createTableView({top:160,left:10,right:10,height:'auto',borderColor:'#ababab',borderWidth:1,borderRadius:7,backgroundColor:'white'}); + var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId); + var x = 0; + while (rows.isValidRow()){ + var chapterName = rows.fieldByName('chapter'); + var id = rows.fieldByName('id'); + var row = Ti.UI.createTableViewRow({chapterId:id,chapterName:chapterName,hasChild:true}); + var label = Ti.UI.createLabel({text:chapterName, left:10,height:20,color:'black'}); + row.add(label); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + chaptersTable.data=data; + }; + refresh(); + + chaptersTable.addEventListener('click',function(e){ + flashCardsWindow(e.rowData.chapterName,e.rowData.chapterId).open(); + }); + + + chapsWin.add(a_viewListTopbar); + chapsWin.add(backButton); + chapsWin.add(navbarShadow); + chapsWin.add(viewSubjectsTitle); + chapsWin.add(viewSubjectsView); + chapsWin.add(chaptersTitle); + chapsWin.add(chaptersTable); + + backButton.addEventListener('click',function(){ + chapsWin.close(); + }); + return chapsWin; +}; diff --git a/Resources/a_viewflascards.js b/Resources/a_viewflascards.js new file mode 100644 index 0000000..f73ace8 --- /dev/null +++ b/Resources/a_viewflascards.js @@ -0,0 +1,110 @@ +var flashCardsWindow = function(title,chapterId){ + var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); + + var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); + var a_bottombar = Ti.UI.createView({left:0,right:0,bottom:0,height:47,backgroundImage:'a_bottombar.png'}); + var a_viewTitle = Ti.UI.createLabel({ text:'Chapters',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + a_topbar.add(a_viewTitle); + var backButton = Ti.UI.createImageView({image:'a_chaps.png',top:9,left:5}); + var flipButton = Ti.UI.createButton({backgroundImage:'flip.png',top:9,right:5,width:48,height:30}); + var randButton = Ti.UI.createButton({backgroundImage:'a_random.png',bottom:8,left:5,width:99,height:30}); + var nameButton = Ti.UI.createButton({backgroundImage:'a_byname.png',bottom:8,right:5,width:99,height:30}); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); + + var totalViews1 = []; + var totalViews2 = []; + var mainView = Ti.UI.createView({left:5,right:5}); + var scrollView1 = Ti.UI.createScrollableView({top:49,bottom:54,left:10,right:10}); + var scrollView2 = Ti.UI.createScrollableView({top:49,bottom:54,left:10,right:10}); + var dubleTapping = function(e){ + e.addEventListener('doubletap',function(){ + flip(); + }); + }; + var refresh = function(order){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var flashcardsName; + if (order == 'random'){ + flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY RANDOM()",chapterId); + } else if (order == 'name'){ + flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY name",chapterId); + } else { + flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ?",chapterId); + } + + var x = 0; + while (flashcardsName.isValidRow()){ + var flashName = flashcardsName.fieldByName('name'); + var flashDescription = flashcardsName.fieldByName('description'); + var id = flashcardsName.fieldByName('id'); + + var flashNumber1 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right',color:'black'}); + var flashView1 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',page:1,borderColor:'#999',borderRadius:5}); + var flashTitle1 = Ti.UI.createLabel({text:flashName,textAlign:'center',color:'black',font:{fontWeight:'bold',fontSize:20}}); + flashView1.add(flashNumber1); + flashView1.add(flashTitle1); + dubleTapping(flashView1); + var flashNumber2 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right',color:'black'}); + var flashView2 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',backgroundImage:'flashcard.png',page:2,borderColor:'#999',borderRadius:5}); + var flashTitle2 = Ti.UI.createLabel({text:flashDescription,textAlign:'left',left:20,right:20,font:{fontWeight:'bold',fontSize:16},color:'black'}); + flashView2.add(flashNumber2); + flashView2.add(flashTitle2); + dubleTapping(flashView2); + + totalViews1[x] = flashView1; + totalViews2[x++] = flashView2; + flashcardsName.next(); + }; + flashcardsName.close(); + db.close(); + scrollView1.views = totalViews1; + scrollView2.views = totalViews2; + }; + refresh(); + win.add(a_topbar); + win.add(a_bottombar); + win.add(navbarShadow); + + win.add(scrollView1); + win.add(backButton); + win.add(randButton); + win.add(nameButton); + win.add(flipButton); + + var pageDisplay = 1; + var flip = function(){ + switch (pageDisplay){ + case 1: + scrollView2.currentPage = scrollView1.currentPage; + win.remove(scrollView1); + win.add(scrollView2); + pageDisplay = 2; + break; + case 2: + scrollView1.currentPage = scrollView2.currentPage; + win.remove(scrollView2); + win.add(scrollView1); + pageDisplay = 1; + break; + } + }; + + + flipButton.addEventListener('click',function(){ + flip(); + }); + + randButton.addEventListener('click',function(){ + refresh('random'); + }); + + nameButton.addEventListener('click',function(){ + refresh('name'); + }); + + backButton.addEventListener('click',function(){ + win.close(); + }); + + return win; +}; \ No newline at end of file diff --git a/Resources/a_viewlist.js b/Resources/a_viewlist.js new file mode 100644 index 0000000..03788e1 --- /dev/null +++ b/Resources/a_viewlist.js @@ -0,0 +1,36 @@ +var a_viewList = function(){ + + var a_view = Ti.UI.createView({bottom:48}); + var a_viewListTopbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'}); + var a_viewTitle = Ti.UI.createLabel({ text:'Subjects',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + var a_viewListTable = Ti.UI.createTableView({backgroundColor:'white',top:44}); + a_viewListTopbar.add(a_viewTitle); + a_view.add(a_viewListTopbar); + a_view.add(a_viewListTable); + var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM subjects ORDER BY subject"); + var x = 0; + while (rows.isValidRow()){ + var subjectName = rows.fieldByName('subject'); + var id = rows.fieldByName('id'); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',subjectId:id,subjectName:subjectName,hasChild:true}); + var label = Ti.UI.createLabel({text:subjectName, left:10,color:'black'}); + row.add(label); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + a_viewListTable.data=data; + }; + refresh(); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44}); + a_view.add(navbarShadow); + a_viewListTable.addEventListener('click',function(e){ + viewChaptertWindow(e.rowData.subjectId).open(); + }); + + return a_view; +}; diff --git a/Resources/addchapter.js b/Resources/addchapter.js new file mode 100644 index 0000000..1eea758 --- /dev/null +++ b/Resources/addchapter.js @@ -0,0 +1,106 @@ +var addChaptertWindow = function(subjectId){ + + var win = Ti.UI.createWindow({color:'#61290C',title:'Add Chapters',barImage:'navbarbg.png',barColor:'#D0A159'}); + var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + win.titleControl = customhead; + + win.hideTabBar(); + + + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId); + var thisSubject = subjectName.fieldByName('subject'); + subjectName.close(); + db.close(); + + + var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false}); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Name of Subject'}); + var label = Ti.UI.createTextField({left:10,right:10,value:thisSubject}); + var data = []; + row.add(label); + data[0] = row; + addSubjectsView.data = data; + + var chaptersTable = Ti.UI.createTableView({top:90,style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',editable:true}); + + var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId); + var x = 0; + while (rows.isValidRow()){ + var chapterName = rows.fieldByName('chapter'); + var id = rows.fieldByName('id'); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',chapterId:id,chapterName:chapterName,hasChild:true}); + if (x == 0){ row.header='Chapters';} + var label = Ti.UI.createLabel({text:chapterName, left:10,height:20}); + row.add(label); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + row = Ti.UI.createTableViewRow({backgroundColor:'white',chapterName:'addChapter',header:''}); + label = Ti.UI.createLabel({text:'Add Chapter',textAlign:'center'}); + row.add(label); + data[data.length] = row; + chaptersTable.data=data; + }; + chaptersTable.addEventListener('click',function(e){ + var window; + if (e.rowData.chapterName == 'addChapter'){ + window = addNewChapterWindow(); + window.open({modal:true}); + window.addEventListener('close',function(){ + Ti.UI.currentTab.close(window); + if(window.addChapter=='true'){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("INSERT INTO chapters (chapter,subject) VALUES (?,?)",window.chapterValue,subjectId); + db.close(); + refresh(); + } + }); + + + } + if (e.rowData.hasChild){ + var thisId = e.rowData.chapterId; + window = flashCardsWindow(e.rowData.chapterName,thisId); + Ti.UI.currentTab.open(window); + window.addEventListener('close',function(){ + Ti.UI.currentTab.close(window); + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("UPDATE chapters SET chapter = '"+window.title+"' WHERE id = "+thisId); + db.close(); + refresh(); + }); + } + }); + + win.nameOfSubject=label.value; + + label.addEventListener('change',function(){ + win.nameOfSubject=label.value; + win.title=label.value; + }); + + chaptersTable.addEventListener('delete',function(e){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("DELETE FROM chapters WHERE id = ?", e.rowData.chapterId); + db.close(); + + }); + + + refresh(); + + win.add(addSubjectsView); + win.add(chaptersTable); + + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0}); + win.add(navbarShadow); + win.orientationModes = [Titanium.UI.PORTRAIT]; + + return win; +}; diff --git a/Resources/addflashcard-old.js b/Resources/addflashcard-old.js new file mode 100644 index 0000000..6230511 --- /dev/null +++ b/Resources/addflashcard-old.js @@ -0,0 +1,55 @@ +var addFlashCardWindow = function(flashId,chapterId){ + var win = Ti.UI.createWindow({color:'#61290C',title:'Add New Chapter',barImage:'navbarbg.png',barColor:'#D0A159',backgroundColor:'#ccc'}); + var closeButton = Ti.UI.createButton({title:'cancel'}); + var saveButton = Ti.UI.createButton({title:'save'}); + win.leftNavButton=closeButton; + win.rightNavButton=saveButton; + var addName = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',top:0,height:90}); + + var data = []; + var row = Ti.UI.createTableViewRow({header:'Name',backgroundColor:'white'}); + var label = Ti.UI.createTextField({left:10,right:10,hintText:'Name'}); + row.add(label); + data[0] = row; + var contentLabel=Ti.UI.createLabel({text:'Defenition', height:30,textAlign:'left',top:90,width:300,left:20,color:'#4c566c',shadowColor:'white',shadowOffset:{x:0,y:1},font:{fontFamily:'Arial-BoldMT',fontSize:17}}); + var label2 = Ti.UI.createTextArea({top:120,width:320,height:100,hintText:'Description',backgroundColor:'white',suppressReturn:false}); + + addName.data = data; + win.add(addName); + win.add(label2); + win.add(contentLabel); + + saveButton.addEventListener('click',function(){ + if (flashId == 'null'){ + var db1 = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db1.execute("INSERT INTO flashcards (name,description,chapter) VALUES (?,?,?)",label1.value,label2.value,chapterId); + db1.close(); + win.close(); + } else { + var db2 = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db2.execute("UPDATE flashcards set name = '"+label1.value+"', description = '"+label2.value+"' WHERE id ="+flashId); + db2.close(); + win.close(); + } + }); + + closeButton.addEventListener('click',function(){ + win.close(); + }); + + + if (flashId != 'null'){ + + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var subjectName = db.execute("SELECT * FROM flashcards WHERE id = ?",flashId); + var thisName = subjectName.fieldByName('name'); + var thisDescription = subjectName.fieldByName('description'); + label1.value = thisName; + label2.value = thisDescription; + subjectName.close(); + db.close(); + } + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0}); + win.add(navbarShadow); + return win; +}; \ No newline at end of file diff --git a/Resources/addflashcard.js b/Resources/addflashcard.js new file mode 100644 index 0000000..2c8f3af --- /dev/null +++ b/Resources/addflashcard.js @@ -0,0 +1,86 @@ +var addFlashCardWindow = function(flashId,chapterId){ + var win = Ti.UI.createWindow({color:'#61290C',title:'Add New Flash Card',barImage:'navbarbg.png',barColor:'#D0A159'}); + + var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:18}}); + win.titleControl = customhead; + + var closeButton = Ti.UI.createButton({title:'cancel'}); + var saveButton = Ti.UI.createButton({title:'save'}); + var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc'}); + win.leftNavButton=closeButton; + win.rightNavButton=saveButton; + + var data = []; + var row1 = Ti.UI.createTableViewRow({header:'Name',backgroundColor:'white'}); + var label1 = Ti.UI.createTextField({left:10,right:10,hintText:'Name'}); + row1.add(label1); + data[0] = row1; + + var row2 = Ti.UI.createTableViewRow({header:'Description',height:100,backgroundColor:'white'}); + var label2 = Ti.UI.createTextArea({left:10,bottom:10,top:10,right:10,font:{fontSize:15},backgroundColor:'white',suppressReturn:false}); + row2.add(label2); + data[1] = row2; + + // this still needs to be fixed + var row3 = Ti.UI.createTableViewRow({header:'',height:80,backgroundImage:''}); + data[2] = row3; + // --------------------------- + + addSubjectsView.data = data; + win.add(addSubjectsView); + + saveButton.addEventListener('click',function(){ + if (flashId == 'null'){ + var db1 = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db1.execute("INSERT INTO flashcards (name,description,chapter) VALUES (?,?,?)",label1.value,label2.value,chapterId); + db1.close(); + win.close(); + } else { + var db2 = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db2.execute("UPDATE flashcards set name = '"+label1.value+"', description = '"+label2.value+"' WHERE id ="+flashId); + db2.close(); + win.close(); + } + }); + + closeButton.addEventListener('click',function(){ + win.close(); + }); + + + if (flashId != 'null'){ + + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var subjectName = db.execute("SELECT * FROM flashcards WHERE id = ?",flashId); + var thisName = subjectName.fieldByName('name'); + var thisDescription = subjectName.fieldByName('description'); + label1.value = thisName; + label2.value = thisDescription; + subjectName.close(); + db.close(); + } + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:'480', height:11,top:0}); + win.add(navbarShadow); + win.orientationModes = [ + Titanium.UI.PORTRAIT, + Titanium.UI.LANDSCAPE_LEFT, + Titanium.UI.LANDSCAPE_RIGHT + ]; + if (Ti.UI.orientation == 3 || Ti.UI.orientation == 4){ + win.barImage='navbarbg-landscape.png'; + } + if (Ti.UI.orientation == 1 || Ti.UI.orientation == 2){ + win.barImage='navbarbg.png'; + } + + Ti.Gesture.addEventListener('orientationchange', function(e){ + if (e.orientation == 3 || e.orientation == 4){ + win.barImage='navbarbg-landscape.png'; + } + if (e.orientation == 1 || e.orientation == 2){ + win.barImage='navbarbg.png'; + } + }); + + return win; +}; \ No newline at end of file diff --git a/Resources/addnewchapter.js b/Resources/addnewchapter.js new file mode 100644 index 0000000..0bef892 --- /dev/null +++ b/Resources/addnewchapter.js @@ -0,0 +1,35 @@ +var addNewChapterWindow = function(){ + var win = Ti.UI.createWindow({color:'#61290C',title:'Add New Chapter', url:'addnewchapter.js',barImage:'navbarbg.png',barColor:'#D0A159'}); + var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + win.titleControl = customhead; + + var closeButton = Ti.UI.createButton({title:'cancel'}); + var saveButton = Ti.UI.createButton({title:'save'}); + win.leftNavButton=closeButton; + win.rightNavButton=saveButton; + var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false}); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Name of Chapter'}); + var label = Ti.UI.createTextField({left:10,right:10,hintText:'Subject'}); + var data = []; + row.add(label); + data[0] = row; + addSubjectsView.data = data; + win.add(addSubjectsView); + label.focus(); + + closeButton.addEventListener('click', function(){ + win.close(); + }); + saveButton.addEventListener('click', function(){ + if (label.value){ + win.addChapter='true'; + } + win.chapterValue=label.value; + win.close(); + }); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0}); + win.add(navbarShadow); + win.orientationModes = [Titanium.UI.PORTRAIT]; + + return win; +}; \ No newline at end of file diff --git a/Resources/addsubject.js b/Resources/addsubject.js new file mode 100644 index 0000000..8d36c50 --- /dev/null +++ b/Resources/addsubject.js @@ -0,0 +1,36 @@ +var addSubjectWindow = function(){ + var win = Ti.UI.createWindow({color:'#61290C',title:'Add New Subject'}); + var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + win.titleControl = customhead; + + win.barImage='navbarbg.png'; + win.barColor='#D0A159'; + win.hideTabBar(); + + var closeButton = Ti.UI.createButton({title:'close'}); + win.leftNavButton=closeButton; + + var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false}); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Name of Subject'}); + var label = Ti.UI.createTextField({left:10,right:10,hintText:'Subject'}); + var data = []; + row.add(label); + data[0] = row; + addSubjectsView.data = data; + win.add(addSubjectsView); + //label.focus(); + + label.addEventListener('change', function(){ + win.nameOfSubject=label.value; + }); + + closeButton.addEventListener('click',function(){ + win.close(); + }); + + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0}); + win.add(navbarShadow); + win.orientationModes = [Titanium.UI.PORTRAIT]; + + return win; +}; \ No newline at end of file diff --git a/Resources/android/.DS_Store b/Resources/android/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Resources/android/.DS_Store differ diff --git a/Resources/android/appicon.png b/Resources/android/appicon.png new file mode 100644 index 0000000..ea8e53d Binary files /dev/null and b/Resources/android/appicon.png differ diff --git a/Resources/android/default.png b/Resources/android/default.png new file mode 100644 index 0000000..989ba4a Binary files /dev/null and b/Resources/android/default.png differ diff --git a/Resources/app.js b/Resources/app.js new file mode 100644 index 0000000..f257578 --- /dev/null +++ b/Resources/app.js @@ -0,0 +1,89 @@ + +Titanium.UI.setBackgroundColor('#000'); +if (Ti.Platform.name != 'android'){ + var tabGroup = Titanium.UI.createTabGroup(); + + var win1 = Titanium.UI.createWindow({color:'#61290C', url:'viewlist.js',title:'Subjects',barImage:'navbarbg.png',barColor:'#D0A159' }); + var tab1 = Titanium.UI.createTab({ + icon:'icon1.png', + title:'Study', + window:win1 + }); + + var win2 = Titanium.UI.createWindow({color:'#61290C', url:'editlist.js',title:'Subjects',barImage:'navbarbg.png',barColor:'#D0A159' }); + var tab2 = Titanium.UI.createTab({ + icon:'icon2.png', + title:'Edit Subjects', + window:win2 + }); + + tabGroup.addTab(tab1); + tabGroup.addTab(tab2); + + + tabGroup.open(); +} +else { + + Ti.include('a_viewlist.js'); + Ti.include('a_editlist.js'); + Ti.include('a_viewchapters.js'); + Ti.include('a_viewflascards.js'); + Ti.include('a_addsubjects.js'); + Ti.include('a_addchapters.js'); + Ti.include('a_addnewchapter.js'); + Ti.include('a_addflashcards.js'); + Ti.include('extras.js'); + Ti.include('a_addnewflashcard.js'); + + + var a_mainWindow = Ti.UI.createWindow({backgroundColor:'white'}); + var a_bottomTabs = Ti.UI.createView({left:0, right:0, height:48, bottom:0, backgroundImage:'a_tab2.png' }); + var a_bottomTab1 = Ti.UI.createView({left:20, width:120, height:48, bottom:0, backgroundImage:'a_tab1.png' }); + var a_bottomTab2 = Ti.UI.createView({right:20, width:120, height:48, bottom:0 }); + + var a_bottomTab1Image = Ti.UI.createImageView({image:'icon1s.png',bottom:18}); + var a_bottomTab2Image = Ti.UI.createImageView({image:'icon2.png',bottom:18}); + + + var a_bottomTab1Text = Ti.UI.createLabel({text:'Study',bottom:0,color:'white'}); + var a_bottomTab2Text = Ti.UI.createLabel({text:'Edit Subjects',bottom:0,color:'white'}); + + a_bottomTab1.add(a_bottomTab1Text); + a_bottomTab2.add(a_bottomTab2Text); + + a_bottomTab1.add(a_bottomTab1Image); + a_bottomTab2.add(a_bottomTab2Image); + + a_mainWindow.add(a_viewList()); + a_bottomTabs.add(a_bottomTab1); + a_bottomTabs.add(a_bottomTab2); + a_mainWindow.add(a_bottomTabs); + + a_mainWindow.open(); +// var width = (a_mainWindow.size.width/2); + + a_bottomTab1.addEventListener('click',function(){ + a_bottomTab1.backgroundImage='a_tab1.png'; + a_bottomTab2.backgroundImage=null; + a_bottomTab1Image.image='icon1s.png'; + a_bottomTab2Image.image='icon2.png'; + a_bottomTab1Text.color='white'; + a_bottomTab2Text.color='#999'; + a_mainWindow.remove(a_editList()); + a_mainWindow.add(a_viewList()); + }); + a_bottomTab2.addEventListener('click',function(){ + a_bottomTab2.backgroundImage='a_tab1.png'; + a_bottomTab1.backgroundImage=null; + a_bottomTab1Image.image='icon1.png'; + a_bottomTab2Image.image='icon2s.png'; + a_bottomTab1Text.color='#999'; + a_bottomTab2Text.color='white'; + a_mainWindow.remove(a_viewList()); + a_mainWindow.add(a_editList()); + }); + a_mainWindow.addEventListener('focus',function(){ + alert(a_mainWindow.toImage().width); + }); +} diff --git a/Resources/appicon.png b/Resources/appicon.png new file mode 100644 index 0000000..ea8e53d Binary files /dev/null and b/Resources/appicon.png differ diff --git a/Resources/default.png b/Resources/default.png new file mode 100644 index 0000000..989ba4a Binary files /dev/null and b/Resources/default.png differ diff --git a/Resources/edit_layout.psd b/Resources/edit_layout.psd new file mode 100644 index 0000000..16cb4fd Binary files /dev/null and b/Resources/edit_layout.psd differ diff --git a/Resources/editlist.js b/Resources/editlist.js new file mode 100644 index 0000000..0bc95ec --- /dev/null +++ b/Resources/editlist.js @@ -0,0 +1,76 @@ +Ti.include('addchapter.js'); +Ti.include('addnewchapter.js'); +Ti.include('flashcardsedit.js'); +Ti.include('addflashcard.js'); +Ti.include('addsubject.js'); + +var win = Titanium.UI.currentWindow; +var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); +win.titleControl = customhead; +var addSubject = Ti.UI.createButton({title:'Add'}); +var listOfSubjects = Ti.UI.createTableView({editable:true}); +win.rightNavButton = addSubject; +win.add(listOfSubjects); +var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0}); +win.add(navbarShadow); + + +var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM subjects ORDER BY subject"); + var x = 0; + while (rows.isValidRow()){ + var subjectName = rows.fieldByName('subject'); + var id = rows.fieldByName('id'); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',subjectId:id,subjectName:subjectName}); + var label = Ti.UI.createLabel({text:subjectName, left:10}); + row.add(label); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + listOfSubjects.data=data; +}; + +refresh(); + + +addSubject.addEventListener('click', function(){ + + var window = addSubjectWindow(); + window.open({modal:true}); + window.addEventListener('close',function(){ + Ti.UI.currentTab.close(window); + if(window.nameOfSubject == null){ } else { + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("INSERT INTO subjects (subject) VALUES (?)",window.nameOfSubject); + db.close(); + refresh(); + } + }); + +}); + +listOfSubjects.addEventListener('delete',function(e){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("DELETE FROM subjects WHERE id = ?", e.rowData.subjectId); + db.close(); +}); +listOfSubjects.addEventListener('click',function(e){ + + + var window = addChaptertWindow(e.rowData.subjectId); + Ti.UI.currentTab.open(window); + + window.addEventListener('close',function(){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("UPDATE subjects SET subject = '"+window.nameOfSubject+"' WHERE id = "+e.rowData.subjectId); + db.close(); + refresh(); + }); + + +}); +win.orientationModes = [Titanium.UI.PORTRAIT]; diff --git a/Resources/extras.js b/Resources/extras.js new file mode 100644 index 0000000..e69de29 diff --git a/Resources/flashcard.png b/Resources/flashcard.png new file mode 100644 index 0000000..d0073ca Binary files /dev/null and b/Resources/flashcard.png differ diff --git a/Resources/flashcards.sqlite b/Resources/flashcards.sqlite new file mode 100644 index 0000000..eb61768 Binary files /dev/null and b/Resources/flashcards.sqlite differ diff --git a/Resources/flashcardsedit.js b/Resources/flashcardsedit.js new file mode 100644 index 0000000..c333ae5 --- /dev/null +++ b/Resources/flashcardsedit.js @@ -0,0 +1,79 @@ +var flashCardsWindow = function(title,chapterId){ + + var win = Ti.UI.createWindow({color:'#61290C',title:title ,chapterId:chapterId,barImage:'navbarbg.png',barColor:'#D0A159'}); + var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + win.titleControl = customhead; + + var addButton = Ti.UI.createButton({title:'add'}); + win.rightNavButton=addButton; + + var chapterView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false}); + var row1 = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Chapter'}); + var label1 = Ti.UI.createTextField({left:10,right:10,value:win.title}); + var data = []; + row1.add(label1); + data[0] = row1; + chapterView.data = data; + + + var flashCardsTable = Ti.UI.createTableView({top:90,editable:true}); + + var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM flashcards WHERE chapter = '"+chapterId+"' ORDER BY id"); + var x = 0; + while (rows.isValidRow()){ + var flashName = rows.fieldByName('name'); + var id = rows.fieldByName('id'); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',flashId:id,flashName:flashName,hasChild:true}); + var label = Ti.UI.createLabel({text:flashName, left:10}); + row.add(label); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + flashCardsTable.data=data; + }; + refresh(); + + win.add(chapterView); + win.add(flashCardsTable); + + addButton.addEventListener('click',function(e){ + var window = addFlashCardWindow('null',chapterId); + Ti.UI.currentTab.open(window); + window.addEventListener('close',function(){ + Ti.UI.currentTab.close(window); + refresh(); + }); + }); + + label1.addEventListener('change', function(){ + win.title=label1.value; + }); + + + flashCardsTable.addEventListener('click',function(e){ + var window = addFlashCardWindow(e.rowData.flashId,'null'); + Ti.UI.currentTab.open(window); + window.addEventListener('close',function(){ + Ti.UI.currentTab.close(window); + refresh(); + }); + }); + + + flashCardsTable.addEventListener('delete',function(e){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + db.execute("DELETE FROM flashcards WHERE id = ?", e.rowData.flashId); + db.close(); + + }); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0}); + win.add(navbarShadow); + win.orientationModes = [Titanium.UI.PORTRAIT]; + return win; + +}; diff --git a/Resources/flip.png b/Resources/flip.png new file mode 100644 index 0000000..0533a7c Binary files /dev/null and b/Resources/flip.png differ diff --git a/Resources/flip1.png b/Resources/flip1.png new file mode 100644 index 0000000..f9a3c6d Binary files /dev/null and b/Resources/flip1.png differ diff --git a/Resources/flip2.png b/Resources/flip2.png new file mode 100644 index 0000000..652ee80 Binary files /dev/null and b/Resources/flip2.png differ diff --git a/Resources/icon1.png b/Resources/icon1.png new file mode 100755 index 0000000..86dc9c4 Binary files /dev/null and b/Resources/icon1.png differ diff --git a/Resources/icon1s.png b/Resources/icon1s.png new file mode 100644 index 0000000..7150ea8 Binary files /dev/null and b/Resources/icon1s.png differ diff --git a/Resources/icon2.png b/Resources/icon2.png new file mode 100644 index 0000000..40f82cf Binary files /dev/null and b/Resources/icon2.png differ diff --git a/Resources/icon2s.png b/Resources/icon2s.png new file mode 100644 index 0000000..6028ffa Binary files /dev/null and b/Resources/icon2s.png differ diff --git a/Resources/iphone/.DS_Store b/Resources/iphone/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Resources/iphone/.DS_Store differ diff --git a/Resources/iphone/Default.png b/Resources/iphone/Default.png new file mode 100644 index 0000000..989ba4a Binary files /dev/null and b/Resources/iphone/Default.png differ diff --git a/Resources/iphone/appicon.png b/Resources/iphone/appicon.png new file mode 100644 index 0000000..c8d456f Binary files /dev/null and b/Resources/iphone/appicon.png differ diff --git a/Resources/iphone/default_app_logo.png b/Resources/iphone/default_app_logo.png new file mode 100644 index 0000000..5f344ba Binary files /dev/null and b/Resources/iphone/default_app_logo.png differ diff --git a/Resources/nav-bar-shadow.png b/Resources/nav-bar-shadow.png new file mode 100644 index 0000000..c1e0880 Binary files /dev/null and b/Resources/nav-bar-shadow.png differ diff --git a/Resources/[email protected] b/Resources/[email protected] new file mode 100644 index 0000000..6639981 Binary files /dev/null and b/Resources/[email protected] differ diff --git a/Resources/nav-button-press.png b/Resources/nav-button-press.png new file mode 100644 index 0000000..ab582ae Binary files /dev/null and b/Resources/nav-button-press.png differ diff --git a/Resources/[email protected] b/Resources/[email protected] new file mode 100644 index 0000000..ddd68b6 Binary files /dev/null and b/Resources/[email protected] differ diff --git a/Resources/navbarbg-landscape.png b/Resources/navbarbg-landscape.png new file mode 100755 index 0000000..b49d9da Binary files /dev/null and b/Resources/navbarbg-landscape.png differ diff --git a/Resources/[email protected] b/Resources/[email protected] new file mode 100755 index 0000000..9d063f4 Binary files /dev/null and b/Resources/[email protected] differ diff --git a/Resources/navbarbg.png b/Resources/navbarbg.png new file mode 100644 index 0000000..748043d Binary files /dev/null and b/Resources/navbarbg.png differ diff --git a/Resources/[email protected] b/Resources/[email protected] new file mode 100644 index 0000000..76cccba Binary files /dev/null and b/Resources/[email protected] differ diff --git a/Resources/subjects-back.png b/Resources/subjects-back.png new file mode 100644 index 0000000..23cd5c1 Binary files /dev/null and b/Resources/subjects-back.png differ diff --git a/Resources/viewchapter.js b/Resources/viewchapter.js new file mode 100644 index 0000000..feb0eb6 --- /dev/null +++ b/Resources/viewchapter.js @@ -0,0 +1,57 @@ +var viewChaptertWindow = function(subjectId){ + var win = Ti.UI.createWindow({color:'#61290C',title:'Chapters',barImage:'navbarbg.png',barColor:'#D0A159'}); + var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + win.titleControl = customhead; + + win.hideTabBar(); + + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId); + var thisSubject = subjectName.fieldByName('subject'); + subjectName.close(); + db.close(); + + var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false}); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Name of Subject'}); + var label = Ti.UI.createLabel({left:10,right:10,text:thisSubject}); + var data = []; + row.add(label); + data[0] = row; + addSubjectsView.data = data; + + var chaptersTable = Ti.UI.createTableView({top:90,style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc'}); + var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId); + var x = 0; + while (rows.isValidRow()){ + var chapterName = rows.fieldByName('chapter'); + var id = rows.fieldByName('id'); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',chapterId:id,chapterName:chapterName,hasChild:true}); + if (x == 0){row.header='Chapters';} + var label = Ti.UI.createLabel({text:chapterName, left:10,height:20}); + row.add(label); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + chaptersTable.data=data; + }; + refresh(); + chaptersTable.addEventListener('click',function(e){ + var window = flashCardsWindow(e.rowData.chapterName,e.rowData.chapterId); + Ti.UI.currentTab.open(window); + }); + + + win.add(addSubjectsView); + win.add(chaptersTable); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0}); + win.add(navbarShadow); + win.orientationModes = [Titanium.UI.PORTRAIT]; + + + return win; +}; diff --git a/Resources/viewflashcards.js b/Resources/viewflashcards.js new file mode 100644 index 0000000..c9e88d2 --- /dev/null +++ b/Resources/viewflashcards.js @@ -0,0 +1,123 @@ +var flashCardsWindow = function(title,chapterId){ + var win = Ti.UI.createWindow({color:'#61290C',title:title,barImage:'navbarbg.png', barColor:'#D0A159',backgroundColor:'#ccc'}); + var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); + win.titleControl = customhead; + + + var flipButton = Ti.UI.createButton({title:'flip',style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED}); + var randButton = Ti.UI.createButton({title:'random order',style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED}); + var flexSpace = Titanium.UI.createButton({systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE}); + + var nameButton = Ti.UI.createButton({title:'order by name',style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED}); + var toolbar = Ti.UI.createToolbar({bottom:0,barColor:'#1b242a',items:[randButton,flexSpace,nameButton]}); + win.rightNavButton=flipButton; + var totalViews1 = []; + var totalViews2 = []; + var mainView = Ti.UI.createView({}); + var scrollView1 = Ti.UI.createScrollableView({top:10,bottom:54}); + var scrollView2 = Ti.UI.createScrollableView({top:10,bottom:54}); + var refresh = function(order){ + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var flashcardsName; + if (order == 'random'){ + flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY RANDOM()",chapterId); + } else if (order == 'name'){ + flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY name",chapterId); + } else { + flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ?",chapterId); + } + + var x = 0; + while (flashcardsName.isValidRow()){ + var flashName = flashcardsName.fieldByName('name'); + var flashDescription = flashcardsName.fieldByName('description'); + var id = flashcardsName.fieldByName('id'); + + var flashNumber1 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right'}); + var flashView1 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',page:1,borderColor:'#999',borderRadius:5}); + var flashTitle1 = Ti.UI.createLabel({text:flashName,textAlign:'center',color:'black',font:{fontWeight:'bold',fontSize:20}}); + flashView1.add(flashNumber1); + flashView1.add(flashTitle1); + + var flashNumber2 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right'}); + var flashView2 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',backgroundImage:'flashcard.png',page:2,borderColor:'#999',borderRadius:5}); + var flashTitle2 = Ti.UI.createLabel({text:flashDescription,textAlign:'left',left:20,right:20,font:{fontWeight:'bold',fontSize:16}}); + flashView2.add(flashNumber2); + flashView2.add(flashTitle2); + + totalViews1[x] = flashView1; + totalViews2[x++] = flashView2; + flashcardsName.next(); + }; + flashcardsName.close(); + db.close(); + scrollView1.views = totalViews1; + scrollView2.views = totalViews2; + + }; + refresh(); + + mainView.add(scrollView1); + win.add(mainView); + win.add(toolbar); + + + var pageDisplay = 1; + var flip = function(){ + switch (pageDisplay){ + case 1: + scrollView2.currentPage = scrollView1.currentPage; + var animation2 = Ti.UI.createAnimation({view:scrollView2,transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT,duration: 500}); + mainView.animate(animation2); + pageDisplay = 2; + break; + case 2: + scrollView1.currentPage = scrollView2.currentPage; + var animation1 = Ti.UI.createAnimation({view:scrollView1,transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_RIGHT,duration: 500}); + mainView.animate(animation1); + pageDisplay = 1; + break; + } + }; + + flipButton.addEventListener('click',function(){ + flip(); + }); + scrollView2.addEventListener('doubletap',function(){ + flip(); + }); + scrollView1.addEventListener('doubletap',function(){ + flip(); + }); + randButton.addEventListener('click',function(){ + refresh('random'); + }); + nameButton.addEventListener('click',function(){ + refresh('name'); + }); + var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0}); + win.add(navbarShadow); + + win.orientationModes = [ + Titanium.UI.PORTRAIT, + Titanium.UI.LANDSCAPE_LEFT, + Titanium.UI.LANDSCAPE_RIGHT + ]; + if (Ti.UI.orientation == 3 || Ti.UI.orientation == 4){ + win.barImage='navbarbg-landscape.png'; + } + if (Ti.UI.orientation == 1 || Ti.UI.orientation == 2){ + win.barImage='navbarbg.png'; + } + + Ti.Gesture.addEventListener('orientationchange', function(e){ + if (e.orientation == 3 || e.orientation == 4){ + win.barImage='navbarbg-landscape.png'; + } + if (e.orientation == 1 || e.orientation == 2){ + win.barImage='navbarbg.png'; + } + }); + + return win; +}; \ No newline at end of file diff --git a/Resources/viewlist.js b/Resources/viewlist.js new file mode 100644 index 0000000..9bca9fa --- /dev/null +++ b/Resources/viewlist.js @@ -0,0 +1,42 @@ +Ti.include('viewchapter.js'); +Ti.include('viewflashcards.js'); + +var win = Ti.UI.currentWindow; +var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}}); +win.titleControl = customhead; + +win.barImage='navbarbg.png'; +win.barColor='#D0A159'; + +var listOfSubjects = Ti.UI.createTableView({}); +win.add(listOfSubjects); +var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0}); +win.add(navbarShadow); + + +var refresh = function(){ + var data = []; + var db = Titanium.Database.install('flashcards.sqlite', 'flash1'); + var rows = db.execute("SELECT * FROM subjects ORDER BY subject"); + var x = 0; + while (rows.isValidRow()){ + var subjectName = rows.fieldByName('subject'); + var id = rows.fieldByName('id'); + var row = Ti.UI.createTableViewRow({backgroundColor:'white',subjectId:id,subjectName:subjectName}); + var label = Ti.UI.createLabel({text:subjectName, left:10}); + row.add(label); + data[x++] = row; + rows.next(); + }; + rows.close(); + db.close(); + listOfSubjects.data=data; +}; +win.addEventListener('focus', function(){ + refresh(); +}); + +listOfSubjects.addEventListener('click',function(e){ + var window = viewChaptertWindow(e.rowData.subjectId); + Ti.UI.currentTab.open(window); +});
lericson/eko
10be576bea69f847badffbe3ff383f1f40115732
Don't use property.setter for py25 compat.
diff --git a/Eko/EkoAppDelegate.py b/Eko/EkoAppDelegate.py index bf6a781..17dc66b 100644 --- a/Eko/EkoAppDelegate.py +++ b/Eko/EkoAppDelegate.py @@ -1,182 +1,182 @@ """THE APP DELEGATE :O""" from __future__ import with_statement import os import datetime import logging from objc import IBOutlet, IBAction, selector, object_lock from Foundation import * from AppKit import * import eko class NSLogHandler(logging.Handler): def emit(self, record): msg = self.format(record) if isinstance(msg, str): msg = msg.decode("utf-8", "replace") NSLog(msg) class CocoaEkoClient(NSObject, eko.EkoClient): @property def __init__(self): raise AttributeError("removed attribute") def initWithServer_AtURL_usingNamespace(self, server_url, target_url, namespace): NSLog("init: server = %r, target = %r, ns = %r" % (server_url, target_url, namespace)) eko.EkoClient.__init__(self, target_url, namespace=namespace, server_url=server_url) @classmethod def newAtURL_usingNamespace_(cls, target_url, namespace): server_url = os.environ.get("EKO_SERVER", cls.server_url) self = cls.new() self.initWithServer_AtURL_usingNamespace(server_url, target_url, namespace) return self - @property - def running(self): + def _get_running(self): return not NSThread.currentThread().isCancelled() - @running.setter - def running(self, value): + def _set_running(self, value): if value != self.running: raise ValueError("can't change running to %r" % (value,)) + running = property(_get_running, _set_running) + def emit_request_forwarded(self, request, response): req_item = RequestItem.from_emission(request, response) with object_lock(self.request_items): self.request_items.append(req_item) NSApp.delegate().requestView.performSelectorOnMainThread_withObject_waitUntilDone_( "reloadData", None, False) class RequestItemDataSource(NSObject): # def outlineView_child_ofItem_(self, view, child_idx, parent_item): # if parent_item is None: # return self.src[child_idx] # else: # return parent_item.data[child_idx] # # def outlineView_isItemExpandable_(self, view, item): # return hasattr(item, "data") # # def outlineView_objectValueForTableColumn_byItem_(self, view, column, item): # attr = column.identifier() # if not attr: # return None # if hasattr(item, "get_" + attr + "_view"): # return getattr(item, "get_" + attr + "_view")() # else: # NSLog("item repr of %s: %r" % (attr, item)) # return getattr(item, attr, "<UNSET>") def numberOfRowsInTableView_(self, view): return len(self.src) def tableView_objectValueForTableColumn_row_(self, view, column, row_idx): attr = column.identifier() item = self.src[row_idx] if not attr: return return getattr(item, attr) @classmethod def newWithSource_(cls, src): self = cls.new() self.src = src return self class RequestItem(NSObject): def initWithPair(self, request, response): self.init() self.request = request self.response = response self.method = request.get_method() self.path = request.get_selector() self.timestamp = datetime.datetime.now() @classmethod def from_emission(cls, request, response): self = cls.alloc() self.initWithPair(request, response) return self class MyTestClass(NSObject): @classmethod def myClassMeth_(cls, arg): pool = NSAutoreleasePool.alloc() pool.init() NSLog("test target: %r" % (arg,)) pool.drain() pool.release() class EkoClientThread(NSThread): def initAtURL_usingNamespace_withItems_(self, target_url, namespace, request_items): self.target_url = target_url self.namespace = namespace self.request_items = request_items @classmethod def newAtURL_usingNamespace_withItems_(cls, url, ns, items): self = cls.new() self.initAtURL_usingNamespace_withItems_(url, ns, items) return self def main(self): pool = NSAutoreleasePool.alloc() pool.init() NSLog("A") NSLog("B") client = CocoaEkoClient.newAtURL_usingNamespace_( self.target_url, self.namespace) NSLog("C") client.request_items = self.request_items try: NSLog("D") client.run_forever() finally: NSLog("E") pool.drain() pool.release() class EkoAppDelegate(NSObject): targetURL = IBOutlet() namespace = IBOutlet() requestView = IBOutlet() @IBAction def updateURLs_(self, sender): target_url = self.targetURL.stringValue() namespace = self.namespace.stringValue() with object_lock(self.request_items): self.request_items[:] = [] self.requestView.reloadData() if hasattr(self, "client_thread"): self.client_thread.cancel() self.client_thread = EkoClientThread.newAtURL_usingNamespace_withItems_( target_url, namespace, self.request_items) self.client_thread.start() ##self.client_thread = NSThread.new() ##self.client_thread.initWithTarget_selector_object_( ## None, selector(runEkoClientThread_, isClassMethod=True), ## (target_url, namespace, self.request_items)) ##self.client_thread.start() #NSThread.detachNewThreadSelector_toTarget_withObject_( # selector(MyTestClass.myClassMeth_, # isClassMethod=True, # argumentTypes="s"), # MyTestClass, # "hello") #t = NSThread.new() #t.initWithTarget_selector_object_(None, selector(my_test_target), "hello") #t.start() #self.t = t def applicationDidFinishLaunching_(self, sender): logging.basicConfig(level=logging.DEBUG) logging.root.addHandler(NSLogHandler()) #CFRunLoopSourceCreate(None, 0, ()) self.request_items = NSMutableArray.new() self.requestView.setDataSource_(RequestItemDataSource.newWithSource_(self.request_items))
lericson/eko
85adba9f23ecddefed2a62c724dca15a6412d6b1
Remove debug line.
diff --git a/Eko/EkoAppDelegate.py b/Eko/EkoAppDelegate.py index 194b11d..bf6a781 100644 --- a/Eko/EkoAppDelegate.py +++ b/Eko/EkoAppDelegate.py @@ -1,183 +1,182 @@ """THE APP DELEGATE :O""" from __future__ import with_statement import os import datetime import logging from objc import IBOutlet, IBAction, selector, object_lock from Foundation import * from AppKit import * import eko class NSLogHandler(logging.Handler): def emit(self, record): msg = self.format(record) if isinstance(msg, str): msg = msg.decode("utf-8", "replace") - #import pdb ; pdb.set_trace() NSLog(msg) class CocoaEkoClient(NSObject, eko.EkoClient): @property def __init__(self): raise AttributeError("removed attribute") def initWithServer_AtURL_usingNamespace(self, server_url, target_url, namespace): NSLog("init: server = %r, target = %r, ns = %r" % (server_url, target_url, namespace)) eko.EkoClient.__init__(self, target_url, namespace=namespace, server_url=server_url) @classmethod def newAtURL_usingNamespace_(cls, target_url, namespace): server_url = os.environ.get("EKO_SERVER", cls.server_url) self = cls.new() self.initWithServer_AtURL_usingNamespace(server_url, target_url, namespace) return self @property def running(self): return not NSThread.currentThread().isCancelled() @running.setter def running(self, value): if value != self.running: raise ValueError("can't change running to %r" % (value,)) def emit_request_forwarded(self, request, response): req_item = RequestItem.from_emission(request, response) with object_lock(self.request_items): self.request_items.append(req_item) NSApp.delegate().requestView.performSelectorOnMainThread_withObject_waitUntilDone_( "reloadData", None, False) class RequestItemDataSource(NSObject): # def outlineView_child_ofItem_(self, view, child_idx, parent_item): # if parent_item is None: # return self.src[child_idx] # else: # return parent_item.data[child_idx] # # def outlineView_isItemExpandable_(self, view, item): # return hasattr(item, "data") # # def outlineView_objectValueForTableColumn_byItem_(self, view, column, item): # attr = column.identifier() # if not attr: # return None # if hasattr(item, "get_" + attr + "_view"): # return getattr(item, "get_" + attr + "_view")() # else: # NSLog("item repr of %s: %r" % (attr, item)) # return getattr(item, attr, "<UNSET>") def numberOfRowsInTableView_(self, view): return len(self.src) def tableView_objectValueForTableColumn_row_(self, view, column, row_idx): attr = column.identifier() item = self.src[row_idx] if not attr: return return getattr(item, attr) @classmethod def newWithSource_(cls, src): self = cls.new() self.src = src return self class RequestItem(NSObject): def initWithPair(self, request, response): self.init() self.request = request self.response = response self.method = request.get_method() self.path = request.get_selector() self.timestamp = datetime.datetime.now() @classmethod def from_emission(cls, request, response): self = cls.alloc() self.initWithPair(request, response) return self class MyTestClass(NSObject): @classmethod def myClassMeth_(cls, arg): pool = NSAutoreleasePool.alloc() pool.init() NSLog("test target: %r" % (arg,)) pool.drain() pool.release() class EkoClientThread(NSThread): def initAtURL_usingNamespace_withItems_(self, target_url, namespace, request_items): self.target_url = target_url self.namespace = namespace self.request_items = request_items @classmethod def newAtURL_usingNamespace_withItems_(cls, url, ns, items): self = cls.new() self.initAtURL_usingNamespace_withItems_(url, ns, items) return self def main(self): pool = NSAutoreleasePool.alloc() pool.init() NSLog("A") NSLog("B") client = CocoaEkoClient.newAtURL_usingNamespace_( self.target_url, self.namespace) NSLog("C") client.request_items = self.request_items try: NSLog("D") client.run_forever() finally: NSLog("E") pool.drain() pool.release() class EkoAppDelegate(NSObject): targetURL = IBOutlet() namespace = IBOutlet() requestView = IBOutlet() @IBAction def updateURLs_(self, sender): target_url = self.targetURL.stringValue() namespace = self.namespace.stringValue() with object_lock(self.request_items): self.request_items[:] = [] self.requestView.reloadData() if hasattr(self, "client_thread"): self.client_thread.cancel() self.client_thread = EkoClientThread.newAtURL_usingNamespace_withItems_( target_url, namespace, self.request_items) self.client_thread.start() ##self.client_thread = NSThread.new() ##self.client_thread.initWithTarget_selector_object_( ## None, selector(runEkoClientThread_, isClassMethod=True), ## (target_url, namespace, self.request_items)) ##self.client_thread.start() #NSThread.detachNewThreadSelector_toTarget_withObject_( # selector(MyTestClass.myClassMeth_, # isClassMethod=True, # argumentTypes="s"), # MyTestClass, # "hello") #t = NSThread.new() #t.initWithTarget_selector_object_(None, selector(my_test_target), "hello") #t.start() #self.t = t def applicationDidFinishLaunching_(self, sender): logging.basicConfig(level=logging.DEBUG) logging.root.addHandler(NSLogHandler()) #CFRunLoopSourceCreate(None, 0, ()) self.request_items = NSMutableArray.new() self.requestView.setDataSource_(RequestItemDataSource.newWithSource_(self.request_items))
lericson/eko
6b196254bf096aa160eab7db684839b827e828b0
Hold request_items lock while reloadData runs (could be mutating.)
diff --git a/Eko/EkoAppDelegate.py b/Eko/EkoAppDelegate.py index a7aaaea..194b11d 100644 --- a/Eko/EkoAppDelegate.py +++ b/Eko/EkoAppDelegate.py @@ -1,183 +1,183 @@ """THE APP DELEGATE :O""" from __future__ import with_statement import os import datetime import logging from objc import IBOutlet, IBAction, selector, object_lock from Foundation import * from AppKit import * import eko class NSLogHandler(logging.Handler): def emit(self, record): msg = self.format(record) if isinstance(msg, str): msg = msg.decode("utf-8", "replace") #import pdb ; pdb.set_trace() NSLog(msg) class CocoaEkoClient(NSObject, eko.EkoClient): @property def __init__(self): raise AttributeError("removed attribute") def initWithServer_AtURL_usingNamespace(self, server_url, target_url, namespace): NSLog("init: server = %r, target = %r, ns = %r" % (server_url, target_url, namespace)) eko.EkoClient.__init__(self, target_url, namespace=namespace, server_url=server_url) @classmethod def newAtURL_usingNamespace_(cls, target_url, namespace): server_url = os.environ.get("EKO_SERVER", cls.server_url) self = cls.new() self.initWithServer_AtURL_usingNamespace(server_url, target_url, namespace) return self @property def running(self): return not NSThread.currentThread().isCancelled() @running.setter def running(self, value): if value != self.running: raise ValueError("can't change running to %r" % (value,)) def emit_request_forwarded(self, request, response): req_item = RequestItem.from_emission(request, response) with object_lock(self.request_items): self.request_items.append(req_item) - NSApp.delegate().requestView.performSelectorOnMainThread_withObject_waitUntilDone_( - "reloadData", None, False) + NSApp.delegate().requestView.performSelectorOnMainThread_withObject_waitUntilDone_( + "reloadData", None, False) class RequestItemDataSource(NSObject): # def outlineView_child_ofItem_(self, view, child_idx, parent_item): # if parent_item is None: # return self.src[child_idx] # else: # return parent_item.data[child_idx] # # def outlineView_isItemExpandable_(self, view, item): # return hasattr(item, "data") # # def outlineView_objectValueForTableColumn_byItem_(self, view, column, item): # attr = column.identifier() # if not attr: # return None # if hasattr(item, "get_" + attr + "_view"): # return getattr(item, "get_" + attr + "_view")() # else: # NSLog("item repr of %s: %r" % (attr, item)) # return getattr(item, attr, "<UNSET>") def numberOfRowsInTableView_(self, view): return len(self.src) def tableView_objectValueForTableColumn_row_(self, view, column, row_idx): attr = column.identifier() item = self.src[row_idx] if not attr: return return getattr(item, attr) @classmethod def newWithSource_(cls, src): self = cls.new() self.src = src return self class RequestItem(NSObject): def initWithPair(self, request, response): self.init() self.request = request self.response = response self.method = request.get_method() self.path = request.get_selector() self.timestamp = datetime.datetime.now() @classmethod def from_emission(cls, request, response): self = cls.alloc() self.initWithPair(request, response) return self class MyTestClass(NSObject): @classmethod def myClassMeth_(cls, arg): pool = NSAutoreleasePool.alloc() pool.init() NSLog("test target: %r" % (arg,)) pool.drain() pool.release() class EkoClientThread(NSThread): def initAtURL_usingNamespace_withItems_(self, target_url, namespace, request_items): self.target_url = target_url self.namespace = namespace self.request_items = request_items @classmethod def newAtURL_usingNamespace_withItems_(cls, url, ns, items): self = cls.new() self.initAtURL_usingNamespace_withItems_(url, ns, items) return self def main(self): pool = NSAutoreleasePool.alloc() pool.init() NSLog("A") NSLog("B") client = CocoaEkoClient.newAtURL_usingNamespace_( self.target_url, self.namespace) NSLog("C") client.request_items = self.request_items try: NSLog("D") client.run_forever() finally: NSLog("E") pool.drain() pool.release() class EkoAppDelegate(NSObject): targetURL = IBOutlet() namespace = IBOutlet() requestView = IBOutlet() @IBAction def updateURLs_(self, sender): target_url = self.targetURL.stringValue() namespace = self.namespace.stringValue() with object_lock(self.request_items): self.request_items[:] = [] - self.requestView.reloadData() + self.requestView.reloadData() if hasattr(self, "client_thread"): self.client_thread.cancel() self.client_thread = EkoClientThread.newAtURL_usingNamespace_withItems_( target_url, namespace, self.request_items) self.client_thread.start() ##self.client_thread = NSThread.new() ##self.client_thread.initWithTarget_selector_object_( ## None, selector(runEkoClientThread_, isClassMethod=True), ## (target_url, namespace, self.request_items)) ##self.client_thread.start() #NSThread.detachNewThreadSelector_toTarget_withObject_( # selector(MyTestClass.myClassMeth_, # isClassMethod=True, # argumentTypes="s"), # MyTestClass, # "hello") #t = NSThread.new() #t.initWithTarget_selector_object_(None, selector(my_test_target), "hello") #t.start() #self.t = t def applicationDidFinishLaunching_(self, sender): logging.basicConfig(level=logging.DEBUG) logging.root.addHandler(NSLogHandler()) #CFRunLoopSourceCreate(None, 0, ()) self.request_items = NSMutableArray.new() self.requestView.setDataSource_(RequestItemDataSource.newWithSource_(self.request_items))
lericson/eko
5e505e327c8fef6d94f49d96bc7559d34304a8d1
Import with statement for py25
diff --git a/Eko/EkoAppDelegate.py b/Eko/EkoAppDelegate.py index 661328c..a7aaaea 100644 --- a/Eko/EkoAppDelegate.py +++ b/Eko/EkoAppDelegate.py @@ -1,181 +1,183 @@ """THE APP DELEGATE :O""" +from __future__ import with_statement + import os import datetime import logging from objc import IBOutlet, IBAction, selector, object_lock from Foundation import * from AppKit import * import eko class NSLogHandler(logging.Handler): def emit(self, record): msg = self.format(record) if isinstance(msg, str): msg = msg.decode("utf-8", "replace") #import pdb ; pdb.set_trace() NSLog(msg) class CocoaEkoClient(NSObject, eko.EkoClient): @property def __init__(self): raise AttributeError("removed attribute") def initWithServer_AtURL_usingNamespace(self, server_url, target_url, namespace): NSLog("init: server = %r, target = %r, ns = %r" % (server_url, target_url, namespace)) eko.EkoClient.__init__(self, target_url, namespace=namespace, server_url=server_url) @classmethod def newAtURL_usingNamespace_(cls, target_url, namespace): server_url = os.environ.get("EKO_SERVER", cls.server_url) self = cls.new() self.initWithServer_AtURL_usingNamespace(server_url, target_url, namespace) return self @property def running(self): return not NSThread.currentThread().isCancelled() @running.setter def running(self, value): if value != self.running: raise ValueError("can't change running to %r" % (value,)) def emit_request_forwarded(self, request, response): req_item = RequestItem.from_emission(request, response) with object_lock(self.request_items): self.request_items.append(req_item) NSApp.delegate().requestView.performSelectorOnMainThread_withObject_waitUntilDone_( "reloadData", None, False) class RequestItemDataSource(NSObject): # def outlineView_child_ofItem_(self, view, child_idx, parent_item): # if parent_item is None: # return self.src[child_idx] # else: # return parent_item.data[child_idx] # # def outlineView_isItemExpandable_(self, view, item): # return hasattr(item, "data") # # def outlineView_objectValueForTableColumn_byItem_(self, view, column, item): # attr = column.identifier() # if not attr: # return None # if hasattr(item, "get_" + attr + "_view"): # return getattr(item, "get_" + attr + "_view")() # else: # NSLog("item repr of %s: %r" % (attr, item)) # return getattr(item, attr, "<UNSET>") def numberOfRowsInTableView_(self, view): return len(self.src) def tableView_objectValueForTableColumn_row_(self, view, column, row_idx): attr = column.identifier() item = self.src[row_idx] if not attr: return return getattr(item, attr) @classmethod def newWithSource_(cls, src): self = cls.new() self.src = src return self class RequestItem(NSObject): def initWithPair(self, request, response): self.init() self.request = request self.response = response self.method = request.get_method() self.path = request.get_selector() self.timestamp = datetime.datetime.now() @classmethod def from_emission(cls, request, response): self = cls.alloc() self.initWithPair(request, response) return self class MyTestClass(NSObject): @classmethod def myClassMeth_(cls, arg): pool = NSAutoreleasePool.alloc() pool.init() NSLog("test target: %r" % (arg,)) pool.drain() pool.release() class EkoClientThread(NSThread): def initAtURL_usingNamespace_withItems_(self, target_url, namespace, request_items): self.target_url = target_url self.namespace = namespace self.request_items = request_items @classmethod def newAtURL_usingNamespace_withItems_(cls, url, ns, items): self = cls.new() self.initAtURL_usingNamespace_withItems_(url, ns, items) return self def main(self): pool = NSAutoreleasePool.alloc() pool.init() NSLog("A") NSLog("B") client = CocoaEkoClient.newAtURL_usingNamespace_( self.target_url, self.namespace) NSLog("C") client.request_items = self.request_items try: NSLog("D") client.run_forever() finally: NSLog("E") pool.drain() pool.release() class EkoAppDelegate(NSObject): targetURL = IBOutlet() namespace = IBOutlet() requestView = IBOutlet() @IBAction def updateURLs_(self, sender): target_url = self.targetURL.stringValue() namespace = self.namespace.stringValue() with object_lock(self.request_items): self.request_items[:] = [] self.requestView.reloadData() if hasattr(self, "client_thread"): self.client_thread.cancel() self.client_thread = EkoClientThread.newAtURL_usingNamespace_withItems_( target_url, namespace, self.request_items) self.client_thread.start() ##self.client_thread = NSThread.new() ##self.client_thread.initWithTarget_selector_object_( ## None, selector(runEkoClientThread_, isClassMethod=True), ## (target_url, namespace, self.request_items)) ##self.client_thread.start() #NSThread.detachNewThreadSelector_toTarget_withObject_( # selector(MyTestClass.myClassMeth_, # isClassMethod=True, # argumentTypes="s"), # MyTestClass, # "hello") #t = NSThread.new() #t.initWithTarget_selector_object_(None, selector(my_test_target), "hello") #t.start() #self.t = t def applicationDidFinishLaunching_(self, sender): logging.basicConfig(level=logging.DEBUG) logging.root.addHandler(NSLogHandler()) #CFRunLoopSourceCreate(None, 0, ()) self.request_items = NSMutableArray.new() self.requestView.setDataSource_(RequestItemDataSource.newWithSource_(self.request_items))
lericson/eko
7d4e1000f24b8d32f5ac08fbd278e23792fc1f5b
Don't wait until [NSTableView reloadData] is done.
diff --git a/Eko/EkoAppDelegate.py b/Eko/EkoAppDelegate.py index 76a464d..661328c 100644 --- a/Eko/EkoAppDelegate.py +++ b/Eko/EkoAppDelegate.py @@ -1,181 +1,181 @@ """THE APP DELEGATE :O""" import os import datetime import logging from objc import IBOutlet, IBAction, selector, object_lock from Foundation import * from AppKit import * import eko class NSLogHandler(logging.Handler): def emit(self, record): msg = self.format(record) if isinstance(msg, str): msg = msg.decode("utf-8", "replace") #import pdb ; pdb.set_trace() NSLog(msg) class CocoaEkoClient(NSObject, eko.EkoClient): @property def __init__(self): raise AttributeError("removed attribute") def initWithServer_AtURL_usingNamespace(self, server_url, target_url, namespace): NSLog("init: server = %r, target = %r, ns = %r" % (server_url, target_url, namespace)) eko.EkoClient.__init__(self, target_url, namespace=namespace, server_url=server_url) @classmethod def newAtURL_usingNamespace_(cls, target_url, namespace): server_url = os.environ.get("EKO_SERVER", cls.server_url) self = cls.new() self.initWithServer_AtURL_usingNamespace(server_url, target_url, namespace) return self @property def running(self): return not NSThread.currentThread().isCancelled() @running.setter def running(self, value): if value != self.running: raise ValueError("can't change running to %r" % (value,)) def emit_request_forwarded(self, request, response): + req_item = RequestItem.from_emission(request, response) with object_lock(self.request_items): - req_item = RequestItem.from_emission(request, response) self.request_items.append(req_item) NSApp.delegate().requestView.performSelectorOnMainThread_withObject_waitUntilDone_( - "reloadData", None, True) + "reloadData", None, False) class RequestItemDataSource(NSObject): # def outlineView_child_ofItem_(self, view, child_idx, parent_item): # if parent_item is None: # return self.src[child_idx] # else: # return parent_item.data[child_idx] # # def outlineView_isItemExpandable_(self, view, item): # return hasattr(item, "data") # # def outlineView_objectValueForTableColumn_byItem_(self, view, column, item): # attr = column.identifier() # if not attr: # return None # if hasattr(item, "get_" + attr + "_view"): # return getattr(item, "get_" + attr + "_view")() # else: # NSLog("item repr of %s: %r" % (attr, item)) # return getattr(item, attr, "<UNSET>") def numberOfRowsInTableView_(self, view): return len(self.src) def tableView_objectValueForTableColumn_row_(self, view, column, row_idx): attr = column.identifier() item = self.src[row_idx] if not attr: return return getattr(item, attr) @classmethod def newWithSource_(cls, src): self = cls.new() self.src = src return self class RequestItem(NSObject): def initWithPair(self, request, response): self.init() self.request = request self.response = response self.method = request.get_method() self.path = request.get_selector() self.timestamp = datetime.datetime.now() @classmethod def from_emission(cls, request, response): self = cls.alloc() self.initWithPair(request, response) return self class MyTestClass(NSObject): @classmethod def myClassMeth_(cls, arg): pool = NSAutoreleasePool.alloc() pool.init() NSLog("test target: %r" % (arg,)) pool.drain() pool.release() class EkoClientThread(NSThread): def initAtURL_usingNamespace_withItems_(self, target_url, namespace, request_items): self.target_url = target_url self.namespace = namespace self.request_items = request_items @classmethod def newAtURL_usingNamespace_withItems_(cls, url, ns, items): self = cls.new() self.initAtURL_usingNamespace_withItems_(url, ns, items) return self def main(self): pool = NSAutoreleasePool.alloc() pool.init() NSLog("A") NSLog("B") client = CocoaEkoClient.newAtURL_usingNamespace_( self.target_url, self.namespace) NSLog("C") client.request_items = self.request_items try: NSLog("D") client.run_forever() finally: NSLog("E") pool.drain() pool.release() class EkoAppDelegate(NSObject): targetURL = IBOutlet() namespace = IBOutlet() requestView = IBOutlet() @IBAction def updateURLs_(self, sender): target_url = self.targetURL.stringValue() namespace = self.namespace.stringValue() with object_lock(self.request_items): self.request_items[:] = [] self.requestView.reloadData() if hasattr(self, "client_thread"): self.client_thread.cancel() self.client_thread = EkoClientThread.newAtURL_usingNamespace_withItems_( target_url, namespace, self.request_items) self.client_thread.start() ##self.client_thread = NSThread.new() ##self.client_thread.initWithTarget_selector_object_( ## None, selector(runEkoClientThread_, isClassMethod=True), ## (target_url, namespace, self.request_items)) ##self.client_thread.start() #NSThread.detachNewThreadSelector_toTarget_withObject_( # selector(MyTestClass.myClassMeth_, # isClassMethod=True, # argumentTypes="s"), # MyTestClass, # "hello") #t = NSThread.new() #t.initWithTarget_selector_object_(None, selector(my_test_target), "hello") #t.start() #self.t = t def applicationDidFinishLaunching_(self, sender): logging.basicConfig(level=logging.DEBUG) logging.root.addHandler(NSLogHandler()) #CFRunLoopSourceCreate(None, 0, ()) self.request_items = NSMutableArray.new() self.requestView.setDataSource_(RequestItemDataSource.newWithSource_(self.request_items))
lericson/eko
5c5116150c111a402f0fcb533d5545fdeb1764c1
Don't check [NSApp isRunning] in client thread.
diff --git a/Eko/EkoAppDelegate.py b/Eko/EkoAppDelegate.py index 6f2b130..76a464d 100644 --- a/Eko/EkoAppDelegate.py +++ b/Eko/EkoAppDelegate.py @@ -1,181 +1,181 @@ """THE APP DELEGATE :O""" import os import datetime import logging from objc import IBOutlet, IBAction, selector, object_lock from Foundation import * from AppKit import * import eko class NSLogHandler(logging.Handler): def emit(self, record): msg = self.format(record) if isinstance(msg, str): msg = msg.decode("utf-8", "replace") #import pdb ; pdb.set_trace() NSLog(msg) class CocoaEkoClient(NSObject, eko.EkoClient): @property def __init__(self): raise AttributeError("removed attribute") def initWithServer_AtURL_usingNamespace(self, server_url, target_url, namespace): NSLog("init: server = %r, target = %r, ns = %r" % (server_url, target_url, namespace)) eko.EkoClient.__init__(self, target_url, namespace=namespace, server_url=server_url) @classmethod def newAtURL_usingNamespace_(cls, target_url, namespace): server_url = os.environ.get("EKO_SERVER", cls.server_url) self = cls.new() self.initWithServer_AtURL_usingNamespace(server_url, target_url, namespace) return self @property def running(self): - return NSApp.isRunning() and not NSThread.currentThread().isCancelled() + return not NSThread.currentThread().isCancelled() @running.setter def running(self, value): if value != self.running: raise ValueError("can't change running to %r" % (value,)) def emit_request_forwarded(self, request, response): with object_lock(self.request_items): req_item = RequestItem.from_emission(request, response) self.request_items.append(req_item) NSApp.delegate().requestView.performSelectorOnMainThread_withObject_waitUntilDone_( "reloadData", None, True) class RequestItemDataSource(NSObject): # def outlineView_child_ofItem_(self, view, child_idx, parent_item): # if parent_item is None: # return self.src[child_idx] # else: # return parent_item.data[child_idx] # # def outlineView_isItemExpandable_(self, view, item): # return hasattr(item, "data") # # def outlineView_objectValueForTableColumn_byItem_(self, view, column, item): # attr = column.identifier() # if not attr: # return None # if hasattr(item, "get_" + attr + "_view"): # return getattr(item, "get_" + attr + "_view")() # else: # NSLog("item repr of %s: %r" % (attr, item)) # return getattr(item, attr, "<UNSET>") def numberOfRowsInTableView_(self, view): return len(self.src) def tableView_objectValueForTableColumn_row_(self, view, column, row_idx): attr = column.identifier() item = self.src[row_idx] if not attr: return return getattr(item, attr) @classmethod def newWithSource_(cls, src): self = cls.new() self.src = src return self class RequestItem(NSObject): def initWithPair(self, request, response): self.init() self.request = request self.response = response self.method = request.get_method() self.path = request.get_selector() self.timestamp = datetime.datetime.now() @classmethod def from_emission(cls, request, response): self = cls.alloc() self.initWithPair(request, response) return self class MyTestClass(NSObject): @classmethod def myClassMeth_(cls, arg): pool = NSAutoreleasePool.alloc() pool.init() NSLog("test target: %r" % (arg,)) pool.drain() pool.release() class EkoClientThread(NSThread): def initAtURL_usingNamespace_withItems_(self, target_url, namespace, request_items): self.target_url = target_url self.namespace = namespace self.request_items = request_items @classmethod def newAtURL_usingNamespace_withItems_(cls, url, ns, items): self = cls.new() self.initAtURL_usingNamespace_withItems_(url, ns, items) return self def main(self): pool = NSAutoreleasePool.alloc() pool.init() NSLog("A") NSLog("B") client = CocoaEkoClient.newAtURL_usingNamespace_( self.target_url, self.namespace) NSLog("C") client.request_items = self.request_items try: NSLog("D") client.run_forever() finally: NSLog("E") pool.drain() pool.release() class EkoAppDelegate(NSObject): targetURL = IBOutlet() namespace = IBOutlet() requestView = IBOutlet() @IBAction def updateURLs_(self, sender): target_url = self.targetURL.stringValue() namespace = self.namespace.stringValue() with object_lock(self.request_items): self.request_items[:] = [] self.requestView.reloadData() if hasattr(self, "client_thread"): self.client_thread.cancel() self.client_thread = EkoClientThread.newAtURL_usingNamespace_withItems_( target_url, namespace, self.request_items) self.client_thread.start() ##self.client_thread = NSThread.new() ##self.client_thread.initWithTarget_selector_object_( ## None, selector(runEkoClientThread_, isClassMethod=True), ## (target_url, namespace, self.request_items)) ##self.client_thread.start() #NSThread.detachNewThreadSelector_toTarget_withObject_( # selector(MyTestClass.myClassMeth_, # isClassMethod=True, # argumentTypes="s"), # MyTestClass, # "hello") #t = NSThread.new() #t.initWithTarget_selector_object_(None, selector(my_test_target), "hello") #t.start() #self.t = t def applicationDidFinishLaunching_(self, sender): logging.basicConfig(level=logging.DEBUG) logging.root.addHandler(NSLogHandler()) #CFRunLoopSourceCreate(None, 0, ()) self.request_items = NSMutableArray.new() self.requestView.setDataSource_(RequestItemDataSource.newWithSource_(self.request_items))
lericson/eko
b9be5897f9ddf3e31cfbb56c6e231e48541d00de
Ignore and remove .mode1v3 and .pbxuser.
diff --git a/.gitignore b/.gitignore index ebeb1c6..c731bf7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ *.pyc *.pyo .DS_Store /Eko/build +/Eko/Eko.xcodeproj/*.mode1v3 +/Eko/Eko.xcodeproj/*.pbxuser diff --git a/Eko/Eko.xcodeproj/jnordberg.mode1v3 b/Eko/Eko.xcodeproj/jnordberg.mode1v3 deleted file mode 100644 index 824cc84..0000000 --- a/Eko/Eko.xcodeproj/jnordberg.mode1v3 +++ /dev/null @@ -1,1351 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>ActivePerspectiveName</key> - <string>Project</string> - <key>AllowedModules</key> - <array> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXSmartGroupTreeModule</string> - <key>Name</key> - <string>Groups and Files Outline View</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Name</key> - <string>Editor</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCTaskListModule</string> - <key>Name</key> - <string>Task List</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCDetailModule</string> - <key>Name</key> - <string>File and Smart Group Detail Viewer</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>1</string> - <key>Module</key> - <string>PBXBuildResultsModule</string> - <key>Name</key> - <string>Detailed Build Results Viewer</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>1</string> - <key>Module</key> - <string>PBXProjectFindModule</string> - <key>Name</key> - <string>Project Batch Find Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCProjectFormatConflictsModule</string> - <key>Name</key> - <string>Project Format Conflicts List</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXBookmarksModule</string> - <key>Name</key> - <string>Bookmarks Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXClassBrowserModule</string> - <key>Name</key> - <string>Class Browser</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXCVSModule</string> - <key>Name</key> - <string>Source Code Control Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXDebugBreakpointsModule</string> - <key>Name</key> - <string>Debug Breakpoints Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCDockableInspector</string> - <key>Name</key> - <string>Inspector</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXOpenQuicklyModule</string> - <key>Name</key> - <string>Open Quickly Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>1</string> - <key>Module</key> - <string>PBXDebugSessionModule</string> - <key>Name</key> - <string>Debugger</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>1</string> - <key>Module</key> - <string>PBXDebugCLIModule</string> - <key>Name</key> - <string>Debug Console</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCSnapshotModule</string> - <key>Name</key> - <string>Snapshots Tool</string> - </dict> - </array> - <key>BundlePath</key> - <string>/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources</string> - <key>Description</key> - <string>DefaultDescriptionKey</string> - <key>DockingSystemVisible</key> - <false/> - <key>Extension</key> - <string>mode1v3</string> - <key>FavBarConfig</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>A5501C8A102F4B8C00A02BF0</string> - <key>XCBarModuleItemNames</key> - <dict/> - <key>XCBarModuleItems</key> - <array/> - </dict> - <key>FirstTimeWindowDisplayed</key> - <false/> - <key>Identifier</key> - <string>com.apple.perspectives.project.mode1v3</string> - <key>MajorVersion</key> - <integer>33</integer> - <key>MinorVersion</key> - <integer>0</integer> - <key>Name</key> - <string>Default</string> - <key>Notifications</key> - <array/> - <key>OpenEditors</key> - <array/> - <key>PerspectiveWidths</key> - <array> - <integer>-1</integer> - <integer>-1</integer> - </array> - <key>Perspectives</key> - <array> - <dict> - <key>ChosenToolbarItems</key> - <array> - <string>active-combo-popup</string> - <string>action</string> - <string>NSToolbarFlexibleSpaceItem</string> - <string>build</string> - <string>build-and-go</string> - <string>com.apple.ide.PBXToolbarStopButton</string> - <string>get-info</string> - <string>NSToolbarFlexibleSpaceItem</string> - <string>com.apple.pbx.toolbar.searchfield</string> - </array> - <key>ControllerClassBaseName</key> - <string></string> - <key>IconName</key> - <string>WindowOfProjectWithEditor</string> - <key>Identifier</key> - <string>perspective.project</string> - <key>IsVertical</key> - <false/> - <key>Layout</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXBottomSmartGroupGIDs</key> - <array> - <string>1C37FBAC04509CD000000102</string> - <string>1C37FAAC04509CD000000102</string> - <string>1C08E77C0454961000C914BD</string> - <string>1C37FABC05509CD000000102</string> - <string>1C37FABC05539CD112110102</string> - <string>E2644B35053B69B200211256</string> - <string>1C37FABC04509CD000100104</string> - <string>1CC0EA4004350EF90044410B</string> - <string>1CC0EA4004350EF90041110B</string> - </array> - <key>PBXProjectModuleGUID</key> - <string>1CE0B1FE06471DED0097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>Files</string> - <key>PBXProjectStructureProvided</key> - <string>yes</string> - <key>PBXSmartGroupTreeModuleColumnData</key> - <dict> - <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> - <array> - <real>186</real> - </array> - <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> - <array> - <string>MainColumn</string> - </array> - </dict> - <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> - <dict> - <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> - <array> - <string>29B97314FDCFA39411CA2CEA</string> - <string>1C37FABC05509CD000000102</string> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> - <array> - <array> - <integer>0</integer> - </array> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {186, 445}}</string> - </dict> - <key>PBXTopSmartGroupGIDs</key> - <array/> - <key>XCIncludePerspectivesSwitch</key> - <true/> - <key>XCSharingToken</key> - <string>com.apple.Xcode.GFSharingToken</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {203, 463}}</string> - <key>GroupTreeTableConfiguration</key> - <array> - <string>MainColumn</string> - <real>186</real> - </array> - <key>RubberWindowFrame</key> - <string>347 294 788 504 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXSmartGroupTreeModule</string> - <key>Proportion</key> - <string>203pt</string> - </dict> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CE0B20306471E060097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>MyNewFile14.java</string> - <key>PBXSplitModuleInNavigatorKey</key> - <dict> - <key>Split0</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CE0B20406471E060097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>MyNewFile14.java</string> - </dict> - <key>SplitCount</key> - <string>1</string> - </dict> - <key>StatusBarVisibility</key> - <true/> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {580, 285}}</string> - <key>RubberWindowFrame</key> - <string>347 294 788 504 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>285pt</string> - </dict> - <dict> - <key>BecomeActive</key> - <true/> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CE0B20506471E060097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>Detail</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 290}, {580, 173}}</string> - <key>RubberWindowFrame</key> - <string>347 294 788 504 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>XCDetailModule</string> - <key>Proportion</key> - <string>173pt</string> - </dict> - </array> - <key>Proportion</key> - <string>580pt</string> - </dict> - </array> - <key>Name</key> - <string>Project</string> - <key>ServiceClasses</key> - <array> - <string>XCModuleDock</string> - <string>PBXSmartGroupTreeModule</string> - <string>XCModuleDock</string> - <string>PBXNavigatorGroup</string> - <string>XCDetailModule</string> - </array> - <key>TableOfContents</key> - <array> - <string>A5501C88102F4B8C00A02BF0</string> - <string>1CE0B1FE06471DED0097A5F4</string> - <string>A5501C89102F4B8C00A02BF0</string> - <string>1CE0B20306471E060097A5F4</string> - <string>1CE0B20506471E060097A5F4</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.defaultV3</string> - </dict> - <dict> - <key>ControllerClassBaseName</key> - <string></string> - <key>IconName</key> - <string>WindowOfProject</string> - <key>Identifier</key> - <string>perspective.morph</string> - <key>IsVertical</key> - <integer>0</integer> - <key>Layout</key> - <array> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXBottomSmartGroupGIDs</key> - <array> - <string>1C37FBAC04509CD000000102</string> - <string>1C37FAAC04509CD000000102</string> - <string>1C08E77C0454961000C914BD</string> - <string>1C37FABC05509CD000000102</string> - <string>1C37FABC05539CD112110102</string> - <string>E2644B35053B69B200211256</string> - <string>1C37FABC04509CD000100104</string> - <string>1CC0EA4004350EF90044410B</string> - <string>1CC0EA4004350EF90041110B</string> - </array> - <key>PBXProjectModuleGUID</key> - <string>11E0B1FE06471DED0097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>Files</string> - <key>PBXProjectStructureProvided</key> - <string>yes</string> - <key>PBXSmartGroupTreeModuleColumnData</key> - <dict> - <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> - <array> - <real>186</real> - </array> - <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> - <array> - <string>MainColumn</string> - </array> - </dict> - <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> - <dict> - <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> - <array> - <string>29B97314FDCFA39411CA2CEA</string> - <string>1C37FABC05509CD000000102</string> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> - <array> - <array> - <integer>0</integer> - </array> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {186, 337}}</string> - </dict> - <key>PBXTopSmartGroupGIDs</key> - <array/> - <key>XCIncludePerspectivesSwitch</key> - <integer>1</integer> - <key>XCSharingToken</key> - <string>com.apple.Xcode.GFSharingToken</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {203, 355}}</string> - <key>GroupTreeTableConfiguration</key> - <array> - <string>MainColumn</string> - <real>186</real> - </array> - <key>RubberWindowFrame</key> - <string>373 269 690 397 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXSmartGroupTreeModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Morph</string> - <key>PreferredWidth</key> - <integer>300</integer> - <key>ServiceClasses</key> - <array> - <string>XCModuleDock</string> - <string>PBXSmartGroupTreeModule</string> - </array> - <key>TableOfContents</key> - <array> - <string>11E0B1FE06471DED0097A5F4</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.default.shortV3</string> - </dict> - </array> - <key>PerspectivesBarVisible</key> - <false/> - <key>ShelfIsVisible</key> - <false/> - <key>SourceDescription</key> - <string>file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec'</string> - <key>StatusbarIsVisible</key> - <true/> - <key>TimeStamp</key> - <real>0.0</real> - <key>ToolbarDisplayMode</key> - <integer>1</integer> - <key>ToolbarIsVisible</key> - <true/> - <key>ToolbarSizeMode</key> - <integer>1</integer> - <key>Type</key> - <string>Perspectives</string> - <key>UpdateMessage</key> - <string>The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'?</string> - <key>WindowJustification</key> - <integer>5</integer> - <key>WindowOrderList</key> - <array> - <string>/Users/jnordberg/Development/Eko/Eko.xcodeproj</string> - </array> - <key>WindowString</key> - <string>347 294 788 504 0 0 1440 878 </string> - <key>WindowToolsV3</key> - <array> - <dict> - <key>Identifier</key> - <string>windowTool.build</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CD0528F0623707200166675</string> - <key>PBXProjectModuleLabel</key> - <string>&lt;No Editor&gt;</string> - <key>PBXSplitModuleInNavigatorKey</key> - <dict> - <key>Split0</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CD052900623707200166675</string> - </dict> - <key>SplitCount</key> - <string>1</string> - </dict> - <key>StatusBarVisibility</key> - <integer>1</integer> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {500, 215}}</string> - <key>RubberWindowFrame</key> - <string>192 257 500 500 0 0 1280 1002 </string> - </dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>218pt</string> - </dict> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>XCMainBuildResultsModuleGUID</string> - <key>PBXProjectModuleLabel</key> - <string>Build</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 222}, {500, 236}}</string> - <key>RubberWindowFrame</key> - <string>192 257 500 500 0 0 1280 1002 </string> - </dict> - <key>Module</key> - <string>PBXBuildResultsModule</string> - <key>Proportion</key> - <string>236pt</string> - </dict> - </array> - <key>Proportion</key> - <string>458pt</string> - </dict> - </array> - <key>Name</key> - <string>Build Results</string> - <key>ServiceClasses</key> - <array> - <string>PBXBuildResultsModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>TableOfContents</key> - <array> - <string>1C78EAA5065D492600B07095</string> - <string>1C78EAA6065D492600B07095</string> - <string>1CD0528F0623707200166675</string> - <string>XCMainBuildResultsModuleGUID</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.buildV3</string> - <key>WindowString</key> - <string>192 257 500 500 0 0 1280 1002 </string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.debugger</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>Debugger</key> - <dict> - <key>HorizontalSplitView</key> - <dict> - <key>_collapsingFrameDimension</key> - <real>0.0</real> - <key>_indexOfCollapsedView</key> - <integer>0</integer> - <key>_percentageOfCollapsedView</key> - <real>0.0</real> - <key>isCollapsed</key> - <string>yes</string> - <key>sizes</key> - <array> - <string>{{0, 0}, {317, 164}}</string> - <string>{{317, 0}, {377, 164}}</string> - </array> - </dict> - <key>VerticalSplitView</key> - <dict> - <key>_collapsingFrameDimension</key> - <real>0.0</real> - <key>_indexOfCollapsedView</key> - <integer>0</integer> - <key>_percentageOfCollapsedView</key> - <real>0.0</real> - <key>isCollapsed</key> - <string>yes</string> - <key>sizes</key> - <array> - <string>{{0, 0}, {694, 164}}</string> - <string>{{0, 164}, {694, 216}}</string> - </array> - </dict> - </dict> - <key>LauncherConfigVersion</key> - <string>8</string> - <key>PBXProjectModuleGUID</key> - <string>1C162984064C10D400B95A72</string> - <key>PBXProjectModuleLabel</key> - <string>Debug - GLUTExamples (Underwater)</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>DebugConsoleDrawerSize</key> - <string>{100, 120}</string> - <key>DebugConsoleVisible</key> - <string>None</string> - <key>DebugConsoleWindowFrame</key> - <string>{{200, 200}, {500, 300}}</string> - <key>DebugSTDIOWindowFrame</key> - <string>{{200, 200}, {500, 300}}</string> - <key>Frame</key> - <string>{{0, 0}, {694, 380}}</string> - <key>RubberWindowFrame</key> - <string>321 238 694 422 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXDebugSessionModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Debugger</string> - <key>ServiceClasses</key> - <array> - <string>PBXDebugSessionModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>TableOfContents</key> - <array> - <string>1CD10A99069EF8BA00B06720</string> - <string>1C0AD2AB069F1E9B00FABCE6</string> - <string>1C162984064C10D400B95A72</string> - <string>1C0AD2AC069F1E9B00FABCE6</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.debugV3</string> - <key>WindowString</key> - <string>321 238 694 422 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>1CD10A99069EF8BA00B06720</string> - <key>WindowToolIsVisible</key> - <integer>0</integer> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.find</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CDD528C0622207200134675</string> - <key>PBXProjectModuleLabel</key> - <string>&lt;No Editor&gt;</string> - <key>PBXSplitModuleInNavigatorKey</key> - <dict> - <key>Split0</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CD0528D0623707200166675</string> - </dict> - <key>SplitCount</key> - <string>1</string> - </dict> - <key>StatusBarVisibility</key> - <integer>1</integer> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {781, 167}}</string> - <key>RubberWindowFrame</key> - <string>62 385 781 470 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>781pt</string> - </dict> - </array> - <key>Proportion</key> - <string>50%</string> - </dict> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CD0528E0623707200166675</string> - <key>PBXProjectModuleLabel</key> - <string>Project Find</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{8, 0}, {773, 254}}</string> - <key>RubberWindowFrame</key> - <string>62 385 781 470 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXProjectFindModule</string> - <key>Proportion</key> - <string>50%</string> - </dict> - </array> - <key>Proportion</key> - <string>428pt</string> - </dict> - </array> - <key>Name</key> - <string>Project Find</string> - <key>ServiceClasses</key> - <array> - <string>PBXProjectFindModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>TableOfContents</key> - <array> - <string>1C530D57069F1CE1000CFCEE</string> - <string>1C530D58069F1CE1000CFCEE</string> - <string>1C530D59069F1CE1000CFCEE</string> - <string>1CDD528C0622207200134675</string> - <string>1C530D5A069F1CE1000CFCEE</string> - <string>1CE0B1FE06471DED0097A5F4</string> - <string>1CD0528E0623707200166675</string> - </array> - <key>WindowString</key> - <string>62 385 781 470 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>1C530D57069F1CE1000CFCEE</string> - <key>WindowToolIsVisible</key> - <integer>0</integer> - </dict> - <dict> - <key>Identifier</key> - <string>MENUSEPARATOR</string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.debuggerConsole</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1C78EAAC065D492600B07095</string> - <key>PBXProjectModuleLabel</key> - <string>Debugger Console</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {650, 250}}</string> - <key>RubberWindowFrame</key> - <string>516 632 650 250 0 0 1680 1027 </string> - </dict> - <key>Module</key> - <string>PBXDebugCLIModule</string> - <key>Proportion</key> - <string>209pt</string> - </dict> - </array> - <key>Proportion</key> - <string>209pt</string> - </dict> - </array> - <key>Name</key> - <string>Debugger Console</string> - <key>ServiceClasses</key> - <array> - <string>PBXDebugCLIModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>TableOfContents</key> - <array> - <string>1C78EAAD065D492600B07095</string> - <string>1C78EAAE065D492600B07095</string> - <string>1C78EAAC065D492600B07095</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.consoleV3</string> - <key>WindowString</key> - <string>650 41 650 250 0 0 1280 1002 </string> - <key>WindowToolGUID</key> - <string>1C78EAAD065D492600B07095</string> - <key>WindowToolIsVisible</key> - <integer>0</integer> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.snapshots</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Module</key> - <string>XCSnapshotModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Snapshots</string> - <key>ServiceClasses</key> - <array> - <string>XCSnapshotModule</string> - </array> - <key>StatusbarIsVisible</key> - <string>Yes</string> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.snapshots</string> - <key>WindowString</key> - <string>315 824 300 550 0 0 1440 878 </string> - <key>WindowToolIsVisible</key> - <string>Yes</string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.scm</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1C78EAB2065D492600B07095</string> - <key>PBXProjectModuleLabel</key> - <string>&lt;No Editor&gt;</string> - <key>PBXSplitModuleInNavigatorKey</key> - <dict> - <key>Split0</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1C78EAB3065D492600B07095</string> - </dict> - <key>SplitCount</key> - <string>1</string> - </dict> - <key>StatusBarVisibility</key> - <integer>1</integer> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {452, 0}}</string> - <key>RubberWindowFrame</key> - <string>743 379 452 308 0 0 1280 1002 </string> - </dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>0pt</string> - </dict> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CD052920623707200166675</string> - <key>PBXProjectModuleLabel</key> - <string>SCM</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>ConsoleFrame</key> - <string>{{0, 259}, {452, 0}}</string> - <key>Frame</key> - <string>{{0, 7}, {452, 259}}</string> - <key>RubberWindowFrame</key> - <string>743 379 452 308 0 0 1280 1002 </string> - <key>TableConfiguration</key> - <array> - <string>Status</string> - <real>30</real> - <string>FileName</string> - <real>199</real> - <string>Path</string> - <real>197.0950012207031</real> - </array> - <key>TableFrame</key> - <string>{{0, 0}, {452, 250}}</string> - </dict> - <key>Module</key> - <string>PBXCVSModule</string> - <key>Proportion</key> - <string>262pt</string> - </dict> - </array> - <key>Proportion</key> - <string>266pt</string> - </dict> - </array> - <key>Name</key> - <string>SCM</string> - <key>ServiceClasses</key> - <array> - <string>PBXCVSModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>TableOfContents</key> - <array> - <string>1C78EAB4065D492600B07095</string> - <string>1C78EAB5065D492600B07095</string> - <string>1C78EAB2065D492600B07095</string> - <string>1CD052920623707200166675</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.scm</string> - <key>WindowString</key> - <string>743 379 452 308 0 0 1280 1002 </string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.breakpoints</string> - <key>IsVertical</key> - <integer>0</integer> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXBottomSmartGroupGIDs</key> - <array> - <string>1C77FABC04509CD000000102</string> - </array> - <key>PBXProjectModuleGUID</key> - <string>1CE0B1FE06471DED0097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>Files</string> - <key>PBXProjectStructureProvided</key> - <string>no</string> - <key>PBXSmartGroupTreeModuleColumnData</key> - <dict> - <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> - <array> - <real>168</real> - </array> - <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> - <array> - <string>MainColumn</string> - </array> - </dict> - <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> - <dict> - <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> - <array> - <string>1C77FABC04509CD000000102</string> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> - <array> - <array> - <integer>0</integer> - </array> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {168, 350}}</string> - </dict> - <key>PBXTopSmartGroupGIDs</key> - <array/> - <key>XCIncludePerspectivesSwitch</key> - <integer>0</integer> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {185, 368}}</string> - <key>GroupTreeTableConfiguration</key> - <array> - <string>MainColumn</string> - <real>168</real> - </array> - <key>RubberWindowFrame</key> - <string>315 424 744 409 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXSmartGroupTreeModule</string> - <key>Proportion</key> - <string>185pt</string> - </dict> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CA1AED706398EBD00589147</string> - <key>PBXProjectModuleLabel</key> - <string>Detail</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{190, 0}, {554, 368}}</string> - <key>RubberWindowFrame</key> - <string>315 424 744 409 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>XCDetailModule</string> - <key>Proportion</key> - <string>554pt</string> - </dict> - </array> - <key>Proportion</key> - <string>368pt</string> - </dict> - </array> - <key>MajorVersion</key> - <integer>3</integer> - <key>MinorVersion</key> - <integer>0</integer> - <key>Name</key> - <string>Breakpoints</string> - <key>ServiceClasses</key> - <array> - <string>PBXSmartGroupTreeModule</string> - <string>XCDetailModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>TableOfContents</key> - <array> - <string>1CDDB66807F98D9800BB5817</string> - <string>1CDDB66907F98D9800BB5817</string> - <string>1CE0B1FE06471DED0097A5F4</string> - <string>1CA1AED706398EBD00589147</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.breakpointsV3</string> - <key>WindowString</key> - <string>315 424 744 409 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>1CDDB66807F98D9800BB5817</string> - <key>WindowToolIsVisible</key> - <integer>1</integer> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.debugAnimator</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Debug Visualizer</string> - <key>ServiceClasses</key> - <array> - <string>PBXNavigatorGroup</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.debugAnimatorV3</string> - <key>WindowString</key> - <string>100 100 700 500 0 0 1280 1002 </string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.bookmarks</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Module</key> - <string>PBXBookmarksModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Bookmarks</string> - <key>ServiceClasses</key> - <array> - <string>PBXBookmarksModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>0</integer> - <key>WindowString</key> - <string>538 42 401 187 0 0 1280 1002 </string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.projectFormatConflicts</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Module</key> - <string>XCProjectFormatConflictsModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Project Format Conflicts</string> - <key>ServiceClasses</key> - <array> - <string>XCProjectFormatConflictsModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>0</integer> - <key>WindowContentMinSize</key> - <string>450 300</string> - <key>WindowString</key> - <string>50 850 472 307 0 0 1440 877</string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.classBrowser</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>OptionsSetName</key> - <string>Hierarchy, all classes</string> - <key>PBXProjectModuleGUID</key> - <string>1CA6456E063B45B4001379D8</string> - <key>PBXProjectModuleLabel</key> - <string>Class Browser - NSObject</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>ClassesFrame</key> - <string>{{0, 0}, {374, 96}}</string> - <key>ClassesTreeTableConfiguration</key> - <array> - <string>PBXClassNameColumnIdentifier</string> - <real>208</real> - <string>PBXClassBookColumnIdentifier</string> - <real>22</real> - </array> - <key>Frame</key> - <string>{{0, 0}, {630, 331}}</string> - <key>MembersFrame</key> - <string>{{0, 105}, {374, 395}}</string> - <key>MembersTreeTableConfiguration</key> - <array> - <string>PBXMemberTypeIconColumnIdentifier</string> - <real>22</real> - <string>PBXMemberNameColumnIdentifier</string> - <real>216</real> - <string>PBXMemberTypeColumnIdentifier</string> - <real>97</real> - <string>PBXMemberBookColumnIdentifier</string> - <real>22</real> - </array> - <key>PBXModuleWindowStatusBarHidden2</key> - <integer>1</integer> - <key>RubberWindowFrame</key> - <string>385 179 630 352 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXClassBrowserModule</string> - <key>Proportion</key> - <string>332pt</string> - </dict> - </array> - <key>Proportion</key> - <string>332pt</string> - </dict> - </array> - <key>Name</key> - <string>Class Browser</string> - <key>ServiceClasses</key> - <array> - <string>PBXClassBrowserModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>0</integer> - <key>TableOfContents</key> - <array> - <string>1C0AD2AF069F1E9B00FABCE6</string> - <string>1C0AD2B0069F1E9B00FABCE6</string> - <string>1CA6456E063B45B4001379D8</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.classbrowser</string> - <key>WindowString</key> - <string>385 179 630 352 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>1C0AD2AF069F1E9B00FABCE6</string> - <key>WindowToolIsVisible</key> - <integer>0</integer> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.refactoring</string> - <key>IncludeInToolsMenu</key> - <integer>0</integer> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{0, 0}, {500, 335}</string> - <key>RubberWindowFrame</key> - <string>{0, 0}, {500, 335}</string> - </dict> - <key>Module</key> - <string>XCRefactoringModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Refactoring</string> - <key>ServiceClasses</key> - <array> - <string>XCRefactoringModule</string> - </array> - <key>WindowString</key> - <string>200 200 500 356 0 0 1920 1200 </string> - </dict> - </array> -</dict> -</plist> diff --git a/Eko/Eko.xcodeproj/jnordberg.pbxuser b/Eko/Eko.xcodeproj/jnordberg.pbxuser deleted file mode 100644 index 9141ec9..0000000 --- a/Eko/Eko.xcodeproj/jnordberg.pbxuser +++ /dev/null @@ -1,85 +0,0 @@ -// !$*UTF8*$! -{ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - activeBuildConfigurationName = Debug; - activeExecutable = A5501C83102F4B8700A02BF0 /* Eko */; - activeTarget = 8D1107260486CEB800E47090 /* Eko */; - addToTargets = ( - 8D1107260486CEB800E47090 /* Eko */, - ); - codeSenseManager = A5501C8C102F4B8C00A02BF0 /* Code sense */; - executables = ( - A5501C83102F4B8700A02BF0 /* Eko */, - ); - perUserDictionary = { - PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 341, - 20, - 48.16259765625, - 43, - 43, - 20, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - PBXFileDataSource_Target_ColumnID, - ); - }; - PBXPerProjectTemplateStateSaveDate = 271534983; - PBXWorkspaceStateSaveDate = 271534983; - }; - sourceControlManager = A5501C8B102F4B8C00A02BF0 /* Source Control */; - userBuildSettings = { - }; - }; - 8D1107260486CEB800E47090 /* Eko */ = { - activeExec = 0; - executables = ( - A5501C83102F4B8700A02BF0 /* Eko */, - ); - }; - A5501C83102F4B8700A02BF0 /* Eko */ = { - isa = PBXExecutable; - activeArgIndices = ( - ); - argumentStrings = ( - ); - autoAttachOnCrash = 1; - breakpointsEnabled = 0; - configStateDict = { - }; - customDataFormattersEnabled = 1; - debuggerPlugin = GDBDebugging; - disassemblyDisplayState = 0; - dylibVariantSuffix = ""; - enableDebugStr = 1; - environmentEntries = ( - ); - executableSystemSymbolLevel = 0; - executableUserSymbolLevel = 0; - libgmallocEnabled = 0; - name = Eko; - sourceDirectories = ( - ); - }; - A5501C8B102F4B8C00A02BF0 /* Source Control */ = { - isa = PBXSourceControlManager; - fallbackIsa = XCSourceControlManager; - isSCMEnabled = 0; - scmConfiguration = { - }; - }; - A5501C8C102F4B8C00A02BF0 /* Code sense */ = { - isa = PBXCodeSenseManager; - indexTemplatePath = ""; - }; -} diff --git a/Eko/Eko.xcodeproj/lericson.mode1v3 b/Eko/Eko.xcodeproj/lericson.mode1v3 deleted file mode 100644 index 0af20a3..0000000 --- a/Eko/Eko.xcodeproj/lericson.mode1v3 +++ /dev/null @@ -1,1402 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>ActivePerspectiveName</key> - <string>Project</string> - <key>AllowedModules</key> - <array> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXSmartGroupTreeModule</string> - <key>Name</key> - <string>Groups and Files Outline View</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Name</key> - <string>Editor</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCTaskListModule</string> - <key>Name</key> - <string>Task List</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCDetailModule</string> - <key>Name</key> - <string>File and Smart Group Detail Viewer</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>1</string> - <key>Module</key> - <string>PBXBuildResultsModule</string> - <key>Name</key> - <string>Detailed Build Results Viewer</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>1</string> - <key>Module</key> - <string>PBXProjectFindModule</string> - <key>Name</key> - <string>Project Batch Find Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCProjectFormatConflictsModule</string> - <key>Name</key> - <string>Project Format Conflicts List</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXBookmarksModule</string> - <key>Name</key> - <string>Bookmarks Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXClassBrowserModule</string> - <key>Name</key> - <string>Class Browser</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXCVSModule</string> - <key>Name</key> - <string>Source Code Control Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXDebugBreakpointsModule</string> - <key>Name</key> - <string>Debug Breakpoints Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCDockableInspector</string> - <key>Name</key> - <string>Inspector</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>PBXOpenQuicklyModule</string> - <key>Name</key> - <string>Open Quickly Tool</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>1</string> - <key>Module</key> - <string>PBXDebugSessionModule</string> - <key>Name</key> - <string>Debugger</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>1</string> - <key>Module</key> - <string>PBXDebugCLIModule</string> - <key>Name</key> - <string>Debug Console</string> - </dict> - <dict> - <key>BundleLoadPath</key> - <string></string> - <key>MaxInstances</key> - <string>n</string> - <key>Module</key> - <string>XCSnapshotModule</string> - <key>Name</key> - <string>Snapshots Tool</string> - </dict> - </array> - <key>BundlePath</key> - <string>/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources</string> - <key>Description</key> - <string>DefaultDescriptionKey</string> - <key>DockingSystemVisible</key> - <false/> - <key>Extension</key> - <string>mode1v3</string> - <key>FavBarConfig</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>2438EA74102F6367004A851C</string> - <key>XCBarModuleItemNames</key> - <dict/> - <key>XCBarModuleItems</key> - <array/> - </dict> - <key>FirstTimeWindowDisplayed</key> - <false/> - <key>Identifier</key> - <string>com.apple.perspectives.project.mode1v3</string> - <key>MajorVersion</key> - <integer>33</integer> - <key>MinorVersion</key> - <integer>0</integer> - <key>Name</key> - <string>Default</string> - <key>Notifications</key> - <array/> - <key>OpenEditors</key> - <array/> - <key>PerspectiveWidths</key> - <array> - <integer>-1</integer> - <integer>-1</integer> - </array> - <key>Perspectives</key> - <array> - <dict> - <key>ChosenToolbarItems</key> - <array> - <string>active-buildstyle-popup</string> - <string>action</string> - <string>NSToolbarFlexibleSpaceItem</string> - <string>buildOrClean</string> - <string>build-and-goOrGo</string> - <string>com.apple.ide.PBXToolbarStopButton</string> - <string>get-info</string> - <string>toggle-editor</string> - <string>NSToolbarFlexibleSpaceItem</string> - <string>com.apple.pbx.toolbar.searchfield</string> - </array> - <key>ControllerClassBaseName</key> - <string></string> - <key>IconName</key> - <string>WindowOfProjectWithEditor</string> - <key>Identifier</key> - <string>perspective.project</string> - <key>IsVertical</key> - <false/> - <key>Layout</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXBottomSmartGroupGIDs</key> - <array> - <string>1C37FBAC04509CD000000102</string> - <string>1C37FAAC04509CD000000102</string> - <string>1C08E77C0454961000C914BD</string> - <string>1C37FABC05509CD000000102</string> - <string>1C37FABC05539CD112110102</string> - <string>E2644B35053B69B200211256</string> - <string>1C37FABC04509CD000100104</string> - <string>1CC0EA4004350EF90044410B</string> - <string>1CC0EA4004350EF90041110B</string> - </array> - <key>PBXProjectModuleGUID</key> - <string>1CE0B1FE06471DED0097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>Files</string> - <key>PBXProjectStructureProvided</key> - <string>yes</string> - <key>PBXSmartGroupTreeModuleColumnData</key> - <dict> - <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> - <array> - <real>186</real> - </array> - <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> - <array> - <string>MainColumn</string> - </array> - </dict> - <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> - <dict> - <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> - <array> - <string>29B97314FDCFA39411CA2CEA</string> - <string>1C37FABC05509CD000000102</string> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> - <array> - <array> - <integer>0</integer> - </array> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {186, 445}}</string> - </dict> - <key>PBXTopSmartGroupGIDs</key> - <array/> - <key>XCIncludePerspectivesSwitch</key> - <true/> - <key>XCSharingToken</key> - <string>com.apple.Xcode.GFSharingToken</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {203, 463}}</string> - <key>GroupTreeTableConfiguration</key> - <array> - <string>MainColumn</string> - <real>186</real> - </array> - <key>RubberWindowFrame</key> - <string>326 315 788 504 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXSmartGroupTreeModule</string> - <key>Proportion</key> - <string>203pt</string> - </dict> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CE0B20306471E060097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>main.py</string> - <key>PBXSplitModuleInNavigatorKey</key> - <dict> - <key>Split0</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CE0B20406471E060097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>main.py</string> - <key>_historyCapacity</key> - <integer>0</integer> - <key>bookmark</key> - <string>24812E4E102FA0C3003B1D41</string> - <key>history</key> - <array> - <string>2438EAD3102F76B8004A851C</string> - <string>2438EAE7102F95F7004A851C</string> - <string>2438EB14102FA0AF004A851C</string> - <string>2438EB15102FA0AF004A851C</string> - <string>2438EB16102FA0AF004A851C</string> - <string>2438EB1B102FA0AF004A851C</string> - </array> - <key>prevStack</key> - <array> - <string>2438EAA5102F7033004A851C</string> - <string>2438EAA6102F7033004A851C</string> - <string>2438EAA7102F7033004A851C</string> - <string>2438EAE9102F95F7004A851C</string> - <string>2438EB19102FA0AF004A851C</string> - <string>2438EB1A102FA0AF004A851C</string> - </array> - </dict> - <key>SplitCount</key> - <string>1</string> - </dict> - <key>StatusBarVisibility</key> - <true/> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {580, 0}}</string> - <key>RubberWindowFrame</key> - <string>326 315 788 504 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>0pt</string> - </dict> - <dict> - <key>BecomeActive</key> - <true/> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CE0B20506471E060097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>Detail</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 5}, {580, 458}}</string> - <key>RubberWindowFrame</key> - <string>326 315 788 504 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>XCDetailModule</string> - <key>Proportion</key> - <string>458pt</string> - </dict> - </array> - <key>Proportion</key> - <string>580pt</string> - </dict> - </array> - <key>Name</key> - <string>Project</string> - <key>ServiceClasses</key> - <array> - <string>XCModuleDock</string> - <string>PBXSmartGroupTreeModule</string> - <string>XCModuleDock</string> - <string>PBXNavigatorGroup</string> - <string>XCDetailModule</string> - </array> - <key>TableOfContents</key> - <array> - <string>24812E4F102FA0C3003B1D41</string> - <string>1CE0B1FE06471DED0097A5F4</string> - <string>24812E50102FA0C3003B1D41</string> - <string>1CE0B20306471E060097A5F4</string> - <string>1CE0B20506471E060097A5F4</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.defaultV3</string> - </dict> - <dict> - <key>ControllerClassBaseName</key> - <string></string> - <key>IconName</key> - <string>WindowOfProject</string> - <key>Identifier</key> - <string>perspective.morph</string> - <key>IsVertical</key> - <integer>0</integer> - <key>Layout</key> - <array> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXBottomSmartGroupGIDs</key> - <array> - <string>1C37FBAC04509CD000000102</string> - <string>1C37FAAC04509CD000000102</string> - <string>1C08E77C0454961000C914BD</string> - <string>1C37FABC05509CD000000102</string> - <string>1C37FABC05539CD112110102</string> - <string>E2644B35053B69B200211256</string> - <string>1C37FABC04509CD000100104</string> - <string>1CC0EA4004350EF90044410B</string> - <string>1CC0EA4004350EF90041110B</string> - </array> - <key>PBXProjectModuleGUID</key> - <string>11E0B1FE06471DED0097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>Files</string> - <key>PBXProjectStructureProvided</key> - <string>yes</string> - <key>PBXSmartGroupTreeModuleColumnData</key> - <dict> - <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> - <array> - <real>186</real> - </array> - <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> - <array> - <string>MainColumn</string> - </array> - </dict> - <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> - <dict> - <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> - <array> - <string>29B97314FDCFA39411CA2CEA</string> - <string>1C37FABC05509CD000000102</string> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> - <array> - <array> - <integer>0</integer> - </array> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {186, 337}}</string> - </dict> - <key>PBXTopSmartGroupGIDs</key> - <array/> - <key>XCIncludePerspectivesSwitch</key> - <integer>1</integer> - <key>XCSharingToken</key> - <string>com.apple.Xcode.GFSharingToken</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {203, 355}}</string> - <key>GroupTreeTableConfiguration</key> - <array> - <string>MainColumn</string> - <real>186</real> - </array> - <key>RubberWindowFrame</key> - <string>373 269 690 397 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXSmartGroupTreeModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Morph</string> - <key>PreferredWidth</key> - <integer>300</integer> - <key>ServiceClasses</key> - <array> - <string>XCModuleDock</string> - <string>PBXSmartGroupTreeModule</string> - </array> - <key>TableOfContents</key> - <array> - <string>11E0B1FE06471DED0097A5F4</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.default.shortV3</string> - </dict> - </array> - <key>PerspectivesBarVisible</key> - <false/> - <key>ShelfIsVisible</key> - <false/> - <key>SourceDescription</key> - <string>file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec'</string> - <key>StatusbarIsVisible</key> - <true/> - <key>TimeStamp</key> - <real>0.0</real> - <key>ToolbarDisplayMode</key> - <integer>1</integer> - <key>ToolbarIsVisible</key> - <true/> - <key>ToolbarSizeMode</key> - <integer>1</integer> - <key>Type</key> - <string>Perspectives</string> - <key>UpdateMessage</key> - <string>The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'?</string> - <key>WindowJustification</key> - <integer>5</integer> - <key>WindowOrderList</key> - <array> - <string>/Users/ludvigericson/Development/eko/Eko/Eko.xcodeproj</string> - </array> - <key>WindowString</key> - <string>326 315 788 504 0 0 1440 878 </string> - <key>WindowToolsV3</key> - <array> - <dict> - <key>FirstTimeWindowDisplayed</key> - <false/> - <key>Identifier</key> - <string>windowTool.build</string> - <key>IsVertical</key> - <true/> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CD0528F0623707200166675</string> - <key>PBXProjectModuleLabel</key> - <string></string> - <key>StatusBarVisibility</key> - <true/> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {500, 218}}</string> - <key>RubberWindowFrame</key> - <string>347 296 500 500 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>218pt</string> - </dict> - <dict> - <key>BecomeActive</key> - <true/> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>XCMainBuildResultsModuleGUID</string> - <key>PBXProjectModuleLabel</key> - <string>Build</string> - <key>XCBuildResultsTrigger_Collapse</key> - <integer>1021</integer> - <key>XCBuildResultsTrigger_Open</key> - <integer>1011</integer> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 223}, {500, 236}}</string> - <key>RubberWindowFrame</key> - <string>347 296 500 500 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXBuildResultsModule</string> - <key>Proportion</key> - <string>236pt</string> - </dict> - </array> - <key>Proportion</key> - <string>459pt</string> - </dict> - </array> - <key>Name</key> - <string>Build Results</string> - <key>ServiceClasses</key> - <array> - <string>PBXBuildResultsModule</string> - </array> - <key>StatusbarIsVisible</key> - <true/> - <key>TableOfContents</key> - <array> - <string>2438EA86102F69A0004A851C</string> - <string>2438EA87102F69A0004A851C</string> - <string>1CD0528F0623707200166675</string> - <string>XCMainBuildResultsModuleGUID</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.buildV3</string> - <key>WindowString</key> - <string>347 296 500 500 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>2438EA86102F69A0004A851C</string> - <key>WindowToolIsVisible</key> - <false/> - </dict> - <dict> - <key>FirstTimeWindowDisplayed</key> - <false/> - <key>Identifier</key> - <string>windowTool.debugger</string> - <key>IsVertical</key> - <true/> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>Debugger</key> - <dict> - <key>HorizontalSplitView</key> - <dict> - <key>_collapsingFrameDimension</key> - <real>0.0</real> - <key>_indexOfCollapsedView</key> - <integer>0</integer> - <key>_percentageOfCollapsedView</key> - <real>0.0</real> - <key>isCollapsed</key> - <string>yes</string> - <key>sizes</key> - <array> - <string>{{0, 0}, {316, 185}}</string> - <string>{{316, 0}, {378, 185}}</string> - </array> - </dict> - <key>VerticalSplitView</key> - <dict> - <key>_collapsingFrameDimension</key> - <real>0.0</real> - <key>_indexOfCollapsedView</key> - <integer>0</integer> - <key>_percentageOfCollapsedView</key> - <real>0.0</real> - <key>isCollapsed</key> - <string>yes</string> - <key>sizes</key> - <array> - <string>{{0, 0}, {694, 185}}</string> - <string>{{0, 185}, {694, 196}}</string> - </array> - </dict> - </dict> - <key>LauncherConfigVersion</key> - <string>8</string> - <key>PBXProjectModuleGUID</key> - <string>1C162984064C10D400B95A72</string> - <key>PBXProjectModuleLabel</key> - <string>Debug - GLUTExamples (Underwater)</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>DebugConsoleVisible</key> - <string>None</string> - <key>DebugConsoleWindowFrame</key> - <string>{{200, 200}, {500, 300}}</string> - <key>DebugSTDIOWindowFrame</key> - <string>{{200, 200}, {500, 300}}</string> - <key>Frame</key> - <string>{{0, 0}, {694, 381}}</string> - <key>PBXDebugSessionStackFrameViewKey</key> - <dict> - <key>DebugVariablesTableConfiguration</key> - <array> - <string>Name</string> - <real>120</real> - <string>Value</string> - <real>85</real> - <string>Summary</string> - <real>148</real> - </array> - <key>Frame</key> - <string>{{316, 0}, {378, 185}}</string> - <key>RubberWindowFrame</key> - <string>347 374 694 422 0 0 1440 878 </string> - </dict> - <key>RubberWindowFrame</key> - <string>347 374 694 422 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXDebugSessionModule</string> - <key>Proportion</key> - <string>381pt</string> - </dict> - </array> - <key>Proportion</key> - <string>381pt</string> - </dict> - </array> - <key>Name</key> - <string>Debugger</string> - <key>ServiceClasses</key> - <array> - <string>PBXDebugSessionModule</string> - </array> - <key>StatusbarIsVisible</key> - <true/> - <key>TableOfContents</key> - <array> - <string>1CD10A99069EF8BA00B06720</string> - <string>2438EA88102F69A0004A851C</string> - <string>1C162984064C10D400B95A72</string> - <string>2438EA89102F69A0004A851C</string> - <string>2438EA8A102F69A0004A851C</string> - <string>2438EA8B102F69A0004A851C</string> - <string>2438EA8C102F69A0004A851C</string> - <string>2438EA8D102F69A0004A851C</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.debugV3</string> - <key>WindowString</key> - <string>347 374 694 422 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>1CD10A99069EF8BA00B06720</string> - <key>WindowToolIsVisible</key> - <false/> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.find</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CDD528C0622207200134675</string> - <key>PBXProjectModuleLabel</key> - <string>&lt;No Editor&gt;</string> - <key>PBXSplitModuleInNavigatorKey</key> - <dict> - <key>Split0</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CD0528D0623707200166675</string> - </dict> - <key>SplitCount</key> - <string>1</string> - </dict> - <key>StatusBarVisibility</key> - <integer>1</integer> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {781, 167}}</string> - <key>RubberWindowFrame</key> - <string>62 385 781 470 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>781pt</string> - </dict> - </array> - <key>Proportion</key> - <string>50%</string> - </dict> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CD0528E0623707200166675</string> - <key>PBXProjectModuleLabel</key> - <string>Project Find</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{8, 0}, {773, 254}}</string> - <key>RubberWindowFrame</key> - <string>62 385 781 470 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXProjectFindModule</string> - <key>Proportion</key> - <string>50%</string> - </dict> - </array> - <key>Proportion</key> - <string>428pt</string> - </dict> - </array> - <key>Name</key> - <string>Project Find</string> - <key>ServiceClasses</key> - <array> - <string>PBXProjectFindModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>TableOfContents</key> - <array> - <string>1C530D57069F1CE1000CFCEE</string> - <string>1C530D58069F1CE1000CFCEE</string> - <string>1C530D59069F1CE1000CFCEE</string> - <string>1CDD528C0622207200134675</string> - <string>1C530D5A069F1CE1000CFCEE</string> - <string>1CE0B1FE06471DED0097A5F4</string> - <string>1CD0528E0623707200166675</string> - </array> - <key>WindowString</key> - <string>62 385 781 470 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>1C530D57069F1CE1000CFCEE</string> - <key>WindowToolIsVisible</key> - <integer>0</integer> - </dict> - <dict> - <key>Identifier</key> - <string>MENUSEPARATOR</string> - </dict> - <dict> - <key>FirstTimeWindowDisplayed</key> - <false/> - <key>Identifier</key> - <string>windowTool.debuggerConsole</string> - <key>IsVertical</key> - <true/> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>BecomeActive</key> - <true/> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1C78EAAC065D492600B07095</string> - <key>PBXProjectModuleLabel</key> - <string>Debugger Console</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {650, 209}}</string> - <key>RubberWindowFrame</key> - <string>347 546 650 250 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXDebugCLIModule</string> - <key>Proportion</key> - <string>209pt</string> - </dict> - </array> - <key>Proportion</key> - <string>209pt</string> - </dict> - </array> - <key>Name</key> - <string>Debugger Console</string> - <key>ServiceClasses</key> - <array> - <string>PBXDebugCLIModule</string> - </array> - <key>StatusbarIsVisible</key> - <true/> - <key>TableOfContents</key> - <array> - <string>1C78EAAD065D492600B07095</string> - <string>2438EA8E102F69A0004A851C</string> - <string>1C78EAAC065D492600B07095</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.consoleV3</string> - <key>WindowString</key> - <string>347 546 650 250 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>1C78EAAD065D492600B07095</string> - <key>WindowToolIsVisible</key> - <true/> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.snapshots</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Module</key> - <string>XCSnapshotModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Snapshots</string> - <key>ServiceClasses</key> - <array> - <string>XCSnapshotModule</string> - </array> - <key>StatusbarIsVisible</key> - <string>Yes</string> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.snapshots</string> - <key>WindowString</key> - <string>315 824 300 550 0 0 1440 878 </string> - <key>WindowToolIsVisible</key> - <string>Yes</string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.scm</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1C78EAB2065D492600B07095</string> - <key>PBXProjectModuleLabel</key> - <string>&lt;No Editor&gt;</string> - <key>PBXSplitModuleInNavigatorKey</key> - <dict> - <key>Split0</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1C78EAB3065D492600B07095</string> - </dict> - <key>SplitCount</key> - <string>1</string> - </dict> - <key>StatusBarVisibility</key> - <integer>1</integer> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {452, 0}}</string> - <key>RubberWindowFrame</key> - <string>743 379 452 308 0 0 1280 1002 </string> - </dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>0pt</string> - </dict> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CD052920623707200166675</string> - <key>PBXProjectModuleLabel</key> - <string>SCM</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>ConsoleFrame</key> - <string>{{0, 259}, {452, 0}}</string> - <key>Frame</key> - <string>{{0, 7}, {452, 259}}</string> - <key>RubberWindowFrame</key> - <string>743 379 452 308 0 0 1280 1002 </string> - <key>TableConfiguration</key> - <array> - <string>Status</string> - <real>30</real> - <string>FileName</string> - <real>199</real> - <string>Path</string> - <real>197.0950012207031</real> - </array> - <key>TableFrame</key> - <string>{{0, 0}, {452, 250}}</string> - </dict> - <key>Module</key> - <string>PBXCVSModule</string> - <key>Proportion</key> - <string>262pt</string> - </dict> - </array> - <key>Proportion</key> - <string>266pt</string> - </dict> - </array> - <key>Name</key> - <string>SCM</string> - <key>ServiceClasses</key> - <array> - <string>PBXCVSModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>TableOfContents</key> - <array> - <string>1C78EAB4065D492600B07095</string> - <string>1C78EAB5065D492600B07095</string> - <string>1C78EAB2065D492600B07095</string> - <string>1CD052920623707200166675</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.scm</string> - <key>WindowString</key> - <string>743 379 452 308 0 0 1280 1002 </string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.breakpoints</string> - <key>IsVertical</key> - <integer>0</integer> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>PBXBottomSmartGroupGIDs</key> - <array> - <string>1C77FABC04509CD000000102</string> - </array> - <key>PBXProjectModuleGUID</key> - <string>1CE0B1FE06471DED0097A5F4</string> - <key>PBXProjectModuleLabel</key> - <string>Files</string> - <key>PBXProjectStructureProvided</key> - <string>no</string> - <key>PBXSmartGroupTreeModuleColumnData</key> - <dict> - <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> - <array> - <real>168</real> - </array> - <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> - <array> - <string>MainColumn</string> - </array> - </dict> - <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> - <dict> - <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> - <array> - <string>1C77FABC04509CD000000102</string> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> - <array> - <array> - <integer>0</integer> - </array> - </array> - <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {168, 350}}</string> - </dict> - <key>PBXTopSmartGroupGIDs</key> - <array/> - <key>XCIncludePerspectivesSwitch</key> - <integer>0</integer> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{0, 0}, {185, 368}}</string> - <key>GroupTreeTableConfiguration</key> - <array> - <string>MainColumn</string> - <real>168</real> - </array> - <key>RubberWindowFrame</key> - <string>315 424 744 409 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXSmartGroupTreeModule</string> - <key>Proportion</key> - <string>185pt</string> - </dict> - <dict> - <key>ContentConfiguration</key> - <dict> - <key>PBXProjectModuleGUID</key> - <string>1CA1AED706398EBD00589147</string> - <key>PBXProjectModuleLabel</key> - <string>Detail</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{{190, 0}, {554, 368}}</string> - <key>RubberWindowFrame</key> - <string>315 424 744 409 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>XCDetailModule</string> - <key>Proportion</key> - <string>554pt</string> - </dict> - </array> - <key>Proportion</key> - <string>368pt</string> - </dict> - </array> - <key>MajorVersion</key> - <integer>3</integer> - <key>MinorVersion</key> - <integer>0</integer> - <key>Name</key> - <string>Breakpoints</string> - <key>ServiceClasses</key> - <array> - <string>PBXSmartGroupTreeModule</string> - <string>XCDetailModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>TableOfContents</key> - <array> - <string>1CDDB66807F98D9800BB5817</string> - <string>1CDDB66907F98D9800BB5817</string> - <string>1CE0B1FE06471DED0097A5F4</string> - <string>1CA1AED706398EBD00589147</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.breakpointsV3</string> - <key>WindowString</key> - <string>315 424 744 409 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>1CDDB66807F98D9800BB5817</string> - <key>WindowToolIsVisible</key> - <integer>1</integer> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.debugAnimator</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Module</key> - <string>PBXNavigatorGroup</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Debug Visualizer</string> - <key>ServiceClasses</key> - <array> - <string>PBXNavigatorGroup</string> - </array> - <key>StatusbarIsVisible</key> - <integer>1</integer> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.debugAnimatorV3</string> - <key>WindowString</key> - <string>100 100 700 500 0 0 1280 1002 </string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.bookmarks</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Module</key> - <string>PBXBookmarksModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Bookmarks</string> - <key>ServiceClasses</key> - <array> - <string>PBXBookmarksModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>0</integer> - <key>WindowString</key> - <string>538 42 401 187 0 0 1280 1002 </string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.projectFormatConflicts</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>Module</key> - <string>XCProjectFormatConflictsModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Project Format Conflicts</string> - <key>ServiceClasses</key> - <array> - <string>XCProjectFormatConflictsModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>0</integer> - <key>WindowContentMinSize</key> - <string>450 300</string> - <key>WindowString</key> - <string>50 850 472 307 0 0 1440 877</string> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.classBrowser</string> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>ContentConfiguration</key> - <dict> - <key>OptionsSetName</key> - <string>Hierarchy, all classes</string> - <key>PBXProjectModuleGUID</key> - <string>1CA6456E063B45B4001379D8</string> - <key>PBXProjectModuleLabel</key> - <string>Class Browser - NSObject</string> - </dict> - <key>GeometryConfiguration</key> - <dict> - <key>ClassesFrame</key> - <string>{{0, 0}, {374, 96}}</string> - <key>ClassesTreeTableConfiguration</key> - <array> - <string>PBXClassNameColumnIdentifier</string> - <real>208</real> - <string>PBXClassBookColumnIdentifier</string> - <real>22</real> - </array> - <key>Frame</key> - <string>{{0, 0}, {630, 331}}</string> - <key>MembersFrame</key> - <string>{{0, 105}, {374, 395}}</string> - <key>MembersTreeTableConfiguration</key> - <array> - <string>PBXMemberTypeIconColumnIdentifier</string> - <real>22</real> - <string>PBXMemberNameColumnIdentifier</string> - <real>216</real> - <string>PBXMemberTypeColumnIdentifier</string> - <real>97</real> - <string>PBXMemberBookColumnIdentifier</string> - <real>22</real> - </array> - <key>PBXModuleWindowStatusBarHidden2</key> - <integer>1</integer> - <key>RubberWindowFrame</key> - <string>385 179 630 352 0 0 1440 878 </string> - </dict> - <key>Module</key> - <string>PBXClassBrowserModule</string> - <key>Proportion</key> - <string>332pt</string> - </dict> - </array> - <key>Proportion</key> - <string>332pt</string> - </dict> - </array> - <key>Name</key> - <string>Class Browser</string> - <key>ServiceClasses</key> - <array> - <string>PBXClassBrowserModule</string> - </array> - <key>StatusbarIsVisible</key> - <integer>0</integer> - <key>TableOfContents</key> - <array> - <string>1C0AD2AF069F1E9B00FABCE6</string> - <string>1C0AD2B0069F1E9B00FABCE6</string> - <string>1CA6456E063B45B4001379D8</string> - </array> - <key>ToolbarConfiguration</key> - <string>xcode.toolbar.config.classbrowser</string> - <key>WindowString</key> - <string>385 179 630 352 0 0 1440 878 </string> - <key>WindowToolGUID</key> - <string>1C0AD2AF069F1E9B00FABCE6</string> - <key>WindowToolIsVisible</key> - <integer>0</integer> - </dict> - <dict> - <key>Identifier</key> - <string>windowTool.refactoring</string> - <key>IncludeInToolsMenu</key> - <integer>0</integer> - <key>Layout</key> - <array> - <dict> - <key>Dock</key> - <array> - <dict> - <key>BecomeActive</key> - <integer>1</integer> - <key>GeometryConfiguration</key> - <dict> - <key>Frame</key> - <string>{0, 0}, {500, 335}</string> - <key>RubberWindowFrame</key> - <string>{0, 0}, {500, 335}</string> - </dict> - <key>Module</key> - <string>XCRefactoringModule</string> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Proportion</key> - <string>100%</string> - </dict> - </array> - <key>Name</key> - <string>Refactoring</string> - <key>ServiceClasses</key> - <array> - <string>XCRefactoringModule</string> - </array> - <key>WindowString</key> - <string>200 200 500 356 0 0 1920 1200 </string> - </dict> - </array> -</dict> -</plist> diff --git a/Eko/Eko.xcodeproj/lericson.pbxuser b/Eko/Eko.xcodeproj/lericson.pbxuser deleted file mode 100644 index 5eaecb1..0000000 --- a/Eko/Eko.xcodeproj/lericson.pbxuser +++ /dev/null @@ -1,318 +0,0 @@ -// !$*UTF8*$! -{ - 2438EA65102F6360004A851C /* Eko */ = { - isa = PBXExecutable; - activeArgIndices = ( - ); - argumentStrings = ( - ); - autoAttachOnCrash = 1; - breakpointsEnabled = 0; - configStateDict = { - }; - customDataFormattersEnabled = 1; - debuggerPlugin = GDBDebugging; - disassemblyDisplayState = 0; - dylibVariantSuffix = ""; - enableDebugStr = 0; - environmentEntries = ( - { - active = YES; - name = EKO_SERVER; - value = "http://localhost:8080/"; - }, - ); - executableSystemSymbolLevel = 0; - executableUserSymbolLevel = 0; - libgmallocEnabled = 0; - name = Eko; - savedGlobals = { - }; - sourceDirectories = ( - ); - }; - 2438EA75102F6367004A851C /* Source Control */ = { - isa = PBXSourceControlManager; - fallbackIsa = XCSourceControlManager; - isSCMEnabled = 0; - scmConfiguration = { - }; - }; - 2438EA76102F6367004A851C /* Code sense */ = { - isa = PBXCodeSenseManager; - indexTemplatePath = ""; - }; - 2438EAA5102F7033004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 7790198E0C07548A00326F66 /* EkoAppDelegate.py */; - name = "EkoAppDelegate.py: 61"; - rLen = 0; - rLoc = 1727; - rType = 0; - vrLen = 438; - vrLoc = 0; - }; - 2438EAA6102F7033004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 77631A3E0C0748CF005415CB /* main.py */; - name = "main.py: 5"; - rLen = 0; - rLoc = 47; - rType = 0; - vrLen = 346; - vrLoc = 0; - }; - 2438EAA7102F7033004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 29B97316FDCFA39411CA2CEA /* main.m */; - name = "main.m: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 523; - vrLoc = 0; - }; - 2438EAD1102F76AB004A851C /* eko.py */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 2212}}"; - sepNavSelRange = "{5422, 0}"; - sepNavVisRange = "{4699, 612}"; - }; - }; - 2438EAD3102F76B8004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 7790198E0C07548A00326F66 /* EkoAppDelegate.py */; - name = "EkoAppDelegate.py: 86"; - rLen = 0; - rLoc = 2726; - rType = 0; - vrLen = 570; - vrLoc = 0; - }; - 2438EAD5102F76B8004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 7790198E0C07548A00326F66 /* EkoAppDelegate.py */; - name = "EkoAppDelegate.py: 86"; - rLen = 0; - rLoc = 2726; - rType = 0; - vrLen = 570; - vrLoc = 0; - }; - 2438EAE7102F95F7004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2438EAD1102F76AB004A851C /* eko.py */; - name = "eko.py: 157"; - rLen = 0; - rLoc = 5422; - rType = 0; - vrLen = 612; - vrLoc = 4699; - }; - 2438EAE9102F95F7004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2438EAD1102F76AB004A851C /* eko.py */; - name = "eko.py: 157"; - rLen = 0; - rLoc = 5422; - rType = 0; - vrLen = 612; - vrLoc = 4699; - }; - 2438EB14102FA0AF004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 29B97316FDCFA39411CA2CEA /* main.m */; - name = "main.m: 33"; - rLen = 0; - rLoc = 1200; - rType = 0; - vrLen = 815; - vrLoc = 967; - }; - 2438EB15102FA0AF004A851C /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2438EB0E102F9F20004A851C /* eko.icns */; - }; - 2438EB16102FA0AF004A851C /* PlistBookmark */ = { - isa = PlistBookmark; - fRef = 8D1107310486CEB800E47090 /* Info.plist */; - fallbackIsa = PBXBookmark; - isK = 0; - kPath = ( - CFBundleName, - ); - name = /Users/ludvigericson/Development/eko/Eko/Info.plist; - rLen = 0; - rLoc = 2147483647; - }; - 2438EB17102FA0AF004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 77631A3E0C0748CF005415CB /* main.py */; - name = "main.py: 5"; - rLen = 0; - rLoc = 47; - rType = 0; - vrLen = 346; - vrLoc = 0; - }; - 2438EB18102FA0AF004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 29B97316FDCFA39411CA2CEA /* main.m */; - name = "main.m: 33"; - rLen = 0; - rLoc = 1200; - rType = 0; - vrLen = 815; - vrLoc = 967; - }; - 2438EB19102FA0AF004A851C /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2438EB0E102F9F20004A851C /* eko.icns */; - }; - 2438EB1A102FA0AF004A851C /* PlistBookmark */ = { - isa = PlistBookmark; - fRef = 8D1107310486CEB800E47090 /* Info.plist */; - fallbackIsa = PBXBookmark; - isK = 0; - kPath = ( - CFBundleName, - ); - name = /Users/ludvigericson/Development/eko/Eko/Info.plist; - rLen = 0; - rLoc = 2147483647; - }; - 2438EB1B102FA0AF004A851C /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 77631A3E0C0748CF005415CB /* main.py */; - name = "main.py: 5"; - rLen = 0; - rLoc = 47; - rType = 0; - vrLen = 372; - vrLoc = 0; - }; - 24812E4E102FA0C3003B1D41 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 77631A3E0C0748CF005415CB /* main.py */; - name = "main.py: 5"; - rLen = 0; - rLoc = 47; - rType = 0; - vrLen = 0; - vrLoc = 0; - }; - 29B97313FDCFA39411CA2CEA /* Project object */ = { - activeBuildConfigurationName = Debug; - activeExecutable = 2438EA65102F6360004A851C /* Eko */; - activeTarget = 8D1107260486CEB800E47090 /* Eko */; - addToTargets = ( - 8D1107260486CEB800E47090 /* Eko */, - ); - codeSenseManager = 2438EA76102F6367004A851C /* Code sense */; - executables = ( - 2438EA65102F6360004A851C /* Eko */, - ); - perUserDictionary = { - PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 300, - 231, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXErrorsWarningsDataSource_TypeID, - PBXErrorsWarningsDataSource_MessageID, - PBXErrorsWarningsDataSource_LocationID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; - PBXFileTableDataSourceColumnWidthsKey = ( - 22, - 300, - 229, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXExecutablesDataSource_ActiveFlagID, - PBXExecutablesDataSource_NameID, - PBXExecutablesDataSource_CommentsID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 341, - 20, - 48, - 43, - 43, - 20, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - PBXFileDataSource_Target_ColumnID, - ); - }; - PBXPerProjectTemplateStateSaveDate = 271556795; - PBXWorkspaceStateSaveDate = 271556795; - }; - perUserProjectItems = { - 2438EAA5102F7033004A851C = 2438EAA5102F7033004A851C /* PBXTextBookmark */; - 2438EAA6102F7033004A851C = 2438EAA6102F7033004A851C /* PBXTextBookmark */; - 2438EAA7102F7033004A851C = 2438EAA7102F7033004A851C /* PBXTextBookmark */; - 2438EAD3102F76B8004A851C = 2438EAD3102F76B8004A851C /* PBXTextBookmark */; - 2438EAD5102F76B8004A851C = 2438EAD5102F76B8004A851C /* PBXTextBookmark */; - 2438EAE7102F95F7004A851C = 2438EAE7102F95F7004A851C /* PBXTextBookmark */; - 2438EAE9102F95F7004A851C = 2438EAE9102F95F7004A851C /* PBXTextBookmark */; - 2438EB14102FA0AF004A851C = 2438EB14102FA0AF004A851C /* PBXTextBookmark */; - 2438EB15102FA0AF004A851C = 2438EB15102FA0AF004A851C /* PBXBookmark */; - 2438EB16102FA0AF004A851C = 2438EB16102FA0AF004A851C /* PlistBookmark */; - 2438EB17102FA0AF004A851C = 2438EB17102FA0AF004A851C /* PBXTextBookmark */; - 2438EB18102FA0AF004A851C = 2438EB18102FA0AF004A851C /* PBXTextBookmark */; - 2438EB19102FA0AF004A851C = 2438EB19102FA0AF004A851C /* PBXBookmark */; - 2438EB1A102FA0AF004A851C = 2438EB1A102FA0AF004A851C /* PlistBookmark */; - 2438EB1B102FA0AF004A851C = 2438EB1B102FA0AF004A851C /* PBXTextBookmark */; - 24812E4E102FA0C3003B1D41 /* PBXTextBookmark */ = 24812E4E102FA0C3003B1D41 /* PBXTextBookmark */; - }; - sourceControlManager = 2438EA75102F6367004A851C /* Source Control */; - userBuildSettings = { - }; - }; - 29B97316FDCFA39411CA2CEA /* main.m */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1200, 700}}"; - sepNavSelRange = "{1200, 0}"; - sepNavVisRange = "{967, 815}"; - }; - }; - 77631A3E0C0748CF005415CB /* main.py */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {534, 294}}"; - sepNavSelRange = "{47, 0}"; - sepNavVisRange = "{0, 0}"; - }; - }; - 7790198E0C07548A00326F66 /* EkoAppDelegate.py */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {519, 1288}}"; - sepNavSelRange = "{2726, 0}"; - sepNavVisRange = "{0, 570}"; - }; - }; - 8D1107260486CEB800E47090 /* Eko */ = { - activeExec = 0; - executables = ( - 2438EA65102F6360004A851C /* Eko */, - ); - }; -}
lericson/eko
a323f7cb9617a0e510bc2e4611a29bbe819163d7
Add OS X client.
diff --git a/.gitignore b/.gitignore index 66b6e4c..ebeb1c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc *.pyo .DS_Store +/Eko/build diff --git a/Eko/Eko.xcodeproj/jnordberg.mode1v3 b/Eko/Eko.xcodeproj/jnordberg.mode1v3 new file mode 100644 index 0000000..824cc84 --- /dev/null +++ b/Eko/Eko.xcodeproj/jnordberg.mode1v3 @@ -0,0 +1,1351 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>ActivePerspectiveName</key> + <string>Project</string> + <key>AllowedModules</key> + <array> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Name</key> + <string>Groups and Files Outline View</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Name</key> + <string>Editor</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCTaskListModule</string> + <key>Name</key> + <string>Task List</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCDetailModule</string> + <key>Name</key> + <string>File and Smart Group Detail Viewer</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXBuildResultsModule</string> + <key>Name</key> + <string>Detailed Build Results Viewer</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXProjectFindModule</string> + <key>Name</key> + <string>Project Batch Find Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCProjectFormatConflictsModule</string> + <key>Name</key> + <string>Project Format Conflicts List</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXBookmarksModule</string> + <key>Name</key> + <string>Bookmarks Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXClassBrowserModule</string> + <key>Name</key> + <string>Class Browser</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXCVSModule</string> + <key>Name</key> + <string>Source Code Control Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXDebugBreakpointsModule</string> + <key>Name</key> + <string>Debug Breakpoints Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCDockableInspector</string> + <key>Name</key> + <string>Inspector</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXOpenQuicklyModule</string> + <key>Name</key> + <string>Open Quickly Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXDebugSessionModule</string> + <key>Name</key> + <string>Debugger</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXDebugCLIModule</string> + <key>Name</key> + <string>Debug Console</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCSnapshotModule</string> + <key>Name</key> + <string>Snapshots Tool</string> + </dict> + </array> + <key>BundlePath</key> + <string>/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources</string> + <key>Description</key> + <string>DefaultDescriptionKey</string> + <key>DockingSystemVisible</key> + <false/> + <key>Extension</key> + <string>mode1v3</string> + <key>FavBarConfig</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>A5501C8A102F4B8C00A02BF0</string> + <key>XCBarModuleItemNames</key> + <dict/> + <key>XCBarModuleItems</key> + <array/> + </dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>com.apple.perspectives.project.mode1v3</string> + <key>MajorVersion</key> + <integer>33</integer> + <key>MinorVersion</key> + <integer>0</integer> + <key>Name</key> + <string>Default</string> + <key>Notifications</key> + <array/> + <key>OpenEditors</key> + <array/> + <key>PerspectiveWidths</key> + <array> + <integer>-1</integer> + <integer>-1</integer> + </array> + <key>Perspectives</key> + <array> + <dict> + <key>ChosenToolbarItems</key> + <array> + <string>active-combo-popup</string> + <string>action</string> + <string>NSToolbarFlexibleSpaceItem</string> + <string>build</string> + <string>build-and-go</string> + <string>com.apple.ide.PBXToolbarStopButton</string> + <string>get-info</string> + <string>NSToolbarFlexibleSpaceItem</string> + <string>com.apple.pbx.toolbar.searchfield</string> + </array> + <key>ControllerClassBaseName</key> + <string></string> + <key>IconName</key> + <string>WindowOfProjectWithEditor</string> + <key>Identifier</key> + <string>perspective.project</string> + <key>IsVertical</key> + <false/> + <key>Layout</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C37FBAC04509CD000000102</string> + <string>1C37FAAC04509CD000000102</string> + <string>1C08E77C0454961000C914BD</string> + <string>1C37FABC05509CD000000102</string> + <string>1C37FABC05539CD112110102</string> + <string>E2644B35053B69B200211256</string> + <string>1C37FABC04509CD000100104</string> + <string>1CC0EA4004350EF90044410B</string> + <string>1CC0EA4004350EF90041110B</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>1CE0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>yes</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>186</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>29B97314FDCFA39411CA2CEA</string> + <string>1C37FABC05509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {186, 445}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <true/> + <key>XCSharingToken</key> + <string>com.apple.Xcode.GFSharingToken</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {203, 463}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>186</real> + </array> + <key>RubberWindowFrame</key> + <string>347 294 788 504 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>203pt</string> + </dict> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20306471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>MyNewFile14.java</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20406471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>MyNewFile14.java</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <true/> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {580, 285}}</string> + <key>RubberWindowFrame</key> + <string>347 294 788 504 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>285pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <true/> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20506471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Detail</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 290}, {580, 173}}</string> + <key>RubberWindowFrame</key> + <string>347 294 788 504 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>XCDetailModule</string> + <key>Proportion</key> + <string>173pt</string> + </dict> + </array> + <key>Proportion</key> + <string>580pt</string> + </dict> + </array> + <key>Name</key> + <string>Project</string> + <key>ServiceClasses</key> + <array> + <string>XCModuleDock</string> + <string>PBXSmartGroupTreeModule</string> + <string>XCModuleDock</string> + <string>PBXNavigatorGroup</string> + <string>XCDetailModule</string> + </array> + <key>TableOfContents</key> + <array> + <string>A5501C88102F4B8C00A02BF0</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>A5501C89102F4B8C00A02BF0</string> + <string>1CE0B20306471E060097A5F4</string> + <string>1CE0B20506471E060097A5F4</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.defaultV3</string> + </dict> + <dict> + <key>ControllerClassBaseName</key> + <string></string> + <key>IconName</key> + <string>WindowOfProject</string> + <key>Identifier</key> + <string>perspective.morph</string> + <key>IsVertical</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C37FBAC04509CD000000102</string> + <string>1C37FAAC04509CD000000102</string> + <string>1C08E77C0454961000C914BD</string> + <string>1C37FABC05509CD000000102</string> + <string>1C37FABC05539CD112110102</string> + <string>E2644B35053B69B200211256</string> + <string>1C37FABC04509CD000100104</string> + <string>1CC0EA4004350EF90044410B</string> + <string>1CC0EA4004350EF90041110B</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>11E0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>yes</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>186</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>29B97314FDCFA39411CA2CEA</string> + <string>1C37FABC05509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {186, 337}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <integer>1</integer> + <key>XCSharingToken</key> + <string>com.apple.Xcode.GFSharingToken</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {203, 355}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>186</real> + </array> + <key>RubberWindowFrame</key> + <string>373 269 690 397 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Morph</string> + <key>PreferredWidth</key> + <integer>300</integer> + <key>ServiceClasses</key> + <array> + <string>XCModuleDock</string> + <string>PBXSmartGroupTreeModule</string> + </array> + <key>TableOfContents</key> + <array> + <string>11E0B1FE06471DED0097A5F4</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.default.shortV3</string> + </dict> + </array> + <key>PerspectivesBarVisible</key> + <false/> + <key>ShelfIsVisible</key> + <false/> + <key>SourceDescription</key> + <string>file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec'</string> + <key>StatusbarIsVisible</key> + <true/> + <key>TimeStamp</key> + <real>0.0</real> + <key>ToolbarDisplayMode</key> + <integer>1</integer> + <key>ToolbarIsVisible</key> + <true/> + <key>ToolbarSizeMode</key> + <integer>1</integer> + <key>Type</key> + <string>Perspectives</string> + <key>UpdateMessage</key> + <string>The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'?</string> + <key>WindowJustification</key> + <integer>5</integer> + <key>WindowOrderList</key> + <array> + <string>/Users/jnordberg/Development/Eko/Eko.xcodeproj</string> + </array> + <key>WindowString</key> + <string>347 294 788 504 0 0 1440 878 </string> + <key>WindowToolsV3</key> + <array> + <dict> + <key>Identifier</key> + <string>windowTool.build</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528F0623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>&lt;No Editor&gt;</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD052900623707200166675</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <integer>1</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {500, 215}}</string> + <key>RubberWindowFrame</key> + <string>192 257 500 500 0 0 1280 1002 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>218pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>XCMainBuildResultsModuleGUID</string> + <key>PBXProjectModuleLabel</key> + <string>Build</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 222}, {500, 236}}</string> + <key>RubberWindowFrame</key> + <string>192 257 500 500 0 0 1280 1002 </string> + </dict> + <key>Module</key> + <string>PBXBuildResultsModule</string> + <key>Proportion</key> + <string>236pt</string> + </dict> + </array> + <key>Proportion</key> + <string>458pt</string> + </dict> + </array> + <key>Name</key> + <string>Build Results</string> + <key>ServiceClasses</key> + <array> + <string>PBXBuildResultsModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C78EAA5065D492600B07095</string> + <string>1C78EAA6065D492600B07095</string> + <string>1CD0528F0623707200166675</string> + <string>XCMainBuildResultsModuleGUID</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.buildV3</string> + <key>WindowString</key> + <string>192 257 500 500 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.debugger</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>Debugger</key> + <dict> + <key>HorizontalSplitView</key> + <dict> + <key>_collapsingFrameDimension</key> + <real>0.0</real> + <key>_indexOfCollapsedView</key> + <integer>0</integer> + <key>_percentageOfCollapsedView</key> + <real>0.0</real> + <key>isCollapsed</key> + <string>yes</string> + <key>sizes</key> + <array> + <string>{{0, 0}, {317, 164}}</string> + <string>{{317, 0}, {377, 164}}</string> + </array> + </dict> + <key>VerticalSplitView</key> + <dict> + <key>_collapsingFrameDimension</key> + <real>0.0</real> + <key>_indexOfCollapsedView</key> + <integer>0</integer> + <key>_percentageOfCollapsedView</key> + <real>0.0</real> + <key>isCollapsed</key> + <string>yes</string> + <key>sizes</key> + <array> + <string>{{0, 0}, {694, 164}}</string> + <string>{{0, 164}, {694, 216}}</string> + </array> + </dict> + </dict> + <key>LauncherConfigVersion</key> + <string>8</string> + <key>PBXProjectModuleGUID</key> + <string>1C162984064C10D400B95A72</string> + <key>PBXProjectModuleLabel</key> + <string>Debug - GLUTExamples (Underwater)</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>DebugConsoleDrawerSize</key> + <string>{100, 120}</string> + <key>DebugConsoleVisible</key> + <string>None</string> + <key>DebugConsoleWindowFrame</key> + <string>{{200, 200}, {500, 300}}</string> + <key>DebugSTDIOWindowFrame</key> + <string>{{200, 200}, {500, 300}}</string> + <key>Frame</key> + <string>{{0, 0}, {694, 380}}</string> + <key>RubberWindowFrame</key> + <string>321 238 694 422 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXDebugSessionModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Debugger</string> + <key>ServiceClasses</key> + <array> + <string>PBXDebugSessionModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1CD10A99069EF8BA00B06720</string> + <string>1C0AD2AB069F1E9B00FABCE6</string> + <string>1C162984064C10D400B95A72</string> + <string>1C0AD2AC069F1E9B00FABCE6</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.debugV3</string> + <key>WindowString</key> + <string>321 238 694 422 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1CD10A99069EF8BA00B06720</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.find</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CDD528C0622207200134675</string> + <key>PBXProjectModuleLabel</key> + <string>&lt;No Editor&gt;</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528D0623707200166675</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <integer>1</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {781, 167}}</string> + <key>RubberWindowFrame</key> + <string>62 385 781 470 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>781pt</string> + </dict> + </array> + <key>Proportion</key> + <string>50%</string> + </dict> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528E0623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>Project Find</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{8, 0}, {773, 254}}</string> + <key>RubberWindowFrame</key> + <string>62 385 781 470 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXProjectFindModule</string> + <key>Proportion</key> + <string>50%</string> + </dict> + </array> + <key>Proportion</key> + <string>428pt</string> + </dict> + </array> + <key>Name</key> + <string>Project Find</string> + <key>ServiceClasses</key> + <array> + <string>PBXProjectFindModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C530D57069F1CE1000CFCEE</string> + <string>1C530D58069F1CE1000CFCEE</string> + <string>1C530D59069F1CE1000CFCEE</string> + <string>1CDD528C0622207200134675</string> + <string>1C530D5A069F1CE1000CFCEE</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>1CD0528E0623707200166675</string> + </array> + <key>WindowString</key> + <string>62 385 781 470 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1C530D57069F1CE1000CFCEE</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>MENUSEPARATOR</string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.debuggerConsole</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAAC065D492600B07095</string> + <key>PBXProjectModuleLabel</key> + <string>Debugger Console</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {650, 250}}</string> + <key>RubberWindowFrame</key> + <string>516 632 650 250 0 0 1680 1027 </string> + </dict> + <key>Module</key> + <string>PBXDebugCLIModule</string> + <key>Proportion</key> + <string>209pt</string> + </dict> + </array> + <key>Proportion</key> + <string>209pt</string> + </dict> + </array> + <key>Name</key> + <string>Debugger Console</string> + <key>ServiceClasses</key> + <array> + <string>PBXDebugCLIModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C78EAAD065D492600B07095</string> + <string>1C78EAAE065D492600B07095</string> + <string>1C78EAAC065D492600B07095</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.consoleV3</string> + <key>WindowString</key> + <string>650 41 650 250 0 0 1280 1002 </string> + <key>WindowToolGUID</key> + <string>1C78EAAD065D492600B07095</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.snapshots</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>XCSnapshotModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Snapshots</string> + <key>ServiceClasses</key> + <array> + <string>XCSnapshotModule</string> + </array> + <key>StatusbarIsVisible</key> + <string>Yes</string> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.snapshots</string> + <key>WindowString</key> + <string>315 824 300 550 0 0 1440 878 </string> + <key>WindowToolIsVisible</key> + <string>Yes</string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.scm</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAB2065D492600B07095</string> + <key>PBXProjectModuleLabel</key> + <string>&lt;No Editor&gt;</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAB3065D492600B07095</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <integer>1</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {452, 0}}</string> + <key>RubberWindowFrame</key> + <string>743 379 452 308 0 0 1280 1002 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>0pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD052920623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>SCM</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>ConsoleFrame</key> + <string>{{0, 259}, {452, 0}}</string> + <key>Frame</key> + <string>{{0, 7}, {452, 259}}</string> + <key>RubberWindowFrame</key> + <string>743 379 452 308 0 0 1280 1002 </string> + <key>TableConfiguration</key> + <array> + <string>Status</string> + <real>30</real> + <string>FileName</string> + <real>199</real> + <string>Path</string> + <real>197.0950012207031</real> + </array> + <key>TableFrame</key> + <string>{{0, 0}, {452, 250}}</string> + </dict> + <key>Module</key> + <string>PBXCVSModule</string> + <key>Proportion</key> + <string>262pt</string> + </dict> + </array> + <key>Proportion</key> + <string>266pt</string> + </dict> + </array> + <key>Name</key> + <string>SCM</string> + <key>ServiceClasses</key> + <array> + <string>PBXCVSModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C78EAB4065D492600B07095</string> + <string>1C78EAB5065D492600B07095</string> + <string>1C78EAB2065D492600B07095</string> + <string>1CD052920623707200166675</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.scm</string> + <key>WindowString</key> + <string>743 379 452 308 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.breakpoints</string> + <key>IsVertical</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C77FABC04509CD000000102</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>1CE0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>no</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>168</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>1C77FABC04509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {168, 350}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <integer>0</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {185, 368}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>168</real> + </array> + <key>RubberWindowFrame</key> + <string>315 424 744 409 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>185pt</string> + </dict> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CA1AED706398EBD00589147</string> + <key>PBXProjectModuleLabel</key> + <string>Detail</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{190, 0}, {554, 368}}</string> + <key>RubberWindowFrame</key> + <string>315 424 744 409 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>XCDetailModule</string> + <key>Proportion</key> + <string>554pt</string> + </dict> + </array> + <key>Proportion</key> + <string>368pt</string> + </dict> + </array> + <key>MajorVersion</key> + <integer>3</integer> + <key>MinorVersion</key> + <integer>0</integer> + <key>Name</key> + <string>Breakpoints</string> + <key>ServiceClasses</key> + <array> + <string>PBXSmartGroupTreeModule</string> + <string>XCDetailModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1CDDB66807F98D9800BB5817</string> + <string>1CDDB66907F98D9800BB5817</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>1CA1AED706398EBD00589147</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.breakpointsV3</string> + <key>WindowString</key> + <string>315 424 744 409 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1CDDB66807F98D9800BB5817</string> + <key>WindowToolIsVisible</key> + <integer>1</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.debugAnimator</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Debug Visualizer</string> + <key>ServiceClasses</key> + <array> + <string>PBXNavigatorGroup</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.debugAnimatorV3</string> + <key>WindowString</key> + <string>100 100 700 500 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.bookmarks</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>PBXBookmarksModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Bookmarks</string> + <key>ServiceClasses</key> + <array> + <string>PBXBookmarksModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>WindowString</key> + <string>538 42 401 187 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.projectFormatConflicts</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>XCProjectFormatConflictsModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Project Format Conflicts</string> + <key>ServiceClasses</key> + <array> + <string>XCProjectFormatConflictsModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>WindowContentMinSize</key> + <string>450 300</string> + <key>WindowString</key> + <string>50 850 472 307 0 0 1440 877</string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.classBrowser</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>OptionsSetName</key> + <string>Hierarchy, all classes</string> + <key>PBXProjectModuleGUID</key> + <string>1CA6456E063B45B4001379D8</string> + <key>PBXProjectModuleLabel</key> + <string>Class Browser - NSObject</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>ClassesFrame</key> + <string>{{0, 0}, {374, 96}}</string> + <key>ClassesTreeTableConfiguration</key> + <array> + <string>PBXClassNameColumnIdentifier</string> + <real>208</real> + <string>PBXClassBookColumnIdentifier</string> + <real>22</real> + </array> + <key>Frame</key> + <string>{{0, 0}, {630, 331}}</string> + <key>MembersFrame</key> + <string>{{0, 105}, {374, 395}}</string> + <key>MembersTreeTableConfiguration</key> + <array> + <string>PBXMemberTypeIconColumnIdentifier</string> + <real>22</real> + <string>PBXMemberNameColumnIdentifier</string> + <real>216</real> + <string>PBXMemberTypeColumnIdentifier</string> + <real>97</real> + <string>PBXMemberBookColumnIdentifier</string> + <real>22</real> + </array> + <key>PBXModuleWindowStatusBarHidden2</key> + <integer>1</integer> + <key>RubberWindowFrame</key> + <string>385 179 630 352 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXClassBrowserModule</string> + <key>Proportion</key> + <string>332pt</string> + </dict> + </array> + <key>Proportion</key> + <string>332pt</string> + </dict> + </array> + <key>Name</key> + <string>Class Browser</string> + <key>ServiceClasses</key> + <array> + <string>PBXClassBrowserModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>TableOfContents</key> + <array> + <string>1C0AD2AF069F1E9B00FABCE6</string> + <string>1C0AD2B0069F1E9B00FABCE6</string> + <string>1CA6456E063B45B4001379D8</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.classbrowser</string> + <key>WindowString</key> + <string>385 179 630 352 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1C0AD2AF069F1E9B00FABCE6</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.refactoring</string> + <key>IncludeInToolsMenu</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{0, 0}, {500, 335}</string> + <key>RubberWindowFrame</key> + <string>{0, 0}, {500, 335}</string> + </dict> + <key>Module</key> + <string>XCRefactoringModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Refactoring</string> + <key>ServiceClasses</key> + <array> + <string>XCRefactoringModule</string> + </array> + <key>WindowString</key> + <string>200 200 500 356 0 0 1920 1200 </string> + </dict> + </array> +</dict> +</plist> diff --git a/Eko/Eko.xcodeproj/jnordberg.pbxuser b/Eko/Eko.xcodeproj/jnordberg.pbxuser new file mode 100644 index 0000000..9141ec9 --- /dev/null +++ b/Eko/Eko.xcodeproj/jnordberg.pbxuser @@ -0,0 +1,85 @@ +// !$*UTF8*$! +{ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + activeBuildConfigurationName = Debug; + activeExecutable = A5501C83102F4B8700A02BF0 /* Eko */; + activeTarget = 8D1107260486CEB800E47090 /* Eko */; + addToTargets = ( + 8D1107260486CEB800E47090 /* Eko */, + ); + codeSenseManager = A5501C8C102F4B8C00A02BF0 /* Code sense */; + executables = ( + A5501C83102F4B8700A02BF0 /* Eko */, + ); + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 341, + 20, + 48.16259765625, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 271534983; + PBXWorkspaceStateSaveDate = 271534983; + }; + sourceControlManager = A5501C8B102F4B8C00A02BF0 /* Source Control */; + userBuildSettings = { + }; + }; + 8D1107260486CEB800E47090 /* Eko */ = { + activeExec = 0; + executables = ( + A5501C83102F4B8700A02BF0 /* Eko */, + ); + }; + A5501C83102F4B8700A02BF0 /* Eko */ = { + isa = PBXExecutable; + activeArgIndices = ( + ); + argumentStrings = ( + ); + autoAttachOnCrash = 1; + breakpointsEnabled = 0; + configStateDict = { + }; + customDataFormattersEnabled = 1; + debuggerPlugin = GDBDebugging; + disassemblyDisplayState = 0; + dylibVariantSuffix = ""; + enableDebugStr = 1; + environmentEntries = ( + ); + executableSystemSymbolLevel = 0; + executableUserSymbolLevel = 0; + libgmallocEnabled = 0; + name = Eko; + sourceDirectories = ( + ); + }; + A5501C8B102F4B8C00A02BF0 /* Source Control */ = { + isa = PBXSourceControlManager; + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + scmConfiguration = { + }; + }; + A5501C8C102F4B8C00A02BF0 /* Code sense */ = { + isa = PBXCodeSenseManager; + indexTemplatePath = ""; + }; +} diff --git a/Eko/Eko.xcodeproj/lericson.mode1v3 b/Eko/Eko.xcodeproj/lericson.mode1v3 new file mode 100644 index 0000000..0af20a3 --- /dev/null +++ b/Eko/Eko.xcodeproj/lericson.mode1v3 @@ -0,0 +1,1402 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>ActivePerspectiveName</key> + <string>Project</string> + <key>AllowedModules</key> + <array> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Name</key> + <string>Groups and Files Outline View</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Name</key> + <string>Editor</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCTaskListModule</string> + <key>Name</key> + <string>Task List</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCDetailModule</string> + <key>Name</key> + <string>File and Smart Group Detail Viewer</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXBuildResultsModule</string> + <key>Name</key> + <string>Detailed Build Results Viewer</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXProjectFindModule</string> + <key>Name</key> + <string>Project Batch Find Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCProjectFormatConflictsModule</string> + <key>Name</key> + <string>Project Format Conflicts List</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXBookmarksModule</string> + <key>Name</key> + <string>Bookmarks Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXClassBrowserModule</string> + <key>Name</key> + <string>Class Browser</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXCVSModule</string> + <key>Name</key> + <string>Source Code Control Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXDebugBreakpointsModule</string> + <key>Name</key> + <string>Debug Breakpoints Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCDockableInspector</string> + <key>Name</key> + <string>Inspector</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXOpenQuicklyModule</string> + <key>Name</key> + <string>Open Quickly Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXDebugSessionModule</string> + <key>Name</key> + <string>Debugger</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXDebugCLIModule</string> + <key>Name</key> + <string>Debug Console</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCSnapshotModule</string> + <key>Name</key> + <string>Snapshots Tool</string> + </dict> + </array> + <key>BundlePath</key> + <string>/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources</string> + <key>Description</key> + <string>DefaultDescriptionKey</string> + <key>DockingSystemVisible</key> + <false/> + <key>Extension</key> + <string>mode1v3</string> + <key>FavBarConfig</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>2438EA74102F6367004A851C</string> + <key>XCBarModuleItemNames</key> + <dict/> + <key>XCBarModuleItems</key> + <array/> + </dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>com.apple.perspectives.project.mode1v3</string> + <key>MajorVersion</key> + <integer>33</integer> + <key>MinorVersion</key> + <integer>0</integer> + <key>Name</key> + <string>Default</string> + <key>Notifications</key> + <array/> + <key>OpenEditors</key> + <array/> + <key>PerspectiveWidths</key> + <array> + <integer>-1</integer> + <integer>-1</integer> + </array> + <key>Perspectives</key> + <array> + <dict> + <key>ChosenToolbarItems</key> + <array> + <string>active-buildstyle-popup</string> + <string>action</string> + <string>NSToolbarFlexibleSpaceItem</string> + <string>buildOrClean</string> + <string>build-and-goOrGo</string> + <string>com.apple.ide.PBXToolbarStopButton</string> + <string>get-info</string> + <string>toggle-editor</string> + <string>NSToolbarFlexibleSpaceItem</string> + <string>com.apple.pbx.toolbar.searchfield</string> + </array> + <key>ControllerClassBaseName</key> + <string></string> + <key>IconName</key> + <string>WindowOfProjectWithEditor</string> + <key>Identifier</key> + <string>perspective.project</string> + <key>IsVertical</key> + <false/> + <key>Layout</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C37FBAC04509CD000000102</string> + <string>1C37FAAC04509CD000000102</string> + <string>1C08E77C0454961000C914BD</string> + <string>1C37FABC05509CD000000102</string> + <string>1C37FABC05539CD112110102</string> + <string>E2644B35053B69B200211256</string> + <string>1C37FABC04509CD000100104</string> + <string>1CC0EA4004350EF90044410B</string> + <string>1CC0EA4004350EF90041110B</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>1CE0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>yes</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>186</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>29B97314FDCFA39411CA2CEA</string> + <string>1C37FABC05509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {186, 445}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <true/> + <key>XCSharingToken</key> + <string>com.apple.Xcode.GFSharingToken</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {203, 463}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>186</real> + </array> + <key>RubberWindowFrame</key> + <string>326 315 788 504 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>203pt</string> + </dict> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20306471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>main.py</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20406471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>main.py</string> + <key>_historyCapacity</key> + <integer>0</integer> + <key>bookmark</key> + <string>24812E4E102FA0C3003B1D41</string> + <key>history</key> + <array> + <string>2438EAD3102F76B8004A851C</string> + <string>2438EAE7102F95F7004A851C</string> + <string>2438EB14102FA0AF004A851C</string> + <string>2438EB15102FA0AF004A851C</string> + <string>2438EB16102FA0AF004A851C</string> + <string>2438EB1B102FA0AF004A851C</string> + </array> + <key>prevStack</key> + <array> + <string>2438EAA5102F7033004A851C</string> + <string>2438EAA6102F7033004A851C</string> + <string>2438EAA7102F7033004A851C</string> + <string>2438EAE9102F95F7004A851C</string> + <string>2438EB19102FA0AF004A851C</string> + <string>2438EB1A102FA0AF004A851C</string> + </array> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <true/> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {580, 0}}</string> + <key>RubberWindowFrame</key> + <string>326 315 788 504 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>0pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <true/> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20506471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Detail</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 5}, {580, 458}}</string> + <key>RubberWindowFrame</key> + <string>326 315 788 504 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>XCDetailModule</string> + <key>Proportion</key> + <string>458pt</string> + </dict> + </array> + <key>Proportion</key> + <string>580pt</string> + </dict> + </array> + <key>Name</key> + <string>Project</string> + <key>ServiceClasses</key> + <array> + <string>XCModuleDock</string> + <string>PBXSmartGroupTreeModule</string> + <string>XCModuleDock</string> + <string>PBXNavigatorGroup</string> + <string>XCDetailModule</string> + </array> + <key>TableOfContents</key> + <array> + <string>24812E4F102FA0C3003B1D41</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>24812E50102FA0C3003B1D41</string> + <string>1CE0B20306471E060097A5F4</string> + <string>1CE0B20506471E060097A5F4</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.defaultV3</string> + </dict> + <dict> + <key>ControllerClassBaseName</key> + <string></string> + <key>IconName</key> + <string>WindowOfProject</string> + <key>Identifier</key> + <string>perspective.morph</string> + <key>IsVertical</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C37FBAC04509CD000000102</string> + <string>1C37FAAC04509CD000000102</string> + <string>1C08E77C0454961000C914BD</string> + <string>1C37FABC05509CD000000102</string> + <string>1C37FABC05539CD112110102</string> + <string>E2644B35053B69B200211256</string> + <string>1C37FABC04509CD000100104</string> + <string>1CC0EA4004350EF90044410B</string> + <string>1CC0EA4004350EF90041110B</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>11E0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>yes</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>186</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>29B97314FDCFA39411CA2CEA</string> + <string>1C37FABC05509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {186, 337}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <integer>1</integer> + <key>XCSharingToken</key> + <string>com.apple.Xcode.GFSharingToken</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {203, 355}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>186</real> + </array> + <key>RubberWindowFrame</key> + <string>373 269 690 397 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Morph</string> + <key>PreferredWidth</key> + <integer>300</integer> + <key>ServiceClasses</key> + <array> + <string>XCModuleDock</string> + <string>PBXSmartGroupTreeModule</string> + </array> + <key>TableOfContents</key> + <array> + <string>11E0B1FE06471DED0097A5F4</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.default.shortV3</string> + </dict> + </array> + <key>PerspectivesBarVisible</key> + <false/> + <key>ShelfIsVisible</key> + <false/> + <key>SourceDescription</key> + <string>file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec'</string> + <key>StatusbarIsVisible</key> + <true/> + <key>TimeStamp</key> + <real>0.0</real> + <key>ToolbarDisplayMode</key> + <integer>1</integer> + <key>ToolbarIsVisible</key> + <true/> + <key>ToolbarSizeMode</key> + <integer>1</integer> + <key>Type</key> + <string>Perspectives</string> + <key>UpdateMessage</key> + <string>The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'?</string> + <key>WindowJustification</key> + <integer>5</integer> + <key>WindowOrderList</key> + <array> + <string>/Users/ludvigericson/Development/eko/Eko/Eko.xcodeproj</string> + </array> + <key>WindowString</key> + <string>326 315 788 504 0 0 1440 878 </string> + <key>WindowToolsV3</key> + <array> + <dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>windowTool.build</string> + <key>IsVertical</key> + <true/> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528F0623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string></string> + <key>StatusBarVisibility</key> + <true/> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {500, 218}}</string> + <key>RubberWindowFrame</key> + <string>347 296 500 500 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>218pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <true/> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>XCMainBuildResultsModuleGUID</string> + <key>PBXProjectModuleLabel</key> + <string>Build</string> + <key>XCBuildResultsTrigger_Collapse</key> + <integer>1021</integer> + <key>XCBuildResultsTrigger_Open</key> + <integer>1011</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 223}, {500, 236}}</string> + <key>RubberWindowFrame</key> + <string>347 296 500 500 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXBuildResultsModule</string> + <key>Proportion</key> + <string>236pt</string> + </dict> + </array> + <key>Proportion</key> + <string>459pt</string> + </dict> + </array> + <key>Name</key> + <string>Build Results</string> + <key>ServiceClasses</key> + <array> + <string>PBXBuildResultsModule</string> + </array> + <key>StatusbarIsVisible</key> + <true/> + <key>TableOfContents</key> + <array> + <string>2438EA86102F69A0004A851C</string> + <string>2438EA87102F69A0004A851C</string> + <string>1CD0528F0623707200166675</string> + <string>XCMainBuildResultsModuleGUID</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.buildV3</string> + <key>WindowString</key> + <string>347 296 500 500 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>2438EA86102F69A0004A851C</string> + <key>WindowToolIsVisible</key> + <false/> + </dict> + <dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>windowTool.debugger</string> + <key>IsVertical</key> + <true/> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>Debugger</key> + <dict> + <key>HorizontalSplitView</key> + <dict> + <key>_collapsingFrameDimension</key> + <real>0.0</real> + <key>_indexOfCollapsedView</key> + <integer>0</integer> + <key>_percentageOfCollapsedView</key> + <real>0.0</real> + <key>isCollapsed</key> + <string>yes</string> + <key>sizes</key> + <array> + <string>{{0, 0}, {316, 185}}</string> + <string>{{316, 0}, {378, 185}}</string> + </array> + </dict> + <key>VerticalSplitView</key> + <dict> + <key>_collapsingFrameDimension</key> + <real>0.0</real> + <key>_indexOfCollapsedView</key> + <integer>0</integer> + <key>_percentageOfCollapsedView</key> + <real>0.0</real> + <key>isCollapsed</key> + <string>yes</string> + <key>sizes</key> + <array> + <string>{{0, 0}, {694, 185}}</string> + <string>{{0, 185}, {694, 196}}</string> + </array> + </dict> + </dict> + <key>LauncherConfigVersion</key> + <string>8</string> + <key>PBXProjectModuleGUID</key> + <string>1C162984064C10D400B95A72</string> + <key>PBXProjectModuleLabel</key> + <string>Debug - GLUTExamples (Underwater)</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>DebugConsoleVisible</key> + <string>None</string> + <key>DebugConsoleWindowFrame</key> + <string>{{200, 200}, {500, 300}}</string> + <key>DebugSTDIOWindowFrame</key> + <string>{{200, 200}, {500, 300}}</string> + <key>Frame</key> + <string>{{0, 0}, {694, 381}}</string> + <key>PBXDebugSessionStackFrameViewKey</key> + <dict> + <key>DebugVariablesTableConfiguration</key> + <array> + <string>Name</string> + <real>120</real> + <string>Value</string> + <real>85</real> + <string>Summary</string> + <real>148</real> + </array> + <key>Frame</key> + <string>{{316, 0}, {378, 185}}</string> + <key>RubberWindowFrame</key> + <string>347 374 694 422 0 0 1440 878 </string> + </dict> + <key>RubberWindowFrame</key> + <string>347 374 694 422 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXDebugSessionModule</string> + <key>Proportion</key> + <string>381pt</string> + </dict> + </array> + <key>Proportion</key> + <string>381pt</string> + </dict> + </array> + <key>Name</key> + <string>Debugger</string> + <key>ServiceClasses</key> + <array> + <string>PBXDebugSessionModule</string> + </array> + <key>StatusbarIsVisible</key> + <true/> + <key>TableOfContents</key> + <array> + <string>1CD10A99069EF8BA00B06720</string> + <string>2438EA88102F69A0004A851C</string> + <string>1C162984064C10D400B95A72</string> + <string>2438EA89102F69A0004A851C</string> + <string>2438EA8A102F69A0004A851C</string> + <string>2438EA8B102F69A0004A851C</string> + <string>2438EA8C102F69A0004A851C</string> + <string>2438EA8D102F69A0004A851C</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.debugV3</string> + <key>WindowString</key> + <string>347 374 694 422 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1CD10A99069EF8BA00B06720</string> + <key>WindowToolIsVisible</key> + <false/> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.find</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CDD528C0622207200134675</string> + <key>PBXProjectModuleLabel</key> + <string>&lt;No Editor&gt;</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528D0623707200166675</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <integer>1</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {781, 167}}</string> + <key>RubberWindowFrame</key> + <string>62 385 781 470 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>781pt</string> + </dict> + </array> + <key>Proportion</key> + <string>50%</string> + </dict> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528E0623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>Project Find</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{8, 0}, {773, 254}}</string> + <key>RubberWindowFrame</key> + <string>62 385 781 470 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXProjectFindModule</string> + <key>Proportion</key> + <string>50%</string> + </dict> + </array> + <key>Proportion</key> + <string>428pt</string> + </dict> + </array> + <key>Name</key> + <string>Project Find</string> + <key>ServiceClasses</key> + <array> + <string>PBXProjectFindModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C530D57069F1CE1000CFCEE</string> + <string>1C530D58069F1CE1000CFCEE</string> + <string>1C530D59069F1CE1000CFCEE</string> + <string>1CDD528C0622207200134675</string> + <string>1C530D5A069F1CE1000CFCEE</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>1CD0528E0623707200166675</string> + </array> + <key>WindowString</key> + <string>62 385 781 470 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1C530D57069F1CE1000CFCEE</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>MENUSEPARATOR</string> + </dict> + <dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>windowTool.debuggerConsole</string> + <key>IsVertical</key> + <true/> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <true/> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAAC065D492600B07095</string> + <key>PBXProjectModuleLabel</key> + <string>Debugger Console</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {650, 209}}</string> + <key>RubberWindowFrame</key> + <string>347 546 650 250 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXDebugCLIModule</string> + <key>Proportion</key> + <string>209pt</string> + </dict> + </array> + <key>Proportion</key> + <string>209pt</string> + </dict> + </array> + <key>Name</key> + <string>Debugger Console</string> + <key>ServiceClasses</key> + <array> + <string>PBXDebugCLIModule</string> + </array> + <key>StatusbarIsVisible</key> + <true/> + <key>TableOfContents</key> + <array> + <string>1C78EAAD065D492600B07095</string> + <string>2438EA8E102F69A0004A851C</string> + <string>1C78EAAC065D492600B07095</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.consoleV3</string> + <key>WindowString</key> + <string>347 546 650 250 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1C78EAAD065D492600B07095</string> + <key>WindowToolIsVisible</key> + <true/> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.snapshots</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>XCSnapshotModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Snapshots</string> + <key>ServiceClasses</key> + <array> + <string>XCSnapshotModule</string> + </array> + <key>StatusbarIsVisible</key> + <string>Yes</string> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.snapshots</string> + <key>WindowString</key> + <string>315 824 300 550 0 0 1440 878 </string> + <key>WindowToolIsVisible</key> + <string>Yes</string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.scm</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAB2065D492600B07095</string> + <key>PBXProjectModuleLabel</key> + <string>&lt;No Editor&gt;</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAB3065D492600B07095</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <integer>1</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {452, 0}}</string> + <key>RubberWindowFrame</key> + <string>743 379 452 308 0 0 1280 1002 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>0pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD052920623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>SCM</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>ConsoleFrame</key> + <string>{{0, 259}, {452, 0}}</string> + <key>Frame</key> + <string>{{0, 7}, {452, 259}}</string> + <key>RubberWindowFrame</key> + <string>743 379 452 308 0 0 1280 1002 </string> + <key>TableConfiguration</key> + <array> + <string>Status</string> + <real>30</real> + <string>FileName</string> + <real>199</real> + <string>Path</string> + <real>197.0950012207031</real> + </array> + <key>TableFrame</key> + <string>{{0, 0}, {452, 250}}</string> + </dict> + <key>Module</key> + <string>PBXCVSModule</string> + <key>Proportion</key> + <string>262pt</string> + </dict> + </array> + <key>Proportion</key> + <string>266pt</string> + </dict> + </array> + <key>Name</key> + <string>SCM</string> + <key>ServiceClasses</key> + <array> + <string>PBXCVSModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C78EAB4065D492600B07095</string> + <string>1C78EAB5065D492600B07095</string> + <string>1C78EAB2065D492600B07095</string> + <string>1CD052920623707200166675</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.scm</string> + <key>WindowString</key> + <string>743 379 452 308 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.breakpoints</string> + <key>IsVertical</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C77FABC04509CD000000102</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>1CE0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>no</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>168</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>1C77FABC04509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {168, 350}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <integer>0</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {185, 368}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>168</real> + </array> + <key>RubberWindowFrame</key> + <string>315 424 744 409 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>185pt</string> + </dict> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CA1AED706398EBD00589147</string> + <key>PBXProjectModuleLabel</key> + <string>Detail</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{190, 0}, {554, 368}}</string> + <key>RubberWindowFrame</key> + <string>315 424 744 409 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>XCDetailModule</string> + <key>Proportion</key> + <string>554pt</string> + </dict> + </array> + <key>Proportion</key> + <string>368pt</string> + </dict> + </array> + <key>MajorVersion</key> + <integer>3</integer> + <key>MinorVersion</key> + <integer>0</integer> + <key>Name</key> + <string>Breakpoints</string> + <key>ServiceClasses</key> + <array> + <string>PBXSmartGroupTreeModule</string> + <string>XCDetailModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1CDDB66807F98D9800BB5817</string> + <string>1CDDB66907F98D9800BB5817</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>1CA1AED706398EBD00589147</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.breakpointsV3</string> + <key>WindowString</key> + <string>315 424 744 409 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1CDDB66807F98D9800BB5817</string> + <key>WindowToolIsVisible</key> + <integer>1</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.debugAnimator</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Debug Visualizer</string> + <key>ServiceClasses</key> + <array> + <string>PBXNavigatorGroup</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.debugAnimatorV3</string> + <key>WindowString</key> + <string>100 100 700 500 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.bookmarks</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>PBXBookmarksModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Bookmarks</string> + <key>ServiceClasses</key> + <array> + <string>PBXBookmarksModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>WindowString</key> + <string>538 42 401 187 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.projectFormatConflicts</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>XCProjectFormatConflictsModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Project Format Conflicts</string> + <key>ServiceClasses</key> + <array> + <string>XCProjectFormatConflictsModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>WindowContentMinSize</key> + <string>450 300</string> + <key>WindowString</key> + <string>50 850 472 307 0 0 1440 877</string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.classBrowser</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>OptionsSetName</key> + <string>Hierarchy, all classes</string> + <key>PBXProjectModuleGUID</key> + <string>1CA6456E063B45B4001379D8</string> + <key>PBXProjectModuleLabel</key> + <string>Class Browser - NSObject</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>ClassesFrame</key> + <string>{{0, 0}, {374, 96}}</string> + <key>ClassesTreeTableConfiguration</key> + <array> + <string>PBXClassNameColumnIdentifier</string> + <real>208</real> + <string>PBXClassBookColumnIdentifier</string> + <real>22</real> + </array> + <key>Frame</key> + <string>{{0, 0}, {630, 331}}</string> + <key>MembersFrame</key> + <string>{{0, 105}, {374, 395}}</string> + <key>MembersTreeTableConfiguration</key> + <array> + <string>PBXMemberTypeIconColumnIdentifier</string> + <real>22</real> + <string>PBXMemberNameColumnIdentifier</string> + <real>216</real> + <string>PBXMemberTypeColumnIdentifier</string> + <real>97</real> + <string>PBXMemberBookColumnIdentifier</string> + <real>22</real> + </array> + <key>PBXModuleWindowStatusBarHidden2</key> + <integer>1</integer> + <key>RubberWindowFrame</key> + <string>385 179 630 352 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXClassBrowserModule</string> + <key>Proportion</key> + <string>332pt</string> + </dict> + </array> + <key>Proportion</key> + <string>332pt</string> + </dict> + </array> + <key>Name</key> + <string>Class Browser</string> + <key>ServiceClasses</key> + <array> + <string>PBXClassBrowserModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>TableOfContents</key> + <array> + <string>1C0AD2AF069F1E9B00FABCE6</string> + <string>1C0AD2B0069F1E9B00FABCE6</string> + <string>1CA6456E063B45B4001379D8</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.classbrowser</string> + <key>WindowString</key> + <string>385 179 630 352 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1C0AD2AF069F1E9B00FABCE6</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.refactoring</string> + <key>IncludeInToolsMenu</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{0, 0}, {500, 335}</string> + <key>RubberWindowFrame</key> + <string>{0, 0}, {500, 335}</string> + </dict> + <key>Module</key> + <string>XCRefactoringModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Refactoring</string> + <key>ServiceClasses</key> + <array> + <string>XCRefactoringModule</string> + </array> + <key>WindowString</key> + <string>200 200 500 356 0 0 1920 1200 </string> + </dict> + </array> +</dict> +</plist> diff --git a/Eko/Eko.xcodeproj/lericson.pbxuser b/Eko/Eko.xcodeproj/lericson.pbxuser new file mode 100644 index 0000000..5eaecb1 --- /dev/null +++ b/Eko/Eko.xcodeproj/lericson.pbxuser @@ -0,0 +1,318 @@ +// !$*UTF8*$! +{ + 2438EA65102F6360004A851C /* Eko */ = { + isa = PBXExecutable; + activeArgIndices = ( + ); + argumentStrings = ( + ); + autoAttachOnCrash = 1; + breakpointsEnabled = 0; + configStateDict = { + }; + customDataFormattersEnabled = 1; + debuggerPlugin = GDBDebugging; + disassemblyDisplayState = 0; + dylibVariantSuffix = ""; + enableDebugStr = 0; + environmentEntries = ( + { + active = YES; + name = EKO_SERVER; + value = "http://localhost:8080/"; + }, + ); + executableSystemSymbolLevel = 0; + executableUserSymbolLevel = 0; + libgmallocEnabled = 0; + name = Eko; + savedGlobals = { + }; + sourceDirectories = ( + ); + }; + 2438EA75102F6367004A851C /* Source Control */ = { + isa = PBXSourceControlManager; + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + scmConfiguration = { + }; + }; + 2438EA76102F6367004A851C /* Code sense */ = { + isa = PBXCodeSenseManager; + indexTemplatePath = ""; + }; + 2438EAA5102F7033004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 7790198E0C07548A00326F66 /* EkoAppDelegate.py */; + name = "EkoAppDelegate.py: 61"; + rLen = 0; + rLoc = 1727; + rType = 0; + vrLen = 438; + vrLoc = 0; + }; + 2438EAA6102F7033004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 77631A3E0C0748CF005415CB /* main.py */; + name = "main.py: 5"; + rLen = 0; + rLoc = 47; + rType = 0; + vrLen = 346; + vrLoc = 0; + }; + 2438EAA7102F7033004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 29B97316FDCFA39411CA2CEA /* main.m */; + name = "main.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 523; + vrLoc = 0; + }; + 2438EAD1102F76AB004A851C /* eko.py */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {519, 2212}}"; + sepNavSelRange = "{5422, 0}"; + sepNavVisRange = "{4699, 612}"; + }; + }; + 2438EAD3102F76B8004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 7790198E0C07548A00326F66 /* EkoAppDelegate.py */; + name = "EkoAppDelegate.py: 86"; + rLen = 0; + rLoc = 2726; + rType = 0; + vrLen = 570; + vrLoc = 0; + }; + 2438EAD5102F76B8004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 7790198E0C07548A00326F66 /* EkoAppDelegate.py */; + name = "EkoAppDelegate.py: 86"; + rLen = 0; + rLoc = 2726; + rType = 0; + vrLen = 570; + vrLoc = 0; + }; + 2438EAE7102F95F7004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2438EAD1102F76AB004A851C /* eko.py */; + name = "eko.py: 157"; + rLen = 0; + rLoc = 5422; + rType = 0; + vrLen = 612; + vrLoc = 4699; + }; + 2438EAE9102F95F7004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2438EAD1102F76AB004A851C /* eko.py */; + name = "eko.py: 157"; + rLen = 0; + rLoc = 5422; + rType = 0; + vrLen = 612; + vrLoc = 4699; + }; + 2438EB14102FA0AF004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 29B97316FDCFA39411CA2CEA /* main.m */; + name = "main.m: 33"; + rLen = 0; + rLoc = 1200; + rType = 0; + vrLen = 815; + vrLoc = 967; + }; + 2438EB15102FA0AF004A851C /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2438EB0E102F9F20004A851C /* eko.icns */; + }; + 2438EB16102FA0AF004A851C /* PlistBookmark */ = { + isa = PlistBookmark; + fRef = 8D1107310486CEB800E47090 /* Info.plist */; + fallbackIsa = PBXBookmark; + isK = 0; + kPath = ( + CFBundleName, + ); + name = /Users/ludvigericson/Development/eko/Eko/Info.plist; + rLen = 0; + rLoc = 2147483647; + }; + 2438EB17102FA0AF004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 77631A3E0C0748CF005415CB /* main.py */; + name = "main.py: 5"; + rLen = 0; + rLoc = 47; + rType = 0; + vrLen = 346; + vrLoc = 0; + }; + 2438EB18102FA0AF004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 29B97316FDCFA39411CA2CEA /* main.m */; + name = "main.m: 33"; + rLen = 0; + rLoc = 1200; + rType = 0; + vrLen = 815; + vrLoc = 967; + }; + 2438EB19102FA0AF004A851C /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2438EB0E102F9F20004A851C /* eko.icns */; + }; + 2438EB1A102FA0AF004A851C /* PlistBookmark */ = { + isa = PlistBookmark; + fRef = 8D1107310486CEB800E47090 /* Info.plist */; + fallbackIsa = PBXBookmark; + isK = 0; + kPath = ( + CFBundleName, + ); + name = /Users/ludvigericson/Development/eko/Eko/Info.plist; + rLen = 0; + rLoc = 2147483647; + }; + 2438EB1B102FA0AF004A851C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 77631A3E0C0748CF005415CB /* main.py */; + name = "main.py: 5"; + rLen = 0; + rLoc = 47; + rType = 0; + vrLen = 372; + vrLoc = 0; + }; + 24812E4E102FA0C3003B1D41 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 77631A3E0C0748CF005415CB /* main.py */; + name = "main.py: 5"; + rLen = 0; + rLoc = 47; + rType = 0; + vrLen = 0; + vrLoc = 0; + }; + 29B97313FDCFA39411CA2CEA /* Project object */ = { + activeBuildConfigurationName = Debug; + activeExecutable = 2438EA65102F6360004A851C /* Eko */; + activeTarget = 8D1107260486CEB800E47090 /* Eko */; + addToTargets = ( + 8D1107260486CEB800E47090 /* Eko */, + ); + codeSenseManager = 2438EA76102F6367004A851C /* Code sense */; + executables = ( + 2438EA65102F6360004A851C /* Eko */, + ); + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 300, + 231, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXErrorsWarningsDataSource_TypeID, + PBXErrorsWarningsDataSource_MessageID, + PBXErrorsWarningsDataSource_LocationID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 22, + 300, + 229, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXExecutablesDataSource_ActiveFlagID, + PBXExecutablesDataSource_NameID, + PBXExecutablesDataSource_CommentsID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 341, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 271556795; + PBXWorkspaceStateSaveDate = 271556795; + }; + perUserProjectItems = { + 2438EAA5102F7033004A851C = 2438EAA5102F7033004A851C /* PBXTextBookmark */; + 2438EAA6102F7033004A851C = 2438EAA6102F7033004A851C /* PBXTextBookmark */; + 2438EAA7102F7033004A851C = 2438EAA7102F7033004A851C /* PBXTextBookmark */; + 2438EAD3102F76B8004A851C = 2438EAD3102F76B8004A851C /* PBXTextBookmark */; + 2438EAD5102F76B8004A851C = 2438EAD5102F76B8004A851C /* PBXTextBookmark */; + 2438EAE7102F95F7004A851C = 2438EAE7102F95F7004A851C /* PBXTextBookmark */; + 2438EAE9102F95F7004A851C = 2438EAE9102F95F7004A851C /* PBXTextBookmark */; + 2438EB14102FA0AF004A851C = 2438EB14102FA0AF004A851C /* PBXTextBookmark */; + 2438EB15102FA0AF004A851C = 2438EB15102FA0AF004A851C /* PBXBookmark */; + 2438EB16102FA0AF004A851C = 2438EB16102FA0AF004A851C /* PlistBookmark */; + 2438EB17102FA0AF004A851C = 2438EB17102FA0AF004A851C /* PBXTextBookmark */; + 2438EB18102FA0AF004A851C = 2438EB18102FA0AF004A851C /* PBXTextBookmark */; + 2438EB19102FA0AF004A851C = 2438EB19102FA0AF004A851C /* PBXBookmark */; + 2438EB1A102FA0AF004A851C = 2438EB1A102FA0AF004A851C /* PlistBookmark */; + 2438EB1B102FA0AF004A851C = 2438EB1B102FA0AF004A851C /* PBXTextBookmark */; + 24812E4E102FA0C3003B1D41 /* PBXTextBookmark */ = 24812E4E102FA0C3003B1D41 /* PBXTextBookmark */; + }; + sourceControlManager = 2438EA75102F6367004A851C /* Source Control */; + userBuildSettings = { + }; + }; + 29B97316FDCFA39411CA2CEA /* main.m */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1200, 700}}"; + sepNavSelRange = "{1200, 0}"; + sepNavVisRange = "{967, 815}"; + }; + }; + 77631A3E0C0748CF005415CB /* main.py */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {534, 294}}"; + sepNavSelRange = "{47, 0}"; + sepNavVisRange = "{0, 0}"; + }; + }; + 7790198E0C07548A00326F66 /* EkoAppDelegate.py */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {519, 1288}}"; + sepNavSelRange = "{2726, 0}"; + sepNavVisRange = "{0, 570}"; + }; + }; + 8D1107260486CEB800E47090 /* Eko */ = { + activeExec = 0; + executables = ( + 2438EA65102F6360004A851C /* Eko */, + ); + }; +} diff --git a/Eko/Eko.xcodeproj/project.pbxproj b/Eko/Eko.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1d95f47 --- /dev/null +++ b/Eko/Eko.xcodeproj/project.pbxproj @@ -0,0 +1,303 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 44; + objects = { + +/* Begin PBXBuildFile section */ + 2438EAD2102F76AB004A851C /* eko.py in Resources */ = {isa = PBXBuildFile; fileRef = 2438EAD1102F76AB004A851C /* eko.py */; }; + 2438EB0F102F9F20004A851C /* eko.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2438EB0E102F9F20004A851C /* eko.icns */; }; + 77631A270C06C501005415CB /* Python.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77631A260C06C501005415CB /* Python.framework */; }; + 77631A3F0C0748CF005415CB /* main.py in Resources */ = {isa = PBXBuildFile; fileRef = 77631A3E0C0748CF005415CB /* main.py */; }; + 7790198F0C07548A00326F66 /* EkoAppDelegate.py in Resources */ = {isa = PBXBuildFile; fileRef = 7790198E0C07548A00326F66 /* EkoAppDelegate.py */; }; + 77C8C1F90C07829500965286 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 77C8C1F70C07829500965286 /* MainMenu.xib */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; + A5501C9C102F5B9600A02BF0 /* info.png in Resources */ = {isa = PBXBuildFile; fileRef = A5501C9B102F5B9600A02BF0 /* info.png */; }; + A5501CA1102F5D5300A02BF0 /* resend.png in Resources */ = {isa = PBXBuildFile; fileRef = A5501CA0102F5D5300A02BF0 /* resend.png */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; + 2438EAD1102F76AB004A851C /* eko.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = eko.py; path = ../eko.py; sourceTree = SOURCE_ROOT; }; + 2438EB0E102F9F20004A851C /* eko.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = eko.icns; sourceTree = "<group>"; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; + 32CA4F630368D1EE00C91783 /* Eko_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Eko_Prefix.pch; sourceTree = "<group>"; }; + 77631A260C06C501005415CB /* Python.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Python.framework; path = /System/Library/Frameworks/Python.framework; sourceTree = "<absolute>"; }; + 77631A3E0C0748CF005415CB /* main.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = main.py; sourceTree = "<group>"; }; + 7790198E0C07548A00326F66 /* EkoAppDelegate.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = EkoAppDelegate.py; sourceTree = "<group>"; }; + 77C8C1F80C07829500965286 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + 8D1107320486CEB800E47090 /* Eko.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Eko.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A5501C9B102F5B9600A02BF0 /* info.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = info.png; sourceTree = "<group>"; }; + A5501CA0102F5D5300A02BF0 /* resend.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = resend.png; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 77631A270C06C501005415CB /* Python.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 7790198E0C07548A00326F66 /* EkoAppDelegate.py */, + ); + name = Classes; + sourceTree = "<group>"; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 77631A260C06C501005415CB /* Python.framework */, + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = "<group>"; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = "<group>"; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* Eko.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 29B97314FDCFA39411CA2CEA /* Eko */ = { + isa = PBXGroup; + children = ( + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = Eko; + sourceTree = "<group>"; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* Eko_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + 77631A3E0C0748CF005415CB /* main.py */, + ); + name = "Other Sources"; + sourceTree = "<group>"; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 2438EB0E102F9F20004A851C /* eko.icns */, + 2438EAD1102F76AB004A851C /* eko.py */, + A5501CA0102F5D5300A02BF0 /* resend.png */, + A5501C9B102F5B9600A02BF0 /* info.png */, + 77C8C1F70C07829500965286 /* MainMenu.xib */, + 8D1107310486CEB800E47090 /* Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = "<group>"; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* Eko */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Eko" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Eko; + productInstallPath = "$(HOME)/Applications"; + productName = Eko; + productReference = 8D1107320486CEB800E47090 /* Eko.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Eko" */; + compatibilityVersion = "Xcode 3.0"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* Eko */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* Eko */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 77631A3F0C0748CF005415CB /* main.py in Resources */, + 7790198F0C07548A00326F66 /* EkoAppDelegate.py in Resources */, + 77C8C1F90C07829500965286 /* MainMenu.xib in Resources */, + A5501C9C102F5B9600A02BF0 /* info.png in Resources */, + A5501CA1102F5D5300A02BF0 /* resend.png in Resources */, + 2438EAD2102F76AB004A851C /* eko.py in Resources */, + 2438EB0F102F9F20004A851C /* eko.icns in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = "<group>"; + }; + 77C8C1F70C07829500965286 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 77C8C1F80C07829500965286 /* English */, + ); + name = MainMenu.xib; + sourceTree = "<group>"; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Eko_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = Eko; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Eko_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = Eko; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Eko" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Eko" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/Eko/EkoAppDelegate.py b/Eko/EkoAppDelegate.py new file mode 100644 index 0000000..6f2b130 --- /dev/null +++ b/Eko/EkoAppDelegate.py @@ -0,0 +1,181 @@ +"""THE APP DELEGATE :O""" + +import os +import datetime +import logging + +from objc import IBOutlet, IBAction, selector, object_lock +from Foundation import * +from AppKit import * + +import eko + +class NSLogHandler(logging.Handler): + def emit(self, record): + msg = self.format(record) + if isinstance(msg, str): + msg = msg.decode("utf-8", "replace") + #import pdb ; pdb.set_trace() + NSLog(msg) + +class CocoaEkoClient(NSObject, eko.EkoClient): + @property + def __init__(self): raise AttributeError("removed attribute") + + def initWithServer_AtURL_usingNamespace(self, server_url, target_url, namespace): + NSLog("init: server = %r, target = %r, ns = %r" % + (server_url, target_url, namespace)) + eko.EkoClient.__init__(self, target_url, namespace=namespace, + server_url=server_url) + + @classmethod + def newAtURL_usingNamespace_(cls, target_url, namespace): + server_url = os.environ.get("EKO_SERVER", cls.server_url) + self = cls.new() + self.initWithServer_AtURL_usingNamespace(server_url, target_url, namespace) + return self + + @property + def running(self): + return NSApp.isRunning() and not NSThread.currentThread().isCancelled() + + @running.setter + def running(self, value): + if value != self.running: + raise ValueError("can't change running to %r" % (value,)) + + def emit_request_forwarded(self, request, response): + with object_lock(self.request_items): + req_item = RequestItem.from_emission(request, response) + self.request_items.append(req_item) + NSApp.delegate().requestView.performSelectorOnMainThread_withObject_waitUntilDone_( + "reloadData", None, True) + +class RequestItemDataSource(NSObject): +# def outlineView_child_ofItem_(self, view, child_idx, parent_item): +# if parent_item is None: +# return self.src[child_idx] +# else: +# return parent_item.data[child_idx] +# +# def outlineView_isItemExpandable_(self, view, item): +# return hasattr(item, "data") +# +# def outlineView_objectValueForTableColumn_byItem_(self, view, column, item): +# attr = column.identifier() +# if not attr: +# return None +# if hasattr(item, "get_" + attr + "_view"): +# return getattr(item, "get_" + attr + "_view")() +# else: +# NSLog("item repr of %s: %r" % (attr, item)) +# return getattr(item, attr, "<UNSET>") + + def numberOfRowsInTableView_(self, view): + return len(self.src) + + def tableView_objectValueForTableColumn_row_(self, view, column, row_idx): + attr = column.identifier() + item = self.src[row_idx] + if not attr: + return + return getattr(item, attr) + + @classmethod + def newWithSource_(cls, src): + self = cls.new() + self.src = src + return self + +class RequestItem(NSObject): + def initWithPair(self, request, response): + self.init() + self.request = request + self.response = response + self.method = request.get_method() + self.path = request.get_selector() + self.timestamp = datetime.datetime.now() + + @classmethod + def from_emission(cls, request, response): + self = cls.alloc() + self.initWithPair(request, response) + return self + +class MyTestClass(NSObject): + @classmethod + def myClassMeth_(cls, arg): + pool = NSAutoreleasePool.alloc() + pool.init() + NSLog("test target: %r" % (arg,)) + pool.drain() + pool.release() + +class EkoClientThread(NSThread): + def initAtURL_usingNamespace_withItems_(self, target_url, namespace, request_items): + self.target_url = target_url + self.namespace = namespace + self.request_items = request_items + + @classmethod + def newAtURL_usingNamespace_withItems_(cls, url, ns, items): + self = cls.new() + self.initAtURL_usingNamespace_withItems_(url, ns, items) + return self + + def main(self): + pool = NSAutoreleasePool.alloc() + pool.init() + NSLog("A") + NSLog("B") + client = CocoaEkoClient.newAtURL_usingNamespace_( + self.target_url, self.namespace) + NSLog("C") + client.request_items = self.request_items + try: + NSLog("D") + client.run_forever() + finally: + NSLog("E") + pool.drain() + pool.release() + +class EkoAppDelegate(NSObject): + targetURL = IBOutlet() + namespace = IBOutlet() + requestView = IBOutlet() + + @IBAction + def updateURLs_(self, sender): + target_url = self.targetURL.stringValue() + namespace = self.namespace.stringValue() + with object_lock(self.request_items): + self.request_items[:] = [] + self.requestView.reloadData() + if hasattr(self, "client_thread"): + self.client_thread.cancel() + self.client_thread = EkoClientThread.newAtURL_usingNamespace_withItems_( + target_url, namespace, self.request_items) + self.client_thread.start() + ##self.client_thread = NSThread.new() + ##self.client_thread.initWithTarget_selector_object_( + ## None, selector(runEkoClientThread_, isClassMethod=True), + ## (target_url, namespace, self.request_items)) + ##self.client_thread.start() + #NSThread.detachNewThreadSelector_toTarget_withObject_( + # selector(MyTestClass.myClassMeth_, + # isClassMethod=True, + # argumentTypes="s"), + # MyTestClass, + # "hello") + #t = NSThread.new() + #t.initWithTarget_selector_object_(None, selector(my_test_target), "hello") + #t.start() + #self.t = t + + def applicationDidFinishLaunching_(self, sender): + logging.basicConfig(level=logging.DEBUG) + logging.root.addHandler(NSLogHandler()) + #CFRunLoopSourceCreate(None, 0, ()) + self.request_items = NSMutableArray.new() + self.requestView.setDataSource_(RequestItemDataSource.newWithSource_(self.request_items)) diff --git a/Eko/Eko_Prefix.pch b/Eko/Eko_Prefix.pch new file mode 100644 index 0000000..8fd5599 --- /dev/null +++ b/Eko/Eko_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'Eko' target in the 'Eko' project +// + +#ifdef __OBJC__ + #import <Cocoa/Cocoa.h> +#endif diff --git a/Eko/English.lproj/InfoPlist.strings b/Eko/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..e7bfaa3 Binary files /dev/null and b/Eko/English.lproj/InfoPlist.strings differ diff --git a/Eko/English.lproj/MainMenu.xib b/Eko/English.lproj/MainMenu.xib new file mode 100644 index 0000000..8b803ae --- /dev/null +++ b/Eko/English.lproj/MainMenu.xib @@ -0,0 +1,2216 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> + <data> + <int key="IBDocument.SystemTarget">1050</int> + <string key="IBDocument.SystemVersion">9L30</string> + <string key="IBDocument.InterfaceBuilderVersion">677</string> + <string key="IBDocument.AppKitVersion">949.54</string> + <string key="IBDocument.HIToolboxVersion">353.00</string> + <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> + <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="29"/> + <integer value="372"/> + </object> + <object class="NSArray" key="IBDocument.PluginDependencies"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilderKit</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + </object> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <object class="NSMutableArray" key="IBDocument.RootObjects" id="1048"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSCustomObject" id="1021"> + <string key="NSClassName">NSApplication</string> + </object> + <object class="NSCustomObject" id="1014"> + <string key="NSClassName">FirstResponder</string> + </object> + <object class="NSCustomObject" id="1050"> + <string key="NSClassName">NSApplication</string> + </object> + <object class="NSMenu" id="649796088"> + <string key="NSTitle">AMainMenu</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="694149608"> + <reference key="NSMenu" ref="649796088"/> + <string key="NSTitle">Eko</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <object class="NSCustomResource" key="NSOnImage" id="715147791"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSMenuCheckmark</string> + </object> + <object class="NSCustomResource" key="NSMixedImage" id="370621835"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSMenuMixedState</string> + </object> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="110575045"> + <string key="NSTitle">Eko</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="238522557"> + <reference key="NSMenu" ref="110575045"/> + <string key="NSTitle">About Eko</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="304266470"> + <reference key="NSMenu" ref="110575045"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="609285721"> + <reference key="NSMenu" ref="110575045"/> + <string type="base64-UTF8" key="NSTitle">UHJlZmVyZW5jZXPigKY</string> + <string key="NSKeyEquiv">,</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="481834944"> + <reference key="NSMenu" ref="110575045"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="1046388886"> + <reference key="NSMenu" ref="110575045"/> + <string key="NSTitle">Services</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="752062318"> + <string key="NSTitle">Services</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <string key="NSName">_NSServicesMenu</string> + </object> + </object> + <object class="NSMenuItem" id="646227648"> + <reference key="NSMenu" ref="110575045"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="755159360"> + <reference key="NSMenu" ref="110575045"/> + <string key="NSTitle">Hide Eko</string> + <string key="NSKeyEquiv">h</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="342932134"> + <reference key="NSMenu" ref="110575045"/> + <string key="NSTitle">Hide Others</string> + <string key="NSKeyEquiv">h</string> + <int key="NSKeyEquivModMask">1572864</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="908899353"> + <reference key="NSMenu" ref="110575045"/> + <string key="NSTitle">Show All</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="1056857174"> + <reference key="NSMenu" ref="110575045"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="632727374"> + <reference key="NSMenu" ref="110575045"/> + <string key="NSTitle">Quit Eko</string> + <string key="NSKeyEquiv">q</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + </object> + <string key="NSName">_NSAppleMenu</string> + </object> + </object> + <object class="NSMenuItem" id="952259628"> + <reference key="NSMenu" ref="649796088"/> + <string key="NSTitle">Edit</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="789758025"> + <string key="NSTitle">Edit</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="1058277027"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Undo</string> + <string key="NSKeyEquiv">z</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="790794224"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Redo</string> + <string key="NSKeyEquiv">Z</string> + <int key="NSKeyEquivModMask">1179648</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="1040322652"> + <reference key="NSMenu" ref="789758025"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="296257095"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Cut</string> + <string key="NSKeyEquiv">x</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="860595796"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Copy</string> + <string key="NSKeyEquiv">c</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="29853731"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Paste</string> + <string key="NSKeyEquiv">v</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="437104165"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Delete</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="583158037"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Select All</string> + <string key="NSKeyEquiv">a</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="212016141"> + <reference key="NSMenu" ref="789758025"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="892235320"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Find</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="963351320"> + <string key="NSTitle">Find</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="447796847"> + <reference key="NSMenu" ref="963351320"/> + <string type="base64-UTF8" key="NSTitle">RmluZOKApg</string> + <string key="NSKeyEquiv">f</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <int key="NSTag">1</int> + </object> + <object class="NSMenuItem" id="326711663"> + <reference key="NSMenu" ref="963351320"/> + <string key="NSTitle">Find Next</string> + <string key="NSKeyEquiv">g</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <int key="NSTag">2</int> + </object> + <object class="NSMenuItem" id="270902937"> + <reference key="NSMenu" ref="963351320"/> + <string key="NSTitle">Find Previous</string> + <string key="NSKeyEquiv">G</string> + <int key="NSKeyEquivModMask">1179648</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <int key="NSTag">3</int> + </object> + <object class="NSMenuItem" id="159080638"> + <reference key="NSMenu" ref="963351320"/> + <string key="NSTitle">Use Selection for Find</string> + <string key="NSKeyEquiv">e</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <int key="NSTag">7</int> + </object> + <object class="NSMenuItem" id="88285865"> + <reference key="NSMenu" ref="963351320"/> + <string key="NSTitle">Jump to Selection</string> + <string key="NSKeyEquiv">j</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + </object> + </object> + </object> + <object class="NSMenuItem" id="972420730"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Spelling and Grammar</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="769623530"> + <string key="NSTitle">Spelling and Grammar</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="679648819"> + <reference key="NSMenu" ref="769623530"/> + <string type="base64-UTF8" key="NSTitle">U2hvdyBTcGVsbGluZ+KApg</string> + <string key="NSKeyEquiv">:</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="96193923"> + <reference key="NSMenu" ref="769623530"/> + <string key="NSTitle">Check Spelling</string> + <string key="NSKeyEquiv">;</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="948374510"> + <reference key="NSMenu" ref="769623530"/> + <string key="NSTitle">Check Spelling While Typing</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="967646866"> + <reference key="NSMenu" ref="769623530"/> + <string key="NSTitle">Check Grammar With Spelling</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + </object> + </object> + </object> + <object class="NSMenuItem" id="507821607"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Substitutions</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="698887838"> + <string key="NSTitle">Substitutions</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="605118523"> + <reference key="NSMenu" ref="698887838"/> + <string key="NSTitle">Smart Copy/Paste</string> + <string key="NSKeyEquiv">f</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <int key="NSTag">1</int> + </object> + <object class="NSMenuItem" id="197661976"> + <reference key="NSMenu" ref="698887838"/> + <string key="NSTitle">Smart Quotes</string> + <string key="NSKeyEquiv">g</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <int key="NSTag">2</int> + </object> + <object class="NSMenuItem" id="708854459"> + <reference key="NSMenu" ref="698887838"/> + <string key="NSTitle">Smart Links</string> + <string key="NSKeyEquiv">G</string> + <int key="NSKeyEquivModMask">1179648</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <int key="NSTag">3</int> + </object> + </object> + </object> + </object> + <object class="NSMenuItem" id="676164635"> + <reference key="NSMenu" ref="789758025"/> + <string key="NSTitle">Speech</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="785027613"> + <string key="NSTitle">Speech</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="731782645"> + <reference key="NSMenu" ref="785027613"/> + <string key="NSTitle">Start Speaking</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="680220178"> + <reference key="NSMenu" ref="785027613"/> + <string key="NSTitle">Stop Speaking</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + </object> + </object> + </object> + </object> + </object> + </object> + <object class="NSMenuItem" id="713487014"> + <reference key="NSMenu" ref="649796088"/> + <string key="NSTitle">Window</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="835318025"> + <string key="NSTitle">Window</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="1011231497"> + <reference key="NSMenu" ref="835318025"/> + <string key="NSTitle">Minimize</string> + <string key="NSKeyEquiv">m</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="575023229"> + <reference key="NSMenu" ref="835318025"/> + <string key="NSTitle">Zoom</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="299356726"> + <reference key="NSMenu" ref="835318025"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + <object class="NSMenuItem" id="625202149"> + <reference key="NSMenu" ref="835318025"/> + <string key="NSTitle">Bring All to Front</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + </object> + <string key="NSName">_NSWindowsMenu</string> + </object> + </object> + <object class="NSMenuItem" id="391199113"> + <reference key="NSMenu" ref="649796088"/> + <string key="NSTitle">Help</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="374024848"> + <string key="NSTitle">Help</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="238773614"> + <reference key="NSMenu" ref="374024848"/> + <string key="NSTitle">Eko Help</string> + <string key="NSKeyEquiv">?</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="715147791"/> + <reference key="NSMixedImage" ref="370621835"/> + </object> + </object> + </object> + </object> + </object> + <string key="NSName">_NSMainMenu</string> + </object> + <object class="NSWindowTemplate" id="972006081"> + <int key="NSWindowStyleMask">15</int> + <int key="NSWindowBacking">2</int> + <string key="NSWindowRect">{{147, 353}, {569, 347}}</string> + <int key="NSWTFlags">1946158080</int> + <string key="NSWindowTitle">Eko</string> + <string key="NSWindowClass">NSWindow</string> + <nil key="NSViewClass"/> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> + <string key="NSWindowContentMinSize">{569, 347}</string> + <object class="NSView" key="NSWindowView" id="439893737"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextField" id="614626927"> + <reference key="NSNextResponder" ref="439893737"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{331, 273}, {170, 22}}</string> + <reference key="NSSuperview" ref="439893737"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="639550805"> + <int key="NSCellFlags">-1804468671</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents"/> + <object class="NSFont" key="NSSupport" id="669758321"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.300000e+01</double> + <int key="NSfFlags">1044</int> + </object> + <reference key="NSControlView" ref="614626927"/> + <bool key="NSDrawsBackground">YES</bool> + <object class="NSColor" key="NSBackgroundColor" id="254796989"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textBackgroundColor</string> + <object class="NSColor" key="NSColor" id="144728694"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor" id="958707964"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textColor</string> + <object class="NSColor" key="NSColor" id="598914187"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> + </object> + </object> + </object> + <object class="NSTextField" id="411310864"> + <reference key="NSNextResponder" ref="439893737"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{331, 305}, {218, 22}}</string> + <reference key="NSSuperview" ref="439893737"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="928663428"> + <int key="NSCellFlags">-1804468671</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="669758321"/> + <reference key="NSControlView" ref="411310864"/> + <bool key="NSDrawsBackground">YES</bool> + <reference key="NSBackgroundColor" ref="254796989"/> + <reference key="NSTextColor" ref="958707964"/> + </object> + </object> + <object class="NSTextField" id="644613290"> + <reference key="NSNextResponder" ref="439893737"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{251, 307}, {78, 17}}</string> + <reference key="NSSuperview" ref="439893737"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="1039770882"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents">Target URL:</string> + <reference key="NSSupport" ref="669758321"/> + <reference key="NSControlView" ref="644613290"/> + <object class="NSColor" key="NSBackgroundColor" id="137276340"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlColor</string> + <object class="NSColor" key="NSColor" id="664895267"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor" id="675775997"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlTextColor</string> + <reference key="NSColor" ref="598914187"/> + </object> + </object> + </object> + <object class="NSTextField" id="713324176"> + <reference key="NSNextResponder" ref="439893737"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{248, 275}, {81, 17}}</string> + <reference key="NSSuperview" ref="439893737"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="715206149"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents">Namespace:</string> + <reference key="NSSupport" ref="669758321"/> + <reference key="NSControlView" ref="713324176"/> + <reference key="NSBackgroundColor" ref="137276340"/> + <reference key="NSTextColor" ref="675775997"/> + </object> + </object> + <object class="NSButton" id="880395183"> + <reference key="NSNextResponder" ref="439893737"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{325, 236}, {96, 32}}</string> + <reference key="NSSuperview" ref="439893737"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="524677927"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents">Apply</string> + <reference key="NSSupport" ref="669758321"/> + <reference key="NSControlView" ref="880395183"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">129</int> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSScrollView" id="361593978"> + <reference key="NSNextResponder" ref="439893737"/> + <int key="NSvFlags">274</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSClipView" id="538231122"> + <reference key="NSNextResponder" ref="361593978"/> + <int key="NSvFlags">2304</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTableView" id="245761583"> + <reference key="NSNextResponder" ref="538231122"/> + <int key="NSvFlags">256</int> + <string key="NSFrameSize">{554, 190}</string> + <reference key="NSSuperview" ref="538231122"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTableHeaderView" key="NSHeaderView" id="759371640"> + <reference key="NSNextResponder" ref="929668417"/> + <int key="NSvFlags">256</int> + <string key="NSFrameSize">{554, 17}</string> + <reference key="NSSuperview" ref="929668417"/> + <reference key="NSTableView" ref="245761583"/> + </object> + <object class="_NSCornerView" key="NSCornerView" id="720411877"> + <reference key="NSNextResponder" ref="361593978"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{555, 0}, {16, 17}}</string> + <reference key="NSSuperview" ref="361593978"/> + </object> + <object class="NSMutableArray" key="NSTableColumns"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTableColumn" id="104452508"> + <string key="NSIdentifier">method</string> + <double key="NSWidth">1.010000e+02</double> + <double key="NSMinWidth">4.000000e+01</double> + <double key="NSMaxWidth">1.000000e+03</double> + <object class="NSTableHeaderCell" key="NSHeaderCell"> + <int key="NSCellFlags">75628032</int> + <int key="NSCellFlags2">67108864</int> + <string key="NSContents">Method</string> + <object class="NSFont" key="NSSupport" id="26"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.100000e+01</double> + <int key="NSfFlags">3100</int> + </object> + <object class="NSColor" key="NSBackgroundColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes> + </object> + <object class="NSColor" key="NSTextColor" id="75656344"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">headerTextColor</string> + <reference key="NSColor" ref="598914187"/> + </object> + </object> + <object class="NSTextFieldCell" key="NSDataCell" id="115682224"> + <int key="NSCellFlags">67239488</int> + <int key="NSCellFlags2">67110912</int> + <string key="NSContents">Text Cell</string> + <reference key="NSSupport" ref="669758321"/> + <reference key="NSControlView" ref="245761583"/> + <object class="NSColor" key="NSBackgroundColor" id="562729959"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlBackgroundColor</string> + <reference key="NSColor" ref="664895267"/> + </object> + <reference key="NSTextColor" ref="675775997"/> + </object> + <int key="NSResizingMask">3</int> + <bool key="NSIsResizeable">YES</bool> + <bool key="NSIsEditable">YES</bool> + <reference key="NSTableView" ref="245761583"/> + </object> + <object class="NSTableColumn" id="1012899834"> + <string key="NSIdentifier">path</string> + <double key="NSWidth">6.400000e+01</double> + <double key="NSMinWidth">1.000000e+01</double> + <double key="NSMaxWidth">3.402823e+38</double> + <object class="NSTableHeaderCell" key="NSHeaderCell"> + <int key="NSCellFlags">75628032</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Path</string> + <reference key="NSSupport" ref="26"/> + <object class="NSColor" key="NSBackgroundColor" id="403963168"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">headerColor</string> + <reference key="NSColor" ref="144728694"/> + </object> + <reference key="NSTextColor" ref="75656344"/> + </object> + <object class="NSTextFieldCell" key="NSDataCell" id="130937894"> + <int key="NSCellFlags">67239488</int> + <int key="NSCellFlags2">-2147481600</int> + <string key="NSContents">Text Cell</string> + <reference key="NSSupport" ref="669758321"/> + <reference key="NSControlView" ref="245761583"/> + <reference key="NSBackgroundColor" ref="562729959"/> + <reference key="NSTextColor" ref="675775997"/> + </object> + <int key="NSResizingMask">3</int> + <bool key="NSIsResizeable">YES</bool> + <bool key="NSIsEditable">YES</bool> + <reference key="NSTableView" ref="245761583"/> + </object> + <object class="NSTableColumn" id="346751920"> + <string key="NSIdentifier">timestamp</string> + <double key="NSWidth">6.400000e+01</double> + <double key="NSMinWidth">1.000000e+01</double> + <double key="NSMaxWidth">3.402823e+38</double> + <object class="NSTableHeaderCell" key="NSHeaderCell"> + <int key="NSCellFlags">75628032</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Timestamp</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSBackgroundColor" ref="403963168"/> + <reference key="NSTextColor" ref="75656344"/> + </object> + <object class="NSTextFieldCell" key="NSDataCell" id="790665458"> + <int key="NSCellFlags">67239488</int> + <int key="NSCellFlags2">-2147481600</int> + <string key="NSContents">Text Cell</string> + <reference key="NSSupport" ref="669758321"/> + <object class="NSDateFormatter" key="NSFormatter" id="17762691"> + <object class="NSMutableDictionary" key="NS.attributes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>dateFormat_10_0</string> + <string>dateStyle</string> + <string>formatterBehavior</string> + <string>timeStyle</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>%m/%d/%y</string> + <integer value="1" id="9"/> + <integer value="1040"/> + <integer value="2"/> + </object> + </object> + <string key="NS.format">yyyy-MM-dd HH:mm:ss</string> + <bool key="NS.natural">NO</bool> + </object> + <reference key="NSControlView" ref="245761583"/> + <reference key="NSBackgroundColor" ref="562729959"/> + <reference key="NSTextColor" ref="675775997"/> + </object> + <int key="NSResizingMask">3</int> + <bool key="NSIsResizeable">YES</bool> + <bool key="NSIsEditable">YES</bool> + <reference key="NSTableView" ref="245761583"/> + </object> + </object> + <double key="NSIntercellSpacingWidth">3.000000e+00</double> + <double key="NSIntercellSpacingHeight">2.000000e+00</double> + <reference key="NSBackgroundColor" ref="144728694"/> + <object class="NSColor" key="NSGridColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">gridColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC41AA</bytes> + </object> + </object> + <double key="NSRowHeight">1.700000e+01</double> + <int key="NSTvFlags">-692060160</int> + <int key="NSColumnAutoresizingStyle">4</int> + <int key="NSDraggingSourceMaskForLocal">15</int> + <int key="NSDraggingSourceMaskForNonLocal">0</int> + <bool key="NSAllowsTypeSelect">YES</bool> + </object> + </object> + <string key="NSFrame">{{1, 17}, {554, 190}}</string> + <reference key="NSSuperview" ref="361593978"/> + <reference key="NSNextKeyView" ref="245761583"/> + <reference key="NSDocView" ref="245761583"/> + <reference key="NSBGColor" ref="562729959"/> + <int key="NScvFlags">4</int> + </object> + <object class="NSScroller" id="892361372"> + <reference key="NSNextResponder" ref="361593978"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{555, 17}, {15, 190}}</string> + <reference key="NSSuperview" ref="361593978"/> + <reference key="NSTarget" ref="361593978"/> + <string key="NSAction">_doScroller:</string> + <double key="NSCurValue">1.000000e+00</double> + <double key="NSPercent">1.947368e-01</double> + </object> + <object class="NSScroller" id="420894305"> + <reference key="NSNextResponder" ref="361593978"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{1, 207}, {554, 15}}</string> + <reference key="NSSuperview" ref="361593978"/> + <int key="NSsFlags">1</int> + <reference key="NSTarget" ref="361593978"/> + <string key="NSAction">_doScroller:</string> + <double key="NSPercent">8.921095e-01</double> + </object> + <object class="NSClipView" id="929668417"> + <reference key="NSNextResponder" ref="361593978"/> + <int key="NSvFlags">2304</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="759371640"/> + </object> + <string key="NSFrame">{{1, 0}, {554, 17}}</string> + <reference key="NSSuperview" ref="361593978"/> + <reference key="NSNextKeyView" ref="759371640"/> + <reference key="NSDocView" ref="759371640"/> + <reference key="NSBGColor" ref="562729959"/> + <int key="NScvFlags">4</int> + </object> + <reference ref="720411877"/> + </object> + <string key="NSFrame">{{-1, 1}, {571, 223}}</string> + <reference key="NSSuperview" ref="439893737"/> + <reference key="NSNextKeyView" ref="538231122"/> + <int key="NSsFlags">50</int> + <reference key="NSVScroller" ref="892361372"/> + <reference key="NSHScroller" ref="420894305"/> + <reference key="NSContentView" ref="538231122"/> + <reference key="NSHeaderClipView" ref="929668417"/> + <reference key="NSCornerView" ref="720411877"/> + <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes> + </object> + </object> + <string key="NSFrameSize">{569, 347}</string> + <reference key="NSSuperview"/> + </object> + <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> + <string key="NSMinSize">{569, 369}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> + </object> + <object class="NSCustomObject" id="610635028"> + <string key="NSClassName">EkoAppDelegate</string> + </object> + </object> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <object class="NSMutableArray" key="connectionRecords"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">performMiniaturize:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="1011231497"/> + </object> + <int key="connectionID">37</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">arrangeInFront:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="625202149"/> + </object> + <int key="connectionID">39</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">orderFrontStandardAboutPanel:</string> + <reference key="source" ref="1021"/> + <reference key="destination" ref="238522557"/> + </object> + <int key="connectionID">142</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">toggleContinuousSpellChecking:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="948374510"/> + </object> + <int key="connectionID">222</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">undo:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="1058277027"/> + </object> + <int key="connectionID">223</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">copy:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="860595796"/> + </object> + <int key="connectionID">224</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">checkSpelling:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="96193923"/> + </object> + <int key="connectionID">225</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">paste:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="29853731"/> + </object> + <int key="connectionID">226</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">stopSpeaking:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="680220178"/> + </object> + <int key="connectionID">227</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">cut:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="296257095"/> + </object> + <int key="connectionID">228</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showGuessPanel:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="679648819"/> + </object> + <int key="connectionID">230</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">redo:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="790794224"/> + </object> + <int key="connectionID">231</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">selectAll:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="583158037"/> + </object> + <int key="connectionID">232</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">startSpeaking:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="731782645"/> + </object> + <int key="connectionID">233</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">delete:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="437104165"/> + </object> + <int key="connectionID">235</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">performZoom:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="575023229"/> + </object> + <int key="connectionID">240</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">performFindPanelAction:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="447796847"/> + </object> + <int key="connectionID">241</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">centerSelectionInVisibleArea:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="88285865"/> + </object> + <int key="connectionID">245</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">toggleGrammarChecking:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="967646866"/> + </object> + <int key="connectionID">347</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">toggleSmartInsertDelete:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="605118523"/> + </object> + <int key="connectionID">355</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">toggleAutomaticQuoteSubstitution:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="197661976"/> + </object> + <int key="connectionID">356</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">toggleAutomaticLinkDetection:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="708854459"/> + </object> + <int key="connectionID">357</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showHelp:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="238773614"/> + </object> + <int key="connectionID">360</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">hide:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="755159360"/> + </object> + <int key="connectionID">367</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">hideOtherApplications:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="342932134"/> + </object> + <int key="connectionID">368</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">terminate:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="632727374"/> + </object> + <int key="connectionID">369</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">unhideAllApplications:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="908899353"/> + </object> + <int key="connectionID">370</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="1050"/> + <reference key="destination" ref="610635028"/> + </object> + <int key="connectionID">374</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">updateURLs:</string> + <reference key="source" ref="610635028"/> + <reference key="destination" ref="880395183"/> + </object> + <int key="connectionID">425</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">requestView</string> + <reference key="source" ref="610635028"/> + <reference key="destination" ref="245761583"/> + </object> + <int key="connectionID">436</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">targetURL</string> + <reference key="source" ref="610635028"/> + <reference key="destination" ref="411310864"/> + </object> + <int key="connectionID">446</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">namespace</string> + <reference key="source" ref="610635028"/> + <reference key="destination" ref="614626927"/> + </object> + <int key="connectionID">447</int> + </object> + </object> + <object class="IBMutableOrderedSet" key="objectRecords"> + <object class="NSArray" key="orderedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <object class="NSArray" key="object" id="1049"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <reference key="children" ref="1048"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="1021"/> + <reference key="parent" ref="1049"/> + <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="1014"/> + <reference key="parent" ref="1049"/> + <string key="objectName">First Responder</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-3</int> + <reference key="object" ref="1050"/> + <reference key="parent" ref="1049"/> + <string key="objectName">Application</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">29</int> + <reference key="object" ref="649796088"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="713487014"/> + <reference ref="694149608"/> + <reference ref="391199113"/> + <reference ref="952259628"/> + </object> + <reference key="parent" ref="1049"/> + <string key="objectName">MainMenu</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">19</int> + <reference key="object" ref="713487014"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="835318025"/> + </object> + <reference key="parent" ref="649796088"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">56</int> + <reference key="object" ref="694149608"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="110575045"/> + </object> + <reference key="parent" ref="649796088"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">103</int> + <reference key="object" ref="391199113"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="374024848"/> + </object> + <reference key="parent" ref="649796088"/> + <string key="objectName">1</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">217</int> + <reference key="object" ref="952259628"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="789758025"/> + </object> + <reference key="parent" ref="649796088"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">205</int> + <reference key="object" ref="789758025"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="437104165"/> + <reference ref="583158037"/> + <reference ref="1058277027"/> + <reference ref="212016141"/> + <reference ref="296257095"/> + <reference ref="29853731"/> + <reference ref="860595796"/> + <reference ref="1040322652"/> + <reference ref="790794224"/> + <reference ref="892235320"/> + <reference ref="972420730"/> + <reference ref="676164635"/> + <reference ref="507821607"/> + </object> + <reference key="parent" ref="952259628"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">202</int> + <reference key="object" ref="437104165"/> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">198</int> + <reference key="object" ref="583158037"/> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">207</int> + <reference key="object" ref="1058277027"/> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">214</int> + <reference key="object" ref="212016141"/> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">199</int> + <reference key="object" ref="296257095"/> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">203</int> + <reference key="object" ref="29853731"/> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">197</int> + <reference key="object" ref="860595796"/> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">206</int> + <reference key="object" ref="1040322652"/> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">215</int> + <reference key="object" ref="790794224"/> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">218</int> + <reference key="object" ref="892235320"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="963351320"/> + </object> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">216</int> + <reference key="object" ref="972420730"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="769623530"/> + </object> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">200</int> + <reference key="object" ref="769623530"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="948374510"/> + <reference ref="96193923"/> + <reference ref="679648819"/> + <reference ref="967646866"/> + </object> + <reference key="parent" ref="972420730"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">219</int> + <reference key="object" ref="948374510"/> + <reference key="parent" ref="769623530"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">201</int> + <reference key="object" ref="96193923"/> + <reference key="parent" ref="769623530"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">204</int> + <reference key="object" ref="679648819"/> + <reference key="parent" ref="769623530"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">220</int> + <reference key="object" ref="963351320"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="270902937"/> + <reference ref="88285865"/> + <reference ref="159080638"/> + <reference ref="326711663"/> + <reference ref="447796847"/> + </object> + <reference key="parent" ref="892235320"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">213</int> + <reference key="object" ref="270902937"/> + <reference key="parent" ref="963351320"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">210</int> + <reference key="object" ref="88285865"/> + <reference key="parent" ref="963351320"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">221</int> + <reference key="object" ref="159080638"/> + <reference key="parent" ref="963351320"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">208</int> + <reference key="object" ref="326711663"/> + <reference key="parent" ref="963351320"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">209</int> + <reference key="object" ref="447796847"/> + <reference key="parent" ref="963351320"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">106</int> + <reference key="object" ref="374024848"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="238773614"/> + </object> + <reference key="parent" ref="391199113"/> + <string key="objectName">2</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">111</int> + <reference key="object" ref="238773614"/> + <reference key="parent" ref="374024848"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">57</int> + <reference key="object" ref="110575045"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="238522557"/> + <reference ref="755159360"/> + <reference ref="908899353"/> + <reference ref="632727374"/> + <reference ref="646227648"/> + <reference ref="609285721"/> + <reference ref="481834944"/> + <reference ref="304266470"/> + <reference ref="1046388886"/> + <reference ref="1056857174"/> + <reference ref="342932134"/> + </object> + <reference key="parent" ref="694149608"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">58</int> + <reference key="object" ref="238522557"/> + <reference key="parent" ref="110575045"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">134</int> + <reference key="object" ref="755159360"/> + <reference key="parent" ref="110575045"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">150</int> + <reference key="object" ref="908899353"/> + <reference key="parent" ref="110575045"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">136</int> + <reference key="object" ref="632727374"/> + <reference key="parent" ref="110575045"/> + <string key="objectName">1111</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">144</int> + <reference key="object" ref="646227648"/> + <reference key="parent" ref="110575045"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">129</int> + <reference key="object" ref="609285721"/> + <reference key="parent" ref="110575045"/> + <string key="objectName">121</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">143</int> + <reference key="object" ref="481834944"/> + <reference key="parent" ref="110575045"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">236</int> + <reference key="object" ref="304266470"/> + <reference key="parent" ref="110575045"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">131</int> + <reference key="object" ref="1046388886"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="752062318"/> + </object> + <reference key="parent" ref="110575045"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">149</int> + <reference key="object" ref="1056857174"/> + <reference key="parent" ref="110575045"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">145</int> + <reference key="object" ref="342932134"/> + <reference key="parent" ref="110575045"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">130</int> + <reference key="object" ref="752062318"/> + <reference key="parent" ref="1046388886"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">24</int> + <reference key="object" ref="835318025"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="299356726"/> + <reference ref="625202149"/> + <reference ref="575023229"/> + <reference ref="1011231497"/> + </object> + <reference key="parent" ref="713487014"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">92</int> + <reference key="object" ref="299356726"/> + <reference key="parent" ref="835318025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">5</int> + <reference key="object" ref="625202149"/> + <reference key="parent" ref="835318025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">239</int> + <reference key="object" ref="575023229"/> + <reference key="parent" ref="835318025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">23</int> + <reference key="object" ref="1011231497"/> + <reference key="parent" ref="835318025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">211</int> + <reference key="object" ref="676164635"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="785027613"/> + </object> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">212</int> + <reference key="object" ref="785027613"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="680220178"/> + <reference ref="731782645"/> + </object> + <reference key="parent" ref="676164635"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">195</int> + <reference key="object" ref="680220178"/> + <reference key="parent" ref="785027613"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">196</int> + <reference key="object" ref="731782645"/> + <reference key="parent" ref="785027613"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">346</int> + <reference key="object" ref="967646866"/> + <reference key="parent" ref="769623530"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">348</int> + <reference key="object" ref="507821607"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="698887838"/> + </object> + <reference key="parent" ref="789758025"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">349</int> + <reference key="object" ref="698887838"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="605118523"/> + <reference ref="197661976"/> + <reference ref="708854459"/> + </object> + <reference key="parent" ref="507821607"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">350</int> + <reference key="object" ref="605118523"/> + <reference key="parent" ref="698887838"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">351</int> + <reference key="object" ref="197661976"/> + <reference key="parent" ref="698887838"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">354</int> + <reference key="object" ref="708854459"/> + <reference key="parent" ref="698887838"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">371</int> + <reference key="object" ref="972006081"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="439893737"/> + </object> + <reference key="parent" ref="1049"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">372</int> + <reference key="object" ref="439893737"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="614626927"/> + <reference ref="411310864"/> + <reference ref="644613290"/> + <reference ref="713324176"/> + <reference ref="880395183"/> + <reference ref="361593978"/> + </object> + <reference key="parent" ref="972006081"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">373</int> + <reference key="object" ref="610635028"/> + <reference key="parent" ref="1049"/> + <string key="objectName">EkoAppDelegate</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">406</int> + <reference key="object" ref="614626927"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="639550805"/> + </object> + <reference key="parent" ref="439893737"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">407</int> + <reference key="object" ref="639550805"/> + <reference key="parent" ref="614626927"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">408</int> + <reference key="object" ref="411310864"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="928663428"/> + </object> + <reference key="parent" ref="439893737"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">409</int> + <reference key="object" ref="928663428"/> + <reference key="parent" ref="411310864"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">410</int> + <reference key="object" ref="644613290"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1039770882"/> + </object> + <reference key="parent" ref="439893737"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">411</int> + <reference key="object" ref="1039770882"/> + <reference key="parent" ref="644613290"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">412</int> + <reference key="object" ref="713324176"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="715206149"/> + </object> + <reference key="parent" ref="439893737"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">413</int> + <reference key="object" ref="715206149"/> + <reference key="parent" ref="713324176"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">414</int> + <reference key="object" ref="880395183"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="524677927"/> + </object> + <reference key="parent" ref="439893737"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">415</int> + <reference key="object" ref="524677927"/> + <reference key="parent" ref="880395183"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">427</int> + <reference key="object" ref="361593978"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="892361372"/> + <reference ref="420894305"/> + <reference ref="245761583"/> + <reference ref="759371640"/> + </object> + <reference key="parent" ref="439893737"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">428</int> + <reference key="object" ref="892361372"/> + <reference key="parent" ref="361593978"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">429</int> + <reference key="object" ref="420894305"/> + <reference key="parent" ref="361593978"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">430</int> + <reference key="object" ref="245761583"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="104452508"/> + <reference ref="1012899834"/> + <reference ref="346751920"/> + </object> + <reference key="parent" ref="361593978"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">431</int> + <reference key="object" ref="759371640"/> + <reference key="parent" ref="361593978"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">432</int> + <reference key="object" ref="104452508"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="115682224"/> + </object> + <reference key="parent" ref="245761583"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">435</int> + <reference key="object" ref="115682224"/> + <reference key="parent" ref="104452508"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">440</int> + <reference key="object" ref="1012899834"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="130937894"/> + </object> + <reference key="parent" ref="245761583"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">441</int> + <reference key="object" ref="130937894"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <reference key="parent" ref="1012899834"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">443</int> + <reference key="object" ref="346751920"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="790665458"/> + </object> + <reference key="parent" ref="245761583"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">444</int> + <reference key="object" ref="790665458"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="17762691"/> + </object> + <reference key="parent" ref="346751920"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">445</int> + <reference key="object" ref="17762691"/> + <reference key="parent" ref="790665458"/> + </object> + </object> + </object> + <object class="NSMutableDictionary" key="flattenedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>-1.IBPluginDependency</string> + <string>-2.IBPluginDependency</string> + <string>-3.IBPluginDependency</string> + <string>103.IBPluginDependency</string> + <string>103.ImportedFromIB2</string> + <string>106.IBEditorWindowLastContentRect</string> + <string>106.IBPluginDependency</string> + <string>106.ImportedFromIB2</string> + <string>106.editorWindowContentRectSynchronizationRect</string> + <string>111.IBPluginDependency</string> + <string>111.ImportedFromIB2</string> + <string>129.IBPluginDependency</string> + <string>129.ImportedFromIB2</string> + <string>130.IBPluginDependency</string> + <string>130.ImportedFromIB2</string> + <string>130.editorWindowContentRectSynchronizationRect</string> + <string>131.IBPluginDependency</string> + <string>131.ImportedFromIB2</string> + <string>134.IBPluginDependency</string> + <string>134.ImportedFromIB2</string> + <string>136.IBPluginDependency</string> + <string>136.ImportedFromIB2</string> + <string>143.IBPluginDependency</string> + <string>143.ImportedFromIB2</string> + <string>144.IBPluginDependency</string> + <string>144.ImportedFromIB2</string> + <string>145.IBPluginDependency</string> + <string>145.ImportedFromIB2</string> + <string>149.IBPluginDependency</string> + <string>149.ImportedFromIB2</string> + <string>150.IBPluginDependency</string> + <string>150.ImportedFromIB2</string> + <string>19.IBPluginDependency</string> + <string>19.ImportedFromIB2</string> + <string>195.IBPluginDependency</string> + <string>195.ImportedFromIB2</string> + <string>196.IBPluginDependency</string> + <string>196.ImportedFromIB2</string> + <string>197.IBPluginDependency</string> + <string>197.ImportedFromIB2</string> + <string>198.IBPluginDependency</string> + <string>198.ImportedFromIB2</string> + <string>199.IBPluginDependency</string> + <string>199.ImportedFromIB2</string> + <string>200.IBPluginDependency</string> + <string>200.ImportedFromIB2</string> + <string>200.editorWindowContentRectSynchronizationRect</string> + <string>201.IBPluginDependency</string> + <string>201.ImportedFromIB2</string> + <string>202.IBPluginDependency</string> + <string>202.ImportedFromIB2</string> + <string>203.IBPluginDependency</string> + <string>203.ImportedFromIB2</string> + <string>204.IBPluginDependency</string> + <string>204.ImportedFromIB2</string> + <string>205.IBEditorWindowLastContentRect</string> + <string>205.IBPluginDependency</string> + <string>205.ImportedFromIB2</string> + <string>205.editorWindowContentRectSynchronizationRect</string> + <string>206.IBPluginDependency</string> + <string>206.ImportedFromIB2</string> + <string>207.IBPluginDependency</string> + <string>207.ImportedFromIB2</string> + <string>208.IBPluginDependency</string> + <string>208.ImportedFromIB2</string> + <string>209.IBPluginDependency</string> + <string>209.ImportedFromIB2</string> + <string>210.IBPluginDependency</string> + <string>210.ImportedFromIB2</string> + <string>211.IBPluginDependency</string> + <string>211.ImportedFromIB2</string> + <string>212.IBPluginDependency</string> + <string>212.ImportedFromIB2</string> + <string>212.editorWindowContentRectSynchronizationRect</string> + <string>213.IBPluginDependency</string> + <string>213.ImportedFromIB2</string> + <string>214.IBPluginDependency</string> + <string>214.ImportedFromIB2</string> + <string>215.IBPluginDependency</string> + <string>215.ImportedFromIB2</string> + <string>216.IBPluginDependency</string> + <string>216.ImportedFromIB2</string> + <string>217.IBPluginDependency</string> + <string>217.ImportedFromIB2</string> + <string>218.IBPluginDependency</string> + <string>218.ImportedFromIB2</string> + <string>219.IBPluginDependency</string> + <string>219.ImportedFromIB2</string> + <string>220.IBPluginDependency</string> + <string>220.ImportedFromIB2</string> + <string>220.editorWindowContentRectSynchronizationRect</string> + <string>221.IBPluginDependency</string> + <string>221.ImportedFromIB2</string> + <string>23.IBPluginDependency</string> + <string>23.ImportedFromIB2</string> + <string>236.IBPluginDependency</string> + <string>236.ImportedFromIB2</string> + <string>239.IBPluginDependency</string> + <string>239.ImportedFromIB2</string> + <string>24.IBEditorWindowLastContentRect</string> + <string>24.IBPluginDependency</string> + <string>24.ImportedFromIB2</string> + <string>24.editorWindowContentRectSynchronizationRect</string> + <string>29.IBEditorWindowLastContentRect</string> + <string>29.IBPluginDependency</string> + <string>29.ImportedFromIB2</string> + <string>29.WindowOrigin</string> + <string>29.editorWindowContentRectSynchronizationRect</string> + <string>346.IBPluginDependency</string> + <string>346.ImportedFromIB2</string> + <string>348.IBPluginDependency</string> + <string>348.ImportedFromIB2</string> + <string>349.IBPluginDependency</string> + <string>349.ImportedFromIB2</string> + <string>349.editorWindowContentRectSynchronizationRect</string> + <string>350.IBPluginDependency</string> + <string>350.ImportedFromIB2</string> + <string>351.IBPluginDependency</string> + <string>351.ImportedFromIB2</string> + <string>354.IBPluginDependency</string> + <string>354.ImportedFromIB2</string> + <string>371.IBEditorWindowLastContentRect</string> + <string>371.IBWindowTemplateEditedContentRect</string> + <string>371.NSWindowTemplate.visibleAtLaunch</string> + <string>371.editorWindowContentRectSynchronizationRect</string> + <string>371.windowTemplate.hasMaxSize</string> + <string>371.windowTemplate.hasMinSize</string> + <string>371.windowTemplate.maxSize</string> + <string>371.windowTemplate.minSize</string> + <string>372.IBPluginDependency</string> + <string>373.IBPluginDependency</string> + <string>406.IBPluginDependency</string> + <string>407.IBPluginDependency</string> + <string>408.IBPluginDependency</string> + <string>409.IBPluginDependency</string> + <string>410.IBPluginDependency</string> + <string>411.IBPluginDependency</string> + <string>412.IBPluginDependency</string> + <string>413.IBPluginDependency</string> + <string>414.IBPluginDependency</string> + <string>415.IBPluginDependency</string> + <string>427.IBPluginDependency</string> + <string>428.IBPluginDependency</string> + <string>429.IBPluginDependency</string> + <string>430.IBPluginDependency</string> + <string>431.IBPluginDependency</string> + <string>432.IBPluginDependency</string> + <string>435.IBPluginDependency</string> + <string>445.IBPluginDependency</string> + <string>5.IBPluginDependency</string> + <string>5.ImportedFromIB2</string> + <string>56.IBPluginDependency</string> + <string>56.ImportedFromIB2</string> + <string>57.IBEditorWindowLastContentRect</string> + <string>57.IBPluginDependency</string> + <string>57.ImportedFromIB2</string> + <string>57.editorWindowContentRectSynchronizationRect</string> + <string>58.IBPluginDependency</string> + <string>58.ImportedFromIB2</string> + <string>92.IBPluginDependency</string> + <string>92.ImportedFromIB2</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilderKit</string> + <string>com.apple.InterfaceBuilderKit</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{251, 765}, {134, 23}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{596, 852}, {216, 23}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{436, 809}, {64, 6}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{608, 612}, {275, 83}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{136, 545}, {243, 243}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{365, 632}, {243, 243}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{608, 612}, {167, 43}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{608, 612}, {241, 103}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{180, 715}, {197, 73}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{525, 802}, {197, 73}}</string> + <string>{{138, 771}, {233, 20}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{74, 862}</string> + <string>{{11, 836}, {478, 20}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{608, 612}, {215, 63}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{175, 307}, {569, 347}}</string> + <string>{{175, 307}, {569, 347}}</string> + <reference ref="9"/> + <string>{{238, 285}, {480, 360}}</string> + <boolean value="NO"/> + <boolean value="YES"/> + <string>{638, 445}</string> + <string>{569, 347}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{91, 605}, {186, 183}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{23, 794}, {245, 183}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + </object> + </object> + <object class="NSMutableDictionary" key="unlocalizedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="activeLocalization"/> + <object class="NSMutableDictionary" key="localizations"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="sourceID"/> + <int key="maxID">447</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <object class="NSMutableArray" key="referencedPartialClassDescriptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">EkoAppDelegate</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">updateURLs:</string> + <string key="NS.object.0">id</string> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>namespace</string> + <string>requestView</string> + <string>targetURL</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">EkoAppDelegate.py</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">EkoAppDelegate</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + </object> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.LastKnownRelativeProjectPath">../Eko.xcodeproj</string> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + </data> +</archive> diff --git a/Eko/Info.plist b/Eko/Info.plist new file mode 100644 index 0000000..1dced31 --- /dev/null +++ b/Eko/Info.plist @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIconFile</key> + <string>eko.icns</string> + <key>CFBundleIdentifier</key> + <string>se.sendapatch.Eko</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>NSMainNibFile</key> + <string>MainMenu</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/Eko/eko.icns b/Eko/eko.icns new file mode 100644 index 0000000..016a89e Binary files /dev/null and b/Eko/eko.icns differ diff --git a/Eko/info.png b/Eko/info.png new file mode 100644 index 0000000..636f9ed Binary files /dev/null and b/Eko/info.png differ diff --git a/Eko/main.m b/Eko/main.m new file mode 100644 index 0000000..9a816ad --- /dev/null +++ b/Eko/main.m @@ -0,0 +1,49 @@ +// +// main.m +// Eko +// +// Created by Johan Nordberg on 2009-08-09. +// Copyright Inveno 2009. All rights reserved. +// + +#import <Python/Python.h> +#import <Cocoa/Cocoa.h> + +int main(int argc, char *argv[]) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSBundle *mainBundle = [NSBundle mainBundle]; + NSString *resourcePath = [mainBundle resourcePath]; + NSArray *pythonPathArray = [NSArray arrayWithObjects: resourcePath, [resourcePath stringByAppendingPathComponent:@"PyObjC"], nil]; + + setenv("PYTHONPATH", [[pythonPathArray componentsJoinedByString:@":"] UTF8String], 1); + + NSArray *possibleMainExtensions = [NSArray arrayWithObjects: @"py", @"pyc", @"pyo", nil]; + NSString *mainFilePath = nil; + + for (NSString *possibleMainExtension in possibleMainExtensions) { + mainFilePath = [mainBundle pathForResource: @"main" ofType: possibleMainExtension]; + if ( mainFilePath != nil ) break; + } + + if ( !mainFilePath ) { + [NSException raise: NSInternalInconsistencyException format: @"%s:%d main() Failed to find the Main.{py,pyc,pyo} file in the application wrapper's Resources directory.", __FILE__, __LINE__]; + } + + Py_SetProgramName("/usr/bin/python"); + Py_Initialize(); + PySys_SetArgv(argc, (char **)argv); + + const char *mainFilePathPtr = [mainFilePath UTF8String]; + FILE *mainFile = fopen(mainFilePathPtr, "r"); + int result = PyRun_SimpleFile(mainFile, (char *)[[mainFilePath lastPathComponent] UTF8String]); + + if ( result != 0 ) + [NSException raise: NSInternalInconsistencyException + format: @"%s:%d main() PyRun_SimpleFile failed with file '%@'. See console for errors.", __FILE__, __LINE__, mainFilePath]; + + [pool drain]; + + return result; +} diff --git a/Eko/main.py b/Eko/main.py new file mode 100644 index 0000000..63e341d --- /dev/null +++ b/Eko/main.py @@ -0,0 +1,20 @@ +# +# main.py +# Eko +# +# Created by Johan Nordberg on 2009-08-09. +# Copyright Inveno 2009. All rights reserved. +# + +#import modules required by application +import objc +import Foundation +import AppKit + +from PyObjCTools import AppHelper + +# import modules containing classes required to start application and load MainMenu.nib +import EkoAppDelegate + +# pass control to AppKit +AppHelper.runEventLoop() diff --git a/Eko/resend.png b/Eko/resend.png new file mode 100644 index 0000000..316c848 Binary files /dev/null and b/Eko/resend.png differ
lericson/eko
dbeb966efd6d3091dedad88a16f3afcf47b11dea
Split out request access log emission.
diff --git a/eko.py b/eko.py index 937f483..055a981 100644 --- a/eko.py +++ b/eko.py @@ -1,152 +1,156 @@ #!/usr/bin/env python import time import datetime import logging import urllib2 import urlparse import optparse try: import json except ImportError: import simplejson as json __version__ = "0.1" def timedelta_to_secs(td): return (td.days * 86400) + td.seconds + (td.microseconds / 1000000.0) class Headers(object): def __init__(self, headers): self.headers = headers def items(self): return self.headers class EkoClient(object): logger = logging.getLogger("eko.client") server_url = "http://eko-eko.appspot.com/" min_pass_time = datetime.timedelta(seconds=6) user_agent = "eko/" + __version__ running = False def __init__(self, target_url, namespace=None, server_url=None): self.target_url = target_url self.target_opener = urllib2.build_opener() self.namespace = namespace if server_url: self.server_url = server_url if self.namespace: self.server_url = urlparse.urljoin(self.server_url, namespace) self.server_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor) self.server_opener.addheaders = [("User-Agent", self.user_agent)] def build_target_url(self, subpath, qs=None): if self.namespace: if not subpath.startswith("/" + self.namespace): raise ValueError("cannot build a target url that is outside " "of namespace %r" % (self.namespace,)) subpath = subpath[1 + len(self.namespace):] rv = urlparse.urljoin(self.target_url, subpath) if qs: rv += "?&"["?" in rv] + qs return rv def build_request(self, path, headers=[], data=None, qs=None): url = self.build_target_url(path, qs=qs) return urllib2.Request(url, headers=Headers(headers), data=data) def call_target(self, path, headers=[], data=None, qs=None): data = data or None # Could be "" req = self.build_request(path, headers=headers, data=data, qs=None) self.logger.info("forward request to %s" % (req.get_full_url(),)) # TODO Should really ignore redirects and so on here. httplib? try: resp = self.target_opener.open(req) except urllib2.URLError, e: resp = e - self.logger.info("forward response:\n" - "[%s] \"%s %s HTTP/1.1\" %d %s" % - (datetime.datetime.now().strftime("%d/%b/%Y %H:%M:%S"), - req.get_method(), req.get_selector(), - resp.code, resp.headers.get("Content-Length", "-"))) + self.emit_request_forwarded(req, resp) def call_server(self): try: return self.server_opener.open(self.server_url) except urllib2.URLError, e: if getattr(e, "code", None) != 504: raise def run_once(self): resp = self.call_server() if resp: for req in json.load(resp): self.call_target(**dict((str(k), v) for k, v in req.items())) def run_forever(self): self.running = True self.logger.info("eko from %s to %s" % (self.server_url, self.target_url)) while self.running: start = datetime.datetime.now() try: self.run_once() except KeyboardInterrupt: raise except: self.logger.exception("run_once") end = datetime.datetime.now() elapsed = end - start if elapsed < self.min_pass_time: sleep_time = self.min_pass_time - elapsed self.logger.debug("cooldown %s", sleep_time) time.sleep(timedelta_to_secs(sleep_time)) else: overdue = elapsed - self.min_pass_time self.logger.info("server overdue: %s" % (overdue,)) + def emit_request_forwarded(self, request, response): + ts = datetime.datetime.now().strftime("%d/%b/%Y %H:%M:%S") + hdrs = response.headers + self.logger.info("forward response:\n" + "[%s] \"%s %s HTTP/1.1\" %d %s" % + (ts, req.get_method(), req.get_selector(), + response.code, hdrs.get("Content-Length", "-"))) + class DebugEkoClient(EkoClient): server_url = "http://localhost:8080/" min_pass_time = datetime.timedelta(seconds=1) parser = optparse.OptionParser() parser.add_option("-v", "--verbose", dest="verbose", action="store_true") parser.add_option("-d", "--debug", dest="debug", action="store_true") parser.add_option("-n", "--namespace", dest="namespace", metavar="NS") parser.add_option("-s", "--server", dest="server_url", metavar="SVR") parser.add_option("-l", "--log", dest="log_fn", default="-") parser.set_usage("%prog [options] <local target>") def main(): import sys opts, args = parser.parse_args() if not args: parser.print_usage(sys.stderr) sys.stderr.write("missing local target\n") sys.exit(1) elif len(args) > 1: parser.print_usage(sys.stderr) sys.stderr.write("can only have one local target\n") sys.exit(1) - + log_level = logging.INFO if opts.verbose: log_level = logging.DEBUG if opts.log_fn == "-": logging.basicConfig(level=log_level) else: logging.basicConfig(filename=opts.log_fn, level=log_level) client_tp = (EkoClient, DebugEkoClient)[bool(opts.debug)] client = client_tp(args[0], namespace=opts.namespace, server_url=opts.server_url) try: client.run_forever() except KeyboardInterrupt: print >>sys.stderr, "Interrupted" if __name__ == "__main__": main()
lericson/eko
3529a2ce97ee42a3abab4a0bc6a2a092fd074fda
Flexibilize imports of zip packages.
diff --git a/gae/runcgi.py b/gae/runcgi.py index 33f5203..a48317b 100644 --- a/gae/runcgi.py +++ b/gae/runcgi.py @@ -1,14 +1,17 @@ import sys import os from glob import glob zip_packs = glob(os.path.join(os.path.dirname(__file__), "lib", "*.zip")) sys.path[:] = zip_packs + sys.path -import werkzeug, jinja2, simplejson +for zip_pack_fn in zip_packs: + modname = os.path.basename(zip_pack_fn) + modname = os.path.splitext(modname)[0] + __import__(modname, fromlist=[""]) def main(): from wsgiref.handlers import CGIHandler from gaeko.app import eko_app CGIHandler().run(eko_app) if __name__ == "__main__": main()
lericson/eko
2954bd58223a5ce8d54188ff11229e8fca12793f
Rename Google App Engine package to gaeko.
diff --git a/gae/eko/__init__.py b/gae/gaeko/__init__.py similarity index 100% rename from gae/eko/__init__.py rename to gae/gaeko/__init__.py diff --git a/gae/eko/app.py b/gae/gaeko/app.py similarity index 94% rename from gae/eko/app.py rename to gae/gaeko/app.py index 96e0341..b6d034d 100644 --- a/gae/eko/app.py +++ b/gae/gaeko/app.py @@ -1,83 +1,83 @@ import logging import datetime from werkzeug import Request, Response from werkzeug.exceptions import HTTPException, BadRequest -from eko.db import ClientInfo, StoredRequest -from eko.utils import JSONResponse, get_entity_body +from gaeko.db import ClientInfo, StoredRequest +from gaeko.utils import JSONResponse, get_entity_body -logger = logging.getLogger("eko.app") +logger = logging.getLogger("gaeko.app") def register_client(request): """Register client based on *request*, with an empty JSON list as response. """ base_path = request.path client_info = ClientInfo(remote_addr=request.remote_addr, base_path=base_path) client_info.put() resp = JSONResponse("[]") resp.set_cookie("cid", str(client_info.key())) return resp def client_pull(request): """Pull stored requests for the client specified by the *cid* cookie. Returns a list of dicts of format:: {"headers": [[name, value], ...], "data": "foo"} Also updates ClientInfo.pulled. """ client_info = ClientInfo.get(request.cookies["cid"]) if client_info is None: raise BadRequest("bad cid") elif client_info.base_path != request.path: raise BadRequest("base_path mismatch") client_info.pulled = datetime.datetime.now() client_info.put() return JSONResponse(client_info.get_requests_json()) @Request.application def client_fwd_app(request): """Handle client forwarding logics. This either registers the client, or gives the client a list of requests which it received. See *client_pull* for more detailed information. """ if "cid" not in request.cookies: return register_client(request) else: return client_pull(request) @Request.application def request_fwd_app(request): """Store a request for forwading. Also lights a semaphore so that the interaction is snappy. """ now = datetime.datetime.now() data = get_entity_body(request.environ) for client_info in ClientInfo.all(): if request.path.startswith(client_info.base_path): client_info.add_request(request, data=data) client_info.pushed = now client_info.put() return Response("OK.\n", mimetype="text/plain") def eko_app(environ, start_response): """Dispatch the request to either client forwarding or request storage. This is solely based on the User-Agent, which must start with 'eko/' for eko clients. """ request = Request(environ) if request.user_agent.string.startswith("eko/"): app = client_fwd_app else: app = request_fwd_app try: return app(environ, start_response) except HTTPException, e: return e(environ, start_response) diff --git a/gae/eko/db.py b/gae/gaeko/db.py similarity index 100% rename from gae/eko/db.py rename to gae/gaeko/db.py diff --git a/gae/eko/utils.py b/gae/gaeko/utils.py similarity index 100% rename from gae/eko/utils.py rename to gae/gaeko/utils.py diff --git a/gae/runcgi.py b/gae/runcgi.py index ba8f9db..33f5203 100644 --- a/gae/runcgi.py +++ b/gae/runcgi.py @@ -1,14 +1,14 @@ import sys import os from glob import glob zip_packs = glob(os.path.join(os.path.dirname(__file__), "lib", "*.zip")) sys.path[:] = zip_packs + sys.path import werkzeug, jinja2, simplejson def main(): from wsgiref.handlers import CGIHandler - from eko.app import eko_app + from gaeko.app import eko_app CGIHandler().run(eko_app) if __name__ == "__main__": main()
lericson/eko
5a6c6fc5a4b30b65d0a5d1776693f19bda1a4228
Added ideas.
diff --git a/ideas.rst b/ideas.rst new file mode 100644 index 0000000..68d8c32 --- /dev/null +++ b/ideas.rst @@ -0,0 +1,12 @@ +Request Replay +============== + +Oftentimes in development, one finds oneself in a situation where it'd +convenient to simply replay a request. + +What I'm thinking is some way of doing this from the client, without involving +the server. The problem is that this would involve some sort of front-end for +the client, so perhaps this needs to be done first. + +A GUI application could do this quite easily by saving the requests in some +sort of LRU structure, and perhaps you'd even be able to save requests.
lericson/eko
881feca8361efcca12821053f00a1c722fa088be
Change timeout in client to six seconds.
diff --git a/eko-client.py b/eko-client.py index 61e660f..937f483 100644 --- a/eko-client.py +++ b/eko-client.py @@ -1,152 +1,152 @@ #!/usr/bin/env python import time import datetime import logging import urllib2 import urlparse import optparse try: import json except ImportError: import simplejson as json __version__ = "0.1" def timedelta_to_secs(td): return (td.days * 86400) + td.seconds + (td.microseconds / 1000000.0) class Headers(object): def __init__(self, headers): self.headers = headers def items(self): return self.headers class EkoClient(object): logger = logging.getLogger("eko.client") server_url = "http://eko-eko.appspot.com/" - min_pass_time = datetime.timedelta(seconds=5) + min_pass_time = datetime.timedelta(seconds=6) user_agent = "eko/" + __version__ running = False def __init__(self, target_url, namespace=None, server_url=None): self.target_url = target_url self.target_opener = urllib2.build_opener() self.namespace = namespace if server_url: self.server_url = server_url if self.namespace: self.server_url = urlparse.urljoin(self.server_url, namespace) self.server_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor) self.server_opener.addheaders = [("User-Agent", self.user_agent)] def build_target_url(self, subpath, qs=None): if self.namespace: if not subpath.startswith("/" + self.namespace): raise ValueError("cannot build a target url that is outside " "of namespace %r" % (self.namespace,)) subpath = subpath[1 + len(self.namespace):] rv = urlparse.urljoin(self.target_url, subpath) if qs: rv += "?&"["?" in rv] + qs return rv def build_request(self, path, headers=[], data=None, qs=None): url = self.build_target_url(path, qs=qs) return urllib2.Request(url, headers=Headers(headers), data=data) def call_target(self, path, headers=[], data=None, qs=None): data = data or None # Could be "" req = self.build_request(path, headers=headers, data=data, qs=None) self.logger.info("forward request to %s" % (req.get_full_url(),)) # TODO Should really ignore redirects and so on here. httplib? try: resp = self.target_opener.open(req) except urllib2.URLError, e: resp = e self.logger.info("forward response:\n" "[%s] \"%s %s HTTP/1.1\" %d %s" % (datetime.datetime.now().strftime("%d/%b/%Y %H:%M:%S"), req.get_method(), req.get_selector(), resp.code, resp.headers.get("Content-Length", "-"))) def call_server(self): try: return self.server_opener.open(self.server_url) except urllib2.URLError, e: if getattr(e, "code", None) != 504: raise def run_once(self): resp = self.call_server() if resp: for req in json.load(resp): self.call_target(**dict((str(k), v) for k, v in req.items())) def run_forever(self): self.running = True self.logger.info("eko from %s to %s" % (self.server_url, self.target_url)) while self.running: start = datetime.datetime.now() try: self.run_once() except KeyboardInterrupt: raise except: self.logger.exception("run_once") end = datetime.datetime.now() elapsed = end - start if elapsed < self.min_pass_time: sleep_time = self.min_pass_time - elapsed self.logger.debug("cooldown %s", sleep_time) time.sleep(timedelta_to_secs(sleep_time)) else: overdue = elapsed - self.min_pass_time self.logger.info("server overdue: %s" % (overdue,)) class DebugEkoClient(EkoClient): server_url = "http://localhost:8080/" min_pass_time = datetime.timedelta(seconds=1) parser = optparse.OptionParser() parser.add_option("-v", "--verbose", dest="verbose", action="store_true") parser.add_option("-d", "--debug", dest="debug", action="store_true") parser.add_option("-n", "--namespace", dest="namespace", metavar="NS") parser.add_option("-s", "--server", dest="server_url", metavar="SVR") parser.add_option("-l", "--log", dest="log_fn", default="-") parser.set_usage("%prog [options] <local target>") def main(): import sys opts, args = parser.parse_args() if not args: parser.print_usage(sys.stderr) sys.stderr.write("missing local target\n") sys.exit(1) elif len(args) > 1: parser.print_usage(sys.stderr) sys.stderr.write("can only have one local target\n") sys.exit(1) log_level = logging.INFO if opts.verbose: log_level = logging.DEBUG if opts.log_fn == "-": logging.basicConfig(level=log_level) else: logging.basicConfig(filename=opts.log_fn, level=log_level) client_tp = (EkoClient, DebugEkoClient)[bool(opts.debug)] client = client_tp(args[0], namespace=opts.namespace, server_url=opts.server_url) try: client.run_forever() except KeyboardInterrupt: print >>sys.stderr, "Interrupted" if __name__ == "__main__": main()
lericson/eko
70b58fd458b4d2f8fa89bdda2eca3a7655b6d3fe
Only read entity body once.
diff --git a/eko/app.py b/eko/app.py index fb2ac34..96e0341 100644 --- a/eko/app.py +++ b/eko/app.py @@ -1,82 +1,83 @@ import logging import datetime from werkzeug import Request, Response from werkzeug.exceptions import HTTPException, BadRequest from eko.db import ClientInfo, StoredRequest -from eko.utils import JSONResponse +from eko.utils import JSONResponse, get_entity_body logger = logging.getLogger("eko.app") def register_client(request): """Register client based on *request*, with an empty JSON list as response. """ base_path = request.path client_info = ClientInfo(remote_addr=request.remote_addr, base_path=base_path) client_info.put() resp = JSONResponse("[]") resp.set_cookie("cid", str(client_info.key())) return resp def client_pull(request): """Pull stored requests for the client specified by the *cid* cookie. Returns a list of dicts of format:: {"headers": [[name, value], ...], "data": "foo"} Also updates ClientInfo.pulled. """ client_info = ClientInfo.get(request.cookies["cid"]) if client_info is None: raise BadRequest("bad cid") elif client_info.base_path != request.path: raise BadRequest("base_path mismatch") client_info.pulled = datetime.datetime.now() client_info.put() return JSONResponse(client_info.get_requests_json()) @Request.application def client_fwd_app(request): """Handle client forwarding logics. This either registers the client, or gives the client a list of requests which it received. See *client_pull* for more detailed information. """ if "cid" not in request.cookies: return register_client(request) else: return client_pull(request) @Request.application def request_fwd_app(request): """Store a request for forwading. Also lights a semaphore so that the interaction is snappy. """ now = datetime.datetime.now() + data = get_entity_body(request.environ) for client_info in ClientInfo.all(): if request.path.startswith(client_info.base_path): - client_info.add_request(request) + client_info.add_request(request, data=data) client_info.pushed = now client_info.put() return Response("OK.\n", mimetype="text/plain") def eko_app(environ, start_response): """Dispatch the request to either client forwarding or request storage. This is solely based on the User-Agent, which must start with 'eko/' for eko clients. """ request = Request(environ) if request.user_agent.string.startswith("eko/"): app = client_fwd_app else: app = request_fwd_app try: return app(environ, start_response) except HTTPException, e: return e(environ, start_response) diff --git a/eko/db.py b/eko/db.py index 2ca9c77..958f536 100644 --- a/eko/db.py +++ b/eko/db.py @@ -1,77 +1,80 @@ import time from google.appengine.ext import db from google.appengine.api import memcache import logging import simplejson as json # TODO logger = logging.getLogger("eko.db") REQ_SEM_EXPIRE = 3600 # an hour class ClientInfo(db.Model): remote_addr = db.StringProperty() base_path = db.StringProperty() registered = db.DateTimeProperty(auto_now_add=True) pushed = db.DateTimeProperty() pulled = db.DateTimeProperty() @property def mc_sem_key(self): return "client_%s_sem" % (self.key(),) def wait_requests(self, timeout=5.0, retries=20): # Essentially aquires a semaphore, so could be split out. key = self.mc_sem_key sleep_interval = timeout / retries for attempt in xrange(retries): val = memcache.get(key) if val is not None: memcache.delete(key) return val - time.sleep(sleep_interval) + try: + time.sleep(sleep_interval) + except KeyboardInterrupt: + break def get_requests_json(self, **kwds): if not self.wait_requests(**kwds): logger.debug("found no requests for %s" % (self.key(),)) return "[]" reqs = list(self.requests) db.delete(reqs) logger.info("popped %d requests for %s" % (len(reqs), self.key())) return "[%s]" % (", ".join(map(StoredRequest.as_json, reqs))) def notify_request(self): key = self.mc_sem_key if not memcache.add(key, 1, time=REQ_SEM_EXPIRE): if memcache.incr(key, 1) is None: raise ValueError("could not increment request semaphore") - def add_request(self, request): - sreq = StoredRequest.from_request(request) + def add_request(self, request, data=None): + sreq = StoredRequest.from_request(request, data=data) sreq.client_info = self sreq.put() self.notify_request() logger.info("request for %s from %s" % (self.key(), sreq.remote_addr)) class StoredRequest(db.Model): client_info = db.ReferenceProperty(ClientInfo, collection_name="requests") created = db.DateTimeProperty(auto_now_add=True) remote_addr = db.StringProperty() path = db.StringProperty() query_string = db.StringProperty() headers = db.BlobProperty() data = db.BlobProperty() request_properties = ("remote_addr", "path", "query_string") @classmethod - def from_request(cls, request): + def from_request(cls, request, data=None): hdrs = json.dumps(request.headers.items()) - data = json.dumps(request.data) + data = json.dumps(data) kwds = dict((k, getattr(request, k)) for k in cls.request_properties) return cls(headers=hdrs, data=data, **kwds) def as_json(self): return ('{"path": %s, "qs": %s, "headers": %s, "data": %s}' % (json.dumps(self.path), json.dumps(self.query_string), self.headers, self.data)) diff --git a/eko/utils.py b/eko/utils.py index 3848f5f..a81bcbc 100644 --- a/eko/utils.py +++ b/eko/utils.py @@ -1,10 +1,22 @@ from werkzeug import Response class JSONResponseMixin(object): default_mimetype = "application/json" @classmethod def from_python(cls, value, *args, **kwds): return cls(simplejson.dumps(value), *args, **kwds) class JSONResponse(Response, JSONResponseMixin): pass + +def get_entity_body(environ): + if "wsgi.input" not in environ: + # Not really something that should ever happen, but yeah. + return "" + parts = [] + while True: + part = environ["wsgi.input"].read(4096) + if not part: + break + parts.append(part) + return "".join(parts)
lericson/eko
c23b8732a22d6ccd9345806408bf67f1289d18ad
Move responsibilities to StoreRequest.
diff --git a/eko/db.py b/eko/db.py index 6a39e8e..2ca9c77 100644 --- a/eko/db.py +++ b/eko/db.py @@ -1,66 +1,77 @@ import time from google.appengine.ext import db from google.appengine.api import memcache import logging -import simplejson +import simplejson as json # TODO logger = logging.getLogger("eko.db") REQ_SEM_EXPIRE = 3600 # an hour class ClientInfo(db.Model): remote_addr = db.StringProperty() base_path = db.StringProperty() registered = db.DateTimeProperty(auto_now_add=True) pushed = db.DateTimeProperty() pulled = db.DateTimeProperty() @property def mc_sem_key(self): return "client_%s_sem" % (self.key(),) def wait_requests(self, timeout=5.0, retries=20): # Essentially aquires a semaphore, so could be split out. key = self.mc_sem_key sleep_interval = timeout / retries for attempt in xrange(retries): val = memcache.get(key) if val is not None: memcache.delete(key) return val time.sleep(sleep_interval) def get_requests_json(self, **kwds): if not self.wait_requests(**kwds): logger.debug("found no requests for %s" % (self.key(),)) return "[]" - req_parts = [] - req_part = req_parts.append reqs = list(self.requests) - for req in reqs: - req_part('{"headers": %s, "data": %s}' % (req.headers, req.data)) db.delete(reqs) logger.info("popped %d requests for %s" % (len(reqs), self.key())) - return "[%s]" % (", ".join(req_parts)) + return "[%s]" % (", ".join(map(StoredRequest.as_json, reqs))) def notify_request(self): key = self.mc_sem_key if not memcache.add(key, 1, time=REQ_SEM_EXPIRE): if memcache.incr(key, 1) is None: raise ValueError("could not increment request semaphore") def add_request(self, request): - hdrs = simplejson.dumps(request.headers.items()) - data = simplejson.dumps(request.data) - req = StoredRequest(client_info=self, headers=hdrs, data=data) - req.put() + sreq = StoredRequest.from_request(request) + sreq.client_info = self + sreq.put() self.notify_request() - logger.info("added request for %s from %s" % - (self.key(), request.remote_addr)) + logger.info("request for %s from %s" % (self.key(), sreq.remote_addr)) class StoredRequest(db.Model): client_info = db.ReferenceProperty(ClientInfo, collection_name="requests") created = db.DateTimeProperty(auto_now_add=True) + remote_addr = db.StringProperty() + path = db.StringProperty() + query_string = db.StringProperty() headers = db.BlobProperty() data = db.BlobProperty() + + request_properties = ("remote_addr", "path", "query_string") + + @classmethod + def from_request(cls, request): + hdrs = json.dumps(request.headers.items()) + data = json.dumps(request.data) + kwds = dict((k, getattr(request, k)) for k in cls.request_properties) + return cls(headers=hdrs, data=data, **kwds) + + def as_json(self): + return ('{"path": %s, "qs": %s, "headers": %s, "data": %s}' % + (json.dumps(self.path), json.dumps(self.query_string), + self.headers, self.data))
lericson/eko
f195a350f6cb72955077f4049528b53104c0f3c8
Validate client info on pull.
diff --git a/eko/app.py b/eko/app.py index a2b3c2c..fb2ac34 100644 --- a/eko/app.py +++ b/eko/app.py @@ -1,76 +1,82 @@ -import hashlib import logging import datetime from werkzeug import Request, Response -from werkzeug.utils import cached_property +from werkzeug.exceptions import HTTPException, BadRequest from eko.db import ClientInfo, StoredRequest from eko.utils import JSONResponse logger = logging.getLogger("eko.app") def register_client(request): """Register client based on *request*, with an empty JSON list as response. """ base_path = request.path client_info = ClientInfo(remote_addr=request.remote_addr, base_path=base_path) client_info.put() resp = JSONResponse("[]") resp.set_cookie("cid", str(client_info.key())) return resp def client_pull(request): """Pull stored requests for the client specified by the *cid* cookie. Returns a list of dicts of format:: {"headers": [[name, value], ...], "data": "foo"} Also updates ClientInfo.pulled. """ client_info = ClientInfo.get(request.cookies["cid"]) + if client_info is None: + raise BadRequest("bad cid") + elif client_info.base_path != request.path: + raise BadRequest("base_path mismatch") client_info.pulled = datetime.datetime.now() client_info.put() return JSONResponse(client_info.get_requests_json()) @Request.application def client_fwd_app(request): """Handle client forwarding logics. This either registers the client, or gives the client a list of requests which it received. See *client_pull* for more detailed information. """ if "cid" not in request.cookies: return register_client(request) else: return client_pull(request) @Request.application def request_fwd_app(request): """Store a request for forwading. Also lights a semaphore so that the interaction is snappy. """ now = datetime.datetime.now() for client_info in ClientInfo.all(): if request.path.startswith(client_info.base_path): client_info.add_request(request) client_info.pushed = now client_info.put() return Response("OK.\n", mimetype="text/plain") def eko_app(environ, start_response): """Dispatch the request to either client forwarding or request storage. This is solely based on the User-Agent, which must start with 'eko/' for eko clients. """ request = Request(environ) if request.user_agent.string.startswith("eko/"): app = client_fwd_app else: app = request_fwd_app - return app(environ, start_response) + try: + return app(environ, start_response) + except HTTPException, e: + return e(environ, start_response)
lericson/eko
14b8b114c06e83c6815093ccf11516ca38893019
Store the correct current path as base path.
diff --git a/eko/app.py b/eko/app.py index 59dcbdf..a2b3c2c 100644 --- a/eko/app.py +++ b/eko/app.py @@ -1,76 +1,76 @@ import hashlib import logging import datetime from werkzeug import Request, Response from werkzeug.utils import cached_property from eko.db import ClientInfo, StoredRequest from eko.utils import JSONResponse logger = logging.getLogger("eko.app") def register_client(request): """Register client based on *request*, with an empty JSON list as response. """ - base_path = "/" # TODO + base_path = request.path client_info = ClientInfo(remote_addr=request.remote_addr, base_path=base_path) client_info.put() resp = JSONResponse("[]") resp.set_cookie("cid", str(client_info.key())) return resp def client_pull(request): """Pull stored requests for the client specified by the *cid* cookie. Returns a list of dicts of format:: {"headers": [[name, value], ...], "data": "foo"} Also updates ClientInfo.pulled. """ client_info = ClientInfo.get(request.cookies["cid"]) client_info.pulled = datetime.datetime.now() client_info.put() return JSONResponse(client_info.get_requests_json()) @Request.application def client_fwd_app(request): """Handle client forwarding logics. This either registers the client, or gives the client a list of requests which it received. See *client_pull* for more detailed information. """ if "cid" not in request.cookies: return register_client(request) else: return client_pull(request) @Request.application def request_fwd_app(request): """Store a request for forwading. Also lights a semaphore so that the interaction is snappy. """ now = datetime.datetime.now() for client_info in ClientInfo.all(): if request.path.startswith(client_info.base_path): client_info.add_request(request) client_info.pushed = now client_info.put() return Response("OK.\n", mimetype="text/plain") def eko_app(environ, start_response): """Dispatch the request to either client forwarding or request storage. This is solely based on the User-Agent, which must start with 'eko/' for eko clients. """ request = Request(environ) if request.user_agent.string.startswith("eko/"): app = client_fwd_app else: app = request_fwd_app return app(environ, start_response)
lericson/eko
5430f44283971e0145fbdcce36a7bf6568d39848
Typofix: Make handler eat all paths
diff --git a/app.yaml b/app.yaml index 25f7dd7..2b1d741 100644 --- a/app.yaml +++ b/app.yaml @@ -1,8 +1,8 @@ application: eko-eko version: 1-brownk runtime: python api_version: 1 handlers: -- url: / +- url: /.* script: runcgi.py
lericson/eko
e1d3a31e3d0cbe643928e40e08dea1d875437a8c
Add functional eko client.
diff --git a/eko-client.py b/eko-client.py new file mode 100644 index 0000000..61e660f --- /dev/null +++ b/eko-client.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python + +import time +import datetime +import logging +import urllib2 +import urlparse +import optparse + +try: + import json +except ImportError: + import simplejson as json + +__version__ = "0.1" + +def timedelta_to_secs(td): + return (td.days * 86400) + td.seconds + (td.microseconds / 1000000.0) + +class Headers(object): + def __init__(self, headers): + self.headers = headers + + def items(self): + return self.headers + +class EkoClient(object): + logger = logging.getLogger("eko.client") + server_url = "http://eko-eko.appspot.com/" + min_pass_time = datetime.timedelta(seconds=5) + user_agent = "eko/" + __version__ + running = False + + def __init__(self, target_url, namespace=None, server_url=None): + self.target_url = target_url + self.target_opener = urllib2.build_opener() + self.namespace = namespace + if server_url: + self.server_url = server_url + if self.namespace: + self.server_url = urlparse.urljoin(self.server_url, namespace) + self.server_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor) + self.server_opener.addheaders = [("User-Agent", self.user_agent)] + + def build_target_url(self, subpath, qs=None): + if self.namespace: + if not subpath.startswith("/" + self.namespace): + raise ValueError("cannot build a target url that is outside " + "of namespace %r" % (self.namespace,)) + subpath = subpath[1 + len(self.namespace):] + rv = urlparse.urljoin(self.target_url, subpath) + if qs: + rv += "?&"["?" in rv] + qs + return rv + + def build_request(self, path, headers=[], data=None, qs=None): + url = self.build_target_url(path, qs=qs) + return urllib2.Request(url, headers=Headers(headers), data=data) + + def call_target(self, path, headers=[], data=None, qs=None): + data = data or None # Could be "" + req = self.build_request(path, headers=headers, data=data, qs=None) + self.logger.info("forward request to %s" % (req.get_full_url(),)) + # TODO Should really ignore redirects and so on here. httplib? + try: + resp = self.target_opener.open(req) + except urllib2.URLError, e: + resp = e + self.logger.info("forward response:\n" + "[%s] \"%s %s HTTP/1.1\" %d %s" % + (datetime.datetime.now().strftime("%d/%b/%Y %H:%M:%S"), + req.get_method(), req.get_selector(), + resp.code, resp.headers.get("Content-Length", "-"))) + + def call_server(self): + try: + return self.server_opener.open(self.server_url) + except urllib2.URLError, e: + if getattr(e, "code", None) != 504: + raise + + def run_once(self): + resp = self.call_server() + if resp: + for req in json.load(resp): + self.call_target(**dict((str(k), v) for k, v in req.items())) + + def run_forever(self): + self.running = True + self.logger.info("eko from %s to %s" % + (self.server_url, self.target_url)) + while self.running: + start = datetime.datetime.now() + try: + self.run_once() + except KeyboardInterrupt: + raise + except: + self.logger.exception("run_once") + end = datetime.datetime.now() + elapsed = end - start + if elapsed < self.min_pass_time: + sleep_time = self.min_pass_time - elapsed + self.logger.debug("cooldown %s", sleep_time) + time.sleep(timedelta_to_secs(sleep_time)) + else: + overdue = elapsed - self.min_pass_time + self.logger.info("server overdue: %s" % (overdue,)) + +class DebugEkoClient(EkoClient): + server_url = "http://localhost:8080/" + min_pass_time = datetime.timedelta(seconds=1) + +parser = optparse.OptionParser() +parser.add_option("-v", "--verbose", dest="verbose", action="store_true") +parser.add_option("-d", "--debug", dest="debug", action="store_true") +parser.add_option("-n", "--namespace", dest="namespace", metavar="NS") +parser.add_option("-s", "--server", dest="server_url", metavar="SVR") +parser.add_option("-l", "--log", dest="log_fn", default="-") +parser.set_usage("%prog [options] <local target>") + +def main(): + import sys + + opts, args = parser.parse_args() + if not args: + parser.print_usage(sys.stderr) + sys.stderr.write("missing local target\n") + sys.exit(1) + elif len(args) > 1: + parser.print_usage(sys.stderr) + sys.stderr.write("can only have one local target\n") + sys.exit(1) + + log_level = logging.INFO + if opts.verbose: + log_level = logging.DEBUG + if opts.log_fn == "-": + logging.basicConfig(level=log_level) + else: + logging.basicConfig(filename=opts.log_fn, level=log_level) + + client_tp = (EkoClient, DebugEkoClient)[bool(opts.debug)] + client = client_tp(args[0], namespace=opts.namespace, + server_url=opts.server_url) + try: + client.run_forever() + except KeyboardInterrupt: + print >>sys.stderr, "Interrupted" + +if __name__ == "__main__": + main()
lericson/eko
44674257bccb2dcaec74b0ea1e5608b9c907e9ed
Fine-tune semaphore busy loop waits.
diff --git a/eko/db.py b/eko/db.py index ab358d5..6a39e8e 100644 --- a/eko/db.py +++ b/eko/db.py @@ -1,66 +1,66 @@ import time from google.appengine.ext import db from google.appengine.api import memcache import logging import simplejson logger = logging.getLogger("eko.db") REQ_SEM_EXPIRE = 3600 # an hour class ClientInfo(db.Model): remote_addr = db.StringProperty() base_path = db.StringProperty() registered = db.DateTimeProperty(auto_now_add=True) pushed = db.DateTimeProperty() pulled = db.DateTimeProperty() @property def mc_sem_key(self): return "client_%s_sem" % (self.key(),) - def wait_requests(self, timeout=10.0, retries=10): + def wait_requests(self, timeout=5.0, retries=20): # Essentially aquires a semaphore, so could be split out. key = self.mc_sem_key sleep_interval = timeout / retries for attempt in xrange(retries): val = memcache.get(key) if val is not None: memcache.delete(key) return val time.sleep(sleep_interval) def get_requests_json(self, **kwds): if not self.wait_requests(**kwds): logger.debug("found no requests for %s" % (self.key(),)) return "[]" req_parts = [] req_part = req_parts.append reqs = list(self.requests) for req in reqs: req_part('{"headers": %s, "data": %s}' % (req.headers, req.data)) db.delete(reqs) logger.info("popped %d requests for %s" % (len(reqs), self.key())) return "[%s]" % (", ".join(req_parts)) def notify_request(self): key = self.mc_sem_key if not memcache.add(key, 1, time=REQ_SEM_EXPIRE): if memcache.incr(key, 1) is None: raise ValueError("could not increment request semaphore") def add_request(self, request): hdrs = simplejson.dumps(request.headers.items()) data = simplejson.dumps(request.data) req = StoredRequest(client_info=self, headers=hdrs, data=data) req.put() self.notify_request() logger.info("added request for %s from %s" % (self.key(), request.remote_addr)) class StoredRequest(db.Model): client_info = db.ReferenceProperty(ClientInfo, collection_name="requests") created = db.DateTimeProperty(auto_now_add=True) headers = db.BlobProperty() data = db.BlobProperty()
lericson/eko
2fa8ba5961847952a4f1679254e94830ea527fd2
Initial import of eko application.
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66b6e4c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +*.pyo +.DS_Store diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..715ce1f --- /dev/null +++ b/README.rst @@ -0,0 +1,85 @@ +===================================== + ``eko``, the HTTP request forwarder +===================================== + +Introduction +============ + +The HTTP request forwarder does what you'd think: forwards HTTP request. + +It's meant to deal with the problem of developing applications that are called +from a remote server via HTTP. Examples of this include PayPal, Facebook, +GitHub and many more. + +So how does it work? Well, first off you actually need to be able to receive +HTTP requests on some server somewhere. The point is that this doesn't need to +be your local development platform. + +Then in addition you run software on your local machine which connects to your +publicly available server, and relays the requests to whatever HTTP server you +prefer on the local machine. + +Flowchart +========= + +This is how it all looks, vaguely:: + + +---------------------------------------------------------------+ + | +----------------+ +--------------+ | + | | Foreign server | | Local server | | + | +----------------+ +--------------+ | + | | ^ | + | HTTP request | | + | | HTTP request | + | v | | + | +------------------+ Foreign request +-----------------+ | + | | Remote forwarder | <-----------------> | Local forwarder | | + | +------------------+ Local response +-----------------+ | + +---------------------------------------------------------------+ + +Part I: Local forwarder +======================= + +The local forwarder, simplified, looks like this: + + 1. Make a long-standing HTTP request to remote server, + 2. forward the response's entity body to the local server, + 3. forward the local server's response to the remote forwarder. + +That is to say, in a flowchart, it does this:: + + [remote forwarder] <-- [local forwarder] --> [local target] + +Part II: Remote forwarder +========================= + +The remote forwarder consists of two subsystems; the HTTP request forwarder, +which accepts requests from remote servers; and the client handler, which +maintains an outstanding request to the local forwarder. + +Request forwarding subsystem +---------------------------- + + 1. Wait for an HTTP request from a remote server, + 2. forward the request to the client handling subsystem, + 3. forward the response to the remote server. + +Client handling subsystem +------------------------- + + 1. Wait for an HTTP request from a local forwarder, + 2. wait for a request from the request forwarding subsystem, + 3. forward the request to the local forwarder, + 4. forward the response to the request forwarding subsystem. + +This part could potentially do some sort of authentication mechanism. + +Namespacing +=========== + +Of course, this all needs some sort of namespacing. The chosen method is using +the request path in HTTP requests. + +So, if you'd want to use a separate namespace for PayPal, you could for example +configure PayPal's IPN to send requests to ``http://eko.example.com/paypal/``, +and similarly, the local forwarder would have to request the very same path. diff --git a/app.yaml b/app.yaml new file mode 100644 index 0000000..25f7dd7 --- /dev/null +++ b/app.yaml @@ -0,0 +1,8 @@ +application: eko-eko +version: 1-brownk +runtime: python +api_version: 1 + +handlers: +- url: / + script: runcgi.py diff --git a/eko/__init__.py b/eko/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/eko/app.py b/eko/app.py new file mode 100644 index 0000000..59dcbdf --- /dev/null +++ b/eko/app.py @@ -0,0 +1,76 @@ +import hashlib +import logging +import datetime + +from werkzeug import Request, Response +from werkzeug.utils import cached_property + +from eko.db import ClientInfo, StoredRequest +from eko.utils import JSONResponse + +logger = logging.getLogger("eko.app") + +def register_client(request): + """Register client based on *request*, with an empty JSON list as response. + """ + base_path = "/" # TODO + client_info = ClientInfo(remote_addr=request.remote_addr, + base_path=base_path) + client_info.put() + resp = JSONResponse("[]") + resp.set_cookie("cid", str(client_info.key())) + return resp + +def client_pull(request): + """Pull stored requests for the client specified by the *cid* cookie. + + Returns a list of dicts of format:: + + {"headers": [[name, value], ...], + "data": "foo"} + + Also updates ClientInfo.pulled. + """ + client_info = ClientInfo.get(request.cookies["cid"]) + client_info.pulled = datetime.datetime.now() + client_info.put() + return JSONResponse(client_info.get_requests_json()) + [email protected] +def client_fwd_app(request): + """Handle client forwarding logics. + + This either registers the client, or gives the client a list of requests + which it received. See *client_pull* for more detailed information. + """ + if "cid" not in request.cookies: + return register_client(request) + else: + return client_pull(request) + [email protected] +def request_fwd_app(request): + """Store a request for forwading. + + Also lights a semaphore so that the interaction is snappy. + """ + now = datetime.datetime.now() + for client_info in ClientInfo.all(): + if request.path.startswith(client_info.base_path): + client_info.add_request(request) + client_info.pushed = now + client_info.put() + return Response("OK.\n", mimetype="text/plain") + +def eko_app(environ, start_response): + """Dispatch the request to either client forwarding or request storage. + + This is solely based on the User-Agent, which must start with 'eko/' for + eko clients. + """ + request = Request(environ) + if request.user_agent.string.startswith("eko/"): + app = client_fwd_app + else: + app = request_fwd_app + return app(environ, start_response) diff --git a/eko/db.py b/eko/db.py new file mode 100644 index 0000000..ab358d5 --- /dev/null +++ b/eko/db.py @@ -0,0 +1,66 @@ +import time +from google.appengine.ext import db +from google.appengine.api import memcache + +import logging +import simplejson + +logger = logging.getLogger("eko.db") + +REQ_SEM_EXPIRE = 3600 # an hour + +class ClientInfo(db.Model): + remote_addr = db.StringProperty() + base_path = db.StringProperty() + registered = db.DateTimeProperty(auto_now_add=True) + pushed = db.DateTimeProperty() + pulled = db.DateTimeProperty() + + @property + def mc_sem_key(self): + return "client_%s_sem" % (self.key(),) + + def wait_requests(self, timeout=10.0, retries=10): + # Essentially aquires a semaphore, so could be split out. + key = self.mc_sem_key + sleep_interval = timeout / retries + for attempt in xrange(retries): + val = memcache.get(key) + if val is not None: + memcache.delete(key) + return val + time.sleep(sleep_interval) + + def get_requests_json(self, **kwds): + if not self.wait_requests(**kwds): + logger.debug("found no requests for %s" % (self.key(),)) + return "[]" + req_parts = [] + req_part = req_parts.append + reqs = list(self.requests) + for req in reqs: + req_part('{"headers": %s, "data": %s}' % (req.headers, req.data)) + db.delete(reqs) + logger.info("popped %d requests for %s" % (len(reqs), self.key())) + return "[%s]" % (", ".join(req_parts)) + + def notify_request(self): + key = self.mc_sem_key + if not memcache.add(key, 1, time=REQ_SEM_EXPIRE): + if memcache.incr(key, 1) is None: + raise ValueError("could not increment request semaphore") + + def add_request(self, request): + hdrs = simplejson.dumps(request.headers.items()) + data = simplejson.dumps(request.data) + req = StoredRequest(client_info=self, headers=hdrs, data=data) + req.put() + self.notify_request() + logger.info("added request for %s from %s" % + (self.key(), request.remote_addr)) + +class StoredRequest(db.Model): + client_info = db.ReferenceProperty(ClientInfo, collection_name="requests") + created = db.DateTimeProperty(auto_now_add=True) + headers = db.BlobProperty() + data = db.BlobProperty() diff --git a/eko/utils.py b/eko/utils.py new file mode 100644 index 0000000..3848f5f --- /dev/null +++ b/eko/utils.py @@ -0,0 +1,10 @@ +from werkzeug import Response + +class JSONResponseMixin(object): + default_mimetype = "application/json" + + @classmethod + def from_python(cls, value, *args, **kwds): + return cls(simplejson.dumps(value), *args, **kwds) + +class JSONResponse(Response, JSONResponseMixin): pass diff --git a/index.yaml b/index.yaml new file mode 100644 index 0000000..a3b9e05 --- /dev/null +++ b/index.yaml @@ -0,0 +1,11 @@ +indexes: + +# AUTOGENERATED + +# This index.yaml is automatically updated whenever the dev_appserver +# detects that a new type of query is run. If you want to manage the +# index.yaml file manually, remove the above marker line (the line +# saying "# AUTOGENERATED"). If you want to manage some indexes +# manually, move them above the marker line. The index.yaml file is +# automatically uploaded to the admin console when you next deploy +# your application using appcfg.py. diff --git a/lib/jinja2.zip b/lib/jinja2.zip new file mode 100644 index 0000000..ab6e989 Binary files /dev/null and b/lib/jinja2.zip differ diff --git a/lib/simplejson.zip b/lib/simplejson.zip new file mode 100644 index 0000000..ede4b7f Binary files /dev/null and b/lib/simplejson.zip differ diff --git a/lib/werkzeug.zip b/lib/werkzeug.zip new file mode 100644 index 0000000..f841b78 Binary files /dev/null and b/lib/werkzeug.zip differ diff --git a/runcgi.py b/runcgi.py new file mode 100644 index 0000000..ba8f9db --- /dev/null +++ b/runcgi.py @@ -0,0 +1,14 @@ +import sys +import os +from glob import glob +zip_packs = glob(os.path.join(os.path.dirname(__file__), "lib", "*.zip")) +sys.path[:] = zip_packs + sys.path +import werkzeug, jinja2, simplejson + +def main(): + from wsgiref.handlers import CGIHandler + from eko.app import eko_app + CGIHandler().run(eko_app) + +if __name__ == "__main__": + main()
wagonlips/Admin-Header-Note
fe5097b51aec322bc89b0595aa421d16db5bbb3f
Giving up on TinyMCE for now.
diff --git a/adminHeaderNote.php b/adminHeaderNote.php index 5bf803f..0f26a8e 100644 --- a/adminHeaderNote.php +++ b/adminHeaderNote.php @@ -1,64 +1,56 @@ <?php /* Plugin Name: Admin Header Note Plugin URI: http://computerdemon.com/ Description: A simple plugin that adds a note with a link to the dashboard. Version: 0.2 Author: Sean Camden Author URI: http://computerdemon.com License: GPL */ // Runs when plugin is activated register_activation_hook(__FILE__,'admin_header_note_install'); // Runs on plugin deactivation register_deactivation_hook( __FILE__, 'admin_header_note_remove' ); // Creates new database field function admin_header_note_install() { add_option("admin_header_note_data", 'Defaultx', '', 'yes'); } // Deletes the database field function admin_header_note_remove() { delete_option('admin_header_note_data'); } if ( is_admin() ){ /* Call the html code */ add_action('admin_menu', 'admin_header_note_admin_menu'); function admin_header_note_admin_menu() { add_options_page('Admin Header Note', 'Admin Header Note', 'administrator', 'adminHeaderNote', 'admin_header_note_html_page'); } } function admin_header_note_html_page() { -// Pluggin' in some tiny_mce stuff. -add_action('admin_head', 'wp_tiny_mce(false)'); -add_filter('teeny_mce_buttons', 'teeny_mce_buttons'); + ?> <div> -<h2>Admin Header Note Options</h2> +<h2>Admin Header Note </h2> <form method="post" action="options.php"> <?php wp_nonce_field('update-options'); ?> -<table width="510"> -<tr valign="top"> -<th width="92" scope="row">Enter Text</th> -<td width="406"> -<textarea class="admin_header_note_area" name="admin_header_note_area" id="admin_header_note_area"> +<div id="admin_header_note_div"> +<textarea class="admin_header_note_area" name="admin_header_note_area" id="admin_header_note_area" rows="20" cols="100"> <?php echo get_option('admin_header_note_data'); ?> </textarea> -<?php the_editor($id = 'content', $media_buttons = true); ?> -</td> -</tr> -</table> +</div> <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="admin_header_note_data" /> <p> <input type="submit" value="<?php _e('Save Changes') ?>" /> </p> </form> </div> <?php } ?>
wagonlips/Admin-Header-Note
7f165e9a8a1364e93a48909e69ecd8e38c1534ef
No significant change was made.
diff --git a/adminHeaderNote.php b/adminHeaderNote.php index 101aab4..5bf803f 100644 --- a/adminHeaderNote.php +++ b/adminHeaderNote.php @@ -1,64 +1,64 @@ <?php /* Plugin Name: Admin Header Note Plugin URI: http://computerdemon.com/ Description: A simple plugin that adds a note with a link to the dashboard. Version: 0.2 Author: Sean Camden Author URI: http://computerdemon.com License: GPL */ // Runs when plugin is activated register_activation_hook(__FILE__,'admin_header_note_install'); // Runs on plugin deactivation register_deactivation_hook( __FILE__, 'admin_header_note_remove' ); // Creates new database field function admin_header_note_install() { add_option("admin_header_note_data", 'Defaultx', '', 'yes'); } // Deletes the database field function admin_header_note_remove() { delete_option('admin_header_note_data'); } - -add_action('admin_head', 'wp_tiny_mce(false)'); -add_filter('teeny_mce_buttons', 'teeny_mce_buttons'); if ( is_admin() ){ /* Call the html code */ add_action('admin_menu', 'admin_header_note_admin_menu'); function admin_header_note_admin_menu() { add_options_page('Admin Header Note', 'Admin Header Note', 'administrator', 'adminHeaderNote', 'admin_header_note_html_page'); } } function admin_header_note_html_page() { +// Pluggin' in some tiny_mce stuff. +add_action('admin_head', 'wp_tiny_mce(false)'); +add_filter('teeny_mce_buttons', 'teeny_mce_buttons'); ?> <div> <h2>Admin Header Note Options</h2> <form method="post" action="options.php"> <?php wp_nonce_field('update-options'); ?> <table width="510"> <tr valign="top"> <th width="92" scope="row">Enter Text</th> <td width="406"> <textarea class="admin_header_note_area" name="admin_header_note_area" id="admin_header_note_area"> <?php echo get_option('admin_header_note_data'); ?> </textarea> <?php the_editor($id = 'content', $media_buttons = true); ?> </td> </tr> </table> <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="admin_header_note_data" /> <p> <input type="submit" value="<?php _e('Save Changes') ?>" /> </p> </form> </div> <?php } ?>
wagonlips/Admin-Header-Note
6dc4d3befff36dfe2e8631be413d5d03d468b4c3
Trying to add tiny_mce. Not working yet.
diff --git a/adminHeaderNote.php b/adminHeaderNote.php index d6a7e47..101aab4 100644 --- a/adminHeaderNote.php +++ b/adminHeaderNote.php @@ -1,67 +1,64 @@ <?php /* Plugin Name: Admin Header Note Plugin URI: http://computerdemon.com/ Description: A simple plugin that adds a note with a link to the dashboard. Version: 0.2 Author: Sean Camden Author URI: http://computerdemon.com License: GPL */ // Runs when plugin is activated register_activation_hook(__FILE__,'admin_header_note_install'); // Runs on plugin deactivation register_deactivation_hook( __FILE__, 'admin_header_note_remove' ); // Creates new database field function admin_header_note_install() { add_option("admin_header_note_data", 'Defaultx', '', 'yes'); } // Deletes the database field function admin_header_note_remove() { delete_option('admin_header_note_data'); } -/* -wp_tiny_mce( false , // true makes the editor "teeny" - array( - "editor_selector" => "admin_header_note_data" - ) -); -*/ + +add_action('admin_head', 'wp_tiny_mce(false)'); +add_filter('teeny_mce_buttons', 'teeny_mce_buttons'); if ( is_admin() ){ /* Call the html code */ add_action('admin_menu', 'admin_header_note_admin_menu'); function admin_header_note_admin_menu() { add_options_page('Admin Header Note', 'Admin Header Note', 'administrator', 'adminHeaderNote', 'admin_header_note_html_page'); } } function admin_header_note_html_page() { ?> <div> <h2>Admin Header Note Options</h2> <form method="post" action="options.php"> <?php wp_nonce_field('update-options'); ?> <table width="510"> <tr valign="top"> <th width="92" scope="row">Enter Text</th> <td width="406"> -<textarea class="admin_header_note_data" name="admin_header_note_data" id="admin_header_note_data"> +<textarea class="admin_header_note_area" name="admin_header_note_area" id="admin_header_note_area"> <?php echo get_option('admin_header_note_data'); ?> </textarea> +<?php the_editor($id = 'content', $media_buttons = true); ?> </td> </tr> </table> <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="admin_header_note_data" /> <p> <input type="submit" value="<?php _e('Save Changes') ?>" /> </p> </form> </div> <?php } ?>
wagonlips/Admin-Header-Note
d2dbfc8c91a601e098e751745f9c9154f3c4e100
Initial import.
diff --git a/README b/README new file mode 100644 index 0000000..145e2ac --- /dev/null +++ b/README @@ -0,0 +1,44 @@ +=== Admin Header Note === +Contributors: Sean Camden +Donate link: http://www.generositynetwork.com/ntaf/index.cfm +Tags: Admin page, dashboard, header, note to other admins +Requires at least: 2.0.3 +Tested up to: 3.1 +Stable tag: 0.2 + +Places a small note with an optional link at the top of the admin pages. + +== Description == + +This plugin simply places a small, bordered note with an optional link at the top of the admin pages +inside the WordPress dashboard. Nothing fancy, just a simple way to draw the attention of everyone +who might be visiting the admin pages to something important, where the README files for the site are, +for instance. + +Obviously, this plugin will primarily be useful to sites with multiple administrators. + +== Installation == + +1. Upload `Admin-Header-Note` to the `/wp-content/plugins/` directory. +2. Activate the plugin through the 'Plugins' menu in WordPress. +3. Use the Admin Header Note options page to configure message, location, color, and link. + +* The Admin Header Note can be positioned and colored using any CSS unit (http://www.w3schools.com/css/css_units.asp), + including %, in, cm, mm, em, ex, pt, pc, and px, for positioning, and color name, comma separated RGB values, comma + separated RGB percentages, or HEX number for color. Check above link for examples. + Coordinate origin is the upper right corner. + +* In the link field, it is incumbent upon the user to supply a valid URI, absolute or relative. + A relative link must use the WordPress site root. + +* The message field will accept text of any length, but anything over a few words will be difficult to position neatly. + +== Frequently Asked Questions == + += No questions asked yet. = + +No answers supplied, either. + +== Screenshots == + +1. The Admin Header Note plugin, live and in action. diff --git a/adminHeaderNote.php b/adminHeaderNote.php new file mode 100644 index 0000000..d6a7e47 --- /dev/null +++ b/adminHeaderNote.php @@ -0,0 +1,67 @@ +<?php +/* +Plugin Name: Admin Header Note +Plugin URI: http://computerdemon.com/ +Description: A simple plugin that adds a note with a link to the dashboard. +Version: 0.2 +Author: Sean Camden +Author URI: http://computerdemon.com +License: GPL +*/ +// Runs when plugin is activated +register_activation_hook(__FILE__,'admin_header_note_install'); +// Runs on plugin deactivation +register_deactivation_hook( __FILE__, 'admin_header_note_remove' ); +// Creates new database field +function admin_header_note_install() { + add_option("admin_header_note_data", 'Defaultx', '', 'yes'); +} +// Deletes the database field +function admin_header_note_remove() { + delete_option('admin_header_note_data'); +} +/* +wp_tiny_mce( false , // true makes the editor "teeny" + array( + "editor_selector" => "admin_header_note_data" + ) +); +*/ +if ( is_admin() ){ + /* Call the html code */ + add_action('admin_menu', 'admin_header_note_admin_menu'); + function admin_header_note_admin_menu() { + add_options_page('Admin Header Note', 'Admin Header Note', 'administrator', 'adminHeaderNote', 'admin_header_note_html_page'); + } +} +function admin_header_note_html_page() { +?> +<div> +<h2>Admin Header Note Options</h2> + +<form method="post" action="options.php"> +<?php wp_nonce_field('update-options'); ?> + +<table width="510"> +<tr valign="top"> +<th width="92" scope="row">Enter Text</th> +<td width="406"> +<textarea class="admin_header_note_data" name="admin_header_note_data" id="admin_header_note_data"> +<?php echo get_option('admin_header_note_data'); ?> +</textarea> +</td> +</tr> +</table> + +<input type="hidden" name="action" value="update" /> +<input type="hidden" name="page_options" value="admin_header_note_data" /> + +<p> +<input type="submit" value="<?php _e('Save Changes') ?>" /> +</p> + +</form> +</div> +<?php +} +?> diff --git a/adminHeaderNote.php.0 b/adminHeaderNote.php.0 new file mode 100644 index 0000000..ce85dee --- /dev/null +++ b/adminHeaderNote.php.0 @@ -0,0 +1,108 @@ +<?php +/* +Plugin Name: Admin Header Note +Plugin URI: http://wagonlips.com/files/plugins/adminHeaderNote/ +Description: This plugin simply places a small link or message at the top of the admin header. +Author: Sean Camden +Version: 0.1 +Author URI: http://www.wagonlips.com +*/ + +// Echo the string. +function adminHeaderNote() { + $adminHeaderNote_message = get_option('adminHeaderNote_message'); + $adminHeaderNote_link = get_option('adminHeaderNote_link'); + echo "<p id='adminNote'><span><a href='$adminHeaderNote_link'>$adminHeaderNote_message</a></span></p>"; +} + +// Fire the previous function when the footer loads. +add_action('admin_footer', 'adminHeaderNote'); + +// Position and style the output just so. +function adminHeaderNote_css() { + $adminHeaderNote_X = get_option('adminHeaderNote_X'); + $adminHeaderNote_Y = get_option('adminHeaderNote_Y'); + $adminHeaderNote_color = get_option('adminHeaderNote_color'); + echo " + <style type='text/css'> + #adminNote { + position: absolute; + top:$adminHeaderNote_Y; + right:$adminHeaderNote_X; + color: #d54e21; + font: 12px Tahoma, Verdana, sans-serif; + color:$adminHeaderNote_color; + padding: 3px 4px; + display: block; + letter-spacing: normal; + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + } + #adminNote a:hover, #adminNote a { + color:$adminHeaderNote_color; + } + </style> + "; +} + +// Add the CSS to the head. +add_action('admin_head', 'adminHeaderNote_css'); + +// Create an admin page that will allow configuration of the note. +add_action('admin_menu', 'adminHeaderNote_setup_menu' ); + +function adminHeaderNote_setup_menu() { + add_options_page('Admin Header Note Options', 'Admin Header Note', 9, __FILE__, 'adminHeaderNote_setup_options'); +} + +// Here lies the markup for the form that goes on the admin page. When written to conform to Wordpress Coding Standards, +// as suggested here: http://codex.wordpress.org/Creating_Options_Pages the values, upon hitting submit, vanish from +// the form fields on the admin page, though they remain in the database. +// Without actually knowing why it makes the values persistent, since it improves usability, this format remains for now. +function adminHeaderNote_setup_options() { + echo ' + <div class="wrap"> + <h2>Admin Header Note</h2> + <form method="post" action="options.php"> + '.wp_nonce_field('update-options').' + <table class="form-table"> + <tr valign="top"> + <th colspan="2" scope="row">Admin Header Note simply places a small note at the top of Dashboard pages with an optional link.</th> + </tr> + <tr> + <td>Distance from right <br />(250px or 25em or like that):</td> + <td><input type="text" name="adminHeaderNote_X" value="'.get_option('adminHeaderNote_X').'" /></td> + </tr> + <tr> + <td>Distance from top <br />(5px or 1em or like that):</td> + <td><input type="text" name="adminHeaderNote_Y" value="'.get_option('adminHeaderNote_Y').'" /></td> + </tr> + <tr> + <td>The message (keep it short)</td> + <td><input type="text" name="adminHeaderNote_message" value="'.get_option('adminHeaderNote_message').'" /></td> + </tr> + <tr> + <td>The link (if there is one)</td> + <td><input type="text" name="adminHeaderNote_link" value="'.get_option('adminHeaderNote_link').'" /></td> + </tr> + <tr> + <td>The color of the note.</td> + <td><input type="text" name="adminHeaderNote_color" value="'.get_option('adminHeaderNote_color').'" /></td> + </tr> + </table> + </div> + <input type="hidden" name="action" value="update" /> + <input type="hidden" name="page_options" value="adminHeaderNote_X,adminHeaderNote_Y,adminHeaderNote_message,adminHeaderNote_link,adminHeaderNote_color" /> + <p class="submit"> + <input type="submit" name="Submit" value="Save Changes" /> + </p> + </form> + </div> + '; +} + +?>
norman/enc
f36174fede1414b43fd3f73e9f0ac8c1dbcdc4dc
Added slides link.
diff --git a/README.md b/README.md index 635f2e5..1d6cdf5 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,34 @@ # The 9th Bit: Encodings in Ruby 1.9 By [Norman Clarke](http://twitter.com/compay) I hope you enjoyed my presentation at [RubyConf Brazil 2010](http://www.rubyconf.com.br/)! This repository has my slides, some code demos you can run, and some links to resources to get more information on encodings and Ruby. +You can also see the slides on [Slideshare](http://www.slideshare.net/normanclarke/the-9th-bit-encodings-in-ruby-19). + Comments? Feel free to send me an email at [email protected]. ## Encoding Resources ### Basic Information * Fabio Akita - [Convertendo meu Banco de Latin1 para UTF-8](http://akitaonrails.com/2010/01/01/convertendo-meu-banco-de-latin1-para-utf-8) * Ilya Grigorik - [Secure UTF-8 Input in Rails](http://www.igvita.com/2007/04/11/secure-utf-8-input-in-rails/) * Yehuda Katz - [Encodings, Unabridged](http://yehudakatz.com/2010/05/17/encodings-unabridged/) ### More Advanced * James Edward Grey II - [Understanding M17N](http://blog.grayproductions.net/articles/understanding_m17n) * Yui Naruse - [The Design and Implementation of Ruby M17N](http://yokolet.blogspot.com/2009/07/design-and-implementation-of-ruby-m17n.html) * Ben Peterson - [Unicode in Japan](http://web.archive.org/web/20080122094511/http://www.jbrowse.com/text/unij.html) * Brian Candler - [String19](http://github.com/candlerb/string19) * Otfried Chong - [Han Unification in Unicode](http://tclab.kaist.ac.kr/~otfried/Mule/unihan.html) * Ken Lundie - [CJKV Information Processing](http://oreilly.com/catalog/9780596514471) (Book) ### Libraries * [Unicode](http://github.com/blackwinter/unicode) * [Babosa](http://github.com/norman/babosa)
norman/enc
8fdfa69c76aecba9f1bbfeacc6726033ea74fc2f
Added license.
diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..5a8e332 --- /dev/null +++ b/COPYING @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar <[email protected]> + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. +
norman/enc
562e2945ea9833a31b7968b6d460c5f4674c19b7
Docs, demos and slides.
diff --git a/README.md b/README.md new file mode 100644 index 0000000..635f2e5 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# The 9th Bit: Encodings in Ruby 1.9 + +By [Norman Clarke](http://twitter.com/compay) + +I hope you enjoyed my presentation at [RubyConf Brazil 2010](http://www.rubyconf.com.br/)! + +This repository has my slides, some code demos you can run, and some links to +resources to get more information on encodings and Ruby. + +Comments? Feel free to send me an email at [email protected]. + +## Encoding Resources + +### Basic Information + +* Fabio Akita - [Convertendo meu Banco de Latin1 para UTF-8](http://akitaonrails.com/2010/01/01/convertendo-meu-banco-de-latin1-para-utf-8) +* Ilya Grigorik - [Secure UTF-8 Input in Rails](http://www.igvita.com/2007/04/11/secure-utf-8-input-in-rails/) +* Yehuda Katz - [Encodings, Unabridged](http://yehudakatz.com/2010/05/17/encodings-unabridged/) + +### More Advanced + +* James Edward Grey II - [Understanding M17N](http://blog.grayproductions.net/articles/understanding_m17n) +* Yui Naruse - [The Design and Implementation of Ruby M17N](http://yokolet.blogspot.com/2009/07/design-and-implementation-of-ruby-m17n.html) +* Ben Peterson - [Unicode in Japan](http://web.archive.org/web/20080122094511/http://www.jbrowse.com/text/unij.html) +* Brian Candler - [String19](http://github.com/candlerb/string19) +* Otfried Chong - [Han Unification in Unicode](http://tclab.kaist.ac.kr/~otfried/Mule/unihan.html) +* Ken Lundie - [CJKV Information Processing](http://oreilly.com/catalog/9780596514471) (Book) + +### Libraries + +* [Unicode](http://github.com/blackwinter/unicode) +* [Babosa](http://github.com/norman/babosa) diff --git a/databases.sql b/databases.sql new file mode 100644 index 0000000..4dbf860 --- /dev/null +++ b/databases.sql @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS example; + +CREATE TABLE example ( + note VARCHAR(20), + value CHAR(1) +); + +-- MySQL: FAIL +INSERT INTO example VALUES ('one byte:', 'a'); +INSERT INTO example VALUES ('two bytes:', 'ã'); +INSERT INTO example VALUES ('three bytes:', 'の'); +INSERT INTO example VALUES ('four bytes:', '沿'); +SELECT * FROM example; +DELETE FROM example; + +-- WIN +SET NAMES 'utf8'; +ALTER TABLE example CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; + +INSERT INTO example VALUES ('one byte:', 'a'); +INSERT INTO example VALUES ('two bytes:', 'ã'); +INSERT INTO example VALUES ('three bytes:', 'の'); +INSERT INTO example VALUES ('four bytes:', '沿'); +SELECT * FROM example; +SELECT * FROM example WHERE value = 'ã'; diff --git a/demos/identity.rb b/equivalence.rb similarity index 84% rename from demos/identity.rb rename to equivalence.rb index 31e8349..bd8de55 100644 --- a/demos/identity.rb +++ b/equivalence.rb @@ -1,63 +1,65 @@ -#encoding: utf-8 +# encoding: utf-8 +# Don't edit this file and save it, or else you'll probably break the demo. +# Run this under Ruby 1.9. def ________________________________________________________________________________ puts "_" * 80; end puts "A Quick Executable Lesson on Unicode Strings" ________________________________________________________________________________ -puts "Identity with ASCII strings is pretty straightforward. If two strings *look*" +puts "Equivalence with ASCII strings is pretty straightforward. If two strings *look*" print "the same, they *are* the same. Here, does 'John' == 'John'? " puts "John" == "John" ________________________________________________________________________________ -puts "But with UTF-8 it's not so straightforward, because there are often several" -print "ways to encode non-ASCII characters. Does 'João' == 'João'? " +puts "But with UTF-8 it's not so straightforward, because there are 2 ways" +print "to encode some non-ASCII characters. Does 'João' == 'João'? " puts "João" == "João" ________________________________________________________________________________ print 'For example, this "ã" is made up of two bytes: ' p "ã".unpack("C*") print 'And is a single Unicode character ("ã"): ' p "ã".unpack("U*") ________________________________________________________________________________ print 'But this "ã" has three bytes: ' p "ã".unpack("C*") -print 'And is two Unicode characters ("a" and "˜"): ' +print 'And is two UTF-8 characters ("a" and "˜"): ' p "ã".unpack("U*") ________________________________________________________________________________ puts "This can make using UTF-8 encoded strings as hash keys risky." users = {} users["João"] = "authorized" users["João"] = "not authorized" print "How many users are in the hash we just created?\n\n" p users ________________________________________________________________________________ print <<-EOM Unicode libraries such as "Unicode" and "Active Support" provide support for *normalizing* UTF-8 strings to ensure that two strings that look the same are the same. If you're ever going to use UTF-8 characters as hash keys, or search against them in a database, make sure you normalize them first. EOM begin puts "So let's loop through the hash keys and normalize them." require "unicode" users.keys.each do |key| value = users.delete(key) key = Unicode.normalize_KC(key) users[key] = value end print "Now how many users will we have? " p users rescue LoadError puts "Oops, you don't have the unicode gem installed, so we can't run this part of the demo." end ________________________________________________________________________________ puts "So if you only remember one thing from this presentation, remember this:" -puts "\n\nNormalizing your Unicode data before you save it!!!" +puts "\n\nNormalize your Unicode data before you save it!!!" diff --git a/slides.pdf b/slides.pdf new file mode 100644 index 0000000..34ebd11 Binary files /dev/null and b/slides.pdf differ diff --git a/source.rb b/source.rb new file mode 100644 index 0000000..39920fc --- /dev/null +++ b/source.rb @@ -0,0 +1,10 @@ +# encoding: utf-8 +# Yes, this is valid Ruby 1.9 - even though your text editor's +# syntax highlighting will probably not think so. +class Canção + GÊNEROS = [:forró, :carimbó, :afoxé] + attr_accessor :gênero +end +asa_branca = Canção.new +asa_branca.gênero = :forró +p asa_branca.gênero diff --git a/strip_diacritics.rb b/strip_diacritics.rb new file mode 100644 index 0000000..397496b --- /dev/null +++ b/strip_diacritics.rb @@ -0,0 +1,31 @@ +# encoding: utf-8 +require "active_support" +require "active_support/inflector" +require "unicode" + +strings = ["ã", "ç", "ê", "ó"] +strings2 = ["ø", "ß", "œ"] + +class String + + def to_ascii1 + # You'll often see this recommended as a way to "asciify" characters by + # stripping off accent marks. It works ok for Portuguese, but isn't a good + # general solution because many common Latin characters don't decompose. + Unicode.normalize_D(self).gsub(/[^\x00-\x7F]/, '') + end + + def to_ascii2 + # Instead, use a library that has transliteration tables to map the + # characters to a reasonable ASCII representation. + ActiveSupport::Inflector.transliterate(self).to_s + end +end + +# FAIL +p strings.map &:to_ascii1 +p strings2.map &:to_ascii1 + +# OK +p strings.map &:to_ascii2 +p strings2.map &:to_ascii2
bravoserver/bravo
7be5d792871a8447499911fa1502c6a7c1437dc3
fix faq link
diff --git a/README.rst b/README.rst index 48522aa..fd4948d 100644 --- a/README.rst +++ b/README.rst @@ -1,202 +1,201 @@ ===== Bravo ===== Bravo is a elegant, speedy, and extensible implementation of the Minecraft Alpha/Beta/"Modern" protocol. Only the server side is implemented. Bravo also has a few tools useful for examining the wire protocols and disk formats in Minecraft. Features ======== Standard Features ----------------- * Console * Login and handshake * Geometry ("chunk") transfer * Location updates * Passage of time (day/night) * Block construction and deconstruction * Entities * Players * Pickups * Tiles * Chests * Furnaces * Signs * Lighting * Save controls * Server-side inventories Extended Features ----------------- * Pluggable architecture * Commands * Inventory control * Teleports * Time of day * Terrain generation * Erosion * Simplex noise, 2D and 3D * Water table * Seasons * Spring * Winter * Physics * Sand, gravel * Water, lava * Redstone * Chat commands * IP ban list Installing ========== Bravo currently requires Python 2.6 or any newer Python 2.x. It is known to work on CPython and PyPy. Bravo ships with a standard setup.py. You will need setuptools/distribute, but most distributions already provide it for you. Bravo depends on the following external libraries from PyPI: * construct, version 2.03 or later * Twisted, version 11.0 or later If installing modular Twisted, Twisted Conch is required. For IRC support, Twisted Words is required; it is usually called python-twisted-words or twisted-words in package managers. For web service support, Twisted Web must be installed; it is generally called python-twisted-web or twisted-web. Windows ------- Windows is no longer directly supported. Though if python and dependencies are installed, it should work just fine. Due note, as of this writing, Twisted only supports Win32 so make sure to only use Win32 python packages. Debian & Ubuntu --------------- Debian and its derivatives, like Ubuntu, have Twisted in their package managers. :: $ sudo aptitude install python-twisted If you are tight on space, you can install only part of Twisted. :: $ sudo aptitude install python-twisted-core python-twisted-bin python-twisted-conch A Note about Ubuntu ^^^^^^^^^^^^^^^^^^^ If you are using Ubuntu 10.04 LTS, you will need a more recent Twisted than Ubuntu provides. There is a PPA at http://launchpad.net/~twisted-dev/+archive/ppa which provides recent versions of all Twisted packages. Fedora ------ Twisted can be installed from the standard Fedora repository. :: $ sudo yum install python-twisted python-twisted-conch Gentoo ------ Gentoo does carry a Construct new enough for Bravo, but it does have to be unmasked. :: # emerge twisted twisted-conch LFS/Virtualenv/Standalone ------------------------- If, for some reason, you are installing to a very raw or unmanaged place, and you want to ensure that everything is built from the latest source available on PyPI, we highly recommend pip for installing Bravo, since it handles all dependencies for you. :: $ pip install Bravo Bravo can also optionally use Ampoule to offload some of its inner calculations to a separate process, improving server response times. Ampoule will be automatically detected and is completely optional. :: $ pip install ampoule Running ======= Bravo includes a twistd plugin, so it's quite easy to run. Just copy bravo.ini.example to bravo.ini, and put it in one of these locations: * /etc/bravo/ * ~/.bravo/ * Your working directory And then run the Twisted plugin: :: $ twistd -n bravo Contributing ============ Contributing is easy! Just send me your code. Diffs are appreciated, in git format; Github pull requests are excellent. Things to consider: * I will be rather merciless about your code during review, especially if it adds lots of new features. * Some things are better off outside of the main tree, especially if they are moving very fast compared to Bravo itself. * Unit tests are necessary for new code, especially feature-laden code. If your code is absolutely not testable, it's not really going to be very fun to maintain. See the above point. * Bravo is MIT/X11. Your contributions will be under that same license. If this isn't acceptable, then your code cannot be merged. This is really the only hard condition. FAQ === -The FAQ moved to the docs; see docs/faq.rst, or more usefully, -http://bravo.readthedocs.org/en/latest/faq.html for an HTML version. +The FAQ moved to readthedocs; see http://bravo.readthedocs.org/en/latest/introduction.html#q-a. License ======= Bravo is MIT/X11-licensed. See the LICENSE file for the actual text of the license.
bravoserver/bravo
058dad38b2988be1ab913e3e2dfd0eed12224466
travis-ci: added notifications
diff --git a/.travis.yml b/.travis.yml index 5e9235b..b9ba6f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,9 @@ language: python python: - "2.6" - "2.7" - "pypy" script: "trial bravo" + +notifications: + irc: "chat.freenode.net#bravoserver"
bravoserver/bravo
bb96c01fbaaf1f7920dd429400f0eb30ea23dffb
requirements: added Pillow
diff --git a/requirements.txt b/requirements.txt index 650f7b1..306ecef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ construct==2.0.6 +Pillow==2.4.0 Twisted>=11.0
bravoserver/bravo
85e8c9db9522a9ec33184e64f3a99ba22f34567b
Revert "Add PIL to requirements.txt, because web.py plugin needs it"
diff --git a/requirements.txt b/requirements.txt index a5049c4..650f7b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,2 @@ -PIL==1.1.7 -Twisted==13.2.0 -argparse==1.2.1 construct==2.0.6 -distribute==0.6.34 -wsgiref==0.1.2 -zope.interface==4.1.0 +Twisted>=11.0
bravoserver/bravo
d724cf814293d7ed5df83422094d56375b58f261
inventory/windows: Don't use ListContainer.
diff --git a/bravo/inventory/windows.py b/bravo/inventory/windows.py index b4cb2b2..c29f217 100644 --- a/bravo/inventory/windows.py +++ b/bravo/inventory/windows.py @@ -1,435 +1,435 @@ from itertools import chain, izip -from construct import Container, ListContainer +from construct import Container from bravo import blocks from bravo.beta.packets import make_packet from bravo.beta.structures import Slot from bravo.inventory import SerializableSlots from bravo.inventory.slots import Crafting, Workbench, LargeChestStorage class Window(SerializableSlots): """ Item manager The ``Window`` covers all kinds of inventory and crafting windows, ranging from user inventories to furnaces and workbenches. The ``Window`` agregates player's inventory and other crafting/storage slots as building blocks of the window. :param int wid: window ID :param Inventory inventory: player's inventory object :param SlotsSet slots: other window slots """ def __init__(self, wid, inventory, slots): self.inventory = inventory self.slots = slots self.wid = wid self.selected = None self.coords = None # NOTE: The property must be defined in every final class # of certain window. Never use generic one. This can lead to # awfull bugs. #@property #def metalist(self): # m = [self.slots.crafted, self.slots.crafting, # self.slots.fuel, self.slots.storage] # m += [self.inventory.storage, self.inventory.holdables] # return m @property def slots_num(self): return self.slots.slots_num @property def identifier(self): return self.slots.identifier @property def title(self): return self.slots.title def container_for_slot(self, slot): """ Retrieve the table and index for a given slot. There is an isomorphism here which allows all of the tables of this ``Window`` to be viewed as a single large table of slots. """ for l in self.metalist: if not len(l): continue if slot < len(l): return l, slot slot -= len(l) def slot_for_container(self, table, index): """ Retrieve slot number for given table and index. """ i = 0 for t in self.metalist: l = len(t) if t is table: if l == 0 or l <= index: return -1 else: i += index return i else: i += l return -1 def load_from_packet(self, container): """ Load data from a packet container. """ items = [None] * self.metalength for i, item in enumerate(container.items): if item.id < 0: items[i] = None else: items[i] = Slot(item.id, item.damage, item.count) self.load_from_list(items) def save_to_packet(self): - lc = ListContainer() + l = [] for item in chain(*self.metalist): if item is None: - lc.append(Container(primary=-1)) + l.append(Container(primary=-1)) else: - lc.append(Container(primary=item.primary, + l.append(Container(primary=item.primary, secondary=item.secondary, count=item.quantity)) - packet = make_packet("inventory", wid=self.wid, length=len(lc), items=lc) + packet = make_packet("inventory", wid=self.wid, length=len(l), items=l) return packet def select_stack(self, container, index): """ Handle stacking of items (Shift + RMB/LMB) """ item = container[index] if item is None: return False loop_over = enumerate # default enumerator - from start to end # same as enumerate() but in reverse order reverse_enumerate = lambda l: izip(xrange(len(l)-1, -1, -1), reversed(l)) if container is self.slots.crafting or container is self.slots.fuel: targets = self.inventory.storage, self.inventory.holdables elif container is self.slots.crafted or container is self.slots.storage: targets = self.inventory.holdables, self.inventory.storage # in this case notchian client enumerates from the end. o_O loop_over = reverse_enumerate elif container is self.inventory.storage: if self.slots.storage: targets = self.slots.storage, else: targets = self.inventory.holdables, elif container is self.inventory.holdables: if self.slots.storage: targets = self.slots.storage, else: targets = self.inventory.storage, else: return False initial_quantity = item_quantity = item.quantity # find same item to stack for stash in targets: for i, slot in loop_over(stash): if slot is not None and slot.holds(item) and slot.quantity < 64 \ and slot.primary not in blocks.unstackable: count = slot.quantity + item_quantity if count > 64: count, item_quantity = 64, count - 64 else: item_quantity = 0 stash[i] = slot.replace(quantity=count) container[index] = item.replace(quantity=item_quantity) self.mark_dirty(stash, i) self.mark_dirty(container, index) if item_quantity == 0: container[index] = None return True # find empty space to move for stash in targets: for i, slot in loop_over(stash): if slot is None: # XXX bug; might overflow a slot! stash[i] = item.replace(quantity=item_quantity) container[index] = None self.mark_dirty(stash, i) self.mark_dirty(container, index) return True return initial_quantity != item_quantity def select(self, slot, alternate=False, shift=False): """ Handle a slot selection. This method implements the basic public interface for interacting with ``Inventory`` objects. It is directly equivalent to mouse clicks made upon slots. :param int slot: which slot was selected :param bool alternate: whether the selection is alternate; e.g., if it was done with a right-click :param bool shift: whether the shift key is toogled """ # Look up the container and offset. # If, for any reason, our slot is out-of-bounds, then # container_for_slot will return None. In that case, catch the error # and return False. try: l, index = self.container_for_slot(slot) except TypeError: return False if l is self.inventory.armor: result, self.selected = self.inventory.select_armor(index, alternate, shift, self.selected) return result elif l is self.slots.crafted: if shift: # shift-click on crafted slot # Notchian client works this way: you lose items # that was not moved to inventory. So, it's not a bug. if (self.select_stack(self.slots.crafted, 0)): # As select_stack() call took items from crafted[0] # we must update the recipe to generate new item there self.slots.update_crafted() # and now we emulate taking of the items result, temp = self.slots.select_crafted(0, alternate, True, None) else: result = False else: result, self.selected = self.slots.select_crafted(index, alternate, shift, self.selected) return result elif shift: return self.select_stack(l, index) elif self.selected is not None and l[index] is not None: sslot = self.selected islot = l[index] if islot.holds(sslot) and islot.primary not in blocks.unstackable: # both contain the same item if alternate: if islot.quantity < 64: l[index] = islot.increment() self.selected = sslot.decrement() self.mark_dirty(l, index) else: if sslot.quantity + islot.quantity <= 64: # Sum of items fits in one slot, so this is easy. l[index] = islot.increment(sslot.quantity) self.selected = None else: # fill up slot to 64, move left overs to selection # valid for left and right mouse click l[index] = islot.replace(quantity=64) self.selected = sslot.replace( quantity=sslot.quantity + islot.quantity - 64) self.mark_dirty(l, index) else: # Default case: just swap # valid for left and right mouse click self.selected, l[index] = l[index], self.selected self.mark_dirty(l, index) else: if alternate: if self.selected is not None: sslot = self.selected l[index] = sslot.replace(quantity=1) self.selected = sslot.decrement() self.mark_dirty(l, index) elif l[index] is None: # Right click on empty inventory slot does nothing return False else: # Logically, l[index] is not None, but self.selected is. islot = l[index] scount = islot.quantity // 2 scount, lcount = islot.quantity - scount, scount l[index] = islot.replace(quantity=lcount) self.selected = islot.replace(quantity=scount) self.mark_dirty(l, index) else: # Default case: just swap. self.selected, l[index] = l[index], self.selected self.mark_dirty(l, index) # At this point, we've already finished touching our selection; this # is just a state update. if l is self.slots.crafting: self.slots.update_crafted() return True def close(self): ''' Clear crafting areas and return items to drop and packets to send to client ''' items = [] packets = "" # slots on close action it, pk = self.slots.close(self.wid) items += it packets += pk # drop 'item on cursor' items += self.drop_selected() return items, packets def drop_selected(self, alternate=False): items = [] if self.selected is not None: if alternate: # drop one item i = Slot(self.selected.primary, self.selected.secondary, 1) items.append(i) self.selected = self.selected.decrement() else: # drop all items.append(self.selected) self.selected = None return items def mark_dirty(self, table, index): # override later in SharedWindow pass def packets_for_dirty(self, a): # override later in SharedWindow return "" class InventoryWindow(Window): ''' Special case of window - player's inventory window ''' def __init__(self, inventory): Window.__init__(self, 0, inventory, Crafting()) @property def slots_num(self): # Actually it doesn't matter. Client never notifies when it opens inventory return 5 @property def identifier(self): # Actually it doesn't matter. Client never notifies when it opens inventory return "inventory" @property def title(self): # Actually it doesn't matter. Client never notifies when it opens inventory return "Inventory" @property def metalist(self): m = [self.slots.crafted, self.slots.crafting] m += [self.inventory.armor, self.inventory.storage, self.inventory.holdables] return m def creative(self, slot, primary, secondary, quantity): ''' Process inventory changes made in creative mode ''' try: container, index = self.container_for_slot(slot) except TypeError: return False # Current notchian implementation has only holdable slots. # Prevent changes in other slots. if container is self.inventory.holdables: container[index] = Slot(primary, secondary, quantity) return True else: return False class WorkbenchWindow(Window): def __init__(self, wid, inventory): Window.__init__(self, wid, inventory, Workbench()) @property def metalist(self): # Window.metalist will work fine as well, # but this verion works a little bit faster m = [self.slots.crafted, self.slots.crafting] m += [self.inventory.storage, self.inventory.holdables] return m class SharedWindow(Window): """ Base class for all windows with shared containers (like chests, furnace and dispenser) """ def __init__(self, wid, inventory, slots, coords): """ :param int wid: window ID :param Inventory inventory: player's inventory object :param Tile tile: tile object :param tuple coords: world coords of the tile (bigx, smallx, bigz, smallz, y) """ Window.__init__(self, wid, inventory, slots) self.coords = coords self.dirty_slots = {} # { slot : value, ... } def mark_dirty(self, table, index): # player's inventory are not shareable slots, skip it if table in self.slots.metalist: slot = self.slot_for_container(table, index) self.dirty_slots[slot] = table[index] def packets_for_dirty(self, dirty_slots): """ Generate update packets for dirty usually privided by another window (sic!) """ packets = "" for slot, item in dirty_slots.iteritems(): if item is None: packets += make_packet("window-slot", wid=self.wid, slot=slot, primary=-1) else: packets += make_packet("window-slot", wid=self.wid, slot=slot, primary=item.primary, secondary=item.secondary, count=item.quantity) return packets class ChestWindow(SharedWindow): @property def metalist(self): m = [self.slots.storage, self.inventory.storage, self.inventory.holdables] return m class LargeChestWindow(SharedWindow): def __init__(self, wid, inventory, chest1, chest2, coords): chests_storage = LargeChestStorage(chest1.storage, chest2.storage) SharedWindow.__init__(self, wid, inventory, chests_storage, coords) @property def metalist(self): m = [self.slots.storage, self.inventory.storage, self.inventory.holdables] return m class FurnaceWindow(SharedWindow): @property def metalist(self): m = [self.slots.crafting, self.slots.fuel, self.slots.crafted] m += [self.inventory.storage, self.inventory.holdables] return m
bravoserver/bravo
b8fb3453bbaaa1c647a4d4bb49124048b69a08be
beta/protocol: Remove infamous "Ignoring unlocated position" message.
diff --git a/bravo/beta/protocol.py b/bravo/beta/protocol.py index d0f3c86..a02f447 100644 --- a/bravo/beta/protocol.py +++ b/bravo/beta/protocol.py @@ -1,713 +1,716 @@ # vim: set fileencoding=utf8 : from itertools import product, chain import json from time import time from urlparse import urlunparse from twisted.internet import reactor from twisted.internet.defer import (DeferredList, inlineCallbacks, maybeDeferred, succeed) from twisted.internet.protocol import Protocol, connectionDone from twisted.internet.task import cooperate, deferLater, LoopingCall from twisted.internet.task import TaskDone, TaskFailed from twisted.protocols.policies import TimeoutMixin from twisted.python import log from twisted.web.client import getPage from bravo import version from bravo.beta.structures import BuildData, Settings from bravo.blocks import blocks, items from bravo.chunk import CHUNK_HEIGHT from bravo.entity import Sign from bravo.errors import BetaClientError, BuildError from bravo.ibravo import (IChatCommand, IPreBuildHook, IPostBuildHook, IWindowOpenHook, IWindowClickHook, IWindowCloseHook, IPreDigHook, IDigHook, ISignHook, IUseHook) from bravo.infini.factory import InfiniClientFactory from bravo.inventory.windows import InventoryWindow from bravo.location import Location, Orientation, Position from bravo.motd import get_motd from bravo.beta.packets import parse_packets, make_packet, make_error_packet from bravo.plugin import retrieve_plugins from bravo.policy.dig import dig_policies from bravo.utilities.coords import adjust_coords_for_face, split_coords from bravo.utilities.chat import complete, username_alternatives from bravo.utilities.maths import circling, clamp, sorted_by_distance from bravo.utilities.temporal import timestamp_from_clock # States of the protocol. (STATE_UNAUTHENTICATED, STATE_AUTHENTICATED, STATE_LOCATED) = range(3) SUPPORTED_PROTOCOL = 78 class BetaServerProtocol(object, Protocol, TimeoutMixin): """ The Minecraft Alpha/Beta server protocol. This class is mostly designed to be a skeleton for featureful clients. It tries hard to not step on the toes of potential subclasses. """ excess = "" packet = None state = STATE_UNAUTHENTICATED buf = "" parser = None handler = None player = None username = None settings = Settings() motd = "Bravo Generic Beta Server" _health = 20 _latency = 0 def __init__(self): self.chunks = dict() self.windows = {} self.wid = 1 self.location = Location() self.handlers = { 0x00: self.ping, 0x02: self.handshake, 0x03: self.chat, 0x07: self.use, 0x09: self.respawn, 0x0a: self.grounded, 0x0b: self.position, 0x0c: self.orientation, 0x0d: self.location_packet, 0x0e: self.digging, 0x0f: self.build, 0x10: self.equip, 0x12: self.animate, 0x13: self.action, 0x15: self.pickup, 0x65: self.wclose, 0x66: self.waction, 0x6a: self.wacknowledge, 0x6b: self.wcreative, 0x82: self.sign, 0xca: self.client_settings, 0xcb: self.complete, 0xcc: self.settings_packet, 0xfe: self.poll, 0xff: self.quit, } self._ping_loop = LoopingCall(self.update_ping) self.setTimeout(30) # Low-level packet handlers # Try not to hook these if possible, since they offer no convenient # abstractions or protections. def ping(self, container): """ Hook for ping packets. By default, this hook will examine the timestamps on incoming pings, and use them to estimate the current latency of the connected client. """ now = timestamp_from_clock(reactor) then = container.pid self.latency = now - then def handshake(self, container): """ Hook for handshake packets. Override this to customize how logins are handled. By default, this method will only confirm that the negotiated wire protocol is the correct version, copy data out of the packet and onto the protocol, and then run the ``authenticated`` callback. This method will call the ``pre_handshake`` method hook prior to logging in the client. """ self.username = container.username if container.protocol < SUPPORTED_PROTOCOL: # Kick old clients. self.error("This server doesn't support your ancient client.") return elif container.protocol > SUPPORTED_PROTOCOL: # Kick new clients. self.error("This server doesn't support your newfangled client.") return log.msg("Handshaking with client, protocol version %d" % container.protocol) if not self.pre_handshake(): log.msg("Pre-handshake hook failed; kicking client") self.error("You failed the pre-handshake hook.") return players = min(self.factory.limitConnections, 20) self.write_packet("login", eid=self.eid, leveltype="default", mode=self.factory.mode, dimension=self.factory.world.dimension, difficulty="peaceful", unused=0, maxplayers=players) self.authenticated() def pre_handshake(self): """ Whether this client should be logged in. """ return True def chat(self, container): """ Hook for chat packets. """ def use(self, container): """ Hook for use packets. """ def respawn(self, container): """ Hook for respawn packets. """ def grounded(self, container): """ Hook for grounded packets. """ self.location.grounded = bool(container.grounded) def position(self, container): """ Hook for position packets. """ + # Refuse to handle any new position information while we are + # relocating. Clients mess this up frequently, and it's fairly racy, + # so don't consider this to be exceptional. Just ignore this one + # packet and continue. if self.state != STATE_LOCATED: - log.msg("Ignoring unlocated position!") return self.grounded(container.grounded) old_position = self.location.pos position = Position.from_player(container.position.x, container.position.y, container.position.z) altered = False dx, dy, dz = old_position - position if any(abs(d) >= 64 for d in (dx, dy, dz)): # Whoa, slow down there, cowboy. You're moving too fast. We're # gonna ignore this position change completely, because it's # either bogus or ignoring a recent teleport. altered = True else: self.location.pos = position self.location.stance = container.position.stance # Santitize location. This handles safety boundaries, illegal stance, # etc. altered = self.location.clamp() or altered # If, for any reason, our opinion on where the client should be # located is different than theirs, force them to conform to our point # of view. if altered: log.msg("Not updating bogus position!") self.update_location() # If our position actually changed, fire the position change hook. if old_position != position: self.position_changed() def orientation(self, container): """ Hook for orientation packets. """ self.grounded(container.grounded) old_orientation = self.location.ori orientation = Orientation.from_degs(container.orientation.rotation, container.orientation.pitch) self.location.ori = orientation if old_orientation != orientation: self.orientation_changed() def location_packet(self, container): """ Hook for location packets. """ self.position(container) self.orientation(container) def digging(self, container): """ Hook for digging packets. """ def build(self, container): """ Hook for build packets. """ def equip(self, container): """ Hook for equip packets. """ def pickup(self, container): """ Hook for pickup packets. """ def animate(self, container): """ Hook for animate packets. """ def action(self, container): """ Hook for action packets. """ def wclose(self, container): """ Hook for wclose packets. """ def waction(self, container): """ Hook for waction packets. """ def wacknowledge(self, container): """ Hook for wacknowledge packets. """ def wcreative(self, container): """ Hook for creative inventory action packets. """ def sign(self, container): """ Hook for sign packets. """ def client_settings(self, container): """ Hook for interaction setting packets. """ self.settings.update_interaction(container) def complete(self, container): """ Hook for tab-completion packets. """ def settings_packet(self, container): """ Hook for presentation setting packets. """ self.settings.update_presentation(container) def poll(self, container): """ Hook for poll packets. By default, queries the parent factory for some data, and replays it in a specific format to the requester. The connection is then closed at both ends. This functionality is used by Beta 1.8 clients to poll servers for status. """ log.msg("Poll data: %r" % container.data) players = unicode(len(self.factory.protocols)) max_players = unicode(self.factory.limitConnections or 1000000) data = [ u"§1", unicode(SUPPORTED_PROTOCOL), u"Bravo %s" % version, self.motd, players, max_players, ] response = u"\u0000".join(data) self.error(response) def quit(self, container): """ Hook for quit packets. By default, merely logs the quit message and drops the connection. Even if the connection is not dropped, it will be lost anyway since the client will close the connection. It's better to explicitly let it go here than to have zombie protocols. """ log.msg("Client is quitting: %s" % container.message) self.transport.loseConnection() # Twisted-level data handlers and methods # Please don't override these needlessly, as they are pretty solid and # shouldn't need to be touched. def dataReceived(self, data): self.buf += data packets, self.buf = parse_packets(self.buf) if packets: self.resetTimeout() for header, payload in packets: if header in self.handlers: d = maybeDeferred(self.handlers[header], payload) @d.addErrback def eb(failure): log.err("Error while handling packet 0x%.2x" % header) log.err(failure) return None else: log.err("Didn't handle parseable packet 0x%.2x!" % header) log.err(payload) def connectionLost(self, reason=connectionDone): if self._ping_loop.running: self._ping_loop.stop() def timeoutConnection(self): self.error("Connection timed out") # State-change callbacks # Feel free to override these, but call them at some point. def authenticated(self): """ Called when the client has successfully authenticated with the server. """ self.state = STATE_AUTHENTICATED self._ping_loop.start(30) # Event callbacks # These are meant to be overriden. def orientation_changed(self): """ Called when the client moves. This callback is only for orientation, not position. """ pass def position_changed(self): """ Called when the client moves. This callback is only for position, not orientation. """ pass # Convenience methods for consolidating code and expressing intent. I # hear that these are occasionally useful. If a method in this section can # be used, then *PLEASE* use it; not using it is the same as open-coding # whatever you're doing, and only hurts in the long run. def write_packet(self, header, **payload): """ Send a packet to the client. """ self.transport.write(make_packet(header, **payload)) def update_ping(self): """ Send a keepalive to the client. """ timestamp = timestamp_from_clock(reactor) self.write_packet("ping", pid=timestamp) def update_location(self): """ Send this client's location to the client. Also let other clients know where this client is. """ # Don't bother trying to update things if the position's not yet # synchronized. We could end up jettisoning them into the void. if self.state != STATE_LOCATED: return x, y, z = self.location.pos yaw, pitch = self.location.ori.to_fracs() # Inform everybody of our new location. packet = make_packet("teleport", eid=self.player.eid, x=x, y=y, z=z, yaw=yaw, pitch=pitch) self.factory.broadcast_for_others(packet, self) # Inform ourselves of our new location. packet = self.location.save_to_packet() self.transport.write(packet) def ascend(self, count): """ Ascend to the next XZ-plane. ``count`` is the number of ascensions to perform, and may be zero in order to force this player to not be standing inside a block. :returns: bool of whether the ascension was successful This client must be located for this method to have any effect. """ if self.state != STATE_LOCATED: return False x, y, z = self.location.pos.to_block() bigx, smallx, bigz, smallz = split_coords(x, z) chunk = self.chunks[bigx, bigz] column = [chunk.get_block((smallx, i, smallz)) for i in range(CHUNK_HEIGHT)] # Special case: Ascend at most once, if the current spot isn't good. if count == 0: if (not column[y]) or column[y + 1] or column[y + 2]: # Yeah, we're gonna need to move. count += 1 else: # Nope, we're fine where we are. return True for i in xrange(y, 255): # Find the next spot above us which has a platform and two empty # blocks of air. if column[i] and (not column[i + 1]) and not column[i + 2]: count -= 1 if not count: break else: return False self.location.pos = self.location.pos._replace(y=i * 32) return True def error(self, message): """ Error out. This method sends ``message`` to the client as a descriptive error message, then closes the connection. """ log.msg("Error: %r" % message) self.transport.write(make_error_packet(message)) self.transport.loseConnection() def play_notes(self, notes): """ Play some music. Send a sequence of notes to the player. ``notes`` is a finite iterable of pairs of instruments and pitches. There is no way to time notes; if staggered playback is desired (and it usually is!), then ``play_notes()`` should be called repeatedly at the appropriate times. This method turns the block beneath the player into a note block, plays the requested notes through it, then turns it back into the original block, all without actually modifying the chunk. """ x, y, z = self.location.pos.to_block() if y: y -= 1 bigx, smallx, bigz, smallz = split_coords(x, z) if (bigx, bigz) not in self.chunks: return block = self.chunks[bigx, bigz].get_block((smallx, y, smallz)) meta = self.chunks[bigx, bigz].get_metadata((smallx, y, smallz)) self.write_packet("block", x=x, y=y, z=z, type=blocks["note-block"].slot, meta=0) for instrument, pitch in notes: self.write_packet("note", x=x, y=y, z=z, pitch=pitch, instrument=instrument) self.write_packet("block", x=x, y=y, z=z, type=block, meta=meta) def send_chat(self, message): """ Send a chat message back to the client. """ data = json.dumps({"text": message}) self.write_packet("chat", message=data) # Automatic properties. Assigning to them causes the client to be notified # of changes. @property def health(self): return self._health @health.setter def health(self, value): if not 0 <= value <= 20: raise BetaClientError("Invalid health value %d" % value) if self._health != value: self.write_packet("health", hp=value, fp=0, saturation=0) self._health = value @property def latency(self): return self._latency @latency.setter def latency(self, value): # Clamp the value to not exceed the boundaries of the packet. This is # necessary even though, in theory, a ping this high is bad news. value = clamp(value, 0, 65535) # Check to see if this is a new value, and if so, alert everybody. if self._latency != value: packet = make_packet("players", name=self.username, online=True, ping=value) self.factory.broadcast(packet) self._latency = value class KickedProtocol(BetaServerProtocol): """ A very simple Beta protocol that helps enforce IP bans, Max Connections, and Max Connections Per IP. This protocol disconnects people as soon as they connect, with a helpful message. """ def __init__(self, reason=None): BetaServerProtocol.__init__(self) if reason: self.reason = reason else: self.reason = ( "This server doesn't like you very much." " I don't like you very much either.") def connectionMade(self): self.error("%s" % self.reason) class BetaProxyProtocol(BetaServerProtocol): """ A ``BetaServerProtocol`` that proxies for an InfiniCraft client. """ gateway = "server.wiki.vg" def handshake(self, container): self.write_packet("handshake", username="-") def login(self, container): self.username = container.username self.write_packet("login", protocol=0, username="", seed=0, dimension="earth") url = urlunparse(("http", self.gateway, "/node/0/0/", None, None, None)) d = getPage(url) d.addCallback(self.start_proxy) def start_proxy(self, response): log.msg("Response: %s" % response) log.msg("Starting proxy...") address, port = response.split(":") self.add_node(address, int(port)) def add_node(self, address, port): """ Add a new node to this client. """ from twisted.internet.endpoints import TCP4ClientEndpoint log.msg("Adding node %s:%d" % (address, port)) endpoint = TCP4ClientEndpoint(reactor, address, port, 5) self.node_factory = InfiniClientFactory() d = endpoint.connect(self.node_factory) d.addCallback(self.node_connected) d.addErrback(self.node_connect_error) def node_connected(self, protocol): log.msg("Connected new node!") def node_connect_error(self, reason): log.err("Couldn't connect node!") log.err(reason) class BravoProtocol(BetaServerProtocol): """ A ``BetaServerProtocol`` suitable for serving MC worlds to clients. This protocol really does need to be hooked up with a ``BravoFactory`` or something very much like it. """ chunk_tasks = None time_loop = None eid = 0 last_dig = None def __init__(self, config, name): BetaServerProtocol.__init__(self) self.config = config self.config_name = "world %s" % name
bravoserver/bravo
48eb8507a131876590cc0e80981cd52368e384ac
Add PIL to requirements.txt, because web.py plugin needs it
diff --git a/requirements.txt b/requirements.txt index 650f7b1..a5049c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,7 @@ +PIL==1.1.7 +Twisted==13.2.0 +argparse==1.2.1 construct==2.0.6 -Twisted>=11.0 +distribute==0.6.34 +wsgiref==0.1.2 +zope.interface==4.1.0
bravoserver/bravo
777446ff2b5aa7a980ad1f4240f8b97ae7c7572a
Worlds at relative paths don't work.
diff --git a/bravo.ini.example b/bravo.ini.example index c69a10d..78dc72a 100644 --- a/bravo.ini.example +++ b/bravo.ini.example @@ -1,99 +1,97 @@ # Bravo sample configuration. [bravo] # Try to enable Ampoule. This can massively improve server responsiveness, but # it can cause crashes, misrendering, and other weird bugs. You have been # warned. # DO NOT ENABLE ON WIN32. IT CAN CAUSE SERVER LOCKUPS. #ampoule = yes ampoule = no # Try to use the fancy console. fancy_console = true [world example] # This is just an example world. World names come from the name of the # section; this section describes a world called "example". # The interfaces to listen on. All of the normal port rules apply; you probably # cannot use ports below 1024 without root permissions. # You may specify several interfaces by seperating them with a comma. #interfaces = tcp:25565, tcp:25566:interface=localhost interfaces = tcp:25565 # The limitConnections is the number of total connections you want allowed on # your server. Say you only want 30 players total, set limitConnections to 30. # If you do not want to limit the number of connections allowed leave at 0. # Negative numbers are ignored. #limitConnections = 30 limitConnections = 0 # limitPerIP is the number of connections you will allow from the same IP. # If you don't want multiple connections from the same IP on your world, set # it's value equal to 1. If you want to allow 3 people from the same IP to be # able to connect, set limitPerIP to 3. If you don't want to use this limit, # set it equal to 0. Negative numbers are ignored. #limitPerIP = 3 limitPerIP = 0 # The folder to use for storing the world. Make sure you have write # permissions to this folder. If it does not exist, it will be created. -# Relative paths are allowed but discouraged. -#url = file://relative/path/to/world url = file:///absolute/path/to/world # The gameplay mode for this server. Valid modes are "creative" and # "survival". mode = creative # Which seasons to enable for this world. # ~ winter: Spread snow over the world, and freeze bodies of water # ~ spring: Thaw everything seasons = winter, spring # Which serializer to use for saving worlds to disk. # ~ anvil: The Anvil NBT/MCR format serializer = anvil # This option enables a permanent cache of geometry, which persists regardless # of the number of clients connected to this world. It greatly speeds up login # at the cost of memory usage. This option will also cause the world to # generate geometry even when no clients are connected, to keep the cache # full. It is highly recommended to keep this cache enabled. The level of # caching done is dependent on the number used. 3 is the minimum required to # let clients login immediately with no glitches; 10 is the level of caching # done by Notchian servers. Anywhere between 3 and 10 is a good value. This # option does not increase overall RAM usage, just idle RAM usage! # # For the technically minded, the amount of additional RAM consumed by the # permanent cache is roughly (2s+1)^2 * c, where s is the size of the cache # according to this setting and c is the amount of RAM consumed by an # individual chunk, 80KiB or so. Thus, a few common settings and their RAM # usage: # ~ 3 -> 3 MiB # ~ 7 -> 17 MiB # ~ 8 -> 22 MiB # ~ 10 -> 34 MiB # ~ 20 -> 131 MiB perm_cache = 3 # Plugins. # Bravo's plugin architecture is quite complex; if you're not sure how to # manage this section, read the documentation first to get things like the # names of plugins. While some examples are given, it's very important to read # the documentation in order to get a good grasp of how to customize your # server. # Plugin packs. # Adding the "beta" plugin pack is probably what most people want to do. It # provides most of the useful functionality found in Beta. packs = beta # A numeric seed can be set to specify how the world should behave. If # omitted, the world will automatically generate one on the initial startup. # seed = 42 # The web service. Comment out to disable. [web] # Interfaces to listen on. interfaces = tcp:8080 diff --git a/bravo/plugins/serializers/beta.py b/bravo/plugins/serializers/beta.py index 01a229c..763e83e 100644 --- a/bravo/plugins/serializers/beta.py +++ b/bravo/plugins/serializers/beta.py @@ -1,567 +1,568 @@ from __future__ import division from array import array import os from StringIO import StringIO from urlparse import urlparse from twisted.python import log from twisted.python.filepath import FilePath from zope.interface import implements from bravo.beta.structures import Level, Slot from bravo.chunk import Chunk from bravo.entity import entities, tiles, Player from bravo.errors import SerializerReadException, SerializerWriteException from bravo.geometry.section import Section from bravo.ibravo import ISerializer from bravo.location import Location, Orientation, Position from bravo.nbt import NBTFile from bravo.nbt import TAG_Compound, TAG_List, TAG_Byte_Array, TAG_String from bravo.nbt import TAG_Double, TAG_Long, TAG_Short, TAG_Int, TAG_Byte from bravo.region import MissingChunk, Region from bravo.utilities.bits import unpack_nibbles, pack_nibbles from bravo.utilities.paths import name_for_anvil class Anvil(object): """ Minecraft Anvil world serializer. This serializer interacts with the modern Minecraft Anvil world format. """ implements(ISerializer) name = "anvil" def __init__(self): self._entity_loaders = { "Chicken": lambda entity, tag: None, "Cow": lambda entity, tag: None, "Creeper": lambda entity, tag: None, "Ghast": lambda entity, tag: None, "GiantZombie": lambda entity, tag: None, "Item": self._load_item_from_tag, "Painting": self._load_painting_from_tag, "Pig": self._load_pig_from_tag, "PigZombie": lambda entity, tag: None, "Sheep": self._load_sheep_from_tag, "Skeleton": lambda entity, tag: None, "Slime": self._load_slime_from_tag, "Spider": lambda entity, tag: None, "Squid": lambda entity, tag: None, "Wolf": self._load_wolf_from_tag, "Zombie": lambda entity, tag: None, } self._entity_savers = { "Chicken": lambda entity, tag: None, "Cow": lambda entity, tag: None, "Creeper": lambda entity, tag: None, "Ghast": lambda entity, tag: None, "GiantZombie": lambda entity, tag: None, "Item": self._save_item_to_tag, "Painting": self._save_painting_to_tag, "Pig": self._save_pig_to_tag, "PigZombie": lambda entity, tag: None, "Sheep": self._save_sheep_to_tag, "Skeleton": lambda entity, tag: None, "Slime": self._save_slime_to_tag, "Spider": lambda entity, tag: None, "Squid": lambda entity, tag: None, "Wolf": self._save_wolf_to_tag, "Zombie": lambda entity, tag: None, } self._tile_loaders = { "Chest": self._load_chest_from_tag, "Furnace": self._load_furnace_from_tag, "MobSpawner": self._load_mobspawner_from_tag, "Music": self._load_music_from_tag, "Sign": self._load_sign_from_tag, } self._tile_savers = { "Chest": self._save_chest_to_tag, "Furnace": self._save_furnace_to_tag, "MobSpawner": self._save_mobspawner_to_tag, "Music": self._save_music_to_tag, "Sign": self._save_sign_to_tag, } # Disk I/O helpers. Highly useful for keeping these few lines in one # place. def _read_tag(self, fp): if fp.exists() and fp.getsize(): return NBTFile(fileobj=fp.open("r")) return None def _write_tag(self, fp, tag): tag.write_file(fileobj=fp.open("w")) # Entity serializers. def _load_entity_from_tag(self, tag): position = tag["Pos"].tags rotation = tag["Rotation"].tags location = Location() location.pos = Position(position[0].value, position[1].value, position[2].value) location.ori = Orientation.from_degs(rotation[0].value, rotation[1].value) location.grounded = bool(tag["OnGround"]) entity = entities[tag["id"].value](location=location) self._entity_loaders[entity.name](entity, tag) return entity def _save_entity_to_tag(self, entity): tag = NBTFile() tag.name = "" tag["id"] = TAG_String(entity.name) position = entity.location.pos tag["Pos"] = TAG_List(type=TAG_Double) tag["Pos"].tags = [TAG_Double(i) for i in position] rotation = entity.location.ori.to_degs() tag["Rotation"] = TAG_List(type=TAG_Double) tag["Rotation"].tags = [TAG_Double(i) for i in rotation] tag["OnGround"] = TAG_Byte(int(entity.location.grounded)) self._entity_savers[entity.name](entity, tag) return tag def _load_item_from_tag(self, item, tag): item.item = tag["Item"]["id"].value, tag["Item"]["Damage"].value item.quantity = tag["Item"]["Count"].value def _save_item_to_tag(self, item, tag): tag["Item"] = TAG_Compound() tag["Item"]["id"] = TAG_Short(item.item[0]) tag["Item"]["Damage"] = TAG_Short(item.item[1]) tag["Item"]["Count"] = TAG_Short(item.quantity) def _load_painting_from_tag(self, painting, tag): painting.direction = tag["Dir"].value painting.motive = tag["Motive"].value # Overwrite position with absolute block coordinates of image's # center. Original position seems to be unused. painting.location.pos = Position(tag["TileX"].value, tag["TileY"].value, tag["TileZ"].value) def _save_painting_to_tag(self, painting, tag): tag["Dir"] = TAG_Byte(painting.direction) tag["Motive"] = TAG_String(painting.motive) # Both tile and position will be the center of the image. tag["TileX"] = TAG_Int(painting.location.pos.x) tag["TileY"] = TAG_Int(painting.location.pos.y) tag["TileZ"] = TAG_Int(painting.location.pos.z) def _load_pig_from_tag(self, pig, tag): pig.saddle = bool(tag["Saddle"].value) def _save_pig_to_tag(self, pig, tag): tag["Saddle"] = TAG_Byte(pig.saddle) def _load_sheep_from_tag(self, sheep, tag): sheep.sheared = bool(tag["Sheared"].value) sheep.color = tag["Color"].value def _save_sheep_to_tag(self, sheep, tag): tag["Sheared"] = TAG_Byte(sheep.sheared) tag["Color"] = TAG_Byte(sheep.color) def _load_slime_from_tag(self, slime, tag): slime.size = tag["Size"].value def _save_slime_to_tag(self, slime, tag): tag["Size"] = TAG_Byte(slime.size) def _load_wolf_from_tag(self, wolf, tag): wolf.owner = tag["Owner"].value wolf.sitting = bool(tag["Sitting"].value) wolf.angry = bool(tag["Angry"].value) def _save_wolf_to_tag(self, wolf, tag): tag["Owner"] = TAG_String(wolf.owner) tag["Sitting"] = TAG_Byte(wolf.sitting) tag["Angry"] = TAG_Byte(wolf.angry) # Tile serializers. Tiles are blocks and entities at the same time, in the # worst way. Each of these helpers will be called during chunk serialize # and deserialize automatically; they never need to be called directly. def _load_tile_from_tag(self, tag): """ Load a tile from a tag. This method will gladly raise exceptions which must be handled by the caller. """ tile = tiles[tag["id"].value](tag["x"].value, tag["y"].value, tag["z"].value) self._tile_loaders[tile.name](tile, tag) return tile def _save_tile_to_tag(self, tile): tag = NBTFile() tag.name = "" tag["id"] = TAG_String(tile.name) tag["x"] = TAG_Int(tile.x) tag["y"] = TAG_Int(tile.y) tag["z"] = TAG_Int(tile.z) self._tile_savers[tile.name](tile, tag) return tag def _load_chest_from_tag(self, chest, tag): self._load_inventory_from_tag(chest.inventory, tag["Items"]) def _save_chest_to_tag(self, chest, tag): tag["Items"] = self._save_inventory_to_tag(chest.inventory) def _load_furnace_from_tag(self, furnace, tag): furnace.burntime = tag["BurnTime"].value furnace.cooktime = tag["CookTime"].value self._load_inventory_from_tag(furnace.inventory, tag["Items"]) def _save_furnace_to_tag(self, furnace, tag): tag["BurnTime"] = TAG_Short(furnace.burntime) tag["CookTime"] = TAG_Short(furnace.cooktime) tag["Items"] = self._save_inventory_to_tag(furnace.inventory) def _load_mobspawner_from_tag(self, ms, tag): ms.mob = tag["EntityId"].value ms.delay = tag["Delay"].value def _save_mobspawner_to_tag(self, ms, tag): tag["EntityId"] = TAG_String(ms.mob) tag["Delay"] = TAG_Short(ms.delay) def _load_music_from_tag(self, music, tag): music.note = tag["note"].value def _save_music_to_tag(self, music, tag): tag["Music"] = TAG_Byte(music.note) def _load_sign_from_tag(self, sign, tag): sign.text1 = tag["Text1"].value sign.text2 = tag["Text2"].value sign.text3 = tag["Text3"].value sign.text4 = tag["Text4"].value def _save_sign_to_tag(self, sign, tag): tag["Text1"] = TAG_String(sign.text1) tag["Text2"] = TAG_String(sign.text2) tag["Text3"] = TAG_String(sign.text3) tag["Text4"] = TAG_String(sign.text4) def _load_chunk_from_tag(self, chunk, tag): """ Load a chunk from a tag. We cannot instantiate chunks, ever, so pass it in from above. """ level = tag["Level"] # These fromstring() calls are designed to raise if there are any # issues, but still be speedy. # Loop through the sections and unpack anything that we find. for tag in level["Sections"].tags: index = tag["Y"].value section = Section() section.blocks = array("B") section.blocks.fromstring(tag["Blocks"].value) section.metadata = array("B", unpack_nibbles(tag["Data"].value)) section.skylight = array("B", unpack_nibbles(tag["SkyLight"].value)) chunk.sections[index] = section chunk.heightmap = array("B") chunk.heightmap.fromstring(level["HeightMap"].value) chunk.blocklight = array("B", unpack_nibbles(level["BlockLight"].value)) chunk.populated = bool(level["TerrainPopulated"]) if "Entities" in level: for tag in level["Entities"].tags: try: entity = self._load_entity_from_tag(tag) chunk.entities.add(entity) except KeyError: log.msg("Unknown entity %s" % tag["id"].value) log.msg("Tag for entity:") log.msg(tag.pretty_tree()) if "TileEntities" in level: for tag in level["TileEntities"].tags: try: tile = self._load_tile_from_tag(tag) chunk.tiles[tile.x, tile.y, tile.z] = tile except KeyError: log.msg("Unknown tile entity %s" % tag["id"].value) log.msg("Tag for tile:") log.msg(tag.pretty_tree()) chunk.dirty = not chunk.populated def _save_chunk_to_tag(self, chunk): tag = NBTFile() tag.name = "" level = TAG_Compound() tag["Level"] = level level["xPos"] = TAG_Int(chunk.x) level["zPos"] = TAG_Int(chunk.z) level["HeightMap"] = TAG_Byte_Array() level["BlockLight"] = TAG_Byte_Array() level["SkyLight"] = TAG_Byte_Array() level["Sections"] = TAG_List(type=TAG_Compound) for i, s in enumerate(chunk.sections): if s: section = TAG_Compound() section.name = "" section["Y"] = TAG_Byte(i) section["Blocks"] = TAG_Byte_Array() section["Blocks"].value = s.blocks.tostring() section["Data"] = TAG_Byte_Array() section["Data"].value = pack_nibbles(s.metadata) section["SkyLight"] = TAG_Byte_Array() section["SkyLight"].value = pack_nibbles(s.skylight) level["Sections"].tags.append(section) level["HeightMap"].value = chunk.heightmap.tostring() level["BlockLight"].value = pack_nibbles(chunk.blocklight) level["TerrainPopulated"] = TAG_Byte(chunk.populated) level["Entities"] = TAG_List(type=TAG_Compound) for entity in chunk.entities: try: entitytag = self._save_entity_to_tag(entity) level["Entities"].tags.append(entitytag) except KeyError: log.msg("Unknown entity %s" % entity.name) level["TileEntities"] = TAG_List(type=TAG_Compound) for tile in chunk.tiles.itervalues(): try: tiletag = self._save_tile_to_tag(tile) level["TileEntities"].tags.append(tiletag) except KeyError: log.msg("Unknown tile entity %s" % tile.name) return tag def _load_inventory_from_tag(self, inventory, tag): """ Load an inventory from a tag. Due to quirks of inventory, we cannot instantiate the inventory here; instead, act on an inventory passed in from above. """ items = [None] * len(inventory) for item in tag.tags: slot = item["Slot"].value items[slot] = Slot(item["id"].value, item["Damage"].value, item["Count"].value) inventory.load_from_list(items) def _save_inventory_to_tag(self, inventory): tag = TAG_List(type=TAG_Compound) for slot, item in enumerate(inventory.save_to_list()): if item is not None: d = TAG_Compound() id, damage, count = item d["id"] = TAG_Short(id) d["Damage"] = TAG_Short(damage) d["Count"] = TAG_Byte(count) d["Slot"] = TAG_Byte(slot) tag.tags.append(d) return tag def _save_level_to_tag(self, level): tag = NBTFile() tag.name = "" tag["Data"] = TAG_Compound() tag["Data"]["RandomSeed"] = TAG_Long(level.seed) tag["Data"]["SpawnX"] = TAG_Int(level.spawn[0]) tag["Data"]["SpawnY"] = TAG_Int(level.spawn[1]) tag["Data"]["SpawnZ"] = TAG_Int(level.spawn[2]) tag["Data"]["Time"] = TAG_Long(level.time) # Beta version and accounting. # Needed for Notchian tools to be able to comprehend this world. tag["Data"]["version"] = TAG_Int(19132) tag["Data"]["LevelName"] = TAG_String("Generated by Bravo :3") return tag # ISerializer API. def connect(self, url): + #TODO: Test this with relative paths. It fails silently. parsed = urlparse(url) if not parsed.scheme: raise Exception("I need to be handed a URL, not a path") if parsed.scheme != "file": raise Exception("I am not okay with scheme %s" % parsed.scheme) self.folder = FilePath(parsed.path) if not self.folder.exists(): log.msg("Creating new world in %s" % self.folder) try: self.folder.makedirs() self.folder.child("players").makedirs() self.folder.child("region").makedirs() except os.error: raise Exception("Could not create world in %s" % self.folder) def load_chunk(self, x, z): name = name_for_anvil(x, z) fp = self.folder.child("region").child(name) region = Region(fp) chunk = Chunk(x, z) try: data = region.get_chunk(x, z) tag = NBTFile(buffer=StringIO(data)) self._load_chunk_from_tag(chunk, tag) except MissingChunk: raise SerializerReadException("No chunk %r in region" % chunk) except Exception, e: raise SerializerReadException("%r couldn't be loaded: %s" % (chunk, e)) return chunk def save_chunk(self, chunk): tag = self._save_chunk_to_tag(chunk) b = StringIO() tag.write_file(buffer=b) data = b.getvalue() name = name_for_anvil(chunk.x, chunk.z) fp = self.folder.child("region").child(name) # Allocate the region and put the chunk into it. Use ensure() instead # of create() so that we don't trash the region. region = Region(fp) try: region.ensure() region.put_chunk(chunk.x, chunk.z, data) except IOError, e: raise SerializerWriteException("Couldn't write to region: %r" % e) def load_level(self): fp = self.folder.child("level.dat") if not fp.exists(): raise SerializerReadException("Level doesn't exist!") tag = self._read_tag(self.folder.child("level.dat")) if not tag: raise SerializerReadException("Level (in %s) is corrupt!" % fp.path) try: spawn = (tag["Data"]["SpawnX"].value, tag["Data"]["SpawnY"].value, tag["Data"]["SpawnZ"].value) seed = tag["Data"]["RandomSeed"].value time = tag["Data"]["Time"].value level = Level(seed, spawn, time) return level except KeyError, e: # Just raise. It's probably gonna be caught and ignored anyway. raise SerializerReadException("Level couldn't be loaded: %s" % e) def save_level(self, level): tag = self._save_level_to_tag(level) self._write_tag(self.folder.child("level.dat"), tag) def load_player(self, username): fp = self.folder.child("players").child("%s.dat" % username) if not fp.exists(): raise SerializerReadException("%r doesn't exist!" % username) tag = self._read_tag(fp) if not tag: raise SerializerReadException("%r (in %s) is corrupt!" % (username, fp.path)) try: player = Player(username=username) x, y, z = [i.value for i in tag["Pos"].tags] player.location.pos = Position(x, y, z) yaw = tag["Rotation"].tags[0].value pitch = tag["Rotation"].tags[1].value player.location.ori = Orientation.from_degs(yaw, pitch) if "Inventory" in tag: self._load_inventory_from_tag(player.inventory, tag["Inventory"]) except KeyError, e: raise SerializerReadException("%r couldn't be loaded: %s" % (player, e)) return player def save_player(self, player): tag = NBTFile() tag.name = "" tag["Pos"] = TAG_List(type=TAG_Double) tag["Pos"].tags = [TAG_Double(i) for i in player.location.pos] tag["Rotation"] = TAG_List(type=TAG_Double) tag["Rotation"].tags = [TAG_Double(i) for i in player.location.ori.to_degs()] tag["Inventory"] = self._save_inventory_to_tag(player.inventory) fp = self.folder.child("players").child("%s.dat" % player.username) self._write_tag(fp, tag) def get_plugin_data_path(self, name): return self.folder.child(name + '.dat') def load_plugin_data(self, name): path = self.get_plugin_data_path(name) if not path.exists(): return "" else: with path.open("rb") as f: return f.read() def save_plugin_data(self, name, value): path = self.get_plugin_data_path(name) path.setContent(value)