export_theme not needs QFontDatabase

This commit is contained in:
Yeison Cardona 2022-02-23 19:06:58 -05:00
parent 594baaa7cd
commit 2a5bf7e8fa
3 changed files with 12 additions and 7 deletions

View File

@ -16,7 +16,7 @@ extra = {
'density_scale': '0',
# environ
'pyside2': True,
'pyside6': True,
'linux': True,
}

View File

@ -137,6 +137,8 @@ class RuntimeStylesheets(QMainWindow, QtStyleTools):
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):
""""""

View File

@ -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:]
@ -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: