Compare commits

..

No commits in common. "7ccc3b0e77071f8b6a13b4f3ac3daf12d02b3ad2" and "f07ce8a5dd132ea6291f94fa6817101af0edc179" have entirely different histories.

2 changed files with 7 additions and 13 deletions

View File

@ -8,7 +8,7 @@ license = "AGPL-3.0"
name = "annoying_journal"
readme = "README.md"
repository = "https://six-five-six-four.com/git/reactor/annoying_journal"
version = "0.1.1"
version = "0.1.0"
exclude = [
"COPYING",

View File

@ -3,7 +3,6 @@ use std::{
};
use chrono::{
DateTime,
Local,
SecondsFormat,
};
@ -124,12 +123,11 @@ enum Error {
#[derive (serde::Serialize)]
struct JournalLine {
text: String,
time_popped_up: Option <String>,
time_submitted: String,
}
struct Gui {
time_popped_up: Option <DateTime <Local>>,
armed: bool,
editor: text::TextEditor,
wind: Window,
}
@ -152,25 +150,23 @@ impl Gui {
let mut but = button::ReturnButton::new (640 - 100, 480 - 50, 100, 50, "Submit");
but.emit (fltk_tx, Message::Submit);
wind.set_label ("ANNOYING JOURNAL");
wind.end ();
wind.show ();
Self {
time_popped_up: Some (Local::now ()),
armed: true,
editor,
wind,
}
}
fn pop_up (&mut self) -> Result <(), Error> {
if self.time_popped_up.is_some () {
eprintln! ("O4U6E36V Ignoring pop-up, already popped up");
if ! self.armed {
eprintln! ("O4U6E36V Ignoring pop-up, not armed");
return Ok (());
}
self.time_popped_up = Some (Local::now ());
self.wind.set_label ("ANNOYING JOURNAL");
self.armed = false;
self.wind.show ();
self.editor.take_focus ()?;
@ -185,7 +181,6 @@ impl Gui {
let jl = JournalLine {
text: buffer.text (),
time_popped_up: self.time_popped_up.map (|x| x.to_rfc3339_opts (SecondsFormat::Secs, true)),
time_submitted: Local::now ().to_rfc3339_opts (SecondsFormat::Secs, true),
};
@ -203,8 +198,7 @@ impl Gui {
println! ("{}", s);
self.editor.set_buffer (text::TextBuffer::default ());
self.wind.iconize ();
self.time_popped_up = None;
self.wind.set_label ("annoying journal");
self.armed = true;
Ok (())
}