Skip to content

Commit

Permalink
export_theme not needs QFontDatabase
Browse files Browse the repository at this point in the history
  • Loading branch information
YeisonCardona committed Feb 24, 2022
1 parent 594baaa commit 2a5bf7e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/exporter/exporter.py
Expand Up @@ -16,7 +16,7 @@
'density_scale': '0',

# environ
'pyside2': True,
'pyside6': True,
'linux': True,

}
Expand Down
2 changes: 2 additions & 0 deletions examples/full_features/main.py
Expand Up @@ -137,6 +137,8 @@ def __init__(self):
self.main.pushButton_folder_dialog.clicked.connect(
lambda: QFileDialog.get_existing_directory(self.main))

self.main.comboBox_8.style_sheet = """*{border-color: red; color: red}"""

# ----------------------------------------------------------------------
def custom_styles(self):
""""""
Expand Down
15 changes: 9 additions & 6 deletions qt_material/__init__.py
Expand Up @@ -48,7 +48,8 @@ def export_theme(theme='', qss=None, rcc=None, invert_secondary=False, extra={},
if not os.path.isabs(output) and not output.startswith('.'):
output = f'.{output}'

stylesheet = build_stylesheet(theme, invert_secondary, extra, output)
stylesheet = build_stylesheet(
theme, invert_secondary, extra, output, export=True)

if output.startswith('.'):
output = output[1:]
Expand Down Expand Up @@ -81,12 +82,14 @@ def export_theme(theme='', qss=None, rcc=None, invert_secondary=False, extra={},


# ----------------------------------------------------------------------
def build_stylesheet(theme='', invert_secondary=False, extra={}, parent='theme', template=TEMPLATE_FILE):
def build_stylesheet(theme='', invert_secondary=False, extra={}, parent='theme', template=TEMPLATE_FILE, export=False):
""""""
try:
add_fonts()
except Exception as e:
logging.warning(e)

if not export:
try:
add_fonts()
except Exception as e:
logging.warning(e)

theme = get_theme(theme, invert_secondary)
if theme is None:
Expand Down

0 comments on commit 2a5bf7e

Please sign in to comment.