2013-03-10 16:34:10 +01:00
|
|
|
#!/usr/bin/env python
|
2013-03-10 17:06:37 +01:00
|
|
|
"""
|
|
|
|
|
A simple example of use.
|
|
|
|
|
|
|
|
|
|
Load an ui made in QtDesigner and apply the DarkStyleSheet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Requirements:
|
|
|
|
|
- Python 2 or Python 3
|
|
|
|
|
- PySide
|
|
|
|
|
|
|
|
|
|
.. note.. :: qdarkstyle does not have to be installed to run
|
|
|
|
|
the example
|
2013-03-10 16:34:10 +01:00
|
|
|
|
2013-03-10 17:06:37 +01:00
|
|
|
"""
|
|
|
|
|
# standard imports
|
|
|
|
|
import os
|
2013-03-10 15:23:40 +01:00
|
|
|
import sys
|
2013-03-10 16:34:10 +01:00
|
|
|
|
2013-03-10 17:06:37 +01:00
|
|
|
# PySide imports
|
2013-03-10 15:23:40 +01:00
|
|
|
from PySide import QtGui
|
2013-03-10 17:06:37 +01:00
|
|
|
|
|
|
|
|
# dark style import:
|
|
|
|
|
# make the example runnable without install
|
|
|
|
|
from os.path import abspath, dirname
|
|
|
|
|
sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/..'))
|
|
|
|
|
import qdarkstyle
|
|
|
|
|
|
|
|
|
|
# our ui made in QtDesigner
|
2013-03-10 15:23:40 +01:00
|
|
|
import example_ui
|
|
|
|
|
|
|
|
|
|
|
2013-03-10 17:06:37 +01:00
|
|
|
def main():
|
|
|
|
|
"""
|
|
|
|
|
Application entry point
|
|
|
|
|
"""
|
|
|
|
|
# create the application and the main window
|
|
|
|
|
app = QtGui.QApplication(sys.argv)
|
|
|
|
|
window = QtGui.QMainWindow()
|
|
|
|
|
|
|
|
|
|
# setup ui
|
|
|
|
|
ui = example_ui.Ui_MainWindow()
|
|
|
|
|
ui.setupUi(window)
|
|
|
|
|
window.setWindowTitle("QDarkStyle example")
|
|
|
|
|
|
|
|
|
|
# setup stylesheet
|
|
|
|
|
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=True))
|
2013-03-10 15:23:40 +01:00
|
|
|
|
2013-03-10 17:06:37 +01:00
|
|
|
# run
|
|
|
|
|
window.show()
|
|
|
|
|
app.exec_()
|
2013-03-10 15:23:40 +01:00
|
|
|
|
|
|
|
|
|
2013-03-10 17:06:37 +01:00
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|
2013-03-10 15:23:40 +01:00
|
|
|
|