2013-03-10 11:21:37 -04:00
|
|
|
"""
|
|
|
|
Initialise the QDarkStyleSheet module when used with python.
|
|
|
|
|
|
|
|
This modules provides a function to transparently load the stylesheets
|
|
|
|
with the correct rc file.
|
|
|
|
"""
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
def load_stylesheet(pyside=True):
|
|
|
|
"""
|
|
|
|
Loads the stylesheet. Takes care of importing the rc module.
|
|
|
|
|
|
|
|
:param pyside: True to load the pyside rc file, False to load the PyQt rc file
|
|
|
|
|
|
|
|
:return the stylesheet string
|
|
|
|
"""
|
2013-03-10 12:06:37 -04:00
|
|
|
cwd = os.path.dirname(os.path.realpath(__file__))
|
2013-03-10 11:21:37 -04:00
|
|
|
# Smart import of the rc file
|
|
|
|
if pyside:
|
2013-03-10 12:06:37 -04:00
|
|
|
import pyside_style_rc
|
2013-03-10 11:21:37 -04:00
|
|
|
else:
|
2013-03-10 12:06:37 -04:00
|
|
|
import pyqt_style_rc
|
2013-03-10 11:21:37 -04:00
|
|
|
|
|
|
|
# Load the stylesheet content
|
|
|
|
ret_val = ""
|
2013-03-10 12:06:37 -04:00
|
|
|
filename = os.path.join(cwd, "style.qss")
|
2013-03-10 11:21:37 -04:00
|
|
|
with open(os.path.join(__file__, filename)) as stylesheet:
|
|
|
|
ret_val = stylesheet.read()
|
|
|
|
return ret_val
|