diff --git a/src/adaptors/dcs_world.py b/src/adaptors/dcs_world.py index 0481c55..7ecb0ec 100644 --- a/src/adaptors/dcs_world.py +++ b/src/adaptors/dcs_world.py @@ -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): @@ -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( @@ -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: @@ -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( @@ -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 @@ -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: diff --git a/src/adaptors/dcs_world_lex.py b/src/adaptors/dcs_world_lex.py index 61ae8e6..674223d 100644 --- a/src/adaptors/dcs_world_lex.py +++ b/src/adaptors/dcs_world_lex.py @@ -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( ( @@ -21,7 +21,7 @@ _lexstatere = { "INITIAL": [ ( - '(?P(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P[0-9]+)|(?P\\"[\\w|\\/|\\(|\\)|\\-|\\:|\\+|\\,|\\&|\\.|\\\'|\\s]+\\")|(?P(true))|(?P(false))|(?P\\{)|(?P\\})|(?P\\[)|(?P\\])|(?P\\,)|(?P\\=)', + '(?P(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P[0-9]+)|(?P\\"[\\w|\\/|\\(|\\)|\\-|\\:|\\+|\\,|\\&|\\.|\\\'|\\<|\\>|\\s]+\\" )|(?P(true))|(?P(false))|(?P\\{)|(?P\\})|(?P\\[)|(?P\\])|(?P\\,)|(?P\\=)', [ None, ("t_DOUBLE_VAL", "DOUBLE_VAL"), diff --git a/src/adaptors/dcs_world_parse.py b/src/adaptors/dcs_world_yacc.py similarity index 88% rename from src/adaptors/dcs_world_parse.py rename to src/adaptors/dcs_world_yacc.py index 9f51fd3..4fb052a 100644 --- a/src/adaptors/dcs_world_parse.py +++ b/src/adaptors/dcs_world_yacc.py @@ -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": ( @@ -228,19 +228,19 @@ 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", @@ -248,7 +248,7 @@ 3, "p_value_expression", "dcs_world.py", - 188, + 260, ), ( "dvalue -> key EQUALS DOUBLE_VAL", @@ -256,7 +256,7 @@ 3, "p_value_expression", "dcs_world.py", - 189, + 261, ), ( "dvalue -> key EQUALS NUMBER", @@ -264,7 +264,7 @@ 3, "p_value_expression", "dcs_world.py", - 190, + 262, ), ( "dvalue -> key EQUALS dict", @@ -272,8 +272,8 @@ 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), ] diff --git a/src/classes/export.py b/src/classes/export.py index a66b0f4..5065b1e 100644 --- a/src/classes/export.py +++ b/src/classes/export.py @@ -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) @@ -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) diff --git a/src/version.py b/src/version.py index bababb5..94dc080 100644 --- a/src/version.py +++ b/src/version.py @@ -1 +1 @@ -VERSION = "1.4.1" +VERSION = "1.4.2"