@@ -65,10 +65,9 @@ def __init__(self):
65
65
self.pack_end(self.button)
66
66
67
67
68
-
class PreviewWidgets():
68
+
class PreviewWidgets(Gtk.Box):
69
69
70
70
# gtk preview widgets:
71
-
background = None
72
71
headerbar = None
73
72
menubar = None
74
73
label = None
@@ -79,7 +78,8 @@ class PreviewWidgets():
79
78
button = None
80
79
81
80
def __init__(self):
82
-
self.background = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
81
+
super().__init__(orientation=Gtk.Orientation.VERTICAL)
82
+
83
83
self.grid = Gtk.Grid(row_spacing=6, column_spacing=6)
84
84
self.grid.set_margin_top(WIDGET_SPACING // 2)
85
85
self.grid.set_halign(Gtk.Align.CENTER)
@@ -125,8 +125,8 @@ def __init__(self):
125
125
self.grid.attach_next_to(
126
126
self.button, self.entry, Gtk.PositionType.BOTTOM, 1, 1
127
127
)
128
-
self.background.pack_start(headerbox, True, True, 0)
129
-
self.background.pack_start(self.grid, True, True, 0)
128
+
self.pack_start(headerbox, True, True, 0)
129
+
self.pack_start(self.grid, True, True, 0)
130
130
131
131
def create_menu(self, n_items, has_submenus=False):
132
132
menu = Gtk.Menu()
@@ -201,14 +201,14 @@ def init_widgets(self):
201
201
self.background = Gtk.Grid(row_spacing=WIDGET_SPACING, column_spacing=6)
202
202
self.attach(self.background, 1, 1, 3, 1)
203
203
204
-
self.gtk_preview.background.set_margin_bottom(WIDGET_SPACING)
205
-
self.background.attach(self.gtk_preview.background, 1, 3, 1, 1)
204
+
self.gtk_preview.set_margin_bottom(WIDGET_SPACING)
205
+
self.background.attach(self.gtk_preview, 1, 3, 1, 1)
206
206
207
207
if self.icons_preview:
208
208
self.icons_preview.destroy()
209
209
self.icons_preview = IconThemePreview()
210
210
self.background.attach_next_to(
211
-
self.icons_preview, self.gtk_preview.background,
211
+
self.icons_preview, self.gtk_preview,
212
212
Gtk.PositionType.BOTTOM, 1, 1
213
213
)
214
214
@@ -467,12 +467,9 @@ def mix(color1, color2, amount):
467
467
)
468
468
469
469
def update_preview(self, colorscheme, theme_plugin, icons_plugin):
470
-
if not theme_plugin:
471
-
return
472
470
_colorscheme = colorscheme
473
471
colorscheme = {}
474
472
colorscheme.update(_colorscheme)
475
-
theme_plugin.preview_before_load_callback(self, colorscheme)
476
473
477
474
colorscheme_with_fallbacks = {}
478
475
for theme_value in THEME_MODEL:
@@ -483,14 +480,25 @@ def update_preview(self, colorscheme, theme_plugin, icons_plugin):
483
480
result = FALLBACK_COLOR
484
481
colorscheme_with_fallbacks[theme_value['key']] = result
485
482
486
-
self.override_css_style(colorscheme_with_fallbacks, theme_plugin)
487
-
self.update_preview_colors(colorscheme_with_fallbacks)
488
-
self.update_preview_borders(colorscheme_with_fallbacks)
489
-
self.update_preview_carets(colorscheme_with_fallbacks)
490
-
self.update_preview_gradients(colorscheme_with_fallbacks)
491
-
self.gtk_preview.update_preview_imageboxes(colorscheme_with_fallbacks, theme_plugin)
483
+
if not theme_plugin:
484
+
self.gtk_preview.hide()
485
+
else:
486
+
theme_plugin.preview_before_load_callback(self, colorscheme)
487
+
488
+
self.override_css_style(colorscheme_with_fallbacks, theme_plugin)
489
+
self.update_preview_colors(colorscheme_with_fallbacks)
490
+
self.update_preview_borders(colorscheme_with_fallbacks)
491
+
self.update_preview_carets(colorscheme_with_fallbacks)
492
+
self.update_preview_gradients(colorscheme_with_fallbacks)
493
+
self.gtk_preview.update_preview_imageboxes(colorscheme_with_fallbacks, theme_plugin)
494
+
self.gtk_preview.show()
495
+
496
+
if not icons_plugin:
497
+
self.icons_preview.hide()
498
+
else:
499
+
self.icons_preview.update_preview(colorscheme, icons_plugin)
500
+
self.icons_preview.show()
492
501
493
-
self.icons_preview.update_preview(colorscheme, icons_plugin)
494
502
self.terminal_preview.update_preview(colorscheme)
495
503
496
504
def get_theme_css_provider(self, theme_plugin):
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4