|
1 | | -#!/usr/bin/env python |
2 | | -# -*- coding: utf-8 -*- |
3 | | - |
4 | | -""" |
5 | | -Created on 2019年1月5日 |
6 | | -@author: Irony |
7 | | -@site: https://pyqt5.com https://github.com/892768447 |
8 | | -@email: 892768447@qq.com |
9 | | -@file: Test.tSlotsByName |
10 | | -@description: |
11 | | -""" |
12 | | -import sys |
13 | | - |
14 | | -from PyQt5.QtCore import QMetaObject, pyqtSlot |
15 | | -from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout |
16 | | - |
17 | | -from Widgets.RotateButton import RotateButton |
18 | | - |
19 | | - |
20 | | -__Author__ = """By: Irony |
21 | | -QQ: 892768447 |
22 | | -Email: 892768447@qq.com""" |
23 | | -__Copyright__ = "Copyright (c) 2019 Irony" |
24 | | -__Version__ = "Version 1.0" |
25 | | - |
26 | | - |
27 | | -class Ui_FormMainWindow(object): |
28 | | - |
29 | | - def setupUi(self, FormMainWindow): |
30 | | - layout = QVBoxLayout(FormMainWindow) |
31 | | - layout.addWidget(RotateButton('test', FormMainWindow, objectName='buttonTest')) |
32 | | - QMetaObject.connectSlotsByName(FormMainWindow) |
33 | | - |
34 | | - |
35 | | -class FrameWindow(QWidget): |
36 | | - |
37 | | - def __init__(self, *args, **kwargs): |
38 | | - super(FrameWindow, self).__init__(*args, **kwargs) |
39 | | - |
40 | | - |
41 | | -class WindowBase: |
42 | | - |
43 | | - @pyqtSlot() |
44 | | - def on_buttonTest_clicked(self): |
45 | | - print('clicked') |
46 | | - |
47 | | - |
48 | | -class Window(FrameWindow, WindowBase, Ui_FormMainWindow): |
49 | | - |
50 | | - def __init__(self, *args, **kwargs): |
51 | | - super(Window, self).__init__(*args, **kwargs) |
52 | | - self.setupUi(self) |
53 | | - |
54 | | - |
55 | | -if __name__ == '__main__': |
56 | | - app = QApplication(sys.argv) |
57 | | - w = Window() |
58 | | - w.show() |
59 | | - sys.exit(app.exec_()) |
| 1 | +#!/usr/bin/env python |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | + |
| 4 | +""" |
| 5 | +Created on 2019年1月5日 |
| 6 | +@author: Irony |
| 7 | +@site: https://pyqt5.com https://github.com/892768447 |
| 8 | +@email: 892768447@qq.com |
| 9 | +@file: Test.tSlotsByName |
| 10 | +@description: |
| 11 | +""" |
| 12 | +import sys |
| 13 | + |
| 14 | +from PyQt5.QtCore import QMetaObject, pyqtSlot |
| 15 | +from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout |
| 16 | + |
| 17 | +from Widgets.Buttons.RotateButton import RotateButton |
| 18 | + |
| 19 | + |
| 20 | +__Author__ = """By: Irony |
| 21 | +QQ: 892768447 |
| 22 | +Email: 892768447@qq.com""" |
| 23 | +__Copyright__ = "Copyright (c) 2019 Irony" |
| 24 | +__Version__ = "Version 1.0" |
| 25 | + |
| 26 | + |
| 27 | +class Ui_FormMainWindow(object): |
| 28 | + |
| 29 | + def setupUi(self, FormMainWindow): |
| 30 | + layout = QVBoxLayout(FormMainWindow) |
| 31 | + layout.addWidget(RotateButton('test', FormMainWindow, objectName='buttonTest')) |
| 32 | + QMetaObject.connectSlotsByName(FormMainWindow) |
| 33 | + |
| 34 | + |
| 35 | +class FrameWindow(QWidget): |
| 36 | + |
| 37 | + def __init__(self, *args, **kwargs): |
| 38 | + super(FrameWindow, self).__init__(*args, **kwargs) |
| 39 | + |
| 40 | + |
| 41 | +class WindowBase: |
| 42 | + |
| 43 | + @pyqtSlot() |
| 44 | + def on_buttonTest_clicked(self): |
| 45 | + print('clicked') |
| 46 | + |
| 47 | + |
| 48 | +class Window(FrameWindow, WindowBase, Ui_FormMainWindow): |
| 49 | + |
| 50 | + def __init__(self, *args, **kwargs): |
| 51 | + super(Window, self).__init__(*args, **kwargs) |
| 52 | + self.setupUi(self) |
| 53 | + |
| 54 | + |
| 55 | +if __name__ == '__main__': |
| 56 | + app = QApplication(sys.argv) |
| 57 | + w = Window() |
| 58 | + w.show() |
| 59 | + sys.exit(app.exec_()) |
0 commit comments