Totally rewrite dashboard as a GTK application #54

Merged
savanni merged 14 commits from dashboard-gtk into main 2023-08-09 18:14:01 +00:00
3 changed files with 5 additions and 14 deletions
Showing only changes of commit ab97e14ad7 - Show all commits

View File

@ -68,16 +68,6 @@ impl PieChart {
end_angle, end_angle,
color, color,
}| { }| {
println!(
"wedge: {:.02?} {:.02?} {:.02?}",
start_angle, end_angle, color
);
println!(
"wedge: {:.02?} {:.02?} [{:.02?}]",
start_angle + self.rotation,
end_angle + self.rotation,
self.rotation
);
context.move_to(self.center_x, self.center_y); context.move_to(self.center_x, self.center_y);
context.set_source_rgb(color.r, color.g, color.b); context.set_source_rgb(color.r, color.g, color.b);
context.arc( context.arc(

View File

@ -1,7 +1,7 @@
use chrono::{Datelike, Local, Utc}; use chrono::{Datelike, Local, Utc};
use geo_types::{Latitude, Longitude}; use geo_types::{Latitude, Longitude};
use glib::Sender; use glib::Sender;
use gtk::{prelude::*, subclass::prelude::*, Orientation}; use gtk::prelude::*;
use ifc::IFC; use ifc::IFC;
use std::{ use std::{
env, env,
@ -12,12 +12,11 @@ mod app_window;
use app_window::ApplicationWindow; use app_window::ApplicationWindow;
mod components; mod components;
use components::{Date, TransitClock};
mod drawing; mod drawing;
mod soluna_client; mod soluna_client;
use soluna_client::{SolunaClient, SunMoon}; use soluna_client::SolunaClient;
mod solstices; mod solstices;
use solstices::EVENTS; use solstices::EVENTS;

View File

@ -133,9 +133,11 @@ fn parse_events() -> Vec<Option<YearlyEvents>> {
pub struct Solstices(HashMap<i32, YearlyEvents>); pub struct Solstices(HashMap<i32, YearlyEvents>);
impl Solstices { impl Solstices {
/*
pub fn acquire(&self, year: i32) -> Option<YearlyEvents> { pub fn acquire(&self, year: i32) -> Option<YearlyEvents> {
self.0.get(&year).map(|c| c.clone()) self.0.get(&year).map(|c| c.clone())
} }
*/
pub fn next_event(&self, date: chrono::DateTime<chrono::Utc>) -> Option<Event> { pub fn next_event(&self, date: chrono::DateTime<chrono::Utc>) -> Option<Event> {
let year_events = self.0.get(&date.year()); let year_events = self.0.get(&date.year());
@ -152,7 +154,7 @@ impl Solstices {
} else { } else {
self.0 self.0
.get(&(date.year() + 1)) .get(&(date.year() + 1))
.map(|events| Event::SpringEquinox(year_events.spring_equinox.clone())) .map(|_| Event::SpringEquinox(year_events.spring_equinox.clone()))
} }
} }
None => None, None => None,