Skip to content

Commit

Permalink
Hotfix for F16 F18 DCS World - Fix for Export FLOATS
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexeh committed Mar 20, 2022
1 parent 4c72c16 commit 9d0f4c1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 28 deletions.
16 changes: 11 additions & 5 deletions src/adaptors/dcs_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import functions.helper as helper
import adaptors.joystick_diagram_interface as jdi
import adaptors.dcs_world_lex # pylint: disable=unused-import
import adaptors.dcs_world_parse # pylint: disable=unused-import
import adaptors.dcs_world_yacc # pylint: disable=unused-import


class DCSWorldParser(jdi.JDinterface):
Expand Down Expand Up @@ -71,7 +71,7 @@ def __validate_profile(self, item):
return False

def get_validated_profiles(self):
""" Expose Valid Profiles only to UI """
"""Expose Valid Profiles only to UI"""
if self.remove_easy_modes:
return list(
filter(
Expand All @@ -83,7 +83,7 @@ def get_validated_profiles(self):
return self.valid_profiles

def convert_button_format(self, button):
""" Convert DCS Buttons to match expected "BUTTON_X" format """
"""Convert DCS Buttons to match expected "BUTTON_X" format"""
split = button.split("_")

if len(split) == 2:
Expand Down Expand Up @@ -137,8 +137,14 @@ def process_profiles(self, profile_list=None):
)
)
else:

print(
f"Processing Device: {joystick_device} and file {joystick_file}"
)
dictionary_2 = self.parse_file()

print(dictionary_2)

button_map = self.create_joystick_map(dictionary_2)

self.update_joystick_dictionary(
Expand Down Expand Up @@ -209,7 +215,7 @@ def t_NUMBER(t): # pylint: disable=invalid-name
return t

def t_STRING(t): # pylint: disable=invalid-name
r"\"[\w|\/|\(|\)|\-|\:|\+|\,|\&|\.|\'|\s]+\""
r"\"[\w|\/|\(|\)|\-|\:|\+|\,|\&|\.|\'|\<|\>|\s]+\" "
t.value = t.value[1:-1]
return t

Expand Down Expand Up @@ -274,7 +280,7 @@ def p_error(t): # pylint: disable=invalid-name
)

# Build the parser
parser = yacc.yacc(debug=False, optimize=1, tabmodule="dcs_world_parse")
parser = yacc.yacc(debug=False, optimize=1, tabmodule="dcs_world_yacc")

