Constants Module

import raconverter.config

# Return config
config_file = raconverter.config.resource_path('raconverter.ini')
config = raconverter.config.read_config(config_file)

# Config sections
package = config['package']
diverse = config['diverse']
program = config['program']
main_application = config['main_application']
entry_form = config['entry_form']
tooltip = config['tooltip']
metadata_file = config['metadata_file']
syntax_file = config['syntax_file']

# Read constants from diverse section
MAIN = diverse.get('main')
FONT_OPTION = diverse.get('font_option')
FONT = diverse.get('font')
RESIZE_X = diverse.getint('resize_x')
RESIZE_Y = diverse.getint('resize_y')
SIDE_TOP = diverse.get('side_top')
SIDE_LEFT = diverse.get('side_left')
SIDE_RIGHT = diverse.get('side_right')
FILL_X = diverse.get('fill_x')
EXPAND_YES = diverse.get('expand_yes')
ANCHOR_EAST = diverse.get('anchor_east')
ANCHOR_WEST = diverse.get('anchor_west')
RELIEF_FLAT = diverse.get('relief_flat')
RELIEF_SOLID = diverse.get('relief_solid')
TEAROFF = diverse.get('tearoff')
UNDERLINE = diverse.get('underline')
STATE_ENABLE = diverse.get('state_enable')
STATE_DISABLE = diverse.get('state_disable')
READ_MODE = diverse.get('read_mode')
WRITE_MODE = diverse.get('write_mode')
WRAP = diverse.get('wrap')
INDEX_START0 = diverse.get('index_start0')
INDEX_START1 = diverse.get('index_start1')
INDEX_END = diverse.get('index_end')
NEW_LINE = diverse.get('new_line')
BLACK = diverse.get('black')
WHITE = diverse.get('white')
INSERT = diverse.get('insert')
OFFSET = diverse.get('offset')
UTF8 = diverse.get('utf8')
UTF8_NO_BOM = diverse.get('utf8_no_bom')
STRICT = diverse.get('strict')
IO_ERROR = diverse.get('io_error')
WINDOWS_SEPARATOR = diverse.get('windows_separator')
UNIX_SEPARATOR = diverse.get('unix_separator')
WINDOWS_OS = diverse.get('windows_os')

# Read constants from program section
SAS_PROGRAM = program.get('sas_name')
SAS_SYNTAX = program.get('sas_syntax')
SAS_DATA = program.get('sas_data')
SAS_CATALOG = program.get('sas_catalog')
STATA_PROGRAM = program.get('stata_name')
STATA_SYNTAX = program.get('stata_syntax')
STATA_DATA = program.get('stata_data')
SPSS_PROGRAM = program.get('spss_name')
SPSS_SYNTAX = program.get('spss_syntax')
SPSS_DATA = program.get('spss_data')
VALID_EXTENSIONS = program.get('valid_extensions')

# Read constants from main application section
BUTTON_HEIGHT2 = main_application.getint('button_height2')
BUTTON_FRAME_PADX10 = main_application.getint('button_frame_padx10')
BUTTON_FRAME_PADY7 = main_application.getint('button_frame_pady7')
BUTTON_PADY3 = main_application.getint('button_pady3')
MAIN_TITLE = main_application.get('main_title')
MENU_RACONVERTER = main_application.get('menu_raconverter')
SUB_MENU_ABOUT = main_application.get('sub_menu_about')
SUB_MENU_EXIT = main_application.get('sub_menu_exit')
BUTTON_STEP1 = main_application.get('button_step1')
BUTTON_STEP2 = main_application.get('button_step2')
BUTTON_STEP3 = main_application.get('button_step3')
BUTTON_STEP4 = main_application.get('button_step4')
ABOUT_RACONVERTER = main_application.get('about_raconverter')
ABOUT_MESSAGE = main_application.get('about_message')
MISSING_CATALOG = main_application.get('missing_catalog_title')
DATA_FILE_INFORMATION = main_application.get('data_file_information')
MISSING_CATALOG_MESSAGE = main_application.get('missing_catalog_message')
INTRO_TEXT = main_application.get('intro_text')
MISSING_CATALOG_TEXT = main_application.get('missing_catalog_text')
STEP1_INVALID_TEXT = main_application.get('step1_invalid_text')
STEP1_TRUE_TEXT = main_application.get('step1_true_text')
STEP2_TRUE_TEXT = main_application.get('step2_true_text')
STEP3_TRUE_TEXT = main_application.get('step3_true_text')
STEP4_TRUE_TEXT = main_application.get('step4_true_text')

