Bugfixes, translation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys, datetime
|
||||
import sys
|
||||
from view.main_window import *
|
||||
from model.main_view_model import *
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import os, time
|
||||
from PIL import Image
|
||||
# GTK
|
||||
from gi.repository import Gio, Gdk
|
||||
|
||||
# Packages
|
||||
import os, time, gi, locale
|
||||
from PIL import Image
|
||||
|
||||
# Local scripts
|
||||
from service.cinnamon_pref_handler import *
|
||||
from service.suntimes import *
|
||||
from service.time_bar_chart import *
|
||||
from service.location import *
|
||||
from enums.PeriodSourceEnum import *
|
||||
|
||||
|
||||
class Main_View_Model:
|
||||
""" The main ViewModel for the application
|
||||
"""
|
||||
@@ -38,6 +43,13 @@ class Main_View_Model:
|
||||
|
||||
self.background_settings = Gio.Settings.new("org.cinnamon.desktop.background")
|
||||
|
||||
|
||||
# Language support
|
||||
self.UUID = "cinnamon-dynamic-wallpaper@TobiZog"
|
||||
self.localeDir = os.path.expanduser("~") + "/.local/share/locale"
|
||||
locale.bindtextdomain(self.UUID, self.localeDir)
|
||||
|
||||
|
||||
# Other Variables
|
||||
self.display = Gdk.Display.get_default()
|
||||
self.screen_height = self.display.get_monitor(0).get_geometry().height
|
||||
|
||||
@@ -32,6 +32,7 @@ class Cinnamon_Pref_Handler:
|
||||
with open(self.pref_location, "r") as pref_file:
|
||||
self.pref_data = json.load(pref_file)
|
||||
|
||||
self.first_start = self.extract_json('first_start')
|
||||
self.picture_aspect = self.extract_json('picture_aspect')
|
||||
self.dynamic_background_color = self.extract_json('dynamic_background_color')
|
||||
self.image_source = self.extract_json('image_source')
|
||||
@@ -93,6 +94,7 @@ class Cinnamon_Pref_Handler:
|
||||
def store_preferences(self):
|
||||
""" Store the values of the Preference object to the JSON file
|
||||
"""
|
||||
self.value_to_json('first_start', self.first_start)
|
||||
self.value_to_json('picture_aspect', self.picture_aspect)
|
||||
self.value_to_json('dynamic_background_color', self.dynamic_background_color)
|
||||
self.value_to_json('image_source', self.image_source)
|
||||
|
||||
@@ -8,8 +8,8 @@ gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GdkPixbuf
|
||||
|
||||
# Packages
|
||||
import subprocess, threading, time, locale
|
||||
from datetime import timedelta, datetime, date
|
||||
import subprocess, threading, time
|
||||
from datetime import timedelta, datetime
|
||||
|
||||
# Local scripts
|
||||
from model.main_view_model import *
|
||||
@@ -17,11 +17,6 @@ from view.dialogs import *
|
||||
from enums.ImageSourceEnum import *
|
||||
from enums.PeriodSourceEnum import *
|
||||
|
||||
UUID = "cinnamon-dynamic-wallpaper@TobiZog"
|
||||
|
||||
localeDir = os.path.expanduser("~") + "/.local/share/locale"
|
||||
locale.bindtextdomain(UUID, localeDir)
|
||||
|
||||
|
||||
class Main_Window:
|
||||
############################################################
|
||||
@@ -39,7 +34,7 @@ class Main_Window:
|
||||
|
||||
# Glade
|
||||
self.builder = Gtk.Builder()
|
||||
self.builder.set_translation_domain(UUID)
|
||||
self.builder.set_translation_domain(self.view_model.UUID)
|
||||
self.builder.add_from_file(self.view_model.GLADE_URI)
|
||||
self.builder.connect_signals(self)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user