# Parse the data
try:
Expand Down
4 changes: 2 additions & 2 deletions src/adaptors/dcs_world_lex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# dcs_world_lex.py. This file automatically created by PLY (version 3.11). Don't edit!
# lextab.py. This file automatically created by PLY (version 3.11). Don't edit!
_tabversion = "3.10"
_lextokens = set(
(
Expand All @@ -21,7 +21,7 @@
_lexstatere = {
"INITIAL": [
(
'(?P<t_DOUBLE_VAL>(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P<t_NUMBER>[0-9]+)|(?P<t_STRING>\\"[\\w|\\/|\\(|\\)|\\-|\\:|\\+|\\,|\\&|\\.|\\\'|\\s]+\\")|(?P<t_TRUE>(true))|(?P<t_FALSE>(false))|(?P<t_LCURLY>\\{)|(?P<t_RCURLY>\\})|(?P<t_LBRACE>\\[)|(?P<t_RBRACE>\\])|(?P<t_COMMA>\\,)|(?P<t_EQUALS>\\=)',
'(?P<t_DOUBLE_VAL>(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P<t_NUMBER>[0-9]+)|(?P<t_STRING>\\"[\\w|\\/|\\(|\\)|\\-|\\:|\\+|\\,|\\&|\\.|\\\'|\\<|\\>|\\s]+\\" )|(?P<t_TRUE>(true))|(?P<t_FALSE>(false))|(?P<t_LCURLY>\\{)|(?P<t_RCURLY>\\})|(?P<t_LBRACE>\\[)|(?P<t_RBRACE>\\])|(?P<t_COMMA>\\,)|(?P<t_EQUALS>\\=)',
[
None,
("t_DOUBLE_VAL", "DOUBLE_VAL"),
Expand Down
30 changes: 15 additions & 15 deletions src/adaptors/dcs_world_parse.py → src/adaptors/dcs_world_yacc.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# dcs_world_parse.py
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = "3.10"

_lr_method = "LALR"

_lr_signature = "COMMA DOUBLE_VAL EQUALS FALSE LBRACE LCURLY NUMBER RBRACE RCURLY STRING TRUEdict : LCURLY dvalues RCURLYdvalues : dvalue\n | dvalue COMMA\n | dvalue COMMA dvalueskey : LBRACE NUMBER RBRACE\n | LBRACE STRING RBRACE dvalue : key EQUALS STRING\n | key EQUALS boolean\n | key EQUALS DOUBLE_VAL\n | key EQUALS NUMBER\n | key EQUALS dict boolean : TRUE\n | FALSE\n "
_lr_signature = "COMMA DOUBLE_VAL EQUALS FALSE LBRACE LCURLY NUMBER RBRACE RCURLY STRING TRUEdict : LCURLY dvalues RCURLYdvalues : dvalue\n | dvalue COMMA\n | dvalue COMMA dvalueskey : LBRACE NUMBER RBRACE\n | LBRACE STRING RBRACEdvalue : key EQUALS STRING\n | key EQUALS boolean\n | key EQUALS DOUBLE_VAL\n | key EQUALS NUMBER\n | key EQUALS dictboolean : TRUE\n | FALSE\n "

_lr_action_items = {
"LCURLY": (
Expand Down Expand Up @@ -228,52 +228,52 @@
del _lr_goto_items
_lr_productions = [
("S' -> dict", "S'", 1, None, None, None),
("dict -> LCURLY dvalues RCURLY", "dict", 3, "p_dict", "dcs_world.py", 170),
("dvalues -> dvalue", "dvalues", 1, "p_dvalues", "dcs_world.py", 174),
("dvalues -> dvalue COMMA", "dvalues", 2, "p_dvalues", "dcs_world.py", 175),
("dvalues -> dvalue COMMA dvalues", "dvalues", 3, "p_dvalues", "dcs_world.py", 176),
("key -> LBRACE NUMBER RBRACE", "key", 3, "p_key_expression", "dcs_world.py", 182),
("key -> LBRACE STRING RBRACE", "key", 3, "p_key_expression", "dcs_world.py", 183),
("dict -> LCURLY dvalues RCURLY", "dict", 3, "p_dict", "dcs_world.py", 242),
("dvalues -> dvalue", "dvalues", 1, "p_dvalues", "dcs_world.py", 246),
("dvalues -> dvalue COMMA", "dvalues", 2, "p_dvalues", "dcs_world.py", 247),
("dvalues -> dvalue COMMA dvalues", "dvalues", 3, "p_dvalues", "dcs_world.py", 248),
("key -> LBRACE NUMBER RBRACE", "key", 3, "p_key_expression", "dcs_world.py", 254),
("key -> LBRACE STRING RBRACE", "key", 3, "p_key_expression", "dcs_world.py", 255),
(
"dvalue -> key EQUALS STRING",
"dvalue",
3,
"p_value_expression",
"dcs_world.py",
187,
259,
),
(
"dvalue -> key EQUALS boolean",
"dvalue",
3,
"p_value_expression",
"dcs_world.py",
188,
260,
),
(
"dvalue -> key EQUALS DOUBLE_VAL",
"dvalue",
3,
"p_value_expression",
"dcs_world.py",
189,
261,
),
(
"dvalue -> key EQUALS NUMBER",
"dvalue",
3,
"p_value_expression",
"dcs_world.py",
190,
262,
),
(
"dvalue -> key EQUALS dict",
"dvalue",
3,
"p_value_expression",
"dcs_world.py",
191,
263,
),
("boolean -> TRUE", "boolean", 1, "p_boolean", "dcs_world.py", 195),
("boolean -> FALSE", "boolean", 1, "p_boolean", "dcs_world.py", 196),
("boolean -> TRUE", "boolean", 1, "p_boolean", "dcs_world.py", 267),
("boolean -> FALSE", "boolean", 1, "p_boolean", "dcs_world.py", 268),
]
14 changes: 9 additions & 5 deletions src/classes/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def export_config(self, progress_bar=None):

if isinstance(progress_bar, QtWidgets.QProgressBar):
progress_bar.setValue(0)
progress_increment = 100 / joystick_count
progress_increment = int(100 / joystick_count)

for joystick in self.joystick_listing:
base_template = self.get_template(joystick)
Expand All @@ -46,11 +46,15 @@ def export_config(self, progress_bar=None):
completed_template = self.brand_template(mode, completed_template)
print("Saving: {}".format(joystick))
self.save_template(joystick, mode, completed_template)
print(f"Progress bar: {progress_bar.value()}")
print(f"Progress Increment: {progress_increment}")

increment = int(progress_increment / progress_increment_modes)

print(f"Increment: {increment}")

if isinstance(progress_bar, QtWidgets.QProgressBar):
progress_bar.setValue(
progress_bar.value()
+ (progress_increment / progress_increment_modes)
)
progress_bar.setValue(progress_bar.value() + increment)
else:
self.error_bucket.append(
"No Template file found for: {}".format(joystick)
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "1.4.1"
VERSION = "1.4.2"

0 comments on commit 9d0f4c1

Please sign in to comment.