Command history now also is implemented

This commit is contained in:
janis
2022-05-14 18:41:45 +02:00
parent 3fade3a2c9
commit dc2bd211e0
5 changed files with 60 additions and 1 deletions

View File

@@ -0,0 +1 @@
test,,test1,start,stop,stop,start
1 test test1 start stop stop start

View File

@@ -24,4 +24,7 @@ Command:
Button:
text: "back"
size_hint: 0.1, 0.1
pos_hint: {"x": 0.02, "y": 0.02}
pos_hint: {"x": 0.02, "y": 0.02}
on_release:
app.root.current = "HomeScreen"
root.manager.transition.direction = "right"

View File

@@ -0,0 +1,24 @@
import bin.com.csv_parsers
cvr = bin.com.csv_parsers.CsvRead()
cvw = bin.com.csv_parsers.CsvWrite()
class HistroyManager:
def __init__(self):
self.__history = []
self.__history_mod = []
def append_history(self, command, path):
try:
self.__history_mod = cvr.importing(path).pop(0)
except IndexError:
pass
if command != "":
self.__history_mod.insert(0, command)
cvw.write_str(path, self.__history_mod)
else:
pass
def get_history(self, path):
return cvr.importing(path)