mirror of https://github.com/lapce/lapce.git
Merge pull request #586 from mrxiaozhuox/master
Add `Plugin load failed` message
This commit is contained in:
commit
f20991d7c1
|
@ -158,6 +158,28 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
|
||||||
let viewport = ctx.size().to_rect().inflate(-padding, 0.0);
|
let viewport = ctx.size().to_rect().inflate(-padding, 0.0);
|
||||||
ctx.clip(viewport);
|
ctx.clip(viewport);
|
||||||
|
|
||||||
|
if data.plugins.is_empty() {
|
||||||
|
let y = self.line_height;
|
||||||
|
let x = self.line_height;
|
||||||
|
let layout = ctx
|
||||||
|
.text()
|
||||||
|
.new_text_layout("Failed to load plugin information")
|
||||||
|
.font(
|
||||||
|
data.config.ui.font_family(),
|
||||||
|
data.config.ui.font_size() as f64,
|
||||||
|
)
|
||||||
|
.default_attribute(TextAttribute::Weight(FontWeight::SEMI_BOLD))
|
||||||
|
.text_color(
|
||||||
|
data.config
|
||||||
|
.get_color_unchecked(LapceTheme::LAPCE_WARN)
|
||||||
|
.clone(),
|
||||||
|
)
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
ctx.draw_text(&layout, Point::new(x, y));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i, plugin) in data.plugins.iter().enumerate() {
|
for (i, plugin) in data.plugins.iter().enumerate() {
|
||||||
let y = 3.0 * self.line_height * i as f64;
|
let y = 3.0 * self.line_height * i as f64;
|
||||||
let x = 3.0 * self.line_height;
|
let x = 3.0 * self.line_height;
|
||||||
|
|
Loading…
Reference in New Issue