support PySide2
This commit is contained in:
parent
e397db884f
commit
48ef9a5b88
220 changed files with 2457 additions and 2542 deletions
|
@ -1,21 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年3月31日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: AutoRestart
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
|
||||
try:
|
||||
from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QHBoxLayout
|
||||
|
||||
except ImportError:
|
||||
from PySide2.QtWidgets import QApplication, QPushButton, QWidget, QHBoxLayout
|
||||
|
||||
canRestart = True
|
||||
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2018年1月27日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: BubbleTips
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QRectF, Qt, QPropertyAnimation, pyqtProperty, \
|
||||
QPoint, QParallelAnimationGroup, QEasingCurve
|
||||
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QPen
|
||||
from PyQt5.QtWidgets import QLabel, QWidget, QVBoxLayout, QApplication, \
|
||||
QLineEdit, QPushButton
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QRectF, Qt, QPropertyAnimation, Property as pyqtProperty, \
|
||||
QPoint, QParallelAnimationGroup, QEasingCurve
|
||||
from PySide2.QtGui import QPainter, QPainterPath, QColor, QPen
|
||||
from PySide2.QtWidgets import QLabel, QWidget, QVBoxLayout, QApplication, \
|
||||
QLineEdit, QPushButton
|
||||
|
||||
|
||||
class BubbleLabel(QWidget):
|
||||
|
||||
BackgroundColor = QColor(195, 195, 195)
|
||||
BorderColor = QColor(150, 150, 150)
|
||||
|
||||
|
@ -133,10 +134,10 @@ class BubbleLabel(QWidget):
|
|||
opacity = pyqtProperty(float, windowOpacity, setWindowOpacity)
|
||||
|
||||
|
||||
class TestWidget(QWidget):
|
||||
class Window(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(TestWidget, self).__init__(*args, **kwargs)
|
||||
super(Window, self).__init__(*args, **kwargs)
|
||||
layout = QVBoxLayout(self)
|
||||
self.msgEdit = QLineEdit(self, returnPressed=self.onMsgShow)
|
||||
self.msgButton = QPushButton("显示内容", self, clicked=self.onMsgShow)
|
||||
|
@ -158,6 +159,6 @@ class TestWidget(QWidget):
|
|||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
w = TestWidget()
|
||||
w = Window()
|
||||
w.show()
|
||||
sys.exit(app.exec_())
|
||||
|
|
|
@ -4,20 +4,19 @@
|
|||
"""
|
||||
Created on 2019年5月22日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: Demo.CallVirtualKeyboard
|
||||
@description: 调用系统虚拟键盘
|
||||
"""
|
||||
import glob
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QProcess, QSysInfo
|
||||
from PyQt5.QtWidgets import QWidget, QTextEdit, QVBoxLayout, QPushButton
|
||||
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
||||
__Version__ = 1.0
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QTextEdit, QVBoxLayout, QPushButton
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QProcess, QSysInfo
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QTextEdit, QVBoxLayout, QPushButton
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
@ -62,7 +61,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
Created on 2019年3月19日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: CircleLine
|
||||
@description:
|
||||
|
@ -14,13 +14,14 @@ from math import floor, pi, cos, sin
|
|||
from random import random, randint
|
||||
from time import time
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer, Qt
|
||||
from PyQt5.QtGui import QColor, QPainter, QPainterPath, QPen
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2019'
|
||||
from PyQt5.QtWidgets import QWidget, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer, Qt
|
||||
from PySide2.QtGui import QColor, QPainter, QPainterPath, QPen
|
||||
from PySide2.QtWidgets import QWidget, QApplication
|
||||
|
||||
# 最小和最大半径、半径阈值和填充圆的百分比
|
||||
radMin = 10
|
||||
|
@ -60,18 +61,21 @@ circleExpMin = 0.997
|
|||
circleExpSp = 0.00004
|
||||
circlePulse = False
|
||||
|
||||
|
||||
# 生成随机整数 a<=x<=b
|
||||
|
||||
|
||||
def randint(a, b):
|
||||
return floor(random() * (b - a + 1) + a)
|
||||
|
||||
|
||||
# 生成随机小数
|
||||
|
||||
|
||||
def randRange(a, b):
|
||||
return random() * (b - a) + a
|
||||
|
||||
|
||||
# 生成接近a的随机小数
|
||||
|
||||
|
||||
|
@ -255,7 +259,7 @@ class CircleLineWindow(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = CircleLineWindow()
|
||||
w.resize(800, 600)
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年4月12日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: 自定义属性测试
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
from random import randint
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal
|
||||
from PyQt5.QtWidgets import QPushButton
|
||||
|
||||
|
||||
__version__ = "0.0.1"
|
||||
from PyQt5.QtWidgets import QPushButton, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Property as pyqtProperty, Signal as pyqtSignal
|
||||
from PySide2.QtWidgets import QPushButton, QApplication
|
||||
|
||||
|
||||
class Window(QPushButton):
|
||||
|
||||
bgChanged = pyqtSignal(str, str)
|
||||
|
||||
def __init__(self):
|
||||
|
@ -56,7 +56,7 @@ class Window(QPushButton):
|
|||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.setStyleSheet(
|
||||
|
|
|
@ -4,22 +4,25 @@
|
|||
"""
|
||||
Created on 2018年3月1日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: EmbedWindow
|
||||
@description: 嵌入外部窗口
|
||||
"""
|
||||
|
||||
__Author__ = 'By: Irony\nQQ: 892768447\nEmail: 892768447@qq.com'
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
|
||||
import win32con
|
||||
import win32gui
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QWindow
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListWidget, \
|
||||
QLabel
|
||||
QLabel, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtGui import QWindow
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListWidget, \
|
||||
QLabel, QApplication
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
@ -113,8 +116,7 @@ if __name__ == '__main__':
|
|||
import sys
|
||||
import cgitb
|
||||
|
||||
cgitb.enable(format='txt')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
cgitb.enable(format='text')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
|
|
|
@ -1,31 +1,33 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2018年1月29日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: FacePoints
|
||||
@description: 人脸特征点
|
||||
'''
|
||||
from bz2 import BZ2Decompressor
|
||||
"""
|
||||
import cgitb
|
||||
import os
|
||||
import sys
|
||||
from bz2 import BZ2Decompressor
|
||||
|
||||
from PyQt5.QtCore import QTimer, QUrl, QFile, QIODevice
|
||||
from PyQt5.QtGui import QImage, QPixmap
|
||||
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
|
||||
from PyQt5.QtWidgets import QLabel, QMessageBox, QApplication
|
||||
import cv2 # @UnresolvedImport
|
||||
import dlib
|
||||
import numpy
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer, QUrl, QFile, QIODevice
|
||||
from PyQt5.QtGui import QImage, QPixmap
|
||||
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
|
||||
from PyQt5.QtWidgets import QLabel, QMessageBox, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer, QUrl, QFile, QIODevice
|
||||
from PySide2.QtGui import QImage, QPixmap
|
||||
from PySide2.QtNetwork import QNetworkAccessManager, QNetworkRequest
|
||||
from PySide2.QtWidgets import QLabel, QMessageBox, QApplication
|
||||
|
||||
DOWNSCALE = 4
|
||||
URL = 'http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2'
|
||||
|
@ -163,7 +165,7 @@ class OpencvWidget(QLabel):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cgitb.enable(1, None, 5, '')
|
||||
cgitb.enable(format='text')
|
||||
app = QApplication(sys.argv)
|
||||
w = OpencvWidget()
|
||||
w.show()
|
||||
|
|
|
@ -4,23 +4,21 @@
|
|||
"""
|
||||
Created on 2018年10月22日
|
||||
@author: Irony
|
||||
@site: https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: FollowWindow
|
||||
@description: 跟随外部窗口
|
||||
"""
|
||||
import os
|
||||
|
||||
from PyQt5.QtCore import QTimer
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
||||
import win32gui
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
@ -53,7 +51,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
# 先检测是否已有记事本打开
|
||||
hwnd = win32gui.FindWindow('Notepad', None)
|
||||
print('hwnd', hwnd)
|
||||
|
|
|
@ -4,20 +4,22 @@
|
|||
"""
|
||||
Created on 2019年4月19日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: FramelessDialog
|
||||
@description: 无边框圆角对话框
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, QSize, QTimer
|
||||
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget, \
|
||||
QGraphicsDropShadowEffect, QPushButton, QGridLayout, QSpacerItem, \
|
||||
QSizePolicy
|
||||
|
||||
|
||||
__Author__ = "Irony"
|
||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
||||
__Version__ = 1.0
|
||||
QSizePolicy, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, QSize, QTimer
|
||||
from PySide2.QtWidgets import QDialog, QVBoxLayout, QWidget, \
|
||||
QGraphicsDropShadowEffect, QPushButton, QGridLayout, QSpacerItem, \
|
||||
QSizePolicy, QApplication
|
||||
|
||||
Stylesheet = """
|
||||
#Custom_Widget {
|
||||
|
@ -77,7 +79,7 @@ class Dialog(QDialog):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Dialog()
|
||||
w.exec_()
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
"""
|
||||
Created on 2018年4月30日
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: Test
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QTextEdit
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QTextEdit, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtGui import QIcon
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QTextEdit, QApplication
|
||||
|
||||
from Lib.FramelessWindow import FramelessWindow # @UnresolvedImport
|
||||
|
||||
|
||||
# Created on 2018年4月30日
|
||||
# author: Irony
|
||||
# site: https://pyqt5.com , https://github.com/892768447
|
||||
# email: 892768447@qq.com
|
||||
# file: Test
|
||||
# description:
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
|
||||
|
||||
class MainWindow(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -63,7 +65,7 @@ TitleBar {
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setStyleSheet(StyleSheet)
|
||||
w = FramelessWindow()
|
||||
|
|
|
@ -4,21 +4,20 @@
|
|||
"""
|
||||
Created on 2020年3月13日
|
||||
@author: Irony
|
||||
@site: https://pyqt.site https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: Demo.GifCursor
|
||||
@description:
|
||||
"""
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
||||
|
||||
try:
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
|
||||
|
||||
from Lib.QCursorGif import QCursorGif
|
||||
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2020'
|
||||
__Version__ = 1.0
|
||||
|
||||
|
||||
class Window(QWidget, QCursorGif):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -38,8 +37,9 @@ class Window(QWidget, QCursorGif):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
import cgitb
|
||||
cgitb.enable(1, None, 5, '')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
cgitb.enable(format='text')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
Created on 2019年2月24日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: IsSignalConnected
|
||||
@description: 判断信号是否连接
|
||||
|
@ -13,13 +13,6 @@ Created on 2019年2月24日
|
|||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QTextBrowser
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
||||
__Version__ = 1.0
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -37,8 +30,10 @@ class Window(QWidget):
|
|||
# button1 clicked 是否连接: %s, %s
|
||||
# button2 clicked 是否连接: %s, %s
|
||||
""" % (
|
||||
self.isSignalConnected(self.button1, 'clicked()'), self.button1.receivers(self.button1.clicked) > 0,
|
||||
self.isSignalConnected(self.button2, 'clicked()'), self.button2.receivers(self.button2.clicked) > 0,
|
||||
self.isSignalConnected(self.button1, 'clicked()'),
|
||||
self.button1.receivers(self.button1.clicked) > 0,
|
||||
self.isSignalConnected(self.button2, 'clicked()'),
|
||||
self.button2.receivers(self.button2.clicked) > 0,
|
||||
))
|
||||
|
||||
def isSignalConnected(self, obj, name):
|
||||
|
@ -57,6 +52,7 @@ class Window(QWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -1,27 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: 单实例应用.Application
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
|
||||
from PyQt5.QtCore import QSharedMemory, pyqtSignal, Qt
|
||||
from PyQt5.QtNetwork import QLocalSocket, QLocalServer
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
|
||||
__version__ = "0.0.1"
|
||||
|
||||
class SharedApplication(QApplication):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SharedApplication, self).__init__(*args, **kwargs)
|
||||
self._running = False
|
||||
key = "SharedApplication" + __version__
|
||||
key = "SharedApplication"
|
||||
self._memory = QSharedMemory(key, self)
|
||||
|
||||
isAttached = self._memory.isAttached()
|
||||
|
@ -41,8 +40,8 @@ class SharedApplication(QApplication):
|
|||
def isRunning(self):
|
||||
return self._running
|
||||
|
||||
class QSingleApplication(QApplication):
|
||||
|
||||
class QSingleApplication(QApplication):
|
||||
messageReceived = pyqtSignal(str)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -1,26 +1,29 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
"""
|
||||
Created on 2018年4月30日
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: FramelessWindow
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, QPoint
|
||||
from PyQt5.QtGui import QFont, QEnterEvent, QPainter, QColor, QPen
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, \
|
||||
QSpacerItem, QSizePolicy, QPushButton
|
||||
|
||||
|
||||
# Created on 2018年4月30日
|
||||
# author: Irony
|
||||
# site: https://pyqt5.com , https://github.com/892768447
|
||||
# email: 892768447@qq.com
|
||||
# file: FramelessWindow
|
||||
# description:
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, Signal as pyqtSignal, QPoint
|
||||
from PySide2.QtGui import QFont, QEnterEvent, QPainter, QColor, QPen
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, \
|
||||
QSpacerItem, QSizePolicy, QPushButton
|
||||
|
||||
|
||||
class TitleBar(QWidget):
|
||||
|
||||
# 窗口最小化信号
|
||||
windowMinimumed = pyqtSignal()
|
||||
# 窗口最大化信号
|
||||
|
@ -138,7 +141,6 @@ Left, Top, Right, Bottom, LeftTop, RightTop, LeftBottom, RightBottom = range(8)
|
|||
|
||||
|
||||
class FramelessWindow(QWidget):
|
||||
|
||||
# 四周边距
|
||||
Margins = 5
|
||||
|
||||
|
|
|
@ -4,19 +4,20 @@
|
|||
"""
|
||||
Created on 2020年3月13日
|
||||
@author: Irony
|
||||
@site: https://pyqt.site https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: Demo.Lib.QCursorGif
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer, Qt
|
||||
from PyQt5.QtGui import QCursor, QPixmap
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2020'
|
||||
__Version__ = 1.0
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer, Qt
|
||||
from PySide2.QtGui import QCursor, QPixmap
|
||||
from PySide2.QtWidgets import QApplication
|
||||
|
||||
|
||||
class QCursorGif:
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
try:
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
except ImportError:
|
||||
from PySide2 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_NotifyForm(object):
|
||||
def setupUi(self, NotifyForm):
|
||||
|
@ -61,7 +65,8 @@ class Ui_NotifyForm(object):
|
|||
self.labelTitle.setText("")
|
||||
self.labelTitle.setObjectName("labelTitle")
|
||||
self.horizontalLayout_3.addWidget(self.labelTitle)
|
||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding,
|
||||
QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_3.addItem(spacerItem)
|
||||
self.buttonClose = QtWidgets.QPushButton(self.widgetTitle)
|
||||
self.buttonClose.setMinimumSize(QtCore.QSize(26, 26))
|
||||
|
@ -80,7 +85,8 @@ class Ui_NotifyForm(object):
|
|||
self.horizontalLayout.setContentsMargins(0, 5, 5, 5)
|
||||
self.horizontalLayout.setSpacing(0)
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
spacerItem1 = QtWidgets.QSpacerItem(170, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(170, 20, QtWidgets.QSizePolicy.Expanding,
|
||||
QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem1)
|
||||
self.buttonView = QtWidgets.QPushButton(self.widgetBottom)
|
||||
self.buttonView.setMinimumSize(QtCore.QSize(75, 25))
|
||||
|
@ -102,10 +108,10 @@ class Ui_NotifyForm(object):
|
|||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
NotifyForm = QtWidgets.QWidget()
|
||||
ui = Ui_NotifyForm()
|
||||
ui.setupUi(NotifyForm)
|
||||
NotifyForm.show()
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
try:
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
except ImportError:
|
||||
from PySide2 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_FormFrameless(object):
|
||||
|
@ -28,7 +31,8 @@ class Ui_FormFrameless(object):
|
|||
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalLayout.setSpacing(0)
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
spacerItem = QtWidgets.QSpacerItem(253, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
spacerItem = QtWidgets.QSpacerItem(253, 20, QtWidgets.QSizePolicy.Expanding,
|
||||
QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.buttonMinimum = QtWidgets.QPushButton(self.widgetTitleBar)
|
||||
self.buttonMinimum.setMinimumSize(QtCore.QSize(36, 36))
|
||||
|
@ -83,7 +87,8 @@ class Ui_FormFrameless(object):
|
|||
self.buttonNormal.setText(_translate("FormFrameless", "2"))
|
||||
self.buttonClose.setToolTip(_translate("FormFrameless", "Close"))
|
||||
self.buttonClose.setText(_translate("FormFrameless", "r"))
|
||||
self.textEdit.setHtml(_translate("FormFrameless", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
self.textEdit.setHtml(_translate("FormFrameless",
|
||||
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
|
@ -92,6 +97,7 @@ class Ui_FormFrameless(object):
|
|||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
FormFrameless = QtWidgets.QWidget()
|
||||
ui = Ui_FormFrameless()
|
||||
|
|
|
@ -2,28 +2,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Created on 2018年8月2日
|
||||
author: Irony
|
||||
site: https://pyqt5.com , https://github.com/892768447
|
||||
site: https://pyqt.site , https://github.com/PyQt5
|
||||
email: 892768447@qq.com
|
||||
file: win无边框调整大小
|
||||
description:
|
||||
"""
|
||||
|
||||
from ctypes.wintypes import POINT
|
||||
import ctypes.wintypes
|
||||
from ctypes.wintypes import POINT
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QWidget, QPushButton
|
||||
from PyQt5.QtWinExtras import QtWin
|
||||
import win32api
|
||||
import win32con
|
||||
import win32gui
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QWidget, QPushButton, QApplication
|
||||
from PyQt5.QtWinExtras import QtWin
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtWidgets import QWidget, QPushButton, QApplication
|
||||
from PySide2.QtWinExtras import QtWin
|
||||
|
||||
|
||||
class MINMAXINFO(ctypes.Structure):
|
||||
|
@ -37,7 +36,6 @@ class MINMAXINFO(ctypes.Structure):
|
|||
|
||||
|
||||
class Window(QWidget):
|
||||
|
||||
BorderWidth = 5
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -121,7 +119,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
btn = QPushButton('exit', w, clicked=app.quit)
|
||||
|
|
|
@ -10,10 +10,16 @@ Created on 2018年4月30日
|
|||
@description:
|
||||
"""
|
||||
|
||||
from Lib.ui_frameless import Ui_FormFrameless
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer, Qt, QEvent, QObject
|
||||
from PyQt5.QtGui import QWindow, QPainter, QColor, QMouseEvent
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer, Qt, QEvent, QObject
|
||||
from PySide2.QtGui import QWindow, QPainter, QColor, QMouseEvent
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QMessageBox
|
||||
|
||||
from Lib.ui_frameless import Ui_FormFrameless
|
||||
|
||||
|
||||
class FramelessObject(QObject):
|
||||
|
|
|
@ -4,30 +4,30 @@
|
|||
"""
|
||||
Created on 2018年9月9日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: Notification
|
||||
@description:
|
||||
"""
|
||||
import base64
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, QRectF, QSize, pyqtSignal, QTimer
|
||||
from PyQt5.QtGui import QPixmap, QImage, QPainter, QPainterPath, \
|
||||
QColor
|
||||
from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, \
|
||||
QGridLayout, QSpacerItem, QSizePolicy, QGraphicsDropShadowEffect, \
|
||||
QListWidget, QListWidgetItem
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
QListWidget, QListWidgetItem, QApplication, QPushButton
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, QRectF, QSize, Signal as pyqtSignal, QTimer
|
||||
from PySide2.QtGui import QPixmap, QImage, QPainter, QPainterPath, \
|
||||
QColor
|
||||
from PySide2.QtWidgets import QWidget, QLabel, QHBoxLayout, \
|
||||
QGridLayout, QSpacerItem, QSizePolicy, QGraphicsDropShadowEffect, \
|
||||
QListWidget, QListWidgetItem, QApplication, QPushButton
|
||||
|
||||
|
||||
class NotificationIcon:
|
||||
|
||||
Info, Success, Warning, Error, Close = range(5)
|
||||
Types = {
|
||||
Info: None,
|
||||
|
@ -39,10 +39,14 @@ class NotificationIcon:
|
|||
|
||||
@classmethod
|
||||
def init(cls):
|
||||
cls.Types[cls.Info] = QPixmap(QImage.fromData(base64.b64decode('iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAC5ElEQVRYR8VX0VHbQBB9e/bkN3QQU0FMBSEVYFcQ8xPBJLJ1FWAqOMcaxogfTAWQCiAVRKkgTgfmM4zRZu6QhGzL0p0nDPr17e7bt7tv14RX/uiV48MJgAon+8TiAMRtMFogaqUJxADPwRRzg67kl8+xbWJWANR40iPQSSFgtX/mGQkaDr56V3VAKgGos4s2JXwJoF3naMPvMS+SrpTHs032GwGkdF+DsFMVnJm/oyGGeHico0EjIjpYes+YMyVd6R/flfkpBWCCQ9zaZM2LZDfLMGXsZ5kdI/lYBmINgHHyyLd1mWdBbAFAM/GY7K2WYx1AeB4T6L1N9umbGxZ0qktATaEAdCps48D39oq/LwEw3U5CN92LfczJoewfT7MAywDCaEbAuxeLrh0zz4L+0e4aAJfGy+sP3IMxlH1vpMJoSMCJDXgWtJeJVc6ACs9HBBrYODCJAFdYvAmkPJxnNqMwYht7Bn+T/lGg3z4DGEd3RPhQ54DBvwAOVkeqagRXfTLjh+x7+8sALOtfHLuiYzWOAiLoKbD58mnIGbCmLxUepS6NQmYlUGE0JeCTTXT9JvA9E9sZgO5iIpoyc6/YzcqSwQzgGgBXB7oXpH9klpRSkxY1xW/b7Iu2zk34PILPnazCqEPAtTWA8iZ0HsOu9L0bw4DzCJeNocMGNDpQ3IKO+6NUiJ4ysZNiBv5I3zPnmJmG5oM+wbS+9+qkvGi7NAXGmeUy0ioofa+XA0jH0UaMKpdRWs/adcwMqfV/tenqpqHY/Znt+j2gJi00RUzA201dXaxh9iZdZloJS+9H1otrkbRrD5InFqpPskxEshJQ468CkSmJC+i1HigaaxCAuCljgoDhwPdOjf7rFVxxuJrMkXScjtKc1rOLNpJk6nii5XmYzbngzlZn+RIb40kPJPTBYXUt6VEDJ8Pi6bWpNFb/jFYY6YGpDeKdjBmTKdMcxDGEmP73v2a2Gr/NOycGtglQZ/MPzEqCMLGckJEAAAAASUVORK5CYII=')))
|
||||
cls.Types[cls.Success] = QPixmap(QImage.fromData(base64.b64decode('iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACZUlEQVRYR8VXS3LTQBDtVsDbcAPMCbB3limkcAKSG4QFdnaYE2BOQLKzxSLJCeAGSUQheSnfwLmB2VJhXmpExpFHI2sk2RWv5FJPv9evP9NieuIfPzE+VSJw8qt3IMDvmahDoDYxt2UAACXMWIIowR5ffn8TJbaBWRE4CXvHAH9RgKXOgQUI48CfXZbZbiTw8Xe/w3d0zkydMkem91IZpyWOJu5sUXS+kEAqt3B+MNOLOuDqDEBLxxFHk7eza5MfIwEJDjhXTYD1s8zinYlEjsCD7FdNI9cJpEq0RFdPR47AMOzLCn69zegz6UgCP+pmfa8RSKudnPNdgCufTOLDxJtdPP7PoA1Cd8HEL5sSUCCD0B0x8bc1f8Bi6sevcgS2VXh6hMOwDz0gsUddNaxWKRjeuKfE/KlJ9Dq4UYH/o/Ns6scj+bgiMAjdayb26xLQwTfVEwg3gRcf6ARq578KuLo7VDc8psCQqwfjr4EfjYvkrAquFJ56UYpdSkAZSmNd1rrg0leOQFELgvA58OJTxVyRaAJORPOpF6UXnFUR5sDiXjs7UqsOMGMRlrWhTkJXpFL3mNrQZhA1lH3F0TiI5FurUQyMpn58VjhkSqQA4Tbw4nSVW6sBU5VXktXSeONlJH3s8jrOVr9RgVSFuNcWfzlh5n3LoKzMAPxxWuiULiQpiR2sZNnCyzIuWUr5Z1Ml0sgdHFZaShVDuR86/0huL3VXtDk/F4e11vKsTHLSCeKx7bYkW80hjLOrV1GhWH0ZrSlyh2MwdZhYfi8oZeYgLBmUiGd8sfVPM6syr2lUSYGaGBuP3QN6rVUwYV/egwAAAABJRU5ErkJggg==')))
|
||||
cls.Types[cls.Warning] = QPixmap(QImage.fromData(base64.b64decode('iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACmElEQVRYR8VXTW7TUBD+xjYSXZFukOIsSE9AskNJJMoJmq4r7OYEwAkabhBOkB/Emt4gVIojdpgbpIumEitX6gKB7UHPkauXxLHfc4F6Z3l+vvnmm/fGhAd+6IHzQwvA9cfOITMfAdQAcx1EdVEAM/tEFADsWyaPn57MfdXClABcT1qnzHSWJiwMzrwgoF91vXGRbS6AH59ajd8hDYmoURQo67tgxoij42rv62KX/04Agu44xmciVMokT32YERgGjquvZ1+y4mQCWPUa0/sk3vQlwqssEFsAVrQbU4XKL/ai2+5PPK6waQ4AOsoDnDARh83NdmwBuJq0fQI9L6p+L7rd3+/5gbAToMPI+FbkIzRRc72mbLcGIFE7jGFRIPHddmZrvstJh1X8CHGv6sxHqe1GkPYCoGcqgcoCAPPCdr2DLQC6wqMoPEj7qdqCNKllxs30sLpjYDluDUDGG5XqhY2sal3w4PiD7c7fJnHShMtJR8zpy/8CALiwndnhBgD1/t+XAXkaZAaUVHwnHulg0W6BNEWlAQD8zna8gQB0Ne70iXCm2j55jCUAei1gxvuaO+uXAcDg7zXHSy640iKUAehOEDJFqDmGQkiPLO5Fv+KADXOqvCuIsrPGsIyQdHou22YeRMJgOdHTQTkAfGk7XrLKrWlAvOhcRgBfWiZ3RQti0zxXuUFXCXMuo0TRitfxugjbIxC5RYzI6s9kIGFh+KLOpiW22id5AUuI8IaisFG4kCQg/sFKJgtPLix3KWXGeRETRbQDuCFCV2spTYMm+2FEI1WBbYIRPTeiqFtqLZeDraaD+qrbkpgQAvfl1WsXU0p/RjIjYYhTkNFgcCVlRlRKoAAc+5aF0V//NVPoc2kTLQZKZ8lx/AMXBmMwuXUwOAAAAABJRU5ErkJggg==')))
|
||||
cls.Types[cls.Error] = QPixmap(QImage.fromData(base64.b64decode('iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACrklEQVRYR82XW27aQBSG/4PtiNhIpStouoImKwjZAV1B07coWCpZQcgK6kh2lLeSFZSsIOwgdAdkBaUSEBQDpxpjU9vM+EJR03nDzJz/mzm3GcIrD3plfZQCeD47O1ho2jERNRmoE9AQG2BgBGBAwIiZe5Zh3JPjiG+5oxCAEF5q2iWITnMtRhOYu5XF4mr/9naYtSYXYGLbHQCXhYVTEwlom657rVqvBOB2uz71/a+ldq1SYe6ahnEhc4sSYGzbfQKOt915eh0D/ZrrnqS/SwEmrVYXRJ92Jb4OC+C65rrtuN0NgIltNwF837V4zN5Hy3V70e9NgFZrCKJ3CQDmJ9MwDsW36XzeB/AhA/CHqeuN2WxWX2paX2JraHneeynA+Pz8lCqVbxLjV5brimxAEJxqiEA8CjZVBvFy+bl2c9MV9hInoAw85qFpGEeRYQVEQjzMokcQHWxsiPne8jzh6j8AodGfyqNlHpiGcaKAkIk/gChwm2yYuv5W2FqfwLNtN5bAQ2bwySB83zENo50A8/1McaFRAU72XVek+mpk+D/JlIKI/xkee654uCbIhjVAqZIrgSgpLhiCwN4OAEj4vEB2yDybBCjsAol4ZD0nRdMQSRcUCsKUeNSw4o2mKMRGEOamoVx8FXDZKVosDYNMUHXAsBRnppo8RQcbpTgIGEkhykpFjnWxzGhPQYxt2yHgS/oIlKVYTJxImpG482nz+VG1Wh1N84pMCCGa0ULXHwmoJwCYnyzPW5fn/68dh7EgPbrMMl3gz7gro+n/7EoWD7w4a96l1NnJ1Yz5Lt6wCgFEk0r1CIkbiPnC9DxH5aHcd4FYGD5MOqVOg/muslh0/vphkm63k5eXZvA0I6qD+ZCI3jDzLxANiHn1NNvb6+30aVYgwLeeUsgFW1svsPA3Ncq4MHzVeO8AAAAASUVORK5CYII=')))
|
||||
cls.Types[cls.Info] = QPixmap(QImage.fromData(base64.b64decode(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAC5ElEQVRYR8VX0VHbQBB9e/bkN3QQU0FMBSEVYFcQ8xPBJLJ1FWAqOMcaxogfTAWQCiAVRKkgTgfmM4zRZu6QhGzL0p0nDPr17e7bt7tv14RX/uiV48MJgAon+8TiAMRtMFogaqUJxADPwRRzg67kl8+xbWJWANR40iPQSSFgtX/mGQkaDr56V3VAKgGos4s2JXwJoF3naMPvMS+SrpTHs032GwGkdF+DsFMVnJm/oyGGeHico0EjIjpYes+YMyVd6R/flfkpBWCCQ9zaZM2LZDfLMGXsZ5kdI/lYBmINgHHyyLd1mWdBbAFAM/GY7K2WYx1AeB4T6L1N9umbGxZ0qktATaEAdCps48D39oq/LwEw3U5CN92LfczJoewfT7MAywDCaEbAuxeLrh0zz4L+0e4aAJfGy+sP3IMxlH1vpMJoSMCJDXgWtJeJVc6ACs9HBBrYODCJAFdYvAmkPJxnNqMwYht7Bn+T/lGg3z4DGEd3RPhQ54DBvwAOVkeqagRXfTLjh+x7+8sALOtfHLuiYzWOAiLoKbD58mnIGbCmLxUepS6NQmYlUGE0JeCTTXT9JvA9E9sZgO5iIpoyc6/YzcqSwQzgGgBXB7oXpH9klpRSkxY1xW/b7Iu2zk34PILPnazCqEPAtTWA8iZ0HsOu9L0bw4DzCJeNocMGNDpQ3IKO+6NUiJ4ysZNiBv5I3zPnmJmG5oM+wbS+9+qkvGi7NAXGmeUy0ioofa+XA0jH0UaMKpdRWs/adcwMqfV/tenqpqHY/Znt+j2gJi00RUzA201dXaxh9iZdZloJS+9H1otrkbRrD5InFqpPskxEshJQ468CkSmJC+i1HigaaxCAuCljgoDhwPdOjf7rFVxxuJrMkXScjtKc1rOLNpJk6nii5XmYzbngzlZn+RIb40kPJPTBYXUt6VEDJ8Pi6bWpNFb/jFYY6YGpDeKdjBmTKdMcxDGEmP73v2a2Gr/NOycGtglQZ/MPzEqCMLGckJEAAAAASUVORK5CYII=')))
|
||||
cls.Types[cls.Success] = QPixmap(QImage.fromData(base64.b64decode(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACZUlEQVRYR8VXS3LTQBDtVsDbcAPMCbB3limkcAKSG4QFdnaYE2BOQLKzxSLJCeAGSUQheSnfwLmB2VJhXmpExpFHI2sk2RWv5FJPv9evP9NieuIfPzE+VSJw8qt3IMDvmahDoDYxt2UAACXMWIIowR5ffn8TJbaBWRE4CXvHAH9RgKXOgQUI48CfXZbZbiTw8Xe/w3d0zkydMkem91IZpyWOJu5sUXS+kEAqt3B+MNOLOuDqDEBLxxFHk7eza5MfIwEJDjhXTYD1s8zinYlEjsCD7FdNI9cJpEq0RFdPR47AMOzLCn69zegz6UgCP+pmfa8RSKudnPNdgCufTOLDxJtdPP7PoA1Cd8HEL5sSUCCD0B0x8bc1f8Bi6sevcgS2VXh6hMOwDz0gsUddNaxWKRjeuKfE/KlJ9Dq4UYH/o/Ns6scj+bgiMAjdayb26xLQwTfVEwg3gRcf6ARq578KuLo7VDc8psCQqwfjr4EfjYvkrAquFJ56UYpdSkAZSmNd1rrg0leOQFELgvA58OJTxVyRaAJORPOpF6UXnFUR5sDiXjs7UqsOMGMRlrWhTkJXpFL3mNrQZhA1lH3F0TiI5FurUQyMpn58VjhkSqQA4Tbw4nSVW6sBU5VXktXSeONlJH3s8jrOVr9RgVSFuNcWfzlh5n3LoKzMAPxxWuiULiQpiR2sZNnCyzIuWUr5Z1Ml0sgdHFZaShVDuR86/0huL3VXtDk/F4e11vKsTHLSCeKx7bYkW80hjLOrV1GhWH0ZrSlyh2MwdZhYfi8oZeYgLBmUiGd8sfVPM6syr2lUSYGaGBuP3QN6rVUwYV/egwAAAABJRU5ErkJggg==')))
|
||||
cls.Types[cls.Warning] = QPixmap(QImage.fromData(base64.b64decode(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACmElEQVRYR8VXTW7TUBD+xjYSXZFukOIsSE9AskNJJMoJmq4r7OYEwAkabhBOkB/Emt4gVIojdpgbpIumEitX6gKB7UHPkauXxLHfc4F6Z3l+vvnmm/fGhAd+6IHzQwvA9cfOITMfAdQAcx1EdVEAM/tEFADsWyaPn57MfdXClABcT1qnzHSWJiwMzrwgoF91vXGRbS6AH59ajd8hDYmoURQo67tgxoij42rv62KX/04Agu44xmciVMokT32YERgGjquvZ1+y4mQCWPUa0/sk3vQlwqssEFsAVrQbU4XKL/ai2+5PPK6waQ4AOsoDnDARh83NdmwBuJq0fQI9L6p+L7rd3+/5gbAToMPI+FbkIzRRc72mbLcGIFE7jGFRIPHddmZrvstJh1X8CHGv6sxHqe1GkPYCoGcqgcoCAPPCdr2DLQC6wqMoPEj7qdqCNKllxs30sLpjYDluDUDGG5XqhY2sal3w4PiD7c7fJnHShMtJR8zpy/8CALiwndnhBgD1/t+XAXkaZAaUVHwnHulg0W6BNEWlAQD8zna8gQB0Ne70iXCm2j55jCUAei1gxvuaO+uXAcDg7zXHSy640iKUAehOEDJFqDmGQkiPLO5Fv+KADXOqvCuIsrPGsIyQdHou22YeRMJgOdHTQTkAfGk7XrLKrWlAvOhcRgBfWiZ3RQti0zxXuUFXCXMuo0TRitfxugjbIxC5RYzI6s9kIGFh+KLOpiW22id5AUuI8IaisFG4kCQg/sFKJgtPLix3KWXGeRETRbQDuCFCV2spTYMm+2FEI1WBbYIRPTeiqFtqLZeDraaD+qrbkpgQAvfl1WsXU0p/RjIjYYhTkNFgcCVlRlRKoAAc+5aF0V//NVPoc2kTLQZKZ8lx/AMXBmMwuXUwOAAAAABJRU5ErkJggg==')))
|
||||
cls.Types[cls.Error] = QPixmap(QImage.fromData(base64.b64decode(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACrklEQVRYR82XW27aQBSG/4PtiNhIpStouoImKwjZAV1B07coWCpZQcgK6kh2lLeSFZSsIOwgdAdkBaUSEBQDpxpjU9vM+EJR03nDzJz/mzm3GcIrD3plfZQCeD47O1ho2jERNRmoE9AQG2BgBGBAwIiZe5Zh3JPjiG+5oxCAEF5q2iWITnMtRhOYu5XF4mr/9naYtSYXYGLbHQCXhYVTEwlom657rVqvBOB2uz71/a+ldq1SYe6ahnEhc4sSYGzbfQKOt915eh0D/ZrrnqS/SwEmrVYXRJ92Jb4OC+C65rrtuN0NgIltNwF837V4zN5Hy3V70e9NgFZrCKJ3CQDmJ9MwDsW36XzeB/AhA/CHqeuN2WxWX2paX2JraHneeynA+Pz8lCqVbxLjV5brimxAEJxqiEA8CjZVBvFy+bl2c9MV9hInoAw85qFpGEeRYQVEQjzMokcQHWxsiPne8jzh6j8AodGfyqNlHpiGcaKAkIk/gChwm2yYuv5W2FqfwLNtN5bAQ2bwySB83zENo50A8/1McaFRAU72XVek+mpk+D/JlIKI/xkee654uCbIhjVAqZIrgSgpLhiCwN4OAEj4vEB2yDybBCjsAol4ZD0nRdMQSRcUCsKUeNSw4o2mKMRGEOamoVx8FXDZKVosDYNMUHXAsBRnppo8RQcbpTgIGEkhykpFjnWxzGhPQYxt2yHgS/oIlKVYTJxImpG482nz+VG1Wh1N84pMCCGa0ULXHwmoJwCYnyzPW5fn/68dh7EgPbrMMl3gz7gro+n/7EoWD7w4a96l1NnJ1Yz5Lt6wCgFEk0r1CIkbiPnC9DxH5aHcd4FYGD5MOqVOg/muslh0/vphkm63k5eXZvA0I6qD+ZCI3jDzLxANiHn1NNvb6+30aVYgwLeeUsgFW1svsPA3Ncq4MHzVeO8AAAAASUVORK5CYII=')))
|
||||
cls.Types[cls.Close] = QPixmap(QImage.fromData(base64.b64decode(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAeElEQVQ4T2NkoBAwUqifgboGzJy76AIjE3NCWmL0BWwumzV/qcH/f38XpCfHGcDkUVwAUsDw9+8GBmbmAHRDcMlheAGbQnwGYw0DZA1gp+JwFUgKZyDCDQGpwuIlrGGAHHAUGUCRFygKRIqjkeKERE6+oG5eIMcFAOqSchGwiKKAAAAAAElFTkSuQmCC')))
|
||||
|
||||
|
@ -52,7 +56,6 @@ class NotificationIcon:
|
|||
|
||||
|
||||
class NotificationItem(QWidget):
|
||||
|
||||
closed = pyqtSignal(QListWidgetItem)
|
||||
|
||||
def __init__(self, title, message, item, *args, ntype=0, callback=None, **kwargs):
|
||||
|
@ -152,7 +155,6 @@ class NotificationItem(QWidget):
|
|||
|
||||
|
||||
class NotificationWindow(QListWidget):
|
||||
|
||||
_instance = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -243,15 +245,18 @@ class NotificationWindow(QListWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
import cgitb
|
||||
sys.excepthook = cgitb.Hook(1, None, 5, sys.stderr, 'text')
|
||||
from PyQt5.QtWidgets import QApplication, QPushButton
|
||||
|
||||
cgitb.enable(format='text')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = QWidget()
|
||||
layout = QHBoxLayout(w)
|
||||
|
||||
|
||||
def callback():
|
||||
print('回调点击')
|
||||
|
||||
|
||||
layout.addWidget(QPushButton(
|
||||
'Info', w, clicked=lambda: NotificationWindow.info('提示', '这是一条会自动关闭的消息', callback=callback)))
|
||||
layout.addWidget(QPushButton(
|
||||
|
|
|
@ -3,23 +3,22 @@
|
|||
"""
|
||||
Created on 2018年6月8日
|
||||
author: Irony
|
||||
site: https://pyqt5.com , https://github.com/892768447
|
||||
site: https://pyqt.site , https://github.com/PyQt5
|
||||
email: 892768447@qq.com
|
||||
file: ProbeWindow
|
||||
description: 简单探测窗口和放大截图
|
||||
"""
|
||||
|
||||
import win32gui
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, QRect
|
||||
from PyQt5.QtGui import QPainter, QPen, QCursor, QColor
|
||||
from PyQt5.QtWidgets import QLabel, QWidget, QApplication
|
||||
import win32gui
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, QRect
|
||||
from PySide2.QtGui import QPainter, QPen, QCursor, QColor
|
||||
from PySide2.QtWidgets import QLabel, QWidget, QApplication
|
||||
|
||||
|
||||
class FrameWidget(QWidget):
|
||||
|
@ -116,6 +115,7 @@ class Label(QLabel):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setQuitOnLastWindowClosed(True)
|
||||
w = Label()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
Created on 2019年3月8日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: Threading.QtThreading
|
||||
@description:
|
||||
|
@ -12,19 +12,15 @@ Created on 2019年3月8日
|
|||
from threading import Thread
|
||||
from time import sleep
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QObject, pyqtSignal, QTimer, Qt
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QProgressBar
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
||||
__Version__ = 1.0
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QProgressBar, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QObject, Signal as pyqtSignal, QTimer, Qt
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QProgressBar, QApplication
|
||||
|
||||
|
||||
class _Signals(QObject):
|
||||
|
||||
updateProgress = pyqtSignal(int)
|
||||
|
||||
|
||||
|
@ -63,7 +59,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2018年1月17日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: RestartWindow
|
||||
@description: 窗口重启
|
||||
'''
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import pyqtSignal
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit, \
|
||||
QMessageBox
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
QMessageBox, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Signal as pyqtSignal
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit, \
|
||||
QMessageBox, QApplication
|
||||
|
||||
|
||||
class RestartWindow(QWidget):
|
||||
|
||||
restarted = pyqtSignal(QWidget, str)
|
||||
_Self = None # 很重要,保留窗口引用
|
||||
|
||||
|
@ -55,7 +55,7 @@ class RestartWindow(QWidget):
|
|||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = RestartWindow("test")
|
||||
w.show()
|
||||
|
|
|
@ -4,15 +4,19 @@
|
|||
"""
|
||||
Created on 2021/4/13
|
||||
@author: Irony
|
||||
@site: https://github.com/PyQt5
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ScreenNotify
|
||||
@description: 屏幕、分辨率、DPI变化通知
|
||||
"""
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer, QRect
|
||||
from PyQt5.QtWidgets import QApplication, QPlainTextEdit, qApp
|
||||
from PyQt5.QtWidgets import QApplication, QPlainTextEdit
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer, QRect
|
||||
from PySide2.QtWidgets import QApplication, QPlainTextEdit
|
||||
|
||||
|
||||
class Window(QPlainTextEdit):
|
||||
|
@ -27,22 +31,24 @@ class Window(QPlainTextEdit):
|
|||
self.m_timer.setSingleShot(True) # **重要** 保证多次信号尽量少的调用函数
|
||||
|
||||
# 主要是多屏幕->无屏幕->有屏幕
|
||||
qApp.primaryScreenChanged.connect(lambda _: self.m_timer.start(1000))
|
||||
QApplication.instance().primaryScreenChanged.connect(lambda _: self.m_timer.start(1000))
|
||||
# 其它信号最终基本上都会调用该信号
|
||||
qApp.primaryScreen().virtualGeometryChanged.connect(lambda _: self.m_timer.start(1000))
|
||||
QApplication.instance().primaryScreen().virtualGeometryChanged.connect(
|
||||
lambda _: self.m_timer.start(1000))
|
||||
# DPI变化
|
||||
qApp.primaryScreen().logicalDotsPerInchChanged.connect(lambda _: self.m_timer.start(1000))
|
||||
QApplication.instance().primaryScreen().logicalDotsPerInchChanged.connect(
|
||||
lambda _: self.m_timer.start(1000))
|
||||
|
||||
def onSolutionChanged(self):
|
||||
# 获取主屏幕
|
||||
screen = qApp.primaryScreen()
|
||||
screen = QApplication.instance().primaryScreen()
|
||||
if self.m_rect == screen.availableVirtualGeometry():
|
||||
return
|
||||
self.m_rect = screen.availableVirtualGeometry()
|
||||
# 所有屏幕可用大小
|
||||
self.appendPlainText('\navailableVirtualGeometry: {0}'.format(str(screen.availableVirtualGeometry())))
|
||||
# 获取所有屏幕
|
||||
screens = qApp.screens()
|
||||
screens = QApplication.instance().screens()
|
||||
for screen in screens:
|
||||
self.appendPlainText(
|
||||
'screen: {0}, geometry({1}), availableGeometry({2}), logicalDotsPerInch({3}), '
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from ctypes import CDLL
|
||||
|
||||
dll = CDLL('Data/ScreenShot.dll')
|
||||
dll.PrScrn()
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: TestQSharedMemory
|
||||
@description:
|
||||
'''
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
"""
|
||||
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
from Lib.Application import SharedApplication # @UnresolvedImport
|
||||
|
||||
__version__ = "0.0.1"
|
||||
|
||||
class Widget(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Widget, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys, os
|
||||
|
||||
print(os.getpid())
|
||||
app = SharedApplication(sys.argv)
|
||||
if app.isRunning():
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
Created on 2019年4月23日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ShowFrameWhenDrag
|
||||
@description: 调整窗口显示边框
|
||||
|
@ -12,12 +12,10 @@ Created on 2019年4月23日
|
|||
from ctypes import sizeof, windll, c_int, byref, c_long, c_void_p, c_ulong, c_longlong, \
|
||||
c_ulonglong, WINFUNCTYPE, c_uint
|
||||
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel
|
||||
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
||||
__Version__ = 1.0
|
||||
try:
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QLabel, QApplication
|
||||
|
||||
if sizeof(c_long) == sizeof(c_void_p):
|
||||
WPARAM = c_ulong
|
||||
|
@ -82,7 +80,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: TestQSingleApplication
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
|
||||
from PyQt5.QtWidgets import QTextEdit
|
||||
|
||||
from Lib.Application import QSingleApplication # @UnresolvedImport
|
||||
|
||||
|
||||
__version__ = "0.0.1"
|
||||
|
||||
class Widget(QTextEdit):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Widget, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
app = QSingleApplication(sys.argv)
|
||||
if app.isRunning():
|
||||
app.sendMessage("app is running")
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年4月5日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: widgets.WidgetCode
|
||||
@description:
|
||||
'''
|
||||
from random import sample
|
||||
"""
|
||||
import string
|
||||
from random import sample
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, qrand, QPointF, QPoint, QBasicTimer
|
||||
from PyQt5.QtGui import QPainter, QBrush, QPen, QPalette, QFontMetrics
|
||||
from PyQt5.QtWidgets import QLabel
|
||||
|
||||
|
||||
__version__ = "0.0.1"
|
||||
from PyQt5.QtGui import QPainter, QBrush, QPen, QPalette, QFontMetrics, QFontDatabase
|
||||
from PyQt5.QtWidgets import QLabel, QApplication, QWidget, QHBoxLayout, QLineEdit
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, qrand, QPointF, QPoint, QBasicTimer
|
||||
from PySide2.QtGui import QPainter, QBrush, QPen, QPalette, QFontMetrics, QFontDatabase
|
||||
from PySide2.QtWidgets import QLabel, QApplication, QWidget, QHBoxLayout, QLineEdit
|
||||
|
||||
DEF_NOISYPOINTCOUNT = 60 # 噪点数量
|
||||
COLORLIST = ("black", "gray", "red", "green", "blue", "magenta")
|
||||
|
@ -28,6 +30,7 @@ FONT = "<font color=\"{color}\">{word}</font>"
|
|||
WORDS = list(string.ascii_letters + string.digits)
|
||||
SINETABLE = (0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38)
|
||||
|
||||
|
||||
class WidgetCode(QLabel):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -107,11 +110,10 @@ class WidgetCode(QLabel):
|
|||
painter.drawText(x, y - ((SINETABLE[index] * metrics.height()) / 400), ch)
|
||||
x += metrics.width(ch)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout
|
||||
from PyQt5.QtGui import QFontDatabase
|
||||
from PyQt5.QtWidgets import QLineEdit
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setApplicationName("Validate Code")
|
||||
QFontDatabase.addApplicationFont("Data/itckrist.ttf")
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
"""
|
||||
Created on 2018年3月1日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: WeltHideWindow
|
||||
@description: 简单的窗口贴边隐藏
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
||||
|
||||
|
||||
__Author__ = 'By: Irony\nQQ: 892768447\nEmail: 892768447@qq.com'
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
|
||||
|
||||
|
||||
class WeltHideWindow(QWidget):
|
||||
|
@ -88,7 +88,7 @@ class WeltHideWindow(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = WeltHideWindow()
|
||||
w.show()
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: WindowNotify
|
||||
@description: 右下角弹窗
|
||||
'''
|
||||
"""
|
||||
import webbrowser
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, QPropertyAnimation, QPoint, QTimer, pyqtSignal
|
||||
from PyQt5.QtWidgets import QWidget, QPushButton
|
||||
from PyQt5.QtWidgets import QWidget, QPushButton, QApplication, QHBoxLayout
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, QPropertyAnimation, QPoint, QTimer, Signal as pyqtSignal
|
||||
from PySide2.QtWidgets import QWidget, QPushButton, QApplication, QHBoxLayout
|
||||
|
||||
from Lib.UiNotify import Ui_NotifyForm # @UnresolvedImport
|
||||
|
||||
|
||||
__version__ = "0.0.1"
|
||||
|
||||
|
||||
class WindowNotify(QWidget, Ui_NotifyForm):
|
||||
|
||||
SignalClosed = pyqtSignal() # 弹窗关闭信号
|
||||
|
||||
def __init__(self, title="", content="", timeout=5000, *args, **kwargs):
|
||||
|
@ -118,6 +118,7 @@ class WindowNotify(QWidget, Ui_NotifyForm):
|
|||
self.animation.start()
|
||||
# 弹出5秒后,如果没有焦点则弹回去
|
||||
self._timer.start(self._timeout)
|
||||
|
||||
# QTimer.singleShot(self._timeout, self.closeAnimation)
|
||||
|
||||
def closeAnimation(self):
|
||||
|
@ -158,9 +159,10 @@ class WindowNotify(QWidget, Ui_NotifyForm):
|
|||
if self._timeouted:
|
||||
QTimer.singleShot(1000, self.closeAnimation)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QHBoxLayout
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
window = QWidget()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
'''
|
||||
"""
|
||||
@author: wxj
|
||||
@license: (C) Hefei tongzhi electromechanical control technology co.LTD
|
||||
@contact:
|
||||
|
@ -8,4 +8,4 @@
|
|||
@file: __init__.py.py
|
||||
@time: 2019/5/21 18:07
|
||||
@desc:
|
||||
'''
|
||||
"""
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class graph_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName("Form")
|
||||
|
@ -50,4 +51,3 @@ class graph_Form(object):
|
|||
self.label.setText(_translate("Form", "图形分析"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("Form", "折线图"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Form", "Tab 2"))
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class graph_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName("Form")
|
||||
|
@ -51,4 +52,3 @@ class graph_Form(object):
|
|||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("Form", "折线图"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Form", "Tab 2"))
|
||||
self.pushButton_7.setText(_translate("Form", "分析"))
|
||||
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
'''
|
||||
"""
|
||||
Created on 2019年5月21日
|
||||
@author: weike32
|
||||
@site: https://pyqt5.com ,https://github.com/weike32
|
||||
@site: https://pyqt.site ,https://github.com/weike32
|
||||
@email: 394967319@qq.com
|
||||
@file: CopyContent
|
||||
@description: 禁止右键,添加滑动窗口,点击按钮生成图片,自定义Y轴坐标,背景颜色调整
|
||||
'''
|
||||
"""
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QDialog, QApplication, QWidget
|
||||
from qtpy import QtWidgets
|
||||
|
||||
import pyqtgraph as pg
|
||||
from PyQt5.QtGui import QSpacerItem, QSizePolicy
|
||||
from PyQt5.QtWidgets import QDialog, QApplication, QWidget, QScrollArea, QVBoxLayout
|
||||
|
||||
from PyQtGraph.Data.graphTest import graph_Form
|
||||
|
||||
|
||||
class CustomViewBox(pg.ViewBox):
|
||||
def __init__(self, *args, **kwds):
|
||||
pg.ViewBox.__init__(self, *args, **kwds)
|
||||
|
@ -31,6 +34,7 @@ class CustomViewBox(pg.ViewBox):
|
|||
# pg.ViewBox.wheelEvent(self, ev, axis)
|
||||
ev.ignore()
|
||||
|
||||
|
||||
class graphAnalysis(QDialog, graph_Form):
|
||||
def __init__(self):
|
||||
super(graphAnalysis, self).__init__()
|
||||
|
@ -39,14 +43,14 @@ class graphAnalysis(QDialog,graph_Form):
|
|||
self.tabWidget.clear()
|
||||
|
||||
def test(self):
|
||||
tab1 = QtWidgets.QWidget()
|
||||
scrollArea = QtWidgets.QScrollArea(tab1)
|
||||
tab1 = QWidget()
|
||||
scrollArea = QScrollArea(tab1)
|
||||
scrollArea.setMinimumSize(984, 550)
|
||||
scrollArea.setWidgetResizable(True)
|
||||
labelsContainer = QWidget()
|
||||
labelsContainer.setMinimumSize(0, 1500)
|
||||
scrollArea.setWidget(labelsContainer)
|
||||
layout = QtWidgets.QVBoxLayout(labelsContainer)
|
||||
layout = QVBoxLayout(labelsContainer)
|
||||
time = ['2019-04-20 08:09:00', '2019-04-20 08:09:00', '2019-04-20 08:09:00', '2019-04-20 08:09:00']
|
||||
value = [1.2, 2, 1, 4]
|
||||
xdict = dict(enumerate(time))
|
||||
|
@ -56,16 +60,18 @@ class graphAnalysis(QDialog,graph_Form):
|
|||
plt.setBackground(background=None)
|
||||
plt.plot(list(xdict.keys()), value)
|
||||
plt.getPlotItem().getAxis("bottom").setTicks(ticks)
|
||||
temp = QtWidgets.QWidget()
|
||||
temp = QWidget()
|
||||
temp.setMinimumSize(900, 300)
|
||||
temp.setMaximumSize(900, 300)
|
||||
layout1 = QtWidgets.QVBoxLayout(temp)
|
||||
layout1 = QVBoxLayout(temp)
|
||||
layout1.addWidget(plt)
|
||||
layout.addWidget(temp)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum,
|
||||
QSizePolicy.Expanding)
|
||||
layout.addItem(spacerItem)
|
||||
self.tabWidget.addTab(tab1, '这里tabWidget修改标签')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
w = graphAnalysis()
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
'''
|
||||
"""
|
||||
Created on 2019年5月2日
|
||||
@author: weike32
|
||||
@site: https://pyqt5.com ,https://github.com/weike32
|
||||
@site: https://pyqt.site ,https://github.com/weike32
|
||||
@email: 394967319@qq.com
|
||||
@file: CopyContent
|
||||
@description: 查阅了很多博客,如果有异,可以联系作者邮箱。本Demo仅作学习参考用,保有后续相关权益。
|
||||
'''
|
||||
"""
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow
|
||||
from PyQt5 import QtCore
|
||||
|
||||
import numpy as np
|
||||
import pyqtgraph as pg
|
||||
from PyQt5 import QtCore
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow
|
||||
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
|
@ -22,6 +24,7 @@ class Ui_Form(object):
|
|||
self.graphicsView.setGeometry(QtCore.QRect(75, 131, 621, 441))
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
|
||||
|
||||
class MyWindow(QMainWindow, Ui_Form):
|
||||
def __init__(self, parent=None):
|
||||
super(MyWindow, self).__init__(parent)
|
||||
|
@ -33,10 +36,13 @@ class MyWindow(QMainWindow, Ui_Form):
|
|||
self.graphicsView.addItem(self.label)
|
||||
self.setMouseTracking(True)
|
||||
self.graphicsView.scene().sigMouseMoved.connect(self.onMouseMoved)
|
||||
|
||||
def onMouseMoved(self, evt):
|
||||
if self.graphicsView.plotItem.vb.mapSceneToView(evt):
|
||||
point = self.graphicsView.plotItem.vb.mapSceneToView(evt)
|
||||
self.label.setHtml("<p style='color:white'>横坐标:{0}</p>".format(point.x()))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
myWin = MyWindow()
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
'''
|
||||
"""
|
||||
Created on 2019年8月17日
|
||||
@author: weike32
|
||||
@site: https://pyqt5.com ,https://github.com/weike32
|
||||
@site: https://pyqt.site ,https://github.com/weike32
|
||||
@email: 394967319@qq.com
|
||||
@file: CopyContent
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
import sys
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QDialog, QApplication, QWidget
|
||||
from qtpy import QtWidgets
|
||||
|
||||
import pyqtgraph as pg
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QSpacerItem, QSizePolicy
|
||||
from PyQt5.QtWidgets import QDialog, QApplication, QWidget, QScrollArea, QVBoxLayout
|
||||
|
||||
from PyQtGraph.Data.graphAnalysis import graph_Form
|
||||
|
||||
|
@ -26,11 +27,14 @@ class CustomViewBox(pg.ViewBox):
|
|||
def mouseClickEvent(self, ev):
|
||||
if ev.button() == pg.QtCore.Qt.RightButton:
|
||||
self.autoRange()
|
||||
|
||||
def mouseDragEvent(self, ev):
|
||||
pg.ViewBox.mouseDragEvent(self, ev)
|
||||
|
||||
def wheelEvent(self, ev, axis=None):
|
||||
ev.ignore()
|
||||
|
||||
|
||||
class graphAnalysis(QDialog, graph_Form):
|
||||
def __init__(self):
|
||||
super(graphAnalysis, self).__init__()
|
||||
|
@ -49,15 +53,15 @@ class graphAnalysis(QDialog,graph_Form):
|
|||
|
||||
def test(self):
|
||||
|
||||
tab1 = QtWidgets.QWidget()
|
||||
scrollArea = QtWidgets.QScrollArea(tab1)
|
||||
tab1 = QWidget()
|
||||
scrollArea = QScrollArea(tab1)
|
||||
scrollArea.setMinimumSize(650, 550)
|
||||
scrollArea.setWidgetResizable(True)
|
||||
|
||||
labelsContainer = QWidget()
|
||||
labelsContainer.setMinimumSize(0, 3000 + 200)
|
||||
scrollArea.setWidget(labelsContainer)
|
||||
layout = QtWidgets.QVBoxLayout(labelsContainer)
|
||||
layout = QVBoxLayout(labelsContainer)
|
||||
|
||||
time = ['2019-04-20 08:09:00', '2019-04-20 08:09:00', '2019-04-20 08:09:00', '2019-04-20 08:09:00']
|
||||
value = [1.2, 2, 1, 4]
|
||||
|
@ -70,19 +74,21 @@ class graphAnalysis(QDialog,graph_Form):
|
|||
plt1.setBackground(background=None)
|
||||
plt1.plot(list(xdict.keys()), value)
|
||||
plt1.getPlotItem().getAxis("bottom").setTicks(ticks)
|
||||
temp1 = QtWidgets.QWidget()
|
||||
temp1 = QWidget()
|
||||
temp1.setMinimumSize(600, 300)
|
||||
temp1.setMaximumSize(600, 300)
|
||||
layout2 = QtWidgets.QVBoxLayout(temp1)
|
||||
layout2 = QVBoxLayout(temp1)
|
||||
layout2.addWidget(plt1)
|
||||
layout.addWidget(temp1)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum,
|
||||
QSizePolicy.Expanding)
|
||||
layout.addItem(spacerItem)
|
||||
# print(layout.count())
|
||||
self.tabWidget.addTab(tab1, '12')
|
||||
for i in range(self.tabWidget.count()):
|
||||
self.tabWidget.widget(i)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
w = graphAnalysis()
|
||||
|
|
|
@ -1,27 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
'''
|
||||
"""
|
||||
Created on 2019年5月21日
|
||||
@author: weike32
|
||||
@site: https://pyqt5.com ,https://github.com/weike32
|
||||
@site: https://pyqt.site ,https://github.com/weike32
|
||||
@email: 394967319@qq.com
|
||||
@file: CopyContent
|
||||
@description: 工具类
|
||||
'''
|
||||
"""
|
||||
import pyqtgraph as pg
|
||||
from pyqtgraph.exporters.ImageExporter import ImageExporter, Exporter
|
||||
from pyqtgraph.parametertree import Parameter
|
||||
import pyqtgraph as pg
|
||||
|
||||
|
||||
# 不用修改源码,重加载,解决右键保存图片异常
|
||||
def widthChanged(self):
|
||||
sr = self.getSourceRect()
|
||||
ar = float(sr.height()) / sr.width()
|
||||
self.params.param('height').setValue(int(self.params['width'] * ar), blockSignal=self.heightChanged)
|
||||
|
||||
|
||||
def heightChanged(self):
|
||||
sr = self.getSourceRect()
|
||||
ar = float(sr.width()) / sr.height()
|
||||
self.params.param('width').setValue(int(self.params['height'] * ar), blockSignal=self.widthChanged)
|
||||
|
||||
|
||||
def New__init__(self, item):
|
||||
Exporter.__init__(self, item)
|
||||
tr = self.getTargetRect()
|
||||
|
@ -42,10 +46,13 @@ def New__init__(self, item):
|
|||
])
|
||||
self.params.param('width').sigValueChanged.connect(self.widthChanged)
|
||||
self.params.param('height').sigValueChanged.connect(self.heightChanged)
|
||||
|
||||
|
||||
ImageExporter.heightChanged = heightChanged
|
||||
ImageExporter.widthChanged = widthChanged
|
||||
ImageExporter.__init__ = New__init__
|
||||
|
||||
|
||||
# 解决自定义坐标轴密集显示
|
||||
class MyStringAxis(pg.AxisItem):
|
||||
def __init__(self, xdict, *args, **kwargs):
|
||||
|
@ -62,6 +69,8 @@ class MyStringAxis(pg.AxisItem):
|
|||
vstr = ""
|
||||
strings.append(vstr)
|
||||
return strings
|
||||
|
||||
|
||||
# 禁止鼠标事件
|
||||
class CustomViewBox(pg.ViewBox):
|
||||
def __init__(self, *args, **kwds):
|
||||
|
|
|
@ -1,24 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年4月6日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ViewOffice
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
|
||||
from PyQt5.QAxContainer import QAxWidget
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QFileDialog, \
|
||||
QMessageBox
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
|
||||
class AxWidget(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -68,6 +64,7 @@ class AxWidget(QWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = AxWidget()
|
||||
w.show()
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
"""
|
||||
Created on 2018年1月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: CalendarQssStyle
|
||||
@description: 日历美化样式
|
||||
"""
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QTextCharFormat, QBrush, QColor
|
||||
from PyQt5.QtWidgets import QApplication, QCalendarWidget
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtGui import QTextCharFormat, QBrush, QColor
|
||||
from PySide2.QtWidgets import QApplication, QCalendarWidget
|
||||
|
||||
|
||||
StyleSheet = '''
|
||||
StyleSheet = """
|
||||
/*顶部导航区域*/
|
||||
#qt_calendar_navigationbar {
|
||||
background-color: rgb(0, 188, 212);
|
||||
|
@ -101,7 +105,7 @@ CalendarWidget QToolButton::menu-indicator {
|
|||
outline: 0px;/*去掉选中后的虚线框*/
|
||||
selection-background-color: rgb(0, 188, 212); /*选中背景颜色*/
|
||||
}
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
class CalendarWidget(QCalendarWidget):
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
"""
|
||||
Created on 2018年1月27日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: CityLinkage
|
||||
@description: 下拉联动
|
||||
|
@ -12,16 +12,18 @@ Created on 2018年1月27日
|
|||
import json
|
||||
import sys
|
||||
|
||||
import chardet
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, QSortFilterProxyModel, QRegExp
|
||||
from PyQt5.QtGui import QStandardItemModel, QStandardItem
|
||||
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QComboBox, \
|
||||
QLabel, QSpacerItem, QSizePolicy
|
||||
import chardet
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, QSortFilterProxyModel, QRegExp
|
||||
from PySide2.QtGui import QStandardItemModel, QStandardItem
|
||||
from PySide2.QtWidgets import QWidget, QApplication, QHBoxLayout, QComboBox, \
|
||||
QLabel, QSpacerItem, QSizePolicy
|
||||
|
||||
|
||||
class SortFilterProxyModel(QSortFilterProxyModel):
|
||||
|
|
|
@ -3,28 +3,29 @@
|
|||
|
||||
"""
|
||||
Created on 2018年1月26日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: FileSystemModel
|
||||
@file: CustomIcon
|
||||
@description:
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QFileInfo
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QFileSystemModel, QFileIconProvider, QApplication, \
|
||||
QTreeView
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
# 图标提供类
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QFileInfo
|
||||
from PySide2.QtGui import QIcon
|
||||
from PySide2.QtWidgets import QFileSystemModel, QFileIconProvider, QApplication, \
|
||||
QTreeView
|
||||
|
||||
|
||||
class FileIconProvider(QFileIconProvider):
|
||||
"""图标提供类"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FileIconProvider, self).__init__(*args, **kwargs)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2018年2月4日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: TencentMovieHotPlay_Flow
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import webbrowser
|
||||
|
@ -20,14 +20,9 @@ from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
|
|||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QLabel, \
|
||||
QHBoxLayout, QSpacerItem, QSizePolicy, QScrollArea, QAbstractSlider
|
||||
|
||||
from Lib.flowlayout import FlowLayout # @UnresolvedImport
|
||||
from lxml.etree import HTML # @UnresolvedImport
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
from Lib.flowlayout import FlowLayout # @UnresolvedImport
|
||||
|
||||
# offset=0,30,60,90
|
||||
Url = "http://v.qq.com/x/list/movie?pay=-1&offset={0}"
|
||||
|
@ -168,6 +163,7 @@ class ItemWidget(QWidget):
|
|||
def setCover(self, path):
|
||||
self.clabel.setCoverPath(path)
|
||||
self.clabel.setPixmap(QPixmap(path))
|
||||
|
||||
# self.clabel.setText('<img src="{0}"/>'.format(os.path.abspath(path)))
|
||||
|
||||
def sizeHint(self):
|
||||
|
@ -188,7 +184,6 @@ class ItemWidget(QWidget):
|
|||
|
||||
|
||||
class GridWidget(QWidget):
|
||||
|
||||
Page = 0
|
||||
loadStarted = pyqtSignal(bool)
|
||||
|
||||
|
|
|
@ -152,7 +152,6 @@ class FlowLayout(QLayout):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
import sys
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: AwesomeFont
|
||||
@description:
|
||||
'''
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtGui import QFontDatabase, QFont
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, \
|
||||
QScrollArea, QPushButton
|
||||
except ImportError:
|
||||
from PySide2.QtGui import QFontDatabase, QFont
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QGridLayout, \
|
||||
QScrollArea, QPushButton
|
||||
|
||||
from Lib.FontAwesome import FontAwesomes # @UnresolvedImport
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# from bs4 import BeautifulSoup
|
||||
import re
|
||||
|
||||
cheatsheet = open("cheatsheet.txt", "rb").read().decode()
|
||||
|
||||
re_fa = re.compile(" fa(.*)")
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: FontAwesome
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
# FontAwesome 版本: 4.7.0
|
||||
# 字体图标地址: http://fontawesome.io/icons/
|
||||
# 字体字符地址: http://fontawesome.io/cheatsheet/
|
||||
|
||||
|
||||
class FontAwesomes:
|
||||
|
||||
FA = None
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -4,20 +4,18 @@
|
|||
"""
|
||||
Created on 2018年9月25日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: AnimationShadowEffect
|
||||
@description: 边框动画阴影动画
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QPropertyAnimation, pyqtProperty
|
||||
from PyQt5.QtWidgets import QGraphicsDropShadowEffect
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QPropertyAnimation, Property as pyqtProperty
|
||||
from PySide2.QtWidgets import QGraphicsDropShadowEffect
|
||||
|
||||
|
||||
class AnimationShadowEffect(QGraphicsDropShadowEffect):
|
||||
|
|
|
@ -4,25 +4,24 @@
|
|||
"""
|
||||
Created on 2018年9月25日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ShadowEffect
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPixmap
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QPushButton, QLineEdit
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QPushButton, QLineEdit, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtGui import QPixmap
|
||||
from PySide2.QtWidgets import QWidget, QHBoxLayout, QLabel, QPushButton, QLineEdit, QApplication
|
||||
|
||||
from Lib.AnimationShadowEffect import AnimationShadowEffect # @UnresolvedImport
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -64,7 +63,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
|
||||
"""
|
||||
Created on 2017年12月23日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: AddQWidget
|
||||
@description:
|
||||
"""
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QVBoxLayout, \
|
||||
QApplication, QGraphicsView, QGraphicsScene
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtWidgets import QWidget, QHBoxLayout, QLabel, QVBoxLayout, \
|
||||
QApplication, QGraphicsView, QGraphicsScene
|
||||
|
||||
|
||||
class ToolTipItem(QWidget):
|
||||
|
|
|
@ -4,21 +4,22 @@
|
|||
"""
|
||||
Created on 2020/11/12
|
||||
@author: Irony
|
||||
@site: https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ImageView
|
||||
@description: 图片查看控件,支持移动、放大、缩小
|
||||
"""
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2020 Irony'
|
||||
__Version__ = 1.0
|
||||
|
||||
import os
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF
|
||||
from PyQt5.QtGui import QPainter, QColor, QImage, QPixmap
|
||||
from PyQt5.QtWidgets import QGraphicsView, QGraphicsPixmapItem, QGraphicsScene
|
||||
from PyQt5.QtWidgets import QApplication, QGraphicsView, QGraphicsPixmapItem, QGraphicsScene
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QPointF, Qt, QRectF, QSizeF
|
||||
from PySide2.QtGui import QPainter, QColor, QImage, QPixmap
|
||||
from PySide2.QtWidgets import QApplication, QGraphicsView, QGraphicsPixmapItem, QGraphicsScene
|
||||
|
||||
|
||||
class ImageView(QGraphicsView):
|
||||
|
@ -141,7 +142,6 @@ if __name__ == '__main__':
|
|||
import cgitb
|
||||
|
||||
cgitb.enable(format='text')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = ImageView(image='Data/bg.jpg', background=Qt.black)
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
"""
|
||||
Created on 2017年12月17日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: WorldMap
|
||||
@description:
|
||||
|
@ -12,19 +12,19 @@ Created on 2017年12月17日
|
|||
import json
|
||||
import math
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, QPointF, QRectF
|
||||
from PyQt5.QtGui import QColor, QPainter, QPolygonF, QPen, QBrush
|
||||
from PyQt5.QtOpenGL import QGLFormat
|
||||
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsPolygonItem
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
from PyQt5.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsPolygonItem
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, QPointF, QRectF
|
||||
from PySide2.QtGui import QColor, QPainter, QPolygonF, QPen, QBrush
|
||||
from PySide2.QtOpenGL import QGLFormat
|
||||
from PySide2.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsPolygonItem
|
||||
|
||||
|
||||
class GraphicsView(QGraphicsView):
|
||||
|
||||
# 背景区域颜色
|
||||
backgroundColor = QColor(31, 31, 47)
|
||||
# 边框颜色
|
||||
|
@ -157,7 +157,7 @@ class GraphicsView(QGraphicsView):
|
|||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
print("OpenGL Status:", QGLFormat.hasOpenGL())
|
||||
view = GraphicsView()
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2018年2月4日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: TencentMovieHotPlay
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import webbrowser
|
||||
|
@ -21,14 +21,8 @@ from PyQt5.QtSvg import QSvgWidget
|
|||
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QLabel, \
|
||||
QHBoxLayout, QSpacerItem, QSizePolicy, QScrollArea, QGridLayout, \
|
||||
QAbstractSlider
|
||||
|
||||
from lxml.etree import HTML # @UnresolvedImport
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
# offset=0,30,60,90
|
||||
Url = "http://v.qq.com/x/list/movie?pay=-1&offset={0}"
|
||||
|
||||
|
@ -166,6 +160,7 @@ class ItemWidget(QWidget):
|
|||
def setCover(self, path):
|
||||
self.clabel.setCoverPath(path)
|
||||
self.clabel.setPixmap(QPixmap(path))
|
||||
|
||||
# self.clabel.setText('<img src="{0}"/>'.format(os.path.abspath(path)))
|
||||
|
||||
def sizeHint(self):
|
||||
|
@ -186,7 +181,6 @@ class ItemWidget(QWidget):
|
|||
|
||||
|
||||
class GridWidget(QWidget):
|
||||
|
||||
Page = 0
|
||||
loadStarted = pyqtSignal(bool)
|
||||
|
||||
|
@ -279,7 +273,8 @@ class GridWidget(QWidget):
|
|||
if os.path.isfile(path):
|
||||
cover_path = path
|
||||
iwidget = ItemWidget(cover_path, figure_info, figure_title,
|
||||
figure_score, figure_desc, figure_count, video_url, cover_url, path, self)
|
||||
figure_score, figure_desc, figure_count, video_url, cover_url, path,
|
||||
self)
|
||||
self._layout.addWidget(iwidget, row_count + row, col)
|
||||
|
||||
|
||||
|
|
|
@ -3,19 +3,21 @@
|
|||
|
||||
"""
|
||||
Created on 2018年1月20日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: CircleImage
|
||||
@description: 圆形图片
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPixmap, QPainter, QPainterPath
|
||||
from PyQt5.QtWidgets import QLabel, QWidget, QHBoxLayout
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
from PyQt5.QtWidgets import QLabel, QWidget, QHBoxLayout, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtGui import QPixmap, QPainter, QPainterPath
|
||||
from PySide2.QtWidgets import QLabel, QWidget, QHBoxLayout, QApplication
|
||||
|
||||
|
||||
class Label(QLabel):
|
||||
|
@ -67,7 +69,6 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
|
|
|
@ -4,22 +4,22 @@
|
|||
"""
|
||||
Created on 2018年11月19日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file:
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPixmap, QPainter, QImage
|
||||
from PyQt5.QtWidgets import QWidget, QLabel, QPushButton, \
|
||||
QVBoxLayout, QHBoxLayout, QSpacerItem, QSizePolicy
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
QVBoxLayout, QHBoxLayout, QSpacerItem, QSizePolicy, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtGui import QPixmap, QPainter, QImage
|
||||
from PySide2.QtWidgets import QWidget, QLabel, QPushButton, \
|
||||
QVBoxLayout, QHBoxLayout, QSpacerItem, QSizePolicy, QApplication
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
@ -96,6 +96,7 @@ class Window(QWidget):
|
|||
self.srcImage = image # 替换
|
||||
self.imageLabel.setPixmap(QPixmap.fromImage(self.srcImage))
|
||||
|
||||
|
||||
# # 下面这个旋转方法针对90度的倍数,否则图片会变大
|
||||
# trans = QTransform()
|
||||
# trans.rotate(90)
|
||||
|
@ -106,7 +107,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,20 +4,18 @@
|
|||
"""
|
||||
Created on 2018年10月18日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ImageSlipped
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtGui import QPixmap, QPainter
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
from PyQt5.QtWidgets import QWidget, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtGui import QPixmap, QPainter
|
||||
from PySide2.QtWidgets import QWidget, QApplication
|
||||
|
||||
|
||||
class SlippedImgWidget(QWidget):
|
||||
|
@ -73,7 +71,7 @@ class SlippedImgWidget(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = SlippedImgWidget('Data/bg1.jpg', 'Data/fg1.png')
|
||||
w.show()
|
||||
|
|
|
@ -4,22 +4,19 @@
|
|||
"""
|
||||
Created on 2018年10月25日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: NinePatch
|
||||
@description:
|
||||
"""
|
||||
from math import fabs
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QRect
|
||||
from PyQt5.QtGui import QImage, QColor, QPainter, qRed, qGreen, qBlue, qAlpha
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QRect
|
||||
from PySide2.QtGui import QImage, QColor, QPainter, qRed, qGreen, qBlue, qAlpha
|
||||
|
||||
|
||||
class _Exception(Exception):
|
||||
|
@ -44,7 +41,8 @@ class ExceptionIncorrectWidth(_Exception):
|
|||
class ExceptionIncorrectWidthAndHeight(_Exception):
|
||||
|
||||
def __str__(self):
|
||||
return "Input incorrect width width and height. Minimum width = :{imgW} . Minimum height = :{imgH}".format(imgW=self.imgW, imgH=self.imgH)
|
||||
return "Input incorrect width width and height. Minimum width = :{imgW} . Minimum height = :{imgH}".format(
|
||||
imgW=self.imgW, imgH=self.imgH)
|
||||
|
||||
|
||||
class ExceptionIncorrectHeight(_Exception):
|
||||
|
@ -103,7 +101,8 @@ class NinePatch:
|
|||
for i in range(len(self.ResizeDistancesY)):
|
||||
resizeHeight += self.ResizeDistancesY[i][1]
|
||||
|
||||
if (width < (self.Image.width() - 2 - resizeWidth) and height < (self.Image.height() - 2 - resizeHeight)):
|
||||
if (width < (self.Image.width() - 2 - resizeWidth) and height < (
|
||||
self.Image.height() - 2 - resizeHeight)):
|
||||
raise ExceptionIncorrectWidthAndHeight(
|
||||
self.Image.width() - 2, self.Image.height() - 2)
|
||||
|
||||
|
@ -123,7 +122,8 @@ class NinePatch:
|
|||
@classmethod
|
||||
def GetContentAreaRect(self, width, height):
|
||||
# print("GetContentAreaRect : width:%d height:%d" % (width, height))
|
||||
return (QRect(self.ContentArea.x(), self.ContentArea.y(), (width - (self.Image.width() - 2 - self.ContentArea.width())),
|
||||
return (QRect(self.ContentArea.x(), self.ContentArea.y(),
|
||||
(width - (self.Image.width() - 2 - self.ContentArea.width())),
|
||||
(height - (self.Image.height() - 2 - self.ContentArea.height()))))
|
||||
|
||||
def DrawScaledPart(self, oldRect, newRect, painter):
|
||||
|
@ -189,7 +189,8 @@ class NinePatch:
|
|||
for i in range(self.Image.width()):
|
||||
if (self.IsColorBlack(self.Image.pixel(i, j)) and left == 0):
|
||||
left = i
|
||||
if (left and self.IsColorBlack(self.Image.pixel(i, j)) and not self.IsColorBlack(self.Image.pixel(i + 1, j))):
|
||||
if (left and self.IsColorBlack(self.Image.pixel(i, j)) and not self.IsColorBlack(
|
||||
self.Image.pixel(i + 1, j))):
|
||||
right = i
|
||||
left -= 1
|
||||
# print("ResizeDistancesX.append ", left, " ", right - left)
|
||||
|
@ -204,7 +205,8 @@ class NinePatch:
|
|||
if (self.IsColorBlack(self.Image.pixel(i, j)) and top == 0):
|
||||
top = j
|
||||
|
||||
if (top and self.IsColorBlack(self.Image.pixel(i, j)) and not self.IsColorBlack(self.Image.pixel(i, j + 1))):
|
||||
if (top and self.IsColorBlack(self.Image.pixel(i, j)) and not self.IsColorBlack(
|
||||
self.Image.pixel(i, j + 1))):
|
||||
bot = j
|
||||
top -= 1
|
||||
# print("ResizeDistancesY.append ", top, " ", bot - top)
|
||||
|
@ -310,7 +312,8 @@ class NinePatch:
|
|||
offsetY = 0
|
||||
for i in range(len(self.ResizeDistancesY)):
|
||||
self.DrawConstPart(QRect(x1 + 1, y1 + 1, widthResize, self.ResizeDistancesY[i][0] - y1),
|
||||
QRect(x1 + offsetX, y1 + offsetY, widthResize, self.ResizeDistancesY[i][0] - y1), painter)
|
||||
QRect(x1 + offsetX, y1 + offsetY, widthResize,
|
||||
self.ResizeDistancesY[i][0] - y1), painter)
|
||||
y1 = self.ResizeDistancesY[i][0]
|
||||
resizeY = round(float(self.ResizeDistancesY[i][1]) * factorY)
|
||||
lostY += resizeY - (float(self.ResizeDistancesY[i][1]) * factorY)
|
||||
|
@ -334,7 +337,8 @@ class NinePatch:
|
|||
offsetX = 0
|
||||
for i in range(len(self.ResizeDistancesX)):
|
||||
self.DrawConstPart(QRect(x1 + 1, y1 + 1, self.ResizeDistancesX[i][0] - x1, heightResize),
|
||||
QRect(x1 + offsetX, y1 + offsetY, self.ResizeDistancesX[i][0] - x1, heightResize), painter)
|
||||
QRect(x1 + offsetX, y1 + offsetY, self.ResizeDistancesX[i][0] - x1,
|
||||
heightResize), painter)
|
||||
x1 = self.ResizeDistancesX[i][0]
|
||||
resizeX = round(float(self.ResizeDistancesX[i][1]) * factorX)
|
||||
lostX += resizeX - (float(self.ResizeDistancesX[i][1]) * factorX)
|
||||
|
|
|
@ -5,9 +5,8 @@ import os
|
|||
import shutil
|
||||
|
||||
import PyQt5
|
||||
from PyQt5.QtCore import PYQT_CONFIGURATION
|
||||
import sipconfig
|
||||
|
||||
from PyQt5.QtCore import PYQT_CONFIGURATION
|
||||
|
||||
# 模块名
|
||||
moduleName = 'QtNinePatch'
|
||||
|
@ -42,7 +41,6 @@ os.makedirs('build', exist_ok=True)
|
|||
print(sip_cmd)
|
||||
os.system(sip_cmd)
|
||||
|
||||
|
||||
# Create the Makefile.
|
||||
makefile = sipconfig.SIPModuleMakefile(
|
||||
config, build_file, dir='build'
|
||||
|
|
|
@ -4,22 +4,19 @@
|
|||
"""
|
||||
Created on 2018年10月25日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: QtNinePatch
|
||||
@description:
|
||||
"""
|
||||
from math import floor
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, QRect
|
||||
from PyQt5.QtGui import qAlpha, QPixmap, QPainter
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, QRect
|
||||
from PySide2.QtGui import qAlpha, QPixmap, QPainter
|
||||
|
||||
|
||||
class Part:
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
try:
|
||||
from PyQt5 import QtCore
|
||||
except ImportError:
|
||||
from PySide2 import QtCore
|
||||
|
||||
qt_resource_data = b"\
|
||||
\x00\x00\x19\xf0\
|
||||
|
@ -462,10 +465,13 @@ else:
|
|||
rcc_version = 2
|
||||
qt_resource_struct = qt_resource_struct_v2
|
||||
|
||||
|
||||
def qInitResources():
|
||||
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
|
||||
def qCleanupResources():
|
||||
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
|
||||
qInitResources()
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年12月23日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: xpmres
|
||||
@description:
|
||||
'''
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
"""
|
||||
|
||||
# 这里把转换的xpm数组直接放到py文件中当做一个变量
|
||||
|
||||
|
|
|
@ -4,23 +4,20 @@
|
|||
"""
|
||||
Created on 2018年10月25日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: NinePatch
|
||||
@description:
|
||||
"""
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
import sys
|
||||
|
||||
from PyQt5.QtGui import QImage, QPainter
|
||||
from PyQt5.QtWidgets import QApplication, QLabel, QWidget
|
||||
try:
|
||||
from PyQt5.QtGui import QPainter
|
||||
from PyQt5.QtWidgets import QApplication, QWidget
|
||||
except ImportError:
|
||||
from PySide2.QtGui import QPainter
|
||||
from PySide2.QtWidgets import QApplication, QWidget
|
||||
|
||||
from Lib.NinePatch import NinePatch
|
||||
|
||||
|
|
|
@ -4,22 +4,15 @@
|
|||
"""
|
||||
Created on 2018年10月25日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: testQtNinePatch
|
||||
@description:
|
||||
"""
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
import sys
|
||||
|
||||
from ctypes import CDLL
|
||||
|
||||
from PyQt5.QtGui import QImage
|
||||
from PyQt5.QtWidgets import QApplication, QLabel
|
||||
|
||||
|
|
|
@ -4,23 +4,20 @@
|
|||
"""
|
||||
Created on 2018年10月25日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: QtNinePatch2
|
||||
@description:
|
||||
"""
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtGui import QImage
|
||||
from PyQt5.QtWidgets import QApplication, QLabel
|
||||
except ImportError:
|
||||
from PySide2.QtGui import QImage
|
||||
from PySide2.QtWidgets import QApplication, QLabel
|
||||
|
||||
from Lib import QtNinePatch2
|
||||
|
||||
|
|
|
@ -1,29 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2017年12月23日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ShowImage
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QResource
|
||||
from PyQt5.QtGui import QPixmap, QMovie
|
||||
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QLabel
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QResource
|
||||
from PySide2.QtGui import QPixmap, QMovie
|
||||
from PySide2.QtWidgets import QWidget, QApplication, QHBoxLayout, QLabel
|
||||
|
||||
from Lib import res_rc # @UnresolvedImport @UnusedImport
|
||||
from Lib.xpmres import image_head # @UnresolvedImport
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
|
||||
class ImageView(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
"""
|
||||
Created on 2018年8月4日
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: QListView.显示自定义Widget
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QSize
|
||||
from PyQt5.QtGui import QStandardItemModel, QStandardItem
|
||||
from PyQt5.QtWidgets import QListView, QWidget, QHBoxLayout, QLineEdit, \
|
||||
QPushButton
|
||||
|
||||
|
||||
# Created on 2018年8月4日
|
||||
# author: Irony
|
||||
# site: https://pyqt5.com , https://github.com/892768447
|
||||
# email: 892768447@qq.com
|
||||
# file: QListView.显示自定义Widget
|
||||
# description:
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
QPushButton, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QSize
|
||||
from PySide2.QtGui import QStandardItemModel, QStandardItem
|
||||
from PySide2.QtWidgets import QListView, QWidget, QHBoxLayout, QLineEdit, \
|
||||
QPushButton, QApplication
|
||||
|
||||
|
||||
class CustomWidget(QWidget):
|
||||
|
@ -56,7 +60,7 @@ class ListView(QListView):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = ListView()
|
||||
w.show()
|
||||
|
|
|
@ -1,26 +1,29 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from random import choice, randint
|
||||
|
||||
|
||||
"""
|
||||
Created on 2018年8月4日
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: QListView.显示自定义Widget并排序
|
||||
@description:
|
||||
"""
|
||||
import string
|
||||
from random import choice, randint
|
||||
from time import time
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QSortFilterProxyModel, Qt, QSize
|
||||
from PyQt5.QtGui import QStandardItem, QStandardItemModel
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListView, \
|
||||
QHBoxLayout, QLineEdit
|
||||
|
||||
|
||||
# Created on 2018年8月4日
|
||||
# author: Irony
|
||||
# site: https://pyqt5.com , https://github.com/892768447
|
||||
# email: 892768447@qq.com
|
||||
# file: QListView.显示自定义Widget并排序
|
||||
# description:
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
QHBoxLayout, QLineEdit, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QSortFilterProxyModel, Qt, QSize
|
||||
from PySide2.QtGui import QStandardItem, QStandardItemModel
|
||||
from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListView, \
|
||||
QHBoxLayout, QLineEdit, QApplication
|
||||
|
||||
|
||||
def randomChar(y):
|
||||
|
@ -109,7 +112,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,16 +4,21 @@
|
|||
"""
|
||||
Created on 2021/4/15
|
||||
@author: Irony
|
||||
@site: https://github.com/PyQt5
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ImageView
|
||||
@description:
|
||||
"""
|
||||
import os
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF
|
||||
from PyQt5.QtGui import QStandardItem, QStandardItemModel, QPainter, QColor, QImage, QPixmap
|
||||
from PyQt5.QtWidgets import QListView, QGraphicsView, QGraphicsPixmapItem, QGraphicsScene
|
||||
from PyQt5.QtWidgets import QApplication, QListView, QGraphicsView, QGraphicsPixmapItem, QGraphicsScene
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QPointF, Qt, QRectF, QSizeF
|
||||
from PySide2.QtGui import QStandardItem, QStandardItemModel, QPainter, QColor, QImage, QPixmap
|
||||
from PySide2.QtWidgets import QApplication, QListView, QGraphicsView, QGraphicsPixmapItem, QGraphicsScene
|
||||
|
||||
ScrollPixel = 40
|
||||
|
||||
|
@ -223,7 +228,6 @@ if __name__ == '__main__':
|
|||
import cgitb
|
||||
|
||||
cgitb.enable(format='text')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = ImageView()
|
||||
|
|
|
@ -4,23 +4,21 @@
|
|||
"""
|
||||
Created on 2018年12月27日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: QListView.SortItemByRole
|
||||
@description:
|
||||
"""
|
||||
from random import choice
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QSortFilterProxyModel, Qt
|
||||
from PyQt5.QtGui import QStandardItem, QStandardItemModel
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QListView, QPushButton
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QListView, QPushButton
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QSortFilterProxyModel, Qt
|
||||
from PySide2.QtGui import QStandardItem, QStandardItemModel
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QListView, QPushButton
|
||||
|
||||
|
||||
class SortFilterProxyModel(QSortFilterProxyModel):
|
||||
|
@ -141,8 +139,9 @@ class Window(QWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
import cgitb
|
||||
cgitb.enable(1, None, 5, '')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
cgitb.enable(format='text')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,25 +4,23 @@
|
|||
"""
|
||||
Created on 2018年11月4日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: 删除Item
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QSize, pyqtSignal
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLineEdit, QPushButton, \
|
||||
QListWidgetItem, QVBoxLayout, QListWidget
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
QListWidgetItem, QVBoxLayout, QListWidget, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QSize, Signal as pyqtSignal
|
||||
from PySide2.QtWidgets import QWidget, QHBoxLayout, QLineEdit, QPushButton, \
|
||||
QListWidgetItem, QVBoxLayout, QListWidget, QApplication
|
||||
|
||||
|
||||
class ItemWidget(QWidget):
|
||||
|
||||
itemDeleted = pyqtSignal(QListWidgetItem)
|
||||
|
||||
def __init__(self, text, item, *args, **kwargs):
|
||||
|
@ -91,8 +89,9 @@ class Window(QWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
import cgitb
|
||||
cgitb.enable(1, None, 5, '')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
cgitb.enable(format='text')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,21 +4,20 @@
|
|||
"""
|
||||
Created on 2018年9月14日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: DragListWidget
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, QSize, QRect, QPoint
|
||||
from PyQt5.QtGui import QColor, QPixmap, QDrag, QPainter, QCursor
|
||||
from PyQt5.QtWidgets import QListWidget, QListWidgetItem, QLabel, QRubberBand
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
from PyQt5.QtWidgets import QListWidget, QListWidgetItem, QLabel, QRubberBand, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, QSize, QRect, QPoint
|
||||
from PySide2.QtGui import QColor, QPixmap, QDrag, QPainter, QCursor
|
||||
from PySide2.QtWidgets import QListWidget, QListWidgetItem, QLabel, QRubberBand, QApplication
|
||||
|
||||
|
||||
class DropListWidget(QListWidget):
|
||||
|
@ -162,7 +161,7 @@ class DragListWidget(QListWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setStyleSheet("""QListWidget {
|
||||
outline: 0px;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
Created on 2019年5月27日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/PyQt5
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: FoldWidget
|
||||
@description: 自定义item折叠控件仿QTreeWidget
|
||||
|
@ -15,11 +15,6 @@ from PyQt5.QtWidgets import QWidget, QPushButton, QFormLayout,\
|
|||
QLineEdit, QListWidget, QListWidgetItem, QCheckBox
|
||||
|
||||
|
||||
__Author__ = "Irony"
|
||||
__Copyright__ = "Copyright (c) 2019"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
|
||||
class CustomWidget(QWidget):
|
||||
|
||||
def __init__(self, item, *args, **kwargs):
|
||||
|
@ -79,8 +74,10 @@ class Window(QListWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
import cgitb
|
||||
cgitb.enable(1, None, 5, '')
|
||||
|
||||
cgitb.enable(format='text')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
# 通过qss改变按钮的高度
|
||||
app.setStyleSheet('#testBtn{min-height:40px;}')
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2018年2月4日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: TencentMovieHotPlay_ListWidget
|
||||
@description:
|
||||
'''
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import webbrowser
|
||||
|
@ -21,14 +21,8 @@ from PyQt5.QtSvg import QSvgWidget
|
|||
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QLabel, \
|
||||
QHBoxLayout, QSpacerItem, QSizePolicy, QAbstractSlider, \
|
||||
QListWidget, QListWidgetItem
|
||||
|
||||
from lxml.etree import HTML # @UnresolvedImport
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
# offset=0,30,60,90
|
||||
Url = "http://v.qq.com/x/list/movie?pay=-1&offset={0}"
|
||||
|
||||
|
@ -131,7 +125,8 @@ class CoverLabel(QLabel):
|
|||
class ItemWidget(QWidget):
|
||||
|
||||
def __init__(self, cover_path, figure_info, figure_title,
|
||||
figure_score, figure_desc, figure_count, video_url, cover_url, img_path, manager, *args, **kwargs):
|
||||
figure_score, figure_desc, figure_count, video_url, cover_url, img_path, manager, *args,
|
||||
**kwargs):
|
||||
super(ItemWidget, self).__init__(*args, **kwargs)
|
||||
self.setMaximumSize(220, 420)
|
||||
self.setMaximumSize(220, 420)
|
||||
|
@ -169,6 +164,7 @@ class ItemWidget(QWidget):
|
|||
def setCover(self, path):
|
||||
self.clabel.setCoverPath(path)
|
||||
self.clabel.setPixmap(QPixmap(path))
|
||||
|
||||
# self.clabel.setText('<img src="{0}"/>'.format(os.path.abspath(path)))
|
||||
|
||||
def sizeHint(self):
|
||||
|
@ -189,7 +185,6 @@ class ItemWidget(QWidget):
|
|||
|
||||
|
||||
class Window(QListWidget):
|
||||
|
||||
Page = 0
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -278,7 +273,8 @@ class Window(QListWidget):
|
|||
if os.path.isfile(path):
|
||||
cover_path = path
|
||||
iwidget = ItemWidget(cover_path, figure_info, figure_title,
|
||||
figure_score, figure_desc, figure_count, video_url, cover_url, path, self._manager, self)
|
||||
figure_score, figure_desc, figure_count, video_url, cover_url, path,
|
||||
self._manager, self)
|
||||
item = QListWidgetItem(self)
|
||||
item.setSizeHint(iwidget.sizeHint())
|
||||
self.setItemWidget(item, iwidget)
|
||||
|
|
|
@ -4,20 +4,22 @@
|
|||
"""
|
||||
Created on 2019年7月3日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/PyQt5
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: QListWidget.SignalsExample
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QColor
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QListWidget, QPlainTextEdit, \
|
||||
QListWidgetItem, QAbstractItemView, QListView
|
||||
|
||||
|
||||
__Author__ = "Irony"
|
||||
__Copyright__ = "Copyright (c) 2019"
|
||||
__Version__ = "Version 1.0"
|
||||
QListWidgetItem, QAbstractItemView, QListView, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtGui import QColor
|
||||
from PySide2.QtWidgets import QWidget, QHBoxLayout, QListWidget, QPlainTextEdit, \
|
||||
QListWidgetItem, QAbstractItemView, QListView, QApplication
|
||||
|
||||
|
||||
def formatColor(text, color):
|
||||
|
@ -118,7 +120,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,20 +4,16 @@
|
|||
"""
|
||||
Created on 2018年10月24日
|
||||
@author: Irony
|
||||
@site: https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: MultiSelect
|
||||
@description:
|
||||
"""
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QMenu,\
|
||||
QAction
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
try:
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QPushButton, QMenu, QAction
|
||||
except ImportError:
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QPushButton, QMenu, QAction
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
@ -70,8 +66,9 @@ class Window(QWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
import cgitb
|
||||
cgitb.enable(1, None, 5, '')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
cgitb.enable(format='text')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.resize(400, 400)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
Created on 2021/4/7
|
||||
@author: Irony
|
||||
@site: https://github.com/PyQt5
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: QQMenu
|
||||
@description:
|
||||
|
@ -12,9 +12,14 @@ Created on 2021/4/7
|
|||
import string
|
||||
from random import choice, randint
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPixmap, QPainter, QFont, QIcon
|
||||
from PyQt5.QtWidgets import QLabel, QMenu, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtGui import QPixmap, QPainter, QFont, QIcon
|
||||
from PySide2.QtWidgets import QLabel, QMenu, QApplication
|
||||
|
||||
Style = """
|
||||
QMenu {
|
||||
|
@ -121,7 +126,7 @@ if __name__ == '__main__':
|
|||
import sys
|
||||
import cgitb
|
||||
|
||||
cgitb.enable(1, None, 5, '')
|
||||
cgitb.enable(format='text')
|
||||
app = QApplication(sys.argv)
|
||||
app.setStyleSheet(Style)
|
||||
w = Window()
|
||||
|
|
|
@ -4,19 +4,17 @@
|
|||
"""
|
||||
Created on 2019年7月10日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ChineseText
|
||||
@description: 修改消息对话框文字汉化
|
||||
"""
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtWidgets import QApplication, QMessageBox
|
||||
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
||||
__Version__ = 1.0
|
||||
except ImportError:
|
||||
from PySide2.QtWidgets import QApplication, QMessageBox
|
||||
|
||||
TextStyle = """
|
||||
QMessageBox QPushButton[text="OK"] {
|
||||
|
|
|
@ -4,22 +4,19 @@
|
|||
"""
|
||||
Created on 2018年6月22日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: MessageBox
|
||||
@description:
|
||||
"""
|
||||
from random import randrange
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
from PyQt5.QtWidgets import QApplication, QMessageBox, QPushButton
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer
|
||||
from PySide2.QtWidgets import QApplication, QMessageBox, QPushButton
|
||||
|
||||
|
||||
class MessageBox(QMessageBox):
|
||||
|
@ -53,7 +50,7 @@ class MessageBox(QMessageBox):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QPushButton
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = QPushButton('点击弹出对话框')
|
||||
w.resize(200, 200)
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2018年1月17日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: CustomBtnIcon
|
||||
@description:
|
||||
'''
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
from PyQt5.QtWidgets import QApplication, QMessageBox
|
||||
|
||||
except ImportError:
|
||||
from PySide2.QtWidgets import QApplication, QMessageBox
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setStyleSheet('''QDialogButtonBox {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
Created on 2021/1/1
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: DWaterProgress
|
||||
@see https://github.com/linuxdeepin/dtkwidget/blob/master/src/widgets/dwaterprogress.cpp
|
||||
|
@ -12,10 +12,18 @@ Created on 2021/1/1
|
|||
"""
|
||||
import math
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import pyqtSlot, QTimer, QSizeF, Qt, QRectF, QPointF, QRect, QPoint, QSize
|
||||
from PyQt5.QtGui import QImage, QColor, QPainter, QLinearGradient, QGradient, QPainterPath, QPixmap, QBrush, QPen
|
||||
from PyQt5.QtGui import QImage, QColor, QPainter, QLinearGradient, QGradient, QPainterPath, QPixmap, \
|
||||
QBrush, QPen
|
||||
from PyQt5.QtSvg import QSvgRenderer
|
||||
from PyQt5.QtWidgets import QProgressBar, QGraphicsDropShadowEffect
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Slot as pyqtSlot, QTimer, QSizeF, Qt, QRectF, QPointF, QRect, QPoint, QSize
|
||||
from PySide2.QtGui import QImage, QColor, QPainter, QLinearGradient, QGradient, QPainterPath, QPixmap, \
|
||||
QBrush, QPen
|
||||
from PySide2.QtSvg import QSvgRenderer
|
||||
from PySide2.QtWidgets import QProgressBar, QGraphicsDropShadowEffect
|
||||
|
||||
WATER_FRONT = """<svg xmlns="http://www.w3.org/2000/svg" width="383" height="115" viewBox="0 0 383 115">
|
||||
<path fill="#01C4FF" fill-rule="evenodd" d="M383,115 L383,14.1688789 C380.269872,14.0716143 377.092672,13.5814974 373.063461,12.4722672 C368.696509,11.2699114 362.241136,10.1727531 357.649256,10.1227411 C347.007291,10.0071963 342.744795,10.6014761 332.930121,12.0276784 C326.157898,13.0120512 317.51313,12.4953762 311.375303,10.33762 C305.58601,8.30230681 299.587109,8.09191178 293.164466,8.16675723 C284.09108,8.27264456 276.303198,11.8021073 267.219716,11.3406179 C260.695053,11.0091595 256.565913,8.56512814 248.546835,8.86450991 C241.871757,9.11387975 235.569934,13.1896798 228.881972,13.3297132 C219.538394,13.525622 215.498041,10.7384053 208.282229,8.42337018 C201.688974,6.30769299 190.725982,6.45048568 185.454442,8.65549452 C170.142255,15.0597811 162.05946,9.31703167 150.536236,5.36712375 C147.826999,4.43862637 144.672431,3.20971247 141.663406,2.90998579 C135.153716,2.26155522 129.812539,3.9788615 123.613779,5.46231888 C115.747555,7.3451819 106.643181,6.73503633 99.4869089,3.84572629 C96.4124243,2.60474055 93.6255416,0.951587506 90.1882469,0.261077932 C79.652131,-1.85528907 69.7970674,9.59778831 58.8051757,9.35186757 C49.4744806,9.14319709 42.6942497,2.4740197 33.3934986,1.93078665 C20.5224457,1.17888312 19.3845731,15.343297 0,13.8463882 L0,115 L383,115 Z"/>
|
||||
|
@ -162,9 +170,11 @@ class DWaterProgress(QProgressBar):
|
|||
|
||||
waterPainter.setCompositionMode(QPainter.CompositionMode_SourceOver)
|
||||
waterPainter.drawImage(int(self.backXOffset), yOffset, self.waterBackImage)
|
||||
waterPainter.drawImage(int(self.backXOffset) - self.waterBackImage.width(), yOffset, self.waterBackImage)
|
||||
waterPainter.drawImage(int(self.backXOffset) - self.waterBackImage.width(), yOffset,
|
||||
self.waterBackImage)
|
||||
waterPainter.drawImage(int(self.frontXOffset), yOffset, self.waterFrontImage)
|
||||
waterPainter.drawImage(int(self.frontXOffset) - self.waterFrontImage.width(), yOffset, self.waterFrontImage)
|
||||
waterPainter.drawImage(int(self.frontXOffset) - self.waterFrontImage.width(), yOffset,
|
||||
self.waterFrontImage)
|
||||
|
||||
# draw pop
|
||||
if self.value() > 30:
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Created on 2018年4月1日
|
||||
# author: Irony
|
||||
# site: https://pyqt5.com , https://github.com/892768447
|
||||
# email: 892768447@qq.com
|
||||
# file: WaterRippleProgressBar
|
||||
# description:
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
"""
|
||||
Created on 2018年4月1日
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: WaterRippleProgressBar
|
||||
@description:
|
||||
"""
|
||||
|
||||
import math
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer, Qt, QRectF, QSize
|
||||
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QFont
|
||||
from PyQt5.QtWidgets import QProgressBar
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer, Qt, QRectF, QSize
|
||||
from PySide2.QtGui import QPainter, QPainterPath, QColor, QFont
|
||||
from PySide2.QtWidgets import QProgressBar
|
||||
|
||||
|
||||
class WaterRippleProgressBar(QProgressBar):
|
||||
|
||||
# 浪高百分比
|
||||
waterHeight = 1
|
||||
# 密度
|
||||
|
|
|
@ -4,27 +4,25 @@
|
|||
"""
|
||||
Created on 2018年9月日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: MetroCircleProgress
|
||||
@description:
|
||||
"""
|
||||
from PyQt5.QtCore import QSequentialAnimationGroup, pyqtProperty,\
|
||||
QPauseAnimation, QPropertyAnimation, QParallelAnimationGroup,\
|
||||
QObject, QSize, Qt, pyqtSignal, QRectF
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QSequentialAnimationGroup, QPauseAnimation, QPropertyAnimation, \
|
||||
QParallelAnimationGroup, QObject, QSize, Qt, QRectF, pyqtSignal, pyqtProperty
|
||||
from PyQt5.QtGui import QPainter, QColor
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QSequentialAnimationGroup, QPauseAnimation, QPropertyAnimation, \
|
||||
QParallelAnimationGroup, QObject, QSize, Qt, QRectF, Signal as pyqtSignal, Property as pyqtProperty
|
||||
from PySide2.QtGui import QPainter, QColor
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||
|
||||
|
||||
class CircleItem(QObject):
|
||||
|
||||
X = 0 # x坐标
|
||||
Opacity = 1 # 透明度0~1
|
||||
valueChanged = pyqtSignal()
|
||||
|
@ -52,7 +50,6 @@ def qBound(miv, cv, mxv):
|
|||
|
||||
|
||||
class MetroCircleProgress(QWidget):
|
||||
|
||||
Radius = 5 # 半径
|
||||
Color = QColor(24, 189, 155) # 圆圈颜色
|
||||
BackgroundColor = QColor(Qt.transparent) # 背景颜色
|
||||
|
@ -189,7 +186,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,25 +4,23 @@
|
|||
"""
|
||||
Created on 2018年9月4日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: PercentProgressBar
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import pyqtProperty, QSize, Qt, QRectF, QTimer
|
||||
from PyQt5.QtGui import QColor, QPainter, QFont
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QSlider
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout, QSlider
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Property as pyqtProperty, QSize, Qt, QRectF, QTimer
|
||||
from PySide2.QtGui import QColor, QPainter, QFont
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout, QSlider
|
||||
|
||||
|
||||
class PercentProgressBar(QWidget):
|
||||
|
||||
MinValue = 0
|
||||
MaxValue = 100
|
||||
Value = 0
|
||||
|
@ -300,8 +298,10 @@ class Window(QWidget):
|
|||
self.staticPercentProgressBar.showFreeArea = True
|
||||
self.staticPercentProgressBar.ShowSmallCircle = True
|
||||
vlayout.addWidget(self.staticPercentProgressBar)
|
||||
vlayout.addWidget(QSlider(self, minimum=0, maximum=100, orientation=Qt.Horizontal,
|
||||
valueChanged=self.staticPercentProgressBar.setValue))
|
||||
|
||||
self.slider = QSlider(self, minimum=0, maximum=100, orientation=Qt.Horizontal)
|
||||
self.slider.valueChanged.connect(self.staticPercentProgressBar.setValue)
|
||||
vlayout.addWidget(self.slider)
|
||||
|
||||
self._timer.start(100)
|
||||
|
||||
|
@ -316,8 +316,9 @@ class Window(QWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
import cgitb
|
||||
sys.excepthook = cgitb.Hook(1, None, 5, sys.stderr, 'text')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
cgitb.enable(format='text')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,25 +4,23 @@
|
|||
"""
|
||||
Created on 2018年9月4日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: 界面美化.圆形进度条.CircleProgressBar
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QSize, pyqtProperty, QTimer, Qt
|
||||
from PyQt5.QtGui import QColor, QPainter
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QSize, Property as pyqtProperty, QTimer, Qt
|
||||
from PySide2.QtGui import QColor, QPainter
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QHBoxLayout
|
||||
|
||||
|
||||
class CircleProgressBar(QWidget):
|
||||
|
||||
Color = QColor(24, 189, 155) # 圆圈颜色
|
||||
Clockwise = True # 顺时针还是逆时针
|
||||
Delta = 36
|
||||
|
@ -105,7 +103,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
"""
|
||||
Created on 2018年1月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: SimpleStyle
|
||||
@description:
|
||||
'''
|
||||
from random import randint
|
||||
import sys
|
||||
"""
|
||||
|
||||
import sys
|
||||
from random import randint
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer
|
||||
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QProgressBar
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer
|
||||
from PySide2.QtWidgets import QWidget, QApplication, QVBoxLayout, QProgressBar
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
StyleSheet = '''
|
||||
StyleSheet = """
|
||||
/*设置红色进度条*/
|
||||
#RedProgressBar {
|
||||
text-align: center; /*进度值居中*/
|
||||
|
@ -50,7 +50,7 @@ StyleSheet = '''
|
|||
width: 10px; /*区块宽度*/
|
||||
margin: 0.5px;
|
||||
}
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
class ProgressBar(QProgressBar):
|
||||
|
|
|
@ -4,16 +4,21 @@
|
|||
"""
|
||||
Created on 2021/1/1
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: WaterProgress
|
||||
@description:
|
||||
"""
|
||||
import sys
|
||||
|
||||
from Lib.DWaterProgress import DWaterProgress
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||
|
||||
from Lib.DWaterProgress import DWaterProgress
|
||||
|
||||
|
||||
class WaterProgressWindow(QWidget):
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Created on 2018年4月1日
|
||||
# author: Irony
|
||||
# site: https://pyqt5.com , https://github.com/892768447
|
||||
# email: 892768447@qq.com
|
||||
# file: WaterProgressBar
|
||||
# description:
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
|
||||
"""
|
||||
Created on 2018年4月1日
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: WaterProgressBar
|
||||
@description:
|
||||
"""
|
||||
|
||||
from random import randint
|
||||
|
||||
from PyQt5.Qt import QSpinBox
|
||||
try:
|
||||
from PyQt5.QtCore import QTimer
|
||||
from PyQt5.QtGui import QPixmap, QIcon
|
||||
from PyQt5.QtWidgets import QWidget, QFormLayout, QRadioButton, QPushButton,\
|
||||
QColorDialog
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QFormLayout, QRadioButton, QPushButton, QColorDialog, \
|
||||
QSpinBox
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QTimer
|
||||
from PySide2.QtGui import QPixmap, QIcon
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QFormLayout, QRadioButton, QPushButton, QColorDialog, \
|
||||
QSpinBox
|
||||
|
||||
from Lib.WaterRippleProgressBar import WaterRippleProgressBar # @UnresolvedImport
|
||||
|
||||
|
@ -53,11 +53,13 @@ class Window(QWidget):
|
|||
layout.addWidget(
|
||||
QPushButton('设置随机0-100固定值', self, clicked=self.setRandomValue))
|
||||
|
||||
layout.addRow('振幅(浪高)',
|
||||
QSpinBox(self, value=1, valueChanged=self.bar.setWaterHeight))
|
||||
spb1 = QSpinBox(self, value=1)
|
||||
spb1.valueChanged.connect(self.bar.setWaterHeight)
|
||||
layout.addRow('振幅(浪高)', spb1)
|
||||
|
||||
layout.addRow('周期(密度)',
|
||||
QSpinBox(self, value=1, valueChanged=self.bar.setWaterDensity))
|
||||
spb2 = QSpinBox(self, value=1)
|
||||
spb2.valueChanged.connect(self.bar.setWaterDensity)
|
||||
layout.addRow('周期(密度)', spb2)
|
||||
|
||||
layout.addWidget(self.bar)
|
||||
|
||||
|
@ -116,9 +118,10 @@ class Window(QWidget):
|
|||
value = 0
|
||||
self.bar.setValue(value)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
from libc.math cimport pow
|
||||
|
||||
|
||||
def getDistance(p1, p2):
|
||||
return pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2)
|
||||
|
||||
|
||||
def findClose(points):
|
||||
cdef int plen = len(points)
|
||||
cdef int i = 0
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
# )
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
from Cython.Build import cythonize
|
||||
|
||||
setup(
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
"""
|
||||
Created on 2018年6月14日
|
||||
@author: Irony
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: FadeInOut
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QPropertyAnimation
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
||||
|
||||
|
||||
# Created on 2018年6月14日
|
||||
# author: Irony
|
||||
# site: https://pyqt5.com , https://github.com/892768447
|
||||
# email: 892768447@qq.com
|
||||
# file: FadeInOut
|
||||
# description:
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QPropertyAnimation
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
@ -55,7 +57,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,23 +4,24 @@
|
|||
"""
|
||||
Created on 2019年5月15日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: 翻转动画
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, QTimer
|
||||
from PyQt5.QtGui import QPixmap
|
||||
from PyQt5.QtWidgets import QStackedWidget, QLabel
|
||||
from PyQt5.QtWidgets import QApplication, QStackedWidget, QLabel
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, Signal as pyqtSignal, QTimer
|
||||
from PySide2.QtGui import QPixmap
|
||||
from PySide2.QtWidgets import QApplication, QStackedWidget, QLabel
|
||||
|
||||
from Lib.FlipWidget import FlipWidget
|
||||
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
||||
__Version__ = 1.0
|
||||
|
||||
|
||||
class LoginWidget(QLabel):
|
||||
# 只是显示登录界面截图
|
||||
|
||||
|
@ -120,7 +121,7 @@ class Window(QStackedWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,23 +4,24 @@
|
|||
"""
|
||||
Created on 2019年5月15日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: FlipWidget
|
||||
@description: 动画翻转窗口
|
||||
"""
|
||||
from PyQt5.QtCore import pyqtSignal, Qt, QPropertyAnimation, QEasingCurve,\
|
||||
pyqtProperty, QPointF
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtProperty, Qt, QPropertyAnimation, QEasingCurve, QPointF
|
||||
from PyQt5.QtGui import QPainter, QTransform
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2019'
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Signal as pyqtSignal, Property as pyqtProperty, Qt, QPropertyAnimation, \
|
||||
QEasingCurve, QPointF
|
||||
from PySide2.QtGui import QPainter, QTransform
|
||||
from PySide2.QtWidgets import QWidget
|
||||
|
||||
|
||||
class FlipWidget(QWidget):
|
||||
|
||||
Left = 0 # 从右往左
|
||||
Right = 1 # 从左往右
|
||||
Scale = 3 # 图片缩放比例
|
||||
|
|
|
@ -4,25 +4,23 @@
|
|||
"""
|
||||
Created on 2018年11月24日
|
||||
author: Irony
|
||||
site: https://pyqt5.com , https://github.com/892768447
|
||||
site: https://pyqt.site , https://github.com/PyQt5
|
||||
email: 892768447@qq.com
|
||||
file:
|
||||
description: 参考 http://qt.shoutwiki.com/wiki/Extending_QStackedWidget_for_sliding_page_animations_in_Qt
|
||||
"""
|
||||
from PyQt5.QtCore import Qt, pyqtProperty, QEasingCurve, QPoint, \
|
||||
QPropertyAnimation, QParallelAnimationGroup, QTimer
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import Qt, pyqtProperty, QEasingCurve, QPoint, QPropertyAnimation, \
|
||||
QParallelAnimationGroup, QTimer
|
||||
from PyQt5.QtWidgets import QStackedWidget
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
except ImportError:
|
||||
from PySide2.QtCore import Qt, Property as pyqtProperty, QEasingCurve, QPoint, QPropertyAnimation, \
|
||||
QParallelAnimationGroup, QTimer
|
||||
from PySide2.QtWidgets import QStackedWidget
|
||||
|
||||
|
||||
class SlidingStackedWidget(QStackedWidget):
|
||||
|
||||
LEFT2RIGHT, RIGHT2LEFT, TOP2BOTTOM, BOTTOM2TOP, AUTOMATIC = range(5)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
try:
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
except ImportError:
|
||||
from PySide2 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
|
@ -89,14 +93,15 @@ class Ui_Form(object):
|
|||
self.pushButtonStart.setText(_translate("Form", "轮播开始"))
|
||||
self.pushButtonStop.setText(_translate("Form", "轮播停止"))
|
||||
|
||||
|
||||
from Lib.SlidingStackedWidget import SlidingStackedWidget
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
Form = QtWidgets.QWidget()
|
||||
ui = Ui_Form()
|
||||
ui.setupUi(Form)
|
||||
Form.show()
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
|
|
@ -4,20 +4,18 @@
|
|||
"""
|
||||
Created on 2018年8月22日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: MenuAnimation
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve, QRect
|
||||
from PyQt5.QtWidgets import QWidget, QMenu, QApplication
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QPropertyAnimation, QEasingCurve, QRect
|
||||
from PySide2.QtWidgets import QWidget, QMenu, QApplication
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
@ -61,7 +59,8 @@ class Window(QWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
import cgitb
|
||||
sys.excepthook = cgitb.Hook(1, None, 5, sys.stderr, 'text')
|
||||
|
||||
cgitb.enable(format='text')
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,27 +4,25 @@
|
|||
"""
|
||||
Created on 2018年11月24日
|
||||
author: Irony
|
||||
site: https://pyqt5.com , https://github.com/892768447
|
||||
site: https://pyqt.site , https://github.com/PyQt5
|
||||
email: 892768447@qq.com
|
||||
file: PageSwitching
|
||||
description:
|
||||
"""
|
||||
import os
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QEasingCurve, Qt
|
||||
from PyQt5.QtGui import QPixmap
|
||||
from PyQt5.QtWidgets import QWidget, QLabel
|
||||
from PyQt5.QtWidgets import QWidget, QLabel, QApplication
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QEasingCurve, Qt
|
||||
from PySide2.QtGui import QPixmap
|
||||
from PySide2.QtWidgets import QWidget, QLabel, QApplication
|
||||
|
||||
from Lib.UiImageSlider import Ui_Form # @UnresolvedImport
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
|
||||
|
||||
class ImageSliderWidget(QWidget, Ui_Form):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -76,7 +74,7 @@ class ImageSliderWidget(QWidget, Ui_Form):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = ImageSliderWidget()
|
||||
w.show()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
Created on 2018年11月22日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: RlatticeEffect
|
||||
@description:
|
||||
|
@ -12,29 +12,29 @@ Created on 2018年11月22日
|
|||
from random import random
|
||||
from time import time
|
||||
|
||||
from PyQt5.QtCore import QPropertyAnimation, QObject, pyqtProperty, QEasingCurve,\
|
||||
Qt, QRectF, pyqtSignal
|
||||
try:
|
||||
from PyQt5.QtCore import QPropertyAnimation, QObject, QEasingCurve, Qt, QRectF, pyqtSignal, pyqtProperty
|
||||
from PyQt5.QtGui import QColor, QPainterPath, QPainter
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
||||
__Version__ = 1.0
|
||||
|
||||
from PyQt5.QtWidgets import QApplication, QWidget
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QPropertyAnimation, QObject, QEasingCurve, Qt, QRectF, Signal as pyqtSignal, \
|
||||
Property as pyqtProperty
|
||||
from PySide2.QtGui import QColor, QPainterPath, QPainter
|
||||
from PySide2.QtWidgets import QApplication, QWidget
|
||||
|
||||
try:
|
||||
from Lib import pointtool # @UnusedImport @UnresolvedImport
|
||||
|
||||
getDistance = pointtool.getDistance
|
||||
findClose = pointtool.findClose
|
||||
except:
|
||||
import math
|
||||
|
||||
|
||||
def getDistance(p1, p2):
|
||||
return math.pow(p1.x - p2.x, 2) + math.pow(p1.y - p2.y, 2)
|
||||
|
||||
|
||||
def findClose(points):
|
||||
plen = len(points)
|
||||
for i in range(plen):
|
||||
|
@ -66,8 +66,7 @@ class Target:
|
|||
|
||||
|
||||
class Point(QObject):
|
||||
|
||||
valueChanged = pyqtSignal()
|
||||
valueChanged = pyqtSignal(int)
|
||||
|
||||
def __init__(self, x, ox, y, oy, *args, **kwargs):
|
||||
super(Point, self).__init__(*args, **kwargs)
|
||||
|
@ -90,12 +89,12 @@ class Point(QObject):
|
|||
# 属性动画
|
||||
if not hasattr(self, 'xanimation'):
|
||||
self.xanimation = QPropertyAnimation(
|
||||
self, b'x', self, valueChanged=self.valueChanged.emit,
|
||||
easingCurve=QEasingCurve.InOutSine)
|
||||
self, b'x', self, easingCurve=QEasingCurve.InOutSine)
|
||||
self.xanimation.valueChanged.connect(self.valueChanged.emit)
|
||||
self.yanimation = QPropertyAnimation(
|
||||
self, b'y', self, valueChanged=self.valueChanged.emit,
|
||||
easingCurve=QEasingCurve.InOutSine,
|
||||
finished=self.updateAnimation)
|
||||
self, b'y', self, easingCurve=QEasingCurve.InOutSine)
|
||||
self.yanimation.valueChanged.connect(self.valueChanged.emit)
|
||||
self.yanimation.finished.connect(self.updateAnimation)
|
||||
self.updateAnimation()
|
||||
|
||||
def updateAnimation(self):
|
||||
|
@ -138,6 +137,9 @@ class Window(QWidget):
|
|||
self.target = Target(self.width() / 2, self.height() / 2)
|
||||
self.initPoints()
|
||||
|
||||
def update(self, *args):
|
||||
super(Window, self).update()
|
||||
|
||||
def paintEvent(self, event):
|
||||
super(Window, self).paintEvent(event)
|
||||
painter = QPainter()
|
||||
|
@ -220,8 +222,9 @@ class Window(QWidget):
|
|||
if __name__ == '__main__':
|
||||
import sys
|
||||
import cgitb
|
||||
cgitb.enable(1, None, 5, '')
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
cgitb.enable(format='text')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
"""
|
||||
Created on 2019年5月8日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: ShakeWindow
|
||||
@description: 抖动动画
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QPropertyAnimation, QPoint
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
||||
|
||||
|
||||
__Author__ = 'Irony'
|
||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
||||
__Version__ = 1.0
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QPropertyAnimation, QPoint
|
||||
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
@ -66,7 +66,7 @@ class Window(QWidget):
|
|||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"""
|
||||
Created on 2018年12月27日
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@site: https://pyqt.site , https://github.com/PyQt5
|
||||
@email: 892768447@qq.com
|
||||
@file: TabBarStyle
|
||||
@description:
|
||||
|
@ -13,13 +13,6 @@ from PyQt5.QtCore import Qt
|
|||
from PyQt5.QtWidgets import QProxyStyle
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
|
||||
class TabBarStyle(QProxyStyle):
|
||||
|
||||
def sizeFromContents(self, types, option, size, widget):
|
||||
|
|
|
@ -9,8 +9,13 @@ Created on 2021年06月23日
|
|||
@file: TabCornerStyle
|
||||
@description:
|
||||
"""
|
||||
|
||||
try:
|
||||
from PyQt5.QtCore import QRect
|
||||
from PyQt5.QtWidgets import QProxyStyle, QStyle
|
||||
except ImportError:
|
||||
from PySide2.QtCore import QRect
|
||||
from PySide2.QtWidgets import QProxyStyle, QStyle
|
||||
|
||||
|
||||
class TabCornerStyle(QProxyStyle):
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue