Skip to content

Commit

Permalink
New registration algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
hcshires committed Aug 6, 2020
1 parent d856a1c commit 7dfef18
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 254 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# xACARS Estafeta Edition by Henry Shires

A simple and free ACARS system supporting phpVMS-based airlines

### v2.0.0 (Original v1.0.0-beta2)
## v2.0.0 (Original v1.0.0-beta2)

* Supports FSX, P3D, and X-Plane 11 (FSUIPC and XPUIPC/FlyWithLua installation required)
* Automatic flight data filing for phpVMS v7.0.0 and higher (v2 and v5 not supported)
* Easy to use interface (re-designed)

## Features

* Select Bid directly from ACARS
* Pre-filing
* Start Flight and immediately record FSUIPC data in the background when in the simulator
* Update enroute time as needed or upon completion of flight
* Finish, file, add comments, and upload to your airline's website with the click of a button

## Contact Me

Please submit ONLY bug reports to this repository's GitHub Issues. Feature requests will NOT be accepted (Submit those to the original)
For additional questions, comments or concerns, please email me:

Expand All @@ -26,6 +29,7 @@ Thank you for using xACARS!
Original source code by @slimit_75

## xACARS Original README

**This is still in early development, expect issues! If you find issues, create a new issue [here](https://github.com/slimit75/xACARS/issues/new)**

ACARS system for phpVMS, powered by Python®.
Expand Down
Binary file removed Wiki/LoginScreen.png
Binary file not shown.
Binary file removed Wiki/StartScreen.png
Binary file not shown.
17 changes: 10 additions & 7 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def stringToBool(x):
raise TypeError("Expected True, true, False, or false: not " + x)

# Reloads the list of airlines.
def reloadList():
def reloadAirlines():
global List
global websites
global savedAPIKeys
Expand All @@ -72,6 +72,11 @@ def reloadList():
config.read("airlines.ini")
configSections = config.sections()

List = []
websites = []
savedAPIKeys = []
usernames = []

try:
for key in configSections:
List.append(config[key]['name'])
Expand All @@ -81,14 +86,11 @@ def reloadList():
except Exception as e:
tk.messagebox.showerror("xACARS Error", e)

def reloadConfig():
def reloadSettings():
global useFSUIPC
global darkMode
global checkUpdate
global getPreRel

# Reload the list of airlines
reloadList()
global getPreRel

# Read the config file and set variables
config = configparser.ConfigParser()
Expand Down Expand Up @@ -120,4 +122,5 @@ def reloadIni():
file.close()

reloadIni()
reloadConfig()
reloadAirlines()
reloadSettings()
123 changes: 2 additions & 121 deletions listAirlines.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,6 @@ from tkinter import messagebox
import config as configLib
import configparser

# Define functions
## Closes the new airline creation screen
def terminateNewAirline():
global name
global url
global apiKey
global newAirWindow
global username
global List

List = configLib.list
name = name.get()
url = url.get()
apiKey = apiKey.get()
username = username.get()

a = 0
for key in List:
a = a + 1

config = configparser.ConfigParser()

if apiKey == "":
if username == "":
config[str(a+1)] = {'name': name, 'url': url}
else:
config[str(a+1)] = {'name': name, 'url': url, 'username': username}
else:
if username == "":
config[str(a+1)] = {'name': name, 'url': url, 'apikey': apiKey}
else:
config[str(a+1)] = {'name': name, 'url': url, 'apikey': apiKey, 'username': username}

with open('airlines.ini', 'a') as configfile:
configfile.write("\n\n")
config.write(configfile)

newAirWindow.quit()
return

## Closes the edit airline screen
def terminateEditAirline():
global airline
Expand Down Expand Up @@ -114,7 +74,7 @@ def terminateDeleteAirline():
websites = configLib.websites
savedAPIKeys = configLib.savedAPIKeys
usernames = configLib.usernames
List = configLib.list
List = configLib.List

airline = airline.get()

Expand Down Expand Up @@ -161,39 +121,6 @@ def terminateDeleteAirline():
delAirWindow.quit()
return

## New airline screen
def new():
global name
global url
global apiKey
global newAirWindow
global username

newAirWindow = tk.Tk()
newAirWindow.iconbitmap('Favicon.ico')
name = tk.StringVar(newAirWindow)
url = tk.StringVar(newAirWindow)
apiKey = tk.StringVar(newAirWindow)
username = tk.StringVar(newAirWindow)

newAirWindow.title('xACARS ' + configLib.version)
tk.Label(newAirWindow, text='Airline Name: ').grid(row=0, column=0)
tk.Label(newAirWindow, text='Airline URL: ').grid(row=1, column=0)
tk.Label(newAirWindow, text='Username: ').grid(row=2, column=0)
tk.Label(newAirWindow, text='API Key (Only if you want use autofill): ').grid(row=3, column=0)
ttk.Entry(newAirWindow, textvariable=name).grid(row=0, column=1)
ttk.Entry(newAirWindow, textvariable=url).grid(row=1, column=1)
ttk.Entry(newAirWindow, textvariable=username).grid(row=2, column=1)
ttk.Entry(newAirWindow, show="*", textvariable=apiKey).grid(row=3, column=1)
ttk.Button(newAirWindow, text='Create', command=terminateNewAirline).grid(row=4, columnspan=2, sticky='we')
newAirWindow.mainloop()
newAirWindow.destroy()

configLib.reloadList()
newAirWindow.quit()
newAirWindow.destroy()
reload()

## Autofill for the edit airline screen
def editAutofill():
global airline
Expand Down Expand Up @@ -266,7 +193,6 @@ def edit():
apiKey = tk.StringVar(editAirWindow)
username = tk.StringVar(editAirWindow)

editAirWindow.title('xACARS ' + configLib.version)
tk.Label(editAirWindow, text='Airline to edit: ').grid(row=0, column=0)
ttk.OptionMenu(editAirWindow, airline, *List).grid(row=0, column=1)
tk.Label(editAirWindow, text='Airline Name: ').grid(row=1, column=0)
Expand All @@ -284,49 +210,4 @@ def edit():

configLib.reloadList()
editAirWindow.quit()
editAirWindow.destroy()
reload()

## Closes main menu
def quit():
global window
window.quit()
window.destroy()

## Draw main window
def reload():
global window
window = tk.Tk()

configLib.reloadList()

list = configLib.list
websites = configLib.websites
savedAPIKeys = configLib.savedAPIKeys
usernames = configLib.usernames

window.title('xACARS - Airlines')
tk.Label(window, text='Airline Name').grid(row=0, column=0)
tk.Label(window, text='Airline URL').grid(row=0, column=1)
tk.Label(window, text='Username').grid(row=0, column=2)
tk.Label(window, text='APIKey (optional)').grid(row=0, column=3)
ttk.Separator(window, orient=tk.HORIZONTAL).grid(row=1, columnspan=4, sticky="we")

a = 1
for key in list:
try:
name = list[a]
tk.Label(window, text=name).grid(row=a+3, column=0)
tk.Label(window, text=websites[a]).grid(row=a+3, column=1)
tk.Label(window, text=usernames[a]).grid(row=a+3, column=2)
tk.Label(window, text=savedAPIKeys[a]).grid(row=a+3, column=3)
a = a + 1
except:
pass

ttk.Separator(window, orient=tk.HORIZONTAL).grid(row=a+3, columnspan=4, sticky="we")
ttk.Button(window, text='Finish', command=quit).grid(row=a+4, column=0, sticky="we")
ttk.Button(window, text='Add Airline', command=new).grid(row=a+4, column=1, sticky="we")
ttk.Button(window, text='Edit Airline', command=edit).grid(row=a+4, column=2, sticky="we")
ttk.Button(window, text='Delete Airline', command=delete).grid(row=a+4, column=3, sticky="we")
window.mainloop()
editAirWindow.destroy()
33 changes: 25 additions & 8 deletions login.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,22 @@
from tkinter import ttk
from tkinter import messagebox
import config
import configparser
import web
import json
import listAirlines

List = config.List
websites = config.websites
savedAPIKeys = config.savedAPIKeys
usernames = config.usernames

def login(airline, username, key):
try:

getAirline = airline.get()
getKey = key.get()
getUsername = username.get()
index = List.index(getAirline)
index = config.List.index(getAirline)

config.changeVar("APIKey", getKey)
config.changeVar("airline", getAirline)
config.changeVar("website", websites[index])
config.changeVar("website", config.websites[index])

data = web.getRaw(config.website + '/api/user')

Expand Down Expand Up @@ -64,5 +61,25 @@ def login(airline, username, key):
tk.messagebox.showerror("xACARS Error", e)
return False

def register(airline, username, website, key):
def register(airline, website, username, apiKey):
getAirline = airline.get()
getKey = apiKey.get()
getUsername = username.get()
getWebsite = website.get()

index = 0
while index < len(config.List):
index += 1

accounts = configparser.ConfigParser()
accounts[str(index + 1)] = {'name': getAirline, 'url': getWebsite, 'apikey': getKey, 'username': getUsername}

with open('airlines.ini', 'a') as configfile:
configfile.write("\n\n")
accounts.write(configfile)

def edit():
return

def delete():
return
Loading

0 comments on commit 7dfef18

Please sign in to comment.