Commit 82236502 authored by Roman Alifanov's avatar Roman Alifanov

widgets: flat style for dropdown and spinbutton

parent 33ac99bd
...@@ -23,7 +23,7 @@ import gi ...@@ -23,7 +23,7 @@ import gi
gi.require_version('Gtk', '4.0') gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1') gi.require_version('Adw', '1')
from gi.repository import Gtk, Gio, Adw from gi.repository import Gtk, Gio, Adw, Gdk
from .window import TuneitWindow from .window import TuneitWindow
from .about import build_about_dialog from .about import build_about_dialog
...@@ -44,6 +44,12 @@ class TuneitApplication(Adw.Application): ...@@ -44,6 +44,12 @@ class TuneitApplication(Adw.Application):
self.create_action('about', self.on_about_action) self.create_action('about', self.on_about_action)
self.create_action('preferences', self.on_preferences_action) self.create_action('preferences', self.on_preferences_action)
css = Gtk.CssProvider()
css.load_from_resource('/ru.ximperlinux.TuneIt/style.css')
Gtk.StyleContext.add_provider_for_display(
Gdk.Display.get_default(), css, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)
_application = self _application = self
def do_activate(self): def do_activate(self):
......
...@@ -10,6 +10,9 @@ class ChoiceWidget(BaseWidget): ...@@ -10,6 +10,9 @@ class ChoiceWidget(BaseWidget):
self.dropdown = Gtk.DropDown.new(self.model, expression) self.dropdown = Gtk.DropDown.new(self.model, expression)
self.dropdown.set_halign(Gtk.Align.CENTER) self.dropdown.set_halign(Gtk.Align.CENTER)
self.dropdown.set_valign(Gtk.Align.CENTER) self.dropdown.set_valign(Gtk.Align.CENTER)
btn = self.dropdown.get_first_child()
btn.add_css_class("flat")
btn.add_css_class("dropdown-flat")
self.handler_id = self.dropdown.connect("notify::selected", self._on_choice_changed) self.handler_id = self.dropdown.connect("notify::selected", self._on_choice_changed)
......
...@@ -17,6 +17,7 @@ class NumStepper(BaseWidget): ...@@ -17,6 +17,7 @@ class NumStepper(BaseWidget):
self.spin = Gtk.SpinButton( self.spin = Gtk.SpinButton(
valign=Gtk.Align.CENTER, valign=Gtk.Align.CENTER,
halign=Gtk.Align.CENTER, halign=Gtk.Align.CENTER,
css_classes=["flat"],
) )
lower, upper, step, digits = self._get_range_values(map_data) lower, upper, step, digits = self._get_range_values(map_data)
......
.dropdown-flat {
font-weight: normal;
padding: 0 2px;
}
.dropdown-flat:hover,
.dropdown-flat:active,
.dropdown-flat:checked {
background: none;
}
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<gresources> <gresources>
<gresource prefix="/ru.ximperlinux.TuneIt"> <gresource prefix="/ru.ximperlinux.TuneIt">
<file>style.css</file>
<file preprocess="xml-stripblanks">window.ui</file> <file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">settings/widgets/panel_row.ui</file> <file preprocess="xml-stripblanks">settings/widgets/panel_row.ui</file>
<file preprocess="xml-stripblanks">settings/widgets/deps_alert_dialog.ui</file> <file preprocess="xml-stripblanks">settings/widgets/deps_alert_dialog.ui</file>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment