support PySide2

This commit is contained in:
Irony 2021-07-13 14:52:26 +08:00
parent e397db884f
commit 48ef9a5b88
220 changed files with 2457 additions and 2542 deletions

View file

@ -1,21 +1,23 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年3月31日 Created on 2017年3月31日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: AutoRestart @file: AutoRestart
@description: @description:
''' """
from optparse import OptionParser
import os import os
import sys import sys
from optparse import OptionParser
try:
from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QHBoxLayout from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QHBoxLayout
except ImportError:
from PySide2.QtWidgets import QApplication, QPushButton, QWidget, QHBoxLayout
canRestart = True canRestart = True

View file

@ -1,30 +1,31 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2018年1月27日 Created on 2018年1月27日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: BubbleTips @file: BubbleTips
@description: @description:
''' """
import sys import sys
try:
from PyQt5.QtCore import QRectF, Qt, QPropertyAnimation, pyqtProperty, \ from PyQt5.QtCore import QRectF, Qt, QPropertyAnimation, pyqtProperty, \
QPoint, QParallelAnimationGroup, QEasingCurve QPoint, QParallelAnimationGroup, QEasingCurve
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QPen from PyQt5.QtGui import QPainter, QPainterPath, QColor, QPen
from PyQt5.QtWidgets import QLabel, QWidget, QVBoxLayout, QApplication, \ from PyQt5.QtWidgets import QLabel, QWidget, QVBoxLayout, QApplication, \
QLineEdit, QPushButton QLineEdit, QPushButton
except ImportError:
from PySide2.QtCore import QRectF, Qt, QPropertyAnimation, Property as pyqtProperty, \
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com" QPoint, QParallelAnimationGroup, QEasingCurve
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]" from PySide2.QtGui import QPainter, QPainterPath, QColor, QPen
__Version__ = "Version 1.0" from PySide2.QtWidgets import QLabel, QWidget, QVBoxLayout, QApplication, \
QLineEdit, QPushButton
class BubbleLabel(QWidget): class BubbleLabel(QWidget):
BackgroundColor = QColor(195, 195, 195) BackgroundColor = QColor(195, 195, 195)
BorderColor = QColor(150, 150, 150) BorderColor = QColor(150, 150, 150)
@ -133,10 +134,10 @@ class BubbleLabel(QWidget):
opacity = pyqtProperty(float, windowOpacity, setWindowOpacity) opacity = pyqtProperty(float, windowOpacity, setWindowOpacity)
class TestWidget(QWidget): class Window(QWidget):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(TestWidget, self).__init__(*args, **kwargs) super(Window, self).__init__(*args, **kwargs)
layout = QVBoxLayout(self) layout = QVBoxLayout(self)
self.msgEdit = QLineEdit(self, returnPressed=self.onMsgShow) self.msgEdit = QLineEdit(self, returnPressed=self.onMsgShow)
self.msgButton = QPushButton("显示内容", self, clicked=self.onMsgShow) self.msgButton = QPushButton("显示内容", self, clicked=self.onMsgShow)
@ -158,6 +159,6 @@ class TestWidget(QWidget):
if __name__ == "__main__": if __name__ == "__main__":
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = TestWidget() w = Window()
w.show() w.show()
sys.exit(app.exec_()) sys.exit(app.exec_())

View file

@ -4,20 +4,19 @@
""" """
Created on 2019年5月22日 Created on 2019年5月22日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: Demo.CallVirtualKeyboard @file: Demo.CallVirtualKeyboard
@description: 调用系统虚拟键盘 @description: 调用系统虚拟键盘
""" """
import glob import glob
try:
from PyQt5.QtCore import QProcess, QSysInfo from PyQt5.QtCore import QProcess, QSysInfo
from PyQt5.QtWidgets import QWidget, QTextEdit, QVBoxLayout, QPushButton from PyQt5.QtWidgets import QApplication, QWidget, QTextEdit, QVBoxLayout, QPushButton
except ImportError:
from PySide2.QtCore import QProcess, QSysInfo
__Author__ = 'Irony' from PySide2.QtWidgets import QApplication, QWidget, QTextEdit, QVBoxLayout, QPushButton
__Copyright__ = 'Copyright (c) 2019 Irony'
__Version__ = 1.0
class Window(QWidget): class Window(QWidget):
@ -62,7 +61,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,7 +4,7 @@
""" """
Created on 2019年3月19日 Created on 2019年3月19日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: CircleLine @file: CircleLine
@description: @description:
@ -14,13 +14,14 @@ from math import floor, pi, cos, sin
from random import random, randint from random import random, randint
from time import time from time import time
try:
from PyQt5.QtCore import QTimer, Qt from PyQt5.QtCore import QTimer, Qt
from PyQt5.QtGui import QColor, QPainter, QPainterPath, QPen from PyQt5.QtGui import QColor, QPainter, QPainterPath, QPen
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QWidget, QApplication
except ImportError:
from PySide2.QtCore import QTimer, Qt
__Author__ = 'Irony' from PySide2.QtGui import QColor, QPainter, QPainterPath, QPen
__Copyright__ = 'Copyright (c) 2019' from PySide2.QtWidgets import QWidget, QApplication
# 最小和最大半径、半径阈值和填充圆的百分比 # 最小和最大半径、半径阈值和填充圆的百分比
radMin = 10 radMin = 10
@ -60,18 +61,21 @@ circleExpMin = 0.997
circleExpSp = 0.00004 circleExpSp = 0.00004
circlePulse = False circlePulse = False
# 生成随机整数 a<=x<=b # 生成随机整数 a<=x<=b
def randint(a, b): def randint(a, b):
return floor(random() * (b - a + 1) + a) return floor(random() * (b - a + 1) + a)
# 生成随机小数 # 生成随机小数
def randRange(a, b): def randRange(a, b):
return random() * (b - a) + a return random() * (b - a) + a
# 生成接近a的随机小数 # 生成接近a的随机小数
@ -255,7 +259,7 @@ class CircleLineWindow(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = CircleLineWindow() w = CircleLineWindow()
w.resize(800, 600) w.resize(800, 600)

View file

@ -1,25 +1,25 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年4月12日 Created on 2017年4月12日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: 自定义属性测试 @file: 自定义属性测试
@description: @description:
''' """
from random import randint from random import randint
try:
from PyQt5.QtCore import pyqtProperty, pyqtSignal from PyQt5.QtCore import pyqtProperty, pyqtSignal
from PyQt5.QtWidgets import QPushButton from PyQt5.QtWidgets import QPushButton, QApplication
except ImportError:
from PySide2.QtCore import Property as pyqtProperty, Signal as pyqtSignal
__version__ = "0.0.1" from PySide2.QtWidgets import QPushButton, QApplication
class Window(QPushButton): class Window(QPushButton):
bgChanged = pyqtSignal(str, str) bgChanged = pyqtSignal(str, str)
def __init__(self): def __init__(self):
@ -56,7 +56,7 @@ class Window(QPushButton):
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.setStyleSheet( w.setStyleSheet(

View file

@ -4,22 +4,25 @@
""" """
Created on 2018年3月1日 Created on 2018年3月1日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: EmbedWindow @file: EmbedWindow
@description: 嵌入外部窗口 @description: 嵌入外部窗口
""" """
__Author__ = 'By: Irony\nQQ: 892768447\nEmail: 892768447@qq.com'
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
import win32con import win32con
import win32gui import win32gui
try:
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QWindow from PyQt5.QtGui import QWindow
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListWidget, \ 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): class Window(QWidget):
@ -113,8 +116,7 @@ if __name__ == '__main__':
import sys import sys
import cgitb import cgitb
cgitb.enable(format='txt') cgitb.enable(format='text')
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()

View file

@ -1,31 +1,33 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2018年1月29日 Created on 2018年1月29日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: FacePoints @file: FacePoints
@description: 人脸特征点 @description: 人脸特征点
''' """
from bz2 import BZ2Decompressor
import cgitb import cgitb
import os import os
import sys 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 cv2 # @UnresolvedImport
import dlib import dlib
import numpy import numpy
try:
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com" from PyQt5.QtCore import QTimer, QUrl, QFile, QIODevice
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]" from PyQt5.QtGui import QImage, QPixmap
__Version__ = "Version 1.0" 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 DOWNSCALE = 4
URL = 'http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2' URL = 'http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2'
@ -163,7 +165,7 @@ class OpencvWidget(QLabel):
if __name__ == "__main__": if __name__ == "__main__":
cgitb.enable(1, None, 5, '') cgitb.enable(format='text')
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = OpencvWidget() w = OpencvWidget()
w.show() w.show()

View file

@ -4,23 +4,21 @@
""" """
Created on 2018年10月22日 Created on 2018年10月22日
@author: Irony @author: Irony
@site: https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: FollowWindow @file: FollowWindow
@description: 跟随外部窗口 @description: 跟随外部窗口
""" """
import os import os
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
import win32gui import win32gui
try:
__Author__ = """By: Irony from PyQt5.QtCore import QTimer
QQ: 892768447 from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
Email: 892768447@qq.com""" except ImportError:
__Copyright__ = "Copyright (c) 2018 Irony" from PySide2.QtCore import QTimer
__Version__ = "Version 1.0" from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
class Window(QWidget): class Window(QWidget):
@ -53,7 +51,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
# 先检测是否已有记事本打开 # 先检测是否已有记事本打开
hwnd = win32gui.FindWindow('Notepad', None) hwnd = win32gui.FindWindow('Notepad', None)
print('hwnd', hwnd) print('hwnd', hwnd)

View file

@ -4,20 +4,22 @@
""" """
Created on 2019年4月19日 Created on 2019年4月19日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: FramelessDialog @file: FramelessDialog
@description: 无边框圆角对话框 @description: 无边框圆角对话框
""" """
try:
from PyQt5.QtCore import Qt, QSize, QTimer from PyQt5.QtCore import Qt, QSize, QTimer
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget, \ from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget, \
QGraphicsDropShadowEffect, QPushButton, QGridLayout, QSpacerItem, \ QGraphicsDropShadowEffect, QPushButton, QGridLayout, QSpacerItem, \
QSizePolicy QSizePolicy, QApplication
except ImportError:
from PySide2.QtCore import Qt, QSize, QTimer
__Author__ = "Irony" from PySide2.QtWidgets import QDialog, QVBoxLayout, QWidget, \
__Copyright__ = 'Copyright (c) 2019 Irony' QGraphicsDropShadowEffect, QPushButton, QGridLayout, QSpacerItem, \
__Version__ = 1.0 QSizePolicy, QApplication
Stylesheet = """ Stylesheet = """
#Custom_Widget { #Custom_Widget {
@ -77,7 +79,7 @@ class Dialog(QDialog):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Dialog() w = Dialog()
w.exec_() w.exec_()

View file

@ -1,24 +1,26 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- 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.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 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): class MainWindow(QWidget):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -63,7 +65,7 @@ TitleBar {
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setStyleSheet(StyleSheet) app.setStyleSheet(StyleSheet)
w = FramelessWindow() w = FramelessWindow()

View file

@ -4,21 +4,20 @@
""" """
Created on 2020年3月13日 Created on 2020年3月13日
@author: Irony @author: Irony
@site: https://pyqt.site https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: Demo.GifCursor @file: Demo.GifCursor
@description: @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 from Lib.QCursorGif import QCursorGif
__Author__ = 'Irony'
__Copyright__ = 'Copyright (c) 2020'
__Version__ = 1.0
class Window(QWidget, QCursorGif): class Window(QWidget, QCursorGif):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -38,8 +37,9 @@ class Window(QWidget, QCursorGif):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
import cgitb import cgitb
cgitb.enable(1, None, 5, '')
from PyQt5.QtWidgets import QApplication cgitb.enable(format='text')
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,7 +4,7 @@
""" """
Created on 2019年2月24日 Created on 2019年2月24日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: IsSignalConnected @file: IsSignalConnected
@description: 判断信号是否连接 @description: 判断信号是否连接
@ -13,13 +13,6 @@ Created on 2019年2月24日
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QTextBrowser 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): class Window(QWidget):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -37,8 +30,10 @@ class Window(QWidget):
# button1 clicked 是否连接: %s, %s # button1 clicked 是否连接: %s, %s
# button2 clicked 是否连接: %s, %s # button2 clicked 是否连接: %s, %s
""" % ( """ % (
self.isSignalConnected(self.button1, 'clicked()'), self.button1.receivers(self.button1.clicked) > 0, self.isSignalConnected(self.button1, 'clicked()'),
self.isSignalConnected(self.button2, 'clicked()'), self.button2.receivers(self.button2.clicked) > 0, self.button1.receivers(self.button1.clicked) > 0,
self.isSignalConnected(self.button2, 'clicked()'),
self.button2.receivers(self.button2.clicked) > 0,
)) ))
def isSignalConnected(self, obj, name): def isSignalConnected(self, obj, name):
@ -57,6 +52,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -1,27 +1,26 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年3月30日 Created on 2017年3月30日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: 单实例应用.Application @file: 单实例应用.Application
@description: @description:
''' """
from PyQt5.QtCore import QSharedMemory, pyqtSignal, Qt from PyQt5.QtCore import QSharedMemory, pyqtSignal, Qt
from PyQt5.QtNetwork import QLocalSocket, QLocalServer from PyQt5.QtNetwork import QLocalSocket, QLocalServer
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
__version__ = "0.0.1"
class SharedApplication(QApplication): class SharedApplication(QApplication):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(SharedApplication, self).__init__(*args, **kwargs) super(SharedApplication, self).__init__(*args, **kwargs)
self._running = False self._running = False
key = "SharedApplication" + __version__ key = "SharedApplication"
self._memory = QSharedMemory(key, self) self._memory = QSharedMemory(key, self)
isAttached = self._memory.isAttached() isAttached = self._memory.isAttached()
@ -41,8 +40,8 @@ class SharedApplication(QApplication):
def isRunning(self): def isRunning(self):
return self._running return self._running
class QSingleApplication(QApplication):
class QSingleApplication(QApplication):
messageReceived = pyqtSignal(str) messageReceived = pyqtSignal(str)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View file

@ -1,26 +1,29 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- 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.QtCore import Qt, pyqtSignal, QPoint
from PyQt5.QtGui import QFont, QEnterEvent, QPainter, QColor, QPen from PyQt5.QtGui import QFont, QEnterEvent, QPainter, QColor, QPen
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, \ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, \
QSpacerItem, QSizePolicy, QPushButton QSpacerItem, QSizePolicy, QPushButton
except ImportError:
from PySide2.QtCore import Qt, Signal as pyqtSignal, QPoint
# Created on 2018年4月30日 from PySide2.QtGui import QFont, QEnterEvent, QPainter, QColor, QPen
# author: Irony from PySide2.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, \
# site: https://pyqt5.com , https://github.com/892768447 QSpacerItem, QSizePolicy, QPushButton
# email: 892768447@qq.com
# file: FramelessWindow
# description:
__Author__ = """By: Irony
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
class TitleBar(QWidget): class TitleBar(QWidget):
# 窗口最小化信号 # 窗口最小化信号
windowMinimumed = pyqtSignal() windowMinimumed = pyqtSignal()
# 窗口最大化信号 # 窗口最大化信号
@ -138,7 +141,6 @@ Left, Top, Right, Bottom, LeftTop, RightTop, LeftBottom, RightBottom = range(8)
class FramelessWindow(QWidget): class FramelessWindow(QWidget):
# 四周边距 # 四周边距
Margins = 5 Margins = 5

View file

@ -4,19 +4,20 @@
""" """
Created on 2020年3月13日 Created on 2020年3月13日
@author: Irony @author: Irony
@site: https://pyqt.site https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: Demo.Lib.QCursorGif @file: Demo.Lib.QCursorGif
@description: @description:
""" """
try:
from PyQt5.QtCore import QTimer, Qt from PyQt5.QtCore import QTimer, Qt
from PyQt5.QtGui import QCursor, QPixmap from PyQt5.QtGui import QCursor, QPixmap
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
except ImportError:
from PySide2.QtCore import QTimer, Qt
__Author__ = 'Irony' from PySide2.QtGui import QCursor, QPixmap
__Copyright__ = 'Copyright (c) 2020' from PySide2.QtWidgets import QApplication
__Version__ = 1.0
class QCursorGif: class QCursorGif:

View file

@ -6,7 +6,11 @@
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
try:
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets
class Ui_NotifyForm(object): class Ui_NotifyForm(object):
def setupUi(self, NotifyForm): def setupUi(self, NotifyForm):
@ -61,7 +65,8 @@ class Ui_NotifyForm(object):
self.labelTitle.setText("") self.labelTitle.setText("")
self.labelTitle.setObjectName("labelTitle") self.labelTitle.setObjectName("labelTitle")
self.horizontalLayout_3.addWidget(self.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.horizontalLayout_3.addItem(spacerItem)
self.buttonClose = QtWidgets.QPushButton(self.widgetTitle) self.buttonClose = QtWidgets.QPushButton(self.widgetTitle)
self.buttonClose.setMinimumSize(QtCore.QSize(26, 26)) self.buttonClose.setMinimumSize(QtCore.QSize(26, 26))
@ -80,7 +85,8 @@ class Ui_NotifyForm(object):
self.horizontalLayout.setContentsMargins(0, 5, 5, 5) self.horizontalLayout.setContentsMargins(0, 5, 5, 5)
self.horizontalLayout.setSpacing(0) self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout") 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.horizontalLayout.addItem(spacerItem1)
self.buttonView = QtWidgets.QPushButton(self.widgetBottom) self.buttonView = QtWidgets.QPushButton(self.widgetBottom)
self.buttonView.setMinimumSize(QtCore.QSize(75, 25)) self.buttonView.setMinimumSize(QtCore.QSize(75, 25))
@ -102,10 +108,10 @@ class Ui_NotifyForm(object):
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)
NotifyForm = QtWidgets.QWidget() NotifyForm = QtWidgets.QWidget()
ui = Ui_NotifyForm() ui = Ui_NotifyForm()
ui.setupUi(NotifyForm) ui.setupUi(NotifyForm)
NotifyForm.show() NotifyForm.show()
sys.exit(app.exec_()) sys.exit(app.exec_())

View file

@ -8,7 +8,10 @@
# run again. Do not edit this file unless you know what you are doing. # run again. Do not edit this file unless you know what you are doing.
try:
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets
class Ui_FormFrameless(object): class Ui_FormFrameless(object):
@ -28,7 +31,8 @@ class Ui_FormFrameless(object):
self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setSpacing(0) self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout") 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.horizontalLayout.addItem(spacerItem)
self.buttonMinimum = QtWidgets.QPushButton(self.widgetTitleBar) self.buttonMinimum = QtWidgets.QPushButton(self.widgetTitleBar)
self.buttonMinimum.setMinimumSize(QtCore.QSize(36, 36)) self.buttonMinimum.setMinimumSize(QtCore.QSize(36, 36))
@ -83,7 +87,8 @@ class Ui_FormFrameless(object):
self.buttonNormal.setText(_translate("FormFrameless", "2")) self.buttonNormal.setText(_translate("FormFrameless", "2"))
self.buttonClose.setToolTip(_translate("FormFrameless", "Close")) self.buttonClose.setToolTip(_translate("FormFrameless", "Close"))
self.buttonClose.setText(_translate("FormFrameless", "r")) 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" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\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" "</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__": if __name__ == "__main__":
import sys import sys
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)
FormFrameless = QtWidgets.QWidget() FormFrameless = QtWidgets.QWidget()
ui = Ui_FormFrameless() ui = Ui_FormFrameless()

