From 367c4fef1981152ac5015715641a7d3954a40306 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Sat, 10 Feb 2018 20:03:24 +0000 Subject: [PATCH] style using CSS Main Window - Make the progress bar look more like the earlier version Fractal Settings - Reduce the width of the notebook - Add some space around the edges - Display source code with monospaced font --- fract4dgui/dialog.py | 4 ++-- fract4dgui/main_window.py | 11 +++++++++++ fract4dgui/settings.py | 1 + gnofract4d.css | 29 +++++++++++++++++++++++++++++ setup.py | 3 +++ 5 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 gnofract4d.css diff --git a/fract4dgui/dialog.py b/fract4dgui/dialog.py index ae84d030c..b5f649768 100644 --- a/fract4dgui/dialog.py +++ b/fract4dgui/dialog.py @@ -6,8 +6,8 @@ def make_container(title): label_box = Gtk.HBox() - label = Gtk.Label(label='%s' % title) - label.set_use_markup(True) + label_box.set_name('dialog_label_box') + label = Gtk.Label(label=title) label_box.pack_start(label, False, False, 0) close = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE) label_box.pack_end(close, False, False, 0) diff --git a/fract4dgui/main_window.py b/fract4dgui/main_window.py index bc5d342d6..d5d6965c2 100644 --- a/fract4dgui/main_window.py +++ b/fract4dgui/main_window.py @@ -39,6 +39,17 @@ def __init__(self, extra_paths=[]): self.window = Gtk.Window() self.window.set_default_size(900,700) self.window.connect('delete-event', self.quit) + self.window.set_name('main_window') + + theme_provider = Gtk.CssProvider() + css_file = "gnofract4d.css" + this_path = os.path.dirname(sys.modules[__name__].__file__) + css_filepath = os.path.join(this_path, "..", css_file) + if not os.path.exists(css_filepath): + css_filepath = fractconfig.instance.get_data_path(css_file) + theme_provider.load_from_path(css_filepath) + Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), + theme_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) # keyboard handling self.keymap = { diff --git a/fract4dgui/settings.py b/fract4dgui/settings.py index 0bb6f5bed..f2ccd16fb 100644 --- a/fract4dgui/settings.py +++ b/fract4dgui/settings.py @@ -34,6 +34,7 @@ def __init__(self, main_window, f): self.main_window = main_window self.f = f self.notebook = Gtk.Notebook() + self.notebook.set_name("settings_notebook") self.controls = Gtk.VBox() self.controls.pack_start(self.notebook, True, True, 0) self.vbox.pack_start(self.controls, True, True, 0) diff --git a/gnofract4d.css b/gnofract4d.css new file mode 100644 index 000000000..4dd7c99ac --- /dev/null +++ b/gnofract4d.css @@ -0,0 +1,29 @@ +#dialog_label_box { + margin: 2px; +} + +#dialog_label_box > label { + font-weight: bold; +} + +#main_window progressbar { + background-color: grey; +} + +#main_window progressbar text { + color: white; + margin-top: 0.3em; +} + +#main_window progressbar progress { + min-height: 3.5em; +} + +#settings_notebook tab { + padding: 2px; +} + +#settings_notebook textview { + padding: 4px; + font-family: monospace; +} diff --git a/setup.py b/setup.py index 8f9d12a7d..59a678b59 100755 --- a/setup.py +++ b/setup.py @@ -204,6 +204,9 @@ def get_files(dir,ext): ext_modules = modules, scripts = ['gnofract4d'], data_files = [ + # style CSS + ('share/gnofract4d', + ['gnofract4d.css']), # color maps ('share/gnofract4d/maps', get_files("maps",".map") +