#coding: utf-8
import workflow
import editor
import clipboard
import datetime


entry_file = workflow.get_variable('entry_filename')
file_contents = editor.get_file_contents(entry_file)

if (file_contents):
    entry = file_contents
else:
    entry = 'empty'

daily_stats = workflow.get_variable('journal_stats')
print('daily_stats' + daily_stats)

editor.set_file_contents(filename, entry + '\n\n' + daily_stats)

workflow.set_variable('entry_text', content)
workflow.set_variable('entry_filename', filename)

clipboard.set(content)
workflow.set_output(content)
예제 #2
0
# https://forum.omz-software.com/topic/2353/encoding-images-in-base64

# coding: utf-8

import workflow
import clipboard
import photos
import base64

source_selection = workflow.get_variable('source')

if source_selection == 'photo':
    image_selection = photos.pick_image()
else:
    image_selection = clipboard.get_image()
    if not image_selection:
        console.alert('No Image', 'Clipboard does not contain an image')
        
w, h = image_selection.size

encoded = base64.b64encode(str(image_selection)

workflow.set_variable('encodedImage', str(encoded))
        
workflow.set_variable('origSize', str(w))
예제 #3
0
# |-----------------|--------:|
# | Title1          |     0.0 |
# | Title2          |     0.0 |
def create_md_table (headers, titles, stats):
    line_template = '| {:<14} | {:>5} |\n'
    header_line = line_template.format(*headers)
    entry_lines = map(lambda t: line_template.format(*t), zip(titles, stats))
    table_break = '|{0:-<16}|{0:->6}:|\n'.format('')
    return header_line + table_break + ''.join(entry_lines)

headers = ('Daily Stats', '')
titles = [
        'Medication',
        'Alcohol',
        'Caffeine',
        'Anxiety',
        'Energy',
        'Happiness',
        'Sleep Hours',
        'Sleep Quality',
        'Systolic',
        'Diastolic'
        # 'Word Count',
]

stats = get_stats(workflow.get_input())
# print process_stats(workflow.get_input())
workflow.set_variable('journal_entry_stats',create_md_table(headers, titles, stats))
workflow.set_variable('csv_entry', ", ".join(map(str,stats)))
###
예제 #4
0
    ).encode("utf-8")


t = todoflow.from_files(todoflow.lists.to_list())

query_today = "@working and not @done"
query_next = "@next and not @done and not @working"

html_parts = [
    print_due(t),
    print_dates(t),
    print_query(t, "Working", query_today, "working"),
    print_query(t, "Next", query_next, "next"),
    '<a class="reload-button" id="reload-button" href="editorial://?command=TF:%20Agenda">Reload</a>',
]

action_out = "\n".join(html_parts).decode("utf-8")

import workflow

workflow.set_output(action_out)

import editor

if editor.get_theme() == "Dark":
    css = workflow.get_variable("dark css")
else:
    css = workflow.get_variable("light css")

workflow.set_variable("css", css.decode("utf-8"))
예제 #5
0
import editor
import console
import os
import re
import sys
import codecs
import workflow
from StringIO import StringIO

# Set CSS theme
theme = editor.get_theme()
workflow.set_variable(
    'CSS',
    workflow.get_variable('CSS Dark' if theme == 'Dark' else 'CSS Light'))

# Set Variables
p = editor.get_path()
console.clear()
term = workflow.get_variable('Search Term')
pattern = re.compile(re.escape(term), flags=re.IGNORECASE)
term_array = term.split()
for i in range(len(term_array)):
    term_array[i] = re.escape(term_array[i])
from urllib import quote
dir = os.path.split(p)[0]
valid_extensions = set(
    ['.txt', '.md', '.markd', '.text', '.mdown', '.taskpaper'])
html = StringIO()
filename_match = 0
content_match = 0
match_count = 0
예제 #6
0
import editor
import console
import os
import re
import sys
import codecs
import workflow
from StringIO import StringIO

# Set CSS theme
theme = editor.get_theme()
workflow.set_variable('CSS', workflow.get_variable('CSS Dark' if theme == 'Dark' else 'CSS Light'))

# Set Variables
p = editor.get_path()
console.clear()
term = workflow.get_variable('Search Term')
pattern = re.compile(re.escape(term), flags=re.IGNORECASE)
term_array = term.split()
for i in range(len(term_array)):
		term_array[i] = re.escape(term_array[i])
from urllib import quote
dir = os.path.split(p)[0]
valid_extensions = set(['.txt', '.md', '.markd', '.text', '.mdown', '.taskpaper'])
html = StringIO()
filename_match = 0
content_match = 0
match_count = 0

# Iterate over fienames against search terms and output if match found