added open buttons
This commit is contained in:
parent
27b7c0648c
commit
842bb5b7b2
12
AppData.json
12
AppData.json
@ -6,7 +6,7 @@
|
|||||||
"icon": "Icon/Alexandria.png",
|
"icon": "Icon/Alexandria.png",
|
||||||
"type": "Webapp",
|
"type": "Webapp",
|
||||||
"location": "-",
|
"location": "-",
|
||||||
"exec": "https://alexandria.io/browser/"
|
"url": "https://alexandria.io/browser/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "2",
|
"id": "2",
|
||||||
@ -22,7 +22,7 @@
|
|||||||
"icon": "Icon/Caltech.png",
|
"icon": "Icon/Caltech.png",
|
||||||
"type": "Webapp",
|
"type": "Webapp",
|
||||||
"location": "-",
|
"location": "-",
|
||||||
"exec": "https://etdb.caltech.edu/browse"
|
"url": "https://etdb.caltech.edu/browse"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "4",
|
"id": "4",
|
||||||
@ -30,7 +30,7 @@
|
|||||||
"icon": "Icon/Flotorizer.png",
|
"icon": "Icon/Flotorizer.png",
|
||||||
"type": "Webapp",
|
"type": "Webapp",
|
||||||
"location": "-",
|
"location": "-",
|
||||||
"exec": "http://flotorizer.net/"
|
"url": "http://flotorizer.net/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "5",
|
"id": "5",
|
||||||
@ -38,7 +38,7 @@
|
|||||||
"icon": "Icon/Medici.png",
|
"icon": "Icon/Medici.png",
|
||||||
"type": "Webapp",
|
"type": "Webapp",
|
||||||
"location": "-",
|
"location": "-",
|
||||||
"exec": "https://www.mediciventures.com/"
|
"url": "https://www.mediciventures.com/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "6",
|
"id": "6",
|
||||||
@ -62,7 +62,7 @@
|
|||||||
"icon": "Icon/tZero.png",
|
"icon": "Icon/tZero.png",
|
||||||
"type": "Webapp",
|
"type": "Webapp",
|
||||||
"location": "-",
|
"location": "-",
|
||||||
"exec": "https://www.tzero.com/"
|
"url": "https://www.tzero.com/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "9",
|
"id": "9",
|
||||||
@ -70,7 +70,7 @@
|
|||||||
"icon": "Icon/WorldMood.png",
|
"icon": "Icon/WorldMood.png",
|
||||||
"type": "Webapp",
|
"type": "Webapp",
|
||||||
"location": "-",
|
"location": "-",
|
||||||
"exec": "http://worldmood.io/"
|
"url": "http://worldmood.io/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "10",
|
"id": "10",
|
||||||
|
|||||||
43
main.py
43
main.py
@ -13,7 +13,6 @@ class FLOappStore:
|
|||||||
self.root = root
|
self.root = root
|
||||||
self.maxRow=5
|
self.maxRow=5
|
||||||
self.maxCol=2
|
self.maxCol=2
|
||||||
self.flag=0
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.MainFrame = Frame(self.root)
|
self.MainFrame = Frame(self.root)
|
||||||
@ -24,26 +23,23 @@ class FLOappStore:
|
|||||||
self.searchBox.grid(row=2,column=1,sticky="E")
|
self.searchBox.grid(row=2,column=1,sticky="E")
|
||||||
self.searchButton=Button(self.MainFrame,text="Search",command = self.searchApps)
|
self.searchButton=Button(self.MainFrame,text="Search",command = self.searchApps)
|
||||||
self.searchButton.grid(row=2,column=2,sticky="W")
|
self.searchButton.grid(row=2,column=2,sticky="W")
|
||||||
self.clearSearch()
|
self.searchApps()
|
||||||
|
|
||||||
|
|
||||||
def clearSearch(self):
|
def clearSearch(self):
|
||||||
if self.flag==1:
|
|
||||||
self.clearSearchButton.destroy()
|
|
||||||
self.flag=0
|
|
||||||
self.searchBox.delete(0, 'end')
|
self.searchBox.delete(0, 'end')
|
||||||
self.searchApps()
|
self.searchApps()
|
||||||
|
|
||||||
def searchApps(self):
|
def searchApps(self):
|
||||||
|
try:
|
||||||
|
self.clearSearchButton.destroy()
|
||||||
|
except:
|
||||||
|
None
|
||||||
self.searchResult=[]
|
self.searchResult=[]
|
||||||
searchText=self.searchBox.get()
|
searchText=self.searchBox.get()
|
||||||
if(searchText != "" and self.flag == 0):
|
if(searchText != ""):
|
||||||
self.flag=1
|
|
||||||
self.clearSearchButton=Button(self.MainFrame,text="Clear Search",command = self.clearSearch)
|
self.clearSearchButton=Button(self.MainFrame,text="Clear Search",command = self.clearSearch)
|
||||||
self.clearSearchButton.grid(row=2,column=2,sticky="N")
|
self.clearSearchButton.grid(row=2,column=2,sticky="N")
|
||||||
if(searchText == "" and self.flag == 1):
|
|
||||||
self.flag=0
|
|
||||||
self.clearSearchButton.destroy()
|
|
||||||
for app in apps:
|
for app in apps:
|
||||||
if (searchText.lower() in app["name"].lower()):
|
if (searchText.lower() in app["name"].lower()):
|
||||||
self.searchResult = self.searchResult + [app]
|
self.searchResult = self.searchResult + [app]
|
||||||
@ -94,12 +90,33 @@ class FLOappStore:
|
|||||||
|
|
||||||
def execute(self,app):
|
def execute(self,app):
|
||||||
print(app["name"])
|
print(app["name"])
|
||||||
|
self.appWin = Toplevel()
|
||||||
|
self.appWin.title(app["name"])
|
||||||
|
self.appWin.geometry("500x100")
|
||||||
|
self.appWin.resizable(0,0)
|
||||||
if(app["type"] == "Gui"):
|
if(app["type"] == "Gui"):
|
||||||
subprocess.Popen(app["exec"], cwd=app["location"])
|
openButton = Button(self.appWin,text="Open App",command=lambda :self.openGuiApp(app))
|
||||||
|
updateButton = Button(self.appWin)
|
||||||
|
openButton.pack()
|
||||||
elif(app["type"] == "Cmdline"):
|
elif(app["type"] == "Cmdline"):
|
||||||
subprocess.Popen(["gnome-terminal --command %s" % (app["exec"])],cwd=app["location"],stdout=subprocess.PIPE,shell=True)
|
openButton = Button(self.appWin,text="Open Terminal",command=lambda :self.openCmdLineApp(app))
|
||||||
|
openButton.pack()
|
||||||
elif(app["type"] == "Webapp"):
|
elif(app["type"] == "Webapp"):
|
||||||
webbrowser.open(app["exec"],new=1)
|
openButton = Button(self.appWin,text="Open Browser",command=lambda :self.openBrowserApp(app))
|
||||||
|
openButton.pack()
|
||||||
|
self.appWin.mainloop()
|
||||||
|
|
||||||
|
def openGuiApp(self,app):
|
||||||
|
self.appWin.destroy()
|
||||||
|
subprocess.Popen(app["exec"], cwd=app["location"])
|
||||||
|
|
||||||
|
def openCmdLineApp(self,app):
|
||||||
|
self.appWin.destroy()
|
||||||
|
subprocess.Popen(["gnome-terminal --command %s" % (app["exec"])],cwd=app["location"],stdout=subprocess.PIPE,shell=True)
|
||||||
|
|
||||||
|
def openBrowserApp(self,app):
|
||||||
|
self.appWin.destroy()
|
||||||
|
webbrowser.open(app["url"],new=1)
|
||||||
|
|
||||||
with open('AppData.json',encoding='utf-8') as F:
|
with open('AppData.json',encoding='utf-8') as F:
|
||||||
apps=json.loads(F.read())["Dapps"]
|
apps=json.loads(F.read())["Dapps"]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user