def as_alfred_xml(self, include_projects=False, additional_arg=None): al = AlfredItemsList() for item in self.items: al_item = item.as_alfred_xml(include_projects, additional_arg) if al_item: # item returns None if it shouldn't be displayed in alfred al += al_item return al
def alfred_xml(query): symbols_list = filter_symbols(query) al = AlfredItemsList() for hex_string, symbol, description, idx in symbols_list: al.append(arg=idx, title=' ' + symbol, subtitle=description, uid='utf_symbols' + str(idx)) return al
def as_alfred_xml(self, include_projects=False, additional_arg=None): al = AlfredItemsList() if self.type != 'project' or include_projects: al.append( arg=str(self.title._id) + \ ((';' + additional_arg) if additional_arg else ''), # _id never has `;` in it so it's safe encoding title=self.title.text, subtitle=self.parents_to_str(), icon='done' if self.is_done() else self.type ) if self.sub_tasks: al += self.sub_tasks.as_alfred_xml(include_projects, additional_arg) return al
def to_alfred_xml(query): items = None with open(full_path, 'r') as f: text = f.read() if text: items = set(text.split('\t')) if not items: return # alfred will display "Please wait" subtext al = AlfredItemsList() # add selected files for item in items: if query.lower() in item.lower(): al.append( arg=item, title='/'.join(item.split('/')[-2:]), subtitle='', icon='remove'.format(item)) return al