Skip to content

Commit

Permalink
Adding Python parser to ligen-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
notdanilo committed Oct 23, 2023
1 parent a7208e5 commit 0534d22
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tools/editor/src/gui/ui/layout/editor/ir/menu_button.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use ligen_ir::Project;
use ligen_python_parser::parser::PythonParser;

use crate::prelude::*;
use crate::gui::ui::editor::ir::Editor;
use crate::gui::ui::menu::MenuButton;
use crate::gui::ui::panes::Panes;
use ligen_parsing::parser::Parser;

pub struct EditorMenuButton;
impl MenuButton for EditorMenuButton {
Expand All @@ -20,8 +24,21 @@ impl MenuButton for EditorMenuButton {
}
ui.close_menu();
}
if ui.button("Parse Python").clicked() {
let entry = rfd::FileDialog::new()
.pick_folder();

if let Some(entry) = entry {
stacker::grow(1024 * 1024 * 10, || {
let root_module = PythonParser::full().parse(entry.as_path()).unwrap();
let project = Project { root_module, ..Default::default() };
panes.new_pane(Box::new(Editor::new(project)));
});
}

ui.close_menu();
}
if ui.button("Parse Rust/Cargo").clicked() {
use ligen_parsing::parser::Parser;
use ligen_cargo::parser::project::ProjectParser;

let file = rfd::FileDialog::new()
Expand Down

0 comments on commit 0534d22

Please sign in to comment.