Image sets
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
extracted/
|
extracted/
|
||||||
custom_images/
|
custom_images/
|
||||||
*.txt
|
*.txt
|
||||||
|
selected/
|
||||||
@@ -159,7 +159,8 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
|
|
||||||
for(let i = 0; i < timesArray.length; i++) {
|
for(let i = 0; i < timesArray.length; i++) {
|
||||||
if(timesArray[i][0] <= now && now <= timesArray[i][1] && i != lastDayTime) {
|
if(timesArray[i][0] <= now && now <= timesArray[i][1] && i != lastDayTime) {
|
||||||
this.changeWallpaper("file://" + PATH + "/res/custom_images/" + imageSet[i])
|
global.log(PATH + "/res/images/selected/" + imageSet[i])
|
||||||
|
this.changeWallpaper("file://" + PATH + "/images/selected/" + imageSet[i])
|
||||||
|
|
||||||
lastDayTime = i
|
lastDayTime = i
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -7,18 +7,6 @@
|
|||||||
<pattern>*.heic</pattern>
|
<pattern>*.heic</pattern>
|
||||||
</patterns>
|
</patterns>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkListStore" id="image_set_list_store">
|
|
||||||
<columns>
|
|
||||||
<!-- column-name gchararray1 -->
|
|
||||||
<column type="gchararray"/>
|
|
||||||
</columns>
|
|
||||||
</object>
|
|
||||||
<object class="GtkListStore" id="ls_preview">
|
|
||||||
<columns>
|
|
||||||
<!-- column-name gchararray1 -->
|
|
||||||
<column type="gchararray"/>
|
|
||||||
</columns>
|
|
||||||
</object>
|
|
||||||
<object class="GtkScrolledWindow" id="page_config">
|
<object class="GtkScrolledWindow" id="page_config">
|
||||||
<property name="width-request">100</property>
|
<property name="width-request">100</property>
|
||||||
<property name="height-request">80</property>
|
<property name="height-request">80</property>
|
||||||
@@ -189,17 +177,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_image_set">
|
<object class="GtkComboBoxText" id="cb_image_set">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">image_set_list_store</property>
|
<signal name="changed" handler="onImageSetSelected" swapped="no"/>
|
||||||
<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>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
@@ -286,18 +267,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_preview_1">
|
<object class="GtkComboBoxText" id="cb_preview_1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">ls_preview</property>
|
|
||||||
<property name="has-entry">True</property>
|
|
||||||
<property name="entry-text-column">0</property>
|
|
||||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||||
<child internal-child="entry">
|
|
||||||
<object class="GtkEntry">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -360,18 +333,9 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_preview_2">
|
<object class="GtkComboBoxText" id="cb_preview_2">
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">ls_preview</property>
|
|
||||||
<property name="has-entry">True</property>
|
|
||||||
<property name="entry-text-column">0</property>
|
|
||||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||||
<child internal-child="entry">
|
|
||||||
<object class="GtkEntry">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -434,18 +398,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_preview_3">
|
<object class="GtkComboBoxText" id="cb_preview_3">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">ls_preview</property>
|
|
||||||
<property name="has-entry">True</property>
|
|
||||||
<property name="entry-text-column">0</property>
|
|
||||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||||
<child internal-child="entry">
|
|
||||||
<object class="GtkEntry">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -508,18 +464,9 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_preview_4">
|
<object class="GtkComboBoxText" id="cb_preview_4">
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">ls_preview</property>
|
|
||||||
<property name="has-entry">True</property>
|
|
||||||
<property name="entry-text-column">0</property>
|
|
||||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||||
<child internal-child="entry">
|
|
||||||
<object class="GtkEntry">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -582,18 +529,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_preview_5">
|
<object class="GtkComboBoxText" id="cb_preview_5">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">ls_preview</property>
|
|
||||||
<property name="has-entry">True</property>
|
|
||||||
<property name="entry-text-column">0</property>
|
|
||||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||||
<child internal-child="entry">
|
|
||||||
<object class="GtkEntry">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -656,18 +595,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_preview_6">
|
<object class="GtkComboBoxText" id="cb_preview_6">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">ls_preview</property>
|
|
||||||
<property name="has-entry">True</property>
|
|
||||||
<property name="entry-text-column">0</property>
|
|
||||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||||
<child internal-child="entry">
|
|
||||||
<object class="GtkEntry">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -730,18 +661,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_preview_7">
|
<object class="GtkComboBoxText" id="cb_preview_7">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">ls_preview</property>
|
|
||||||
<property name="has-entry">True</property>
|
|
||||||
<property name="entry-text-column">0</property>
|
|
||||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||||
<child internal-child="entry">
|
|
||||||
<object class="GtkEntry">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -804,18 +727,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_preview_8">
|
<object class="GtkComboBoxText" id="cb_preview_8">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">ls_preview</property>
|
|
||||||
<property name="has-entry">True</property>
|
|
||||||
<property name="entry-text-column">0</property>
|
|
||||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||||
<child internal-child="entry">
|
|
||||||
<object class="GtkEntry">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -878,18 +793,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="cb_preview_9">
|
<object class="GtkComboBoxText" id="cb_preview_9">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="model">ls_preview</property>
|
|
||||||
<property name="has-entry">True</property>
|
|
||||||
<property name="entry-text-column">0</property>
|
|
||||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||||
<child internal-child="entry">
|
|
||||||
<object class="GtkEntry">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|||||||
@@ -3,18 +3,21 @@ import gi, os, glob, json, shutil, enum, threading
|
|||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
from gi.repository import Gtk, GdkPixbuf
|
from gi.repository import Gtk, GdkPixbuf
|
||||||
|
|
||||||
PROJECT_DIR = os.path.dirname(os.path.dirname(__file__))
|
PROJECT_DIR = os.path.dirname(os.path.dirname(__file__)) + "/"
|
||||||
PROG_DIR = PROJECT_DIR + "/image-configurator"
|
UI_PATH = PROJECT_DIR + "image-configurator/" + "image-configurator.glade"
|
||||||
EXPORT_DIR = PROG_DIR + "/extracted"
|
|
||||||
RES_DIR = PROJECT_DIR + "/res"
|
IMAGE_DIR = PROJECT_DIR + "images/"
|
||||||
UI_PATH = PROG_DIR + "/image-configurator.glade"
|
IMAGE_EXTRACT_DIR = IMAGE_DIR + "extracted/"
|
||||||
|
IMAGE_SETS_DIR = IMAGE_DIR + "included_image_sets/"
|
||||||
|
IMAGE_SELECTED_DIR = IMAGE_DIR + "selected/"
|
||||||
|
|
||||||
PREF_PATH = os.path.expanduser("~") + \
|
PREF_PATH = os.path.expanduser("~") + \
|
||||||
"/.config/cinnamon/spices/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json"
|
"/.config/cinnamon/spices/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json"
|
||||||
|
|
||||||
class Source(enum.Enum):
|
class Source(enum.Enum):
|
||||||
RESSOURCES = 0
|
SELECTED = 0 # Load previous selected images
|
||||||
EXPORT = 1
|
EXTRACT = 1 # Use a custom image set from a heic file
|
||||||
SET = 2
|
SET = 2 # Use an included image set
|
||||||
|
|
||||||
|
|
||||||
class ImageConfigurator:
|
class ImageConfigurator:
|
||||||
@@ -32,14 +35,23 @@ class ImageConfigurator:
|
|||||||
"etr_img_night"
|
"etr_img_night"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
self.img_sets = [
|
||||||
|
"aurora",
|
||||||
|
"beach",
|
||||||
|
"bitday",
|
||||||
|
"lakeside",
|
||||||
|
"mountains",
|
||||||
|
"sahara"
|
||||||
|
]
|
||||||
|
|
||||||
########### Create the folder ###########
|
########### Create the folder ###########
|
||||||
try:
|
try:
|
||||||
os.mkdir(EXPORT_DIR)
|
os.mkdir(IMAGE_EXTRACT_DIR)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.mkdir(RES_DIR + "/custom_images")
|
os.mkdir(IMAGE_SELECTED_DIR)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -57,8 +69,6 @@ class ImageConfigurator:
|
|||||||
|
|
||||||
self.lb_heic_file = self.builder.get_object("lb_heic_file")
|
self.lb_heic_file = self.builder.get_object("lb_heic_file")
|
||||||
self.fc_heic_file = self.builder.get_object("fc_heic_file")
|
self.fc_heic_file = self.builder.get_object("fc_heic_file")
|
||||||
self.image_set_list_store = self.builder.get_object("image_set_list_store")
|
|
||||||
self.ls_preview = self.builder.get_object("ls_preview")
|
|
||||||
|
|
||||||
self.img_previews = [
|
self.img_previews = [
|
||||||
self.builder.get_object("img_preview_1"),
|
self.builder.get_object("img_preview_1"),
|
||||||
@@ -92,10 +102,11 @@ class ImageConfigurator:
|
|||||||
|
|
||||||
|
|
||||||
########### Load predefinitions and settings ###########
|
########### Load predefinitions and settings ###########
|
||||||
self.image_set_list_store.append(["Big Sur Beach 2"])
|
for set in self.img_sets:
|
||||||
self.image_set_list_store.append(["Firewatch"])
|
self.cb_image_set.append_text(set)
|
||||||
self.image_set_list_store.append(["Lakeside"])
|
|
||||||
# todo
|
self.image_source = Source.SELECTED
|
||||||
|
|
||||||
|
|
||||||
# Load preferences
|
# Load preferences
|
||||||
self.loadFromSettings()
|
self.loadFromSettings()
|
||||||
@@ -107,6 +118,9 @@ class ImageConfigurator:
|
|||||||
window = self.builder.get_object("main_window")
|
window = self.builder.get_object("main_window")
|
||||||
window.show_all()
|
window.show_all()
|
||||||
|
|
||||||
|
self.imageSetVisibility(self.image_source)
|
||||||
|
self.rb_external_image_set.set_active(self.image_source == Source.EXTRACT)
|
||||||
|
|
||||||
Gtk.main()
|
Gtk.main()
|
||||||
|
|
||||||
|
|
||||||
@@ -118,21 +132,35 @@ class ImageConfigurator:
|
|||||||
pref_data = json.load(pref_file)
|
pref_data = json.load(pref_file)
|
||||||
|
|
||||||
|
|
||||||
# Use the settings
|
# Get all images in the "selected" folder
|
||||||
if pref_data["etr_choosen_image_set"]["value"] == "custom":
|
choosable_images = os.listdir(IMAGE_SELECTED_DIR)
|
||||||
self.image_source = Source.RESSOURCES
|
choosable_images.sort()
|
||||||
else:
|
|
||||||
#todo
|
|
||||||
pass
|
# Add the founded image names to the ComboBoxes
|
||||||
|
if pref_data["etr_choosen_image_set"]["value"] == "custom":
|
||||||
|
for combobox in self.cb_previews:
|
||||||
|
for option in choosable_images:
|
||||||
|
combobox.append_text(option)
|
||||||
|
else:
|
||||||
|
for i, set in enumerate(self.img_sets):
|
||||||
|
if set == pref_data["etr_choosen_image_set"]["value"]:
|
||||||
|
self.cb_image_set.set_active(i)
|
||||||
|
|
||||||
self.createExtracted()
|
|
||||||
|
|
||||||
for i, val in enumerate(self.pref_vars):
|
for i, val in enumerate(self.pref_vars):
|
||||||
try:
|
# Set the preview image
|
||||||
self.changePreviewImage(i, RES_DIR + "/custom_images/" + pref_data[val]['value'])
|
self.changePreviewImage(i, IMAGE_SELECTED_DIR + pref_data[val]['value'])
|
||||||
self.cb_previews[i].set_active(self.extracted.index(pref_data[val]['value']))
|
|
||||||
except:
|
# Set the ComboBox selection
|
||||||
pass
|
if pref_data["etr_choosen_image_set"]["value"] == "custom":
|
||||||
|
self.image_source = Source.EXTRACT
|
||||||
|
|
||||||
|
for j, set in enumerate(choosable_images):
|
||||||
|
if set == pref_data[val]["value"]:
|
||||||
|
self.cb_previews[i].set_active(j)
|
||||||
|
else:
|
||||||
|
self.image_source = Source.SET
|
||||||
|
|
||||||
|
|
||||||
def writeToSettings(self):
|
def writeToSettings(self):
|
||||||
@@ -144,17 +172,17 @@ class ImageConfigurator:
|
|||||||
|
|
||||||
|
|
||||||
# Update the settings
|
# Update the settings
|
||||||
|
if self.image_source == Source.SET:
|
||||||
|
pref_data["etr_choosen_image_set"]["value"] = self.cb_image_set.get_active_text()
|
||||||
|
|
||||||
for i, val in enumerate(self.pref_vars):
|
for i, val in enumerate(self.pref_vars):
|
||||||
pref_data[val]['value'] = self.extracted[self.cb_previews[i].get_active()]
|
pref_data[val]['value'] = str(i + 1) + ".jpg"
|
||||||
|
|
||||||
|
|
||||||
if self.rb_included_image_set:
|
|
||||||
#pref_data["etr_choosen_image_set"]["value"] = self.cb_image_set.
|
|
||||||
# todo
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
pref_data["etr_choosen_image_set"]["value"] = "custom"
|
pref_data["etr_choosen_image_set"]["value"] = "custom"
|
||||||
|
|
||||||
|
for i, val in enumerate(self.pref_vars):
|
||||||
|
pref_data[val]['value'] = self.cb_previews[i].get_active_text()
|
||||||
|
|
||||||
|
|
||||||
# Write the settings
|
# Write the settings
|
||||||
with open(PREF_PATH, "w") as pref_file:
|
with open(PREF_PATH, "w") as pref_file:
|
||||||
@@ -184,10 +212,10 @@ class ImageConfigurator:
|
|||||||
|
|
||||||
filename = imageURI[imageURI.rfind("/") + 1:imageURI.rfind(".")]
|
filename = imageURI[imageURI.rfind("/") + 1:imageURI.rfind(".")]
|
||||||
|
|
||||||
self.image_source = Source.EXPORT
|
self.image_source = Source.EXTRACT
|
||||||
|
|
||||||
self.wipeImages(Source.EXPORT)
|
self.wipeImages(Source.EXTRACT)
|
||||||
os.system("heif-convert " + imageURI + " " + EXPORT_DIR + "/" + filename + ".jpg")
|
os.system("heif-convert " + imageURI + " " + IMAGE_EXTRACT_DIR + "/" + filename + ".jpg")
|
||||||
|
|
||||||
self.createExtracted()
|
self.createExtracted()
|
||||||
|
|
||||||
@@ -198,10 +226,10 @@ class ImageConfigurator:
|
|||||||
Args:
|
Args:
|
||||||
source (Source): Choose the folder by selecting the Source
|
source (Source): Choose the folder by selecting the Source
|
||||||
"""
|
"""
|
||||||
if source == Source.EXPORT:
|
if source == Source.EXTRACT:
|
||||||
dir = EXPORT_DIR + "/*"
|
dir = IMAGE_EXTRACT_DIR + "*"
|
||||||
elif source == Source.RESSOURCES:
|
elif source == Source.SELECTED:
|
||||||
dir = RES_DIR + "/custom_images/*"
|
dir = IMAGE_SELECTED_DIR + "*"
|
||||||
|
|
||||||
for file in glob.glob(dir):
|
for file in glob.glob(dir):
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
@@ -211,29 +239,37 @@ class ImageConfigurator:
|
|||||||
""" Create the extracted images array
|
""" Create the extracted images array
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if self.image_source == Source.RESSOURCES:
|
if self.image_source == Source.SELECTED:
|
||||||
self.extracted = os.listdir(RES_DIR + "/custom_images")
|
self.extracted = os.listdir(IMAGE_SELECTED_DIR)
|
||||||
elif self.image_source == Source.EXPORT:
|
elif self.image_source == Source.EXTRACT:
|
||||||
self.extracted = os.listdir(EXPORT_DIR)
|
self.extracted = os.listdir(IMAGE_EXTRACT_DIR)
|
||||||
|
|
||||||
self.extracted.sort()
|
self.extracted.sort()
|
||||||
self.ls_preview.clear()
|
|
||||||
|
|
||||||
|
for combobox in self.cb_previews:
|
||||||
for option in self.extracted:
|
for option in self.extracted:
|
||||||
self.ls_preview.append([option])
|
combobox.append_text(option)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.stack_main.set_visible_child_name("config")
|
self.stack_main.set_visible_child_name("config")
|
||||||
|
|
||||||
|
|
||||||
def copyToSource(self):
|
def copyToSelected(self, source: Source):
|
||||||
""" Copies the extracted images to "res/"
|
""" Copies the extracted images to "res/"
|
||||||
"""
|
"""
|
||||||
self.wipeImages(Source.RESSOURCES)
|
# Clean the "selected folder up"
|
||||||
|
self.wipeImages(Source.SELECTED)
|
||||||
|
|
||||||
for image in os.listdir(EXPORT_DIR):
|
# Estimate the source folder
|
||||||
shutil.copy(EXPORT_DIR + "/" + image, RES_DIR + "/custom_images/" + image)
|
if source == Source.EXTRACT:
|
||||||
|
source_folder = IMAGE_EXTRACT_DIR
|
||||||
|
else:
|
||||||
|
source_folder = IMAGE_SETS_DIR + self.cb_image_set.get_active_text() + "/"
|
||||||
|
|
||||||
|
# Copy it to "selected/"
|
||||||
|
for image in os.listdir(source_folder):
|
||||||
|
shutil.copy(source_folder + image, IMAGE_SELECTED_DIR + image)
|
||||||
|
|
||||||
|
|
||||||
def imageSetVisibility(self, source: Source):
|
def imageSetVisibility(self, source: Source):
|
||||||
@@ -242,16 +278,34 @@ class ImageConfigurator:
|
|||||||
Args:
|
Args:
|
||||||
source (Source): Toggle by type of Source
|
source (Source): Toggle by type of Source
|
||||||
"""
|
"""
|
||||||
|
self.image_source = source
|
||||||
|
|
||||||
self.lb_image_set.set_visible(source == Source.SET)
|
self.lb_image_set.set_visible(source == Source.SET)
|
||||||
self.cb_image_set.set_visible(source == Source.SET)
|
self.cb_image_set.set_visible(source == Source.SET)
|
||||||
|
|
||||||
self.lb_heic_file.set_visible(source != Source.SET)
|
self.lb_heic_file.set_visible(source != Source.SET)
|
||||||
self.fc_heic_file.set_visible(source != Source.SET)
|
self.fc_heic_file.set_visible(source != Source.SET)
|
||||||
|
|
||||||
|
for i in range(0, 9):
|
||||||
|
self.cb_previews[i].set_visible(source != Source.SET)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########## UI Signals ##########
|
########## UI Signals ##########
|
||||||
|
|
||||||
|
def onImageSetSelected(self, cb):
|
||||||
|
""" UI signal if the image set combo box value changed
|
||||||
|
|
||||||
|
Args:
|
||||||
|
cb (GtkComboBox): The active ComboBox
|
||||||
|
"""
|
||||||
|
if self.image_source != Source.SELECTED:
|
||||||
|
set_name = cb.get_active_text()
|
||||||
|
|
||||||
|
for i, _ in enumerate(self.img_previews):
|
||||||
|
self.changePreviewImage(i, IMAGE_SETS_DIR + set_name + "/" + str(i + 1) + ".jpg")
|
||||||
|
|
||||||
|
|
||||||
def onRadioImageSet(self, rb):
|
def onRadioImageSet(self, rb):
|
||||||
""" UI signal if the radio buttons are toggled
|
""" UI signal if the radio buttons are toggled
|
||||||
|
|
||||||
@@ -261,7 +315,7 @@ class ImageConfigurator:
|
|||||||
if rb.get_active():
|
if rb.get_active():
|
||||||
self.imageSetVisibility(Source.SET)
|
self.imageSetVisibility(Source.SET)
|
||||||
else:
|
else:
|
||||||
self.imageSetVisibility(Source.EXPORT)
|
self.imageSetVisibility(Source.EXTRACT)
|
||||||
|
|
||||||
|
|
||||||
def onHeifSelected(self, fc):
|
def onHeifSelected(self, fc):
|
||||||
@@ -290,18 +344,15 @@ class ImageConfigurator:
|
|||||||
number = Gtk.Buildable.get_name(cb)
|
number = Gtk.Buildable.get_name(cb)
|
||||||
number = number[number.rfind("_") + 1:]
|
number = number[number.rfind("_") + 1:]
|
||||||
|
|
||||||
# todo
|
if self.image_source == Source.EXTRACT:
|
||||||
if self.image_source == Source.RESSOURCES:
|
self.changePreviewImage(int(number) - 1, IMAGE_EXTRACT_DIR + cb.get_active_text())
|
||||||
self.changePreviewImage(int(number) - 1, RES_DIR + "/custom_images/" + self.extracted[cb.get_active()])
|
|
||||||
elif self.image_source == Source.EXPORT:
|
|
||||||
self.changePreviewImage(int(number) - 1, EXPORT_DIR + "/" + self.extracted[cb.get_active()])
|
|
||||||
|
|
||||||
|
|
||||||
def onApply(self, *args):
|
def onApply(self, *args):
|
||||||
""" UI signal if the user presses the "Apply" button
|
""" UI signal if the user presses the "Apply" button
|
||||||
"""
|
"""
|
||||||
self.writeToSettings()
|
self.writeToSettings()
|
||||||
self.copyToSource()
|
self.copyToSelected(self.image_source)
|
||||||
|
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
|||||||
|
After Width: | Height: | Size: 454 KiB |
|
After Width: | Height: | Size: 488 KiB |
|
After Width: | Height: | Size: 436 KiB |
|
After Width: | Height: | Size: 436 KiB |
|
After Width: | Height: | Size: 470 KiB |
|
After Width: | Height: | Size: 435 KiB |
|
After Width: | Height: | Size: 426 KiB |
|
After Width: | Height: | Size: 420 KiB |
|
After Width: | Height: | Size: 485 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1 @@
|
|||||||
|
1.jpg
|
||||||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 513 KiB |
|
After Width: | Height: | Size: 1012 KiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 695 KiB |
|
After Width: | Height: | Size: 710 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 352 KiB |
|
After Width: | Height: | Size: 449 KiB |
|
After Width: | Height: | Size: 558 KiB |
|
After Width: | Height: | Size: 681 KiB |
|
After Width: | Height: | Size: 654 KiB |
|
After Width: | Height: | Size: 631 KiB |
|
After Width: | Height: | Size: 548 KiB |
|
After Width: | Height: | Size: 540 KiB |
|
After Width: | Height: | Size: 465 KiB |
|
After Width: | Height: | Size: 392 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 93 KiB |