styles decoupling

This commit is contained in:
DYefremov
2020-04-13 20:07:57 +03:00
parent c9c962e129
commit 036e666c9b
3 changed files with 89 additions and 85 deletions

78
app/ui/default_style.css Normal file
View File

@@ -0,0 +1,78 @@
* {
-GtkDialog-action-area-border: 5;
}
entry {
min-height: 24px;
}
button {
min-height: 20px;
padding-top: 1px;
padding-bottom: 1px;
}
button.image-button {
min-height: 24px;
padding-left: 2px;
padding-right: 2px;
}
button.text-button.image-button {
min-height: 24px;
padding-left: 2px;
padding-right: 2px;
}
spinbutton {
min-height: 20px;
}
toolbutton {
padding: 2px;
}
spinner {
padding-left: 10px;
padding-right: 10px;
}
headerbar {
min-height: 34px;
padding-top: 1px;
padding-left: 5px;
padding-right: 5px;
padding-bottom: 1px;
}
headerbar button {
min-height: 24px;
min-width: 24px;
padding-left: 2px;
padding-right: 2px;
}
box button {
padding-left: 4px;
padding-right: 4px;
}
infobar {
min-height: 24px;
}
infobar button {
min-height: 16px;
min-width: 16px;
padding-left: 2px;
padding-right: 2px;
}
switch {
border-radius: 50px;
}
switch slider {
min-height: 18px;
min-width: 18px;
}

View File

@@ -10,82 +10,3 @@
#textview-large {
font-size: 14px;
}
* {
-GtkDialog-action-area-border: 5;
}
entry {
min-height: 24px;
}
button {
min-height: 20px;
padding-top: 1px;
padding-bottom: 1px;
}
button.image-button {
min-height: 24px;
padding-left: 2px;
padding-right: 2px;
}
button.text-button.image-button {
min-height: 24px;
padding-left: 2px;
padding-right: 2px;
}
spinbutton {
min-height: 20px;
}
toolbutton {
padding: 2px;
}
spinner {
padding-left: 10px;
padding-right: 10px;
}
headerbar {
min-height: 34px;
padding-top: 1px;
padding-left: 5px;
padding-right: 5px;
padding-bottom: 1px;
}
headerbar button {
min-height: 24px;
min-width: 24px;
padding-left: 2px;
padding-right: 2px;
}
box button {
padding-left: 4px;
padding-right: 4px;
}
infobar {
min-height: 24px;
}
infobar button {
min-height: 16px;
min-width: 16px;
padding-left: 2px;
padding-right: 2px;
}
switch {
border-radius: 50px;
}
switch slider {
min-height: 18px;
min-width: 18px;
}

View File

@@ -1,7 +1,6 @@
import os
import sys
from enum import Enum, IntEnum
from app.settings import Settings, SettingsException
from functools import lru_cache
from app.settings import Settings, SettingsException
@@ -29,6 +28,17 @@ except SettingsException:
else:
os.environ["LANGUAGE"] = settings.language
if settings.is_themes_support:
st = Gtk.Settings().get_default()
st.set_property("gtk-theme-name", settings.theme)
st.set_property("gtk-icon-theme-name", settings.icon_theme)
else:
style_provider = Gtk.CssProvider()
s_path = "{}default_style.css".format(GTK_PATH + "/" + UI_RESOURCES_PATH if GTK_PATH else UI_RESOURCES_PATH)
style_provider.load_from_path(s_path)
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
if IS_DARWIN:
import gettext
@@ -43,11 +53,6 @@ else:
locale.bindtextdomain(TEXT_DOMAIN, LANG_PATH)
if settings.is_themes_support:
st = Gtk.Settings().get_default()
st.set_property("gtk-theme-name", settings.theme)
st.set_property("gtk-icon-theme-name", settings.icon_theme)
theme = Gtk.IconTheme.get_default()
theme.append_search_path(GTK_PATH + "/share/icons" if GTK_PATH else UI_RESOURCES_PATH + "icons")