Skip to content

Commit

Permalink
HOTKEYS WORKS
Browse files Browse the repository at this point in the history
  • Loading branch information
joey-kilgore committed Sep 29, 2019
1 parent 883b52d commit 5901491
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 260 deletions.
125 changes: 0 additions & 125 deletions Extensions/SecuritySystem.py

This file was deleted.

32 changes: 32 additions & 0 deletions Extensions/VSCodeEXT.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from sys import path

def install():
# Adds the extensions commands to the command file
import consts
print("Installing VSCodeEXT")
print(consts.COMMANDS_FILE)
commandsFile = open(consts.COMMANDS_FILE, "a")
commandsFile.write("vscode,VSCodeEXT\n")
commandsFile.close()
return

def init():
# A very useful function that does a lot of things!
return

def listen(command):
# Takes and processes command from OLGA

# Adds olga's directory to be accessible
import os
olgaDir = os.getcwd().replace("Extensions"+os.sep, "")
path.append(olgaDir)
from olga import makeOOO

# Package output into an Olga Output Object
output = None
if(command=="vscode"):
output = makeOOO(text="Open Visual Studio Code")
import subprocess
subprocess.Popen("C:\\Users\\Joey\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe") # This opens up the calculator
return output
72 changes: 0 additions & 72 deletions Extensions/WeatherEXT.py

This file was deleted.

61 changes: 0 additions & 61 deletions Extensions/spotify.py

This file was deleted.

9 changes: 8 additions & 1 deletion Front-Ends/Keyboard-Front.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ def callWord():
output = olgaInstance.run("word")
processOutput(output)

def callVS():
global olgaInstance
output = olgaInstance.run("vscode")
processOutput(output)

# The key combination to check
combination_to_function = {
frozenset([Key.shift, KeyCode(char='a')]): callAdobe,
Expand All @@ -54,7 +59,9 @@ def callWord():
frozenset([Key.shift, KeyCode(char='p')]): callPower,
frozenset([Key.shift, KeyCode(char='P')]): callPower,
frozenset([Key.shift, KeyCode(char='w')]): callWord,
frozenset([Key.shift, KeyCode(char='W')]): callWord
frozenset([Key.shift, KeyCode(char='W')]): callWord,
frozenset([Key.shift, KeyCode(char='v')]): callVS,
frozenset([Key.shift, KeyCode(char='V')]): callVS
}

def on_press(key):
Expand Down
3 changes: 2 additions & 1 deletion olga.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ def __init__(self):

def run(self, command):
# Take command from user and check for a exact match in the commands dictionary
output = None
if command.split(" ")[0] in self.commands.keys():
extension = __import__(("Extensions."+self.commands[command.split(" ")[0]]).replace("\n",""),
globals(), locals(), ["listen"])
output = extension.listen(command)
else:
# There was no matching command in the commands dictionary
output = makeOOO(error="Command Unknwon")
return output
return output
9 changes: 9 additions & 0 deletions tmp/.commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
adobe,AdobeEXT
calculator,CalculatorEXT
excel,ExcelEXT
hello,HelloEXT
itunes,ITunesEXT
outlook,OutlookEXT
powerpoint,PowerpointEXT
vscode,VSCodeEXT
word,WordEXT

0 comments on commit 5901491

Please sign in to comment.