|
@@ -14,6 +14,8 @@ import ast
|
14
|
14
|
import random
|
15
|
15
|
from pathlib import Path
|
16
|
16
|
import socket
|
|
17
|
+import git
|
|
18
|
+
|
17
|
19
|
#====================================
|
18
|
20
|
|
19
|
21
|
State = type("State", (object,), {})
|
|
@@ -591,6 +593,8 @@ def util_command(self, o, command):
|
591
|
593
|
self.FSM.ToTransition('toSelTheme')
|
592
|
594
|
elif command == "Reboot":
|
593
|
595
|
self.FSM.ToTransition('toReboot')
|
|
596
|
+ elif command == "Update":
|
|
597
|
+ self.FSM.ToTransition('toUpdate')
|
594
|
598
|
#os.system("sudo reboot")
|
595
|
599
|
elif command == "Shutdown":
|
596
|
600
|
self.FSM.ToTransition('toShutdown')
|
|
@@ -2861,3 +2865,61 @@ class Defender(State):
|
2861
|
2865
|
self.FSM.owner.pub.unregister("beat", self)
|
2862
|
2866
|
|
2863
|
2867
|
#====================================
|
|
2868
|
+#====================================
|
|
2869
|
+
|
|
2870
|
+
|
|
2871
|
+
|
|
2872
|
+class Update(State):
|
|
2873
|
+ def __init__(self,FSM):
|
|
2874
|
+ super(Update, self).__init__(FSM)
|
|
2875
|
+
|
|
2876
|
+ def Enter(self):
|
|
2877
|
+
|
|
2878
|
+ o = self.FSM.owner
|
|
2879
|
+ o.header_text = "Update"
|
|
2880
|
+ o.pub.register("beat", self)
|
|
2881
|
+ g = git.cmd.Git("/home/pi/zpc_ct/")
|
|
2882
|
+ self.msg = g.pull()
|
|
2883
|
+ if o.keyState[16] > 0 or o.keyState[17] > 0:
|
|
2884
|
+ pass
|
|
2885
|
+ else:
|
|
2886
|
+ draw_header(o)
|
|
2887
|
+ o.update_display(0)
|
|
2888
|
+ super(Update, self).Enter()
|
|
2889
|
+
|
|
2890
|
+ def Execute(self):
|
|
2891
|
+ o = self.FSM.owner
|
|
2892
|
+ menu1_actions(self, o)
|
|
2893
|
+ if o.keyState[16] == 1:
|
|
2894
|
+ draw_menu1(o)
|
|
2895
|
+ o.update_display(0)
|
|
2896
|
+ elif o.keyState[16] == 4:
|
|
2897
|
+ draw_header(o)
|
|
2898
|
+ #self.draw_footer(o)
|
|
2899
|
+ self.draw_main(o)
|
|
2900
|
+ o.update_display(0)
|
|
2901
|
+
|
|
2902
|
+ if o.keyState[0] == 1 or o.keyState[0] == 3 or o.keyState[1] == 1 or o.keyState[1] == 3 or o.keyState[2] == 1 or o.keyState[2] == 3 or o.keyState[3] == 1 or o.keyState[3] == 3:
|
|
2903
|
+ draw_header(o)
|
|
2904
|
+ #self.draw_footer(o)
|
|
2905
|
+ self.draw_main(o)
|
|
2906
|
+ o.update_display(0)
|
|
2907
|
+
|
|
2908
|
+ if o.keyState[16] > 0 or o.keyState[17] > 0:
|
|
2909
|
+ pass
|
|
2910
|
+ else:
|
|
2911
|
+ pass
|
|
2912
|
+ #o.update_display(0)
|
|
2913
|
+
|
|
2914
|
+ def draw_main(self, o):
|
|
2915
|
+ #o.center_text(self.msg, o.h1, o.width, 25, o.light_grey)
|
|
2916
|
+ o.center_block(self.msg, o.h2, [0, 0, o.width, o.height], o.light_grey)
|
|
2917
|
+
|
|
2918
|
+ def ReceiveMessage(self, message):
|
|
2919
|
+ o = self.FSM.owner
|
|
2920
|
+ play_seq(o, message)
|
|
2921
|
+
|
|
2922
|
+ def Exit(self):
|
|
2923
|
+ self.FSM.owner.pub.unregister("beat", self)
|
|
2924
|
+
|
|
2925
|
+#====================================
|