Skip to content

Commit 97cac37

Browse files
author
BuildTools
committed
Upload
1 parent 9e6a3fe commit 97cac37

File tree

9 files changed

+50
-8
lines changed

9 files changed

+50
-8
lines changed

.DS_Store

0 Bytes
Binary file not shown.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# PYTOHub
22

3-
PYTOHub is a program that can directly connect to your lego spike prime or mindstorms hub
3+
PYTOHub is a program that can directly connect to your lego spike prime or mindstorms hub
4+
5+
# How to download
6+
7+
![alt text](banner.png)

banner.png

2.44 MB
Loading

pytohub/__main__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
from .main import run
1+
from .main import run, download_program
22
import sys
33

44
if __name__ == "__main__":
55
program = sys.argv[0]
6-
sys.argv.pop()
7-
run(sys.argv)
6+
sys.argv.pop(0)
7+
if sys.argv[0] == '--download':
8+
download_program()
9+
else:
10+
run()
22 Bytes
Binary file not shown.
1.06 KB
Binary file not shown.
1.06 KB
Binary file not shown.

pytohub/main.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import subprocess
44
import requests
55
from .legohub import listallports, hubconnection
6-
from .menu import main_menu, second_menu
6+
from .menu import main_menu, second_menu, options_menu
77
from getkey import getkey, keys
88

99
conn = None
@@ -165,11 +165,19 @@ def start_main_menu():
165165
log.log("Your hub will restart because if you uploaded data to it changes directorys and glitches the hub")
166166
exit()
167167
elif out[1] == 1:
168-
out2 = second_menu()
168+
out2 = second_menu("Manage",options=["View mods","Delete mods"])
169169
else:
170170
pass
171171

172-
def run(args=None):
172+
173+
def download_program():
174+
clear()
175+
print(textcolors.BOLD+textcolors.HEADER+"PYToHub is made by @mas6y6 on github\n"+textcolors.END)
176+
time.sleep(3)
177+
print("Loading download menu")
178+
h = options_menu(menuname="Download selection",desc="Please pick the lego hub that you are currently using",options=[])
179+
180+
def run():
173181
global hub
174182
clear()
175183
print(textcolors.BOLD+textcolors.HEADER+"PYToHub is made by @mas6y6 on github\n"+textcolors.END)

pytohub/menu.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def main_menu():
5353
else:
5454
pass
5555

56-
def second_menu(menuname,options=[]):
56+
def second_menu(menuname: str,options=[]):
5757
sel = 0
5858
options.append("Back")
5959
while True:
@@ -67,6 +67,33 @@ def second_menu(menuname,options=[]):
6767
print(i)
6868
print("\nUse UP/DOWN arrows to navagate")
6969
key = getkey()
70+
if key == keys.DOWN:
71+
if not sel == len(options) - 1:
72+
sel += 1
73+
elif key == keys.UP:
74+
if not sel == 0:
75+
sel -= 1
76+
elif key == keys.ENTER:
77+
clear()
78+
return (options[sel],sel)
79+
else:
80+
pass
81+
82+
def options_menu(menuname: str,options=[],desc=None):
83+
sel = 0
84+
while True:
85+
clear()
86+
print(menuname)
87+
print()
88+
print(desc)
89+
print()
90+
for i in options:
91+
if i == options[sel]:
92+
print(textcolors.BACKGROUND+i+textcolors.END)
93+
else:
94+
print(i)
95+
print("\nUse UP/DOWN arrows to navagate")
96+
key = getkey()
7097
if key == keys.DOWN:
7198
if not sel == len(options) - 1:
7299
sel += 1

0 commit comments

Comments
 (0)