-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of a bar displaying the name of the image being displayed #3
base: master
Are you sure you want to change the base?
Conversation
and not the fie path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the smaller stuff I've pointed out as we've discussed on IRC it would make sense to show the image width and height as well at least.
src/main.rs
Outdated
.center_justify() | ||
.line_spacing(10.0) | ||
.set(ids.lefttext, ui); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace here is misaligned
src/main.rs
Outdated
|
||
if let Some(ref f) = file { | ||
let file_name = Path::new(f).file_name().unwrap(); | ||
widget::Text::new(file_name.to_str().unwrap()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These unwrap()s need to be handled
src/main.rs
Outdated
(ids.imgcanvas, widget::Canvas::new().color(color::CHARCOAL).border(0.0)), | ||
(ids.leftarea, widget::Canvas::new().color(color::CHARCOAL).border(0.0).flow_down(&[ | ||
(ids.imgcanvas, widget::Canvas::new().color(color::GREY).border(0.0)), | ||
(ids.footer, widget::Canvas::new().color(color::CHARCOAL).length(75.0).border(0.0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The footer is probably too tall for just the text. It should be sized to hold 1.5 font heights or something like that.
@@ -41,7 +42,7 @@ fn main() { | |||
let mut renderer = conrod::backend::glium::Renderer::new(&display).unwrap(); | |||
|
|||
// The `WidgetId` for our background and `Image` widgets. | |||
widget_ids!(struct Ids { background, imgcanvas, dragcanvas, setcanvas, settop, setcont, raw_image, chimper, filenav }); | |||
widget_ids!(struct Ids { background, imgcanvas, dragcanvas, leftarea, lefttext, footer,setcanvas, settop, setcont, raw_image, chimper, filenav }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lefttext doesn't exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lefttext is being used on line 188
@@ -155,6 +159,20 @@ fn main() { | |||
.set(ids.chimper, ui); | |||
} | |||
|
|||
const PAD: Scalar = 20.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just copied from the example and has no meaning in this program. A proper variable name should be used instead.
.line_spacing(10.0) | ||
.set(ids.lefttext, ui); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably excess white space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still very far from being finished, sorry.
@@ -81,4 +81,33 @@ impl ImageCache { | |||
ui.needs_update(); | |||
}); | |||
} | |||
} | |||
|
|||
pub fn get_image_dimensions<'a>(&'a self, path: String, size: usize) -> Option<(usize,usize)>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing the image all over again just to get the dimensions is just broken.
}, | ||
}; | ||
let imgwidth = decoded.width; | ||
let imgheight = decoded.height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't return the image dimensions, it will return the decoded dimensions that in the case of raws has been downsized.
(ids.imgcanvas, widget::Canvas::new().color(color::CHARCOAL).border(0.0)), | ||
(ids.leftarea, widget::Canvas::new().color(color::CHARCOAL).border(0.0).flow_down(&[ | ||
(ids.imgcanvas, widget::Canvas::new().color(color::GREY).border(0.0)), | ||
(ids.footer, widget::Canvas::new().color(color::CHARCOAL).length(60.0).border(0.0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to be sized to the font size.
let height_usize = dimensions.1; | ||
|
||
let width = &width_usize.to_string(); | ||
let height = &height_usize.to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed at all. format!
can handle the usize directly.
No description provided.