mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-05 07:24:38 -04:00
Made a python package for the stylesheet so that user only needs to import the package and call 1 line of code to make use of the stylesheet
This commit is contained in:
+44
-15
@@ -1,27 +1,56 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
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
|
||||
|
||||
"""
|
||||
# standard imports
|
||||
import os
|
||||
from os.path import abspath, dirname
|
||||
|
||||
import sys
|
||||
sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/../..'))
|
||||
|
||||
# PySide imports
|
||||
from PySide import QtGui
|
||||
import QDarkStyleSheet
|
||||
|
||||
# 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
|
||||
import example_ui
|
||||
|
||||
|
||||
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")
|
||||
|
||||
# create the application and the main window
|
||||
app = QtGui.QApplication(sys.argv)
|
||||
window = QtGui.QMainWindow()
|
||||
# setup stylesheet
|
||||
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=True))
|
||||
|
||||
# setup ui
|
||||
ui = example_ui.Ui_MainWindow()
|
||||
ui.setupUi(window)
|
||||
# run
|
||||
window.show()
|
||||
app.exec_()
|
||||
|
||||
# setup stylesheet
|
||||
app.setStyleSheet(QDarkStyleSheet.load_stylesheet(pyside=True))
|
||||
|
||||
# run
|
||||
window.show()
|
||||
app.exec_()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user