PyQt/partner_625781186/15_Plugins/Plugins/PluginPage0_inMainLayout.py

96 lines
2.1 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
"""
2018-09-27 16:45:55 +08:00
插件例子1.
"""
"""
Created on 2018-09-18 <br>
description: $description$ <br>
author: 625781186@qq.com <br>
site: https://github.com/625781186 <br>
更多经典例子:https://github.com/892768447/PyQt <br>
课件: https://github.com/625781186/WoHowLearn_PyQt5 <br>
视频教程: https://space.bilibili.com/1863103/#/ <br>
"""
from PyQt5 import QtGui, QtWidgets, QtCore
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtWidgets import QWidget
try:
2018-09-23 17:04:51 +08:00
from Ui_PluginPage1 import Ui_Form
except:
2018-09-24 14:51:53 +08:00
from page1.Ui_PluginPage1 import Ui_Form
2018-09-27 16:45:55 +08:00
# 实例化类名, 必须
2018-09-23 17:04:51 +08:00
className = "Form"
class Form(QWidget, Ui_Form):
"""
Class documentation goes here.
"""
def __init__(self, parent=None):
"""
"""
super(Form, self).__init__(parent)
self.setupUi(self)
2018-09-24 14:51:53 +08:00
self.__mw = parent
# layout = self.getParentLayout()
# layout.addWidget(self)
def getParentLayout(self):
2018-09-27 16:45:55 +08:00
"""
布局函数,必须.
"""
2018-09-24 14:51:53 +08:00
return self.__mw.verticalLayout
2018-09-23 17:04:51 +08:00
2018-09-27 16:45:55 +08:00
def toInterface(self):
"""
插入到界面,必须
"""
layout = self.getParentLayout()
layout.addWidget(self)
2018-09-23 17:04:51 +08:00
def __del__(self):
print("die")
@pyqtSlot()
def on_pushButton_clicked(self):
print(2)
pass
@pyqtSlot()
def on_pushButton_2_clicked(self):
print(2)
pass
@pyqtSlot()
def on_pushButton_3_clicked(self):
print(3)
2018-09-24 14:51:53 +08:00
pass
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
app.setStyle(QStyleFactory.create("Fusion"))
# 自定义CSS样式
# from BasePack.CommonHelper import CommonHelper
# styleFile = 'BasePack/style.css'
# qssStyle = CommonHelper.readQss( styleFile )
# framelessWindow.setStyleSheet( qssStyle )
# If you want to use this style, please pip install qdarkstyle.
# import qdarkstyle
# app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
ui = Form()
ui.show()
sys.exit(app.exec_())