forked from motatoes/preech
-
Notifications
You must be signed in to change notification settings - Fork 0
/
speech.py
36 lines (29 loc) · 793 Bytes
/
speech.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys
import sublime, sublime_plugin
from Config import Config
from Controller import Controller
from subprocess import PIPE, Popen,call
import os
class speechCommand(sublime_plugin.TextCommand):
ctrl = Controller()
def run(self,edit,toggle):
print toggle
#config = configig(self.view)
#config.run(edit)
self.edit = edit
if (toggle == "on"):
Controller.turnOn(self.view,edit,self)
else:
print self.ctrl
Controller.turnOff()
def insertText(self,offset,text):
print 'we got an action!' + text
#insert the text
self.edit = self.view.begin_edit()
pos = self.view.sel()
pos = pos[0].begin()
self.view.insert(self.edit, pos, text )
if (offset != 0):
self.view.sel().clear()
self.view.sel().add( pos + offset)
self.view.end_edit(self.edit)