Skip to content

Commit 3d8d82d

Browse files
picture-frames@KopfdesDaemons: New error layout (#1796)
1 parent 554a462 commit 3d8d82d

4 files changed

Lines changed: 25 additions & 6 deletions

File tree

picture-frames@KopfdesDaemons/files/picture-frames@KopfdesDaemons/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [1.1.1] 06.04.2026
4+
5+
- New Features
6+
- New Error Layout
7+
- Fixes
8+
- Fixed a bug where the error layout was not loaded when an error occurred,
9+
and the loading text was permanently displayed.
10+
311
## [1.1.0] 06.04.2026
412

513
- New Features

picture-frames@KopfdesDaemons/files/picture-frames@KopfdesDaemons/desklet.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@ class MyDesklet extends Desklet.Desklet {
171171
}
172172

173173
_createShapedImageActor(imagePath, size, loadId) {
174+
const container = new St.Bin({ width: size, height: size });
174175
const canvas = new Clutter.Canvas();
175176
canvas.set_size(size, size);
176177
const actor = new Clutter.Actor({ width: size, height: size, content: canvas });
178+
container.set_child(actor);
177179
const file = Gio.file_new_for_path(imagePath);
178180
let iter = null;
179181

@@ -237,13 +239,15 @@ class MyDesklet extends Desklet.Desklet {
237239
updateAnimation();
238240
} catch (e) {
239241
global.logError(`${UUID}: Error creating pixbuf animation from stream: ${e}`);
242+
container.set_child(this._getErrorLayout(`Error creating pixbuf animation from stream: ${e}`));
240243
}
241244
});
242245
} catch (e) {
243246
global.logError(`${UUID}: Error reading file async: ${e}`);
247+
container.set_child(this._getErrorLayout(`Error reading file: ${e}`));
244248
}
245249
});
246-
return actor;
250+
return container;
247251
}
248252

249253
_drawFinalImage(cr, pixbuf, width, height) {
@@ -316,9 +320,19 @@ class MyDesklet extends Desklet.Desklet {
316320
return this._createActorFromPixbuf(pixBuf);
317321
} catch (e) {
318322
global.logError(`${UUID}: Error loading image ${imageFileName}: ${e}`);
319-
return new St.Label({ text: "Error" + e.message, style_class: "picture-frame-error-label" });
323+
return this._getErrorLayout(`Error loading image ${imageFileName}: ${e}`);
320324
}
321325
}
326+
327+
_getErrorLayout(message) {
328+
const headline = new St.Label({ text: _("Picture Frame"), style: `font-weight: bold; color: red; font-size: 1.2em;` });
329+
const label = new St.Label({ text: "Error: " + message, style: `color: red;` });
330+
label.clutter_text.set_line_wrap(true);
331+
const errorLayout = new St.BoxLayout({ vertical: true, width: this.size, height: this.size, style: `background-color: #d3b0ae; padding: 1em; spacing: 1em;` });
332+
errorLayout.add_child(headline);
333+
errorLayout.add_child(label);
334+
return errorLayout;
335+
}
322336
}
323337

324338
function main(metadata, deskletId) {

picture-frames@KopfdesDaemons/files/picture-frames@KopfdesDaemons/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"uuid": "picture-frames@KopfdesDaemons",
33
"name": "Picture frames",
44
"description": "Displays photos in different picture frames.",
5-
"version": "1.1.0",
5+
"version": "1.1.1",
66
"prevent-decorations": true,
77
"max-instances": "50"
88
}

picture-frames@KopfdesDaemons/files/picture-frames@KopfdesDaemons/stylesheet.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)