View file

@ -2,28 +2,27 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""Created on 2018年8月2日 """Created on 2018年8月2日
author: Irony author: Irony
site: https://pyqt5.com , https://github.com/892768447 site: https://pyqt.site , https://github.com/PyQt5
email: 892768447@qq.com email: 892768447@qq.com
file: win无边框调整大小 file: win无边框调整大小
description: description:
""" """
from ctypes.wintypes import POINT
import ctypes.wintypes 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 win32api
import win32con import win32con
import win32gui import win32gui
try:
__Author__ = """By: Irony from PyQt5.QtCore import Qt
QQ: 892768447 from PyQt5.QtWidgets import QWidget, QPushButton, QApplication
Email: 892768447@qq.com""" from PyQt5.QtWinExtras import QtWin
__Copyright__ = 'Copyright (c) 2018 Irony' except ImportError:
__Version__ = 1.0 from PySide2.QtCore import Qt
from PySide2.QtWidgets import QWidget, QPushButton, QApplication
from PySide2.QtWinExtras import QtWin
class MINMAXINFO(ctypes.Structure): class MINMAXINFO(ctypes.Structure):
@ -37,7 +36,6 @@ class MINMAXINFO(ctypes.Structure):
class Window(QWidget): class Window(QWidget):
BorderWidth = 5 BorderWidth = 5
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -121,7 +119,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
btn = QPushButton('exit', w, clicked=app.quit) btn = QPushButton('exit', w, clicked=app.quit)

View file

@ -10,10 +10,16 @@ Created on 2018年4月30日
@description: @description:
""" """
from Lib.ui_frameless import Ui_FormFrameless try:
from PyQt5.QtCore import QTimer, Qt, QEvent, QObject from PyQt5.QtCore import QTimer, Qt, QEvent, QObject
from PyQt5.QtGui import QWindow, QPainter, QColor, QMouseEvent from PyQt5.QtGui import QWindow, QPainter, QColor, QMouseEvent
from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox 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): class FramelessObject(QObject):

View file

@ -4,30 +4,30 @@
""" """
Created on 2018年9月9日 Created on 2018年9月9日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: Notification @file: Notification
@description: @description:
""" """
import base64 import base64
try:
from PyQt5.QtCore import Qt, QRectF, QSize, pyqtSignal, QTimer from PyQt5.QtCore import Qt, QRectF, QSize, pyqtSignal, QTimer
from PyQt5.QtGui import QPixmap, QImage, QPainter, QPainterPath, \ from PyQt5.QtGui import QPixmap, QImage, QPainter, QPainterPath, \
QColor QColor
from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, \ from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, \
QGridLayout, QSpacerItem, QSizePolicy, QGraphicsDropShadowEffect, \ QGridLayout, QSpacerItem, QSizePolicy, QGraphicsDropShadowEffect, \
QListWidget, QListWidgetItem QListWidget, QListWidgetItem, QApplication, QPushButton
except ImportError:
from PySide2.QtCore import Qt, QRectF, QSize, Signal as pyqtSignal, QTimer
__Author__ = """By: Irony from PySide2.QtGui import QPixmap, QImage, QPainter, QPainterPath, \
QQ: 892768447 QColor
Email: 892768447@qq.com""" from PySide2.QtWidgets import QWidget, QLabel, QHBoxLayout, \
__Copyright__ = 'Copyright (c) 2018 Irony' QGridLayout, QSpacerItem, QSizePolicy, QGraphicsDropShadowEffect, \
__Version__ = 1.0 QListWidget, QListWidgetItem, QApplication, QPushButton
class NotificationIcon: class NotificationIcon:
Info, Success, Warning, Error, Close = range(5) Info, Success, Warning, Error, Close = range(5)
Types = { Types = {
Info: None, Info: None,
@ -39,10 +39,14 @@ class NotificationIcon:
@classmethod @classmethod
def init(cls): 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.Info] = QPixmap(QImage.fromData(base64.b64decode(
cls.Types[cls.Success] = QPixmap(QImage.fromData(base64.b64decode('iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACZUlEQVRYR8VXS3LTQBDtVsDbcAPMCbB3limkcAKSG4QFdnaYE2BOQLKzxSLJCeAGSUQheSnfwLmB2VJhXmpExpFHI2sk2RWv5FJPv9evP9NieuIfPzE+VSJw8qt3IMDvmahDoDYxt2UAACXMWIIowR5ffn8TJbaBWRE4CXvHAH9RgKXOgQUI48CfXZbZbiTw8Xe/w3d0zkydMkem91IZpyWOJu5sUXS+kEAqt3B+MNOLOuDqDEBLxxFHk7eza5MfIwEJDjhXTYD1s8zinYlEjsCD7FdNI9cJpEq0RFdPR47AMOzLCn69zegz6UgCP+pmfa8RSKudnPNdgCufTOLDxJtdPP7PoA1Cd8HEL5sSUCCD0B0x8bc1f8Bi6sevcgS2VXh6hMOwDz0gsUddNaxWKRjeuKfE/KlJ9Dq4UYH/o/Ns6scj+bgiMAjdayb26xLQwTfVEwg3gRcf6ARq578KuLo7VDc8psCQqwfjr4EfjYvkrAquFJ56UYpdSkAZSmNd1rrg0leOQFELgvA58OJTxVyRaAJORPOpF6UXnFUR5sDiXjs7UqsOMGMRlrWhTkJXpFL3mNrQZhA1lH3F0TiI5FurUQyMpn58VjhkSqQA4Tbw4nSVW6sBU5VXktXSeONlJH3s8jrOVr9RgVSFuNcWfzlh5n3LoKzMAPxxWuiULiQpiR2sZNnCyzIuWUr5Z1Ml0sgdHFZaShVDuR86/0huL3VXtDk/F4e11vKsTHLSCeKx7bYkW80hjLOrV1GhWH0ZrSlyh2MwdZhYfi8oZeYgLBmUiGd8sfVPM6syr2lUSYGaGBuP3QN6rVUwYV/egwAAAABJRU5ErkJggg=='))) '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.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.Success] = QPixmap(QImage.fromData(base64.b64decode(
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='))) '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( cls.Types[cls.Close] = QPixmap(QImage.fromData(base64.b64decode(
'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAeElEQVQ4T2NkoBAwUqifgboGzJy76AIjE3NCWmL0BWwumzV/qcH/f38XpCfHGcDkUVwAUsDw9+8GBmbmAHRDcMlheAGbQnwGYw0DZA1gp+JwFUgKZyDCDQGpwuIlrGGAHHAUGUCRFygKRIqjkeKERE6+oG5eIMcFAOqSchGwiKKAAAAAAElFTkSuQmCC'))) 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAeElEQVQ4T2NkoBAwUqifgboGzJy76AIjE3NCWmL0BWwumzV/qcH/f38XpCfHGcDkUVwAUsDw9+8GBmbmAHRDcMlheAGbQnwGYw0DZA1gp+JwFUgKZyDCDQGpwuIlrGGAHHAUGUCRFygKRIqjkeKERE6+oG5eIMcFAOqSchGwiKKAAAAAAElFTkSuQmCC')))
@ -52,7 +56,6 @@ class NotificationIcon:
class NotificationItem(QWidget): class NotificationItem(QWidget):
closed = pyqtSignal(QListWidgetItem) closed = pyqtSignal(QListWidgetItem)
def __init__(self, title, message, item, *args, ntype=0, callback=None, **kwargs): def __init__(self, title, message, item, *args, ntype=0, callback=None, **kwargs):
@ -152,7 +155,6 @@ class NotificationItem(QWidget):
class NotificationWindow(QListWidget): class NotificationWindow(QListWidget):
_instance = None _instance = None
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -243,15 +245,18 @@ class NotificationWindow(QListWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
import cgitb 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) app = QApplication(sys.argv)
w = QWidget() w = QWidget()
layout = QHBoxLayout(w) layout = QHBoxLayout(w)
def callback(): def callback():
print('回调点击') print('回调点击')
layout.addWidget(QPushButton( layout.addWidget(QPushButton(
'Info', w, clicked=lambda: NotificationWindow.info('提示', '这是一条会自动关闭的消息', callback=callback))) 'Info', w, clicked=lambda: NotificationWindow.info('提示', '这是一条会自动关闭的消息', callback=callback)))
layout.addWidget(QPushButton( layout.addWidget(QPushButton(

View file

@ -3,23 +3,22 @@
""" """
Created on 2018年6月8日 Created on 2018年6月8日
author: Irony author: Irony
site: https://pyqt5.com , https://github.com/892768447 site: https://pyqt.site , https://github.com/PyQt5
email: 892768447@qq.com email: 892768447@qq.com
file: ProbeWindow file: ProbeWindow
description: 简单探测窗口和放大截图 description: 简单探测窗口和放大截图
""" """
import win32gui
try:
from PyQt5.QtCore import Qt, QRect from PyQt5.QtCore import Qt, QRect
from PyQt5.QtGui import QPainter, QPen, QCursor, QColor from PyQt5.QtGui import QPainter, QPen, QCursor, QColor
from PyQt5.QtWidgets import QLabel, QWidget, QApplication from PyQt5.QtWidgets import QLabel, QWidget, QApplication
import win32gui except ImportError:
from PySide2.QtCore import Qt, QRect
from PySide2.QtGui import QPainter, QPen, QCursor, QColor
__Author__ = """By: Irony from PySide2.QtWidgets import QLabel, QWidget, QApplication
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
class FrameWidget(QWidget): class FrameWidget(QWidget):
@ -116,6 +115,7 @@ class Label(QLabel):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setQuitOnLastWindowClosed(True) app.setQuitOnLastWindowClosed(True)
w = Label() w = Label()