# Read constants from entry form section
LABEL_WIDTH17 = entry_form.getint('label_width17')
LABEL_WIDTH21 = entry_form.getint('label_width21')
ENTRY_WIDTH36 = entry_form.getint('entry_width36')
TEXT_ENTRY_WIDTH46 = entry_form.getint('text_entry_width46')
TEXT_ENTRY_HEIGHT16 = entry_form.getint('text_entry_height16')
BUTTON_HEIGHT1 = entry_form.getint('button_height1')
BUTTON_FRAME_PADX7 = entry_form.getint('button_frame_padx7')
BUTTON_FRAME_PADY10 = entry_form.getint('button_frame_pady10')
BUTTON_PADX3 = entry_form.getint('button_padx3')
ENTRY_FRAME_PADX10 = entry_form.getint('entry_frame_padx10')
ENTRY_FRAME_PADY5 = entry_form.getint('entry_frame_pady5')
TEXT_ENTRY_PADX10 = entry_form.getint('text_entry_padx10')
ENTER_EVENT = entry_form.get('enter_event')
LEAVE_EVENT = entry_form.get('leave_event')
BUTTON_PRESS_EVENT = entry_form.get('button_press_event')
DATA_FILE_FORM_TITLE = entry_form.get('data_file_form_title')
REFERENCE_FORM_TITLE = entry_form.get('reference_form_title')
MENU_ADD_DATA_FILE_REFERENCE = entry_form.get('menu_add_data_file_reference')
DATA_FILE_NAME = entry_form.get('data_file_name')
DATA_FILE_DESCRIPTION = entry_form.get('data_file_description')
KEY_VARIABLE = entry_form.get('key_variable')
VARIABLE_OTHER = entry_form.get('variable_other')
VARIABLE_THIS = entry_form.get('variable_this')
DATA_FILE_REFERENCE = entry_form.get('data_file_reference')
VALIDATE = entry_form.get('validate')
ENTRY_STRING = entry_form.get('entry_string')
ENTRY_NAME = entry_form.get('entry_name')
INVALID_NAME = entry_form.get('invalid_name')
ASK_ADD_DATA_FILE_REFERENCE = entry_form.get('ask_add_data_file_reference')
BUTTON_ADD = entry_form.get('button_add')
BUTTON_DONE = entry_form.get('button_done')
BUTTON_QUIT = entry_form.get('button_quit')
DOUBLE_QUOTE_BOTH_VARIABLES = entry_form.get('double_quote_both_variables')
DOUBLE_QUOTE_VARIABLE_OTHER = entry_form.get('double_quote_variable_other')
DOUBLE_QUOTE_VARIABLE_THIS = entry_form.get('double_quote_variable_this')
DOUBLE_QUOTE_NO_VARIABLES = entry_form.get('double_quote_no_variables')
INVALID_DATA_FILE_NAME_MESSAGE = entry_form.get('invalid_data_file_name_message')
INVALID_VARIABLE_NAME_MESSAGE = entry_form.get('invalid_variable_name_message')
ADD_DATA_FILE_REFERENCE_MESSAGE = entry_form.get('add_data_file_reference_message')
INVALID_NAME_MESSAGE = entry_form.get('invalid_name_message')
ASK_ADD_DATA_FILE_REFERENCE_MESSAGE = entry_form.get('ask_add_data_file_reference_message')

# Read contants from tooltip section
OFFSET_X = tooltip.getint('offset_x')
OFFSET_Y = tooltip.getint('offset_y')
WAIT_TIME = tooltip.getint('wait_time')
WRAP_LENGTH = tooltip.getint('wrap_length')
LABEL_IPADX1 = tooltip.getint('label_ipadx1')
TOOLTIP_BORDERWIDTH = tooltip.getint('tooltip_borderwidth')
DEFAULT_TOOLTIP_TEXT = tooltip.get('default_tooltip_text')
DATA_FILE_NAME_TOOLTIP = tooltip.get('data_file_name_tooltip')
DATA_FILE_DESCRIPTION_TOOLTIP = tooltip.get('data_file_description_tooltip')
KEY_VARIABLE_TOOLTIP = tooltip.get('key_variable_tooltip')
VARIABLE_OTHER_TOOLTIP = tooltip.get('variable_other_tooltip')
VARIABLE_THIS_TOOLTIP = tooltip.get('variable_this_tooltip')

# Read constants from metadata file section
DATA = metadata_file.get('data')
METADATA = metadata_file.get('metadata')
DECODING_ERROR_DIRECTORY = metadata_file.get('decoding_error_directory')
APPLICATION_NAME_LABEL = metadata_file.get('application_name_label')
DATA_FILE_INFORMATION_LABEL = metadata_file.get('data_file_information_label')
DATA_FILE_NAME_LABEL = metadata_file.get('data_file_name_label')
DATA_FILE_DESCRIPTION_LABEL = metadata_file.get('data_file_description_label')
KEY_VARIABLE_LABEL = metadata_file.get('key_variable_label')
DATA_FILE_REFERENCE_LABEL = metadata_file.get('data_file_reference_label')
VARIABLE_LIST_LABEL = metadata_file.get('variable_list_label')
VARIABLE_DESCRIPTION_LABEL = metadata_file.get('variable_description_label')
CODE_LIST_LABEL = metadata_file.get('code_list_label')
USER_DEFINED_MISSING_VALUE_LABEL = metadata_file.get('user_defined_missing_value_label')
DATA_FILE_INFORMATION_FILE = metadata_file.get('data_file_information_file')
VARIABLE_LIST_FILE = metadata_file.get('variable_list_file')
VARIABLE_DESCRIPTION_FILE = metadata_file.get('variable_description_file')
CODE_LIST_FILE = metadata_file.get('code_list_file')
USER_DEFINED_MISING_VALUE_FILE = metadata_file.get('user_defined_missing_value_file')
INVALID_ENCODING_TEXT = metadata_file.get('invalid_encoding_text')
NO_METADATA_TEXT = metadata_file.get('no_metadata_text')

# Read constants from syntax file section
DOLLAR_SIGN = syntax_file.get('dollar_sign')
STATA_SYNTAX_CONTENT = syntax_file.get('stata_syntax_content')
SAS_SYNTAX_CONTENT_WITH_CATALOG = syntax_file.get('sas_syntax_content_with_catalog')
SAS_SYNTAX_CONTENT_WITHOUT_CATALOG = syntax_file.get('sas_syntax_content_without_catalog')
SPSS_SYNTAX_CONTENT = syntax_file.get('spss_syntax_content')

Leave a Reply

Your email address will not be published.