format and ui tweaks
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Chris Cochrun 2025-09-23 15:41:44 -05:00
parent 1e1912d419
commit 20d042d279
5 changed files with 69 additions and 45 deletions

View file

@ -95,7 +95,10 @@ mod test {
let screenshot = bg_path_from_video(video); let screenshot = bg_path_from_video(video);
let screenshot_string = let screenshot_string =
screenshot.to_str().expect("Should be thing"); screenshot.to_str().expect("Should be thing");
assert_eq!(screenshot_string, "/home/chris/.local/share/lumina/thumbnails/moms-funeral.png"); assert_eq!(
screenshot_string,
"/home/chris/.local/share/lumina/thumbnails/moms-funeral.png"
);
// let runtime = tokio::runtime::Runtime::new().unwrap(); // let runtime = tokio::runtime::Runtime::new().unwrap();
let result = bg_from_video(video, &screenshot); let result = bg_from_video(video, &screenshot);
@ -118,6 +121,9 @@ mod test {
let screenshot = bg_path_from_video(video); let screenshot = bg_path_from_video(video);
let screenshot_string = let screenshot_string =
screenshot.to_str().expect("Should be thing"); screenshot.to_str().expect("Should be thing");
assert_ne!(screenshot_string, "/home/chris/.local/share/lumina/thumbnails/All WebDev Sucks and you know it.webm"); assert_ne!(
screenshot_string,
"/home/chris/.local/share/lumina/thumbnails/All WebDev Sucks and you know it.webm"
);
} }
} }

View file

