This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' Shows a couple of ideas around coroutines for event handling. | |
''' | |
import asyncio | |
from asyncio import sleep, ensure_future, Future | |
import os | |
os.environ['KIVY_EVENTLOOP'] = 'async' | |
'''async needs to be set so that asyncio will be used for the event loop. ''' | |
from kivy.app import App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SOURCE="${BASH_SOURCE[0]}" | |
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | |
SOURCE="$(readlink "$SOURCE")" | |
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | |
done | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | |
echo $DIR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open template .blend | |
path = os.path.dirname(__file__) | |
template_path="/"+os.path.join(path,"blends",template+".blend") | |
if not os.path.exists(template_path): | |
print(prog_name + "could not find this template file: '%s'" % template_path) | |
sys.exit(1) | |
bpy.ops.wm.open_mainfile(filepath=template_path) | |
# Change text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parse arguments | |
arguments = sys.argv[sys.argv.index("--")+1:] | |
parser = argparse.ArgumentParser(description="Create captions") | |
parser.add_argument('--template') | |
parser.add_argument('--text') | |
parser.add_argument('--output') | |
args = parser.parse_args(arguments) | |
text = args.text | |
output = args.output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import argparse | |
try: | |
import bpy | |
except ImportError: | |
print("Module 'bpy' could not be imported. This probably means you are not using Blender to run this script.") | |
sys.exit(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import argparse | |
try: | |
import bpy | |
except ImportError: | |
print("Module 'bpy' could not be imported. This probably means you are not using Blender to run this script.") | |
sys.exit(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# <nbformat>3.0</nbformat> | |
# <codecell> | |
from numpy import * | |
from pandas import * | |
from scipy.signal import argrelextrema |