mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-26 22:28:41 -05:00
Add a pyqt example
(and rename the original example into example_pyqide)
This commit is contained in:
parent
469d9afd84
commit
c58336977d
@ -30,20 +30,19 @@ Load an ui made in QtDesigner and apply the DarkStyleSheet.
|
||||
|
||||
Requirements:
|
||||
- Python 2 or Python 3
|
||||
- PySide
|
||||
- PyQt4
|
||||
|
||||
.. note.. :: qdarkstyle does not have to be installed to run
|
||||
the example
|
||||
the example
|
||||
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
from PySide import QtGui
|
||||
from PyQt4 import QtGui
|
||||
from os.path import abspath, dirname
|
||||
# make the example runnable without the need to install
|
||||
sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/..'))
|
||||
import qdarkstyle
|
||||
import example_ui
|
||||
import example_pyqt_ui as example_ui
|
||||
|
||||
|
||||
def main():
|
||||
@ -60,7 +59,7 @@ def main():
|
||||
window.setWindowTitle("QDarkStyle example")
|
||||
|
||||
# setup stylesheet
|
||||
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=True))
|
||||
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
|
||||
|
||||
# run
|
||||
window.show()
|
||||
|
183
example/example_pyqt_ui.py
Normal file
183
example/example_pyqt_ui.py
Normal file
@ -0,0 +1,183 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'example.ui'
|
||||
#
|
||||
# Created: Thu Jan 2 15:54:09 2014
|
||||
# by: PyQt4 UI code generator 4.10.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName(_fromUtf8("MainWindow"))
|
||||
MainWindow.resize(800, 600)
|
||||
self.centralwidget = QtGui.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.centralwidget)
|
||||
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
||||
self.groupBox = QtGui.QGroupBox(self.centralwidget)
|
||||
self.groupBox.setObjectName(_fromUtf8("groupBox"))
|
||||
self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox)
|
||||
self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
|
||||
self.lineEdit = QtGui.QLineEdit(self.groupBox)
|
||||
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
|
||||
self.verticalLayout_3.addWidget(self.lineEdit)
|
||||
self.listWidget = QtGui.QListWidget(self.groupBox)
|
||||
self.listWidget.setObjectName(_fromUtf8("listWidget"))
|
||||
item = QtGui.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
item = QtGui.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
item = QtGui.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
item = QtGui.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
item = QtGui.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
item = QtGui.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
item = QtGui.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
item = QtGui.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
self.verticalLayout_3.addWidget(self.listWidget)
|
||||
self.horizontalLayout_2.addWidget(self.groupBox)
|
||||
self.groupBox_2 = QtGui.QGroupBox(self.centralwidget)
|
||||
self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
|
||||
self.verticalLayout_4 = QtGui.QVBoxLayout(self.groupBox_2)
|
||||
self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
|
||||
self.label = QtGui.QLabel(self.groupBox_2)
|
||||
self.label.setObjectName(_fromUtf8("label"))
|
||||
self.verticalLayout_4.addWidget(self.label)
|
||||
self.radioButton = QtGui.QRadioButton(self.groupBox_2)
|
||||
self.radioButton.setObjectName(_fromUtf8("radioButton"))
|
||||
self.verticalLayout_4.addWidget(self.radioButton)
|
||||
self.checkBox = QtGui.QCheckBox(self.groupBox_2)
|
||||
self.checkBox.setObjectName(_fromUtf8("checkBox"))
|
||||
self.verticalLayout_4.addWidget(self.checkBox)
|
||||
self.treeWidget = QtGui.QTreeWidget(self.groupBox_2)
|
||||
self.treeWidget.setObjectName(_fromUtf8("treeWidget"))
|
||||
item_0 = QtGui.QTreeWidgetItem(self.treeWidget)
|
||||
item_0 = QtGui.QTreeWidgetItem(self.treeWidget)
|
||||
self.verticalLayout_4.addWidget(self.treeWidget)
|
||||
self.horizontalLayout_2.addWidget(self.groupBox_2)
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtGui.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 25))
|
||||
self.menubar.setObjectName(_fromUtf8("menubar"))
|
||||
self.menuMenu = QtGui.QMenu(self.menubar)
|
||||
self.menuMenu.setObjectName(_fromUtf8("menuMenu"))
|
||||
self.menuSubmenu_2 = QtGui.QMenu(self.menuMenu)
|
||||
self.menuSubmenu_2.setObjectName(_fromUtf8("menuSubmenu_2"))
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtGui.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName(_fromUtf8("statusbar"))
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
self.ExampleDock = QtGui.QDockWidget(MainWindow)
|
||||
self.ExampleDock.setObjectName(_fromUtf8("ExampleDock"))
|
||||
self.dockWidgetContents = QtGui.QWidget()
|
||||
self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
|
||||
self.verticalLayout_2 = QtGui.QVBoxLayout(self.dockWidgetContents)
|
||||
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||
self.pushButton_2 = QtGui.QPushButton(self.dockWidgetContents)
|
||||
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
|
||||
self.horizontalLayout.addWidget(self.pushButton_2)
|
||||
self.pushButton = QtGui.QPushButton(self.dockWidgetContents)
|
||||
self.pushButton.setObjectName(_fromUtf8("pushButton"))
|
||||
self.horizontalLayout.addWidget(self.pushButton)
|
||||
self.pushButton_3 = QtGui.QPushButton(self.dockWidgetContents)
|
||||
self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))
|
||||
self.horizontalLayout.addWidget(self.pushButton_3)
|
||||
self.doubleSpinBox = QtGui.QDoubleSpinBox(self.dockWidgetContents)
|
||||
self.doubleSpinBox.setObjectName(_fromUtf8("doubleSpinBox"))
|
||||
self.horizontalLayout.addWidget(self.doubleSpinBox)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
||||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
|
||||
self.comboBox = QtGui.QComboBox(self.dockWidgetContents)
|
||||
self.comboBox.setObjectName(_fromUtf8("comboBox"))
|
||||
self.comboBox.addItem(_fromUtf8(""))
|
||||
self.comboBox.addItem(_fromUtf8(""))
|
||||
self.verticalLayout.addWidget(self.comboBox)
|
||||
self.textEdit = QtGui.QTextEdit(self.dockWidgetContents)
|
||||
self.textEdit.setObjectName(_fromUtf8("textEdit"))
|
||||
self.verticalLayout.addWidget(self.textEdit)
|
||||
self.progressBar = QtGui.QProgressBar(self.dockWidgetContents)
|
||||
self.progressBar.setProperty("value", 24)
|
||||
self.progressBar.setObjectName(_fromUtf8("progressBar"))
|
||||
self.verticalLayout.addWidget(self.progressBar)
|
||||
self.verticalLayout_2.addLayout(self.verticalLayout)
|
||||
self.ExampleDock.setWidget(self.dockWidgetContents)
|
||||
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.ExampleDock)
|
||||
self.actionSubmenu = QtGui.QAction(MainWindow)
|
||||
self.actionSubmenu.setObjectName(_fromUtf8("actionSubmenu"))
|
||||
self.actionSubsubmenu = QtGui.QAction(MainWindow)
|
||||
self.actionSubsubmenu.setObjectName(_fromUtf8("actionSubsubmenu"))
|
||||
self.menuSubmenu_2.addAction(self.actionSubsubmenu)
|
||||
self.menuMenu.addAction(self.actionSubmenu)
|
||||
self.menuMenu.addAction(self.menuSubmenu_2.menuAction())
|
||||
self.menubar.addAction(self.menuMenu.menuAction())
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
|
||||
self.groupBox.setTitle(_translate("MainWindow", "GroupBox", None))
|
||||
__sortingEnabled = self.listWidget.isSortingEnabled()
|
||||
self.listWidget.setSortingEnabled(False)
|
||||
item = self.listWidget.item(0)
|
||||
item.setText(_translate("MainWindow", "New Item", None))
|
||||
item = self.listWidget.item(1)
|
||||
item.setText(_translate("MainWindow", "New Item", None))
|
||||
item = self.listWidget.item(2)
|
||||
item.setText(_translate("MainWindow", "New Item", None))
|
||||
item = self.listWidget.item(3)
|
||||
item.setText(_translate("MainWindow", "New Item", None))
|
||||
item = self.listWidget.item(4)
|
||||
item.setText(_translate("MainWindow", "New Item", None))
|
||||
item = self.listWidget.item(5)
|
||||
item.setText(_translate("MainWindow", "New Item", None))
|
||||
item = self.listWidget.item(6)
|
||||
item.setText(_translate("MainWindow", "New Item", None))
|
||||
item = self.listWidget.item(7)
|
||||
item.setText(_translate("MainWindow", "New Item", None))
|
||||
self.listWidget.setSortingEnabled(__sortingEnabled)
|
||||
self.groupBox_2.setTitle(_translate("MainWindow", "GroupBox", None))
|
||||
self.label.setText(_translate("MainWindow", "TextLabel", None))
|
||||
self.radioButton.setText(_translate("MainWindow", "RadioButton", None))
|
||||
self.checkBox.setText(_translate("MainWindow", "CheckBox", None))
|
||||
self.treeWidget.headerItem().setText(0, _translate("MainWindow", "qdz", None))
|
||||
__sortingEnabled = self.treeWidget.isSortingEnabled()
|
||||
self.treeWidget.setSortingEnabled(False)
|
||||
self.treeWidget.topLevelItem(0).setText(0, _translate("MainWindow", "qzd", None))
|
||||
self.treeWidget.topLevelItem(1).setText(0, _translate("MainWindow", "effefe", None))
|
||||
self.treeWidget.setSortingEnabled(__sortingEnabled)
|
||||
self.menuMenu.setTitle(_translate("MainWindow", "Menu", None))
|
||||
self.menuSubmenu_2.setTitle(_translate("MainWindow", "Submenu 2", None))
|
||||
self.pushButton_2.setText(_translate("MainWindow", "PushButton", None))
|
||||
self.pushButton.setText(_translate("MainWindow", "PushButton", None))
|
||||
self.pushButton_3.setText(_translate("MainWindow", "PushButton", None))
|
||||
self.comboBox.setItemText(0, _translate("MainWindow", "Item 0", None))
|
||||
self.comboBox.setItemText(1, _translate("MainWindow", "Item 2", None))
|
||||
self.actionSubmenu.setText(_translate("MainWindow", "Submenu", None))
|
||||
self.actionSubsubmenu.setText(_translate("MainWindow", "Subsubmenu", None))
|
||||
|
BIN
example/example_pyqt_ui.pyc
Normal file
BIN
example/example_pyqt_ui.pyc
Normal file
Binary file not shown.
@ -33,7 +33,7 @@ Requirements:
|
||||
- PySide
|
||||
|
||||
.. note.. :: qdarkstyle does not have to be installed to run
|
||||
the example
|
||||
the example
|
||||
|
||||
"""
|
||||
import os
|
||||
@ -43,7 +43,7 @@ from os.path import abspath, dirname
|
||||
# make the example runnable without the need to install
|
||||
sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/..'))
|
||||
import qdarkstyle
|
||||
import example_ui
|
||||
import example_pyside_ui as example_ui
|
||||
|
||||
|
||||
def main():
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user