Skip to content

Commit

Permalink
docs: implement mkdocs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Germano123 committed Jan 12, 2025
1 parent 9ef5fff commit 71017c2
Show file tree
Hide file tree
Showing 23 changed files with 222 additions and 5 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: ci
on:
push:
branches:
- master
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/__pycache__
src/tests
credentials.json
tokens.json
token.json
*.env
/tests
/__pycache__
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
File renamed without changes.
Empty file added documentation/docs/faq.md
Empty file.
17 changes: 17 additions & 0 deletions documentation/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Welcome to MkDocs

For full documentation visit [mkdocs.org](https://www.mkdocs.org).

## Commands

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.

## Project layout

mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.
Empty file.
62 changes: 62 additions & 0 deletions documentation/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
site_name: GameFlow Connect
repo_name: GitHub - GameFlow Connect
repo_url: https://github.com/Germano123/python-gameflowconnect
edit_uri: edit/main/documentation/

theme:
name: material
# logo: assets/logo.png
# favicon: assets/favicon.ico
palette:
primary: "teal"
accent: "cyan"
font:
text: "Roboto"
code: "Roboto Mono"
language: "en"
icon:
repo: fontawesome/brands/github
edit: material/pencil
view: material/eye
features:
- content.action.edit
- header.autohide
- navigation.tabs
- navigation.path
- navigation.prune
- navigation.top

extra:
social:
- icon: fontawesome/brands/instagram
link: https://www.instagram.com/geh_m_gomes/
name: instagram
- icon: fontawesome/brands/github
link: https://github.com/Germano123
name: github

nav:
- Home: index.md
- Getting Started:
- Installation: 1 getting_started/1 installation.md
- Usage Guide: 1 getting_started/2 usage.md
- Requirements: 1 getting_started/3 requirements.md
- Features:
- Core Features: 2 features/1 core_features.md
- Secondary Features: 2 features/2 secondary_features.md
- Technical Details:
- Architecture: 3 technical_details/1 architecture.md
- UI Design: 3 technical_details/2 ui_design.md
- Integrations: 3 technical_details/3 integrations.md
- Collaboration:
- Contributing Guide: 4 collaboration/1 contributing.md
- Roadmap: 4 collaboration/2 roadmap.md
- Changelog: 4 collaboration/3 changelog.md
- Troubleshooting: troubleshooting.md
- FAQ: faq.md

markdown_extensions:
- admonition
- pymdownx.details

copyright: Copyright © 2025 - Germano Gomes
Binary file not shown.
Binary file added src/__pycache__/github.cpython-311.pyc
Binary file not shown.
88 changes: 88 additions & 0 deletions src/drive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import os.path

import google.auth
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from googleapiclient.http import MediaFileUpload

def uploadfile(creds):
# creds, _ = google.auth.default()
try:
service = build("drive", "v3", credentials=creds)
file_metadata = {
'name': 'fileName_to_be_in_drive.txt',
}
media = MediaFileUpload('test.txt',
mimetype='*/*',
resumable=True)
file = (
service.files()
.create(body=file_metadata, media_body=media, fields='id')
.execute()
)

except HttpError as error:
print(f"An error occurred: {error}")
file = None

# print ('File ID: ' + file.get('id'))

# If modifying these scopes, delete the file token.json.
SCOPES = ["https://www.googleapis.com/auth/drive"]

def list_files(creds):
try:
service = build("drive", "v3", credentials=creds)

# Call the Drive v3 API
results = (
service.files()
.list(pageSize=10, fields="nextPageToken, files(id, name)")
.execute()
)
items = results.get("files", [])

if not items:
print("No files found.")
return

print("Files:")
for item in items:
print(f"{item['name']} ({item['id']})")
except HttpError as error:
# TODO(developer) - Handle errors from drive API.
print(f"An error occurred: {error}")

def main():
"""Shows basic usage of the Drive v3 API.
Prints the names and ids of the first 10 files the user has access to.
"""
creds = None
# The file token.json stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists("token.json"):
creds = Credentials.from_authorized_user_file("token.json", SCOPES)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
"credentials.json", SCOPES
)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run
with open("token.json", "w") as token:
token.write(creds.to_json())

# list_files(creds)
uploadfile(creds)


if __name__ == "__main__":
main()

21 changes: 21 additions & 0 deletions src/git_connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from github import Github
from github import Auth

from dotenv import load_dotenv
import os

load_dotenv()
access_token = os.getenv("ACCESS_TOKEN")

# using an access token
auth = Auth.Token(access_token)

# Public Web Github
g = Github(auth=auth)

for repo in g.get_user().get_repos():
print(repo.name)
# to see all the available attributes and methods
# print(dir(repo))

g.close()
4 changes: 2 additions & 2 deletions main.py → src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class FrameWidget():
# __init__ function for class FrameWidget
def __init__(self, widget, xPos, yPos):
def __init__(self, widget: Widget, xPos, yPos):
self.__widget = widget
self.__xPos = xPos
self.__yPos = yPos
Expand Down Expand Up @@ -91,7 +91,7 @@ def appscreen(self):
# widget -> Label(self.main_frame, text="First page").place(relx=0.05, rely=0.05)
self.create_page("First page", [
PageFrame(0.02, 0.02, 0.96, 0.3, 4, colors["secondary"], colors["terciary"], 2, [
FrameWidget(Button(self.root), x=50, y=50)
FrameWidget(Button(self.root), xPos=50, yPos=50)
]),
PageFrame(0.02, 0.35, 0.96, 0.6, 4, colors["secondary"], colors["terciary"], 2, []),
])
Expand Down

0 comments on commit 71017c2

Please sign in to comment.