This repository was archived by the owner on Apr 20, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuser_interface.py
More file actions
54 lines (44 loc) · 1.58 KB
/
user_interface.py
File metadata and controls
54 lines (44 loc) · 1.58 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from modules.cache.cache_manager import get_packages # Cache Manager
from modules.utility.script_runner import runScript # Script Runner
try:
import toga # GUI Library
from toga.style.pack import * # GUI Components
except ImportError:
pass
where_is_scripts = "scripts/"
def build(app):
def installHandle(widget):
packageToInstall = packageInput.value
resultInput.value = runScript(
where_is_scripts + packageToInstall + ".sh")
packages = get_packages(where_is_scripts, "test.sh",
"updateYapiScripts.sh")
box = toga.Box()
listBox = toga.Box()
listLabel = toga.Label('Packages Available: ')
packageBox = toga.Box()
packageLabel = toga.Label('Package To Install:')
packageInput = toga.TextInput()
submitBox = toga.Box()
install = toga.Button('Install Package', on_press=installHandle)
resultBox = toga.Box()
resultInput = toga.TextInput(readonly=True)
listBox.add(listLabel)
packageBox.add(packageLabel)
packageBox.add(packageInput)
submitBox.add(install)
resultBox.add(resultInput)
box.add(listBox)
box.add(packageBox)
box.add(submitBox)
box.add(resultBox)
box.style.update(direction=COLUMN, padding_top=10)
listBox.style.update(direction=ROW, padding=5)
packageBox.style.update(direction=ROW, padding=5)
submitBox.style.update(direction=ROW, padding=5)
return box
def start():
return toga.App('Yet Another Package Manager',
'org.YAPI.yapi', startup=build).main_loop()
def main():
start().main_loop()