Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added imagesxxx/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions nbactions-release-profile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>test.single</actionName>
<packagings>
<packaging>*</packaging>
</packagings>
</action>
<action>
<actionName>test</actionName>
<packagings>
<packaging>*</packaging>
</packagings>
</action>
</actions>
29 changes: 21 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<artifactId>sikuli-slides-api</artifactId>
<name>Sikuli Slides API</name>
<url>http://lab.sikuli.org</url>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.2-cloud9</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -62,11 +62,6 @@
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>stringtemplate</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down Expand Up @@ -126,6 +121,22 @@
<version>1.6.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>ST4</artifactId>
<version>4.0.8</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>0.9</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv</artifactId>
<version>2.4.9-0.9</version>
<classifier>windows-x86_64</classifier>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -138,7 +149,8 @@
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7</version>
Expand All @@ -148,7 +160,8 @@
<buildDirectory>true</buildDirectory>
</systemPropertyVariables>
</configuration>
</plugin>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sikuli/recorder/html/HTMLGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void generate(File inputDir, File outputDir){
}

pageListST.addAggr("pages.{url,name}", pageUrl, pageName);

if (firstPageUrl == null){
firstPageUrl = pageUrl;
indexST.add("firstPageUrl", firstPageUrl);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sikuli/slides/api/SlideShowExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void execute(List<Slide> slides) throws SlideExecutionException {
logger.info("Executing {} slide(s)", slides.size());

this.slides = slides;
Interpreter interpreter = new DefaultInterpreter();
Interpreter interpreter = new DefaultInterpreter(context);
actions = Lists.newArrayList();
for (Slide slide : slides){
Action action = interpreter.interpret(slide);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sikuli/slides/api/Slides.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static public void execute(File file, Context context) throws SlideExecutionExce
*/
public static List<Action> interpret(File file) throws IOException {
checkNotNull(file);
Interpreter interpreter = new DefaultInterpreter();
Interpreter interpreter = new DefaultInterpreter(null);
SlidesReader reader = new PPTXSlidesReader();
List<Slide> slides;
slides = reader.read(file);
Expand Down
30 changes: 29 additions & 1 deletion src/main/java/org/sikuli/slides/api/actions/TypeAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,36 @@ String interpretAsKeyString(String name){
return Key.BACKSPACE;
}else if (name.equals("PAGEUP")){
return Key.PAGE_UP;
}else if (name.equals("PAGEDOAN")){
}else if (name.equals("PAGEDOWN")){
return Key.PAGE_DOWN;
}else if (name.equals("ALT")){
return Key.ALT;
}else if (name.equals("CTRL")){
return Key.CTRL;
}else if (name.equals("F1")){
return Key.F1;
}else if (name.equals("F2")){
return Key.F2;
}else if (name.equals("F3")){
return Key.F3;
}else if (name.equals("F4")){
return Key.F4;
}else if (name.equals("F5")){
return Key.F5;
}else if (name.equals("F6")){
return Key.F6;
}else if (name.equals("F7")){
return Key.F7;
}else if (name.equals("F8")){
return Key.F8;
}else if (name.equals("F9")){
return Key.F9;
}else if (name.equals("F10")){
return Key.F10;
}else if (name.equals("F11")){
return Key.F11;
}else if (name.equals("F12")){
return Key.F12;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@
public class DefaultInterpreter implements Interpreter {

static Logger logger = LoggerFactory.getLogger(DefaultInterpreter.class);
private final Context context; // The context created by the user for parsing / intepreting slides

public DefaultInterpreter(Context context){
this.context = context;
}

static class RegexActionInterpreter implements Interpreter {

RegexActionInterpreter(String regex){
Expand Down Expand Up @@ -127,17 +132,26 @@ protected Action interpret(Slide slide, SlideElement element, String[] arguments

static class BrowseActionInterpreter extends RegexActionInterpreter {

BrowseActionInterpreter(){
private final Context context;

BrowseActionInterpreter(Context context){
super("(?i)(browse|open)\\s+(.+)");
this.context = context;
}

@Override
protected Action interpret(Slide slide, SlideElement element, String[] arguments){
if (arguments.length != 2)
return null;

String urlString = arguments[1];
URL url = null;
// If there is a context, check to see if the URL entered is a context parameter or is plain text
String urlString;
if (context != null){
urlString = context.render(arguments[1]);
} else {
urlString = arguments[1];
}

URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
Expand Down Expand Up @@ -734,7 +748,7 @@ public Action interpret(Slide inputSlide){
new TargetActionInterpreter(),
new ExistActionInterpreter(),
new NotExistActionInterpreter(),
new BrowseActionInterpreter(),
new BrowseActionInterpreter(context),
new SleepActionInterpreter(),
new WaitActionInterpreter()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.sikuli.slides.api.models.SlideElement;

public interface Interpreter {
Action interpret(Slide slide);
Action interpret(Slide slide);
}

interface TargetInterpreter {
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/sikuli/slides/api/io/PPTXSlidesReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.slf4j.LoggerFactory;

import com.google.common.collect.Lists;
import java.net.URLDecoder;
import org.sikuli.slides.api.Context;

public class PPTXSlidesReader implements SlidesReader {

Expand Down Expand Up @@ -51,14 +53,16 @@ public List<Slide> read(URL url) throws IOException {
throw new IOException("Unable to download from " + url);
}
}else if (url.getProtocol().compareToIgnoreCase("file") == 0){
pptxFile = new File(url.getFile());
// Need to unencode the URL because otherwise spaces in the name will cause the file not to be found.
String filename = URLDecoder.decode(url.getFile(), "UTF-8");
pptxFile = new File(filename);
}else{
throw new IOException("Unable to deal with " + url);
}

return read(pptxFile);
}

public static File downloadFile(URL downloadURL){
logger.info("Download file from {} ... ", downloadURL);
File destination;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sikuli/slides/api/models/Slide.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void execute(Context context) throws ActionExecutionException {

List<Interpreter> interpreters = Lists.newArrayList(
new ConfigInterpreter(),
new DefaultInterpreter()
new DefaultInterpreter(context)
);

for (Interpreter interpreter : interpreters){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void browse_http(){
Slide slide = new Slide();
on(slide).insert().element().text("browse http://slides.sikuli.org");

Interpreter interpreter = new DefaultInterpreter.BrowseActionInterpreter();
Interpreter interpreter = new DefaultInterpreter.BrowseActionInterpreter(null);
Action action = interpreter.interpret(slide);

assertThat(action, instanceOf(BrowserAction.class));
Expand All @@ -63,7 +63,7 @@ public void open_http(){
Slide slide = new Slide();
on(slide).insert().element().text("open http://slides.sikuli.org");

Interpreter interpreter = new DefaultInterpreter.BrowseActionInterpreter();
Interpreter interpreter = new DefaultInterpreter.BrowseActionInterpreter(null);
Action action = interpreter.interpret(slide);

assertThat(action, instanceOf(BrowserAction.class));
Expand All @@ -75,7 +75,7 @@ public void browse(){
Slide slide = new Slide();
on(slide).insert().element().text("browse");

Interpreter interpreter = new DefaultInterpreter.BrowseActionInterpreter();
Interpreter interpreter = new DefaultInterpreter.BrowseActionInterpreter(null);
Action action = interpreter.interpret(slide);

assertThat(action, nullValue());
Expand All @@ -86,7 +86,7 @@ public void browse_garbage(){
Slide slide = new Slide();
on(slide).insert().element().text("browse garbage");

Interpreter interpreter = new DefaultInterpreter.BrowseActionInterpreter();
Interpreter interpreter = new DefaultInterpreter.BrowseActionInterpreter(null);
Action action = interpreter.interpret(slide);

assertThat(action, nullValue());
Expand Down