Skip to content

Commit

Permalink
Merge branch 'nightvisi0n-feature_colored-src-btns'
Browse files Browse the repository at this point in the history
  • Loading branch information
MaZderMind committed Apr 1, 2018
2 parents 3e2c90b + b490dd9 commit ceab271
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
11 changes: 11 additions & 0 deletions voctogui/ui/voctogui.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.btn_grp_a:checked {
background-image: none;
background-color: blue;
color: white;
}

.btn_grp_b:checked {
background-image: none;
background-color: red;
color: white;
}
6 changes: 6 additions & 0 deletions voctogui/ui/voctogui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@
<property name="receives_default">True</property>
<property name="margin_right">5</property>
<property name="draw_indicator">False</property>
<style>
<class name="btn_grp_a"/>
</style>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -349,6 +352,9 @@
<property name="receives_default">True</property>
<property name="margin_right">5</property>
<property name="draw_indicator">False</property>
<style>
<class name="btn_grp_b"/>
</style>
</object>
<packing>
<property name="expand">False</property>
Expand Down
30 changes: 30 additions & 0 deletions voctogui/voctogui.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,36 @@ def __init__(self):
raise Exception("Can't find any .ui-Files to use "
"(searched {})".format(', '.join(paths)))

#
# search for a .css style sheet file and load it
#

css_provider = Gtk.CssProvider()
context = Gtk.StyleContext()

css_paths = [
os.path.join(os.path.dirname(os.path.realpath(__file__)),
'ui/voctogui.css'),
'/usr/lib/voctogui/ui/voctogui.css'
]

for path in css_paths:
self.log.debug('trying to load css-file from file %s', path)

if os.path.isfile(path):
self.log.info('loading css-file from file %s', path)
css_provider.load_from_path(path)
break
else:
raise Exception("Can't find any .css-Files to use "
"(searched {})".format(', '.join(css_paths)))

context.add_provider_for_screen(
Gdk.Screen.get_default(),
css_provider,
Gtk.STYLE_PROVIDER_PRIORITY_USER
)

self.ui.setup()

def run(self):
Expand Down

0 comments on commit ceab271

Please sign in to comment.