@ -1290,8 +1290,7 @@ impl cosmic::Application for App {
let song_editor = let song_editor =
self.song_editor.view().map(Message::SongEditor); self.song_editor.view().map(Message::SongEditor);
let row = row![ let service_row = row![
library,
service_list, service_list,
Container::new( Container::new(
button::icon(icon_left) button::icon(icon_left)
@ -1325,23 +1324,33 @@ impl cosmic::Application for App {
.height(Length::Fill) .height(Length::Fill)
.spacing(20); .spacing(20);
let column = column![ let preview_bar = if self.editor_mode.is_none() {
Container::new(row).center_y(Length::Fill),
Container::new( Container::new(
self.presenter.preview_bar().map(Message::Present) self.presenter.preview_bar().map(Message::Present),
) )
.clip(true) .clip(true)
.width(Length::Fill) .width(Length::Fill)
.center_y(180) .center_y(180)
]; } else {
Container::new(horizontal_space())
};
if let Some(_editor) = &self.editor_mode { let main_area = if let Some(editor) = &self.editor_mode {
container(song_editor) container(song_editor)
.padding(cosmic::theme::spacing().space_xxl) .padding(cosmic::theme::spacing().space_xxl)
.into()
} else { } else {
Element::from(column) Container::new(service_row).center_y(Length::Fill)
} };
let column = column![
row![
library.width(Length::FillPortion(1)),
main_area.width(Length::FillPortion(4))
],
preview_bar
];
column.into()
} }
// View for presentation // View for presentation

View file

@ -488,40 +488,43 @@ impl<'a> Library {
column({ column({
model.items.iter().enumerate().map( model.items.iter().enumerate().map(
|(index, item)| { |(index, item)| {
let service_item = item.to_service_item(); let service_item = item.to_service_item();
let visual_item = self let visual_item = self
.single_item(index, item, model) .single_item(index, item, model)
.map(|()| Message::None); .map(|()| Message::None);
DndSource::<Message, ServiceItem>::new({ DndSource::<Message, ServiceItem>::new({
let mouse_area = Element::from(mouse_area(visual_item) let mouse_area = mouse_area(visual_item);
.on_drag(Message::DragItem(service_item.clone())) let mouse_area = mouse_area.on_enter(Message::HoverItem(
.on_enter(Message::HoverItem( Some((
Some(( model.kind,
model.kind, index as i32,
index as i32, )),
)), ))
)) .on_double_click(
.on_double_click( Message::OpenItem(Some((
Message::OpenItem(Some(( model.kind,
model.kind, index as i32,
index as i32, ))),
))), )
) .on_right_press(Message::OpenContext(index as i32))
.on_right_press(Message::OpenContext(index as i32)) .on_exit(Message::HoverItem(None))
.on_exit(Message::HoverItem(None)) .on_press(Message::SelectItem(
.on_press(Message::SelectItem( Some((
Some(( model.kind,
model.kind, index as i32,
index as i32, )),
)), ));
)));
if let Some(context_id) = self.context_menu { if let Some(context_id) = self.context_menu {
if index == context_id as usize { if index == context_id as usize {
let menu_items = vec![menu::Item::Button("Delete", None, MenuMessage::Delete((model.kind, index as i32)))];
let context_menu = context_menu( let context_menu = context_menu(
mouse_area, mouse_area,
self.context_menu.map_or_else(|| None, |_| { self.context_menu.map_or_else(|| None, |_| {
Some(menu::items(&self.menu_keys, Some(menu::items(&self.menu_keys,
vec![menu::Item::Button("Delete", None, MenuMessage::Delete((model.kind, index as i32)))])) menu_items))
}) })
); );
Element::from(context_menu) Element::from(context_menu)

View file

@ -256,11 +256,13 @@ impl TextSvg {
path.push(PathBuf::from("temp")); path.push(PathBuf::from("temp"));
let shadow = if let Some(shadow) = &self.shadow { let shadow = if let Some(shadow) = &self.shadow {
format!("<filter id=\"shadow\"><feDropShadow dx=\"{}\" dy=\"{}\" stdDeviation=\"{}\" flood-color=\"{}\"/></filter>", format!(
"<filter id=\"shadow\"><feDropShadow dx=\"{}\" dy=\"{}\" stdDeviation=\"{}\" flood-color=\"{}\"/></filter>",
shadow.offset_x, shadow.offset_x,
shadow.offset_y, shadow.offset_y,
shadow.spread, shadow.spread,
shadow.color) shadow.color
)
} else { } else {
String::new() String::new()
}; };
@ -299,13 +301,17 @@ impl TextSvg {
.collect(); .collect();
let text: String = text_pieces.join("\n"); let text: String = text_pieces.join("\n");
let final_svg = format!("<svg viewBox=\"0 0 {} {}\" xmlns=\"http://www.w3.org/2000/svg\"><defs>{}</defs><text x=\"50%\" y=\"50%\" dominant-baseline=\"middle\" text-anchor=\"middle\" font-weight=\"bold\" font-family=\"{}\" font-size=\"{}\" fill=\"{}\" {} style=\"filter:url(#shadow);\">{}</text></svg>", let final_svg = format!(
size.width, "<svg viewBox=\"0 0 {} {}\" xmlns=\"http://www.w3.org/2000/svg\"><defs>{}</defs><text x=\"50%\" y=\"50%\" dominant-baseline=\"middle\" text-anchor=\"middle\" font-weight=\"bold\" font-family=\"{}\" font-size=\"{}\" fill=\"{}\" {} style=\"filter:url(#shadow);\">{}</text></svg>",
size.height, size.width,
shadow, size.height,
self.font.name, shadow,
font_size, self.font.name,
self.fill, stroke, text); font_size,
self.fill,
stroke,
text
);
let hashed_title = rapidhash_v3(final_svg.as_bytes()); let hashed_title = rapidhash_v3(final_svg.as_bytes());
path.push(PathBuf::from(hashed_title.to_string())); path.push(PathBuf::from(hashed_title.to_string()));

View file

@ -1,7 +1,7 @@
#+TITLE: The Task list for Lumina #+TITLE: The Task list for Lumina
* TODO [#A] Add removal and reordering of service_items * DONE [#A] Add removal and reordering of service_items
Reordering is finished Reordering is finished
* TODO Add OBS integration * TODO Add OBS integration
This will be based on each slide having the ability to activate an OBS scene when it is active. This will be based on each slide having the ability to activate an OBS scene when it is active.