Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git
scripts/01.sikuli/01.py
header( "What is this application?" )
typer( "Well, this application is a text editor that supports interpolated definitions, ")
-typer( "a few different plain text formats, real-time preview, spell check ")
+typer( "a few different text formats, real-time preview, spell check ")
typer( "as you tipe" )
wait( 0.5 )
-recur( 3, typer, Key.BACKSPACE )
+recur( 3, backspace )
typer( "ype, and R statements." )
paragraph()
# Focus the definition editor.
click_create()
-recur( 4, typer, Key.TAB )
+recur( 4, tab )
wait( .5 )
# Set focus to the text editor.
-typer( Key.TAB )
+tab()
typer( "The left-hand pane contains a nested, folder-like structure of names " )
typer( "The definition names act as placeholders. Substituting placeholders with " )
typer( "their defined value is called *interpolation*. Let's see how it works." )
-wait( 3 )
+wait( 2 )
scripts/02.sikuli/02.py
# Open sample chapter.
# -----------------------------------------------------------------------------
-type( "o", Key.CTRL )
-wait( 1 )
+file_open()
type( Key.UP, Key.ALT )
wait( 1 )
# Open the corresponding definition file.
# -----------------------------------------------------------------------------
-type( "o", Key.CTRL )
-wait( 1 )
-down()
+file_open()
+recur( 2, down )
wait( 1 )
enter()
wait( 1 )
# -----------------------------------------------------------------------------
-# Start to edit the sample document.
+# Edit the sample document.
# -----------------------------------------------------------------------------
set_typing_speed( 80 )
wait( 4 )
recur( 13, type, Key.BACKSPACE, Key.CTRL )
-recur( 9, typer, Key.BACKSPACE )
+recur( 9, backspace )
set_typing_speed( 60 )
# Traverse the text field
-typer( Key.HOME )
+home()
recur( 16, type, Key.RIGHT, Key.CTRL )
esc()
edit_find_next()
typer( Key.RIGHT )
-recur( 2, typer, Key.DELETE )
+recur( 2, delete )
autoinsert()
typer( "'s" )
tab()
typer( "Organizing definitions is left to your ")
-typer( "Doub" )
+typer( "doub" )
wait( .25 )
autoinsert()
wait( 1 )
typer( " Good imagination." )
tab()
# Jump to "char" definition
-typer( Key.HOME )
+home()
# Jump to "char.a.primary.name" definition
# Reselect "super"
recur( 5, typer, Key.RIGHT )
-wait( 5 )
+wait( 2 )
+
+# Close the window, no save
+type( "w", Key.CTRL )
+wait( 0.5 )
+tab()
+wait( 0.5 )
+typer( Key.SPACE )
+wait( 1 )
scripts/03.sikuli/03.py
+# -----------------------------------------------------------------------------
+# Copyright 2020 White Magic Software, Ltd.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# -----------------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# This script introduces images and R.
+# -----------------------------------------------------------------------------
+import sys
+
+if not "../editor.sikuli" in sys.path:
+ sys.path.append( "../editor.sikuli" )
+
+from editor import *
+
+set_typing_speed( 80 )
+file_open()
+type( Key.UP, Key.ALT )
+wait( 0.5 )
+home()
+wait( 0.25 )
+enter()
+wait( 1 )
+end()
+wait( 0.25 )
+enter()
+wait( 1 )
+
+set_typing_speed( 200 )
+
+paragraph()
+header( "What text formats are supported?" )
+
+typer( "Scr" )
+autoinsert()
+typer( " supports Markdown, R Markdown, XML, and R XML; however, the software " )
+typer( "architecture enables it to easily add new formats. The following figure " )
+typer( "depicts the overall architecture: " )
+paragraph()
+typer( "![](../writing/images/architecture)" )
+paragraph()
+typer( "Most text editors read a single format and convert it to one other format. " )
+typer( "With a little more effort, text editors can support many input and output " )
+typer( "formats. Scr" )
+autoinsert()
+typer( " goes one step further by introducing interpolated definitions." )
+paragraph()
+typer( "Kitten interlude:" )
+paragraph()
+typer( "![](https://i.imgur.com/jboueQH.jpg)" )
+paragraph()
+
+header( "What is R?" )
+typer( "R is a programming language. You might have noticed a few potential grammar " )
+typer( "problems with direct substitution. Rules for possessive forms, numbers, and " )
+typer( "other linguistic exceptions can be addressed using R. Let's take a look!" )
scripts/04.sikuli/04.py
+# -----------------------------------------------------------------------------
+# Copyright 2020 White Magic Software, Ltd.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# -----------------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# This script demonstrates using R.
+# -----------------------------------------------------------------------------
+import sys
+
+if not "../editor.sikuli" in sys.path:
+ sys.path.append( "../editor.sikuli" )
+
+from editor import *
+
+# -----------------------------------------------------------------------------
+# Open the demo text.
+# -----------------------------------------------------------------------------
+file_open()
+type( Key.UP, Key.ALT )
+wait( 0.5 )
+end()
+wait( 0.25 )
+enter()
+wait( 0.5 )
+down()
+wait( 0.25 )
+enter()
+wait( 1 )
+
+# -----------------------------------------------------------------------------
+# Demo bootstrapping
+# -----------------------------------------------------------------------------
+
+# Jump to the end.
+type( Key.END, Key.CTRL )
+paragraph()
+
+type( "s", Key.CTRL + Key.ALT )
+wait( 0.25 )
+
+
+# -----------------------------------------------------------------------------
+# Demo pluralization
+# -----------------------------------------------------------------------------
+
+
+# -----------------------------------------------------------------------------
+# Demo possessives (it, she, he, Ross)
+# -----------------------------------------------------------------------------
+
+
+# -----------------------------------------------------------------------------
+# Demo conversion, including ordinal numbers
+# -----------------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# Demo Chicago Manual of Style
+# -----------------------------------------------------------------------------
+
+
+# -----------------------------------------------------------------------------
+# Demo CSV file import
+# -----------------------------------------------------------------------------
+
+
scripts/editor.sikuli/editor.py
# -----------------------------------------------------------------------------
+# Types the HOME key.
+# -----------------------------------------------------------------------------
+def home():
+ typer( Key.HOME )
+
+# -----------------------------------------------------------------------------
+# Types the END key.
+# -----------------------------------------------------------------------------
+def end():
+ typer( Key.END )
+
+# -----------------------------------------------------------------------------
+# Types the BACKSPACE key.
+# -----------------------------------------------------------------------------
+def backspace():
+ typer( Key.BACKSPACE )
+
+# -----------------------------------------------------------------------------
# Types the INSERT key, often to insert a new definition.
# -----------------------------------------------------------------------------
typer( Key.F3 )
wait( .5 )
+
+# -----------------------------------------------------------------------------
+# Opens a dialog for selecting a file.
+# -----------------------------------------------------------------------------
+def file_open():
+ type( "o", Key.CTRL )
+ wait( 1 )

Add more demo scripts

Author DaveJarvis <email>
Date 2020-07-12 14:25:42 GMT-0700
Commit 21abe64b50e29f47dbdef0850c86f170ea525c82
Parent 888e00d
Delta 206 lines added, 17 lines removed, 189-line increase