Skip to content

Commit ef50513

Browse files
committed
Rename to egui_serial_term
- Serial TTY considered TerminalBackend - PTY prefix to TTY - macOS PL2303 hotfix (serialport/serialport-rs#194 (comment)) - basic example for serial monitor
1 parent 5eb2893 commit ef50513

File tree

14 files changed

+50
-55
lines changed

14 files changed

+50
-55
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
2-
name = "egui_term"
3-
description = "Terminal emulator widget powered by EGUI framework and alacritty terminal backend."
4-
authors = ["Ilya Shvyryalkin <[email protected]>"]
2+
name = "egui_serial_term"
3+
description = "Serial monitor widget powered by EGUI framework and alacritty terminal backend."
4+
authors = ["Jinwoo Park <[email protected]>", "Ilya Shvyryalkin <[email protected]>"]
55
version = "0.1.0"
66
edition = "2021"
7-
repository = "https://github.com/Harzu/egui_term"
7+
repository = "https://github.com/pmnxis/egui_serial_term"
88
categories = ["gui", "terminal", "tty", "shell"]
99
license = "MIT"
1010

README.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<div align="center">
22

3-
# egui_term
3+
# egui_serial_term
44

5-
![GitHub License](https://img.shields.io/github/license/Harzu/iced_term)
5+
![GitHub License](https://img.shields.io/github/license/pmxnis/egui_serial_term)
66

77
Terminal emulator widget powered by EGUI framework and alacritty terminal backend.
88

9-
<a href="./examples/full_screen">
10-
<img src="examples/full_screen/assets/screenshot.png" width="275px">
11-
</a>
12-
<a href="./examples/tabs">
13-
<img src="examples/tabs/assets/screenshot.png" width="273px">
9+
Forked from [egui_term](https://github.com/Harzu/egui_term) to use serial TTY monitor.
10+
11+
<a href="./examples/serial_monitor">
12+
<img src="examples/serial_monitor/assets/screenshot.png" width="275px">
1413
</a>
1514

1615
</div>
@@ -19,7 +18,7 @@ Terminal emulator widget powered by EGUI framework and alacritty terminal backen
1918

2019
The widget is currently under development and does not provide full terminal features make sure that widget is covered everything you want.
2120

22-
- PTY content rendering
21+
- TTY content rendering
2322
- Multiple instance support
2423
- Basic keyboard input
2524
- Adding custom keyboard or mouse bindings
@@ -36,11 +35,7 @@ This widget tested on MacOS and Linux and is not tested on Windows.
3635

3736
You can also look at [examples](./examples) directory for more information about widget using.
3837

39-
- [full_screen](./examples/full_screen/) - The basic example of terminal emulator.
40-
- [tabs](./examples/tabs/) - The example with tab widget that show how multiple instance feature work.
41-
- [custom_bindings](./examples/custom_bindings/) - The example that show how you can add custom keyboard or mouse bindings to your terminal emulator app.
42-
- [themes](./examples/themes/) - The example that show how you can change terminal color scheme.
43-
- [fonts](./examples/fonts/) - The examples that show how you can change font type or font size in your terminal emulator app.
38+
- [serial_monitor](./examples/serial_monitor/) - The basic example of serial monitor.
4439

4540
## Dependencies
4641

examples/custom_bindings/src/app.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use egui::{Key, Modifiers, Vec2};
2-
use egui_term::{
2+
use egui_serial_term::{
33
generate_bindings, Binding, BindingAction, InputKind, KeyboardBinding,
4-
PtyEvent, TerminalBackend, TerminalMode, TerminalView,
4+
TtyEvent, TerminalBackend, TerminalMode, TerminalView,
55
};
66
use std::sync::mpsc::Receiver;
77

88
pub struct App {
99
terminal_backend: TerminalBackend,
10-
pty_proxy_receiver: Receiver<(u64, egui_term::PtyEvent)>,
10+
pty_proxy_receiver: Receiver<(u64, egui_term::TtyEvent)>,
1111
custom_terminal_bindings: Vec<(Binding<InputKind>, BindingAction)>,
1212
}
1313

@@ -79,7 +79,7 @@ impl App {
7979

8080
impl eframe::App for App {
8181
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
82-
if let Ok((_, PtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
82+
if let Ok((_, TtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
8383
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
8484
return;
8585
}

examples/fonts/src/app.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use egui::{FontId, Vec2};
22
use egui_term::{
3-
FontSettings, PtyEvent, TerminalBackend, TerminalFont, TerminalView,
3+
FontSettings, TtyEvent, TerminalBackend, TerminalFont, TerminalView,
44
};
55
use std::sync::{mpsc::Receiver, Arc};
66

@@ -49,7 +49,7 @@ fn setup_font(ctx: &egui::Context, name: &str) {
4949
pub struct App {
5050
terminal_backend: TerminalBackend,
5151
font_size: f32,
52-
pty_proxy_receiver: Receiver<(u64, egui_term::PtyEvent)>,
52+
pty_proxy_receiver: Receiver<(u64, egui_term::TtyEvent)>,
5353
}
5454

5555
impl App {
@@ -81,7 +81,7 @@ impl App {
8181

8282
impl eframe::App for App {
8383
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
84-
if let Ok((_, PtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
84+
if let Ok((_, TtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
8585
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
8686
return;
8787
}

examples/full_screen/src/app.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use egui::Vec2;
2-
use egui_term::{PtyEvent, TerminalBackend, TerminalView};
2+
use egui_term::{TtyEvent, TerminalBackend, TerminalView};
33
use std::sync::mpsc::Receiver;
44

55
pub struct App {
66
terminal_backend: TerminalBackend,
7-
pty_proxy_receiver: Receiver<(u64, egui_term::PtyEvent)>,
7+
pty_proxy_receiver: Receiver<(u64, egui_term::TtyEvent)>,
88
}
99

1010
impl App {
@@ -34,7 +34,7 @@ impl App {
3434

3535
impl eframe::App for App {
3636
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
37-
if let Ok((_, PtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
37+
if let Ok((_, TtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
3838
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
3939
return;
4040
}

examples/serial_monitor/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/serial_monitor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ eframe = { version = "0.31.0", default-features = false, features = [
1111
"persistence", # Enable restoring app state when restarting the app.
1212
] }
1313
log = "0.4"
14-
egui_term = { path = "../../" }
14+
egui_serial_term = { path = "../../" }
1515
mio-serial = { version = "5.0.6", features = ["libudev", "serde"] }
1616

1717
# native:

examples/serial_monitor/src/app.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use egui::{Color32, RichText, Vec2};
2-
use egui_term::{PtyEvent, SerialMonitorView, TerminalTheme};
3-
use egui_term::{SerialMonitorBackend, SerialTtyOptions};
2+
use egui_serial_term::{TtyEvent, SerialMonitorView, TerminalTheme};
3+
use egui_serial_term::{SerialMonitorBackend, SerialTtyOptions};
44
use mio_serial::{DataBits, FlowControl, Parity, StopBits};
55
use std::sync::mpsc::{Receiver, Sender};
66

@@ -21,8 +21,8 @@ pub struct App {
2121
tty_list: Vec<String>,
2222
tty_conn: SerialTtyOptions,
2323
last_failed: Option<std::time::Instant>,
24-
pty_proxy_sender: Sender<(u64, egui_term::PtyEvent)>,
25-
pty_proxy_receiver: Receiver<(u64, egui_term::PtyEvent)>,
24+
pty_proxy_sender: Sender<(u64, egui_serial_term::TtyEvent)>,
25+
pty_proxy_receiver: Receiver<(u64, egui_serial_term::TtyEvent)>,
2626
}
2727

2828
impl App {
@@ -53,7 +53,7 @@ impl App {
5353

5454
impl eframe::App for App {
5555
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
56-
if let Ok((_, PtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
56+
if let Ok((_, TtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
5757
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
5858
return;
5959
}

examples/split_view/src/app.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use eframe::epaint::FontId;
22
use egui::{Context, Ui};
33
use egui_dock::{DockArea, DockState, NodeIndex, Style};
44
use egui_term::{
5-
BackendSettings, FontSettings, PtyEvent, TerminalBackend, TerminalFont,
5+
BackendSettings, FontSettings, TtyEvent, TerminalBackend, TerminalFont,
66
TerminalView,
77
};
88
use log::error;
@@ -35,7 +35,7 @@ pub struct Tab {
3535
}
3636

3737
impl Tab {
38-
pub fn term(ctx: Context, command_sender: Sender<(u64, PtyEvent)>) -> Self {
38+
pub fn term(ctx: Context, command_sender: Sender<(u64, TtyEvent)>) -> Self {
3939
let id = GLOBAL_COUNTER.next();
4040
let backend = TerminalBackend::new(
4141
id,
@@ -50,7 +50,7 @@ impl Tab {
5050
}
5151

5252
struct TabViewer<'a> {
53-
command_sender: &'a Sender<(u64, PtyEvent)>,
53+
command_sender: &'a Sender<(u64, TtyEvent)>,
5454
}
5555

5656
impl egui_dock::TabViewer for TabViewer<'_> {
@@ -71,7 +71,7 @@ impl egui_dock::TabViewer for TabViewer<'_> {
7171
}
7272

7373
fn on_close(&mut self, tab: &mut Self::Tab) -> bool {
74-
match self.command_sender.send((tab.id, PtyEvent::Exit)) {
74+
match self.command_sender.send((tab.id, TtyEvent::Exit)) {
7575
Err(err) => {
7676
error!("close tab {} failed: {err}", tab.id);
7777
false
@@ -82,7 +82,7 @@ impl egui_dock::TabViewer for TabViewer<'_> {
8282
}
8383

8484
pub struct App {
85-
command_sender: Sender<(u64, PtyEvent)>,
85+
command_sender: Sender<(u64, TtyEvent)>,
8686
dock_state: DockState<Tab>,
8787
}
8888

examples/tabs/src/app.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use egui_term::{PtyEvent, TerminalBackend, TerminalView};
1+
use egui_term::{TtyEvent, TerminalBackend, TerminalView};
22
use std::{
33
collections::BTreeMap,
44
sync::mpsc::{self, Receiver, Sender},
55
};
66

77
pub struct App {
8-
command_sender: Sender<(u64, egui_term::PtyEvent)>,
9-
command_receiver: Receiver<(u64, egui_term::PtyEvent)>,
8+
command_sender: Sender<(u64, egui_term::TtyEvent)>,
9+
command_receiver: Receiver<(u64, egui_term::TtyEvent)>,
1010
tab_manager: TabManager,
1111
}
1212

@@ -29,10 +29,10 @@ impl eframe::App for App {
2929

3030
if let Ok((tab_id, event)) = self.command_receiver.try_recv() {
3131
match event {
32-
egui_term::PtyEvent::Exit => {
32+
egui_term::TtyEvent::Exit => {
3333
self.tab_manager.remove(tab_id);
3434
},
35-
egui_term::PtyEvent::Title(title) => {
35+
egui_term::TtyEvent::Title(title) => {
3636
self.tab_manager.set_title(tab_id, title);
3737
},
3838
_ => {},
@@ -88,7 +88,7 @@ impl TabManager {
8888

8989
fn add(
9090
&mut self,
91-
command_sender: Sender<(u64, PtyEvent)>,
91+
command_sender: Sender<(u64, TtyEvent)>,
9292
ctx: egui::Context,
9393
) {
9494
let id = self.tabs.len() as u64;
@@ -156,7 +156,7 @@ struct Tab {
156156
impl Tab {
157157
fn new(
158158
ctx: egui::Context,
159-
command_sender: Sender<(u64, PtyEvent)>,
159+
command_sender: Sender<(u64, TtyEvent)>,
160160
id: u64,
161161
) -> Self {
162162
let system_shell = std::env::var("SHELL")

examples/themes/src/app.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use egui::Vec2;
22
use egui_term::{
3-
ColorPalette, PtyEvent, TerminalBackend, TerminalTheme, TerminalView,
3+
ColorPalette, TtyEvent, TerminalBackend, TerminalTheme, TerminalView,
44
};
55
use std::sync::mpsc::Receiver;
66

77
pub struct App {
88
terminal_backend: TerminalBackend,
99
terminal_theme: TerminalTheme,
10-
pty_proxy_receiver: Receiver<(u64, egui_term::PtyEvent)>,
10+
pty_proxy_receiver: Receiver<(u64, egui_term::TtyEvent)>,
1111
}
1212

1313
impl App {
@@ -38,7 +38,7 @@ impl App {
3838

3939
impl eframe::App for App {
4040
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
41-
if let Ok((_, PtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
41+
if let Ok((_, TtyEvent::Exit)) = self.pty_proxy_receiver.try_recv() {
4242
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
4343
return;
4444
}

src/backend/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::sync::mpsc::Sender;
2626
use std::sync::{mpsc, Arc};
2727

2828
pub type TerminalMode = TermMode;
29-
pub type PtyEvent = Event;
29+
pub type TtyEvent = Event;
3030
pub type SelectionType = AlacrittySelectionType;
3131

3232
#[derive(Debug, Clone)]
@@ -146,7 +146,7 @@ impl SerialMonitorBackend {
146146
pub fn new(
147147
id: u64,
148148
app_context: egui::Context,
149-
pty_event_proxy_sender: Sender<(u64, PtyEvent)>,
149+
pty_event_proxy_sender: Sender<(u64, TtyEvent)>,
150150
serial_settings: SerialTtyOptions,
151151
) -> Result<Self> {
152152
let config = term::Config::default();
@@ -178,7 +178,7 @@ impl SerialMonitorBackend {
178178
pty_event_proxy_sender
179179
.send((id, event.clone()))
180180
.unwrap_or_else(|_| {
181-
panic!("pty_event_subscription_{}: sending PtyEvent is failed", id)
181+
panic!("pty_event_subscription_{}: sending TtyEvent is failed", id)
182182
});
183183
app_context.clone().request_repaint();
184184
if let Event::Exit = event {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod view;
88

99
// pub use backend::settings::BackendSettings;
1010
pub use backend::{
11-
BackendCommand, PtyEvent, SerialMonitorBackend, TerminalMode,
11+
BackendCommand, SerialMonitorBackend, TerminalMode, TtyEvent,
1212
};
1313
pub use bindings::{Binding, BindingAction, InputKind, KeyboardBinding};
1414
pub use font::{FontSettings, TerminalFont};

0 commit comments

Comments
 (0)