Add sample CSS styling.
This commit is contained in:
parent
d7c350866a
commit
b4c086c049
11
main.py
11
main.py
@ -9,6 +9,9 @@ import task_manager
|
|||||||
|
|
||||||
APP_TITLE = "Org-mob"
|
APP_TITLE = "Org-mob"
|
||||||
DOCS_PATH = os.environ["ORG_PATH"]
|
DOCS_PATH = os.environ["ORG_PATH"]
|
||||||
|
STYLE_FILE_PATH = os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
"style.css")
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
@ -16,7 +19,7 @@ gi.require_version("Gtk", "4.0")
|
|||||||
gi.require_version('Polkit', '1.0')
|
gi.require_version('Polkit', '1.0')
|
||||||
gi.require_version(namespace='Adw', version='1')
|
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):
|
class MainWindow(Gtk.Window):
|
||||||
@ -67,11 +70,17 @@ class Application(Gtk.Application):
|
|||||||
def do_activate(self):
|
def do_activate(self):
|
||||||
win = self.props.active_window
|
win = self.props.active_window
|
||||||
if not win:
|
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(
|
win = MainWindow(
|
||||||
title=APP_TITLE,
|
title=APP_TITLE,
|
||||||
application=self,
|
application=self,
|
||||||
task_manager=self.task_manager,
|
task_manager=self.task_manager,
|
||||||
)
|
)
|
||||||
|
|
||||||
win.present()
|
win.present()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user