Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from calexandru2018/testing
Browse files Browse the repository at this point in the history
New layout; Improved Search
  • Loading branch information
Alexandru Cheltuitor authored Apr 25, 2020
2 parents 9a3c300 + c4670c5 commit f6f7e83
Show file tree
Hide file tree
Showing 21 changed files with 1,247 additions and 864 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Glade temp file
*.glade~

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
4 changes: 3 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pytest = "*"

[packages]
requests = "*"
requests-oauthlib = "*"
oauthlib = "*"
setuptools = "*"
selenium = "*"
pyqt5 = "*"
pycairo = "*"
pygobject = "*"
124 changes: 84 additions & 40 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,21 @@ The main goal with <b>Offstack</b> is to make sure that developpers have access
- python3.5+
- pip for python3 (pip3)
- setuptools for python3 (python3-setuptools)
- requests
- requests-oauthlib
- requests
- oauthlib
- selenium
- pyqt5
- <a href="https://github.com/mozilla/geckodriver/releases">geckodriver</a>


Install the following packages based on your distro:

| **Distro** | **Command** |
|:----------------------------------------|:--------------------------------------------------------------------------------------------------------- |
|Fedora/CentOS/RHEL | `sudo dnf install -y python3-pip python3-setuptools python3-pyqt5` |
|Ubuntu/Linux Mint/Debian and derivatives | `sudo apt install -y python3-pip python3-setuptools python3-pyqt5` |
|OpenSUSE/SLES | `sudo zypper in -y python3-pip python3-setuptools python3-pyqt5` |
|Arch Linux/Manjaro | `sudo pacman -S python-pip python-setuptools python-pyqt5` |
|Fedora/CentOS/RHEL | `sudo dnf install -y python3-gobject gtk3` |
|Ubuntu/Linux Mint/Debian and derivatives | `sudo apt install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0` |
|OpenSUSE/SLES | `sudo zypper install python3-gobject python3-gobject-Gdk typelib-1_0-Gtk-3_0 libgtk-3-0` |
|Arch Linux/Manjaro | `sudo pacman -S python-gobject gtk3` |


## Installing offstack
Expand All @@ -76,7 +75,7 @@ You can either install via <b>PIP</b> or by cloning the repository.

### To update to a new version

`sudo pip3 install offstack --upgrade`
`pip3 install offstack --upgrade`

## Manual Installation

Expand All @@ -90,7 +89,7 @@ You can either install via <b>PIP</b> or by cloning the repository.

3. Install

`sudo python3 setup.py install`
`python3 setup.py install`

### How to use

Expand All @@ -104,9 +103,9 @@ You can either install via <b>PIP</b> or by cloning the repository.
## GUI Layout

<p align="center">
<img src="https://i.imgur.com/hPYZw28.png" alt="Logo"></img>
</p>
<img src="https://i.imgur.com/P2D5mKE.png" alt="Advanced Settings"></img>
</p>

<p align="center">
<img src="https://i.imgur.com/nzWsIwn.png" alt="Logo"></img>
</p>
<img src="https://i.imgur.com/BxJ2Fys.png" alt="Diagnosis Tool"></img>
</p>
50 changes: 50 additions & 0 deletions offstack/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import os
from queue import Queue

from requests_oauthlib import OAuth2Session
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
opts = Options()
opts.headless = True
opts.add_argument('--no-sandbox')
assert opts.headless # Operating in headless mode

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, GObject

from .logger import logger
from .constants import CONFIG_DIR, USERDATA, CURRDIR
from .utils import check_user_credentials

from .login_window import display_login
from .dialog_window import DialogHandlers
from .dashboard_window import display_dashboard

def init():
queue = Queue()
interface = Gtk.Builder()

# Apply CSS
style_provider = Gtk.CssProvider()
style_provider.load_from_path(CURRDIR+"/resources/main.css")

Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)

interface.add_from_file(CURRDIR+"/resources/dialog_window.glade")
interface.connect_signals(DialogHandlers(interface, queue))

# dial = interface.get_object("MessageDialog")

# dial.show()

if not check_user_credentials():
display_login(interface, OAuth2Session, Firefox, opts, queue, Gtk)
else:
display_dashboard(interface, OAuth2Session, Firefox, opts, queue, Gtk)

Gtk.main()
10 changes: 4 additions & 6 deletions offstack/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@
except KeyError:
USER = getpass.getuser()

CONFIG_DIR = os.path.join(os.path.expanduser("~{0}".format(USER)), ".offstack")
CURRDIR = os.path.dirname(os.path.abspath(__file__))

CONFIG_DIR = os.path.join(os.path.expanduser("~{0}".format(USER)), ".offstack")
FAVORITES = os.path.join(CONFIG_DIR, "favorites.json")
USERDATA = os.path.join(CONFIG_DIR, ".userdata")

VERSION = "0.0.0"
VERSION = "0.0.1-alpha"
CLIENT_ID = '17218'
CLIENT_SECRET = 'vrkGpneBMkEkA7E*mVCynw(('
REDIRECT_URI = 'https://stackexchange.com/oauth/login_success'
SCOPE = ['no_expiry']
BASE_API = "https://api.stackexchange.com/2.2/"

# FAVORITES = './favorites.json'
# USERDATA = './.userdata'
BASE_API = "https://api.stackexchange.com/2.2/"
Loading

0 comments on commit f6f7e83

Please sign in to comment.