Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request fract4d#22 from cjmayo/stylecss
Browse files Browse the repository at this point in the history
style using CSS
  • Loading branch information
edyoung committed Feb 13, 2018
2 parents 5b619dd + 367c4fe commit 339a7f4
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fract4dgui/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

def make_container(title):
label_box = Gtk.HBox()
label = Gtk.Label(label='<span weight="bold">%s</span>' % 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)
Expand Down
11 changes: 11 additions & 0 deletions fract4dgui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
1 change: 1 addition & 0 deletions fract4dgui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
29 changes: 29 additions & 0 deletions gnofract4d.css
Original file line number Diff line number Diff line change
@@ -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;
}
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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") +
Expand Down

0 comments on commit 339a7f4

Please sign in to comment.