def __init__(self): global option_color_comma global option_colors_fixed global option_colors_themed global option_use_theme_colors global option_separator option_color_comma = ct.ini_read(fn_config, "op", "color_comma", option_color_comma) option_colors_fixed = ct.ini_read(fn_config, "op", "colors_fixed", option_colors_fixed) option_colors_themed = ct.ini_read(fn_config, "op", "colors_themed", option_colors_themed) option_use_theme_colors = str_to_bool( ct.ini_read( fn_config, "op", "use_theme_colors", bool_to_str(option_use_theme_colors), )) option_separator = ct.ini_read(fn_config, "op", "separator", option_separator) self.update_colors()
def __init__(self): self.h_tree = app.app_proc(app.PROC_GET_CODETREE, '') dir = app.app_path(app.APP_DIR_PY) dirs = os.listdir(dir) dirs = [ os.path.join(dir, s) for s in dirs if s.startswith('cuda_tree_') ] for dir in dirs: fn_inf = os.path.join(dir, 'install.inf') s_module = app.ini_read(fn_inf, 'info', 'subdir', '') for index in range(1, MAX_SECTIONS + 1): section = 'treehelper' + str(index) s_method = app.ini_read(fn_inf, section, 'method', '') if not s_method: continue s_lexers = app.ini_read(fn_inf, section, 'lexers', '') if not s_lexers: continue for s_lex in s_lexers.split(','): self.helpers[s_lex] = { 'module': s_module, 'method': s_method, } #print('module', s_module, 'lexers', s_lexers, 'method', s_method) items = sorted(list(self.helpers.keys())) if items: print('TreeHelpers: ' + ', '.join(items))
def do_fix_imports(text): fn = get_config_filename('Python Fix Imports') op_split = ini_read(fn, 'op', 'split_import_statements', '1') == '1' op_sort = ini_read(fn, 'op', 'sort_import_statements', '1') == '1' res, textout = fmt.sortImportGroups(ed_filename, text, splitImportStatements=op_split, sortImportStatements=op_sort) if res: if textout != text: return textout
def load(self): self.items = [] for i in range(self.max_size): fn = ct.ini_read(self.filename, self.section, str(i), '') if not fn: break self.items.append(fn)
def __init__(self): self.app = App() self.fn = None self.nodes = [] self.env_path = ct.ini_read(cfg_file, cfg_section, cfg_opt_env, '') if self.env_path: self.app.environment = create_env(self.env_path) if not self.app.environment: # show menu self.app.environment = select_env() if IS_NT and not self.app.environment: msg("ERROR: Interpreter is not selected. Cannot use Python IntelliSense.") self.load_prj()
def do_options_load(): global color_error global color_warn global color_info global color_error_use global color_warn_use global color_info_use global use_on_open global use_on_save global use_on_change color_error = html_to_int(app.ini_read(fn_ini, 'colors', 'error', '#ff00ff')) color_warn = html_to_int(app.ini_read(fn_ini, 'colors', 'warn', '#ffff00')) color_info = html_to_int(app.ini_read(fn_ini, 'colors', 'info', '#a6caf0')) color_error_use = app.ini_read(fn_ini, 'colors', 'error_use', '1')=='1' color_warn_use = app.ini_read(fn_ini, 'colors', 'warn_use', '1')=='1' color_info_use = app.ini_read(fn_ini, 'colors', 'info_use', '1')=='1' use_on_open = app.ini_read(fn_ini, 'events', 'on_open', '0')=='1' use_on_save = app.ini_read(fn_ini, 'events', 'on_save', '0')=='1' use_on_change = app.ini_read(fn_ini, 'events', 'on_change', '0')=='1'
sys.path.append(os.path.dirname(__file__)) import jedi import cuda_project_man as prj_man cfg_file = os.path.join(ct.app_path(ct.APP_DIR_SETTINGS), 'plugins.ini') cfg_section = 'python_intel' cfg_opt_env = 'environment' cfg_opt_menu_w = 'usages_menu_w' cfg_opt_menu_h = 'usages_menu_h' HOMEDIR = os.path.expanduser('~') IS_NT = os.name == 'nt' LINE_GOTO_OFFSET = 5 opt_menu_w = int(ct.ini_read(cfg_file, cfg_section, cfg_opt_menu_w, '600')) opt_menu_h = int(ct.ini_read(cfg_file, cfg_section, cfg_opt_menu_h, '400')) def pretty_path(s): if not IS_NT: if s == HOMEDIR: s = '~' elif s.startswith(HOMEDIR+'/'): s = '~'+s[len(HOMEDIR):] return s def input_name(caption, name): while True: s = ct.dlg_input(caption, name)
def do_load_ops(): opt.MIN_LEN = int(app.ini_read(fn_ini, 'op', 'min_len', '2')) opt.MAX_LINES = int(app.ini_read(fn_ini, 'op', 'max_lines', '5000')) opt.USE_NEAREST_LINE_COUNT = int(app.ini_read(fn_ini, 'op', 'use_nearest_line_count', '10000')) opt.SEL_ALLOW = str_to_bool(app.ini_read(fn_ini, 'op', 'sel_allow', '1')) opt.SEL_ALLOW_WHITE_SPACE = str_to_bool(app.ini_read(fn_ini, 'op', 'sel_allow_white_space', '0')) opt.SEL_CASE_SENSITIVE = str_to_bool(app.ini_read(fn_ini, 'op', 'sel_case_sensitive', '0')) opt.SEL_WORDS_ONLY = str_to_bool(app.ini_read(fn_ini, 'op', 'sel_words_only', '0')) opt.SEL_WHOLE_WORDS = str_to_bool(app.ini_read(fn_ini, 'op', 'sel_whole_words', '0')) opt.CARET_ALLOW = str_to_bool(app.ini_read(fn_ini, 'op', 'caret_allow', '1')) opt.CARET_CASE_SENSITIVE = str_to_bool(app.ini_read(fn_ini, 'op', 'caret_case_sensitive', '1')) opt.CARET_WHOLE_WORDS = str_to_bool(app.ini_read(fn_ini, 'op', 'caret_whole_words', '1')) opt.COLOR_FONT_OTHER = appx.html_color_to_int(app.ini_read(fn_ini, 'colors', 'font_other', '#000')) opt.COLOR_BG_OTHER = appx.html_color_to_int(app.ini_read(fn_ini, 'colors', 'bg_other', '#ff0')) opt.COLOR_FONT_CURRENT = appx.html_color_to_int(app.ini_read(fn_ini, 'colors', 'font_current', '#000')) opt.COLOR_BG_CURRENT = appx.html_color_to_int(app.ini_read(fn_ini, 'colors', 'bg_current', '#e4c0e4'))
def read_int(self, section, key, defvalue): """Reads single string from .ini file""" return int(ct.ini_read(self.file, section, key, str(defvalue)))
def do_load_ops(): global MIN_LEN global SEL_ALLOW global SEL_ALLOW_WHITE_SPACE global SEL_CASE_SENSITIVE global SEL_WORDS_ONLY global SEL_WHOLE_WORDS global CARET_ALLOW global CARET_CASE_SENSITIVE global CARET_WHOLE_WORDS global COLOR_FONT_OTHER global COLOR_BG_OTHER global COLOR_FONT_CURRENT global COLOR_BG_CURRENT MIN_LEN = int(app.ini_read(fn_ini, 'op', 'min_len', '1')) SEL_ALLOW = app.ini_read(fn_ini, 'op', 'sel_allow', '1')=='1' SEL_ALLOW_WHITE_SPACE = app.ini_read(fn_ini, 'op', 'sel_allow_white_space', '0')=='1' SEL_CASE_SENSITIVE = app.ini_read(fn_ini, 'op', 'sel_case_sensitive', '0')=='1' SEL_WORDS_ONLY = app.ini_read(fn_ini, 'op', 'sel_words_only', '0')=='1' SEL_WHOLE_WORDS = app.ini_read(fn_ini, 'op', 'sel_whole_words', '0')=='1' CARET_ALLOW = app.ini_read(fn_ini, 'op', 'caret_allow', '1')=='1' CARET_CASE_SENSITIVE = app.ini_read(fn_ini, 'op', 'caret_case_sensitive', '1')=='1' CARET_WHOLE_WORDS = app.ini_read(fn_ini, 'op', 'caret_whole_words', '1')=='1' COLOR_FONT_OTHER = apx.html_color_to_int(app.ini_read(fn_ini, 'colors', 'font_other', int_to_html(0x000000))) COLOR_BG_OTHER = apx.html_color_to_int(app.ini_read(fn_ini, 'colors', 'bg_other', int_to_html(0x80ffff))) COLOR_FONT_CURRENT = apx.html_color_to_int(app.ini_read(fn_ini, 'colors', 'font_current', int_to_html(0x000000))) COLOR_BG_CURRENT = apx.html_color_to_int(app.ini_read(fn_ini, 'colors', 'bg_current', int_to_html(0xe3c1e3)))
# # Written by Joshua Hagins # Copyright (c) 2015 Joshua Hagins # # Adapted to CudaLint by Alexey Torgashin, 2020 # # License: MIT # """This module exports the Scalastyle plugin class.""" import os from cuda_lint import Linter, util import cudatext as app import shutil jar_file = app.ini_read('plugins.ini', 'lint_scalastyle', 'jar', '_') if not os.path.isfile(jar_file): app.msg_box( 'Cannot find Scalastyle, see\n settings/plugins.ini\n [lint_scalastyle]\n jar=...', app.MB_OK + app.MB_ICONERROR) cfg_file_init = os.path.join(os.path.dirname(__file__), 'scalastyle_config.xml') cfg_file = os.path.join(app.app_path(app.APP_DIR_SETTINGS), 'scalastyle_config.xml') if not os.path.isfile(cfg_file) and os.path.isfile(cfg_file_init): shutil.copy(cfg_file_init, cfg_file) class Scalastyle(Linter):