removed useless PyQT5 Scripts
This commit is contained in:
parent
b63b82528f
commit
d3d3f1e833
2
themes/breeze/.gitignore
vendored
2
themes/breeze/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
__pycache__
|
|
||||||
*.pyc
|
|
Binary file not shown.
Before Width: | Height: | Size: 7.7 MiB |
File diff suppressed because it is too large
Load Diff
@ -1,94 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c) <2013-2014> <Colin Duquesnoy>
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
#
|
|
||||||
"""
|
|
||||||
A simple example of use.
|
|
||||||
|
|
||||||
Load an ui made in QtDesigner and apply the DarkStyleSheet.
|
|
||||||
|
|
||||||
|
|
||||||
Requirements:
|
|
||||||
- Python 2 or Python 3
|
|
||||||
- PyQt4
|
|
||||||
|
|
||||||
.. note.. :: qdarkstyle does not have to be installed to run
|
|
||||||
the example
|
|
||||||
|
|
||||||
"""
|
|
||||||
import logging
|
|
||||||
import sys
|
|
||||||
from PyQt5 import QtWidgets, QtCore
|
|
||||||
from PyQt5.QtCore import QFile, QTextStream
|
|
||||||
# make the example runnable without the need to install
|
|
||||||
|
|
||||||
import example
|
|
||||||
import breeze_resources
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""
|
|
||||||
Application entry point
|
|
||||||
"""
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
|
||||||
# create the application and the main window
|
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
|
||||||
#app.setStyle(QtWidgets.QStyleFactory.create("fusion"))
|
|
||||||
window = QtWidgets.QMainWindow()
|
|
||||||
|
|
||||||
# setup ui
|
|
||||||
ui = example.Ui_MainWindow()
|
|
||||||
ui.setupUi(window)
|
|
||||||
ui.bt_delay_popup.addActions([
|
|
||||||
ui.actionAction,
|
|
||||||
ui.actionAction_C
|
|
||||||
])
|
|
||||||
ui.bt_instant_popup.addActions([
|
|
||||||
ui.actionAction,
|
|
||||||
ui.actionAction_C
|
|
||||||
])
|
|
||||||
ui.bt_menu_button_popup.addActions([
|
|
||||||
ui.actionAction,
|
|
||||||
ui.actionAction_C
|
|
||||||
])
|
|
||||||
window.setWindowTitle("BreezeDark example")
|
|
||||||
|
|
||||||
# tabify dock widgets to show bug #6
|
|
||||||
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
|
|
||||||
|
|
||||||
# setup stylesheet
|
|
||||||
file = QFile(":/dark.qss")
|
|
||||||
file.open(QFile.ReadOnly | QFile.Text)
|
|
||||||
stream = QTextStream(file)
|
|
||||||
app.setStyleSheet(stream.readAll())
|
|
||||||
|
|
||||||
# auto quit after 2s when testing on travis-ci
|
|
||||||
if "--travis" in sys.argv:
|
|
||||||
QtCore.QTimer.singleShot(2000, app.exit)
|
|
||||||
|
|
||||||
# run
|
|
||||||
window.show()
|
|
||||||
app.exec_()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
@ -1,359 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'example.ui'
|
|
||||||
#
|
|
||||||
# Created by: PyQt5 UI code generator 5.4.2
|
|
||||||
#
|
|
||||||
# WARNING! All changes made in this file will be lost!
|
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
|
||||||
|
|
||||||
class Ui_MainWindow(object):
|
|
||||||
def setupUi(self, MainWindow):
|
|
||||||
MainWindow.setObjectName("MainWindow")
|
|
||||||
MainWindow.resize(1068, 824)
|
|
||||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
|
||||||
self.centralwidget.setObjectName("centralwidget")
|
|
||||||
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.centralwidget)
|
|
||||||
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
|
||||||
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
|
|
||||||
self.tabWidget.setTabPosition(QtWidgets.QTabWidget.East)
|
|
||||||
self.tabWidget.setTabsClosable(True)
|
|
||||||
self.tabWidget.setObjectName("tabWidget")
|
|
||||||
self.tab = QtWidgets.QWidget()
|
|
||||||
self.tab.setObjectName("tab")
|
|
||||||
self.gridLayout = QtWidgets.QGridLayout(self.tab)
|
|
||||||
self.gridLayout.setObjectName("gridLayout")
|
|
||||||
self.groupBox = QtWidgets.QGroupBox(self.tab)
|
|
||||||
self.groupBox.setObjectName("groupBox")
|
|
||||||
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox)
|
|
||||||
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
|
||||||
self.toolBox = QtWidgets.QToolBox(self.groupBox)
|
|
||||||
self.toolBox.setObjectName("toolBox")
|
|
||||||
self.page = QtWidgets.QWidget()
|
|
||||||
self.page.setGeometry(QtCore.QRect(0, 0, 718, 227))
|
|
||||||
self.page.setObjectName("page")
|
|
||||||
self.gridLayout_4 = QtWidgets.QGridLayout(self.page)
|
|
||||||
self.gridLayout_4.setObjectName("gridLayout_4")
|
|
||||||
self.lineEdit = QtWidgets.QLineEdit(self.page)
|
|
||||||
self.lineEdit.setObjectName("lineEdit")
|
|
||||||
self.gridLayout_4.addWidget(self.lineEdit, 0, 0, 1, 1)
|
|
||||||
self.toolBox.addItem(self.page, "")
|
|
||||||
self.page_2 = QtWidgets.QWidget()
|
|
||||||
self.page_2.setGeometry(QtCore.QRect(0, 0, 718, 227))
|
|
||||||
self.page_2.setObjectName("page_2")
|
|
||||||
self.gridLayout_5 = QtWidgets.QGridLayout(self.page_2)
|
|
||||||
self.gridLayout_5.setObjectName("gridLayout_5")
|
|
||||||
self.listWidget = QtWidgets.QListWidget(self.page_2)
|
|
||||||
self.listWidget.setObjectName("listWidget")
|
|
||||||
item = QtWidgets.QListWidgetItem()
|
|
||||||
self.listWidget.addItem(item)
|
|
||||||
item = QtWidgets.QListWidgetItem()
|
|
||||||
self.listWidget.addItem(item)
|
|
||||||
item = QtWidgets.QListWidgetItem()
|
|
||||||
self.listWidget.addItem(item)
|
|
||||||
item = QtWidgets.QListWidgetItem()
|
|
||||||
self.listWidget.addItem(item)
|
|
||||||
item = QtWidgets.QListWidgetItem()
|
|
||||||
self.listWidget.addItem(item)
|
|
||||||
item = QtWidgets.QListWidgetItem()
|
|
||||||
self.listWidget.addItem(item)
|
|
||||||
item = QtWidgets.QListWidgetItem()
|
|
||||||
self.listWidget.addItem(item)
|
|
||||||
item = QtWidgets.QListWidgetItem()
|
|
||||||
self.listWidget.addItem(item)
|
|
||||||
self.gridLayout_5.addWidget(self.listWidget, 0, 0, 1, 1)
|
|
||||||
self.toolBox.addItem(self.page_2, "")
|
|
||||||
self.verticalLayout_3.addWidget(self.toolBox)
|
|
||||||
self.gridLayout.addWidget(self.groupBox, 1, 0, 1, 1)
|
|
||||||
self.tabWidget_2 = QtWidgets.QTabWidget(self.tab)
|
|
||||||
self.tabWidget_2.setObjectName("tabWidget_2")
|
|
||||||
self.tab_3 = QtWidgets.QWidget()
|
|
||||||
self.tab_3.setObjectName("tab_3")
|
|
||||||
self.gridLayout_6 = QtWidgets.QGridLayout(self.tab_3)
|
|
||||||
self.gridLayout_6.setObjectName("gridLayout_6")
|
|
||||||
self.checkableButton = QtWidgets.QPushButton(self.tab_3)
|
|
||||||
self.checkableButton.setCheckable(True)
|
|
||||||
self.checkableButton.setChecked(True)
|
|
||||||
self.checkableButton.setObjectName("checkableButton")
|
|
||||||
self.gridLayout_6.addWidget(self.checkableButton, 1, 0, 1, 1)
|
|
||||||
self.pushButton = QtWidgets.QPushButton(self.tab_3)
|
|
||||||
self.pushButton.setObjectName("pushButton")
|
|
||||||
self.gridLayout_6.addWidget(self.pushButton, 0, 0, 1, 1)
|
|
||||||
self.pushButton_5 = QtWidgets.QPushButton(self.tab_3)
|
|
||||||
self.pushButton_5.setObjectName("pushButton_5")
|
|
||||||
self.gridLayout_6.addWidget(self.pushButton_5, 2, 0, 1, 1)
|
|
||||||
self.tabWidget_2.addTab(self.tab_3, "")
|
|
||||||
self.tab_5 = QtWidgets.QWidget()
|
|
||||||
self.tab_5.setObjectName("tab_5")
|
|
||||||
self.gridLayout_7 = QtWidgets.QGridLayout(self.tab_5)
|
|
||||||
self.gridLayout_7.setObjectName("gridLayout_7")
|
|
||||||
self.tableWidget = QtWidgets.QTableWidget(self.tab_5)
|
|
||||||
self.tableWidget.setObjectName("tableWidget")
|
|
||||||
self.tableWidget.setColumnCount(2)
|
|
||||||
self.tableWidget.setRowCount(4)
|
|
||||||
item = QtWidgets.QTableWidgetItem()
|
|
||||||
self.tableWidget.setVerticalHeaderItem(0, item)
|
|
||||||
item = QtWidgets.QTableWidgetItem()
|
|
||||||
self.tableWidget.setVerticalHeaderItem(1, item)
|
|
||||||
item = QtWidgets.QTableWidgetItem()
|
|
||||||
self.tableWidget.setVerticalHeaderItem(2, item)
|
|
||||||
item = QtWidgets.QTableWidgetItem()
|
|
||||||
self.tableWidget.setVerticalHeaderItem(3, item)
|
|
||||||
item = QtWidgets.QTableWidgetItem()
|
|
||||||
self.tableWidget.setHorizontalHeaderItem(0, item)
|
|
||||||
item = QtWidgets.QTableWidgetItem()
|
|
||||||
self.tableWidget.setHorizontalHeaderItem(1, item)
|
|
||||||
self.gridLayout_7.addWidget(self.tableWidget, 0, 0, 1, 1)
|
|
||||||
self.tabWidget_2.addTab(self.tab_5, "")
|
|
||||||
self.tab_4 = QtWidgets.QWidget()
|
|
||||||
self.tab_4.setObjectName("tab_4")
|
|
||||||
self.tabWidget_2.addTab(self.tab_4, "")
|
|
||||||
self.gridLayout.addWidget(self.tabWidget_2, 0, 0, 1, 1)
|
|
||||||
self.tabWidget.addTab(self.tab, "")
|
|
||||||
self.tab_2 = QtWidgets.QWidget()
|
|
||||||
self.tab_2.setObjectName("tab_2")
|
|
||||||
self.gridLayout_2 = QtWidgets.QGridLayout(self.tab_2)
|
|
||||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
|
||||||
self.groupBox_2 = QtWidgets.QGroupBox(self.tab_2)
|
|
||||||
self.groupBox_2.setObjectName("groupBox_2")
|
|
||||||
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_2)
|
|
||||||
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
|
||||||
self.label = QtWidgets.QLabel(self.groupBox_2)
|
|
||||||
self.label.setObjectName("label")
|
|
||||||
self.verticalLayout_4.addWidget(self.label)
|
|
||||||
self.radioButton = QtWidgets.QRadioButton(self.groupBox_2)
|
|
||||||
self.radioButton.setObjectName("radioButton")
|
|
||||||
self.verticalLayout_4.addWidget(self.radioButton)
|
|
||||||
self.checkBox = QtWidgets.QCheckBox(self.groupBox_2)
|
|
||||||
self.checkBox.setObjectName("checkBox")
|
|
||||||
self.verticalLayout_4.addWidget(self.checkBox)
|
|
||||||
self.checkBox_2 = QtWidgets.QCheckBox(self.groupBox_2)
|
|
||||||
self.checkBox_2.setTristate(True)
|
|
||||||
self.checkBox_2.setObjectName("checkBox_2")
|
|
||||||
self.verticalLayout_4.addWidget(self.checkBox_2)
|
|
||||||
self.treeWidget = QtWidgets.QTreeWidget(self.groupBox_2)
|
|
||||||
self.treeWidget.setObjectName("treeWidget")
|
|
||||||
item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget)
|
|
||||||
item_1 = QtWidgets.QTreeWidgetItem(self.treeWidget)
|
|
||||||
item_2 = QtWidgets.QTreeWidgetItem(item_1)
|
|
||||||
item_2.setText(0, "subitem")
|
|
||||||
self.verticalLayout_4.addWidget(self.treeWidget)
|
|
||||||
self.gridLayout_2.addWidget(self.groupBox_2, 0, 0, 1, 1)
|
|
||||||
self.tabWidget.addTab(self.tab_2, "")
|
|
||||||
self.verticalLayout_5.addWidget(self.tabWidget)
|
|
||||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
|
||||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
|
||||||
self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
|
|
||||||
self.pushButton_2.setObjectName("pushButton_2")
|
|
||||||
self.horizontalLayout.addWidget(self.pushButton_2)
|
|
||||||
self.bt_delay_popup = QtWidgets.QToolButton(self.centralwidget)
|
|
||||||
self.bt_delay_popup.setObjectName("bt_delay_popup")
|
|
||||||
self.horizontalLayout.addWidget(self.bt_delay_popup)
|
|
||||||
self.bt_instant_popup = QtWidgets.QToolButton(self.centralwidget)
|
|
||||||
self.bt_instant_popup.setPopupMode(QtWidgets.QToolButton.InstantPopup)
|
|
||||||
self.bt_instant_popup.setObjectName("bt_instant_popup")
|
|
||||||
self.horizontalLayout.addWidget(self.bt_instant_popup)
|
|
||||||
self.bt_menu_button_popup = QtWidgets.QToolButton(self.centralwidget)
|
|
||||||
self.bt_menu_button_popup.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
|
|
||||||
self.bt_menu_button_popup.setObjectName("bt_menu_button_popup")
|
|
||||||
self.horizontalLayout.addWidget(self.bt_menu_button_popup)
|
|
||||||
self.line_2 = QtWidgets.QFrame(self.centralwidget)
|
|
||||||
self.line_2.setFrameShape(QtWidgets.QFrame.VLine)
|
|
||||||
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
||||||
self.line_2.setObjectName("line_2")
|
|
||||||
self.horizontalLayout.addWidget(self.line_2)
|
|
||||||
self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
|
|
||||||
self.pushButton_3.setEnabled(False)
|
|
||||||
self.pushButton_3.setObjectName("pushButton_3")
|
|
||||||
self.horizontalLayout.addWidget(self.pushButton_3)
|
|
||||||
self.doubleSpinBox = QtWidgets.QDoubleSpinBox(self.centralwidget)
|
|
||||||
self.doubleSpinBox.setObjectName("doubleSpinBox")
|
|
||||||
self.horizontalLayout.addWidget(self.doubleSpinBox)
|
|
||||||
self.toolButton = QtWidgets.QToolButton(self.centralwidget)
|
|
||||||
self.toolButton.setPopupMode(QtWidgets.QToolButton.InstantPopup)
|
|
||||||
self.toolButton.setObjectName("toolButton")
|
|
||||||
self.horizontalLayout.addWidget(self.toolButton)
|
|
||||||
self.verticalLayout_5.addLayout(self.horizontalLayout)
|
|
||||||
MainWindow.setCentralWidget(self.centralwidget)
|
|
||||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
|
||||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1068, 29))
|
|
||||||
self.menubar.setObjectName("menubar")
|
|
||||||
self.menuMenu = QtWidgets.QMenu(self.menubar)
|
|
||||||
self.menuMenu.setObjectName("menuMenu")
|
|
||||||
self.menuSubmenu_2 = QtWidgets.QMenu(self.menuMenu)
|
|
||||||
self.menuSubmenu_2.setObjectName("menuSubmenu_2")
|
|
||||||
MainWindow.setMenuBar(self.menubar)
|
|
||||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
|
||||||
self.statusbar.setObjectName("statusbar")
|
|
||||||
MainWindow.setStatusBar(self.statusbar)
|
|
||||||
self.dockWidget1 = QtWidgets.QDockWidget(MainWindow)
|
|
||||||
self.dockWidget1.setObjectName("dockWidget1")
|
|
||||||
self.dockWidgetContents = QtWidgets.QWidget()
|
|
||||||
self.dockWidgetContents.setObjectName("dockWidgetContents")
|
|
||||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.dockWidgetContents)
|
|
||||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
|
||||||
self.verticalLayout = QtWidgets.QVBoxLayout()
|
|
||||||
self.verticalLayout.setObjectName("verticalLayout")
|
|
||||||
self.comboBox = QtWidgets.QComboBox(self.dockWidgetContents)
|
|
||||||
self.comboBox.setObjectName("comboBox")
|
|
||||||
self.comboBox.addItem("")
|
|
||||||
self.comboBox.addItem("")
|
|
||||||
self.verticalLayout.addWidget(self.comboBox)
|
|
||||||
self.horizontalSlider = QtWidgets.QSlider(self.dockWidgetContents)
|
|
||||||
self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
|
|
||||||
self.horizontalSlider.setObjectName("horizontalSlider")
|
|
||||||
self.verticalLayout.addWidget(self.horizontalSlider)
|
|
||||||
self.textEdit = QtWidgets.QTextEdit(self.dockWidgetContents)
|
|
||||||
self.textEdit.setObjectName("textEdit")
|
|
||||||
self.verticalLayout.addWidget(self.textEdit)
|
|
||||||
self.line = QtWidgets.QFrame(self.dockWidgetContents)
|
|
||||||
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
|
||||||
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
||||||
self.line.setObjectName("line")
|
|
||||||
self.verticalLayout.addWidget(self.line)
|
|
||||||
self.progressBar = QtWidgets.QProgressBar(self.dockWidgetContents)
|
|
||||||
self.progressBar.setProperty("value", 24)
|
|
||||||
self.progressBar.setObjectName("progressBar")
|
|
||||||
self.verticalLayout.addWidget(self.progressBar)
|
|
||||||
self.verticalLayout_2.addLayout(self.verticalLayout)
|
|
||||||
self.frame = QtWidgets.QFrame(self.dockWidgetContents)
|
|
||||||
self.frame.setMinimumSize(QtCore.QSize(0, 100))
|
|
||||||
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
|
||||||
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
|
|
||||||
self.frame.setLineWidth(3)
|
|
||||||
self.frame.setObjectName("frame")
|
|
||||||
self.verticalLayout_2.addWidget(self.frame)
|
|
||||||
self.dockWidget1.setWidget(self.dockWidgetContents)
|
|
||||||
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget1)
|
|
||||||
self.toolBar = QtWidgets.QToolBar(MainWindow)
|
|
||||||
self.toolBar.setObjectName("toolBar")
|
|
||||||
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
|
|
||||||
self.dockWidget2 = QtWidgets.QDockWidget(MainWindow)
|
|
||||||
self.dockWidget2.setObjectName("dockWidget2")
|
|
||||||
self.dockWidgetContents_2 = QtWidgets.QWidget()
|
|
||||||
self.dockWidgetContents_2.setObjectName("dockWidgetContents_2")
|
|
||||||
self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents_2)
|
|
||||||
self.gridLayout_3.setObjectName("gridLayout_3")
|
|
||||||
self.verticalSlider = QtWidgets.QSlider(self.dockWidgetContents_2)
|
|
||||||
self.verticalSlider.setOrientation(QtCore.Qt.Vertical)
|
|
||||||
self.verticalSlider.setObjectName("verticalSlider")
|
|
||||||
self.gridLayout_3.addWidget(self.verticalSlider, 0, 0, 1, 1)
|
|
||||||
self.dockWidget2.setWidget(self.dockWidgetContents_2)
|
|
||||||
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget2)
|
|
||||||
self.actionAction = QtWidgets.QAction(MainWindow)
|
|
||||||
self.actionAction.setObjectName("actionAction")
|
|
||||||
self.actionSub_menu = QtWidgets.QAction(MainWindow)
|
|
||||||
self.actionSub_menu.setObjectName("actionSub_menu")
|
|
||||||
self.actionAction_C = QtWidgets.QAction(MainWindow)
|
|
||||||
self.actionAction_C.setObjectName("actionAction_C")
|
|
||||||
self.menuSubmenu_2.addAction(self.actionSub_menu)
|
|
||||||
self.menuSubmenu_2.addAction(self.actionAction_C)
|
|
||||||
self.menuMenu.addAction(self.actionAction)
|
|
||||||
self.menuMenu.addAction(self.menuSubmenu_2.menuAction())
|
|
||||||
self.menubar.addAction(self.menuMenu.menuAction())
|
|
||||||
self.toolBar.addAction(self.actionAction)
|
|
||||||
self.toolBar.addAction(self.actionSub_menu)
|
|
||||||
|
|
||||||
self.retranslateUi(MainWindow)
|
|
||||||
self.tabWidget.setCurrentIndex(0)
|
|
||||||
self.toolBox.setCurrentIndex(1)
|
|
||||||
self.tabWidget_2.setCurrentIndex(0)
|
|
||||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
|
||||||
MainWindow.setTabOrder(self.pushButton, self.checkableButton)
|
|
||||||
MainWindow.setTabOrder(self.checkableButton, self.pushButton_5)
|
|
||||||
MainWindow.setTabOrder(self.pushButton_5, self.tabWidget_2)
|
|
||||||
MainWindow.setTabOrder(self.tabWidget_2, self.tableWidget)
|
|
||||||
MainWindow.setTabOrder(self.tableWidget, self.radioButton)
|
|
||||||
MainWindow.setTabOrder(self.radioButton, self.checkBox)
|
|
||||||
MainWindow.setTabOrder(self.checkBox, self.checkBox_2)
|
|
||||||
MainWindow.setTabOrder(self.checkBox_2, self.treeWidget)
|
|
||||||
MainWindow.setTabOrder(self.treeWidget, self.pushButton_2)
|
|
||||||
MainWindow.setTabOrder(self.pushButton_2, self.bt_delay_popup)
|
|
||||||
MainWindow.setTabOrder(self.bt_delay_popup, self.bt_instant_popup)
|
|
||||||
MainWindow.setTabOrder(self.bt_instant_popup, self.bt_menu_button_popup)
|
|
||||||
MainWindow.setTabOrder(self.bt_menu_button_popup, self.pushButton_3)
|
|
||||||
MainWindow.setTabOrder(self.pushButton_3, self.doubleSpinBox)
|
|
||||||
MainWindow.setTabOrder(self.doubleSpinBox, self.toolButton)
|
|
||||||
MainWindow.setTabOrder(self.toolButton, self.comboBox)
|
|
||||||
MainWindow.setTabOrder(self.comboBox, self.horizontalSlider)
|
|
||||||
MainWindow.setTabOrder(self.horizontalSlider, self.textEdit)
|
|
||||||
MainWindow.setTabOrder(self.textEdit, self.verticalSlider)
|
|
||||||
MainWindow.setTabOrder(self.verticalSlider, self.tabWidget)
|
|
||||||
MainWindow.setTabOrder(self.tabWidget, self.lineEdit)
|
|
||||||
MainWindow.setTabOrder(self.lineEdit, self.listWidget)
|
|
||||||
|
|
||||||
def retranslateUi(self, MainWindow):
|
|
||||||
_translate = QtCore.QCoreApplication.translate
|
|
||||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
|
||||||
self.groupBox.setTitle(_translate("MainWindow", "ToolBox"))
|
|
||||||
self.toolBox.setItemText(self.toolBox.indexOf(self.page), _translate("MainWindow", "Page 1"))
|
|
||||||
__sortingEnabled = self.listWidget.isSortingEnabled()
|
|
||||||
self.listWidget.setSortingEnabled(False)
|
|
||||||
item = self.listWidget.item(0)
|
|
||||||
item.setText(_translate("MainWindow", "New Item"))
|
|
||||||
item = self.listWidget.item(1)
|
|
||||||
item.setText(_translate("MainWindow", "New Item"))
|
|
||||||
item = self.listWidget.item(2)
|
|
||||||
item.setText(_translate("MainWindow", "New Item"))
|
|
||||||
item = self.listWidget.item(3)
|
|
||||||
item.setText(_translate("MainWindow", "New Item"))
|
|
||||||
item = self.listWidget.item(4)
|
|
||||||
item.setText(_translate("MainWindow", "New Item"))
|
|
||||||
item = self.listWidget.item(5)
|
|
||||||
item.setText(_translate("MainWindow", "New Item"))
|
|
||||||
item = self.listWidget.item(6)
|
|
||||||
item.setText(_translate("MainWindow", "New Item"))
|
|
||||||
item = self.listWidget.item(7)
|
|
||||||
item.setText(_translate("MainWindow", "New Item"))
|
|
||||||
self.listWidget.setSortingEnabled(__sortingEnabled)
|
|
||||||
self.toolBox.setItemText(self.toolBox.indexOf(self.page_2), _translate("MainWindow", "Page 2"))
|
|
||||||
self.checkableButton.setText(_translate("MainWindow", "Checkable button"))
|
|
||||||
self.pushButton.setText(_translate("MainWindow", "PushButton"))
|
|
||||||
self.pushButton_5.setText(_translate("MainWindow", "PushButton"))
|
|
||||||
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_3), _translate("MainWindow", "Tab 1"))
|
|
||||||
item = self.tableWidget.verticalHeaderItem(0)
|
|
||||||
item.setText(_translate("MainWindow", "New Row"))
|
|
||||||
item = self.tableWidget.verticalHeaderItem(1)
|
|
||||||
item.setText(_translate("MainWindow", "New Row"))
|
|
||||||
item = self.tableWidget.verticalHeaderItem(2)
|
|
||||||
item.setText(_translate("MainWindow", "New Row"))
|
|
||||||
item = self.tableWidget.verticalHeaderItem(3)
|
|
||||||
item.setText(_translate("MainWindow", "New Row"))
|
|
||||||
item = self.tableWidget.horizontalHeaderItem(0)
|
|
||||||
item.setText(_translate("MainWindow", "New Column"))
|
|
||||||
item = self.tableWidget.horizontalHeaderItem(1)
|
|
||||||
item.setText(_translate("MainWindow", "New Column 2"))
|
|
||||||
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_5), _translate("MainWindow", "Page"))
|
|
||||||
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_4), _translate("MainWindow", "Tab 2"))
|
|
||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Tab 1"))
|
|
||||||
self.groupBox_2.setTitle(_translate("MainWindow", "GroupBox"))
|
|
||||||
self.label.setText(_translate("MainWindow", "TextLabel"))
|
|
||||||
self.radioButton.setText(_translate("MainWindow", "RadioB&utton"))
|
|
||||||
self.checkBox.setText(_translate("MainWindow", "CheckBox"))
|
|
||||||
self.checkBox_2.setText(_translate("MainWindow", "CheckBox Tristate"))
|
|
||||||
self.treeWidget.headerItem().setText(0, _translate("MainWindow", "qdz"))
|
|
||||||
__sortingEnabled = self.treeWidget.isSortingEnabled()
|
|
||||||
self.treeWidget.setSortingEnabled(False)
|
|
||||||
self.treeWidget.topLevelItem(0).setText(0, _translate("MainWindow", "qzd"))
|
|
||||||
self.treeWidget.topLevelItem(1).setText(0, _translate("MainWindow", "effefe"))
|
|
||||||
self.treeWidget.setSortingEnabled(__sortingEnabled)
|
|
||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Tab 2"))
|
|
||||||
self.pushButton_2.setText(_translate("MainWindow", "PushButton"))
|
|
||||||
self.bt_delay_popup.setText(_translate("MainWindow", "Delayed popup "))
|
|
||||||
self.bt_instant_popup.setText(_translate("MainWindow", "Instant popup"))
|
|
||||||
self.bt_menu_button_popup.setText(_translate("MainWindow", "MenuButtonPopup"))
|
|
||||||
self.pushButton_3.setText(_translate("MainWindow", "Disabled"))
|
|
||||||
self.toolButton.setText(_translate("MainWindow", "..."))
|
|
||||||
self.menuMenu.setTitle(_translate("MainWindow", "&Menu"))
|
|
||||||
self.menuSubmenu_2.setTitle(_translate("MainWindow", "&Submenu 2"))
|
|
||||||
self.dockWidget1.setWindowTitle(_translate("MainWindow", "&Dock widget 1"))
|
|
||||||
self.comboBox.setItemText(0, _translate("MainWindow", "Item 0"))
|
|
||||||
self.comboBox.setItemText(1, _translate("MainWindow", "Item 2"))
|
|
||||||
self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
|
|
||||||
self.dockWidget2.setWindowTitle(_translate("MainWindow", "Dock widget &2"))
|
|
||||||
self.actionAction.setText(_translate("MainWindow", "&Action"))
|
|
||||||
self.actionSub_menu.setText(_translate("MainWindow", "&Action B"))
|
|
||||||
self.actionSub_menu.setToolTip(_translate("MainWindow", "submenu"))
|
|
||||||
self.actionAction_C.setText(_translate("MainWindow", "Action &C"))
|
|
||||||
|
|
@ -1,94 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c) <2013-2014> <Colin Duquesnoy>
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
#
|
|
||||||
"""
|
|
||||||
A simple example of use.
|
|
||||||
|
|
||||||
Load an ui made in QtDesigner and apply the DarkStyleSheet.
|
|
||||||
|
|
||||||
|
|
||||||
Requirements:
|
|
||||||
- Python 2 or Python 3
|
|
||||||
- PyQt4
|
|
||||||
|
|
||||||
.. note.. :: qdarkstyle does not have to be installed to run
|
|
||||||
the example
|
|
||||||
|
|
||||||
"""
|
|
||||||
import logging
|
|
||||||
import sys
|
|
||||||
from PyQt5 import QtWidgets, QtCore
|
|
||||||
from PyQt5.QtCore import QFile, QTextStream
|
|
||||||
# make the example runnable without the need to install
|
|
||||||
|
|
||||||
import example
|
|
||||||
import breeze_resources
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""
|
|
||||||
Application entry point
|
|
||||||
"""
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
|
||||||
# create the application and the main window
|
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
|
||||||
#app.setStyle(QtWidgets.QStyleFactory.create("fusion"))
|
|
||||||
window = QtWidgets.QMainWindow()
|
|
||||||
|
|
||||||
# setup ui
|
|
||||||
ui = example.Ui_MainWindow()
|
|
||||||
ui.setupUi(window)
|
|
||||||
ui.bt_delay_popup.addActions([
|
|
||||||
ui.actionAction,
|
|
||||||
ui.actionAction_C
|
|
||||||
])
|
|
||||||
ui.bt_instant_popup.addActions([
|
|
||||||
ui.actionAction,
|
|
||||||
ui.actionAction_C
|
|
||||||
])
|
|
||||||
ui.bt_menu_button_popup.addActions([
|
|
||||||
ui.actionAction,
|
|
||||||
ui.actionAction_C
|
|
||||||
])
|
|
||||||
window.setWindowTitle("Breeze example")
|
|
||||||
|
|
||||||
# tabify dock widgets to show bug #6
|
|
||||||
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
|
|
||||||
|
|
||||||
# setup stylesheet
|
|
||||||
file = QFile(":/light.qss")
|
|
||||||
file.open(QFile.ReadOnly | QFile.Text)
|
|
||||||
stream = QTextStream(file)
|
|
||||||
app.setStyleSheet(stream.readAll())
|
|
||||||
|
|
||||||
# auto quit after 2s when testing on travis-ci
|
|
||||||
if "--travis" in sys.argv:
|
|
||||||
QtCore.QTimer.singleShot(2000, app.exit)
|
|
||||||
|
|
||||||
# run
|
|
||||||
window.show()
|
|
||||||
app.exec_()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
@ -1,87 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c) <2013-2014> <Colin Duquesnoy>
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
#
|
|
||||||
"""
|
|
||||||
A simple example of use.
|
|
||||||
|
|
||||||
Load an ui made in QtDesigner and apply the DarkStyleSheet.
|
|
||||||
|
|
||||||
|
|
||||||
Requirements:
|
|
||||||
- Python 2 or Python 3
|
|
||||||
- PyQt4
|
|
||||||
|
|
||||||
.. note.. :: qdarkstyle does not have to be installed to run
|
|
||||||
the example
|
|
||||||
|
|
||||||
"""
|
|
||||||
import logging
|
|
||||||
import sys
|
|
||||||
from PyQt5 import QtWidgets, QtCore
|
|
||||||
# make the example runnable without the need to install
|
|
||||||
|
|
||||||
import example
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""
|
|
||||||
Application entry point
|
|
||||||
"""
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
|
||||||
# create the application and the main window
|
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
|
||||||
#app.setStyle(QtWidgets.QStyleFactory.create("fusion"))
|
|
||||||
window = QtWidgets.QMainWindow()
|
|
||||||
|
|
||||||
# setup ui
|
|
||||||
ui = example.Ui_MainWindow()
|
|
||||||
ui.setupUi(window)
|
|
||||||
ui.bt_delay_popup.addActions([
|
|
||||||
ui.actionAction,
|
|
||||||
ui.actionAction_C
|
|
||||||
])
|
|
||||||
ui.bt_instant_popup.addActions([
|
|
||||||
ui.actionAction,
|
|
||||||
ui.actionAction_C
|
|
||||||
])
|
|
||||||
ui.bt_menu_button_popup.addActions([
|
|
||||||
ui.actionAction,
|
|
||||||
ui.actionAction_C
|
|
||||||
])
|
|
||||||
window.setWindowTitle("Native example")
|
|
||||||
|
|
||||||
# tabify dock widgets to show bug #6
|
|
||||||
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
|
|
||||||
|
|
||||||
# auto quit after 2s when testing on travis-ci
|
|
||||||
if "--travis" in sys.argv:
|
|
||||||
QtCore.QTimer.singleShot(2000, app.exit)
|
|
||||||
|
|
||||||
# run
|
|
||||||
window.show()
|
|
||||||
app.exec_()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
@ -1,473 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""QDarkStyle is a dark stylesheet for Python and Qt applications.
|
|
||||||
|
|
||||||
This module provides a function to transparently load the stylesheets
|
|
||||||
with the correct rc file.
|
|
||||||
|
|
||||||
First, start importing our module
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import qdarkstyle
|
|
||||||
|
|
||||||
Then you can get stylesheet provided by QDarkStyle for various Qt wrappers
|
|
||||||
as shown bellow
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
# PySide
|
|
||||||
dark_stylesheet = qdarkstyle.load_stylesheet_pyside()
|
|
||||||
# PySide 2
|
|
||||||
dark_stylesheet = qdarkstyle.load_stylesheet_pyside2()
|
|
||||||
# PyQt4
|
|
||||||
dark_stylesheet = qdarkstyle.load_stylesheet_pyqt()
|
|
||||||
# PyQt5
|
|
||||||
dark_stylesheet = qdarkstyle.load_stylesheet_pyqt5()
|
|
||||||
|
|
||||||
Or from environment variables provided for QtPy or PyQtGraph, see
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
# QtPy
|
|
||||||
dark_stylesheet = qdarkstyle.load_stylesheet_from_environment()
|
|
||||||
# PyQtGraph
|
|
||||||
dark_stylesheet = qdarkstyle.load_stylesheet_from_environment(is_pyqtgraph)
|
|
||||||
|
|
||||||
Finally, set your QApplication with it
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
app.setStyleSheet(dark_stylesheet)
|
|
||||||
|
|
||||||
Enjoy!
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
import platform
|
|
||||||
import sys
|
|
||||||
import warnings
|
|
||||||
import copy
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 4):
|
|
||||||
import importlib
|
|
||||||
|
|
||||||
__version__ = "2.6.8"
|
|
||||||
|
|
||||||
|
|
||||||
QT_BINDINGS = ['PyQt4', 'PyQt5', 'PySide', 'PySide2']
|
|
||||||
"""list: values of all Qt bindings to import."""
|
|
||||||
|
|
||||||
QT_ABSTRACTIONS = ['qtpy', 'pyqtgraph', 'Qt']
|
|
||||||
"""list: values of all Qt abstraction layers to import."""
|
|
||||||
|
|
||||||
QT4_IMPORT_API = ['QtCore', 'QtGui']
|
|
||||||
"""list: which subpackage to import for Qt4 API."""
|
|
||||||
|
|
||||||
QT5_IMPORT_API = ['QtCore', 'QtGui', 'QtWidgets']
|
|
||||||
"""list: which subpackage to import for Qt5 API."""
|
|
||||||
|
|
||||||
QT_API_VALUES = ['pyqt', 'pyqt5', 'pyside', 'pyside2']
|
|
||||||
"""list: values for QT_API environment variable used by QtPy."""
|
|
||||||
|
|
||||||
QT_LIB_VALUES = ['PyQt', 'PyQt5', 'PySide', 'PySide2']
|
|
||||||
"""list: values for PYQTGRAPH_QT_LIB environment variable used by PyQtGraph."""
|
|
||||||
|
|
||||||
QT_BINDING = 'Not set or nonexistent'
|
|
||||||
"""str: Qt binding in use."""
|
|
||||||
|
|
||||||
QT_ABSTRACTION = 'Not set or nonexistent'
|
|
||||||
"""str: Qt abstraction layer in use."""
|
|
||||||
|
|
||||||
|
|
||||||
def _logger():
|
|
||||||
return logging.getLogger('qdarkstyle')
|
|
||||||
|
|
||||||
|
|
||||||
def _qt_wrapper_import(qt_api):
|
|
||||||
"""
|
|
||||||
Check if Qt API defined can be imported.
|
|
||||||
|
|
||||||
:param qt_api: Qt API string to test import
|
|
||||||
|
|
||||||
:return load function fot given qt_api, otherwise empty string
|
|
||||||
|
|
||||||
"""
|
|
||||||
qt_wrapper = ''
|
|
||||||
loader = ""
|
|
||||||
|
|
||||||
try:
|
|
||||||
if qt_api == 'PyQt' or qt_api == 'pyqt':
|
|
||||||
import PyQt4
|
|
||||||
qt_wrapper = 'PyQt4'
|
|
||||||
loader = load_stylesheet_pyqt()
|
|
||||||
elif qt_api == 'PyQt5' or qt_api == 'pyqt5':
|
|
||||||
import PyQt5
|
|
||||||
qt_wrapper = 'PyQt5'
|
|
||||||
loader = load_stylesheet_pyqt5()
|
|
||||||
elif qt_api == 'PySide' or qt_api == 'pyside':
|
|
||||||
import PySide
|
|
||||||
qt_wrapper = 'PySide'
|
|
||||||
loader = load_stylesheet_pyside()
|
|
||||||
elif qt_api == 'PySide2' or qt_api == 'pyside2':
|
|
||||||
import PySide2
|
|
||||||
qt_wrapper = 'PySide2'
|
|
||||||
loader = load_stylesheet_pyside2()
|
|
||||||
except ImportError as err:
|
|
||||||
_logger().error("Impossible import Qt wrapper.\n %s", str(err))
|
|
||||||
else:
|
|
||||||
_logger().info("Using Qt wrapper = %s ", qt_wrapper)
|
|
||||||
QT_BINDING = qt_wrapper
|
|
||||||
finally:
|
|
||||||
return loader
|
|
||||||
|
|
||||||
|
|
||||||
def load_stylesheet_from_environment(is_pyqtgraph=False):
|
|
||||||
"""
|
|
||||||
Load the stylesheet from QT_API (or PYQTGRAPH_QT_LIB) environment variable.
|
|
||||||
|
|
||||||
:param is_pyqtgraph: True if it is to be set using PYQTGRAPH_QT_LIB
|
|
||||||
|
|
||||||
:raise KeyError: if QT_API/PYQTGRAPH_QT_LIB does not exist
|
|
||||||
|
|
||||||
:return the stylesheet string
|
|
||||||
"""
|
|
||||||
warnings.warn(
|
|
||||||
"load_stylesheet_from_environment() will be deprecated in version 3,"
|
|
||||||
"use load_stylesheet()",
|
|
||||||
PendingDeprecationWarning
|
|
||||||
)
|
|
||||||
qt_api = ''
|
|
||||||
pyqtgraph_qt_lib = ''
|
|
||||||
|
|
||||||
loader = ""
|
|
||||||
|
|
||||||
# Get values from QT_API
|
|
||||||
try:
|
|
||||||
qt_api = os.environ['QT_API']
|
|
||||||
except KeyError as err:
|
|
||||||
# Log this error just if using QT_API
|
|
||||||
if not is_pyqtgraph:
|
|
||||||
_logger().error("QT_API does not exist, do os.environ['QT_API']= "
|
|
||||||
"and choose one option from %s", QT_API_VALUES)
|
|
||||||
else:
|
|
||||||
if not is_pyqtgraph:
|
|
||||||
if qt_api in QT_API_VALUES:
|
|
||||||
QT_ABSTRACTION = "qtpy"
|
|
||||||
_logger().info("Found QT_API='%s'", qt_api)
|
|
||||||
loader = _qt_wrapper_import(qt_api)
|
|
||||||
else:
|
|
||||||
# Raise this error because the function need this key/value
|
|
||||||
raise KeyError("QT_API=%s is unknown, please use a value "
|
|
||||||
"from %s",
|
|
||||||
(qt_api, QT_API_VALUES))
|
|
||||||
|
|
||||||
# Get values from PYQTGRAPH_QT_LIB
|
|
||||||
try:
|
|
||||||
pyqtgraph_qt_lib = os.environ['PYQTGRAPH_QT_LIB']
|
|
||||||
except KeyError as err:
|
|
||||||
# Log this error just if using PYQTGRAPH_QT_LIB
|
|
||||||
if is_pyqtgraph:
|
|
||||||
_logger().error("PYQTGRAP_QT_API does not exist, do "
|
|
||||||
"os.environ['PYQTGRAPH_QT_LIB']= "
|
|
||||||
"and choose one option from %s",
|
|
||||||
QT_LIB_VALUES)
|
|
||||||
else:
|
|
||||||
|
|
||||||
if is_pyqtgraph:
|
|
||||||
if pyqtgraph_qt_lib in QT_LIB_VALUES:
|
|
||||||
QT_ABSTRACTION = "pyqtgraph"
|
|
||||||
_logger().info("Found PYQTGRAPH_QT_LIB='%s'", pyqtgraph_qt_lib)
|
|
||||||
loader = _qt_wrapper_import(pyqtgraph_qt_lib)
|
|
||||||
else:
|
|
||||||
# Raise this error because the function need this key/value
|
|
||||||
raise KeyError("PYQTGRAPH_QT_LIB=%s is unknown, please use a "
|
|
||||||
"value from %s", (
|
|
||||||
pyqtgraph_qt_lib,
|
|
||||||
QT_LIB_VALUES))
|
|
||||||
|
|
||||||
# Just a warning if both are set but differs each other
|
|
||||||
if qt_api and pyqtgraph_qt_lib:
|
|
||||||
if qt_api != pyqtgraph_qt_lib.lower():
|
|
||||||
_logger().warning("Both QT_API=%s and PYQTGRAPH_QT_LIB=%s are set, "
|
|
||||||
"but with different values, this could cause "
|
|
||||||
"some issues if using them in the same project!",
|
|
||||||
qt_api, pyqtgraph_qt_lib)
|
|
||||||
|
|
||||||
return loader
|
|
||||||
|
|
||||||
|
|
||||||
def load_stylesheet(pyside=True):
|
|
||||||
"""
|
|
||||||
Load 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
|
|
||||||
"""
|
|
||||||
warnings.warn(
|
|
||||||
"load_stylesheet() will not receive pyside parameter in version 3. "
|
|
||||||
"Set QtPy environment variable to specify the Qt binding insteady.",
|
|
||||||
PendingDeprecationWarning
|
|
||||||
)
|
|
||||||
# Smart import of the rc file
|
|
||||||
|
|
||||||
pyside_ver = None
|
|
||||||
|
|
||||||
if pyside:
|
|
||||||
|
|
||||||
# Detect the PySide version available
|
|
||||||
try:
|
|
||||||
import PySide
|
|
||||||
except ImportError: # Compatible with py27
|
|
||||||
import PySide2
|
|
||||||
pyside_ver = 2
|
|
||||||
else:
|
|
||||||
pyside_ver = 1
|
|
||||||
|
|
||||||
if pyside_ver == 1:
|
|
||||||
import qdarkstyle.pyside_style_rc
|
|
||||||
else:
|
|
||||||
import qdarkstyle.pyside2_style_rc
|
|
||||||
else:
|
|
||||||
import qdarkstyle.pyqt_style_rc
|
|
||||||
|
|
||||||
# Load the stylesheet content from resources
|
|
||||||
if not pyside:
|
|
||||||
from PyQt4.QtCore import QFile, QTextStream
|
|
||||||
else:
|
|
||||||
if pyside_ver == 1:
|
|
||||||
from PySide.QtCore import QFile, QTextStream
|
|
||||||
else:
|
|
||||||
from PySide2.QtCore import QFile, QTextStream
|
|
||||||
|
|
||||||
f = QFile(":qdarkstyle/style.qss")
|
|
||||||
if not f.exists():
|
|
||||||
_logger().error("Unable to load stylesheet, file not found in "
|
|
||||||
"resources")
|
|
||||||
return ""
|
|
||||||
else:
|
|
||||||
f.open(QFile.ReadOnly | QFile.Text)
|
|
||||||
ts = QTextStream(f)
|
|
||||||
stylesheet = ts.readAll()
|
|
||||||
if platform.system().lower() == 'darwin': # see issue #12 on github
|
|
||||||
mac_fix = '''
|
|
||||||
QDockWidget::title
|
|
||||||
{
|
|
||||||
background-color: #32414B;
|
|
||||||
text-align: center;
|
|
||||||
height: 12px;
|
|
||||||
}
|
|
||||||
'''
|
|
||||||
stylesheet += mac_fix
|
|
||||||
return stylesheet
|
|
||||||
|
|
||||||
|
|
||||||
def load_stylesheet_pyside():
|
|
||||||
"""
|
|
||||||
Load the stylesheet for use in a pyside application.
|
|
||||||
|
|
||||||
:return the stylesheet string
|
|
||||||
"""
|
|
||||||
warnings.warn(
|
|
||||||
"load_stylesheet_pyside() will be deprecated in version 3,"
|
|
||||||
"set QtPy environment variable to specify the Qt binding and "
|
|
||||||
"use load_stylesheet()",
|
|
||||||
PendingDeprecationWarning
|
|
||||||
)
|
|
||||||
return load_stylesheet(pyside=True)
|
|
||||||
|
|
||||||
|
|
||||||
def load_stylesheet_pyside2():
|
|
||||||
"""
|
|
||||||
Load the stylesheet for use in a pyside2 application.
|
|
||||||
|
|
||||||
:raise NotImplementedError: Because it is not supported yet
|
|
||||||
"""
|
|
||||||
warnings.warn(
|
|
||||||
"load_stylesheet_pyside2() will be deprecated in version 3,"
|
|
||||||
"set QtPy environment variable to specify the Qt binding and "
|
|
||||||
"use load_stylesheet()",
|
|
||||||
PendingDeprecationWarning
|
|
||||||
)
|
|
||||||
return load_stylesheet(pyside=True)
|
|
||||||
|
|
||||||
|
|
||||||
def load_stylesheet_pyqt():
|
|
||||||
"""
|
|
||||||
Load the stylesheet for use in a pyqt4 application.
|
|
||||||
|
|
||||||
:return the stylesheet string
|
|
||||||
"""
|
|
||||||
warnings.warn(
|
|
||||||
"load_stylesheet_pyqt() will be deprecated in version 3,"
|
|
||||||
"set QtPy environment variable to specify the Qt binding and "
|
|
||||||
"use load_stylesheet()",
|
|
||||||
PendingDeprecationWarning
|
|
||||||
)
|
|
||||||
return load_stylesheet(pyside=False)
|
|
||||||
|
|
||||||
|
|
||||||
def load_stylesheet_pyqt5():
|
|
||||||
"""
|
|
||||||
Load the stylesheet for use in a pyqt5 application.
|
|
||||||
|
|
||||||
:param pyside: True to load the pyside rc file, False to load the PyQt rc file
|
|
||||||
|
|
||||||
:return the stylesheet string
|
|
||||||
"""
|
|
||||||
warnings.warn(
|
|
||||||
"load_stylesheet_pyqt5() will be deprecated in version 3,"
|
|
||||||
"set QtPy environment variable to specify the Qt binding and "
|
|
||||||
"use load_stylesheet()",
|
|
||||||
PendingDeprecationWarning
|
|
||||||
)
|
|
||||||
# Smart import of the rc file
|
|
||||||
import qdarkstyle.pyqt5_style_rc
|
|
||||||
|
|
||||||
# Load the stylesheet content from resources
|
|
||||||
from PyQt5.QtCore import QFile, QTextStream
|
|
||||||
|
|
||||||
f = QFile(":qdarkstyle/style.qss")
|
|
||||||
if not f.exists():
|
|
||||||
_logger().error("Unable to load stylesheet, file not found in "
|
|
||||||
"resources")
|
|
||||||
return ""
|
|
||||||
else:
|
|
||||||
f.open(QFile.ReadOnly | QFile.Text)
|
|
||||||
ts = QTextStream(f)
|
|
||||||
stylesheet = ts.readAll()
|
|
||||||
if platform.system().lower() == 'darwin': # see issue #12 on github
|
|
||||||
mac_fix = '''
|
|
||||||
QDockWidget::title
|
|
||||||
{
|
|
||||||
background-color: #32414B;
|
|
||||||
text-align: center;
|
|
||||||
height: 12px;
|
|
||||||
}
|
|
||||||
'''
|
|
||||||
stylesheet += mac_fix
|
|
||||||
return stylesheet
|
|
||||||
|
|
||||||
|
|
||||||
def information():
|
|
||||||
"""Get system and runtime information."""
|
|
||||||
info = []
|
|
||||||
qt_api = ''
|
|
||||||
qt_lib = ''
|
|
||||||
qt_bin = ''
|
|
||||||
|
|
||||||
try:
|
|
||||||
qt_api = os.environ['QT_API']
|
|
||||||
except KeyError:
|
|
||||||
qt_api = 'Not set or nonexistent'
|
|
||||||
|
|
||||||
try:
|
|
||||||
from Qt import __binding__
|
|
||||||
except Exception:
|
|
||||||
# It should be (KeyError, ModuleNotFoundError, ImportError)
|
|
||||||
# but each python version have a different one, and not define others
|
|
||||||
qt_lib = 'Not set or nonexistent'
|
|
||||||
else:
|
|
||||||
qt_lib = __binding__
|
|
||||||
|
|
||||||
try:
|
|
||||||
qt_bin = os.environ['PYQTGRAPH_QT_LIB']
|
|
||||||
except KeyError:
|
|
||||||
qt_bin = 'Not set or nonexistent'
|
|
||||||
|
|
||||||
info.append('QDarkStyle: %s' % __version__)
|
|
||||||
info.append('OS: %s %s %s' % (platform.system(), platform.release(), platform.machine()))
|
|
||||||
info.append('Platform: %s' % sys.platform)
|
|
||||||
info.append('Python: %s' % '.'.join(str(e) for e in sys.version_info[:]))
|
|
||||||
info.append('Python API: %s' % sys.api_version)
|
|
||||||
|
|
||||||
info.append('Binding in use: %s' % QT_BINDING)
|
|
||||||
info.append('Abstraction in use: %s' % QT_ABSTRACTION)
|
|
||||||
|
|
||||||
info.append('qtpy (QT_API): %s' % qt_api)
|
|
||||||
info.append('pyqtgraph (PYQTGRAPH_QT_LIB): %s' % qt_lib)
|
|
||||||
info.append('Qt.py (__binding__): %s' % qt_bin)
|
|
||||||
|
|
||||||
return info
|
|
||||||
|
|
||||||
|
|
||||||
def qt_bindings():
|
|
||||||
"""Return a list of qt bindings available."""
|
|
||||||
return _check_imports(import_list=QT_BINDINGS)
|
|
||||||
|
|
||||||
|
|
||||||
def qt_abstractions():
|
|
||||||
"""Return a list of qt abstraction layers available."""
|
|
||||||
return _check_imports(import_list=QT_ABSTRACTIONS)
|
|
||||||
|
|
||||||
|
|
||||||
def _check_imports(import_list):
|
|
||||||
"""Return a list of imports available."""
|
|
||||||
|
|
||||||
# Disable warnings here
|
|
||||||
warnings.filterwarnings("ignore")
|
|
||||||
|
|
||||||
import_list_return = copy.deepcopy(import_list)
|
|
||||||
# Using import_list_return var in for, does not work in py2.7
|
|
||||||
# when removing the element, it reflects on for list
|
|
||||||
# so it skips next element
|
|
||||||
for current_import in import_list:
|
|
||||||
|
|
||||||
spec = True
|
|
||||||
# Copy the sys path to make sure to not insert anything
|
|
||||||
sys_path = sys.path
|
|
||||||
|
|
||||||
# Check import
|
|
||||||
if sys.version_info >= (3, 4):
|
|
||||||
spec = importlib.util.find_spec(current_import)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
__import__(current_import)
|
|
||||||
except RuntimeWarning:
|
|
||||||
spec = True
|
|
||||||
except Exception:
|
|
||||||
spec = None
|
|
||||||
else:
|
|
||||||
spec = True
|
|
||||||
|
|
||||||
if spec is None:
|
|
||||||
# Remove if not available
|
|
||||||
import_list_return.remove(current_import)
|
|
||||||
|
|
||||||
# Restore sys path
|
|
||||||
sys.path = sys_path
|
|
||||||
|
|
||||||
# Restore warnings
|
|
||||||
warnings.resetwarnings()
|
|
||||||
|
|
||||||
return import_list_return
|
|
||||||
|
|
||||||
|
|
||||||
def _import_qt_modules_from(use_binding='pyqt5', use_abstraction='qtpy'):
|
|
||||||
"""New approach to import modules using importlib."""
|
|
||||||
|
|
||||||
if not sys.version_info >= (3, 4):
|
|
||||||
print('Function not available for Python < 3.4')
|
|
||||||
|
|
||||||
spec_binding = importlib.util.find_spec(use_binding)
|
|
||||||
spec_abstraction = importlib.util.find_spec(use_abstraction)
|
|
||||||
|
|
||||||
if spec_binding is None:
|
|
||||||
print("Cannot find Qt binding: ", use_binding)
|
|
||||||
else:
|
|
||||||
module = importlib.util.module_from_spec(spec_binding)
|
|
||||||
spec.loader.exec_module(module)
|
|
||||||
# Adding the module to sys.modules is optional.
|
|
||||||
sys.modules[name] = module
|
|
||||||
|
|
||||||
if spec_abstraction is None:
|
|
||||||
print("Cannot find Qt abstraction layer: ", use_abstraction)
|
|
||||||
else:
|
|
||||||
module = importlib.util.module_from_spec(spec)
|
|
||||||
spec.loader.exec_module(module)
|
|
||||||
# Adding the module to sys.modules is optional.
|
|
||||||
sys.modules[name] = module
|
|
@ -1,65 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from qdarkstyle import qt_bindings, qt_abstractions, information, __version__
|
|
||||||
import qdarkstyle
|
|
||||||
import argparse
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from os.path import abspath, dirname
|
|
||||||
sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/..'))
|
|
||||||
|
|
||||||
|
|
||||||
def print_list_md(info):
|
|
||||||
"""Print a list of information, line by line."""
|
|
||||||
for item in info:
|
|
||||||
print(' - ' + item)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Execute QDarkStyle example."""
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__,
|
|
||||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
||||||
parser.add_argument('-i', '--information', action='store_true',
|
|
||||||
help="Show information about environment (important for bug report)")
|
|
||||||
parser.add_argument('-b', '--bindings', action='store_true',
|
|
||||||
help="Show available bindings for Qt")
|
|
||||||
parser.add_argument('-a', '--abstractions', action='store_true',
|
|
||||||
help="Show available abstraction layers for Qt bindings")
|
|
||||||
# parser.add_argument('-e', '--example', action='store_true',
|
|
||||||
# help="Show qdarkstyle example, subcommand.")
|
|
||||||
parser.add_argument('-v', '--version', action='store_true',
|
|
||||||
help="Show qdarkstyle version")
|
|
||||||
parser.add_argument('--all', action='store_true',
|
|
||||||
help="Show all information options at once")
|
|
||||||
|
|
||||||
# parsing arguments from command line
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
parser.print_help()
|
|
||||||
|
|
||||||
if args.information or args.all:
|
|
||||||
info = information()
|
|
||||||
print('\nInformation about your current environment setup:')
|
|
||||||
print_list_md(info)
|
|
||||||
|
|
||||||
if args.bindings or args.all:
|
|
||||||
info = qt_bindings()
|
|
||||||
print('\nQt bindings available:')
|
|
||||||
print_list_md(info)
|
|
||||||
|
|
||||||
if args.abstractions or args.all:
|
|
||||||
info = qt_abstractions()
|
|
||||||
print('\nQt abstraction layers available:')
|
|
||||||
print_list_md(info)
|
|
||||||
|
|
||||||
if args.version:
|
|
||||||
info = __version__
|
|
||||||
print('\nVersion: %s' % info)
|
|
||||||
|
|
||||||
# if args.example:
|
|
||||||
# example.main()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user