Add sample CSS styling.
This commit is contained in:
parent
d7c350866a
commit
b4c086c049
2 changed files with 20 additions and 1 deletions
11
main.py
11
main.py
|
@ -9,6 +9,9 @@ import task_manager
|
|||
|
||||
APP_TITLE = "Org-mob"
|
||||
DOCS_PATH = os.environ["ORG_PATH"]
|
||||
STYLE_FILE_PATH = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"style.css")
|
||||
|
||||
import gi
|
||||
|
||||
|
@ -16,7 +19,7 @@ gi.require_version("Gtk", "4.0")
|
|||
gi.require_version('Polkit', '1.0')
|
||||
gi.require_version(namespace='Adw', version='1')
|
||||
|
||||
from gi.repository import Gtk, Polkit, GObject, Gio, Adw
|
||||
from gi.repository import Gtk, Polkit, GObject, Gio, Adw, Gdk
|
||||
|
||||
|
||||
class MainWindow(Gtk.Window):
|
||||
|
@ -67,11 +70,17 @@ class Application(Gtk.Application):
|
|||
def do_activate(self):
|
||||
win = self.props.active_window
|
||||
if not win:
|
||||
if os.path.exists(STYLE_FILE_PATH):
|
||||
style_provider = Gtk.CssProvider()
|
||||
Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(), style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
style_provider.load_from_path(STYLE_FILE_PATH)
|
||||
|
||||
win = MainWindow(
|
||||
title=APP_TITLE,
|
||||
application=self,
|
||||
task_manager=self.task_manager,
|
||||
)
|
||||
|
||||
win.present()
|
||||
|
||||
|
||||
|
|
10
style.css
Normal file
10
style.css
Normal file
|
@ -0,0 +1,10 @@
|
|||
label {
|
||||
padding-top: 20px;
|
||||
background-color: red;
|
||||
/* font: Vera 20px; */
|
||||
}
|
||||
|
||||
entry {
|
||||
color: #0f0;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue