wget working

This commit is contained in:
YourSandwich 2021-05-02 02:40:52 +02:00
parent 59ba769685
commit 19324b1115

60
main.py
View File

@ -4,7 +4,6 @@ from getKernelInfo import KernelVerList, KernelURL
import sys,os import sys,os
# TODO: Fix the install Process function. # TODO: Fix the install Process function.
# TODO: Implement when ListItem selected and install pressed, to parse the array and download the right Kernel with wget or curl from the Archive
# TODO: Implement resizable Windows # TODO: Implement resizable Windows
# TODO: Clean the code. # TODO: Clean the code.
@ -17,9 +16,10 @@ class Window(QWidget):
self.center() self.center()
self.setIcon() self.setIcon()
List.setList(self,25,20) setList(self,25,20)
Button.setButton(self,"Install",400,540,self.installKernel) Button.setButton(self,"Install",400,540,self.installKernel)
Button.setButton(self,"Exit",490,540,self.exitApp) Button.setButton(self,"Exit",490,540,self.exitApp)
aList.itemSelectionChanged.connect(selected)
def center(self): def center(self):
qRect = self.frameGeometry() qRect = self.frameGeometry()
@ -52,44 +52,29 @@ class Button(QPushButton):
button.clicked.connect(function) button.clicked.connect(function)
## Making a List
class List(QListWidget):
def setList(self,x,y):
global aList
self.aList = QListWidget(self)
self.aList.resize(550,500)
self.aList.move(x,y)
aList = self.aList
## Taking the output from getKernelInfo and put it in the List
def addItem(self):
for i in KernelVerList:
self.item = QListWidgetItem(i, aList)
font = QFont()
font.setPixelSize(16)
self.item.setFont(font)
class InstallProcess(QWidget): class InstallProcess(QWidget):
def __init__(self, *args): def __init__(self, *args):
QWidget.__init__(self, *args) QWidget.__init__(self, *args)
self.setWindowTitle("Kernel Installation") self.setWindowTitle("Kernel Installation")
self.setFixedSize(400,300) self.setMinimumSize(400,300)
self.center() self.center()
def Installation(): def Installation():
DeList = List() output = os.popen("wget "+ URL + " -P ~/").read()
print(DeList.item) return output
Stream = Installation()
#!!! WARNING this function is wrong it waits for the Terminal to finish then it display the output. #!!! WARNING this function is wrong it waits for the Terminal to finish then it display the output.
#!!! If you put yes in it, the Program will freeze, there needs to be a better way to implement this. #!!! If you put yes in it, the Program will freeze, there needs to be a better way to implement this.
# Output into InstallProcess Windows -> QTextBrowser # Output into InstallProcess Windows -> QTextBrowser
"""
def letsgo(): def letsgo():
output = os.popen("echo 'The Place where all the Terminal work is gonna be done.'").read() output = os.popen("echo 'The Place where all the Terminal work is gonna be done.'").read()
return output return output
Stream = letsgo() Stream = letsgo()
"""
# create objects # create objects
self.te = QTextBrowser() self.te = QTextBrowser()
@ -107,15 +92,36 @@ class InstallProcess(QWidget):
qRect.moveCenter(centerPoint) qRect.moveCenter(centerPoint)
self.move(qRect.topLeft()) self.move(qRect.topLeft())
def setList(self,x,y):
global aList
aList = QListWidget(self)
aList.resize(550,500)
aList.move(x,y)
font = QFont()
font.setPixelSize(16)
aList.setFont(font)
for i in KernelVerList:
item = QListWidgetItem()
item.setText(str(i))
aList.addItem(item)
def selected():
global TheSelect, URL
TheSelect = str([item.text() for item in aList.selectedItems()])
TheSelect = TheSelect.strip("'['']'")
URL = [name for name in KernelURL if TheSelect in name]
URL = '+'.join(URL).strip("'['']'").split("+", 1)[0]
print(URL)
def main(): def main():
global App,window,DeList global App,window
App = QApplication(sys.argv) App = QApplication(sys.argv)
window = Window() window = Window()
DeList = List()
window.show() window.show()
DeList.addItem()
App.exec_() App.exec_()
sys.exit(0) sys.exit(0)