diff --git a/.gitignore b/.gitignore index da9723e..9ae7abf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store .idea/ - +.venv +data.txt \ No newline at end of file diff --git a/RepoMenuItem.py b/RepoMenuItem.py index f0ae15c..58e5404 100644 --- a/RepoMenuItem.py +++ b/RepoMenuItem.py @@ -16,13 +16,16 @@ def __init__(self, link, text, is_sub=False): self.set_callback(self.goTolink) if not is_sub: data = GetData() - for i in data.getRepoContent(name=self.text.strip()): - newMenu = MenuItem(link=i.href, text=i.title, is_sub=True) - if i.type == "Directory": - newMenu.icon = "folder.png" - else: - newMenu.icon = "file.png" - self.add(newMenu) + repContent = data.getRepoContent(name=self.text.strip()) + if repContent != "error": + for i in repContent: + newMenu = MenuItem(link=i.href, text=i.title, is_sub=True) + if i.type == "Directory": + newMenu.icon = "folder.png" + else: + newMenu.icon = "file.png" + self.add(newMenu) + def goTolink(self, _): """Open menu Item link in browser.""" diff --git a/data.py b/data.py index 4bfb27d..1f8a184 100644 --- a/data.py +++ b/data.py @@ -12,6 +12,7 @@ class GetUserName(rumps.Window): """A dialog which contain a text input for getting username""" + def __init__(self): super().__init__("Your GitHub user name ", "Config") self.icon = "gitIco.png" @@ -19,6 +20,7 @@ def __init__(self): class GetData(): """Get data from Git""" + def __init__(self): # chech if there is data file or not if not self.isThereFile(): @@ -82,8 +84,7 @@ def getRepoContent(self, name): soup = soup.findAll("div", role="row", class_="Box-row--focus-gray") except: - rumps.alert("Network Error", "Check your network connection", ok=None, icon_path="gitIco.png") - return ["error"] + return "error" finally: list = [] for i in soup: diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..af7f8c4 --- /dev/null +++ b/data.txt @@ -0,0 +1 @@ +mazaheriMahdi \ No newline at end of file diff --git a/setup.py b/setup.py index b6a786e..7a1365f 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ app=APP, name="GitStray", data_files=DATA_FILES, - version="1.1 beta", + version="1.1 stable", author="mahdi mazaheri", author_email="mahdi83mazaheri@gmail.com", platforms=["OSX"],