mirror of https://gitlab.com/cppit/jucipp
Compare commits
66 Commits
f19a36d91f
...
e2e799029f
| Author | SHA1 | Date |
|---|---|---|
|
|
e2e799029f | 3 months ago |
|
|
a2e4868893 | 7 months ago |
|
|
1223a72908 | 7 months ago |
|
|
4e6c2c2d95 | 5 years ago |
|
|
1a11a5736b | 5 years ago |
|
|
92679161f4 | 5 years ago |
|
|
9ad7c21407 | 5 years ago |
|
|
8a7dd41b73 | 5 years ago |
|
|
5139d6e127 | 5 years ago |
|
|
5b20c32754 | 5 years ago |
|
|
32a70dd5b0 | 5 years ago |
|
|
19c3e90cca | 5 years ago |
|
|
c7e67a70b4 | 5 years ago |
|
|
a994405c71 | 5 years ago |
|
|
ad60559d97 | 5 years ago |
|
|
69d5297d88 | 5 years ago |
|
|
c72aa8cdc4 | 5 years ago |
|
|
03cf0990f2 | 5 years ago |
|
|
ecc2a4d642 | 5 years ago |
|
|
c5d40c1d0e | 5 years ago |
|
|
ff0c52cc45 | 5 years ago |
|
|
86e6a12180 | 5 years ago |
|
|
f8a607a8ab | 5 years ago |
|
|
c3b4f21735 | 5 years ago |
|
|
ca7d9830b2 | 5 years ago |
|
|
be76f94374 | 5 years ago |
|
|
b736400807 | 5 years ago |
|
|
cdf8b4548f | 5 years ago |
|
|
c9055243c3 | 5 years ago |
|
|
ce37b55d0b | 5 years ago |
|
|
6afde6fe37 | 5 years ago |
|
|
6d04f7cff6 | 5 years ago |
|
|
333fe0aa81 | 5 years ago |
|
|
53f1c755b7 | 5 years ago |
|
|
3cf14b7841 | 5 years ago |
|
|
f8127a76d2 | 5 years ago |
|
|
3368b4ffc2 | 5 years ago |
|
|
95f15ef264 | 5 years ago |
|
|
7778752da0 | 5 years ago |
|
|
76e8e5dc54 | 5 years ago |
|
|
7307307846 | 5 years ago |
|
|
05b5b57997 | 5 years ago |
|
|
c519c9dd94 | 5 years ago |
|
|
32b5df1060 | 5 years ago |
|
|
00e1282008 | 5 years ago |
|
|
91ba2234fe | 5 years ago |
|
|
b898db575f | 5 years ago |
|
|
8061731851 | 5 years ago |
|
|
57a42c8f9e | 5 years ago |
|
|
0f4c4a7ce7 | 5 years ago |
|
|
ba24942106 | 5 years ago |
|
|
e08504e250 | 5 years ago |
|
|
f583644a89 | 5 years ago |
|
|
891edadc48 | 5 years ago |
|
|
8e6eaec757 | 5 years ago |
|
|
6ae2d94dd1 | 5 years ago |
|
|
3879f9b0d8 | 5 years ago |
|
|
ee8226d224 | 5 years ago |
|
|
e55c075981 | 5 years ago |
|
|
4763f50e25 | 5 years ago |
|
|
bcd3d0eb96 | 5 years ago |
|
|
22bf01be44 | 5 years ago |
|
|
1244f1a32f | 5 years ago |
|
|
0be5d31d13 | 5 years ago |
|
|
63c822c887 | 5 years ago |
|
|
d7b60adc62 | 5 years ago |
68 changed files with 1827 additions and 46 deletions
@ -0,0 +1,14 @@ |
|||||||
|
# Plugins |
||||||
|
|
||||||
|
## Getting started |
||||||
|
|
||||||
|
Plugins are stored in .juci/plugins |
||||||
|
|
||||||
|
### Basic hello world |
||||||
|
from Jucipp import Terminal |
||||||
|
|
||||||
|
print("Hello, world! From before the application is loaded") |
||||||
|
|
||||||
|
def init_hook(): |
||||||
|
t = Terminal() |
||||||
|
t.print("Hello, world! From after the application is started.\n") |
||||||
@ -0,0 +1,116 @@ |
|||||||
|
#include "config.hpp" |
||||||
|
#include "python_type_casters.h" |
||||||
|
#include <pybind11/stl.h> |
||||||
|
|
||||||
|
void Config::init_module(py::module &api) { |
||||||
|
py::class_<Config, std::unique_ptr<Config, py::nodelete>> config(api, "Config"); |
||||||
|
|
||||||
|
py::class_<Config::Menu>(config, "Menu") |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("keys", &Config::Menu::keys) |
||||||
|
|
||||||
|
; |
||||||
|
py::class_<Config::Theme>(config, "Theme") |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("name", &Config::Theme::name) |
||||||
|
.def_readwrite("variant", &Config::Theme::variant) |
||||||
|
.def_readwrite("font", &Config::Theme::font) |
||||||
|
|
||||||
|
; |
||||||
|
py::class_<Config::Terminal>(config, "Terminal") |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("history_size", &Config::Terminal::history_size) |
||||||
|
.def_readwrite("font", &Config::Terminal::font) |
||||||
|
|
||||||
|
; |
||||||
|
py::class_<Config::Project> project(config, "Project"); |
||||||
|
py::class_<Config::Project::CMake>(project, "CMake") |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("command", &Config::Project::CMake::command) |
||||||
|
.def_readwrite("compile_command", &Config::Project::CMake::compile_command) |
||||||
|
|
||||||
|
; |
||||||
|
py::class_<Config::Project::Meson>(project, "Meson") |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("command", &Config::Project::Meson::command) |
||||||
|
.def_readwrite("compile_command", &Config::Project::Meson::compile_command) |
||||||
|
|
||||||
|
; |
||||||
|
project |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("default_build_path", &Config::Project::default_build_path) |
||||||
|
.def_readwrite("debug_build_path", &Config::Project::debug_build_path) |
||||||
|
.def_readwrite("cmake", &Config::Project::cmake) |
||||||
|
.def_readwrite("meson", &Config::Project::meson) |
||||||
|
.def_readwrite("save_on_compile_or_run", &Config::Project::save_on_compile_or_run) |
||||||
|
// .def_readwrite("clear_terminal_on_compile", &Config::Project::clear_terminal_on_compile)
|
||||||
|
.def_readwrite("ctags_command", &Config::Project::ctags_command) |
||||||
|
.def_readwrite("python_command", &Config::Project::python_command) |
||||||
|
|
||||||
|
; |
||||||
|
py::class_<Config::Source> source(config, "Source"); |
||||||
|
py::class_<Config::Source::DocumentationSearch>(source, "DocumentationSearch") |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("separator", &Config::Source::DocumentationSearch::separator) |
||||||
|
.def_readwrite("queries", &Config::Source::DocumentationSearch::queries) |
||||||
|
|
||||||
|
; |
||||||
|
source |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("style", &Config::Source::style) |
||||||
|
.def_readwrite("font", &Config::Source::font) |
||||||
|
.def_readwrite("spellcheck_language", &Config::Source::spellcheck_language) |
||||||
|
.def_readwrite("cleanup_whitespace_characters", &Config::Source::cleanup_whitespace_characters) |
||||||
|
.def_readwrite("show_whitespace_characters", &Config::Source::show_whitespace_characters) |
||||||
|
.def_readwrite("format_style_on_save", &Config::Source::format_style_on_save) |
||||||
|
.def_readwrite("format_style_on_save_if_style_file_found", &Config::Source::format_style_on_save_if_style_file_found) |
||||||
|
.def_readwrite("smart_inserts", &Config::Source::smart_inserts) |
||||||
|
.def_readwrite("show_map", &Config::Source::show_map) |
||||||
|
.def_readwrite("map_font_size", &Config::Source::map_font_size) |
||||||
|
.def_readwrite("show_git_diff", &Config::Source::show_git_diff) |
||||||
|
.def_readwrite("show_background_pattern", &Config::Source::show_background_pattern) |
||||||
|
.def_readwrite("show_right_margin", &Config::Source::show_right_margin) |
||||||
|
.def_readwrite("right_margin_position", &Config::Source::right_margin_position) |
||||||
|
.def_readwrite("auto_tab_char_and_size", &Config::Source::auto_tab_char_and_size) |
||||||
|
.def_readwrite("default_tab_char", &Config::Source::default_tab_char) |
||||||
|
.def_readwrite("default_tab_size", &Config::Source::default_tab_size) |
||||||
|
.def_readwrite("tab_indents_line", &Config::Source::tab_indents_line) |
||||||
|
// .def_readwrite("wrap_lines", &Config::Source::wrap_lines)
|
||||||
|
.def_readwrite("highlight_current_line", &Config::Source::highlight_current_line) |
||||||
|
.def_readwrite("show_line_numbers", &Config::Source::show_line_numbers) |
||||||
|
.def_readwrite("enable_multiple_cursors", &Config::Source::enable_multiple_cursors) |
||||||
|
.def_readwrite("auto_reload_changed_files", &Config::Source::auto_reload_changed_files) |
||||||
|
.def_readwrite("clang_format_style", &Config::Source::clang_format_style) |
||||||
|
.def_readwrite("clang_usages_threads", &Config::Source::clang_usages_threads) |
||||||
|
.def_readwrite("documentation_searches", &Config::Source::documentation_searches) |
||||||
|
|
||||||
|
; |
||||||
|
|
||||||
|
py::class_<Config::Log>(config, "Log") |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("libclang", &Config::Log::libclang) |
||||||
|
.def_readwrite("language_server", &Config::Log::language_server) |
||||||
|
|
||||||
|
; |
||||||
|
py::class_<Config::Plugins>(config, "Plugins") |
||||||
|
.def(py::init()) |
||||||
|
.def_readwrite("enabled", &Config::Plugins::enabled) |
||||||
|
.def_readwrite("path", &Config::Plugins::path) |
||||||
|
|
||||||
|
; |
||||||
|
config |
||||||
|
.def(py::init([]() { return &(Config::get()); })) |
||||||
|
.def("load", &Config::load) |
||||||
|
.def_readonly("version", &Config::version) |
||||||
|
.def_readwrite("menu", &Config::menu) |
||||||
|
.def_readwrite("theme", &Config::theme) |
||||||
|
.def_readwrite("terminal", &Config::terminal) |
||||||
|
.def_readwrite("project", &Config::project) |
||||||
|
.def_readwrite("source", &Config::source) |
||||||
|
.def_readwrite("log", &Config::log) |
||||||
|
.def_readwrite("plugins", &Config::plugins) |
||||||
|
.def_readwrite("home_path", &Config::home_path) |
||||||
|
.def_readwrite("home_juci_path", &Config::home_juci_path) |
||||||
|
|
||||||
|
; |
||||||
|
} |
||||||
@ -0,0 +1,438 @@ |
|||||||
|
#pragma once |
||||||
|
#include <string> |
||||||
|
|
||||||
|
/// If you add or remove nodes from the default_config_file, increase the juci
|
||||||
|
/// version number (JUCI_VERSION) in ../CMakeLists.txt to automatically apply
|
||||||
|
/// the changes to user's ~/.juci/config/config.json files
|
||||||
|
const std::string default_config_file = R"RAW({ |
||||||
|
"version": ")RAW" + std::string(JUCI_VERSION) + R"RAW(", |
||||||
|
"gtk_theme": { |
||||||
|
"name_comment": "Use \"\" for default theme, At least these two exist on all systems: Adwaita, Raleigh", |
||||||
|
"name": "", |
||||||
|
"variant_comment": "Use \"\" for default variant, and \"dark\" for dark theme variant. Note that not all themes support dark variant, but for instance Adwaita does", |
||||||
|
"variant": "", |
||||||
|
"font_comment": "Set to override theme font, for instance: \"Arial 12\"", |
||||||
|
"font": "" |
||||||
|
}, |
||||||
|
"source": { |
||||||
|
"style_comment": "Use \"\" for default style, and for instance juci-dark or juci-dark-blue together with dark gtk_theme variant. Styles from normal gtksourceview install: classic, cobalt, kate, oblivion, solarized-dark, solarized-light, tango", |
||||||
|
"style": "juci-light", |
||||||
|
"font_comment": "Use \"\" for default font, and for instance \"Monospace 12\" to also set size",)RAW" |
||||||
|
#ifdef __APPLE__ |
||||||
|
R"RAW( |
||||||
|
"font": "Menlo",)RAW" |
||||||
|
#else |
||||||
|
#ifdef _WIN32 |
||||||
|
R"RAW( |
||||||
|
"font": "Consolas",)RAW" |
||||||
|
#else |
||||||
|
R"RAW( |
||||||
|
"font": "Monospace",)RAW" |
||||||
|
#endif |
||||||
|
#endif |
||||||
|
R"RAW( |
||||||
|
"cleanup_whitespace_characters_comment": "Remove trailing whitespace characters on save, and add trailing newline if missing", |
||||||
|
"cleanup_whitespace_characters": false, |
||||||
|
"show_whitespace_characters_comment": "Determines what kind of whitespaces should be drawn. Use comma-separated list of: space, tab, newline, nbsp, leading, text, trailing or all", |
||||||
|
"show_whitespace_characters": "", |
||||||
|
"format_style_on_save_comment": "Performs style format on save if supported on language in buffer", |
||||||
|
"format_style_on_save": false, |
||||||
|
"format_style_on_save_if_style_file_found_comment": "Format style if format file is found, even if format_style_on_save is false", |
||||||
|
"format_style_on_save_if_style_file_found": true, |
||||||
|
"smart_brackets_comment": "If smart_inserts is enabled, this option is automatically enabled. When inserting an already closed bracket, the cursor might instead be moved, avoiding the need of arrow keys after autocomplete", |
||||||
|
"smart_brackets": true, |
||||||
|
"smart_inserts_comment": "When for instance inserting (, () gets inserted. Applies to: (), [], \", '. Also enables pressing ; inside an expression before a final ) to insert ; at the end of line, and deletions of empty insertions", |
||||||
|
"smart_inserts": true, |
||||||
|
"show_map": true, |
||||||
|
"map_font_size": "1", |
||||||
|
"show_git_diff": true, |
||||||
|
"show_background_pattern": true, |
||||||
|
"show_right_margin": false, |
||||||
|
"right_margin_position": 80, |
||||||
|
"spellcheck_language_comment": "Use \"\" to set language from your locale settings", |
||||||
|
"spellcheck_language": "en_US", |
||||||
|
"auto_tab_char_and_size_comment": "Use false to always use default tab char and size", |
||||||
|
"auto_tab_char_and_size": true, |
||||||
|
"default_tab_char_comment": "Use \"\t\" for regular tab", |
||||||
|
"default_tab_char": " ", |
||||||
|
"default_tab_size": 2, |
||||||
|
"tab_indents_line": true, |
||||||
|
"word_wrap_comment": "Specify language ids that should enable word wrap, for instance: chdr, c, cpphdr, cpp, js, python, or all to enable word wrap for all languages", |
||||||
|
"word_wrap": "markdown, latex", |
||||||
|
"highlight_current_line": true, |
||||||
|
"show_line_numbers": true, |
||||||
|
"enable_multiple_cursors": false, |
||||||
|
"auto_reload_changed_files": true, |
||||||
|
"search_for_selection": true, |
||||||
|
"clang_format_style_comment": "IndentWidth, AccessModifierOffset and UseTab are set automatically. See http://clang.llvm.org/docs/ClangFormatStyleOptions.html", |
||||||
|
"clang_format_style": "ColumnLimit: 0, NamespaceIndentation: All", |
||||||
|
"clang_tidy_enable_comment": "Enable clang-tidy in new C/C++ buffers", |
||||||
|
"clang_tidy_enable": false, |
||||||
|
"clang_tidy_checks_comment": "In new C/C++ buffers, these checks are appended to the value of 'Checks' in the .clang-tidy file, if any", |
||||||
|
"clang_tidy_checks": "", |
||||||
|
"clang_usages_threads_comment": "The number of threads used in finding usages in unparsed files. -1 corresponds to the number of cores available, and 0 disables the search", |
||||||
|
"clang_usages_threads": -1, |
||||||
|
"clang_detailed_preprocessing_record_comment": "Set to true to, at the cost of increased resource use, include all macro definitions and instantiations when parsing new C/C++ buffers. You should reopen buffers and delete build/.usages_clang after changing this option.", |
||||||
|
"clang_detailed_preprocessing_record": false, |
||||||
|
"debug_place_cursor_at_stop": false |
||||||
|
}, |
||||||
|
"terminal": { |
||||||
|
"history_size": 10000, |
||||||
|
"font_comment": "Use \"\" to use source.font with slightly smaller size", |
||||||
|
"font": "", |
||||||
|
"clear_on_compile": true, |
||||||
|
"clear_on_run_command": false |
||||||
|
}, |
||||||
|
"project": { |
||||||
|
"default_build_path_comment": "Use <project_directory_name> to insert the project top level directory name", |
||||||
|
"default_build_path": "./build", |
||||||
|
"debug_build_path_comment": "Use <project_directory_name> to insert the project top level directory name, and <default_build_path> to insert your default_build_path setting.", |
||||||
|
"debug_build_path": "<default_build_path>/debug", |
||||||
|
"cmake": {)RAW" |
||||||
|
#ifdef _WIN32 |
||||||
|
R"RAW( |
||||||
|
"command": "cmake -G\"MSYS Makefiles\"",)RAW" |
||||||
|
#else |
||||||
|
R"RAW( |
||||||
|
"command": "cmake",)RAW" |
||||||
|
#endif |
||||||
|
R"RAW( |
||||||
|
"compile_command": "cmake --build ." |
||||||
|
}, |
||||||
|
"meson": { |
||||||
|
"command": "meson", |
||||||
|
"compile_command": "ninja" |
||||||
|
}, |
||||||
|
"default_build_management_system_comment": "Select which build management system to use when creating a new C or C++ project, for instance \"cmake\" or \"meson\"", |
||||||
|
"default_build_management_system": "cmake", |
||||||
|
"save_on_compile_or_run": true,)RAW" |
||||||
|
#ifdef JUCI_USE_UCTAGS |
||||||
|
R"RAW( |
||||||
|
"ctags_command": "uctags",)RAW" |
||||||
|
#else |
||||||
|
R"RAW( |
||||||
|
"ctags_command": "ctags",)RAW" |
||||||
|
#endif |
||||||
|
R"RAW( |
||||||
|
"grep_command": "grep", |
||||||
|
"cargo_command": "cargo", |
||||||
|
"python_command": "python -u", |
||||||
|
"markdown_command": "grip -b" |
||||||
|
}, |
||||||
|
"keybindings": { |
||||||
|
"preferences": "<primary>comma", |
||||||
|
"snippets": "", |
||||||
|
"quit": "<primary>q", |
||||||
|
"file_new_file": "<primary>n", |
||||||
|
"file_new_folder": "<primary><shift>n", |
||||||
|
"file_open_file": "<primary>o", |
||||||
|
"file_open_folder": "<primary><shift>o", |
||||||
|
"file_reload_file": "", |
||||||
|
"file_save": "<primary>s", |
||||||
|
"file_save_as": "<primary><shift>s", |
||||||
|
"file_close_file": "<primary>w", |
||||||
|
"file_close_folder": "", |
||||||
|
"file_close_project": "", |
||||||
|
"file_print": "", |
||||||
|
"edit_undo": "<primary>z", |
||||||
|
"edit_redo": "<primary><shift>z", |
||||||
|
"edit_cut": "<primary>x", |
||||||
|
"edit_cut_lines": "<primary><shift>x", |
||||||
|
"edit_copy": "<primary>c", |
||||||
|
"edit_copy_lines": "<primary><shift>c", |
||||||
|
"edit_paste": "<primary>v", |
||||||
|
"edit_extend_selection": "<primary><shift>a", |
||||||
|
"edit_shrink_selection": "<primary><shift><alt>a", |
||||||
|
"edit_show_or_hide": "", |
||||||
|
"edit_find": "<primary>f", |
||||||
|
"source_spellcheck": "", |
||||||
|
"source_spellcheck_clear": "", |
||||||
|
"source_spellcheck_next_error": "<primary><shift>e", |
||||||
|
"source_git_next_diff": "<primary>k", |
||||||
|
"source_git_show_diff": "<alt>k", |
||||||
|
"source_indentation_set_buffer_tab": "", |
||||||
|
"source_indentation_auto_indent_buffer": "<primary><shift>i", |
||||||
|
"source_goto_line": "<primary>g", |
||||||
|
"source_center_cursor": "<primary>l", |
||||||
|
"source_cursor_history_back": "<alt>Left", |
||||||
|
"source_cursor_history_forward": "<alt>Right", |
||||||
|
"source_show_completion_comment" : "Add completion keybinding to disable interactive autocompletion", |
||||||
|
"source_show_completion" : "", |
||||||
|
"source_find_file": "<primary>p", |
||||||
|
"source_find_symbol": "<primary><shift>f", |
||||||
|
"source_find_pattern": "<alt><shift>f", |
||||||
|
"source_comments_toggle": "<primary>slash", |
||||||
|
"source_comments_add_documentation": "<primary><alt>slash", |
||||||
|
"source_find_documentation": "<primary><shift>d", |
||||||
|
"source_goto_declaration": "<primary>d", |
||||||
|
"source_goto_type_declaration": "<alt><shift>d", |
||||||
|
"source_goto_implementation": "<primary>i", |
||||||
|
"source_goto_usage": "<primary>u", |
||||||
|
"source_goto_method": "<primary>m", |
||||||
|
"source_rename": "<primary>r", |
||||||
|
"source_implement_method": "<primary><shift>m", |
||||||
|
"source_goto_next_diagnostic": "<primary>e", |
||||||
|
"source_apply_fix_its": "<control>space", |
||||||
|
"project_set_run_arguments": "", |
||||||
|
"project_compile_and_run": "<primary>Return", |
||||||
|
"project_compile": "<primary><shift>Return", |
||||||
|
"project_run_command": "<alt>Return", |
||||||
|
"project_kill_last_running": "<primary>Escape", |
||||||
|
"project_force_kill_last_running": "<primary><shift>Escape", |
||||||
|
"debug_set_run_arguments": "", |
||||||
|
"debug_start_continue": "<primary>y", |
||||||
|
"debug_stop": "<primary><shift>y", |
||||||
|
"debug_kill": "<primary><shift>k", |
||||||
|
"debug_step_over": "<primary>j", |
||||||
|
"debug_step_into": "<primary>t", |
||||||
|
"debug_step_out": "<primary><shift>t", |
||||||
|
"debug_backtrace": "<primary><shift>j", |
||||||
|
"debug_show_variables": "<primary><shift>b", |
||||||
|
"debug_run_command": "<alt><shift>Return", |
||||||
|
"debug_toggle_breakpoint": "<primary>b", |
||||||
|
"debug_show_breakpoints": "<primary><shift><alt>b", |
||||||
|
"debug_goto_stop": "<primary><shift>l",)RAW" |
||||||
|
#ifdef __linux |
||||||
|
R"RAW( |
||||||
|
"window_next_tab": "<primary>Tab", |
||||||
|
"window_previous_tab": "<primary><shift>Tab",)RAW" |
||||||
|
#else |
||||||
|
R"RAW( |
||||||
|
"window_next_tab": "<primary><alt>Right", |
||||||
|
"window_previous_tab": "<primary><alt>Left",)RAW" |
||||||
|
#endif |
||||||
|
R"RAW( |
||||||
|
"window_goto_tab": "", |
||||||
|
"window_toggle_split": "", |
||||||
|
"window_split_source_buffer": "",)RAW" |
||||||
|
#ifdef __APPLE__ |
||||||
|
R"RAW( |
||||||
|
"window_toggle_full_screen": "<primary><control>f",)RAW" |
||||||
|
#else |
||||||
|
R"RAW( |
||||||
|
"window_toggle_full_screen": "F11",)RAW" |
||||||
|
#endif |
||||||
|
R"RAW( |
||||||
|
"window_toggle_tabs": "", |
||||||
|
"window_toggle_zen_mode": "", |
||||||
|
"window_clear_terminal": "" |
||||||
|
}, |
||||||
|
"documentation_searches": { |
||||||
|
"clang": { |
||||||
|
"separator": "::", |
||||||
|
"queries": { |
||||||
|
"@empty": "https://www.google.com/search?q=c%2B%2B+", |
||||||
|
"std": "https://www.google.com/search?q=site:http://www.cplusplus.com/reference/+", |
||||||
|
"boost": "https://www.google.com/search?q=site:http://www.boost.org/doc/libs/1_59_0/+", |
||||||
|
"Gtk": "https://www.google.com/search?q=site:https://developer.gnome.org/gtkmm/stable/+", |
||||||
|
"@any": "https://www.google.com/search?q=" |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"log": { |
||||||
|
"libclang_comment": "Outputs diagnostics for new C/C++ buffers", |
||||||
|
"libclang": false, |
||||||
|
"language_server": false |
||||||
|
}, |
||||||
|
"plugins": { |
||||||
|
"enabled": true, |
||||||
|
"path_comment": "Directory where plugins are loaded from.", |
||||||
|
"path": "<juci_home_directory>/plugins" |
||||||
|
} |
||||||
|
} |
||||||
|
)RAW"; |
||||||
|
|
||||||
|
const std::string juci_light_style = R"RAW(<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
|
||||||
|
<style-scheme id="juci-light" _name="juci" version="1.0"> |
||||||
|
<author>juCi++ team</author> |
||||||
|
<_description>Default juCi++ style</_description> |
||||||
|
|
||||||
|
<!-- Palette --> |
||||||
|
<color name="white" value="#FFFFFF"/> |
||||||
|
<color name="black" value="#000000"/> |
||||||
|
<color name="gray" value="#888888"/> |
||||||
|
<color name="red" value="#CC0000"/> |
||||||
|
<color name="green" value="#008800"/> |
||||||
|
<color name="blue" value="#0000FF"/> |
||||||
|
<color name="dark-blue" value="#002299"/> |
||||||
|
<color name="yellow" value="#FFFF00"/> |
||||||
|
<color name="light-yellow" value="#FFFF88"/> |
||||||
|
<color name="orange" value="#FF8800"/> |
||||||
|
<color name="purple" value="#990099"/> |
||||||
|
|
||||||
|
<style name="text" foreground="#000000" background="#FFFFFF"/> |
||||||
|
<style name="background-pattern" background="#rgba(0,0,0,.03)"/> |
||||||
|
<style name="selection" background="#4A90D9"/> |
||||||
|
|
||||||
|
<!-- Current Line Highlighting --> |
||||||
|
<style name="current-line" background="#rgba(0,0,0,.07)"/> |
||||||
|
|
||||||
|
<!-- Bracket Matching --> |
||||||
|
<style name="bracket-match" foreground="white" background="gray" bold="true"/> |
||||||
|
<style name="bracket-mismatch" foreground="white" background="#FF0000" bold="true"/> |
||||||
|
|
||||||
|
<!-- Search Matching --> |
||||||
|
<style name="search-match" foreground="#000000" background="#FFFF00"/> |
||||||
|
|
||||||
|
<!-- Language specifics --> |
||||||
|
<style name="def:builtin" foreground="blue"/> |
||||||
|
<style name="def:constant" foreground="blue"/> |
||||||
|
<style name="def:boolean" foreground="red"/> |
||||||
|
<style name="def:decimal" foreground="red"/> |
||||||
|
<style name="def:base-n-integer" foreground="red"/> |
||||||
|
<style name="def:floating-point" foreground="red"/> |
||||||
|
<style name="def:complex" foreground="red"/> |
||||||
|
<style name="def:character" foreground="red"/> |
||||||
|
<style name="def:special-char" foreground="red"/> |
||||||
|
|
||||||
|
<!-- Language specifics used by clang-parser in default config --> |
||||||
|
<style name="def:string" foreground="red"/> |
||||||
|
<style name="def:comment" foreground="gray"/> |
||||||
|
<style name="def:statement" foreground="blue"/> |
||||||
|
<style name="def:type" foreground="blue"/> |
||||||
|
<style name="def:function" foreground="dark-blue"/> |
||||||
|
<style name="def:identifier" foreground="purple"/> |
||||||
|
<style name="def:preprocessor" foreground="green"/> |
||||||
|
<style name="def:error" foreground="red"/> |
||||||
|
<style name="def:warning" foreground="orange"/> |
||||||
|
<style name="def:note" foreground="black" background="light-yellow"/> |
||||||
|
|
||||||
|
<style name="diff:added-line" foreground="green"/> |
||||||
|
<style name="diff:removed-line" foreground="red"/> |
||||||
|
<style name="diff:changed-line" foreground="orange"/> |
||||||
|
<style name="diff:diff-file" use-style="def:type"/> |
||||||
|
<style name="diff:location" use-style="def:statement"/> |
||||||
|
<style name="diff:special-case" use-style="def:constant"/> |
||||||
|
|
||||||
|
</style-scheme> |
||||||
|
)RAW"; |
||||||
|
|
||||||
|
const std::string juci_dark_style = R"RAW(<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
|
||||||
|
<style-scheme id="juci-dark" _name="juci" version="1.0"> |
||||||
|
<author>juCi++ team</author> |
||||||
|
<_description>Dark juCi++ style</_description> |
||||||
|
|
||||||
|
<!-- Palette --> |
||||||
|
<color name="white" value="#D6D6D6"/> |
||||||
|
<color name="black" value="#202428"/> |
||||||
|
<color name="gray" value="#919191"/> |
||||||
|
<color name="red" value="#FF9999"/> |
||||||
|
<color name="yellow" value="#EEEE66"/> |
||||||
|
<color name="green" value="#AACC99"/> |
||||||
|
<color name="blue" value="#88AAFF"/> |
||||||
|
<color name="light-blue" value="#AABBEE"/> |
||||||
|
<color name="purple" value="#DD99DD"/> |
||||||
|
|
||||||
|
<style name="text" foreground="white" background="black"/> |
||||||
|
<style name="background-pattern" background="#rgba(255,255,255,.04)"/> |
||||||
|
<style name="selection" background="#215D9C"/> |
||||||
|
|
||||||
|
<!-- Current Line Highlighting --> |
||||||
|
<style name="current-line" background="#rgba(255,255,255,.05)"/> |
||||||
|
|
||||||
|
<!-- Bracket Matching --> |
||||||
|
<style name="bracket-match" foreground="black" background="gray" bold="true"/> |
||||||
|
<style name="bracket-mismatch" foreground="black" background="#FF0000" bold="true"/> |
||||||
|
|
||||||
|
<!-- Search Matching --> |
||||||
|
<style name="search-match" foreground="#000000" background="#FFFF00"/> |
||||||
|
|
||||||
|
<!-- Language specifics --> |
||||||
|
<style name="def:builtin" foreground="blue"/> |
||||||
|
<style name="def:constant" foreground="blue"/> |
||||||
|
<style name="def:boolean" foreground="red"/> |
||||||
|
<style name="def:decimal" foreground="red"/> |
||||||
|
<style name="def:base-n-integer" foreground="red"/> |
||||||
|
<style name="def:floating-point" foreground="red"/> |
||||||
|
<style name="def:complex" foreground="red"/> |
||||||
|
<style name="def:character" foreground="red"/> |
||||||
|
<style name="def:special-char" foreground="red"/> |
||||||
|
|
||||||
|
<!-- Language specifics used by clang-parser in default config --> |
||||||
|
<style name="def:string" foreground="red"/> |
||||||
|
<style name="def:comment" foreground="gray"/> |
||||||
|
<style name="def:statement" foreground="blue"/> |
||||||
|
<style name="def:type" foreground="blue"/> |
||||||
|
<style name="def:function" foreground="light-blue"/> |
||||||
|
<style name="def:identifier" foreground="purple"/> |
||||||
|
<style name="def:preprocessor" foreground="green"/> |
||||||
|
<style name="def:error" foreground="red"/> |
||||||
|
<style name="def:warning" foreground="yellow"/> |
||||||
|
<style name="def:note" foreground="#E6E6E6" background="#383F46"/> |
||||||
|
|
||||||
|
<style name="diff:added-line" foreground="green"/> |
||||||
|
<style name="diff:removed-line" foreground="red"/> |
||||||
|
<style name="diff:changed-line" foreground="yellow"/> |
||||||
|
<style name="diff:diff-file" use-style="def:type"/> |
||||||
|
<style name="diff:location" use-style="def:statement"/> |
||||||
|
<style name="diff:special-case" use-style="def:constant"/> |
||||||
|
|
||||||
|
</style-scheme> |
||||||
|
)RAW"; |
||||||
|
|
||||||
|
const std::string juci_dark_blue_style = R"RAW(<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
|
||||||
|
<style-scheme id="juci-dark-blue" _name="juci" version="1.0"> |
||||||
|
<author>juCi++ team</author> |
||||||
|
<_description>Dark blue juCi++ style based on the Emacs deeper blue theme</_description> |
||||||
|
|
||||||
|
<!-- Palette --> |
||||||
|
<color name="white" value="#D6D6D6"/> |
||||||
|
<color name="dark-blue" value="#202233"/> |
||||||
|
<color name="gray" value="#919191"/> |
||||||
|
<color name="red" value="#FF7777"/> |
||||||
|
<color name="yellow" value="#FFE100"/> |
||||||
|
<color name="light-yellow" value="#EAC595"/> |
||||||
|
<color name="blue" value="#00CCFF"/> |
||||||
|
<color name="green" value="#14ECA8"/> |
||||||
|
<color name="light-blue" value="#8BFAFF"/> |
||||||
|
<color name="light-green" value="#A0DB6B"/> |
||||||
|
|
||||||
|
<style name="text" foreground="white" background="dark-blue"/> |
||||||
|
<style name="background-pattern" background="#rgba(255,255,255,.04)"/> |
||||||
|
<style name="selection" background="#215D9C"/> |
||||||
|
|
||||||
|
<!-- Current Line Highlighting --> |
||||||
|
<style name="current-line" background="#rgba(255,255,255,.05)"/> |
||||||
|
|
||||||
|
<!-- Bracket Matching --> |
||||||
|
<style name="bracket-match" foreground="dark-blue" background="gray" bold="true"/> |
||||||
|
<style name="bracket-mismatch" foreground="dark-blue" background="#FF0000" bold="true"/> |
||||||
|
|
||||||
|
<!-- Search Matching --> |
||||||
|
<style name="search-match" foreground="#000000" background="#FFFF00"/> |
||||||
|
|
||||||
|
<!-- Language specifics --> |
||||||
|
<style name="def:builtin" foreground="blue"/> |
||||||
|
<style name="def:constant" foreground="blue"/> |
||||||
|
<style name="def:boolean" foreground="light-yellow"/> |
||||||
|
<style name="def:decimal" foreground="light-yellow"/> |
||||||
|
<style name="def:base-n-integer" foreground="light-yellow"/> |
||||||
|
<style name="def:floating-point" foreground="light-yellow"/> |
||||||
|
<style name="def:complex" foreground="light-yellow"/> |
||||||
|
<style name="def:character" foreground="light-yellow"/> |
||||||
|
<style name="def:special-char" foreground="light-yellow"/> |
||||||
|
|
||||||
|
<!-- Language specifics used by clang-parser in default config --> |
||||||
|
<style name="def:string" foreground="light-yellow"/> |
||||||
|
<style name="def:comment" foreground="gray"/> |
||||||
|
<style name="def:statement" foreground="blue"/> |
||||||
|
<style name="def:type" foreground="blue"/> |
||||||
|
<style name="def:function" foreground="light-blue"/> |
||||||
|
<style name="def:identifier" foreground="light-green"/> |
||||||
|
<style name="def:preprocessor" foreground="yellow"/> |
||||||
|
<style name="def:error" foreground="red"/> |
||||||
|
<style name="def:warning" foreground="yellow"/> |
||||||
|
<style name="def:note" foreground="#E6E6E6" background="#383C59"/> |
||||||
|
|
||||||
|
<style name="diff:added-line" foreground="green"/> |
||||||
|
<style name="diff:removed-line" foreground="red"/> |
||||||
|
<style name="diff:changed-line" foreground="yellow"/> |
||||||
|
<style name="diff:diff-file" use-style="def:type"/> |
||||||
|
<style name="diff:location" use-style="def:statement"/> |
||||||
|
<style name="diff:special-case" use-style="def:constant"/> |
||||||
|
|
||||||
|
</style-scheme> |
||||||
|
)RAW"; |
||||||
@ -0,0 +1,79 @@ |
|||||||
|
#include "plugins.h" |
||||||
|
#include "config.hpp" |
||||||
|
#include "python_module.h" |
||||||
|
#include "terminal.hpp" |
||||||
|
|
||||||
|
Plugins::Plugins(Config &config) : jucipp_module("Jucipp", Module::init_jucipp_module) { |
||||||
|
#ifdef PYTHON_HOME_DIR |
||||||
|
#ifdef _WIN32 |
||||||
|
const std::wstring python_home(PYTHON_HOME_DIR); |
||||||
|
const std::wstring python_path(python_home + L";" + python_home + L"\\lib-dynload;" + python_home + L"\\site-packages"); |
||||||
|
Py_SetPythonHome(python_home.c_str()); |
||||||
|
Py_SetPath(python_path.c_str()); |
||||||
|
#endif |
||||||
|
#endif |
||||||
|
py::initialize_interpreter(); |
||||||
|
py::module::import("sys") |
||||||
|
.attr("path") |
||||||
|
.cast<py::list>() |
||||||
|
.append(config.plugins.path); |
||||||
|
} |
||||||
|
|
||||||
|
Plugins::~Plugins() { |
||||||
|
py::finalize_interpreter(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void Plugins::init_hook() { |
||||||
|
for(auto &module_name : loaded_modules) { |
||||||
|
auto module = py::module(py::handle(PyImport_GetModule(py::str(module_name.c_str()).ptr())), false); |
||||||
|
if(py::hasattr(module, "init_hook")) { |
||||||
|
py::object obj = module.attr("init_hook"); |
||||||
|
if(py::isinstance<py::function>(obj)) { |
||||||
|
py::function func(obj); |
||||||
|
try { |
||||||
|
func(); |
||||||
|
} |
||||||
|
catch(const py::error_already_set &err) { |
||||||
|
std::cerr << err.what() << std::endl; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void Plugins::load() { |
||||||
|
const auto &plugin_path = Config::get().plugins.path; |
||||||
|
|
||||||
|
boost::system::error_code ec; |
||||||
|
if(!boost::filesystem::exists(plugin_path, ec)) { |
||||||
|
ec.clear(); |
||||||
|
boost::filesystem::create_directories(plugin_path, ec); |
||||||
|
} |
||||||
|
|
||||||
|
if(ec) { |
||||||
|
std::cerr << ec.message() << std::endl; |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
boost::filesystem::directory_iterator end_it; |
||||||
|
|
||||||
|
for(boost::filesystem::directory_iterator it(plugin_path); it != end_it; it++) { |
||||||
|
auto module_name = it->path().stem().string(); |
||||||
|
if(module_name.empty()) |
||||||
|
continue; |
||||||
|
const auto is_directory = boost::filesystem::is_directory(it->path()); |
||||||
|
const auto has_py_extension = it->path().extension() == ".py"; |
||||||
|
const auto is_pycache = module_name == "__pycache__"; |
||||||
|
if((is_directory && !is_pycache) || has_py_extension) { |
||||||
|
try { |
||||||
|
auto module = py::module::import(module_name.c_str()); |
||||||
|
loaded_modules.push_back(module_name); |
||||||
|
} |
||||||
|
catch(py::error_already_set &error) { |
||||||
|
std::cerr << "Error loading plugin `" << module_name << "`:\n" |
||||||
|
<< error.what() << "\n"; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
#pragma once |
||||||
|
#include "config.hpp" |
||||||
|
#include "python_bind.h" |
||||||
|
#include <pybind11/embed.h> |
||||||
|
|
||||||
|
class __attribute__((visibility("default"))) |
||||||
|
Plugins { |
||||||
|
public: |
||||||
|
Plugins(Config &config); |
||||||
|
~Plugins(); |
||||||
|
void load(); |
||||||
|
|
||||||
|
void init_hook(); |
||||||
|
|
||||||
|
private: |
||||||
|
py::detail::embedded_module jucipp_module; |
||||||
|
std::vector<std::string> loaded_modules; |
||||||
|
}; |
||||||
@ -0,0 +1,3 @@ |
|||||||
|
#pragma once |
||||||
|
#include <pybind11/pybind11.h> |
||||||
|
namespace py = pybind11; |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
#include "python_module.h" |
||||||
|
#include "cmake.hpp" |
||||||
|
#include "compile_commands.hpp" |
||||||
|
#include "config.hpp" |
||||||
|
#include "ctags.hpp" |
||||||
|
#ifdef JUCI_ENABLE_DEBUG |
||||||
|
#include "debug_lldb.hpp" |
||||||
|
#endif |
||||||
|
#include "dialogs.hpp" |
||||||
|
#include "git.hpp" |
||||||
|
#include "terminal.hpp" |
||||||
|
#include "tiny_process_module.hpp" |
||||||
|
|
||||||
|
PyObject *Module::init_jucipp_module() { |
||||||
|
auto api = py::module("Jucipp", "API"); |
||||||
|
CMake::init_module(api); |
||||||
|
CompileCommands::init_module(api); |
||||||
|
Config::init_module(api); |
||||||
|
Ctags::init_module(api); |
||||||
|
#ifdef JUCI_ENABLE_DEBUG |
||||||
|
Debug::LLDB::init_module(api); |
||||||
|
#endif |
||||||
|
Dialog::init_module(api); |
||||||
|
Dispatcher::init_module(api); |
||||||
|
Git::init_module(api); |
||||||
|
Terminal::init_module(api); |
||||||
|
TinyProcessModule::init_module(api); |
||||||
|
return api.ptr(); |
||||||
|
} |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
#pragma once |
||||||
|
#include "python_bind.h" |
||||||
|
|
||||||
|
class Module { |
||||||
|
public: |
||||||
|
static PyObject *init_jucipp_module(); |
||||||
|
}; |
||||||
@ -0,0 +1,28 @@ |
|||||||
|
#pragma once |
||||||
|
#include "python_bind.h" |
||||||
|
#include <boost/filesystem.hpp> |
||||||
|
|
||||||
|
namespace pybind11 { |
||||||
|
namespace detail { |
||||||
|
template <> |
||||||
|
struct type_caster<boost::filesystem::path> { |
||||||
|
public: |
||||||
|
PYBIND11_TYPE_CASTER(boost::filesystem::path, _("str")); |
||||||
|
bool load(handle src, bool) { |
||||||
|
if (!src) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
try { |
||||||
|
value = std::string(py::str(src)); |
||||||
|
} catch(...) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
return !PyErr_Occurred(); |
||||||
|
} |
||||||
|
|
||||||
|
static handle cast(boost::filesystem::path src, return_value_policy, handle) { |
||||||
|
return pybind11::str(src.string()).release(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} // namespace detail
|
||||||
|
} // namespace pybind11
|
||||||
@ -0,0 +1,27 @@ |
|||||||
|
#include "tiny_process_module.hpp" |
||||||
|
#include <process.hpp> |
||||||
|
|
||||||
|
void TinyProcessModule::init_module(py::module &api) { |
||||||
|
py::class_<TinyProcessLib::Process, std::shared_ptr<TinyProcessLib::Process>> process(api, "Process"); |
||||||
|
process |
||||||
|
// .def("kill", (void (TinyProcessLib::Process::*)(TinyProcessLib::Process::id_type, bool)) & TinyProcessLib::Process::kill,
|
||||||
|
// py::arg("id"),
|
||||||
|
// py::arg("force") = false)
|
||||||
|
// .def(py::init<const TinyProcessLib::Process::string_type &, const TinyProcessLib::Process::string_type &>(),
|
||||||
|
// py::arg("command"),
|
||||||
|
// py::arg("path") = TinyProcessLib::Process::string_type())
|
||||||
|
.def("get_id", &TinyProcessLib::Process::get_id) |
||||||
|
.def("get_exit_status", &TinyProcessLib::Process::get_exit_status) |
||||||
|
.def("try_get_exit_status", &TinyProcessLib::Process::try_get_exit_status, |
||||||
|
py::arg("exit_status")) |
||||||
|
.def("write", (bool (TinyProcessLib::Process::*)(const char *, size_t)) & TinyProcessLib::Process::write, |
||||||
|
py::arg("bytes"), |
||||||
|
py::arg("n")) |
||||||
|
.def("write", (bool (TinyProcessLib::Process::*)(const std::string &)) & TinyProcessLib::Process::write, |
||||||
|
py::arg("string")) |
||||||
|
.def("close_stdin", &TinyProcessLib::Process::close_stdin) |
||||||
|
.def("kill", (void (TinyProcessLib::Process::*)(bool)) & TinyProcessLib::Process::kill, |
||||||
|
py::arg("force")) |
||||||
|
|
||||||
|
; |
||||||
|
} |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
#include "python_bind.h" |
||||||
|
|
||||||
|
class TinyProcessModule { |
||||||
|
public: |
||||||
|
static void init_module(py::module &api); |
||||||
|
}; |
||||||
@ -0,0 +1,34 @@ |
|||||||
|
add_library(test_suite test_suite.cc) |
||||||
|
target_link_libraries(test_suite juci_shared ${PYTHON_LIBRARIES}) |
||||||
|
|
||||||
|
include_directories(${CMAKE_SOURCE_DIR}/tests/python_bindings) |
||||||
|
|
||||||
|
add_executable(pb_terminal_test Terminal_tests/terminal_test.cc $<TARGET_OBJECTS:test_stubs>) |
||||||
|
target_link_libraries(pb_terminal_test test_suite) |
||||||
|
add_test(pb_terminal_test pb_terminal_test) |
||||||
|
|
||||||
|
add_executable(pb_python_module_test PythonModule_tests/python_module_test.cc $<TARGET_OBJECTS:test_stubs>) |
||||||
|
target_link_libraries(pb_python_module_test test_suite) |
||||||
|
add_test(pb_python_module_test pb_python_module_test) |
||||||
|
|
||||||
|
add_executable(pb_cmake_test CMake_tests/cmake_test.cc $<TARGET_OBJECTS:test_stubs>) |
||||||
|
target_link_libraries(pb_cmake_test test_suite) |
||||||
|
add_test(pb_cmake_test pb_cmake_test) |
||||||
|
|
||||||
|
add_executable(pb_compile_commands_test CompileCommands_tests/compile_commands_test.cc $<TARGET_OBJECTS:test_stubs>) |
||||||
|
target_link_libraries(pb_compile_commands_test test_suite) |
||||||
|
add_test(pb_compile_commands_test pb_compile_commands_test) |
||||||
|
|
||||||
|
add_executable(pb_config_test Config_tests/config_test.cc $<TARGET_OBJECTS:test_stubs>) |
||||||
|
target_link_libraries(pb_config_test test_suite) |
||||||
|
add_test(pb_config_test pb_config_test) |
||||||
|
|
||||||
|
# add_executable(pb_ctags_test Ctags_tests/ctags_test.cc $<TARGET_OBJECTS:test_stubs>) |
||||||
|
# target_link_libraries(pb_ctags_test test_suite) |
||||||
|
# add_test(pb_ctags_test pb_ctags_test) |
||||||
|
|
||||||
|
if(LIBLLDB_FOUND AND NOT DEBIAN_STRETCH_FOUND) |
||||||
|
add_executable(pb_debug_lldb_test Debug_lldb_tests/debug_lldb_test.cc $<TARGET_OBJECTS:test_stubs>) |
||||||
|
target_link_libraries(pb_debug_lldb_test test_suite) |
||||||
|
add_test(pb_debug_lldb_test pb_debug_lldb_test) |
||||||
|
endif() |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
#include "test_suite.h" |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
int main() { |
||||||
|
auto &config = Config::get(); |
||||||
|
#ifdef _WIN32 |
||||||
|
config.project.cmake.command = "cmake -G\"MSYS Makefiles\" -DCMAKE_INSTALL_PREFIX=/mingw64"; |
||||||
|
#else |
||||||
|
config.project.cmake.command = "cmake"; |
||||||
|
#endif |
||||||
|
auto suite_name = "CMake_tests"; |
||||||
|
suite test_suite(suite_name); |
||||||
|
auto module = py::module::import("cmake_test"); |
||||||
|
|
||||||
|
try { |
||||||
|
module.attr("run")((test_suite.test_file_path / "cmake_project").string()); |
||||||
|
test_suite.has_assertion = true; |
||||||
|
} catch(const py::error_already_set &error){ |
||||||
|
std::cout << error.what(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
from Jucipp import CMake |
||||||
|
|
||||||
|
from jucipp_test import assert_equal |
||||||
|
|
||||||
|
def run(project_path): |
||||||
|
cmake = CMake(project_path) |
||||||
|
assert_equal(project_path, cmake.project_path) |
||||||
|
default_build_path = project_path + "/build" |
||||||
|
assert_equal(True, cmake.update_default_build(default_build_path)) |
||||||
|
executable = cmake.get_executable(default_build_path, project_path) |
||||||
|
assert_equal(default_build_path + "/cmake_project", executable) |
||||||
|
default_debug_path = project_path + "/debug" |
||||||
|
assert_equal(True, cmake.update_debug_build(default_debug_path)) |
||||||
|
executable = cmake.get_executable(default_debug_path, project_path) |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
#include "cmake.hpp" |
||||||
|
#include "test_suite.h" |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
int main() { |
||||||
|
auto suite_name = "CompileCommands_tests"; |
||||||
|
suite test_suite(suite_name); |
||||||
|
auto project_path = test_suite.test_file_path / "cmake_project"; |
||||||
|
auto &config = Config::get(); |
||||||
|
#ifdef _WIN32 |
||||||
|
std::string slash = "\\"; |
||||||
|
config.project.cmake.command = "cmake -G\"MSYS Makefiles\" -DCMAKE_INSTALL_PREFIX=/mingw64"; |
||||||
|
#else |
||||||
|
std::string slash = "/"; |
||||||
|
config.project.cmake.command = "cmake"; |
||||||
|
#endif |
||||||
|
CMake cmake(project_path); |
||||||
|
cmake.update_default_build(boost::filesystem::path(project_path) / "build"); |
||||||
|
try { |
||||||
|
auto module = py::module::import("compile_commands_test"); |
||||||
|
module.attr("run")(project_path.make_preferred().string(), slash); |
||||||
|
test_suite.has_assertion = true; |
||||||
|
} |
||||||
|
catch(const py::error_already_set &error) { |
||||||
|
std::cout << error.what(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,37 @@ |
|||||||
|
from Jucipp import CompileCommands |
||||||
|
|
||||||
|
from os import path |
||||||
|
|
||||||
|
from jucipp_test import assert_equal |
||||||
|
|
||||||
|
def run(project_path, slash): |
||||||
|
build_path = project_path + slash + "build" |
||||||
|
cc = CompileCommands(build_path) |
||||||
|
commands = cc.commands |
||||||
|
assert len(commands) == 1, "Wrong length of compile commands" |
||||||
|
command = commands.pop() |
||||||
|
assert_equal(build_path, command.directory) |
||||||
|
assert_equal(project_path + slash + "main.cpp", command.file) |
||||||
|
|
||||||
|
params = command.parameters |
||||||
|
param = path.basename(params.pop()) |
||||||
|
assert_equal("main.cpp", param) |
||||||
|
|
||||||
|
param = params.pop() |
||||||
|
assert_equal("-c", param) |
||||||
|
|
||||||
|
param = params.pop() |
||||||
|
param = params.pop() |
||||||
|
assert_equal("-o", param) |
||||||
|
|
||||||
|
values = command.parameter_values("-c") |
||||||
|
value = path.basename(values.pop()) |
||||||
|
assert_equal("main.cpp", value) |
||||||
|
|
||||||
|
assert_equal(True, CompileCommands.is_source(project_path + slash + "main.cpp")) |
||||||
|
assert_equal(False, CompileCommands.is_header(project_path + slash + "main.cpp")) |
||||||
|
|
||||||
|
arguments = CompileCommands.get_arguments(build_path, project_path + slash + "main.cpp") |
||||||
|
argument = arguments.pop() |
||||||
|
|
||||||
|
assert_equal(build_path, argument) |
||||||
@ -0,0 +1,90 @@ |
|||||||
|
#include "test_suite.h" |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
int main() { |
||||||
|
const auto suite_name = "Config_tests"; |
||||||
|
const auto doTest = [&](const std::string &test, const std::function<void(Config & config)> &assertions) { |
||||||
|
auto &config = Config::get(); |
||||||
|
suite test_suite(suite_name); |
||||||
|
try { |
||||||
|
auto module = py::module::import("config_test"); |
||||||
|
module.attr(test.c_str())(); |
||||||
|
assertions(config); |
||||||
|
test_suite.has_assertion = true; |
||||||
|
} |
||||||
|
catch(const py::error_already_set &error) { |
||||||
|
std::cout << error.what(); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
doTest("menu", [](Config &config) { |
||||||
|
g_assert_cmpstr(config.menu.keys.at("key").c_str(), ==, "value"); |
||||||
|
}); |
||||||
|
|
||||||
|
doTest("theme", [](Config &config) { |
||||||
|
g_assert_cmpstr(config.theme.name.c_str(), ==, "Star Wars"); |
||||||
|
g_assert_cmpstr(config.theme.variant.c_str(), ==, "Instrumental"); |
||||||
|
g_assert_cmpstr(config.theme.font.c_str(), ==, "Imperial"); |
||||||
|
}); |
||||||
|
|
||||||
|
doTest("terminal", [](Config &config) { |
||||||
|
g_assert_cmpstr(config.terminal.font.c_str(), ==, "Comic Sans"); |
||||||
|
g_assert_cmpuint(config.terminal.history_size, ==, 3); |
||||||
|
}); |
||||||
|
|
||||||
|
doTest("project", [](Config &config) { |
||||||
|
g_assert_cmpstr(config.project.default_build_path.c_str(), ==, "/build"); |
||||||
|
g_assert_cmpstr(config.project.debug_build_path.c_str(), ==, "/debug"); |
||||||
|
g_assert_cmpstr(config.project.meson.command.c_str(), ==, "meson"); |
||||||
|
g_assert_cmpstr(config.project.meson.compile_command.c_str(), ==, "meson --build"); |
||||||
|
g_assert_cmpstr(config.project.cmake.command.c_str(), ==, "cmake"); |
||||||
|
g_assert_cmpstr(config.project.cmake.compile_command.c_str(), ==, "cmake --build"); |
||||||
|
g_assert_true(config.project.save_on_compile_or_run); |
||||||
|
// g_assert_false(config.project.clear_terminal_on_compile);
|
||||||
|
g_assert_cmpstr(config.project.ctags_command.c_str(), ==, "ctags"); |
||||||
|
g_assert_cmpstr(config.project.python_command.c_str(), ==, "python"); |
||||||
|
}); |
||||||
|
|
||||||
|
doTest("source", [](Config &config) { |
||||||
|
g_assert_cmpstr(config.source.style.c_str(), ==, "Classical"); |
||||||
|
g_assert_cmpstr(config.source.font.c_str(), ==, "Monospaced"); |
||||||
|
g_assert_cmpstr(config.source.spellcheck_language.c_str(), ==, "Klingon"); |
||||||
|
g_assert_false(config.source.cleanup_whitespace_characters); |
||||||
|
g_assert_cmpstr(config.source.show_whitespace_characters.c_str(), ==, "no"); |
||||||
|
g_assert_false(config.source.format_style_on_save); |
||||||
|
g_assert_false(config.source.format_style_on_save_if_style_file_found); |
||||||
|
g_assert_false(config.source.smart_inserts); |
||||||
|
g_assert_false(config.source.show_map); |
||||||
|
// g_assert_cmpstr(config.source.map_font_size.c_str(), ==, "10px");
|
||||||
|
g_assert_false(config.source.show_git_diff); |
||||||
|
g_assert_false(config.source.show_background_pattern); |
||||||
|
g_assert_false(config.source.show_right_margin); |
||||||
|
g_assert_cmpuint(config.source.right_margin_position, ==, 10); |
||||||
|
g_assert_false(config.source.auto_tab_char_and_size); |
||||||
|
g_assert_cmpint(config.source.default_tab_char, ==, 'c'); |
||||||
|
g_assert_cmpuint(config.source.default_tab_size, ==, 1); |
||||||
|
g_assert_false(config.source.tab_indents_line); |
||||||
|
// g_assert_false(config.source.wrap_lines);
|
||||||
|
g_assert_false(config.source.highlight_current_line); |
||||||
|
g_assert_false(config.source.show_line_numbers); |
||||||
|
g_assert_false(config.source.enable_multiple_cursors); |
||||||
|
g_assert_false(config.source.auto_reload_changed_files); |
||||||
|
g_assert_cmpstr(config.source.clang_format_style.c_str(), ==, "CFS"); |
||||||
|
g_assert_cmpuint(config.source.clang_usages_threads, ==, 1); |
||||||
|
g_assert_cmpuint(config.source.documentation_searches.size(), ==, 1); |
||||||
|
auto ds = config.source.documentation_searches.at("cpp"); |
||||||
|
g_assert_cmpstr(ds.separator.c_str(), ==, "::"); |
||||||
|
g_assert_cmpint(ds.queries.size(), ==, 1); |
||||||
|
g_assert_cmpstr(ds.queries.at("key").c_str(), ==, "value"); |
||||||
|
}); |
||||||
|
|
||||||
|
doTest("log", [](Config &config) { |
||||||
|
g_assert_true(config.log.libclang); |
||||||
|
g_assert_false(config.log.language_server); |
||||||
|
}); |
||||||
|
|
||||||
|
doTest("cfg", [](Config &config) { |
||||||
|
g_assert_cmpstr(config.home_juci_path.string().c_str(), ==, "/away"); |
||||||
|
g_assert_cmpstr(config.home_path.string().c_str(), ==, "/home"); |
||||||
|
}); |
||||||
|
} |
||||||
@ -0,0 +1,87 @@ |
|||||||
|
from Jucipp import Config |
||||||
|
|
||||||
|
def menu(): |
||||||
|
menu = Config.Menu() |
||||||
|
menu.keys = { |
||||||
|
'key': 'value', |
||||||
|
} |
||||||
|
Config().menu = menu |
||||||
|
|
||||||
|
def theme(): |
||||||
|
theme = Config.Theme() |
||||||
|
theme.name = "Star Wars" |
||||||
|
theme.variant = "Instrumental" |
||||||
|
theme.font = "Imperial" |
||||||
|
Config().theme = theme |
||||||
|
|
||||||
|
def terminal(): |
||||||
|
terminal = Config.Terminal() |
||||||
|
terminal.font = "Comic Sans" |
||||||
|
terminal.history_size = 3 |
||||||
|
Config().terminal = terminal |
||||||
|
|
||||||
|
def project(): |
||||||
|
project = Config.Project() |
||||||
|
project.default_build_path = "/build" |
||||||
|
project.debug_build_path = "/debug" |
||||||
|
meson = Config.Project.Meson() |
||||||
|
meson.command = "meson" |
||||||
|
meson.compile_command = "meson --build" |
||||||
|
cmake = Config.Project.CMake() |
||||||
|
cmake.command = "cmake" |
||||||
|
cmake.compile_command = "cmake --build" |
||||||
|
project.meson = meson |
||||||
|
project.cmake = cmake |
||||||
|
project.save_on_compile_or_run = True |
||||||
|
# project.clear_terminal_on_compile = False |
||||||
|
project.ctags_command = "ctags" |
||||||
|
project.python_command = "python" |
||||||
|
Config().project = project |
||||||
|
|
||||||
|
def source(): |
||||||
|
source = Config.Source() |
||||||
|
source.style = "Classical" |
||||||
|
source.font = "Monospaced" |
||||||
|
source.spellcheck_language = "Klingon" |
||||||
|
source.cleanup_whitespace_characters = False |
||||||
|
source.show_whitespace_characters = "no" |
||||||
|
source.format_style_on_save = False |
||||||
|
source.format_style_on_save_if_style_file_found = False |
||||||
|
source.smart_inserts = False |
||||||
|
source.show_map = False |
||||||
|
# source.map_font_size = "10px" |
||||||
|
source.show_git_diff = False |
||||||
|
source.show_background_pattern = False |
||||||
|
source.show_right_margin = False |
||||||
|
source.right_margin_position = 10 |
||||||
|
source.auto_tab_char_and_size = False |
||||||
|
source.default_tab_char = "c" |
||||||
|
source.default_tab_size = 1 |
||||||
|
source.tab_indents_line = False |
||||||
|
# source.wrap_lines = False |
||||||
|
source.highlight_current_line = False |
||||||
|
source.show_line_numbers = False |
||||||
|
source.enable_multiple_cursors = False |
||||||
|
source.auto_reload_changed_files = False |
||||||
|
source.clang_format_style = "CFS" |
||||||
|
source.clang_usages_threads = 1 |
||||||
|
documentation_search = Config.Source.DocumentationSearch() |
||||||
|
documentation_search.separator = '::' |
||||||
|
documentation_search.queries = { |
||||||
|
'key': 'value', |
||||||
|
} |
||||||
|
source.documentation_searches = { |
||||||
|
'cpp' : documentation_search |
||||||
|
} |
||||||
|
Config().source = source |
||||||
|
|
||||||
|
def log(): |
||||||
|
log = Config.Log() |
||||||
|
log.libclang = True |
||||||
|
log.language_server = False |
||||||
|
Config().log = log |
||||||
|
|
||||||
|
def cfg(): |
||||||
|
config = Config() |
||||||
|
config.home_path = "/home" |
||||||
|
config.home_juci_path = "/away" |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
#include "test_suite.h" |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
int main() { |
||||||
|
auto &config = Config::get(); |
||||||
|
config.project.ctags_command = "ctags"; |
||||||
|
#ifdef _WIN32 |
||||||
|
std::string slash = "\\"; |
||||||
|
config.project.cmake.command = |
||||||
|
"cmake -G\"MSYS Makefiles\" -DCMAKE_INSTALL_PREFIX=/mingw64"; |
||||||
|
#else |
||||||
|
auto slash = "/"; |
||||||
|
config.project.cmake.command = "cmake"; |
||||||
|
#endif |
||||||
|
auto suite_name = "Ctags_tests"; |
||||||
|
|
||||||
|
{ |
||||||
|
auto doTest = [&](auto test) { |
||||||
|
auto test_suite = suite(suite_name); |
||||||
|
{ |
||||||
|
auto module = py::module::import("ctags_test"); |
||||||
|
test_suite.has_assertion = false; |
||||||
|
auto project_path = (test_suite.test_file_path / "cmake_project") |
||||||
|
.make_preferred() |
||||||
|
.string(); |
||||||
|
try { |
||||||
|
module.attr(test)(project_path, slash); |
||||||
|
test_suite.has_assertion = true; |
||||||
|
} |
||||||
|
catch(const std::exception &error) { |
||||||
|
std::cout << error.what(); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
doTest("get_location"); |
||||||
|
doTest("get_locations"); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
from Jucipp import Ctags |
||||||
|
from jucipp_test import assert_equal |
||||||
|
|
||||||
|
def get_location(a, b): |
||||||
|
line = 'main main.cpp /^int main() { return 0; }$/;" line:1' |
||||||
|
location = Ctags.get_location(line, False) |
||||||
|
if location: |
||||||
|
assert_equal('main.cpp', location.file_path) |
||||||
|
assert_equal(0, location.line) |
||||||
|
assert_equal(4, location.index) |
||||||
|
assert_equal('main', location.symbol) |
||||||
|
assert_equal('', location.scope) |
||||||
|
assert_equal('int main() { return 0; }', location.source) |
||||||
|
else: |
||||||
|
raise ValueError('File path was empty') |
||||||
|
|
||||||
|
def get_locations(project_path, slash): |
||||||
|
path = project_path + slash + 'main.cpp' |
||||||
|
locations = Ctags.get_locations(project_path + slash + 'main.cpp', 'main', 'int ()') |
||||||
|
assert_equal(len(locations), 1) |
||||||
|
location = locations[0]; |
||||||
|
assert_equal(path, location.file_path) |
||||||
|
assert_equal(0, location.line) |
||||||
|
assert_equal(4, location.index) |
||||||
|
assert_equal('main', location.symbol) |
||||||
|
assert_equal('', location.scope) |
||||||
|
assert_equal('int main() { return 0; }', location.source) |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
#include "test_suite.h" |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
int main() { |
||||||
|
auto &config = Config::get(); |
||||||
|
config.project.ctags_command = "ctags"; |
||||||
|
auto suite_name = "Debug_lldb_tests"; |
||||||
|
{ |
||||||
|
auto doTest = [&](auto test) { |
||||||
|
auto test_suite = suite(suite_name); |
||||||
|
auto build_path = test_suite.build_file_path / "tests" / "lldb_test_files" / "lldb_test_executable"; |
||||||
|
{ |
||||||
|
auto module = py::module::import("debug_lldb_test"); |
||||||
|
test_suite.has_assertion = false; |
||||||
|
try { |
||||||
|
module.attr(test)(build_path.c_str()); |
||||||
|
test_suite.has_assertion = true; |
||||||
|
} |
||||||
|
catch(const std::exception &error) { |
||||||
|
std::cout << error.what(); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
doTest("start_on_exit"); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
from Jucipp import LLDB |
||||||
|
from time import sleep |
||||||
|
from jucipp_test import assert_equal |
||||||
|
|
||||||
|
|
||||||
|
exited = False |
||||||
|
|
||||||
|
def on_exit(exit_code): |
||||||
|
assert_equal(0, exit_code) |
||||||
|
global exited |
||||||
|
exited = True |
||||||
|
|
||||||
|
def start_on_exit(exec_path): |
||||||
|
print(exec_path) |
||||||
|
l = LLDB() |
||||||
|
l.on_exit = [on_exit] |
||||||
|
l.start(exec_path, "", []) |
||||||
|
|
||||||
|
while not exited: |
||||||
|
sleep(0.1) |
||||||
|
LLDB.destroy() |
||||||
@ -0,0 +1 @@ |
|||||||
|
invalid code |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
#include "python_type_casters.h" |
||||||
|
#include <test_suite.h> |
||||||
|
|
||||||
|
int main() { |
||||||
|
{ |
||||||
|
suite test_suite("PythonModule_tests"); |
||||||
|
{ |
||||||
|
py::module::import("python_module_test"); |
||||||
|
test_suite.has_assertion = true; |
||||||
|
} |
||||||
|
} |
||||||
|
{ |
||||||
|
suite test_suite("PythonModule_tests"); |
||||||
|
{ |
||||||
|
try { |
||||||
|
py::module::import("exception_test"); |
||||||
|
} |
||||||
|
catch(const py::error_already_set &error) { |
||||||
|
test_suite.has_assertion = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
||||||
@ -0,0 +1 @@ |
|||||||
|
import Jucipp |
||||||
@ -0,0 +1,51 @@ |
|||||||
|
#include "terminal.hpp" |
||||||
|
#include "test_suite.h" |
||||||
|
|
||||||
|
int main() { |
||||||
|
const auto test_directory = "Terminal_tests"; |
||||||
|
{ |
||||||
|
suite test_suite(test_directory); |
||||||
|
{ |
||||||
|
auto &terminal = Terminal::get(); |
||||||
|
auto connection = terminal.get_buffer()->signal_insert().connect([&](const Gtk::TextBuffer::iterator &, const Glib::ustring &msg, int) { |
||||||
|
g_assert_cmpstr(msg.c_str(), ==, "Hello, World!\n"); |
||||||
|
test_suite.has_assertion = true; |
||||||
|
}); |
||||||
|
auto module = py::module::import("terminal_test"); |
||||||
|
module.attr("hello_world")(); |
||||||
|
connection.disconnect(); |
||||||
|
} |
||||||
|
} |
||||||
|
{ |
||||||
|
suite test_suite(test_directory); |
||||||
|
{ |
||||||
|
auto &terminal = Terminal::get(); |
||||||
|
auto connection = terminal.get_buffer()->signal_insert().connect([&](const Gtk::TextBuffer::iterator &, const Glib::ustring &msg, int) { |
||||||
|
g_assert_cmpstr(msg.c_str(), ==, "hello_world.txt\n"); |
||||||
|
test_suite.has_assertion = true; |
||||||
|
test_suite.app->release(); |
||||||
|
}); |
||||||
|
test_suite.app->hold(); |
||||||
|
std::thread thread([&] { |
||||||
|
const auto ls_dir = test_suite.test_file_path / test_directory / "ls"; |
||||||
|
auto module = py::module::import("terminal_test"); |
||||||
|
auto res = module.attr("process")(ls_dir).cast<int>(); |
||||||
|
g_assert_cmpint(res, ==, 0); |
||||||
|
}); |
||||||
|
test_suite.app->run(); |
||||||
|
thread.join(); |
||||||
|
connection.disconnect(); |
||||||
|
} |
||||||
|
} |
||||||
|
{ |
||||||
|
suite test_suite(test_directory); |
||||||
|
try { |
||||||
|
const auto ls_dir = test_suite.test_file_path / test_directory / "ls"; |
||||||
|
py::module::import("terminal_test").attr("async_process")(ls_dir); |
||||||
|
test_suite.has_assertion = true; |
||||||
|
} |
||||||
|
catch(const py::error_already_set &error) { |
||||||
|
std::cout << error.what(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
from Jucipp import Terminal |
||||||
|
from jucipp_test import assert_equal |
||||||
|
|
||||||
|
t = Terminal() |
||||||
|
|
||||||
|
def hello_world(): |
||||||
|
t.print("Hello, World!\n") |
||||||
|
|
||||||
|
def clear(): |
||||||
|
t.clear() |
||||||
|
|
||||||
|
def process(path): |
||||||
|
p = t.process("ls", path, True) |
||||||
|
assert_equal(p, 0) |
||||||
|
return p |
||||||
|
|
||||||
|
def async_print(): |
||||||
|
return t.async_print("Hello, World!") |
||||||
|
|
||||||
|
def callback(exit_code): |
||||||
|
assert_equal(0, exit_code) |
||||||
|
|
||||||
|
def async_process(path): |
||||||
|
p = t.async_process("ls", path, callback, True) |
||||||
|
assert_equal(0, p.get_exit_status()) |
||||||
|
return p.get_exit_status() |
||||||
@ -0,0 +1,3 @@ |
|||||||
|
cmake_minimum_required(VERSION 2.8) |
||||||
|
project(cmake_project) |
||||||
|
add_executable(cmake_project main.cpp) |
||||||
@ -0,0 +1 @@ |
|||||||
|
int main() { return 0; } |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
""" Shared test methods """ |
||||||
|
|
||||||
|
def assert_equal(expected, actual): |
||||||
|
""" Assert two variables for equality with an useful error message """ |
||||||
|
assert actual == expected, "Expected: " + str(expected) + ", got " + str(actual) |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
#include "test_suite.h" |
||||||
|
#include "python_module.h" |
||||||
|
#include <gtksourceviewmm/init.h> |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
suite::suite(const boost::filesystem::path &path) : plugins(config) { |
||||||
|
Gsv::init(); |
||||||
|
py::initialize_interpreter(); |
||||||
|
if(!Py_IsInitialized()) { |
||||||
|
throw std::runtime_error("Unable to initialize interpreter"); |
||||||
|
} |
||||||
|
auto sys = py::module::import("sys"); |
||||||
|
if(!sys) { |
||||||
|
throw std::runtime_error("Unable to append sys path"); |
||||||
|
} |
||||||
|
auto sys_path = sys.attr("path").cast<py::list>(); |
||||||
|
sys_path.append((test_file_path / path).string()); |
||||||
|
sys_path.append((test_file_path).string()); |
||||||
|
config.terminal.history_size = 100; |
||||||
|
} |
||||||
|
suite::~suite() { |
||||||
|
if(Py_IsInitialized()) { |
||||||
|
py::finalize_interpreter(); |
||||||
|
g_assert_true(has_assertion); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
#pragma once |
||||||
|
#include "config.hpp" |
||||||
|
#include "plugins.h" |
||||||
|
#include <gtkmm.h> |
||||||
|
|
||||||
|
class __attribute__((visibility("default"))) |
||||||
|
suite { |
||||||
|
public: |
||||||
|
suite(const boost::filesystem::path &path); |
||||||
|
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(); |
||||||
|
Config &config = Config::get(); |
||||||
|
boost::filesystem::path test_file_path = boost::filesystem::canonical(std::string(JUCI_TESTS_PATH) + "/python_bindings"); |
||||||
|
boost::filesystem::path build_file_path = boost::filesystem::canonical(JUCI_BUILD_PATH); |
||||||
|
bool has_assertion = false; |
||||||
|
Plugins plugins; |
||||||
|
~suite(); |
||||||
|
}; |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
#include "plugins.h" |
||||||
|
#include "python_module.h" |
||||||
|
|
||||||
|
Plugins::Plugins(Config &config) : jucipp_module("Jucipp", Module::init_jucipp_module) { |
||||||
|
#ifdef PYTHON_HOME_DIR |
||||||
|
#ifdef _WIN32 |
||||||
|
const std::wstring python_home(PYTHON_HOME_DIR); |
||||||
|
const std::wstring python_path(python_home + L";" + python_home + L"\\lib-dynload;" + python_home + L"\\site-packages"); |
||||||
|
Py_SetPythonHome(python_home.c_str()); |
||||||
|
Py_SetPath(python_path.c_str()); |
||||||
|
#endif |
||||||
|
#endif |
||||||
|
} |
||||||
|
|
||||||
|
void Plugins::load() {} |
||||||
|
|
||||||
|
Plugins::~Plugins() {} |
||||||
Loading…
Reference in new issue