mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-23 04:38:37 -05:00
Added an example of usage with pyside
This commit is contained in:
parent
d0b29eb734
commit
8f2078b562
23
example.py
Normal file
23
example.py
Normal file
@ -0,0 +1,23 @@
|
||||
import sys
|
||||
from PySide import QtGui
|
||||
import example_ui
|
||||
|
||||
# import the style resources
|
||||
import style_pyside_rc
|
||||
|
||||
|
||||
# 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)
|
||||
|
||||
# setup stylesheet
|
||||
with open("style.qss", 'r') as stylesheet:
|
||||
app.setStyleSheet(stylesheet.read())
|
||||
|
||||
# run
|
||||
window.show()
|
||||
app.exec_()
|
228
example.ui
Normal file
228
example.ui
Normal file
@ -0,0 +1,228 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>GroupBox</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>GroupBox</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="text">
|
||||
<string>RadioButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>qdz</string>
|
||||
</property>
|
||||
</column>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>qzd</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>effefe</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuMenu">
|
||||
<property name="title">
|
||||
<string>Menu</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuSubmenu_2">
|
||||
<property name="title">
|
||||
<string>Submenu 2</string>
|
||||
</property>
|
||||
<addaction name="actionSubsubmenu"/>
|
||||
</widget>
|
||||
<addaction name="actionSubmenu"/>
|
||||
<addaction name="menuSubmenu_2"/>
|
||||
</widget>
|
||||
<addaction name="menuMenu"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QDockWidget" name="ExampleDock">
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Item 0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Item 2</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionSubmenu">
|
||||
<property name="text">
|
||||
<string>Submenu</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSubsubmenu">
|
||||
<property name="text">
|
||||
<string>Subsubmenu</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
153
example_ui.py
Normal file
153
example_ui.py
Normal file
@ -0,0 +1,153 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'example.ui'
|
||||
#
|
||||
# Created: Sun Mar 10 15:08:16 2013
|
||||
# by: pyside-uic 0.2.13 running on PySide 1.1.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(800, 600)
|
||||
self.centralwidget = QtGui.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.centralwidget)
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.groupBox = QtGui.QGroupBox(self.centralwidget)
|
||||
self.groupBox.setObjectName("groupBox")
|
||||
self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox)
|
||||
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||
self.lineEdit = QtGui.QLineEdit(self.groupBox)
|
||||
self.lineEdit.setObjectName("lineEdit")
|
||||
self.verticalLayout_3.addWidget(self.lineEdit)
|
||||
self.listWidget = QtGui.QListWidget(self.groupBox)
|
||||
self.listWidget.setObjectName("listWidget")
|
||||
QtGui.QListWidgetItem(self.listWidget)
|
||||
QtGui.QListWidgetItem(self.listWidget)
|
||||
QtGui.QListWidgetItem(self.listWidget)
|
||||
QtGui.QListWidgetItem(self.listWidget)
|
||||
QtGui.QListWidgetItem(self.listWidget)
|
||||
QtGui.QListWidgetItem(self.listWidget)
|
||||
QtGui.QListWidgetItem(self.listWidget)
|
||||
QtGui.QListWidgetItem(self.listWidget)
|
||||
self.verticalLayout_3.addWidget(self.listWidget)
|
||||
self.horizontalLayout_2.addWidget(self.groupBox)
|
||||
self.groupBox_2 = QtGui.QGroupBox(self.centralwidget)
|
||||
self.groupBox_2.setObjectName("groupBox_2")
|
||||
self.verticalLayout_4 = QtGui.QVBoxLayout(self.groupBox_2)
|
||||
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||
self.label = QtGui.QLabel(self.groupBox_2)
|
||||
self.label.setObjectName("label")
|
||||
self.verticalLayout_4.addWidget(self.label)
|
||||
self.radioButton = QtGui.QRadioButton(self.groupBox_2)
|
||||
self.radioButton.setObjectName("radioButton")
|
||||
self.verticalLayout_4.addWidget(self.radioButton)
|
||||
self.checkBox = QtGui.QCheckBox(self.groupBox_2)
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
self.verticalLayout_4.addWidget(self.checkBox)
|
||||
self.treeWidget = QtGui.QTreeWidget(self.groupBox_2)
|
||||
self.treeWidget.setObjectName("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("menubar")
|
||||
self.menuMenu = QtGui.QMenu(self.menubar)
|
||||
self.menuMenu.setObjectName("menuMenu")
|
||||
self.menuSubmenu_2 = QtGui.QMenu(self.menuMenu)
|
||||
self.menuSubmenu_2.setObjectName("menuSubmenu_2")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtGui.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
self.ExampleDock = QtGui.QDockWidget(MainWindow)
|
||||
self.ExampleDock.setObjectName("ExampleDock")
|
||||
self.dockWidgetContents = QtGui.QWidget()
|
||||
self.dockWidgetContents.setObjectName("dockWidgetContents")
|
||||
self.verticalLayout_2 = QtGui.QVBoxLayout(self.dockWidgetContents)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.pushButton_2 = QtGui.QPushButton(self.dockWidgetContents)
|
||||
self.pushButton_2.setObjectName("pushButton_2")
|
||||
self.horizontalLayout.addWidget(self.pushButton_2)
|
||||
self.pushButton = QtGui.QPushButton(self.dockWidgetContents)
|
||||
self.pushButton.setObjectName("pushButton")
|
||||
self.horizontalLayout.addWidget(self.pushButton)
|
||||
self.pushButton_3 = QtGui.QPushButton(self.dockWidgetContents)
|
||||
self.pushButton_3.setObjectName("pushButton_3")
|
||||
self.horizontalLayout.addWidget(self.pushButton_3)
|
||||
self.doubleSpinBox = QtGui.QDoubleSpinBox(self.dockWidgetContents)
|
||||
self.doubleSpinBox.setObjectName("doubleSpinBox")
|
||||
self.horizontalLayout.addWidget(self.doubleSpinBox)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
||||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.comboBox = QtGui.QComboBox(self.dockWidgetContents)
|
||||
self.comboBox.setObjectName("comboBox")
|
||||
self.comboBox.addItem("")
|
||||
self.comboBox.addItem("")
|
||||
self.verticalLayout.addWidget(self.comboBox)
|
||||
self.textEdit = QtGui.QTextEdit(self.dockWidgetContents)
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.verticalLayout.addWidget(self.textEdit)
|
||||
self.progressBar = QtGui.QProgressBar(self.dockWidgetContents)
|
||||
self.progressBar.setProperty("value", 24)
|
||||
self.progressBar.setObjectName("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("actionSubmenu")
|
||||
self.actionSubsubmenu = QtGui.QAction(MainWindow)
|
||||
self.actionSubsubmenu.setObjectName("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(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "GroupBox", None, QtGui.QApplication.UnicodeUTF8))
|
||||
__sortingEnabled = self.listWidget.isSortingEnabled()
|
||||
self.listWidget.setSortingEnabled(False)
|
||||
self.listWidget.item(0).setText(QtGui.QApplication.translate("MainWindow", "New Item", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.listWidget.item(1).setText(QtGui.QApplication.translate("MainWindow", "New Item", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.listWidget.item(2).setText(QtGui.QApplication.translate("MainWindow", "New Item", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.listWidget.item(3).setText(QtGui.QApplication.translate("MainWindow", "New Item", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.listWidget.item(4).setText(QtGui.QApplication.translate("MainWindow", "New Item", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.listWidget.item(5).setText(QtGui.QApplication.translate("MainWindow", "New Item", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.listWidget.item(6).setText(QtGui.QApplication.translate("MainWindow", "New Item", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.listWidget.item(7).setText(QtGui.QApplication.translate("MainWindow", "New Item", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.listWidget.setSortingEnabled(__sortingEnabled)
|
||||
self.groupBox_2.setTitle(QtGui.QApplication.translate("MainWindow", "GroupBox", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label.setText(QtGui.QApplication.translate("MainWindow", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton.setText(QtGui.QApplication.translate("MainWindow", "RadioButton", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.checkBox.setText(QtGui.QApplication.translate("MainWindow", "CheckBox", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.treeWidget.headerItem().setText(0, QtGui.QApplication.translate("MainWindow", "qdz", None, QtGui.QApplication.UnicodeUTF8))
|
||||
__sortingEnabled = self.treeWidget.isSortingEnabled()
|
||||
self.treeWidget.setSortingEnabled(False)
|
||||
self.treeWidget.topLevelItem(0).setText(0, QtGui.QApplication.translate("MainWindow", "qzd", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.treeWidget.topLevelItem(1).setText(0, QtGui.QApplication.translate("MainWindow", "effefe", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.treeWidget.setSortingEnabled(__sortingEnabled)
|
||||
self.menuMenu.setTitle(QtGui.QApplication.translate("MainWindow", "Menu", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.menuSubmenu_2.setTitle(QtGui.QApplication.translate("MainWindow", "Submenu 2", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.pushButton_2.setText(QtGui.QApplication.translate("MainWindow", "PushButton", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "PushButton", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.pushButton_3.setText(QtGui.QApplication.translate("MainWindow", "PushButton", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.comboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Item 0", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.comboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Item 2", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.actionSubmenu.setText(QtGui.QApplication.translate("MainWindow", "Submenu", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.actionSubsubmenu.setText(QtGui.QApplication.translate("MainWindow", "Subsubmenu", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
Loading…
Reference in New Issue
Block a user