35 lines
978 B
Python
35 lines
978 B
Python
|
# Python imports
|
||
|
import os
|
||
|
|
||
|
# Lib imports
|
||
|
import gi
|
||
|
gi.require_version('Gtk', '3.0')
|
||
|
|
||
|
# Application imports
|
||
|
|
||
|
|
||
|
|
||
|
class StyleProperties:
|
||
|
def __init__(self):
|
||
|
self.background: str = None
|
||
|
self.foreground: str = None
|
||
|
self.italic: bool = False
|
||
|
self.bold: bool = False
|
||
|
self.strikethrough: bool = False
|
||
|
self.underline: bool = False
|
||
|
|
||
|
|
||
|
def from_gtk_source_style(self, style):
|
||
|
self.background = style.props.background
|
||
|
self.foreground = style.props.foreground
|
||
|
self.italic = style.props.italic
|
||
|
self.bold = style.props.bold
|
||
|
self.underline = style.props.underline_set
|
||
|
self.strikethrough = style.props.strikethrough
|
||
|
|
||
|
if self.foreground and self.foreground[0] != '#':
|
||
|
self.foreground = f"#{self.foreground}"
|
||
|
|
||
|
if self.background and self.background[0] != '#':
|
||
|
self.background = f"#{self.background}"
|