Added Download, Update, Remove App features for gui and cmdline apps
This commit is contained in:
parent
842bb5b7b2
commit
9504e44cc1
@ -45,8 +45,9 @@
|
|||||||
"name": "FloSharedSecret",
|
"name": "FloSharedSecret",
|
||||||
"icon": "Icon/SharedSecret.png",
|
"icon": "Icon/SharedSecret.png",
|
||||||
"type": "Gui",
|
"type": "Gui",
|
||||||
"location": "apps/FLO-Shared-Secret/",
|
"location": "apps/FLO-shared-secret/",
|
||||||
"exec": "./FLO_Secret"
|
"exec": "bin/FLO_Secret",
|
||||||
|
"github": "https://github.com/akhil2015/FLO-shared-secret.git"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "7",
|
"id": "7",
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 252 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 252 KiB |
47
main.py
47
main.py
@ -92,27 +92,48 @@ class FLOappStore:
|
|||||||
print(app["name"])
|
print(app["name"])
|
||||||
self.appWin = Toplevel()
|
self.appWin = Toplevel()
|
||||||
self.appWin.title(app["name"])
|
self.appWin.title(app["name"])
|
||||||
self.appWin.geometry("500x100")
|
#self.appWin.geometry("500x100")
|
||||||
self.appWin.resizable(0,0)
|
#self.appWin.resizable(0,0)
|
||||||
if(app["type"] == "Gui"):
|
if(app["type"] == "Gui" or app["type"] == "Cmdline"):
|
||||||
openButton = Button(self.appWin,text="Open App",command=lambda :self.openGuiApp(app))
|
if(os.path.isdir(app["location"]) and subprocess.Popen("git config --get remote.origin.url",cwd=app["location"],stdout=subprocess.PIPE,shell=True).communicate()[0].decode("utf-8").strip()==app["github"]):
|
||||||
updateButton = Button(self.appWin)
|
openButton = Button(self.appWin,text="Open App",command=lambda :self.openApp(app))
|
||||||
openButton.pack()
|
openButton.pack()
|
||||||
elif(app["type"] == "Cmdline"):
|
if(subprocess.Popen("git diff --raw",cwd=app["location"],stdout=subprocess.PIPE,shell=True).communicate()[0].decode("utf-8")!=""):
|
||||||
openButton = Button(self.appWin,text="Open Terminal",command=lambda :self.openCmdLineApp(app))
|
updateButton = Button(self.appWin,text="Update App",command=lambda :self.updateApp(app))
|
||||||
openButton.pack()
|
updateButton.pack()
|
||||||
|
removeButton = Button(self.appWin,text="Remove App",command=lambda :self.removeApp(app))
|
||||||
|
removeButton.pack()
|
||||||
|
else:
|
||||||
|
downloadButton = Button(self.appWin,text="Download App",command=lambda :self.downloadApp(app))
|
||||||
|
downloadButton.pack()
|
||||||
elif(app["type"] == "Webapp"):
|
elif(app["type"] == "Webapp"):
|
||||||
openButton = Button(self.appWin,text="Open Browser",command=lambda :self.openBrowserApp(app))
|
openButton = Button(self.appWin,text="Open Browser",command=lambda :self.openBrowserApp(app))
|
||||||
openButton.pack()
|
openButton.pack()
|
||||||
self.appWin.mainloop()
|
self.appWin.mainloop()
|
||||||
|
|
||||||
def openGuiApp(self,app):
|
def downloadApp(self,app):
|
||||||
self.appWin.destroy()
|
self.appWin.destroy()
|
||||||
subprocess.Popen(app["exec"], cwd=app["location"])
|
subprocess.Popen(['rm', '-rf', app['location']])
|
||||||
|
subprocess.Popen("gnome-terminal -- git clone %s"%(app["github"]),cwd="apps/",shell=True)
|
||||||
|
messagebox.showinfo(app['name'], f"Downloading {app['name']}...\n Please Wait until the downloader closes")
|
||||||
|
|
||||||
def openCmdLineApp(self,app):
|
def removeApp(self,app):
|
||||||
self.appWin.destroy()
|
self.appWin.destroy()
|
||||||
subprocess.Popen(["gnome-terminal --command %s" % (app["exec"])],cwd=app["location"],stdout=subprocess.PIPE,shell=True)
|
subprocess.Popen(['rm', '-rf', app['location']])
|
||||||
|
messagebox.showinfo(app['name'], f"Removed {app['name']}...")
|
||||||
|
|
||||||
|
def updateApp(self,app):
|
||||||
|
self.appWin.destroy()
|
||||||
|
subprocess.Popen("gnome-terminal -- git fetch --all",cwd=app['location'],shell=True)
|
||||||
|
subprocess.Popen("gnome-terminal -- git reset --hard HEAD ",cwd=app['location'],shell=True)
|
||||||
|
messagebox.showinfo(app['name'], f"Updating {app['name']}...\n Please Wait until the updater closes")
|
||||||
|
|
||||||
|
def openApp(self,app):
|
||||||
|
self.appWin.destroy()
|
||||||
|
if(app["type"] == "Gui"):
|
||||||
|
subprocess.Popen(app["exec"], cwd=app["location"])
|
||||||
|
elif(app["type"] == "Cmdline"):
|
||||||
|
subprocess.Popen(["gnome-terminal --command",app["exec"]],cwd=app["location"],stdout=subprocess.PIPE,shell=True)
|
||||||
|
|
||||||
def openBrowserApp(self,app):
|
def openBrowserApp(self,app):
|
||||||
self.appWin.destroy()
|
self.appWin.destroy()
|
||||||
|
|||||||
12
test.py
12
test.py
@ -4,8 +4,10 @@ import subprocess
|
|||||||
import os
|
import os
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import json
|
import json
|
||||||
|
app={}
|
||||||
|
app["location"] = 'apps/FLO-shared-secret/'
|
||||||
i=[]
|
app["github"] = "https://github.com/akhil2015/FLO-shared-secret.git"
|
||||||
i = i+[1]
|
print(os.path.isdir(app["location"]))
|
||||||
print(i)
|
#print(os.path.isdir(app["location"]) and subprocess.Popen("git config --get remote.origin.url",cwd=app["location"],stdout=subprocess.PIPE,shell=True).communicate()[0].decode("utf-8")==app["github"])
|
||||||
|
#print(subprocess.Popen("git diff --raw",cwd=app["location"],stdout=subprocess.PIPE,shell=True).communicate()[0]=="")
|
||||||
|
subprocess.Popen(['rm', '-rf', app['location']])
|
||||||
Loading…
Reference in New Issue
Block a user