-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added executing python and terminal commands from config.ini
- Loading branch information
1 parent
5c822c4
commit 38e12f1
Showing
5 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[otwórz terminal] | ||
type = command_line | ||
command = gnome-terminal | ||
|
||
[zakończ] | ||
type = python | ||
command = window.close() |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
import configparser | ||
import re | ||
import subprocess | ||
|
||
from voice_operations import * | ||
|
||
class CommandProcessing(): | ||
def __init__(self): | ||
pass | ||
|
||
def loadConfig(self): | ||
config = configparser.ConfigParser() | ||
config.read("config.ini") | ||
self.config = config | ||
|
||
def processCommand(self, window): | ||
command = takeVoice(3, window) | ||
window.stateLabel.setText(command) | ||
command = command.lower() | ||
self.loadConfig() | ||
for i in self.config: | ||
if re.search(i, command): | ||
if self.config[i]["type"] == "command_line": | ||
subprocess.Popen(self.config[i]["command"]) | ||
if self.config[i]["type"] == "python": | ||
exec(self.config[i]["command"]) | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import configparser | ||
#Read config.ini file | ||
config_obj = configparser.ConfigParser() | ||
config_obj.read("config.ini") | ||
for i in config_obj: | ||
print(i) |
This file contains 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