Compare commits
2 Commits
6fbbe918fe
...
d7af07b275
Author | SHA1 | Date |
---|---|---|
_ | d7af07b275 | |
_ | 233567cf72 |
|
@ -4,7 +4,7 @@ version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "annoying_journal"
|
name = "annoying_journal"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"fltk",
|
"fltk",
|
||||||
|
|
|
@ -8,7 +8,7 @@ license = "AGPL-3.0"
|
||||||
name = "annoying_journal"
|
name = "annoying_journal"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://six-five-six-four.com/git/reactor/annoying_journal"
|
repository = "https://six-five-six-four.com/git/reactor/annoying_journal"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
|
|
||||||
exclude = [
|
exclude = [
|
||||||
"COPYING",
|
"COPYING",
|
||||||
|
|
23
src/main.rs
23
src/main.rs
|
@ -11,6 +11,7 @@ use chrono::{
|
||||||
use fltk::{
|
use fltk::{
|
||||||
app,
|
app,
|
||||||
button,
|
button,
|
||||||
|
frame,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
text,
|
text,
|
||||||
window::Window,
|
window::Window,
|
||||||
|
@ -98,6 +99,7 @@ struct JournalLine {
|
||||||
struct Gui {
|
struct Gui {
|
||||||
time_popped_up: Option <DateTime <Local>>,
|
time_popped_up: Option <DateTime <Local>>,
|
||||||
editor: text::TextEditor,
|
editor: text::TextEditor,
|
||||||
|
status: frame::Frame,
|
||||||
wind: Window,
|
wind: Window,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,15 +121,31 @@ impl Gui {
|
||||||
let mut but = button::ReturnButton::new (640 - 100, 480 - 50, 100, 50, "Submit");
|
let mut but = button::ReturnButton::new (640 - 100, 480 - 50, 100, 50, "Submit");
|
||||||
but.emit (fltk_tx, Message::Submit);
|
but.emit (fltk_tx, Message::Submit);
|
||||||
|
|
||||||
|
let status = frame::Frame::new (0, 480 - 50, 640 - 100, 50, "");
|
||||||
|
|
||||||
wind.set_label ("ANNOYING JOURNAL");
|
wind.set_label ("ANNOYING JOURNAL");
|
||||||
wind.end ();
|
wind.end ();
|
||||||
wind.show ();
|
wind.show ();
|
||||||
|
|
||||||
Self {
|
let mut that = Self {
|
||||||
time_popped_up: Some (Local::now ()),
|
time_popped_up: Some (Local::now ()),
|
||||||
editor,
|
editor,
|
||||||
|
status,
|
||||||
wind,
|
wind,
|
||||||
}
|
};
|
||||||
|
|
||||||
|
that.refresh_status ();
|
||||||
|
|
||||||
|
that
|
||||||
|
}
|
||||||
|
|
||||||
|
fn refresh_status (&mut self) {
|
||||||
|
let version = option_env! ("CARGO_PKG_VERSION").unwrap_or ("(???)");
|
||||||
|
let time_popped_up = self.time_popped_up
|
||||||
|
.map (|x| x.to_rfc3339_opts (SecondsFormat::Secs, true))
|
||||||
|
.unwrap_or_else (|| "(???)".to_string ());
|
||||||
|
|
||||||
|
self.status.set_label (&format! ("v{}, popped up at {}", version, time_popped_up));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pop_up (&mut self) -> Result <(), Error> {
|
fn pop_up (&mut self) -> Result <(), Error> {
|
||||||
|
@ -137,6 +155,7 @@ impl Gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.time_popped_up = Some (Local::now ());
|
self.time_popped_up = Some (Local::now ());
|
||||||
|
self.refresh_status ();
|
||||||
self.wind.set_label ("ANNOYING JOURNAL");
|
self.wind.set_label ("ANNOYING JOURNAL");
|
||||||
self.wind.show ();
|
self.wind.show ();
|
||||||
self.editor.take_focus ()?;
|
self.editor.take_focus ()?;
|
||||||
|
|
Loading…
Reference in New Issue