View file

@ -4,7 +4,7 @@
""" """
Created on 2019年3月8日 Created on 2019年3月8日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: Threading.QtThreading @file: Threading.QtThreading
@description: @description:
@ -12,19 +12,15 @@ Created on 2019年3月8日
from threading import Thread from threading import Thread
from time import sleep from time import sleep
try:
from PyQt5.QtCore import QObject, pyqtSignal, QTimer, Qt from PyQt5.QtCore import QObject, pyqtSignal, QTimer, Qt
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QProgressBar from PyQt5.QtWidgets import QWidget, QVBoxLayout, QProgressBar, QApplication
except ImportError:
from PySide2.QtCore import QObject, Signal as pyqtSignal, QTimer, Qt
__Author__ = """By: Irony from PySide2.QtWidgets import QWidget, QVBoxLayout, QProgressBar, QApplication
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = 'Copyright (c) 2019 Irony'
__Version__ = 1.0
class _Signals(QObject): class _Signals(QObject):
updateProgress = pyqtSignal(int) updateProgress = pyqtSignal(int)
@ -63,7 +59,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -1,26 +1,26 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2018年1月17日 Created on 2018年1月17日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: RestartWindow @file: RestartWindow
@description: 窗口重启 @description: 窗口重启
''' """
try:
from PyQt5.QtCore import pyqtSignal from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit, \ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit, \
QMessageBox QMessageBox, QApplication
except ImportError:
from PySide2.QtCore import Signal as pyqtSignal
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com" from PySide2.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit, \
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]" QMessageBox, QApplication
__Version__ = "Version 1.0"
class RestartWindow(QWidget): class RestartWindow(QWidget):
restarted = pyqtSignal(QWidget, str) restarted = pyqtSignal(QWidget, str)
_Self = None # 很重要,保留窗口引用 _Self = None # 很重要,保留窗口引用
@ -55,7 +55,7 @@ class RestartWindow(QWidget):
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = RestartWindow("test") w = RestartWindow("test")
w.show() w.show()

View file

