Skip to content

Commit

Permalink
Added installing python requirements automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Diogo Lopes committed May 31, 2022
1 parent a5cb27e commit 1f67378
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 7 deletions.
85 changes: 80 additions & 5 deletions dist/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,26 @@ select {
background-color: currentColor;
}

.absolute {
position: absolute;
}

.relative {
position: relative;
}

.top-2\/4 {
top: 50%;
}

.left-2\/4 {
left: 50%;
}

.right-2\/4 {
right: 50%;
}

.ml-2 {
margin-left: 0.5rem;
}
Expand All @@ -781,10 +801,34 @@ select {
margin-top: 0.5rem;
}

.mb-\[5px\] {
margin-bottom: 5px;
}

.mt-\[-68px\] {
margin-top: -68px;
}

.ml-\[-68px\] {
margin-left: -68px;
}

.mr-\[50px\] {
margin-right: 50px;
}

.mr-16 {
margin-right: 4rem;
}

.flex {
display: flex;
}

.hidden {
display: none;
}

.h-8 {
height: 2rem;
}
Expand All @@ -793,6 +837,10 @@ select {
height: 6rem;
}

.h-full {
height: 100%;
}

.w-full {
width: 100%;
}
Expand Down Expand Up @@ -856,11 +904,6 @@ select {
background-color: rgb(39 39 42 / var(--tw-bg-opacity));
}

.bg-zinc-700 {
--tw-bg-opacity: 1;
background-color: rgb(63 63 70 / var(--tw-bg-opacity));
}

.p-2 {
padding: 0.5rem;
}
Expand Down Expand Up @@ -997,4 +1040,36 @@ textarea:focus{

select:focus > option:checked {
background: #000 !important;
}

#loader {
border: 16px solid #f3f3f3;
/* Light grey */
border-top: 16px solid #3498db;
/* Blue */
border-radius: 50%;
width: 120px;
height: 120px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}

@-webkit-keyframes spin {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}

@keyframes spin {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}
14 changes: 14 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,18 @@ textarea:focus{

select:focus > option:checked {
background: #000 !important;
}

#loader {
border: 16px solid #f3f3f3; /* Light grey */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
}

@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
8 changes: 7 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
</head>

<body class="w-full bg-zinc-900">
<div class="flex">
<div id="loaderPage" class="absolute top-2/4 left-2/4 mt-[-68px] ml-[-68px]">
<div id="loader" class=""></div>
<p id="loaderText" class="absolute">
Installing python requirements...
</p>
</div>
<div id="Page" class="hidden">
<div class="grow">
<label for="">Emulator</label>
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const createWindow = () => {
title: 'Bookmark Bot'

});
mainWindow.setMenu(null)
//mainWindow.setMenu(null)
mainWindow.loadFile(path.join(__dirname, 'index.html'));

};
Expand Down
24 changes: 24 additions & 0 deletions src/js/bookmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ $(document).ready(function() {
$('#friendshipNumber').on('input',()=> {
updateBookmarkNumber('friendship','Bookmarks',5);
});

let optionsBot = {
mode: 'text',
pythonPath: 'py',
pythonOptions: ['-u'],
scriptPath: path.join(__dirname,"python"),
args: [path.join(__dirname,"python/")]
};



let reqs = PythonShell.run('installReq.py', optionsBot,function (err, results) {
if (err) throw err;
})

reqs.on('message', function (message) {
// received a message sent from the Python script (a simple "print" statement)
console.log(message)
});

reqs.on('close',(code) => {
$("#loaderPage").addClass('hidden')
$("#Page").toggleClass('hidden flex')
});
});

async function getWindows() {
Expand Down
5 changes: 5 additions & 0 deletions src/python/installReq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sys
import subprocess

# implement pip as a subprocess:
subprocess.check_call([sys.executable, '-m', 'pip', 'install','-r' ,sys.argv[1]+'requirements.txt'])

0 comments on commit 1f67378

Please sign in to comment.