wget working

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

62
main.py
View File

@ -4,7 +4,6 @@ from getKernelInfo import KernelVerList, KernelURL
import sys,os
# 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: Clean the code.
@ -17,9 +16,10 @@ class Window(QWidget):
self.center()
self.setIcon()
List.setList(self,25,20)
setList(self,25,20)
Button.setButton(self,"Install",400,540,self.installKernel)
Button.setButton(self,"Exit",490,540,self.exitApp)
aList.itemSelectionChanged.connect(selected)
def center(self):
qRect = self.frameGeometry()
@ -50,25 +50,7 @@ class Button(QPushButton):
button = QPushButton(name,self)
button.move(x,y)
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)
button.clicked.connect(function)
class InstallProcess(QWidget):
@ -76,20 +58,23 @@ class InstallProcess(QWidget):
QWidget.__init__(self, *args)
self.setWindowTitle("Kernel Installation")
self.setFixedSize(400,300)
self.setMinimumSize(400,300)
self.center()
def Installation():
DeList = List()
print(DeList.item)
output = os.popen("wget "+ URL + " -P ~/").read()
return output
Stream = Installation()
#!!! 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.
# Output into InstallProcess Windows -> QTextBrowser
"""
def letsgo():
output = os.popen("echo 'The Place where all the Terminal work is gonna be done.'").read()
return output
Stream = letsgo()
"""
# create objects
self.te = QTextBrowser()
@ -107,15 +92,36 @@ class InstallProcess(QWidget):
qRect.moveCenter(centerPoint)
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():
global App,window,DeList
global App,window
App = QApplication(sys.argv)
window = Window()
DeList = List()
window.show()
DeList.addItem()
App.exec_()
sys.exit(0)