@ -4,15 +4,19 @@
""" """
Created on 2021/4/13 Created on 2021/4/13
@author: Irony @author: Irony
@site: https://github.com/PyQt5 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ScreenNotify @file: ScreenNotify
@description: 屏幕分辨率DPI变化通知 @description: 屏幕分辨率DPI变化通知
""" """
import sys import sys
try:
from PyQt5.QtCore import QTimer, QRect 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): class Window(QPlainTextEdit):
@ -27,22 +31,24 @@ class Window(QPlainTextEdit):
self.m_timer.setSingleShot(True) # **重要** 保证多次信号尽量少的调用函数 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变化 # 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): def onSolutionChanged(self):
# 获取主屏幕 # 获取主屏幕
screen = qApp.primaryScreen() screen = QApplication.instance().primaryScreen()
if self.m_rect == screen.availableVirtualGeometry(): if self.m_rect == screen.availableVirtualGeometry():
return return
self.m_rect = screen.availableVirtualGeometry() self.m_rect = screen.availableVirtualGeometry()
# 所有屏幕可用大小 # 所有屏幕可用大小
self.appendPlainText('\navailableVirtualGeometry: {0}'.format(str(screen.availableVirtualGeometry()))) self.appendPlainText('\navailableVirtualGeometry: {0}'.format(str(screen.availableVirtualGeometry())))
# 获取所有屏幕 # 获取所有屏幕
screens = qApp.screens() screens = QApplication.instance().screens()
for screen in screens: for screen in screens:
self.appendPlainText( self.appendPlainText(
'screen: {0}, geometry({1}), availableGeometry({2}), logicalDotsPerInch({3}), ' 'screen: {0}, geometry({1}), availableGeometry({2}), logicalDotsPerInch({3}), '

View file

@ -1,3 +1,4 @@
from ctypes import CDLL from ctypes import CDLL
dll = CDLL('Data/ScreenShot.dll') dll = CDLL('Data/ScreenShot.dll')
dll.PrScrn() dll.PrScrn()

View file

@ -1,28 +1,29 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年3月30日 Created on 2017年3月30日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: TestQSharedMemory @file: TestQSharedMemory
@description: @description:
''' """
from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QWidget
from Lib.Application import SharedApplication # @UnresolvedImport from Lib.Application import SharedApplication # @UnresolvedImport
__version__ = "0.0.1"
class Widget(QWidget): class Widget(QWidget):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Widget, self).__init__(*args, **kwargs) super(Widget, self).__init__(*args, **kwargs)
if __name__ == "__main__": if __name__ == "__main__":
import sys, os import sys, os
print(os.getpid()) print(os.getpid())
app = SharedApplication(sys.argv) app = SharedApplication(sys.argv)
if app.isRunning(): if app.isRunning():

View file

@ -4,7 +4,7 @@
""" """
Created on 2019年4月23日 Created on 2019年4月23日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ShowFrameWhenDrag @file: ShowFrameWhenDrag
@description: 调整窗口显示边框 @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, \ from ctypes import sizeof, windll, c_int, byref, c_long, c_void_p, c_ulong, c_longlong, \
c_ulonglong, WINFUNCTYPE, c_uint c_ulonglong, WINFUNCTYPE, c_uint
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel try:
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QApplication
except ImportError:
__Author__ = 'Irony' from PySide2.QtWidgets import QWidget, QVBoxLayout, QLabel, QApplication
__Copyright__ = 'Copyright (c) 2019 Irony'
__Version__ = 1.0
if sizeof(c_long) == sizeof(c_void_p): if sizeof(c_long) == sizeof(c_void_p):
WPARAM = c_ulong WPARAM = c_ulong
@ -82,7 +80,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -1,28 +1,29 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年3月30日 Created on 2017年3月30日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: TestQSingleApplication @file: TestQSingleApplication
@description: @description:
''' """
from PyQt5.QtWidgets import QTextEdit from PyQt5.QtWidgets import QTextEdit
from Lib.Application import QSingleApplication # @UnresolvedImport from Lib.Application import QSingleApplication # @UnresolvedImport
__version__ = "0.0.1"
class Widget(QTextEdit): class Widget(QTextEdit):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Widget, self).__init__(*args, **kwargs) super(Widget, self).__init__(*args, **kwargs)
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
app = QSingleApplication(sys.argv) app = QSingleApplication(sys.argv)
if app.isRunning(): if app.isRunning():
app.sendMessage("app is running") app.sendMessage("app is running")

View file

@ -1,23 +1,25 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年4月5日 Created on 2017年4月5日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: widgets.WidgetCode @file: widgets.WidgetCode
@description: @description:
''' """
from random import sample
import string import string
from random import sample
try:
from PyQt5.QtCore import Qt, qrand, QPointF, QPoint, QBasicTimer from PyQt5.QtCore import Qt, qrand, QPointF, QPoint, QBasicTimer
from PyQt5.QtGui import QPainter, QBrush, QPen, QPalette, QFontMetrics from PyQt5.QtGui import QPainter, QBrush, QPen, QPalette, QFontMetrics, QFontDatabase
from PyQt5.QtWidgets import QLabel from PyQt5.QtWidgets import QLabel, QApplication, QWidget, QHBoxLayout, QLineEdit
except ImportError:
from PySide2.QtCore import Qt, qrand, QPointF, QPoint, QBasicTimer
__version__ = "0.0.1" from PySide2.QtGui import QPainter, QBrush, QPen, QPalette, QFontMetrics, QFontDatabase
from PySide2.QtWidgets import QLabel, QApplication, QWidget, QHBoxLayout, QLineEdit
DEF_NOISYPOINTCOUNT = 60 # 噪点数量 DEF_NOISYPOINTCOUNT = 60 # 噪点数量
COLORLIST = ("black", "gray", "red", "green", "blue", "magenta") COLORLIST = ("black", "gray", "red", "green", "blue", "magenta")
@ -28,6 +30,7 @@ FONT = "<font color=\"{color}\">{word}</font>"
WORDS = list(string.ascii_letters + string.digits) WORDS = list(string.ascii_letters + string.digits)
SINETABLE = (0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38) SINETABLE = (0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38)
class WidgetCode(QLabel): class WidgetCode(QLabel):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -107,11 +110,10 @@ class WidgetCode(QLabel):
painter.drawText(x, y - ((SINETABLE[index] * metrics.height()) / 400), ch) painter.drawText(x, y - ((SINETABLE[index] * metrics.height()) / 400), ch)
x += metrics.width(ch) x += metrics.width(ch)
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout
from PyQt5.QtGui import QFontDatabase
from PyQt5.QtWidgets import QLineEdit
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setApplicationName("Validate Code") app.setApplicationName("Validate Code")
QFontDatabase.addApplicationFont("Data/itckrist.ttf") QFontDatabase.addApplicationFont("Data/itckrist.ttf")

View file

@ -4,18 +4,18 @@
""" """
Created on 2018年3月1日 Created on 2018年3月1日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: WeltHideWindow @file: WeltHideWindow
@description: 简单的窗口贴边隐藏 @description: 简单的窗口贴边隐藏
""" """
try:
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
except ImportError:
from PySide2.QtCore import Qt
__Author__ = 'By: Irony\nQQ: 892768447\nEmail: 892768447@qq.com' from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
class WeltHideWindow(QWidget): class WeltHideWindow(QWidget):
@ -88,7 +88,7 @@ class WeltHideWindow(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = WeltHideWindow() w = WeltHideWindow()
w.show() w.show()

View file

@ -1,27 +1,27 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年3月30日 Created on 2017年3月30日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: WindowNotify @file: WindowNotify
@description: 右下角弹窗 @description: 右下角弹窗
''' """
import webbrowser import webbrowser
try:
from PyQt5.QtCore import Qt, QPropertyAnimation, QPoint, QTimer, pyqtSignal 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 from Lib.UiNotify import Ui_NotifyForm # @UnresolvedImport
__version__ = "0.0.1"
class WindowNotify(QWidget, Ui_NotifyForm): class WindowNotify(QWidget, Ui_NotifyForm):
SignalClosed = pyqtSignal() # 弹窗关闭信号 SignalClosed = pyqtSignal() # 弹窗关闭信号
def __init__(self, title="", content="", timeout=5000, *args, **kwargs): def __init__(self, title="", content="", timeout=5000, *args, **kwargs):
@ -118,6 +118,7 @@ class WindowNotify(QWidget, Ui_NotifyForm):
self.animation.start() self.animation.start()
# 弹出5秒后,如果没有焦点则弹回去 # 弹出5秒后,如果没有焦点则弹回去
self._timer.start(self._timeout) self._timer.start(self._timeout)
# QTimer.singleShot(self._timeout, self.closeAnimation) # QTimer.singleShot(self._timeout, self.closeAnimation)
def closeAnimation(self): def closeAnimation(self):
@ -158,9 +159,10 @@ class WindowNotify(QWidget, Ui_NotifyForm):
if self._timeouted: if self._timeouted:
QTimer.singleShot(1000, self.closeAnimation) QTimer.singleShot(1000, self.closeAnimation)
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
from PyQt5.QtWidgets import QApplication, QHBoxLayout
app = QApplication(sys.argv) app = QApplication(sys.argv)
window = QWidget() window = QWidget()

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
''' """
@author: wxj @author: wxj
@license: (C) Hefei tongzhi electromechanical control technology co.LTD @license: (C) Hefei tongzhi electromechanical control technology co.LTD
@contact: @contact:
@ -8,4 +8,4 @@
@file: __init__.py.py @file: __init__.py.py
@time: 2019/5/21 18:07 @time: 2019/5/21 18:07
@desc: @desc:
''' """

View file

@ -8,6 +8,7 @@
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
class graph_Form(object): class graph_Form(object):
def setupUi(self, Form): def setupUi(self, Form):
Form.setObjectName("Form") Form.setObjectName("Form")
@ -50,4 +51,3 @@ class graph_Form(object):
self.label.setText(_translate("Form", "图形分析")) self.label.setText(_translate("Form", "图形分析"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _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")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Form", "Tab 2"))

View file

@ -8,6 +8,7 @@
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
class graph_Form(object): class graph_Form(object):
def setupUi(self, Form): def setupUi(self, Form):
Form.setObjectName("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), _translate("Form", "折线图"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Form", "Tab 2")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Form", "Tab 2"))
self.pushButton_7.setText(_translate("Form", "分析")) self.pushButton_7.setText(_translate("Form", "分析"))

View file

@ -1,19 +1,22 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
''' """
Created on 2019年5月21日 Created on 2019年5月21日
@author: weike32 @author: weike32
@site: https://pyqt5.com ,https://github.com/weike32 @site: https://pyqt.site ,https://github.com/weike32
@email: 394967319@qq.com @email: 394967319@qq.com
@file: CopyContent @file: CopyContent
@description: 禁止右键添加滑动窗口点击按钮生成图片自定义Y轴坐标背景颜色调整 @description: 禁止右键添加滑动窗口点击按钮生成图片自定义Y轴坐标背景颜色调整
''' """
import sys import sys
from PyQt5.QtWidgets import QDialog, QApplication, QWidget
from qtpy import QtWidgets
import pyqtgraph as pg 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 from PyQtGraph.Data.graphTest import graph_Form
class CustomViewBox(pg.ViewBox): class CustomViewBox(pg.ViewBox):
def __init__(self, *args, **kwds): def __init__(self, *args, **kwds):
pg.ViewBox.__init__(self, *args, **kwds) pg.ViewBox.__init__(self, *args, **kwds)
@ -31,6 +34,7 @@ class CustomViewBox(pg.ViewBox):
# pg.ViewBox.wheelEvent(self, ev, axis) # pg.ViewBox.wheelEvent(self, ev, axis)
ev.ignore() ev.ignore()
class graphAnalysis(QDialog, graph_Form): class graphAnalysis(QDialog, graph_Form):
def __init__(self): def __init__(self):
super(graphAnalysis, self).__init__() super(graphAnalysis, self).__init__()
@ -39,14 +43,14 @@ class graphAnalysis(QDialog,graph_Form):
self.tabWidget.clear() self.tabWidget.clear()
def test(self): def test(self):
tab1 = QtWidgets.QWidget() tab1 = QWidget()
scrollArea = QtWidgets.QScrollArea(tab1) scrollArea = QScrollArea(tab1)
scrollArea.setMinimumSize(984, 550) scrollArea.setMinimumSize(984, 550)
scrollArea.setWidgetResizable(True) scrollArea.setWidgetResizable(True)
labelsContainer = QWidget() labelsContainer = QWidget()
labelsContainer.setMinimumSize(0, 1500) labelsContainer.setMinimumSize(0, 1500)
scrollArea.setWidget(labelsContainer) 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'] 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] value = [1.2, 2, 1, 4]
xdict = dict(enumerate(time)) xdict = dict(enumerate(time))
@ -56,16 +60,18 @@ class graphAnalysis(QDialog,graph_Form):
plt.setBackground(background=None) plt.setBackground(background=None)
plt.plot(list(xdict.keys()), value) plt.plot(list(xdict.keys()), value)
plt.getPlotItem().getAxis("bottom").setTicks(ticks) plt.getPlotItem().getAxis("bottom").setTicks(ticks)
temp = QtWidgets.QWidget() temp = QWidget()
temp.setMinimumSize(900, 300) temp.setMinimumSize(900, 300)
temp.setMaximumSize(900, 300) temp.setMaximumSize(900, 300)
layout1 = QtWidgets.QVBoxLayout(temp) layout1 = QVBoxLayout(temp)
layout1.addWidget(plt) layout1.addWidget(plt)
layout.addWidget(temp) 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) layout.addItem(spacerItem)
self.tabWidget.addTab(tab1, '这里tabWidget修改标签') self.tabWidget.addTab(tab1, '这里tabWidget修改标签')
if __name__ == "__main__": if __name__ == "__main__":
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = graphAnalysis() w = graphAnalysis()

View file

@ -1,18 +1,20 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
''' """
Created on 2019年5月2日 Created on 2019年5月2日
@author: weike32 @author: weike32
@site: https://pyqt5.com ,https://github.com/weike32 @site: https://pyqt.site ,https://github.com/weike32
@email: 394967319@qq.com @email: 394967319@qq.com
@file: CopyContent @file: CopyContent
@description: 查阅了很多博客如果有异可以联系作者邮箱本Demo仅作学习参考用保有后续相关权益 @description: 查阅了很多博客如果有异可以联系作者邮箱本Demo仅作学习参考用保有后续相关权益
''' """
import sys import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5 import QtCore
import numpy as np import numpy as np
import pyqtgraph as pg import pyqtgraph as pg
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication, QMainWindow
class Ui_Form(object): class Ui_Form(object):
def setupUi(self, Form): def setupUi(self, Form):
@ -22,6 +24,7 @@ class Ui_Form(object):
self.graphicsView.setGeometry(QtCore.QRect(75, 131, 621, 441)) self.graphicsView.setGeometry(QtCore.QRect(75, 131, 621, 441))
self.graphicsView.setObjectName("graphicsView") self.graphicsView.setObjectName("graphicsView")
class MyWindow(QMainWindow, Ui_Form): class MyWindow(QMainWindow, Ui_Form):
def __init__(self, parent=None): def __init__(self, parent=None):
super(MyWindow, self).__init__(parent) super(MyWindow, self).__init__(parent)
@ -33,10 +36,13 @@ class MyWindow(QMainWindow, Ui_Form):
self.graphicsView.addItem(self.label) self.graphicsView.addItem(self.label)
self.setMouseTracking(True) self.setMouseTracking(True)
self.graphicsView.scene().sigMouseMoved.connect(self.onMouseMoved) self.graphicsView.scene().sigMouseMoved.connect(self.onMouseMoved)
def onMouseMoved(self, evt): def onMouseMoved(self, evt):
if self.graphicsView.plotItem.vb.mapSceneToView(evt): if self.graphicsView.plotItem.vb.mapSceneToView(evt):
point = 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())) self.label.setHtml("<p style='color:white'>横坐标:{0}</p>".format(point.x()))
if __name__ == '__main__': if __name__ == '__main__':
app = QApplication(sys.argv) app = QApplication(sys.argv)
myWin = MyWindow() myWin = MyWindow()

View file

@ -1,18 +1,19 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
''' """
Created on 2019年8月17日 Created on 2019年8月17日
@author: weike32 @author: weike32
@site: https://pyqt5.com ,https://github.com/weike32 @site: https://pyqt.site ,https://github.com/weike32
@email: 394967319@qq.com @email: 394967319@qq.com
@file: CopyContent @file: CopyContent
@description: @description:
''' """
import sys import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QApplication, QWidget
from qtpy import QtWidgets
import pyqtgraph as pg 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 from PyQtGraph.Data.graphAnalysis import graph_Form
@ -26,11 +27,14 @@ class CustomViewBox(pg.ViewBox):
def mouseClickEvent(self, ev): def mouseClickEvent(self, ev):
if ev.button() == pg.QtCore.Qt.RightButton: if ev.button() == pg.QtCore.Qt.RightButton:
self.autoRange() self.autoRange()
def mouseDragEvent(self, ev): def mouseDragEvent(self, ev):
pg.ViewBox.mouseDragEvent(self, ev) pg.ViewBox.mouseDragEvent(self, ev)
def wheelEvent(self, ev, axis=None): def wheelEvent(self, ev, axis=None):
ev.ignore() ev.ignore()
class graphAnalysis(QDialog, graph_Form): class graphAnalysis(QDialog, graph_Form):
def __init__(self): def __init__(self):
super(graphAnalysis, self).__init__() super(graphAnalysis, self).__init__()
@ -49,15 +53,15 @@ class graphAnalysis(QDialog,graph_Form):
def test(self): def test(self):
tab1 = QtWidgets.QWidget() tab1 = QWidget()
scrollArea = QtWidgets.QScrollArea(tab1) scrollArea = QScrollArea(tab1)
scrollArea.setMinimumSize(650, 550) scrollArea.setMinimumSize(650, 550)
scrollArea.setWidgetResizable(True) scrollArea.setWidgetResizable(True)
labelsContainer = QWidget() labelsContainer = QWidget()
labelsContainer.setMinimumSize(0, 3000 + 200) labelsContainer.setMinimumSize(0, 3000 + 200)
scrollArea.setWidget(labelsContainer) 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'] 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] value = [1.2, 2, 1, 4]
@ -70,19 +74,21 @@ class graphAnalysis(QDialog,graph_Form):
plt1.setBackground(background=None) plt1.setBackground(background=None)
plt1.plot(list(xdict.keys()), value) plt1.plot(list(xdict.keys()), value)
plt1.getPlotItem().getAxis("bottom").setTicks(ticks) plt1.getPlotItem().getAxis("bottom").setTicks(ticks)
temp1 = QtWidgets.QWidget() temp1 = QWidget()
temp1.setMinimumSize(600, 300) temp1.setMinimumSize(600, 300)
temp1.setMaximumSize(600, 300) temp1.setMaximumSize(600, 300)
layout2 = QtWidgets.QVBoxLayout(temp1) layout2 = QVBoxLayout(temp1)
layout2.addWidget(plt1) layout2.addWidget(plt1)
layout.addWidget(temp1) 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) layout.addItem(spacerItem)
# print(layout.count()) # print(layout.count())
self.tabWidget.addTab(tab1, '12') self.tabWidget.addTab(tab1, '12')
for i in range(self.tabWidget.count()): for i in range(self.tabWidget.count()):
self.tabWidget.widget(i) self.tabWidget.widget(i)
if __name__ == "__main__": if __name__ == "__main__":
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = graphAnalysis() w = graphAnalysis()

View file

@ -1,27 +1,31 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
''' """
Created on 2019年5月21日 Created on 2019年5月21日
@author: weike32 @author: weike32
@site: https://pyqt5.com ,https://github.com/weike32 @site: https://pyqt.site ,https://github.com/weike32
@email: 394967319@qq.com @email: 394967319@qq.com
@file: CopyContent @file: CopyContent
@description: 工具类 @description: 工具类
''' """
import pyqtgraph as pg
from pyqtgraph.exporters.ImageExporter import ImageExporter, Exporter from pyqtgraph.exporters.ImageExporter import ImageExporter, Exporter
from pyqtgraph.parametertree import Parameter from pyqtgraph.parametertree import Parameter
import pyqtgraph as pg
# 不用修改源码,重加载,解决右键保存图片异常 # 不用修改源码,重加载,解决右键保存图片异常
def widthChanged(self): def widthChanged(self):
sr = self.getSourceRect() sr = self.getSourceRect()
ar = float(sr.height()) / sr.width() ar = float(sr.height()) / sr.width()
self.params.param('height').setValue(int(self.params['width'] * ar), blockSignal=self.heightChanged) self.params.param('height').setValue(int(self.params['width'] * ar), blockSignal=self.heightChanged)
def heightChanged(self): def heightChanged(self):
sr = self.getSourceRect() sr = self.getSourceRect()
ar = float(sr.width()) / sr.height() ar = float(sr.width()) / sr.height()
self.params.param('width').setValue(int(self.params['height'] * ar), blockSignal=self.widthChanged) self.params.param('width').setValue(int(self.params['height'] * ar), blockSignal=self.widthChanged)
def New__init__(self, item): def New__init__(self, item):
Exporter.__init__(self, item) Exporter.__init__(self, item)
tr = self.getTargetRect() tr = self.getTargetRect()
@ -42,10 +46,13 @@ def New__init__(self, item):
]) ])
self.params.param('width').sigValueChanged.connect(self.widthChanged) self.params.param('width').sigValueChanged.connect(self.widthChanged)
self.params.param('height').sigValueChanged.connect(self.heightChanged) self.params.param('height').sigValueChanged.connect(self.heightChanged)
ImageExporter.heightChanged = heightChanged ImageExporter.heightChanged = heightChanged
ImageExporter.widthChanged = widthChanged ImageExporter.widthChanged = widthChanged
ImageExporter.__init__ = New__init__ ImageExporter.__init__ = New__init__
# 解决自定义坐标轴密集显示 # 解决自定义坐标轴密集显示
class MyStringAxis(pg.AxisItem): class MyStringAxis(pg.AxisItem):
def __init__(self, xdict, *args, **kwargs): def __init__(self, xdict, *args, **kwargs):
@ -62,6 +69,8 @@ class MyStringAxis(pg.AxisItem):
vstr = "" vstr = ""
strings.append(vstr) strings.append(vstr)
return strings return strings
# 禁止鼠标事件 # 禁止鼠标事件
class CustomViewBox(pg.ViewBox): class CustomViewBox(pg.ViewBox):
def __init__(self, *args, **kwds): def __init__(self, *args, **kwds):

View file

@ -1,24 +1,20 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年4月6日 Created on 2017年4月6日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ViewOffice @file: ViewOffice
@description: @description:
''' """
from PyQt5.QAxContainer import QAxWidget from PyQt5.QAxContainer import QAxWidget
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QFileDialog, \ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QFileDialog, \
QMessageBox QMessageBox
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
__Version__ = "Version 1.0"
class AxWidget(QWidget): class AxWidget(QWidget):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -68,6 +64,7 @@ class AxWidget(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = AxWidget() w = AxWidget()
w.show() w.show()

View file

@ -1,19 +1,23 @@
""" """
Created on 2018年1月30日 Created on 2018年1月30日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: CalendarQssStyle @file: CalendarQssStyle
@description: 日历美化样式 @description: 日历美化样式
""" """
import sys import sys
try:
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QTextCharFormat, QBrush, QColor from PyQt5.QtGui import QTextCharFormat, QBrush, QColor
from PyQt5.QtWidgets import QApplication, QCalendarWidget 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 { #qt_calendar_navigationbar {
background-color: rgb(0, 188, 212); background-color: rgb(0, 188, 212);
@ -101,7 +105,7 @@ CalendarWidget QToolButton::menu-indicator {
outline: 0px;/*去掉选中后的虚线框*/ outline: 0px;/*去掉选中后的虚线框*/
selection-background-color: rgb(0, 188, 212); /*选中背景颜色*/ selection-background-color: rgb(0, 188, 212); /*选中背景颜色*/
} }
''' """
class CalendarWidget(QCalendarWidget): class CalendarWidget(QCalendarWidget):

View file

@ -3,8 +3,8 @@
""" """
Created on 2018年1月27日 Created on 2018年1月27日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: CityLinkage @file: CityLinkage
@description: 下拉联动 @description: 下拉联动
@ -12,16 +12,18 @@ Created on 2018年1月27日
import json import json
import sys import sys
import chardet
try:
from PyQt5.QtCore import Qt, QSortFilterProxyModel, QRegExp from PyQt5.QtCore import Qt, QSortFilterProxyModel, QRegExp
from PyQt5.QtGui import QStandardItemModel, QStandardItem from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QComboBox, \ from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QComboBox, \
QLabel, QSpacerItem, QSizePolicy QLabel, QSpacerItem, QSizePolicy
import chardet except ImportError:
from PySide2.QtCore import Qt, QSortFilterProxyModel, QRegExp
from PySide2.QtGui import QStandardItemModel, QStandardItem
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com" from PySide2.QtWidgets import QWidget, QApplication, QHBoxLayout, QComboBox, \
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]" QLabel, QSpacerItem, QSizePolicy
__Version__ = "Version 1.0"
class SortFilterProxyModel(QSortFilterProxyModel): class SortFilterProxyModel(QSortFilterProxyModel):

View file

@ -3,28 +3,29 @@
""" """
Created on 2018年1月26日 Created on 2018年1月26日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: FileSystemModel @file: CustomIcon
@description: @description:
""" """
import sys import sys
try:
from PyQt5.QtCore import QFileInfo from PyQt5.QtCore import QFileInfo
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QFileSystemModel, QFileIconProvider, QApplication, \ from PyQt5.QtWidgets import QFileSystemModel, QFileIconProvider, QApplication, \
QTreeView QTreeView
except ImportError:
from PySide2.QtCore import QFileInfo
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com" from PySide2.QtGui import QIcon
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]" from PySide2.QtWidgets import QFileSystemModel, QFileIconProvider, QApplication, \
__Version__ = "Version 1.0" QTreeView
# 图标提供类
class FileIconProvider(QFileIconProvider): class FileIconProvider(QFileIconProvider):
"""图标提供类"""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(FileIconProvider, self).__init__(*args, **kwargs) super(FileIconProvider, self).__init__(*args, **kwargs)

View file

@ -1,14 +1,14 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2018年2月4日 Created on 2018年2月4日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: TencentMovieHotPlay_Flow @file: TencentMovieHotPlay_Flow
@description: @description:
''' """
import os import os
import sys import sys
import webbrowser import webbrowser
@ -20,14 +20,9 @@ from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
from PyQt5.QtSvg import QSvgWidget from PyQt5.QtSvg import QSvgWidget
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QLabel, \ from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QLabel, \
QHBoxLayout, QSpacerItem, QSizePolicy, QScrollArea, QAbstractSlider QHBoxLayout, QSpacerItem, QSizePolicy, QScrollArea, QAbstractSlider
from Lib.flowlayout import FlowLayout # @UnresolvedImport
from lxml.etree import HTML # @UnresolvedImport from lxml.etree import HTML # @UnresolvedImport
from Lib.flowlayout import FlowLayout # @UnresolvedImport
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
__Version__ = "Version 1.0"
# offset=0,30,60,90 # offset=0,30,60,90
Url = "http://v.qq.com/x/list/movie?pay=-1&offset={0}" Url = "http://v.qq.com/x/list/movie?pay=-1&offset={0}"
@ -168,6 +163,7 @@ class ItemWidget(QWidget):
def setCover(self, path): def setCover(self, path):
self.clabel.setCoverPath(path) self.clabel.setCoverPath(path)
self.clabel.setPixmap(QPixmap(path)) self.clabel.setPixmap(QPixmap(path))
# self.clabel.setText('<img src="{0}"/>'.format(os.path.abspath(path))) # self.clabel.setText('<img src="{0}"/>'.format(os.path.abspath(path)))
def sizeHint(self): def sizeHint(self):
@ -188,7 +184,6 @@ class ItemWidget(QWidget):
class GridWidget(QWidget): class GridWidget(QWidget):
Page = 0 Page = 0
loadStarted = pyqtSignal(bool) loadStarted = pyqtSignal(bool)

View file

@ -152,7 +152,6 @@ class FlowLayout(QLayout):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
app = QApplication(sys.argv) app = QApplication(sys.argv)

View file

@ -1,24 +1,25 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年3月30日 Created on 2017年3月30日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: AwesomeFont @file: AwesomeFont
@description: @description:
''' """
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
__Version__ = "Version 1.0"
import sys import sys
try:
from PyQt5.QtGui import QFontDatabase, QFont from PyQt5.QtGui import QFontDatabase, QFont
from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, \ from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, \
QScrollArea, QPushButton 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 from Lib.FontAwesome import FontAwesomes # @UnresolvedImport

View file

@ -1,5 +1,6 @@
# from bs4 import BeautifulSoup # from bs4 import BeautifulSoup
import re import re
cheatsheet = open("cheatsheet.txt", "rb").read().decode() cheatsheet = open("cheatsheet.txt", "rb").read().decode()
re_fa = re.compile(" fa(.*)") re_fa = re.compile(" fa(.*)")

View file

@ -1,21 +1,22 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年3月30日 Created on 2017年3月30日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: FontAwesome @file: FontAwesome
@description: @description:
''' """
# FontAwesome 版本: 4.7.0 # FontAwesome 版本: 4.7.0
# 字体图标地址: http://fontawesome.io/icons/ # 字体图标地址: http://fontawesome.io/icons/
# 字体字符地址: http://fontawesome.io/cheatsheet/ # 字体字符地址: http://fontawesome.io/cheatsheet/
class FontAwesomes: class FontAwesomes:
FA = None FA = None
@classmethod @classmethod

View file

@ -4,20 +4,18 @@
""" """
Created on 2018年9月25日 Created on 2018年9月25日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: AnimationShadowEffect @file: AnimationShadowEffect
@description: 边框动画阴影动画 @description: 边框动画阴影动画
""" """
try:
from PyQt5.QtCore import QPropertyAnimation, pyqtProperty from PyQt5.QtCore import QPropertyAnimation, pyqtProperty
from PyQt5.QtWidgets import QGraphicsDropShadowEffect from PyQt5.QtWidgets import QGraphicsDropShadowEffect
except ImportError:
from PySide2.QtCore import QPropertyAnimation, Property as pyqtProperty
__Author__ = """By: Irony from PySide2.QtWidgets import QGraphicsDropShadowEffect
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
class AnimationShadowEffect(QGraphicsDropShadowEffect): class AnimationShadowEffect(QGraphicsDropShadowEffect):

View file

@ -4,25 +4,24 @@
""" """
Created on 2018年9月25日 Created on 2018年9月25日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ShadowEffect @file: ShadowEffect
@description: @description:
""" """
try:
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap 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 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): class Window(QWidget):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -64,7 +63,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -3,22 +3,22 @@
""" """
Created on 2017年12月23日 Created on 2017年12月23日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: AddQWidget @file: AddQWidget
@description: @description:
""" """
import sys import sys
try:
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QVBoxLayout, \ from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QVBoxLayout, \
QApplication, QGraphicsView, QGraphicsScene QApplication, QGraphicsView, QGraphicsScene
except ImportError:
from PySide2.QtCore import Qt
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com" from PySide2.QtWidgets import QWidget, QHBoxLayout, QLabel, QVBoxLayout, \
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]" QApplication, QGraphicsView, QGraphicsScene
__Version__ = "Version 1.0"
class ToolTipItem(QWidget): class ToolTipItem(QWidget):

View file

@ -4,21 +4,22 @@
""" """
Created on 2020/11/12 Created on 2020/11/12
@author: Irony @author: Irony
@site: https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ImageView @file: ImageView
@description: 图片查看控件支持移动放大缩小 @description: 图片查看控件支持移动放大缩小
""" """
__Author__ = 'Irony'
__Copyright__ = 'Copyright (c) 2020 Irony'
__Version__ = 1.0
import os import os
try:
from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF
from PyQt5.QtGui import QPainter, QColor, QImage, QPixmap 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): class ImageView(QGraphicsView):
@ -141,7 +142,6 @@ if __name__ == '__main__':
import cgitb import cgitb
cgitb.enable(format='text') cgitb.enable(format='text')
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = ImageView(image='Data/bg.jpg', background=Qt.black) w = ImageView(image='Data/bg.jpg', background=Qt.black)

View file

@ -3,8 +3,8 @@
""" """
Created on 2017年12月17日 Created on 2017年12月17日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: WorldMap @file: WorldMap
@description: @description:
@ -12,19 +12,19 @@ Created on 2017年12月17日
import json import json
import math import math
try:
from PyQt5.QtCore import Qt, QPointF, QRectF from PyQt5.QtCore import Qt, QPointF, QRectF
from PyQt5.QtGui import QColor, QPainter, QPolygonF, QPen, QBrush from PyQt5.QtGui import QColor, QPainter, QPolygonF, QPen, QBrush
from PyQt5.QtOpenGL import QGLFormat from PyQt5.QtOpenGL import QGLFormat
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsPolygonItem from PyQt5.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsPolygonItem
except ImportError:
from PySide2.QtCore import Qt, QPointF, QRectF
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com" from PySide2.QtGui import QColor, QPainter, QPolygonF, QPen, QBrush
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]" from PySide2.QtOpenGL import QGLFormat
__Version__ = "Version 1.0" from PySide2.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsPolygonItem
class GraphicsView(QGraphicsView): class GraphicsView(QGraphicsView):
# 背景区域颜色 # 背景区域颜色
backgroundColor = QColor(31, 31, 47) backgroundColor = QColor(31, 31, 47)
# 边框颜色 # 边框颜色
@ -157,7 +157,7 @@ class GraphicsView(QGraphicsView):
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
print("OpenGL Status:", QGLFormat.hasOpenGL()) print("OpenGL Status:", QGLFormat.hasOpenGL())
view = GraphicsView() view = GraphicsView()

View file

@ -1,14 +1,14 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2018年2月4日 Created on 2018年2月4日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: TencentMovieHotPlay @file: TencentMovieHotPlay
@description: @description:
''' """
import os import os
import sys import sys
import webbrowser import webbrowser
@ -21,14 +21,8 @@ from PyQt5.QtSvg import QSvgWidget
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QLabel, \ from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QLabel, \
QHBoxLayout, QSpacerItem, QSizePolicy, QScrollArea, QGridLayout, \ QHBoxLayout, QSpacerItem, QSizePolicy, QScrollArea, QGridLayout, \
QAbstractSlider QAbstractSlider
from lxml.etree import HTML # @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"
# offset=0,30,60,90 # offset=0,30,60,90
Url = "http://v.qq.com/x/list/movie?pay=-1&offset={0}" Url = "http://v.qq.com/x/list/movie?pay=-1&offset={0}"
@ -166,6 +160,7 @@ class ItemWidget(QWidget):
def setCover(self, path): def setCover(self, path):
self.clabel.setCoverPath(path) self.clabel.setCoverPath(path)
self.clabel.setPixmap(QPixmap(path)) self.clabel.setPixmap(QPixmap(path))
# self.clabel.setText('<img src="{0}"/>'.format(os.path.abspath(path))) # self.clabel.setText('<img src="{0}"/>'.format(os.path.abspath(path)))
def sizeHint(self): def sizeHint(self):
@ -186,7 +181,6 @@ class ItemWidget(QWidget):
class GridWidget(QWidget): class GridWidget(QWidget):
Page = 0 Page = 0
loadStarted = pyqtSignal(bool) loadStarted = pyqtSignal(bool)
@ -279,7 +273,8 @@ class GridWidget(QWidget):
if os.path.isfile(path): if os.path.isfile(path):
cover_path = path cover_path = path
iwidget = ItemWidget(cover_path, figure_info, figure_title, 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) self._layout.addWidget(iwidget, row_count + row, col)

View file

@ -3,19 +3,21 @@
""" """
Created on 2018年1月20日 Created on 2018年1月20日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: CircleImage @file: CircleImage
@description: 圆形图片 @description: 圆形图片
""" """
try:
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap, QPainter, QPainterPath from PyQt5.QtGui import QPixmap, QPainter, QPainterPath
from PyQt5.QtWidgets import QLabel, QWidget, QHBoxLayout from PyQt5.QtWidgets import QLabel, QWidget, QHBoxLayout, QApplication
except ImportError:
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com" from PySide2.QtCore import Qt
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]" from PySide2.QtGui import QPixmap, QPainter, QPainterPath
__Version__ = "Version 1.0" from PySide2.QtWidgets import QLabel, QWidget, QHBoxLayout, QApplication
class Label(QLabel): class Label(QLabel):
@ -67,7 +69,6 @@ class Window(QWidget):
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()

View file

@ -4,22 +4,22 @@
""" """
Created on 2018年11月19日 Created on 2018年11月19日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: @file:
@description: @description:
""" """
try:
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap, QPainter, QImage from PyQt5.QtGui import QPixmap, QPainter, QImage
from PyQt5.QtWidgets import QWidget, QLabel, QPushButton, \ from PyQt5.QtWidgets import QWidget, QLabel, QPushButton, \
QVBoxLayout, QHBoxLayout, QSpacerItem, QSizePolicy QVBoxLayout, QHBoxLayout, QSpacerItem, QSizePolicy, QApplication
except ImportError:
from PySide2.QtCore import Qt
__Author__ = """By: Irony from PySide2.QtGui import QPixmap, QPainter, QImage
QQ: 892768447 from PySide2.QtWidgets import QWidget, QLabel, QPushButton, \
Email: 892768447@qq.com""" QVBoxLayout, QHBoxLayout, QSpacerItem, QSizePolicy, QApplication
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class Window(QWidget): class Window(QWidget):
@ -96,6 +96,7 @@ class Window(QWidget):
self.srcImage = image # 替换 self.srcImage = image # 替换
self.imageLabel.setPixmap(QPixmap.fromImage(self.srcImage)) self.imageLabel.setPixmap(QPixmap.fromImage(self.srcImage))
# # 下面这个旋转方法针对90度的倍数,否则图片会变大 # # 下面这个旋转方法针对90度的倍数,否则图片会变大
# trans = QTransform() # trans = QTransform()
# trans.rotate(90) # trans.rotate(90)
@ -106,7 +107,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,20 +4,18 @@
""" """
Created on 2018年10月18日 Created on 2018年10月18日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ImageSlipped @file: ImageSlipped
@description: @description:
""" """
try:
from PyQt5.QtGui import QPixmap, QPainter from PyQt5.QtGui import QPixmap, QPainter
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QWidget, QApplication
except ImportError:
from PySide2.QtGui import QPixmap, QPainter
__Author__ = """By: Irony from PySide2.QtWidgets import QWidget, QApplication
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class SlippedImgWidget(QWidget): class SlippedImgWidget(QWidget):
@ -73,7 +71,7 @@ class SlippedImgWidget(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = SlippedImgWidget('Data/bg1.jpg', 'Data/fg1.png') w = SlippedImgWidget('Data/bg1.jpg', 'Data/fg1.png')
w.show() w.show()

View file

@ -4,22 +4,19 @@
""" """
Created on 2018年10月25日 Created on 2018年10月25日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: NinePatch @file: NinePatch
@description: @description:
""" """
from math import fabs from math import fabs
try:
from PyQt5.QtCore import QRect from PyQt5.QtCore import QRect
from PyQt5.QtGui import QImage, QColor, QPainter, qRed, qGreen, qBlue, qAlpha from PyQt5.QtGui import QImage, QColor, QPainter, qRed, qGreen, qBlue, qAlpha
except ImportError:
from PySide2.QtCore import QRect
__Author__ = """By: Irony from PySide2.QtGui import QImage, QColor, QPainter, qRed, qGreen, qBlue, qAlpha
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class _Exception(Exception): class _Exception(Exception):
@ -44,7 +41,8 @@ class ExceptionIncorrectWidth(_Exception):
class ExceptionIncorrectWidthAndHeight(_Exception): class ExceptionIncorrectWidthAndHeight(_Exception):
def __str__(self): 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): class ExceptionIncorrectHeight(_Exception):
@ -103,7 +101,8 @@ class NinePatch:
for i in range(len(self.ResizeDistancesY)): for i in range(len(self.ResizeDistancesY)):
resizeHeight += self.ResizeDistancesY[i][1] 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( raise ExceptionIncorrectWidthAndHeight(
self.Image.width() - 2, self.Image.height() - 2) self.Image.width() - 2, self.Image.height() - 2)
@ -123,7 +122,8 @@ class NinePatch:
@classmethod @classmethod
def GetContentAreaRect(self, width, height): def GetContentAreaRect(self, width, height):
# print("GetContentAreaRect : width:%d height:%d" % (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())))) (height - (self.Image.height() - 2 - self.ContentArea.height()))))
def DrawScaledPart(self, oldRect, newRect, painter): def DrawScaledPart(self, oldRect, newRect, painter):
@ -189,7 +189,8 @@ class NinePatch:
for i in range(self.Image.width()): for i in range(self.Image.width()):
if (self.IsColorBlack(self.Image.pixel(i, j)) and left == 0): if (self.IsColorBlack(self.Image.pixel(i, j)) and left == 0):
left = i 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 right = i
left -= 1 left -= 1
# print("ResizeDistancesX.append ", left, " ", right - left) # print("ResizeDistancesX.append ", left, " ", right - left)
@ -204,7 +205,8 @@ class NinePatch:
if (self.IsColorBlack(self.Image.pixel(i, j)) and top == 0): if (self.IsColorBlack(self.Image.pixel(i, j)) and top == 0):
top = j 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 bot = j
top -= 1 top -= 1
# print("ResizeDistancesY.append ", top, " ", bot - top) # print("ResizeDistancesY.append ", top, " ", bot - top)
@ -310,7 +312,8 @@ class NinePatch:
offsetY = 0 offsetY = 0
for i in range(len(self.ResizeDistancesY)): for i in range(len(self.ResizeDistancesY)):
self.DrawConstPart(QRect(x1 + 1, y1 + 1, widthResize, self.ResizeDistancesY[i][0] - y1), 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] y1 = self.ResizeDistancesY[i][0]
resizeY = round(float(self.ResizeDistancesY[i][1]) * factorY) resizeY = round(float(self.ResizeDistancesY[i][1]) * factorY)
lostY += resizeY - (float(self.ResizeDistancesY[i][1]) * factorY) lostY += resizeY - (float(self.ResizeDistancesY[i][1]) * factorY)
@ -334,7 +337,8 @@ class NinePatch:
offsetX = 0 offsetX = 0
for i in range(len(self.ResizeDistancesX)): for i in range(len(self.ResizeDistancesX)):
self.DrawConstPart(QRect(x1 + 1, y1 + 1, self.ResizeDistancesX[i][0] - x1, heightResize), 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] x1 = self.ResizeDistancesX[i][0]
resizeX = round(float(self.ResizeDistancesX[i][1]) * factorX) resizeX = round(float(self.ResizeDistancesX[i][1]) * factorX)
lostX += resizeX - (float(self.ResizeDistancesX[i][1]) * factorX) lostX += resizeX - (float(self.ResizeDistancesX[i][1]) * factorX)

View file

@ -5,9 +5,8 @@ import os
import shutil import shutil
import PyQt5 import PyQt5
from PyQt5.QtCore import PYQT_CONFIGURATION
import sipconfig import sipconfig
from PyQt5.QtCore import PYQT_CONFIGURATION
# 模块名 # 模块名
moduleName = 'QtNinePatch' moduleName = 'QtNinePatch'
@ -42,7 +41,6 @@ os.makedirs('build', exist_ok=True)
print(sip_cmd) print(sip_cmd)
os.system(sip_cmd) os.system(sip_cmd)
# Create the Makefile. # Create the Makefile.
makefile = sipconfig.SIPModuleMakefile( makefile = sipconfig.SIPModuleMakefile(
config, build_file, dir='build' config, build_file, dir='build'

View file

@ -4,22 +4,19 @@
""" """
Created on 2018年10月25日 Created on 2018年10月25日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: QtNinePatch @file: QtNinePatch
@description: @description:
""" """
from math import floor from math import floor
try:
from PyQt5.QtCore import Qt, QRect from PyQt5.QtCore import Qt, QRect
from PyQt5.QtGui import qAlpha, QPixmap, QPainter from PyQt5.QtGui import qAlpha, QPixmap, QPainter
except ImportError:
from PySide2.QtCore import Qt, QRect
__Author__ = """By: Irony from PySide2.QtGui import qAlpha, QPixmap, QPainter
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class Part: class Part:

View file

@ -6,7 +6,10 @@
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
try:
from PyQt5 import QtCore from PyQt5 import QtCore
except ImportError:
from PySide2 import QtCore
qt_resource_data = b"\ qt_resource_data = b"\
\x00\x00\x19\xf0\ \x00\x00\x19\xf0\
@ -462,10 +465,13 @@ else:
rcc_version = 2 rcc_version = 2
qt_resource_struct = qt_resource_struct_v2 qt_resource_struct = qt_resource_struct_v2
def qInitResources(): def qInitResources():
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
def qCleanupResources(): def qCleanupResources():
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
qInitResources() qInitResources()

View file

@ -1,18 +1,14 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年12月23日 Created on 2017年12月23日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: xpmres @file: xpmres
@description: @description:
''' """
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
__Version__ = "Version 1.0"
# 这里把转换的xpm数组直接放到py文件中当做一个变量 # 这里把转换的xpm数组直接放到py文件中当做一个变量

View file

@ -4,23 +4,20 @@
""" """
Created on 2018年10月25日 Created on 2018年10月25日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: NinePatch @file: NinePatch
@description: @description:
""" """
__Author__ = """By: Irony
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
import sys import sys
from PyQt5.QtGui import QImage, QPainter try:
from PyQt5.QtWidgets import QApplication, QLabel, QWidget 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 from Lib.NinePatch import NinePatch

View file

@ -4,22 +4,15 @@
""" """
Created on 2018年10月25日 Created on 2018年10月25日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: testQtNinePatch @file: testQtNinePatch
@description: @description:
""" """
__Author__ = """By: Irony
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
import sys import sys
from ctypes import CDLL from ctypes import CDLL
from PyQt5.QtGui import QImage from PyQt5.QtGui import QImage
from PyQt5.QtWidgets import QApplication, QLabel from PyQt5.QtWidgets import QApplication, QLabel

View file

@ -4,23 +4,20 @@
""" """
Created on 2018年10月25日 Created on 2018年10月25日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: QtNinePatch2 @file: QtNinePatch2
@description: @description:
""" """
__Author__ = """By: Irony
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
import sys import sys
try:
from PyQt5.QtGui import QImage from PyQt5.QtGui import QImage
from PyQt5.QtWidgets import QApplication, QLabel from PyQt5.QtWidgets import QApplication, QLabel
except ImportError:
from PySide2.QtGui import QImage
from PySide2.QtWidgets import QApplication, QLabel
from Lib import QtNinePatch2 from Lib import QtNinePatch2

View file

@ -1,29 +1,28 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2017年12月23日 Created on 2017年12月23日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ShowImage @file: ShowImage
@description: @description:
''' """
import sys import sys
try:
from PyQt5.QtCore import QResource from PyQt5.QtCore import QResource
from PyQt5.QtGui import QPixmap, QMovie from PyQt5.QtGui import QPixmap, QMovie
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QLabel 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 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): class ImageView(QWidget):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View file

@ -1,22 +1,26 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- 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.QtCore import QSize
from PyQt5.QtGui import QStandardItemModel, QStandardItem from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtWidgets import QListView, QWidget, QHBoxLayout, QLineEdit, \ from PyQt5.QtWidgets import QListView, QWidget, QHBoxLayout, QLineEdit, \
QPushButton QPushButton, QApplication
except ImportError:
from PySide2.QtCore import QSize
# Created on 2018年8月4日 from PySide2.QtGui import QStandardItemModel, QStandardItem
# author: Irony from PySide2.QtWidgets import QListView, QWidget, QHBoxLayout, QLineEdit, \
# site: https://pyqt5.com , https://github.com/892768447 QPushButton, QApplication
# 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
class CustomWidget(QWidget): class CustomWidget(QWidget):
@ -56,7 +60,7 @@ class ListView(QListView):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = ListView() w = ListView()
w.show() w.show()

View file

@ -1,26 +1,29 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- 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 import string
from random import choice, randint
from time import time from time import time
try:
from PyQt5.QtCore import QSortFilterProxyModel, Qt, QSize from PyQt5.QtCore import QSortFilterProxyModel, Qt, QSize
from PyQt5.QtGui import QStandardItem, QStandardItemModel from PyQt5.QtGui import QStandardItem, QStandardItemModel
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListView, \ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListView, \
QHBoxLayout, QLineEdit QHBoxLayout, QLineEdit, QApplication
except ImportError:
from PySide2.QtCore import QSortFilterProxyModel, Qt, QSize
# Created on 2018年8月4日 from PySide2.QtGui import QStandardItem, QStandardItemModel
# author: Irony from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListView, \
# site: https://pyqt5.com , https://github.com/892768447 QHBoxLayout, QLineEdit, QApplication
# 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
def randomChar(y): def randomChar(y):
@ -109,7 +112,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,16 +4,21 @@
""" """
Created on 2021/4/15 Created on 2021/4/15
@author: Irony @author: Irony
@site: https://github.com/PyQt5 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ImageView @file: ImageView
@description: @description:
""" """
import os import os
try:
from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF
from PyQt5.QtGui import QStandardItem, QStandardItemModel, QPainter, QColor, QImage, QPixmap 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 ScrollPixel = 40
@ -223,7 +228,6 @@ if __name__ == '__main__':
import cgitb import cgitb
cgitb.enable(format='text') cgitb.enable(format='text')
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = ImageView() w = ImageView()

View file

@ -4,23 +4,21 @@
""" """
Created on 2018年12月27日 Created on 2018年12月27日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: QListView.SortItemByRole @file: QListView.SortItemByRole
@description: @description:
""" """
from random import choice from random import choice
try:
from PyQt5.QtCore import QSortFilterProxyModel, Qt from PyQt5.QtCore import QSortFilterProxyModel, Qt
from PyQt5.QtGui import QStandardItem, QStandardItemModel from PyQt5.QtGui import QStandardItem, QStandardItemModel
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QListView, QPushButton from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QListView, QPushButton
except ImportError:
from PySide2.QtCore import QSortFilterProxyModel, Qt
__Author__ = """By: Irony from PySide2.QtGui import QStandardItem, QStandardItemModel
QQ: 892768447 from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QListView, QPushButton
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class SortFilterProxyModel(QSortFilterProxyModel): class SortFilterProxyModel(QSortFilterProxyModel):
@ -141,8 +139,9 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
import cgitb import cgitb
cgitb.enable(1, None, 5, '')
from PyQt5.QtWidgets import QApplication cgitb.enable(format='text')
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,25 +4,23 @@
""" """
Created on 2018年11月4日 Created on 2018年11月4日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: 删除Item @file: 删除Item
@description: @description:
""" """
try:
from PyQt5.QtCore import QSize, pyqtSignal from PyQt5.QtCore import QSize, pyqtSignal
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLineEdit, QPushButton, \ from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLineEdit, QPushButton, \
QListWidgetItem, QVBoxLayout, QListWidget QListWidgetItem, QVBoxLayout, QListWidget, QApplication
except ImportError:
from PySide2.QtCore import QSize, Signal as pyqtSignal
__Author__ = """By: Irony from PySide2.QtWidgets import QWidget, QHBoxLayout, QLineEdit, QPushButton, \
QQ: 892768447 QListWidgetItem, QVBoxLayout, QListWidget, QApplication
Email: 892768447@qq.com"""
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
class ItemWidget(QWidget): class ItemWidget(QWidget):
itemDeleted = pyqtSignal(QListWidgetItem) itemDeleted = pyqtSignal(QListWidgetItem)
def __init__(self, text, item, *args, **kwargs): def __init__(self, text, item, *args, **kwargs):
@ -91,8 +89,9 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
import cgitb import cgitb
cgitb.enable(1, None, 5, '')
from PyQt5.QtWidgets import QApplication cgitb.enable(format='text')
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,21 +4,20 @@
""" """
Created on 2018年9月14日 Created on 2018年9月14日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: DragListWidget @file: DragListWidget
@description: @description:
""" """
try:
from PyQt5.QtCore import Qt, QSize, QRect, QPoint from PyQt5.QtCore import Qt, QSize, QRect, QPoint
from PyQt5.QtGui import QColor, QPixmap, QDrag, QPainter, QCursor from PyQt5.QtGui import QColor, QPixmap, QDrag, QPainter, QCursor
from PyQt5.QtWidgets import QListWidget, QListWidgetItem, QLabel, QRubberBand from PyQt5.QtWidgets import QListWidget, QListWidgetItem, QLabel, QRubberBand, QApplication
except ImportError:
from PySide2.QtCore import Qt, QSize, QRect, QPoint
__Author__ = """By: Irony from PySide2.QtGui import QColor, QPixmap, QDrag, QPainter, QCursor
QQ: 892768447 from PySide2.QtWidgets import QListWidget, QListWidgetItem, QLabel, QRubberBand, QApplication
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class DropListWidget(QListWidget): class DropListWidget(QListWidget):
@ -162,7 +161,7 @@ class DragListWidget(QListWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setStyleSheet("""QListWidget { app.setStyleSheet("""QListWidget {
outline: 0px; outline: 0px;

View file

@ -4,7 +4,7 @@
""" """
Created on 2019年5月27日 Created on 2019年5月27日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/PyQt5 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: FoldWidget @file: FoldWidget
@description: 自定义item折叠控件仿QTreeWidget @description: 自定义item折叠控件仿QTreeWidget
@ -15,11 +15,6 @@ from PyQt5.QtWidgets import QWidget, QPushButton, QFormLayout,\
QLineEdit, QListWidget, QListWidgetItem, QCheckBox QLineEdit, QListWidget, QListWidgetItem, QCheckBox
__Author__ = "Irony"
__Copyright__ = "Copyright (c) 2019"
__Version__ = "Version 1.0"
class CustomWidget(QWidget): class CustomWidget(QWidget):
def __init__(self, item, *args, **kwargs): def __init__(self, item, *args, **kwargs):
@ -79,8 +74,10 @@ class Window(QListWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
import cgitb import cgitb
cgitb.enable(1, None, 5, '')
cgitb.enable(format='text')
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
# 通过qss改变按钮的高度 # 通过qss改变按钮的高度
app.setStyleSheet('#testBtn{min-height:40px;}') app.setStyleSheet('#testBtn{min-height:40px;}')

View file

@ -1,14 +1,14 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2018年2月4日 Created on 2018年2月4日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: TencentMovieHotPlay_ListWidget @file: TencentMovieHotPlay_ListWidget
@description: @description:
''' """
import os import os
import sys import sys
import webbrowser import webbrowser
@ -21,14 +21,8 @@ from PyQt5.QtSvg import QSvgWidget
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QLabel, \ from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QLabel, \
QHBoxLayout, QSpacerItem, QSizePolicy, QAbstractSlider, \ QHBoxLayout, QSpacerItem, QSizePolicy, QAbstractSlider, \
QListWidget, QListWidgetItem QListWidget, QListWidgetItem
from lxml.etree import HTML # @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"
# offset=0,30,60,90 # offset=0,30,60,90
Url = "http://v.qq.com/x/list/movie?pay=-1&offset={0}" Url = "http://v.qq.com/x/list/movie?pay=-1&offset={0}"
@ -131,7 +125,8 @@ class CoverLabel(QLabel):
class ItemWidget(QWidget): class ItemWidget(QWidget):
def __init__(self, cover_path, figure_info, figure_title, 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) super(ItemWidget, self).__init__(*args, **kwargs)
self.setMaximumSize(220, 420) self.setMaximumSize(220, 420)
self.setMaximumSize(220, 420) self.setMaximumSize(220, 420)
@ -169,6 +164,7 @@ class ItemWidget(QWidget):
def setCover(self, path): def setCover(self, path):
self.clabel.setCoverPath(path) self.clabel.setCoverPath(path)
self.clabel.setPixmap(QPixmap(path)) self.clabel.setPixmap(QPixmap(path))
# self.clabel.setText('<img src="{0}"/>'.format(os.path.abspath(path))) # self.clabel.setText('<img src="{0}"/>'.format(os.path.abspath(path)))
def sizeHint(self): def sizeHint(self):
@ -189,7 +185,6 @@ class ItemWidget(QWidget):
class Window(QListWidget): class Window(QListWidget):
Page = 0 Page = 0
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -278,7 +273,8 @@ class Window(QListWidget):
if os.path.isfile(path): if os.path.isfile(path):
cover_path = path cover_path = path
iwidget = ItemWidget(cover_path, figure_info, figure_title, 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 = QListWidgetItem(self)
item.setSizeHint(iwidget.sizeHint()) item.setSizeHint(iwidget.sizeHint())
self.setItemWidget(item, iwidget) self.setItemWidget(item, iwidget)

View file

@ -4,20 +4,22 @@
""" """
Created on 2019年7月3日 Created on 2019年7月3日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/PyQt5 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: QListWidget.SignalsExample @file: QListWidget.SignalsExample
@description: @description:
""" """
try:
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QColor from PyQt5.QtGui import QColor
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QListWidget, QPlainTextEdit, \ from PyQt5.QtWidgets import QWidget, QHBoxLayout, QListWidget, QPlainTextEdit, \
QListWidgetItem, QAbstractItemView, QListView QListWidgetItem, QAbstractItemView, QListView, QApplication
except ImportError:
from PySide2.QtCore import Qt
__Author__ = "Irony" from PySide2.QtGui import QColor
__Copyright__ = "Copyright (c) 2019" from PySide2.QtWidgets import QWidget, QHBoxLayout, QListWidget, QPlainTextEdit, \
__Version__ = "Version 1.0" QListWidgetItem, QAbstractItemView, QListView, QApplication
def formatColor(text, color): def formatColor(text, color):
@ -118,7 +120,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,20 +4,16 @@
""" """
Created on 2018年10月24日 Created on 2018年10月24日
@author: Irony @author: Irony
@site: https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: MultiSelect @file: MultiSelect
@description: @description:
""" """
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QMenu,\
QAction
try:
__Author__ = """By: Irony from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QPushButton, QMenu, QAction
QQ: 892768447 except ImportError:
Email: 892768447@qq.com""" from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QPushButton, QMenu, QAction
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class Window(QWidget): class Window(QWidget):
@ -70,8 +66,9 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
import cgitb import cgitb
cgitb.enable(1, None, 5, '')
from PyQt5.QtWidgets import QApplication cgitb.enable(format='text')
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.resize(400, 400) w.resize(400, 400)

View file

@ -4,7 +4,7 @@
""" """
Created on 2021/4/7 Created on 2021/4/7
@author: Irony @author: Irony
@site: https://github.com/PyQt5 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: QQMenu @file: QQMenu
@description: @description:
@ -12,9 +12,14 @@ Created on 2021/4/7
import string import string
from random import choice, randint from random import choice, randint
try:
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap, QPainter, QFont, QIcon from PyQt5.QtGui import QPixmap, QPainter, QFont, QIcon
from PyQt5.QtWidgets import QLabel, QMenu, QApplication 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 = """ Style = """
QMenu { QMenu {
@ -121,7 +126,7 @@ if __name__ == '__main__':
import sys import sys
import cgitb import cgitb
cgitb.enable(1, None, 5, '') cgitb.enable(format='text')
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setStyleSheet(Style) app.setStyleSheet(Style)
w = Window() w = Window()

View file

@ -4,19 +4,17 @@
""" """
Created on 2019年7月10日 Created on 2019年7月10日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ChineseText @file: ChineseText
@description: 修改消息对话框文字汉化 @description: 修改消息对话框文字汉化
""" """
import sys import sys
try:
from PyQt5.QtWidgets import QApplication, QMessageBox from PyQt5.QtWidgets import QApplication, QMessageBox
except ImportError:
from PySide2.QtWidgets import QApplication, QMessageBox
__Author__ = 'Irony'
__Copyright__ = 'Copyright (c) 2019 Irony'
__Version__ = 1.0
TextStyle = """ TextStyle = """
QMessageBox QPushButton[text="OK"] { QMessageBox QPushButton[text="OK"] {

View file

@ -4,22 +4,19 @@
""" """
Created on 2018年6月22日 Created on 2018年6月22日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: MessageBox @file: MessageBox
@description: @description:
""" """
from random import randrange from random import randrange
try:
from PyQt5.QtCore import QTimer from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QMessageBox from PyQt5.QtWidgets import QApplication, QMessageBox, QPushButton
except ImportError:
from PySide2.QtCore import QTimer
__Author__ = """By: Irony from PySide2.QtWidgets import QApplication, QMessageBox, QPushButton
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class MessageBox(QMessageBox): class MessageBox(QMessageBox):
@ -53,7 +50,7 @@ class MessageBox(QMessageBox):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication, QPushButton
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = QPushButton('点击弹出对话框') w = QPushButton('点击弹出对话框')
w.resize(200, 200) w.resize(200, 200)

View file

@ -1,23 +1,21 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2018年1月17日 Created on 2018年1月17日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: CustomBtnIcon @file: CustomBtnIcon
@description: @description:
''' """
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
__Version__ = "Version 1.0"
import sys import sys
try:
from PyQt5.QtWidgets import QApplication, QMessageBox from PyQt5.QtWidgets import QApplication, QMessageBox
except ImportError:
from PySide2.QtWidgets import QApplication, QMessageBox
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setStyleSheet('''QDialogButtonBox { app.setStyleSheet('''QDialogButtonBox {

View file

@ -4,7 +4,7 @@
""" """
Created on 2021/1/1 Created on 2021/1/1
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: DWaterProgress @file: DWaterProgress
@see https://github.com/linuxdeepin/dtkwidget/blob/master/src/widgets/dwaterprogress.cpp @see https://github.com/linuxdeepin/dtkwidget/blob/master/src/widgets/dwaterprogress.cpp
@ -12,10 +12,18 @@ Created on 2021/1/1
""" """
import math import math
try:
from PyQt5.QtCore import pyqtSlot, QTimer, QSizeF, Qt, QRectF, QPointF, QRect, QPoint, QSize 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.QtSvg import QSvgRenderer
from PyQt5.QtWidgets import QProgressBar, QGraphicsDropShadowEffect 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"> 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"/> <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.setCompositionMode(QPainter.CompositionMode_SourceOver)
waterPainter.drawImage(int(self.backXOffset), yOffset, self.waterBackImage) 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), 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 # draw pop
if self.value() > 30: if self.value() > 30:

View file

@ -1,28 +1,28 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Created on 2018年4月1日 """
# author: Irony Created on 2018年4月1日
# site: https://pyqt5.com , https://github.com/892768447 @author: Irony
# email: 892768447@qq.com @site: https://pyqt.site , https://github.com/PyQt5
# file: WaterRippleProgressBar @email: 892768447@qq.com
# description: @file: WaterRippleProgressBar
@description:
__Author__ = """By: Irony """
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
import math import math
try:
from PyQt5.QtCore import QTimer, Qt, QRectF, QSize from PyQt5.QtCore import QTimer, Qt, QRectF, QSize
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QFont from PyQt5.QtGui import QPainter, QPainterPath, QColor, QFont
from PyQt5.QtWidgets import QProgressBar 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): class WaterRippleProgressBar(QProgressBar):
# 浪高百分比 # 浪高百分比
waterHeight = 1 waterHeight = 1
# 密度 # 密度

View file

@ -4,27 +4,25 @@
""" """
Created on 2018年9月日 Created on 2018年9月日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: MetroCircleProgress @file: MetroCircleProgress
@description: @description:
""" """
from PyQt5.QtCore import QSequentialAnimationGroup, pyqtProperty,\
QPauseAnimation, QPropertyAnimation, QParallelAnimationGroup,\ try:
QObject, QSize, Qt, pyqtSignal, QRectF from PyQt5.QtCore import QSequentialAnimationGroup, QPauseAnimation, QPropertyAnimation, \
QParallelAnimationGroup, QObject, QSize, Qt, QRectF, pyqtSignal, pyqtProperty
from PyQt5.QtGui import QPainter, QColor from PyQt5.QtGui import QPainter, QColor
from PyQt5.QtWidgets import QWidget, QVBoxLayout from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
except ImportError:
from PySide2.QtCore import QSequentialAnimationGroup, QPauseAnimation, QPropertyAnimation, \
__Author__ = """By: Irony QParallelAnimationGroup, QObject, QSize, Qt, QRectF, Signal as pyqtSignal, Property as pyqtProperty
QQ: 892768447 from PySide2.QtGui import QPainter, QColor
Email: 892768447@qq.com""" from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
class CircleItem(QObject): class CircleItem(QObject):
X = 0 # x坐标 X = 0 # x坐标
Opacity = 1 # 透明度0~1 Opacity = 1 # 透明度0~1
valueChanged = pyqtSignal() valueChanged = pyqtSignal()
@ -52,7 +50,6 @@ def qBound(miv, cv, mxv):
class MetroCircleProgress(QWidget): class MetroCircleProgress(QWidget):
Radius = 5 # 半径 Radius = 5 # 半径
Color = QColor(24, 189, 155) # 圆圈颜色 Color = QColor(24, 189, 155) # 圆圈颜色
BackgroundColor = QColor(Qt.transparent) # 背景颜色 BackgroundColor = QColor(Qt.transparent) # 背景颜色
@ -189,7 +186,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,25 +4,23 @@
""" """
Created on 2018年9月4日 Created on 2018年9月4日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: PercentProgressBar @file: PercentProgressBar
@description: @description:
""" """
try:
from PyQt5.QtCore import pyqtProperty, QSize, Qt, QRectF, QTimer from PyQt5.QtCore import pyqtProperty, QSize, Qt, QRectF, QTimer
from PyQt5.QtGui import QColor, QPainter, QFont from PyQt5.QtGui import QColor, QPainter, QFont
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QSlider from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout, QSlider
except ImportError:
from PySide2.QtCore import Property as pyqtProperty, QSize, Qt, QRectF, QTimer
__Author__ = """By: Irony from PySide2.QtGui import QColor, QPainter, QFont
QQ: 892768447 from PySide2.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout, QSlider
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class PercentProgressBar(QWidget): class PercentProgressBar(QWidget):
MinValue = 0 MinValue = 0
MaxValue = 100 MaxValue = 100
Value = 0 Value = 0
@ -300,8 +298,10 @@ class Window(QWidget):
self.staticPercentProgressBar.showFreeArea = True self.staticPercentProgressBar.showFreeArea = True
self.staticPercentProgressBar.ShowSmallCircle = True self.staticPercentProgressBar.ShowSmallCircle = True
vlayout.addWidget(self.staticPercentProgressBar) 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) self._timer.start(100)
@ -316,8 +316,9 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
import cgitb 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) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,25 +4,23 @@
""" """
Created on 2018年9月4日 Created on 2018年9月4日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: 界面美化.圆形进度条.CircleProgressBar @file: 界面美化.圆形进度条.CircleProgressBar
@description: @description:
""" """
try:
from PyQt5.QtCore import QSize, pyqtProperty, QTimer, Qt from PyQt5.QtCore import QSize, pyqtProperty, QTimer, Qt
from PyQt5.QtGui import QColor, QPainter from PyQt5.QtGui import QColor, QPainter
from PyQt5.QtWidgets import QWidget, QHBoxLayout from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout
except ImportError:
from PySide2.QtCore import QSize, Property as pyqtProperty, QTimer, Qt
__Author__ = """By: Irony from PySide2.QtGui import QColor, QPainter
QQ: 892768447 from PySide2.QtWidgets import QApplication, QWidget, QHBoxLayout
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class CircleProgressBar(QWidget): class CircleProgressBar(QWidget):
Color = QColor(24, 189, 155) # 圆圈颜色 Color = QColor(24, 189, 155) # 圆圈颜色
Clockwise = True # 顺时针还是逆时针 Clockwise = True # 顺时针还是逆时针
Delta = 36 Delta = 36
@ -105,7 +103,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -1,26 +1,26 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' """
Created on 2018年1月30日 Created on 2018年1月30日
@author: Irony."[讽刺] @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: SimpleStyle @file: SimpleStyle
@description: @description:
''' """
from random import randint
import sys
import sys
from random import randint
try:
from PyQt5.QtCore import QTimer from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QProgressBar from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QProgressBar
except ImportError:
from PySide2.QtCore import QTimer
from PySide2.QtWidgets import QWidget, QApplication, QVBoxLayout, QProgressBar
StyleSheet = """
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
__Version__ = "Version 1.0"
StyleSheet = '''
/*设置红色进度条*/ /*设置红色进度条*/
#RedProgressBar { #RedProgressBar {
text-align: center; /*进度值居中*/ text-align: center; /*进度值居中*/
@ -50,7 +50,7 @@ StyleSheet = '''
width: 10px; /*区块宽度*/ width: 10px; /*区块宽度*/
margin: 0.5px; margin: 0.5px;
} }
''' """
class ProgressBar(QProgressBar): class ProgressBar(QProgressBar):

View file

@ -4,16 +4,21 @@
""" """
Created on 2021/1/1 Created on 2021/1/1
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: WaterProgress @file: WaterProgress
@description: @description:
""" """
import sys import sys
from Lib.DWaterProgress import DWaterProgress try:
from PyQt5.QtCore import QTimer from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout 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): class WaterProgressWindow(QWidget):

View file

@ -1,27 +1,27 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Created on 2018年4月1日 """
# author: Irony Created on 2018年4月1日
# site: https://pyqt5.com , https://github.com/892768447 @author: Irony
# email: 892768447@qq.com @site: https://pyqt.site , https://github.com/PyQt5
# file: WaterProgressBar @email: 892768447@qq.com
# description: @file: WaterProgressBar
@description:
__Author__ = """By: Irony """
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
from random import randint from random import randint
from PyQt5.Qt import QSpinBox try:
from PyQt5.QtCore import QTimer from PyQt5.QtCore import QTimer
from PyQt5.QtGui import QPixmap, QIcon from PyQt5.QtGui import QPixmap, QIcon
from PyQt5.QtWidgets import QWidget, QFormLayout, QRadioButton, QPushButton,\ from PyQt5.QtWidgets import QApplication, QWidget, QFormLayout, QRadioButton, QPushButton, QColorDialog, \
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 from Lib.WaterRippleProgressBar import WaterRippleProgressBar # @UnresolvedImport
@ -53,11 +53,13 @@ class Window(QWidget):
layout.addWidget( layout.addWidget(
QPushButton('设置随机0-100固定值', self, clicked=self.setRandomValue)) QPushButton('设置随机0-100固定值', self, clicked=self.setRandomValue))
layout.addRow('振幅(浪高)', spb1 = QSpinBox(self, value=1)
QSpinBox(self, value=1, valueChanged=self.bar.setWaterHeight)) spb1.valueChanged.connect(self.bar.setWaterHeight)
layout.addRow('振幅(浪高)', spb1)
layout.addRow('周期(密度)', spb2 = QSpinBox(self, value=1)
QSpinBox(self, value=1, valueChanged=self.bar.setWaterDensity)) spb2.valueChanged.connect(self.bar.setWaterDensity)
layout.addRow('周期(密度)', spb2)
layout.addWidget(self.bar) layout.addWidget(self.bar)
@ -116,9 +118,10 @@ class Window(QWidget):
value = 0 value = 0
self.bar.setValue(value) self.bar.setValue(value)
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -1,10 +1,8 @@
from libc.math cimport pow from libc.math cimport pow
def getDistance(p1, p2): def getDistance(p1, p2):
return pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2) return pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2)
def findClose(points): def findClose(points):
cdef int plen = len(points) cdef int plen = len(points)
cdef int i = 0 cdef int i = 0

View file

@ -10,6 +10,7 @@
# ) # )
from distutils.core import setup from distutils.core import setup
from Cython.Build import cythonize from Cython.Build import cythonize
setup( setup(

View file

@ -1,20 +1,22 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- 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.QtCore import QPropertyAnimation
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
except ImportError:
from PySide2.QtCore import QPropertyAnimation
# Created on 2018年6月14日 from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
# 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
class Window(QWidget): class Window(QWidget):
@ -55,7 +57,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,23 +4,24 @@
""" """
Created on 2019年5月15日 Created on 2019年5月15日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: 翻转动画 @file: 翻转动画
@description: @description:
""" """
try:
from PyQt5.QtCore import Qt, pyqtSignal, QTimer from PyQt5.QtCore import Qt, pyqtSignal, QTimer
from PyQt5.QtGui import QPixmap 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 from Lib.FlipWidget import FlipWidget
__Author__ = 'Irony'
__Copyright__ = 'Copyright (c) 2019 Irony'
__Version__ = 1.0
class LoginWidget(QLabel): class LoginWidget(QLabel):
# 只是显示登录界面截图 # 只是显示登录界面截图
@ -120,7 +121,7 @@ class Window(QStackedWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,23 +4,24 @@
""" """
Created on 2019年5月15日 Created on 2019年5月15日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: FlipWidget @file: FlipWidget
@description: 动画翻转窗口 @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.QtGui import QPainter, QTransform
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QWidget
except ImportError:
from PySide2.QtCore import Signal as pyqtSignal, Property as pyqtProperty, Qt, QPropertyAnimation, \
__Author__ = 'Irony' QEasingCurve, QPointF
__Copyright__ = 'Copyright (c) 2019' from PySide2.QtGui import QPainter, QTransform
from PySide2.QtWidgets import QWidget
class FlipWidget(QWidget): class FlipWidget(QWidget):
Left = 0 # 从右往左 Left = 0 # 从右往左
Right = 1 # 从左往右 Right = 1 # 从左往右
Scale = 3 # 图片缩放比例 Scale = 3 # 图片缩放比例

View file

@ -4,25 +4,23 @@
""" """
Created on 2018年11月24日 Created on 2018年11月24日
author: Irony author: Irony
site: https://pyqt5.com , https://github.com/892768447 site: https://pyqt.site , https://github.com/PyQt5
email: 892768447@qq.com email: 892768447@qq.com
file: file:
description: 参考 http://qt.shoutwiki.com/wiki/Extending_QStackedWidget_for_sliding_page_animations_in_Qt 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 from PyQt5.QtWidgets import QStackedWidget
except ImportError:
from PySide2.QtCore import Qt, Property as pyqtProperty, QEasingCurve, QPoint, QPropertyAnimation, \
__Author__ = """By: Irony QParallelAnimationGroup, QTimer
QQ: 892768447 from PySide2.QtWidgets import QStackedWidget
Email: 892768447@qq.com"""
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
class SlidingStackedWidget(QStackedWidget): class SlidingStackedWidget(QStackedWidget):
LEFT2RIGHT, RIGHT2LEFT, TOP2BOTTOM, BOTTOM2TOP, AUTOMATIC = range(5) LEFT2RIGHT, RIGHT2LEFT, TOP2BOTTOM, BOTTOM2TOP, AUTOMATIC = range(5)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View file

@ -6,7 +6,11 @@
# #
# WARNING! All changes made in this file will be lost! # 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): class Ui_Form(object):
def setupUi(self, Form): def setupUi(self, Form):
@ -89,14 +93,15 @@ class Ui_Form(object):
self.pushButtonStart.setText(_translate("Form", "轮播开始")) self.pushButtonStart.setText(_translate("Form", "轮播开始"))
self.pushButtonStop.setText(_translate("Form", "轮播停止")) self.pushButtonStop.setText(_translate("Form", "轮播停止"))
from Lib.SlidingStackedWidget import SlidingStackedWidget from Lib.SlidingStackedWidget import SlidingStackedWidget
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget() Form = QtWidgets.QWidget()
ui = Ui_Form() ui = Ui_Form()
ui.setupUi(Form) ui.setupUi(Form)
Form.show() Form.show()
sys.exit(app.exec_()) sys.exit(app.exec_())

View file

@ -4,20 +4,18 @@
""" """
Created on 2018年8月22日 Created on 2018年8月22日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: MenuAnimation @file: MenuAnimation
@description: @description:
""" """
try:
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve, QRect from PyQt5.QtCore import QPropertyAnimation, QEasingCurve, QRect
from PyQt5.QtWidgets import QWidget, QMenu, QApplication from PyQt5.QtWidgets import QWidget, QMenu, QApplication
except ImportError:
from PySide2.QtCore import QPropertyAnimation, QEasingCurve, QRect
__Author__ = """By: Irony from PySide2.QtWidgets import QWidget, QMenu, QApplication
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = "Copyright (c) 2018 Irony"
__Version__ = "Version 1.0"
class Window(QWidget): class Window(QWidget):
@ -61,7 +59,8 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
import cgitb import cgitb
sys.excepthook = cgitb.Hook(1, None, 5, sys.stderr, 'text')
cgitb.enable(format='text')
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,27 +4,25 @@
""" """
Created on 2018年11月24日 Created on 2018年11月24日
author: Irony author: Irony
site: https://pyqt5.com , https://github.com/892768447 site: https://pyqt.site , https://github.com/PyQt5
email: 892768447@qq.com email: 892768447@qq.com
file: PageSwitching file: PageSwitching
description: description:
""" """
import os import os
try:
from PyQt5.QtCore import QEasingCurve, Qt from PyQt5.QtCore import QEasingCurve, Qt
from PyQt5.QtGui import QPixmap 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 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): class ImageSliderWidget(QWidget, Ui_Form):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -76,7 +74,7 @@ class ImageSliderWidget(QWidget, Ui_Form):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = ImageSliderWidget() w = ImageSliderWidget()
w.show() w.show()

View file

@ -4,7 +4,7 @@
""" """
Created on 2018年11月22日 Created on 2018年11月22日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: RlatticeEffect @file: RlatticeEffect
@description: @description:
@ -12,29 +12,29 @@ Created on 2018年11月22日
from random import random from random import random
from time import time from time import time
from PyQt5.QtCore import QPropertyAnimation, QObject, pyqtProperty, QEasingCurve,\ try:
Qt, QRectF, pyqtSignal from PyQt5.QtCore import QPropertyAnimation, QObject, QEasingCurve, Qt, QRectF, pyqtSignal, pyqtProperty
from PyQt5.QtGui import QColor, QPainterPath, QPainter from PyQt5.QtGui import QColor, QPainterPath, QPainter
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QApplication, QWidget
except ImportError:
from PySide2.QtCore import QPropertyAnimation, QObject, QEasingCurve, Qt, QRectF, Signal as pyqtSignal, \
__Author__ = """By: Irony Property as pyqtProperty
QQ: 892768447 from PySide2.QtGui import QColor, QPainterPath, QPainter
Email: 892768447@qq.com""" from PySide2.QtWidgets import QApplication, QWidget
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
try: try:
from Lib import pointtool # @UnusedImport @UnresolvedImport from Lib import pointtool # @UnusedImport @UnresolvedImport
getDistance = pointtool.getDistance getDistance = pointtool.getDistance
findClose = pointtool.findClose findClose = pointtool.findClose
except: except:
import math import math
def getDistance(p1, p2): def getDistance(p1, p2):
return math.pow(p1.x - p2.x, 2) + math.pow(p1.y - p2.y, 2) return math.pow(p1.x - p2.x, 2) + math.pow(p1.y - p2.y, 2)
def findClose(points): def findClose(points):
plen = len(points) plen = len(points)
for i in range(plen): for i in range(plen):
@ -66,8 +66,7 @@ class Target:
class Point(QObject): class Point(QObject):
valueChanged = pyqtSignal(int)
valueChanged = pyqtSignal()
def __init__(self, x, ox, y, oy, *args, **kwargs): def __init__(self, x, ox, y, oy, *args, **kwargs):
super(Point, self).__init__(*args, **kwargs) super(Point, self).__init__(*args, **kwargs)
@ -90,12 +89,12 @@ class Point(QObject):
# 属性动画 # 属性动画
if not hasattr(self, 'xanimation'): if not hasattr(self, 'xanimation'):
self.xanimation = QPropertyAnimation( self.xanimation = QPropertyAnimation(
self, b'x', self, valueChanged=self.valueChanged.emit, self, b'x', self, easingCurve=QEasingCurve.InOutSine)
easingCurve=QEasingCurve.InOutSine) self.xanimation.valueChanged.connect(self.valueChanged.emit)
self.yanimation = QPropertyAnimation( self.yanimation = QPropertyAnimation(
self, b'y', self, valueChanged=self.valueChanged.emit, self, b'y', self, easingCurve=QEasingCurve.InOutSine)
easingCurve=QEasingCurve.InOutSine, self.yanimation.valueChanged.connect(self.valueChanged.emit)
finished=self.updateAnimation) self.yanimation.finished.connect(self.updateAnimation)
self.updateAnimation() self.updateAnimation()
def updateAnimation(self): def updateAnimation(self):
@ -138,6 +137,9 @@ class Window(QWidget):
self.target = Target(self.width() / 2, self.height() / 2) self.target = Target(self.width() / 2, self.height() / 2)
self.initPoints() self.initPoints()
def update(self, *args):
super(Window, self).update()
def paintEvent(self, event): def paintEvent(self, event):
super(Window, self).paintEvent(event) super(Window, self).paintEvent(event)
painter = QPainter() painter = QPainter()
@ -220,8 +222,9 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
import cgitb import cgitb
cgitb.enable(1, None, 5, '')
from PyQt5.QtWidgets import QApplication cgitb.enable(format='text')
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,18 +4,18 @@
""" """
Created on 2019年5月8日 Created on 2019年5月8日
@author: Irony @author: Irony
@site: https://pyqt5.com https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: ShakeWindow @file: ShakeWindow
@description: 抖动动画 @description: 抖动动画
""" """
try:
from PyQt5.QtCore import QPropertyAnimation, QPoint from PyQt5.QtCore import QPropertyAnimation, QPoint
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
except ImportError:
from PySide2.QtCore import QPropertyAnimation, QPoint
__Author__ = 'Irony' from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
__Copyright__ = 'Copyright (c) 2019 Irony'
__Version__ = 1.0
class Window(QWidget): class Window(QWidget):
@ -66,7 +66,7 @@ class Window(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = Window() w = Window()
w.show() w.show()

View file

@ -4,7 +4,7 @@
""" """
Created on 2018年12月27日 Created on 2018年12月27日
@author: Irony @author: Irony
@site: https://pyqt5.com , https://github.com/892768447 @site: https://pyqt.site , https://github.com/PyQt5
@email: 892768447@qq.com @email: 892768447@qq.com
@file: TabBarStyle @file: TabBarStyle
@description: @description:
@ -13,13 +13,6 @@ from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QProxyStyle 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): class TabBarStyle(QProxyStyle):
def sizeFromContents(self, types, option, size, widget): def sizeFromContents(self, types, option, size, widget):

View file

@ -9,8 +9,13 @@ Created on 2021年06月23日
@file: TabCornerStyle @file: TabCornerStyle
@description: @description:
""" """
try:
from PyQt5.QtCore import QRect from PyQt5.QtCore import QRect
from PyQt5.QtWidgets import QProxyStyle, QStyle from PyQt5.QtWidgets import QProxyStyle, QStyle
except ImportError:
from PySide2.QtCore import QRect
from PySide2.QtWidgets import QProxyStyle, QStyle
class TabCornerStyle(QProxyStyle): class TabCornerStyle(QProxyStyle):

Some files were not shown because too many files have changed in this diff Show more