Skip to content

Commit

Permalink
add proper system definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
detectiveren committed May 18, 2024
1 parent a37d5cc commit 0a8303d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
__pycache__/settings.cpython-312.pyc
__pycache__/settings.cpython-310.pyc
__pycache__/lunaChatPage.cpython-312.pyc
__pycache__/system.cpython-312.pyc
23 changes: 23 additions & 0 deletions luna.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from cryptography.fernet import Fernet
from time import sleep
import sqlite3
import system
import platform
import os


# Resources used to develop the app https://flet.dev/docs/tutorials/python-realtime-chat/#getting-started-with-flet
# For info on how to deal with keyboard events https://flet.dev/docs/guides/python/keyboard-shortcuts/
Expand All @@ -12,6 +16,25 @@
# https://flet.dev/docs/controls/appbar/
# https://flet.dev/docs/controls/banner/


def lunaChatInfo():
# This code is a work in progress
lunaInfo = system.getLunaChatInfo("Version")
lunaPlatformsSupported = system.getLunaChatInfo("Platforms")
lunaVersion = lunaInfo[0]
lunaBranch = lunaInfo[2]
supportedWindowsPlatforms = lunaPlatformsSupported[2][1]
if platform.system() == "Windows":
if platform.release() < supportedWindowsPlatforms:
print(f"This version of Windows is unsupported in lunaChat {lunaVersion}, please upgrade to Windows "
+ supportedWindowsPlatforms + " or later")
input("Press any key to continue...")
exit()
return lunaInfo


lunaChatInfo()

print(f"lunaChat instance {settings.lunaChatName} started on http://{settings.host}:{settings.port}/")


Expand Down
44 changes: 44 additions & 0 deletions system.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
class systemInfo:
def __init__(self, version, codename, branch, build):
self.version = version
self.codename = codename
self.branch = branch
self.build = build


class platforms:
def __init__(self, operating_system, version, kernel):
self.operating_system = operating_system
self.version = version
self.kernel = kernel


branches = [
"Alpha",
"Dev",
"Beta",
"Release Candidate",
"Release Preview",
"Release"
]

lunaChatInfo = {
"Version": systemInfo("1.0", "Andromeda", f"{branches[0]}", "2420"),
"releaseDate": None,
"Platforms": [
platforms("Android", "15.0", "Linux"),
platforms("iOS", "17.5", "darwin"),
platforms("Windows", "11", "NT"),
platforms("macOS", "14.5", "darwin")
]
}


def getLunaChatInfo(selection):
getInfo = lunaChatInfo.get(selection)
if isinstance(getInfo, list):
return [list(vars(item).values()) for item in getInfo]
elif getInfo is not None:
return list(vars(getInfo).values())
else:
return getInfo

0 comments on commit 0a8303d

Please sign in to comment.