def import_keyword(self, record): keyword = keyword_for_id(record.keywordID) if not eim.EIM.installed_on(keyword): eim.EIM(keyword).add() for sidebar_entry in ChandlerApplication.sidebar_entries: if sidebar_entry.collection is keyword: break else: sidebar_entry = SidebarEntry(collection=keyword) ChandlerApplication.sidebar_entries.add(sidebar_entry) hsv = self.record_rgb_to_hsv(record) if hsv: sidebar_entry.hsv_color = hsv
def import_collection(self, record): collection = eim.collection_for_name(record.uuid) if not isinstance(collection, Collection): raise TypeError("An Item was created instead of a Collection") for sidebar_entry in ChandlerApplication.sidebar_entries: if sidebar_entry.collection is collection: break else: sidebar_entry = SidebarEntry(collection=collection) ChandlerApplication.sidebar_entries.add(sidebar_entry) hsv = self.record_rgb_to_hsv(record) if hsv: sidebar_entry.hsv_color = hsv
def test_chex_export(self): """Export a simple Event and collection.""" collection = Collection(title="Fun") ChandlerApplication.sidebar_entries.add(SidebarEntry(collection=collection)) item = Item(title="OK") collection.add(item) Event(item).add(base_start=self.jan_ninth) uuids = [str_uuid_for(x) for x in (collection, item)] try: handle = file(self.tmp_path, 'wb') dump(handle, uuids) finally: handle.close() try: os.remove(self.tmp_path) except: pass