Skip to content

Commit

Permalink
Final Tweaks
Browse files Browse the repository at this point in the history
Fixed directory opening, removed samples and other files
  • Loading branch information
Rexeh committed Sep 16, 2020
1 parent 8851747 commit 0c01ac0
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 4,355 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ src/functions/__pycache__/
.vscode/
/build/
/dist/
/logs/*.log
/logs/*.log
.env
3 changes: 0 additions & 3 deletions NewBuild.txt

This file was deleted.

2 changes: 1 addition & 1 deletion config.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[DEFAULT]
EnableLogging = 1
# 1 = Minimum, 3 = Full Debug
LogLevel = 2
LogLevel = 1

[BROWSER]
OpenTemplatesInBrowser = 0
Expand Down
13 changes: 8 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ Learning flight simulators is a daunting task, with lots of buttons to remember.

### Joystick Gremlin
- Custom SVG templates can be built to suit your joystick, throttle, custom HID device
- Importing/inheriance of base templates into button profile exports (In progress)
- Importing/inheriance of base templates into button profile exports
- Support for multiple profiles in Joystick Gremlin

## What's not supported (yet)

### Joystick Gremlin
- POV hats (In POV mode) - If your POV is configured for button outputs, then it will work
- POV hats (In POV mode)
- AXIS support

### Support for other programs/games (yet)
I'm currently working on DCS World - if you have a game you think will benefit from this, let me know and I might add it.
Expand Down Expand Up @@ -47,8 +46,12 @@ I'm expecting issues with the Virpil templates, as don't have the logical button
[Please read](templates/readme.md)

# Support / Beer fund
I plan to expand this out and continue on this journey. I'd appreciate any donations for time saved and to help me continue to support this program.

## Discord
If you have any issues/questions, pop along to discord - https://discord.gg/JC5QFMB

## Beer
I plan to expand this out and continue on this journey. I'd appreciate any donations for time saved and to help me continue to support this program.
[Donate via Paypal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WLLDYGQM5Z39W&source=url)


3,002 changes: 0 additions & 3,002 deletions samples/DCS_mode_new_cm2_2.xml

This file was deleted.

1,293 changes: 0 additions & 1,293 deletions samples/Virpil_DCS.xml

This file was deleted.

52 changes: 14 additions & 38 deletions src/functions/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@
logDir = './logs/'
logFile = 'jv.log'
logger = logging.getLogger('jv')
if not os.path.exists(logDir):
createDirectory(logDir)
hdlr = logging.FileHandler(logDir + logFile)
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
if config.debugLevel == 1:
logger.setLevel(logging.WARNING)
elif config.debugLevel == 2:
logger.setLevel(logging.ERROR)
elif config.debugLevel == 3:
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.WARNING)

webbrowser.register('chrome', None,webbrowser.BackgroundBrowser(config.chrome_path))
tempFilesDirectory = './temp/'
diagramFilesDirectory = './diagrams/'
Expand All @@ -52,7 +37,6 @@ def updateDeviceArray(deviceArray, device, mode, inherit, buttons):
}
})


def createDirectory(directory):
if not os.path.exists(directory):
return os.makedirs(directory)
Expand Down Expand Up @@ -125,25 +109,17 @@ def log(text, level='info'):
def getVersion():
return "Version: " + version.VERSION

#TODO
# # https://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth

# def nested_update(d, u):
# for k, v in u.items():
# if isinstance(v, collections.abc.Mapping):
# d[k] = nested_update(d.get(k, {}), v)
# else:
# d[k] = v
# return d

# def updateDeviceArray(deviceArray, device, mode, buttons):
# data = {
# device: {
# mode: {
# "Buttons": buttons,
# "Axis": ""
# }
# }
# }

# nested_update(deviceArray, data)
if not os.path.exists(logDir):
createDirectory(logDir)
hdlr = logging.FileHandler(logDir + logFile)
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
if config.debugLevel == 1:
logger.setLevel(logging.WARNING)
elif config.debugLevel == 2:
logger.setLevel(logging.ERROR)
elif config.debugLevel == 3:
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.WARNING)
33 changes: 21 additions & 12 deletions src/joystick-diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
root = tk.Tk()
text = tk.Text(root)
root.wm_minsize(600,400)
root.wm_maxsize(600,400)
root.title("Joystick Visualiser - github.com/Rexeh/joystick-diagrams")
root.iconbitmap('./images/logo.ico')
root.config(bg="white")
Expand Down Expand Up @@ -42,7 +43,7 @@
# Functions

def exportGremlin():
parsedConfig = gremlin.Gremlin(selectedFile.cget('text'))
parsedConfig = gremlin.Gremlin(selectedFile)

devices = parsedConfig.createDictionary()

Expand Down Expand Up @@ -97,14 +98,15 @@ def chooseFile():
filetypes=[("Gremlin Config Files" , '*.xml')]
)
global selectedFile
selectedFile = tk.Label(jg_tab, text=file,font=buttonFont)
selectedFile.grid(row=2, column=0)
selectedFile = file
step_2_secondary.config(text=file)
#selectedFile.grid(row=3, column=0)
step_2_button.config(state="active")


def openDiagramsDirectory():
path = os.path.dirname(__file__) + '/diagrams'
helper.log(path)
helper.log(os.getcwd(), 'error')
path = os.path.join(os.getcwd(), 'diagrams' )
helper.log(path, 'error')
FILEBROWSER_PATH = os.path.join(os.getenv('WINDIR'), 'explorer.exe')
subprocess.run([FILEBROWSER_PATH, path])

Expand Down Expand Up @@ -138,7 +140,7 @@ def openDiagramsDirectory():
gremlinLogo = tk.Button(topFrame, text="Support us on GitHub", image=photo, bg="white",anchor="e",padx=(15), font=buttonFont,command=openLink,compound = "left", width=160)
bugLogo = tk.Button(topFrame, text="Got a Bug? Feature?", image=bug,bg="white",anchor="e", padx=(15), font=buttonFont, command=openBugs,compound = "left", width=160)

step_1_info = tk.Label(jg_tab, text="Step 1: Select your Gremlin .XML File",anchor="w",font=largeFont, compound = "left", state="disabled",bg="white", pady=20)
step_1_info = tk.Label(jg_tab, text="Step 1: Select your Gremlin .XML File",anchor="e",font=largeFont, compound = "left", state="disabled",bg="white", pady=20)
chooseFile = tk.Button(jg_tab, text="Choose Gremlin File",font=buttonFont, command=chooseFile,bg="white")

## LISTBOX TEST
Expand Down Expand Up @@ -166,7 +168,6 @@ def openDiagramsDirectory():
bg="white"
)

### END
step_2_info = tk.Label(
jg_tab,
text="Step 2: Run Export",
Expand All @@ -182,7 +183,7 @@ def openDiagramsDirectory():
jg_tab,
text="Export profiles",
bg="white",
anchor="w",
anchor="e",
padx=(15),
font=buttonFont,
command=exportGremlin,
Expand All @@ -208,11 +209,19 @@ def openDiagramsDirectory():
pady=20
)

step_3_secondary = tk.Label(
jg_tab,
text="View your exported diagrams in the Diagrams folder",
font=buttonFont,
compound = "left",
bg="white",
)

step_3_button = tk.Button(
jg_tab,
text="Open diagrams folder",
bg="white",
anchor="w",
anchor="e",
padx=(15),
font=buttonFont,
command=openDiagramsDirectory,
Expand All @@ -223,7 +232,6 @@ def openDiagramsDirectory():
selected_item_button.pack()
selected_item_label.pack()


gremlinLogo.grid(row=0, column=3)
bugLogo.grid(row=0, column=2)

Expand All @@ -235,7 +243,8 @@ def openDiagramsDirectory():
step_2_secondary.grid(row=3, column=0)

step_3_info.grid(row=4, column=0, sticky="W")
step_3_button.grid(row=4, column=1)
step_3_button.grid(row=4, column=1, sticky="W")
step_3_secondary.grid(row=5, column=0, sticky="W")

version.grid(row=5,column=3, sticky="E")
info.grid(row=5,column=1)
Expand Down

0 comments on commit 0c01ac0

Please sign in to comment.