Creating external image configuration tool UI + connection to cinnamon extension settings
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*.glade~
|
||||||
|
*.glade#
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
const UUID = "cinnamon-dynamic-wallpaper@TobiZog";
|
const UUID = "cinnamon-dynamic-wallpaper@TobiZog";
|
||||||
const APPNAME = "Cinnamon Dynamic Wallpaper"
|
const APPNAME = "Cinnamon Dynamic Wallpaper"
|
||||||
|
const DIRECTORY = imports.ui.extensionSystem.extensionMeta[UUID];
|
||||||
|
|
||||||
|
|
||||||
/********** Imports **********/
|
/********** Imports **********/
|
||||||
@@ -18,6 +19,7 @@ const St = imports.gi.St;
|
|||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Util = imports.misc.util;
|
const Util = imports.misc.util;
|
||||||
const Settings = imports.ui.settings;
|
const Settings = imports.ui.settings;
|
||||||
|
const { find_program_in_path } = imports.gi.GLib;
|
||||||
|
|
||||||
|
|
||||||
/********** Global Variables **********/
|
/********** Global Variables **********/
|
||||||
@@ -41,13 +43,6 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
*/
|
*/
|
||||||
_init: function(uuid) {
|
_init: function(uuid) {
|
||||||
this.settings = new Settings.AppletSettings(this, uuid);
|
this.settings = new Settings.AppletSettings(this, uuid);
|
||||||
|
|
||||||
// Display the welcome notification on activation
|
|
||||||
this.showNotification(
|
|
||||||
APPNAME,
|
|
||||||
"Welcome to " + APPNAME + "! Open the settings and configure the extensions.",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -93,8 +88,9 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
* Callback for settings-schema
|
* Callback for settings-schema
|
||||||
* Opens the external heic-importer window
|
* Opens the external heic-importer window
|
||||||
*/
|
*/
|
||||||
configCustomImageSet: function() {
|
openImageConfigurator: function() {
|
||||||
// todo
|
global.log(DIRECTORY.path + "/image-configurator/image-configurator.py")
|
||||||
|
Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/image-configurator/image-configurator.py");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -127,6 +123,18 @@ function init(extensionMeta) {
|
|||||||
* @returns The extension object
|
* @returns The extension object
|
||||||
*/
|
*/
|
||||||
function enable() {
|
function enable() {
|
||||||
|
// Check for necessary software
|
||||||
|
if (!find_program_in_path('heif-convert')) {
|
||||||
|
Util.spawnCommandLine("apturl apt://libheif-examples");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display the welcome notification on activation
|
||||||
|
extension.showNotification(
|
||||||
|
APPNAME,
|
||||||
|
"Welcome to " + APPNAME + "! Open the settings and configure the extensions.",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,856 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.40.0 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.24"/>
|
||||||
|
<object class="GtkFileFilter" id="filefilter1">
|
||||||
|
<patterns>
|
||||||
|
<pattern>*.heic</pattern>
|
||||||
|
</patterns>
|
||||||
|
</object>
|
||||||
|
<object class="GtkListStore" id="image_set_list_store">
|
||||||
|
<columns>
|
||||||
|
<!-- column-name gchararray1 -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
</columns>
|
||||||
|
</object>
|
||||||
|
<object class="GtkWindow" id="main_window">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="window-position">center</property>
|
||||||
|
<property name="default-width">1000</property>
|
||||||
|
<property name="default-height">768</property>
|
||||||
|
<property name="icon">../icons/icon.png</property>
|
||||||
|
<signal name="destroy" handler="onDestroy" swapped="no"/>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkViewport">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vscroll-policy">natural</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">8</property>
|
||||||
|
<property name="margin-end">8</property>
|
||||||
|
<property name="margin-top">8</property>
|
||||||
|
<property name="margin-bottom">8</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.009999999776482582</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="left-padding">12</property>
|
||||||
|
<child>
|
||||||
|
<!-- n-columns=2 n-rows=2 -->
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">8</property>
|
||||||
|
<property name="margin-end">8</property>
|
||||||
|
<property name="margin-top">8</property>
|
||||||
|
<property name="margin-bottom">8</property>
|
||||||
|
<property name="row-spacing">8</property>
|
||||||
|
<property name="column-spacing">8</property>
|
||||||
|
<property name="column-homogeneous">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Use an included or a custom image set?</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
<property name="height">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="rb_included_image_set">
|
||||||
|
<property name="label" translatable="yes">Use an included image set</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">False</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
<property name="draw-indicator">True</property>
|
||||||
|
<signal name="toggled" handler="onRadioIncludedImageSet" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="rb_external_image_set">
|
||||||
|
<property name="label" translatable="yes">Import a heic-file</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">False</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
<property name="draw-indicator">True</property>
|
||||||
|
<property name="group">rb_included_image_set</property>
|
||||||
|
<signal name="toggled" handler="onRadioExternalImageSet" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Image Source</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.009999999776482582</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="left-padding">12</property>
|
||||||
|
<child>
|
||||||
|
<!-- n-columns=2 n-rows=2 -->
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">8</property>
|
||||||
|
<property name="margin-end">8</property>
|
||||||
|
<property name="margin-top">8</property>
|
||||||
|
<property name="margin-bottom">8</property>
|
||||||
|
<property name="row-spacing">8</property>
|
||||||
|
<property name="column-spacing">8</property>
|
||||||
|
<property name="column-homogeneous">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="lb_image_set">
|
||||||
|
<property name="height-request">36</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Select an image-set</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFileChooserButton" id="fc_heic_file">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="no-show-all">True</property>
|
||||||
|
<property name="filter">filefilter1</property>
|
||||||
|
<property name="title" translatable="yes"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="lb_heic_file">
|
||||||
|
<property name="height-request">36</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="no-show-all">True</property>
|
||||||
|
<property name="label" translatable="yes">Choose the file, which you want to use</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox" id="cb_image_set">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="model">image_set_list_store</property>
|
||||||
|
<property name="has-entry">True</property>
|
||||||
|
<property name="entry-text-column">0</property>
|
||||||
|
<child internal-child="entry">
|
||||||
|
<object class="GtkEntry">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Image Set</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="label-xalign">0.009999999776482582</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<!-- n-columns=3 n-rows=3 -->
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="row-spacing">8</property>
|
||||||
|
<property name="column-spacing">8</property>
|
||||||
|
<property name="row-homogeneous">True</property>
|
||||||
|
<property name="column-homogeneous">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.5</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="top-padding">8</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="img_preview_1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
<property name="pixel-size">30</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Morning Twilight</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.5</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="top-padding">8</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="img_preview_2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Sunrise</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.5</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="top-padding">8</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="img_preview_3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Morning</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.5</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="top-padding">8</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="img_preview_4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Noon</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.5</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="top-padding">8</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="img_preview_5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Afternoon</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.5</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="top-padding">8</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="img_preview_6">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Evening</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.5</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="top-padding">8</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="img_preview_7">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Sunset</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.5</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="top-padding">8</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="img_preview_8">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Night Twilight</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label-xalign">0.5</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="top-padding">8</property>
|
||||||
|
<property name="bottom-padding">8</property>
|
||||||
|
<property name="left-padding">8</property>
|
||||||
|
<property name="right-padding">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="img_preview_9">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Night</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">4</property>
|
||||||
|
<property name="margin-end">4</property>
|
||||||
|
<property name="label" translatable="yes">Preview</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="titlebar">
|
||||||
|
<object class="GtkHeaderBar">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="title" translatable="yes">Cinnamon Dynamic Wallpaper</property>
|
||||||
|
<property name="subtitle" translatable="yes">Image Configuration</property>
|
||||||
|
<property name="show-close-button">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label">gtk-apply</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<property name="use-stock">True</property>
|
||||||
|
<property name="always-show-image">True</property>
|
||||||
|
<signal name="clicked" handler="onApply" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
import gi, os
|
||||||
|
|
||||||
|
gi.require_version("Gtk", "3.0")
|
||||||
|
from gi.repository import Gtk
|
||||||
|
|
||||||
|
UI_FILE = os.path.dirname(os.path.abspath(__file__)) + "/image-configurator.glade"
|
||||||
|
|
||||||
|
class ImageConfigurator:
|
||||||
|
def __init__(self) -> None:
|
||||||
|
self.builder = Gtk.Builder()
|
||||||
|
self.builder.add_from_file(UI_FILE)
|
||||||
|
self.builder.connect_signals(self)
|
||||||
|
|
||||||
|
# Get all resources from the glade file
|
||||||
|
self.imageSetText = self.builder.get_object("lb_image_set")
|
||||||
|
self.imageSetCb = self.builder.get_object("cb_image_set")
|
||||||
|
|
||||||
|
self.fileChooserText = self.builder.get_object("lb_heic_file")
|
||||||
|
self.fileChooserFc = self.builder.get_object("fc_heic_file")
|
||||||
|
self.image_set_list_store = self.builder.get_object("image_set_list_store")
|
||||||
|
|
||||||
|
self.img_previews = [
|
||||||
|
self.builder.get_object("img_preview_1"),
|
||||||
|
self.builder.get_object("img_preview_2"),
|
||||||
|
self.builder.get_object("img_preview_3"),
|
||||||
|
self.builder.get_object("img_preview_4"),
|
||||||
|
self.builder.get_object("img_preview_5"),
|
||||||
|
self.builder.get_object("img_preview_6"),
|
||||||
|
self.builder.get_object("img_preview_7"),
|
||||||
|
self.builder.get_object("img_preview_8"),
|
||||||
|
self.builder.get_object("img_preview_9")
|
||||||
|
]
|
||||||
|
|
||||||
|
# Predefinition
|
||||||
|
self.image_set_list_store.append(["Big Sur Beach 2"])
|
||||||
|
self.image_set_list_store.append(["Firewatch"])
|
||||||
|
self.image_set_list_store.append(["Lakeside"])
|
||||||
|
|
||||||
|
|
||||||
|
def showMainWindow(self):
|
||||||
|
window = self.builder.get_object("main_window")
|
||||||
|
window.show_all()
|
||||||
|
|
||||||
|
Gtk.main()
|
||||||
|
|
||||||
|
|
||||||
|
def changeImage(self, imageId: int, imageURI: str):
|
||||||
|
self.img_previews[imageId].set_from_file(os.path.dirname(os.path.abspath(__file__)) + "/" + imageURI)
|
||||||
|
|
||||||
|
|
||||||
|
def onRadioIncludedImageSet(self, rb):
|
||||||
|
if rb.get_active():
|
||||||
|
self.imageSetText.set_visible(True)
|
||||||
|
self.imageSetCb.set_visible(True)
|
||||||
|
|
||||||
|
self.fileChooserText.set_visible(False)
|
||||||
|
self.fileChooserFc.set_visible(False)
|
||||||
|
|
||||||
|
|
||||||
|
def onRadioExternalImageSet(self, rb):
|
||||||
|
if rb.get_active():
|
||||||
|
self.fileChooserText.set_visible(True)
|
||||||
|
self.fileChooserFc.set_visible(True)
|
||||||
|
|
||||||
|
self.imageSetText.set_visible(False)
|
||||||
|
self.imageSetCb.set_visible(False)
|
||||||
|
|
||||||
|
|
||||||
|
def onApply(self, *args):
|
||||||
|
# todo
|
||||||
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
|
||||||
|
def onDestroy(self, *args):
|
||||||
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
|
||||||
|
ic = ImageConfigurator()
|
||||||
|
ic.showMainWindow()
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"type": "page",
|
"type": "page",
|
||||||
"title": "Configuration",
|
"title": "Configuration",
|
||||||
"sections": [
|
"sections": [
|
||||||
"sec_image_set",
|
"sec_image_configuration",
|
||||||
"sec_location"
|
"sec_location"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -21,13 +21,12 @@
|
|||||||
"sec_github"
|
"sec_github"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"sec_image_set": {
|
"sec_image_configuration": {
|
||||||
"type": "section",
|
"type": "section",
|
||||||
"title": "Image set",
|
"title": "Image set",
|
||||||
"keys": [
|
"keys": [
|
||||||
"sw_template_enabled",
|
"lb_image_configuration",
|
||||||
"rg_choose_template",
|
"btn_config_images"
|
||||||
"btn_config_custom_image_set"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"sec_location": {
|
"sec_location": {
|
||||||
@@ -57,25 +56,14 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sw_template_enabled": {
|
"lb_image_configuration": {
|
||||||
"type": "switch",
|
"type": "label",
|
||||||
"default": true,
|
"description": "Choose an included image set or import a heic-file with the Image Configurator"
|
||||||
"description": "Use a included image set"
|
|
||||||
},
|
},
|
||||||
"rg_choose_template": {
|
"btn_config_images": {
|
||||||
"type": "radiogroup",
|
|
||||||
"default": "",
|
|
||||||
"description": "Choose a set of images",
|
|
||||||
"options": {
|
|
||||||
"": ""
|
|
||||||
},
|
|
||||||
"dependency": "sw_template_enabled"
|
|
||||||
},
|
|
||||||
"btn_config_custom_image_set": {
|
|
||||||
"type": "button",
|
"type": "button",
|
||||||
"description": "Create your own image set from images",
|
"description": "Image Configurator",
|
||||||
"callback": "configCustomImageSet",
|
"callback": "openImageConfigurator"
|
||||||
"dependency": "!sw_template_enabled"
|
|
||||||
},
|
},
|
||||||
"sw_auto_location": {
|
"sw_auto_location": {
|
||||||
"type": "switch",
|
"type": "switch",
|
||||||
|
|||||||
Reference in New Issue
Block a user