diff --git a/FLO_appStore b/FLO_appStore index 2519f7a..bcce47d 100755 Binary files a/FLO_appStore and b/FLO_appStore differ diff --git a/README.md b/README.md index 771c598..8e8ffad 100755 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ This is a Tkinter(Python 3) based gui app,which lets users to download/install,u ## Requirements 1. Linux operating system(working on a cross platform version). +2. git (to install git): + sudo apt-get install git ## Usage 1. Clone/download this repository. (https://github.com/sairajzero/FLO-appStore/) diff --git a/main.py b/main.py index c1f26d5..15d144f 100755 --- a/main.py +++ b/main.py @@ -6,8 +6,17 @@ import os import webbrowser import json import math +import socket +def isConnected(): + try: + socket.create_connection(("www.github.com", 80)) + return True + except: + messagebox.showerror('FLOappStore', "Unable to Connect to GitHub!\nPlease check Internet connectivity and firewall!") + return False + class FLOappStore: def __init__(self, root): self.root = root @@ -90,6 +99,7 @@ class FLOappStore: def execute(self,app): print(app["name"]) + isConnected() self.appWin = Toplevel() self.appWin.title(app["name"]) #self.appWin.geometry("500x100") @@ -114,6 +124,8 @@ class FLOappStore: def downloadApp(self,app): self.appWin.destroy() subprocess.Popen(['rm', '-rf', app['location']]) + if(not isConnected()): + return 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") @@ -124,7 +136,9 @@ class FLOappStore: def updateApp(self,app): self.appWin.destroy() - subprocess.Popen("gnome-terminal -- git fetch --all",cwd=app['location'],shell=True) + if(not isConnected()): + return + subprocess.Popen("gnome-terminal -- git pull --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") @@ -139,6 +153,10 @@ class FLOappStore: self.appWin.destroy() webbrowser.open(app["url"],new=1) +if(isConnected()): + subprocess.call("git pull",shell=True) +else: + exit(0) with open('AppData.json',encoding='utf-8') as F: apps=json.loads(F.read())["Dapps"] root = Tk()