Skip to content

Commit

Permalink
added test and command prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
privacyrespected committed Feb 9, 2022
1 parent 07f3770 commit d3040bc
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 12 deletions.
9 changes: 6 additions & 3 deletions UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ def checkcpu():
def checknetwork1():
checknetwork= psutil.sensors_battery().percent
checknetwork= str(checknetwork)
current_network="Battery: " + checknetwork + "%"
current_network="Energy: " + checknetwork + "%"
return current_network

@eel.expose
def checkcommand(commandinput):
print(commandinput)

#frontend functions
def alpha_frontend():
if sys.platform in ['win32', 'win64'] and int(platform.release())>=10:
eel.start("index.html", block=False, cmdline_args=['--start-fullscreen'],port=4000)
eel.start("index.html", cmdline_args=['--start-fullscreen'],port=4000)
else:
raise EnvironmentError("Error: system is not windows 10 or above")

#uncomment this line to purely debug this function
#alpha_frontend()
alpha_frontend()
24 changes: 15 additions & 9 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,23 @@
<div id="particle12" class="vline"></div>

<!-- #######################################################################################################################################################################################################################-->
<textarea id="note_input" rows="12" cols="44">Alpha-Alpaca Update
Update Patch Notes: (Alpha-V2.0):
1. Brand new UI!
2. New functions
3. Better Machine learning
4. Application restructuring
5. Added the text you are seeing right now.

Tips: You can edit this text for your notes!
<script>
const textarea = document.querySelector("#note_input")
textarea.onkeypress = (event) => {
// console.log (`${event.code} key pressed)
if ( keycode == 13) {
event.preventDefault()
let x = document.getElementById("note_input")
console.log(`${event.code} key pressed`)
console.log(x)
// only used for debugging the front end
}
}
</script>
<textarea id="note_input" rows="12" cols="44">

</textarea>

</div>


Expand Down
10 changes: 10 additions & 0 deletions web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ eel.checkcpu()(callback1)
function callback2(current_network){
document.getElementById("networkoutput").innerHTML=current_network
};

function checknetwork(){
eel.checknetwork1()(callback2)
};

function callbacl3(commandinput){
document.getElementById("commandinput").innerHTML=commandinput
};

function checkcommand(){
var commandinput=document.getElementById("note_input").value
eel.checkcommand(commandinput)
};
23 changes: 23 additions & 0 deletions web/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html class="focus-outline-visible">
<head>
<title>Test</title>
</head>
<body>
<textarea id="note_input" rows="12" cols="44"> </textarea>
<script>
const textarea = document.querySelector("#note_input")
textarea.onkeypress = (event) => {
const keyCode = event.keyCode
// console.log(`${event.code} key pressed`)
if (keyCode == 13) {
event.preventDefault()
let x = document.getElementById("note_input").value
console.log(`${event.code} key pressed`)
console.log(x)
alert(x)
}
}
</script>
</body>
</html>

0 comments on commit d3040bc

Please sign in to comment.