support PySide2
This commit is contained in:
parent
e397db884f
commit
48ef9a5b88
220 changed files with 2457 additions and 2542 deletions
|
@ -1,21 +1,23 @@
|
||||||
#!/usr/bin/env python
|
#!/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
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QHBoxLayout
|
try:
|
||||||
|
from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QHBoxLayout
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtWidgets import QApplication, QPushButton, QWidget, QHBoxLayout
|
||||||
|
|
||||||
canRestart = True
|
canRestart = True
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QRectF, Qt, QPropertyAnimation, pyqtProperty, \
|
try:
|
||||||
QPoint, QParallelAnimationGroup, QEasingCurve
|
from PyQt5.QtCore import QRectF, Qt, QPropertyAnimation, pyqtProperty, \
|
||||||
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QPen
|
QPoint, QParallelAnimationGroup, QEasingCurve
|
||||||
from PyQt5.QtWidgets import QLabel, QWidget, QVBoxLayout, QApplication,\
|
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QPen
|
||||||
QLineEdit, QPushButton
|
from PyQt5.QtWidgets import QLabel, QWidget, QVBoxLayout, QApplication, \
|
||||||
|
QLineEdit, QPushButton
|
||||||
|
except ImportError:
|
||||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
from PySide2.QtCore import QRectF, Qt, QPropertyAnimation, Property as pyqtProperty, \
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
QPoint, QParallelAnimationGroup, QEasingCurve
|
||||||
__Version__ = "Version 1.0"
|
from PySide2.QtGui import QPainter, QPainterPath, QColor, QPen
|
||||||
|
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_())
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QProcess, QSysInfo
|
try:
|
||||||
from PyQt5.QtWidgets import QWidget, QTextEdit, QVBoxLayout, QPushButton
|
from PyQt5.QtCore import QProcess, QSysInfo
|
||||||
|
from PyQt5.QtWidgets import QApplication, QWidget, QTextEdit, QVBoxLayout, QPushButton
|
||||||
|
except ImportError:
|
||||||
__Author__ = 'Irony'
|
from PySide2.QtCore import QProcess, QSysInfo
|
||||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
from PySide2.QtWidgets import QApplication, QWidget, QTextEdit, QVBoxLayout, QPushButton
|
||||||
__Version__ = 1.0
|
|
||||||
|
|
||||||
|
|
||||||
class Window(QWidget):
|
class Window(QWidget):
|
||||||
|
@ -50,7 +49,7 @@ class Window(QWidget):
|
||||||
self.resultEdit.append('start osk error: %s' % e)
|
self.resultEdit.append('start osk error: %s' % e)
|
||||||
elif kernelType == 'darwin':
|
elif kernelType == 'darwin':
|
||||||
pass
|
pass
|
||||||
# elif kernelType=='linux':
|
# elif kernelType=='linux':
|
||||||
else:
|
else:
|
||||||
ret = QProcess.startDetached('florence')
|
ret = QProcess.startDetached('florence')
|
||||||
self.resultEdit.append('start florence: %s' % ret)
|
self.resultEdit.append('start florence: %s' % ret)
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QTimer, Qt
|
try:
|
||||||
from PyQt5.QtGui import QColor, QPainter, QPainterPath, QPen
|
from PyQt5.QtCore import QTimer, Qt
|
||||||
from PyQt5.QtWidgets import QWidget
|
from PyQt5.QtGui import QColor, QPainter, QPainterPath, QPen
|
||||||
|
from PyQt5.QtWidgets import QWidget, QApplication
|
||||||
|
except ImportError:
|
||||||
__Author__ = 'Irony'
|
from PySide2.QtCore import QTimer, Qt
|
||||||
__Copyright__ = 'Copyright (c) 2019'
|
from PySide2.QtGui import QColor, QPainter, QPainterPath, QPen
|
||||||
|
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的随机小数
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +92,7 @@ class Circle:
|
||||||
self.radius = hyperRange(radMin, radMax)
|
self.radius = hyperRange(radMin, radMax)
|
||||||
self.filled = (False if randint(
|
self.filled = (False if randint(
|
||||||
0, 100) > concentricCircle else 'full') if self.radius < radThreshold else (
|
0, 100) > concentricCircle else 'full') if self.radius < radThreshold else (
|
||||||
False if randint(0, 100) > concentricCircle else 'concentric')
|
False if randint(0, 100) > concentricCircle else 'concentric')
|
||||||
self.color = colors[randint(0, len(colors) - 1)]
|
self.color = colors[randint(0, len(colors) - 1)]
|
||||||
self.borderColor = colors[randint(0, len(colors) - 1)]
|
self.borderColor = colors[randint(0, len(colors) - 1)]
|
||||||
self.opacity = 0.05
|
self.opacity = 0.05
|
||||||
|
@ -233,29 +237,29 @@ class CircleLineWindow(QWidget):
|
||||||
# otherwise we connect them only if the dist is < linkDist
|
# otherwise we connect them only if the dist is < linkDist
|
||||||
if dist < self.linkDist:
|
if dist < self.linkDist:
|
||||||
xi = (1 if circles[i].x < circles[j].x else -
|
xi = (1 if circles[i].x < circles[j].x else -
|
||||||
1) * abs(circles[i].radius * deltax / dist)
|
1) * abs(circles[i].radius * deltax / dist)
|
||||||
yi = (1 if circles[i].y < circles[j].y else -
|
yi = (1 if circles[i].y < circles[j].y else -
|
||||||
1) * abs(circles[i].radius * deltay / dist)
|
1) * abs(circles[i].radius * deltay / dist)
|
||||||
xj = (-1 if circles[i].x < circles[j].x else 1) * \
|
xj = (-1 if circles[i].x < circles[j].x else 1) * \
|
||||||
abs(circles[j].radius * deltax / dist)
|
abs(circles[j].radius * deltax / dist)
|
||||||
yj = (-1 if circles[i].y < circles[j].y else 1) * \
|
yj = (-1 if circles[i].y < circles[j].y else 1) * \
|
||||||
abs(circles[j].radius * deltay / dist)
|
abs(circles[j].radius * deltay / dist)
|
||||||
path = QPainterPath()
|
path = QPainterPath()
|
||||||
path.moveTo(circles[i].x + xi, circles[i].y + yi)
|
path.moveTo(circles[i].x + xi, circles[i].y + yi)
|
||||||
path.lineTo(circles[j].x + xj, circles[j].y + yj)
|
path.lineTo(circles[j].x + xj, circles[j].y + yj)
|
||||||
# samecolor = circles[i].color == circles[j].color
|
# samecolor = circles[i].color == circles[j].color
|
||||||
c = QColor(circles[i].borderColor)
|
c = QColor(circles[i].borderColor)
|
||||||
c.setAlphaF(min(circles[i].opacity, circles[j].opacity)
|
c.setAlphaF(min(circles[i].opacity, circles[j].opacity)
|
||||||
* ((self.linkDist - dist) / self.linkDist))
|
* ((self.linkDist - dist) / self.linkDist))
|
||||||
painter.setPen(QPen(c, (
|
painter.setPen(QPen(c, (
|
||||||
lineBorder * backgroundMlt if circles[i].background else lineBorder) * (
|
lineBorder * backgroundMlt if circles[i].background else lineBorder) * (
|
||||||
(self.linkDist - dist) / self.linkDist)))
|
(self.linkDist - dist) / self.linkDist)))
|
||||||
painter.drawPath(path)
|
painter.drawPath(path)
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal
|
try:
|
||||||
from PyQt5.QtWidgets import QPushButton
|
from PyQt5.QtCore import pyqtProperty, pyqtSignal
|
||||||
|
from PyQt5.QtWidgets import QPushButton, QApplication
|
||||||
|
except ImportError:
|
||||||
__version__ = "0.0.1"
|
from PySide2.QtCore import Property as pyqtProperty, Signal as pyqtSignal
|
||||||
|
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(
|
||||||
|
|
|
@ -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
|
||||||
from PyQt5.QtCore import Qt
|
|
||||||
from PyQt5.QtGui import QWindow
|
try:
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListWidget, \
|
from PyQt5.QtCore import Qt
|
||||||
QLabel
|
from PyQt5.QtGui import QWindow
|
||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListWidget, \
|
||||||
|
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()
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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: 无边框圆角对话框
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import Qt, QSize, QTimer
|
|
||||||
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget,\
|
|
||||||
QGraphicsDropShadowEffect, QPushButton, QGridLayout, QSpacerItem,\
|
|
||||||
QSizePolicy
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = "Irony"
|
from PyQt5.QtCore import Qt, QSize, QTimer
|
||||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget, \
|
||||||
__Version__ = 1.0
|
QGraphicsDropShadowEffect, QPushButton, QGridLayout, QSpacerItem, \
|
||||||
|
QSizePolicy, QApplication
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Qt, QSize, QTimer
|
||||||
|
from PySide2.QtWidgets import QDialog, QVBoxLayout, QWidget, \
|
||||||
|
QGraphicsDropShadowEffect, QPushButton, QGridLayout, QSpacerItem, \
|
||||||
|
QSizePolicy, QApplication
|
||||||
|
|
||||||
Stylesheet = """
|
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_()
|
||||||
|
|
|
@ -1,24 +1,26 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from PyQt5.QtGui import QIcon
|
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QTextEdit
|
|
||||||
|
"""
|
||||||
|
Created on 2018年4月30日
|
||||||
|
@author: Irony
|
||||||
|
@site: https://pyqt.site , https://github.com/PyQt5
|
||||||
|
@email: 892768447@qq.com
|
||||||
|
@file: Test
|
||||||
|
@description:
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
from PyQt5.QtGui import QIcon
|
||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QTextEdit, 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()
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -1,26 +1,29 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from PyQt5.QtCore import Qt, pyqtSignal, QPoint
|
|
||||||
from PyQt5.QtGui import QFont, QEnterEvent, QPainter, QColor, QPen
|
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel,\
|
|
||||||
QSpacerItem, QSizePolicy, QPushButton
|
|
||||||
|
|
||||||
|
|
||||||
# Created on 2018年4月30日
|
"""
|
||||||
# author: Irony
|
Created on 2018年4月30日
|
||||||
# site: https://pyqt5.com , https://github.com/892768447
|
@author: Irony
|
||||||
# email: 892768447@qq.com
|
@site: https://pyqt.site , https://github.com/PyQt5
|
||||||
# file: FramelessWindow
|
@email: 892768447@qq.com
|
||||||
# description:
|
@file: FramelessWindow
|
||||||
__Author__ = """By: Irony
|
@description:
|
||||||
QQ: 892768447
|
"""
|
||||||
Email: 892768447@qq.com"""
|
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
try:
|
||||||
__Version__ = 1.0
|
from PyQt5.QtCore import Qt, pyqtSignal, QPoint
|
||||||
|
from PyQt5.QtGui import QFont, QEnterEvent, QPainter, QColor, QPen
|
||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, \
|
||||||
|
QSpacerItem, QSizePolicy, QPushButton
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Qt, Signal as pyqtSignal, QPoint
|
||||||
|
from PySide2.QtGui import QFont, QEnterEvent, QPainter, QColor, QPen
|
||||||
|
from PySide2.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, \
|
||||||
|
QSpacerItem, QSizePolicy, QPushButton
|
||||||
|
|
||||||
|
|
||||||
class TitleBar(QWidget):
|
class TitleBar(QWidget):
|
||||||
|
|
||||||
# 窗口最小化信号
|
# 窗口最小化信号
|
||||||
windowMinimumed = pyqtSignal()
|
windowMinimumed = pyqtSignal()
|
||||||
# 窗口最大化信号
|
# 窗口最大化信号
|
||||||
|
@ -48,7 +51,7 @@ class TitleBar(QWidget):
|
||||||
layout.setContentsMargins(0, 0, 0, 0)
|
layout.setContentsMargins(0, 0, 0, 0)
|
||||||
# 窗口图标
|
# 窗口图标
|
||||||
self.iconLabel = QLabel(self)
|
self.iconLabel = QLabel(self)
|
||||||
# self.iconLabel.setScaledContents(True)
|
# self.iconLabel.setScaledContents(True)
|
||||||
layout.addWidget(self.iconLabel)
|
layout.addWidget(self.iconLabel)
|
||||||
# 窗口标题
|
# 窗口标题
|
||||||
self.titleLabel = QLabel(self)
|
self.titleLabel = QLabel(self)
|
||||||
|
@ -138,7 +141,6 @@ Left, Top, Right, Bottom, LeftTop, RightTop, LeftBottom, RightBottom = range(8)
|
||||||
|
|
||||||
|
|
||||||
class FramelessWindow(QWidget):
|
class FramelessWindow(QWidget):
|
||||||
|
|
||||||
# 四周边距
|
# 四周边距
|
||||||
Margins = 5
|
Margins = 5
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import QTimer, Qt
|
|
||||||
from PyQt5.QtGui import QCursor, QPixmap
|
|
||||||
from PyQt5.QtWidgets import QApplication
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = 'Irony'
|
from PyQt5.QtCore import QTimer, Qt
|
||||||
__Copyright__ = 'Copyright (c) 2020'
|
from PyQt5.QtGui import QCursor, QPixmap
|
||||||
__Version__ = 1.0
|
from PyQt5.QtWidgets import QApplication
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QTimer, Qt
|
||||||
|
from PySide2.QtGui import QCursor, QPixmap
|
||||||
|
from PySide2.QtWidgets import QApplication
|
||||||
|
|
||||||
|
|
||||||
class QCursorGif:
|
class QCursorGif:
|
||||||
|
@ -55,4 +56,4 @@ class QCursorGif:
|
||||||
|
|
||||||
def setOldCursor(self, parent=None):
|
def setOldCursor(self, parent=None):
|
||||||
self._oldCursor = (parent.cursor() or Qt.ArrowCursor) if parent else (
|
self._oldCursor = (parent.cursor() or Qt.ArrowCursor) if parent else (
|
||||||
QApplication.instance().overrideCursor() or Qt.ArrowCursor)
|
QApplication.instance().overrideCursor() or Qt.ArrowCursor)
|
||||||
|
|
|
@ -6,46 +6,50 @@
|
||||||
#
|
#
|
||||||
# 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, 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):
|
||||||
NotifyForm.setObjectName("NotifyForm")
|
NotifyForm.setObjectName("NotifyForm")
|
||||||
NotifyForm.resize(300, 200)
|
NotifyForm.resize(300, 200)
|
||||||
NotifyForm.setStyleSheet("QWidget#widgetTitle {\n"
|
NotifyForm.setStyleSheet("QWidget#widgetTitle {\n"
|
||||||
" background-color: rgb(76, 169, 106);\n"
|
" background-color: rgb(76, 169, 106);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QWidget#widgetBottom {\n"
|
"QWidget#widgetBottom {\n"
|
||||||
" border-top-style: solid;\n"
|
" border-top-style: solid;\n"
|
||||||
" border-top-width: 2px;\n"
|
" border-top-width: 2px;\n"
|
||||||
" border-top-color: rgb(185, 218, 201);\n"
|
" border-top-color: rgb(185, 218, 201);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QLabel#labelTitle {\n"
|
"QLabel#labelTitle {\n"
|
||||||
" color: rgb(255, 255, 255);\n"
|
" color: rgb(255, 255, 255);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QLabel#labelContent {\n"
|
"QLabel#labelContent {\n"
|
||||||
" padding: 5px;\n"
|
" padding: 5px;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QPushButton {\n"
|
"QPushButton {\n"
|
||||||
" border: none;\n"
|
" border: none;\n"
|
||||||
" background: transparent;\n"
|
" background: transparent;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QPushButton#buttonClose {\n"
|
"QPushButton#buttonClose {\n"
|
||||||
" font-family: \"webdings\";\n"
|
" font-family: \"webdings\";\n"
|
||||||
" color: rgb(255, 255, 255);\n"
|
" color: rgb(255, 255, 255);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QPushButton#buttonClose:hover {\n"
|
"QPushButton#buttonClose:hover {\n"
|
||||||
" background-color: rgb(212, 64, 39);\n"
|
" background-color: rgb(212, 64, 39);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QPushButton#buttonView {\n"
|
"QPushButton#buttonView {\n"
|
||||||
" color: rgb(255, 255, 255);\n"
|
" color: rgb(255, 255, 255);\n"
|
||||||
" border-radius: 5px;\n"
|
" border-radius: 5px;\n"
|
||||||
" border: solid 1px rgb(76, 169, 106);\n"
|
" border: solid 1px rgb(76, 169, 106);\n"
|
||||||
" background-color: rgb(76, 169, 106);\n"
|
" background-color: rgb(76, 169, 106);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"QPushButton#buttonView:hover {\n"
|
"QPushButton#buttonView:hover {\n"
|
||||||
" color: rgb(0, 0, 0);\n"
|
" color: rgb(0, 0, 0);\n"
|
||||||
"}")
|
"}")
|
||||||
self.verticalLayout = QtWidgets.QVBoxLayout(NotifyForm)
|
self.verticalLayout = QtWidgets.QVBoxLayout(NotifyForm)
|
||||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.verticalLayout.setSpacing(6)
|
self.verticalLayout.setSpacing(6)
|
||||||
|
@ -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_())
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
try:
|
||||||
|
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,15 +87,17 @@ 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",
|
||||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
"p, li { white-space: pre-wrap; }\n"
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||||
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
"p, li { white-space: pre-wrap; }\n"
|
||||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">frameless window with move and resize</p></body></html>"))
|
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">frameless window with move and resize</p></body></html>"))
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
|
|
@ -2,42 +2,40 @@
|
||||||
# -*- 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):
|
||||||
_fields_ = [
|
_fields_ = [
|
||||||
("ptReserved", POINT),
|
("ptReserved", POINT),
|
||||||
("ptMaxSize", POINT),
|
("ptMaxSize", POINT),
|
||||||
("ptMaxPosition", POINT),
|
("ptMaxPosition", POINT),
|
||||||
("ptMinTrackSize", POINT),
|
("ptMinTrackSize", POINT),
|
||||||
("ptMaxTrackSize", POINT),
|
("ptMaxTrackSize", POINT),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -10,10 +10,16 @@ Created on 2018年4月30日
|
||||||
@description:
|
@description:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
from PyQt5.QtCore import QTimer, Qt, QEvent, QObject
|
||||||
|
from PyQt5.QtGui import QWindow, QPainter, QColor, QMouseEvent
|
||||||
|
from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QTimer, Qt, QEvent, QObject
|
||||||
|
from PySide2.QtGui import QWindow, QPainter, QColor, QMouseEvent
|
||||||
|
from PySide2.QtWidgets import QApplication, QWidget, QMessageBox
|
||||||
|
|
||||||
from Lib.ui_frameless import Ui_FormFrameless
|
from Lib.ui_frameless import Ui_FormFrameless
|
||||||
from PyQt5.QtCore import QTimer, Qt, QEvent, QObject
|
|
||||||
from PyQt5.QtGui import QWindow, QPainter, QColor, QMouseEvent
|
|
||||||
from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox
|
|
||||||
|
|
||||||
|
|
||||||
class FramelessObject(QObject):
|
class FramelessObject(QObject):
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QRectF, QSize, pyqtSignal, QTimer
|
try:
|
||||||
from PyQt5.QtGui import QPixmap, QImage, QPainter, QPainterPath,\
|
from PyQt5.QtCore import Qt, QRectF, QSize, pyqtSignal, QTimer
|
||||||
QColor
|
from PyQt5.QtGui import QPixmap, QImage, QPainter, QPainterPath, \
|
||||||
from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout,\
|
QColor
|
||||||
QGridLayout, QSpacerItem, QSizePolicy, QGraphicsDropShadowEffect,\
|
from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, \
|
||||||
QListWidget, QListWidgetItem
|
QGridLayout, QSpacerItem, QSizePolicy, QGraphicsDropShadowEffect, \
|
||||||
|
QListWidget, QListWidgetItem, QApplication, QPushButton
|
||||||
|
except ImportError:
|
||||||
__Author__ = """By: Irony
|
from PySide2.QtCore import Qt, QRectF, QSize, Signal as pyqtSignal, QTimer
|
||||||
QQ: 892768447
|
from PySide2.QtGui import QPixmap, QImage, QPainter, QPainterPath, \
|
||||||
Email: 892768447@qq.com"""
|
QColor
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
from PySide2.QtWidgets import QWidget, QLabel, QHBoxLayout, \
|
||||||
__Version__ = 1.0
|
QGridLayout, QSpacerItem, QSizePolicy, QGraphicsDropShadowEffect, \
|
||||||
|
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(
|
||||||
|
@ -268,9 +273,9 @@ if __name__ == '__main__':
|
||||||
callback=callback)))
|
callback=callback)))
|
||||||
w.show()
|
w.show()
|
||||||
|
|
||||||
# NotificationIcon.init()
|
# NotificationIcon.init()
|
||||||
# ww = NotificationItem('提示', '<html><head/><body><p><span style=" font-style:italic; color:teal;">这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案</span></p></body></html>', None,
|
# ww = NotificationItem('提示', '<html><head/><body><p><span style=" font-style:italic; color:teal;">这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案</span></p></body></html>', None,
|
||||||
# ntype=NotificationIcon.Error)
|
# ntype=NotificationIcon.Error)
|
||||||
# ww.bgWidget.setVisible(True)
|
# ww.bgWidget.setVisible(True)
|
||||||
# ww.show()
|
# ww.show()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
|
@ -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: 简单探测窗口和放大截图
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QRect
|
|
||||||
from PyQt5.QtGui import QPainter, QPen, QCursor, QColor
|
|
||||||
from PyQt5.QtWidgets import QLabel, QWidget, QApplication
|
|
||||||
import win32gui
|
import win32gui
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import Qt, QRect
|
||||||
QQ: 892768447
|
from PyQt5.QtGui import QPainter, QPen, QCursor, QColor
|
||||||
Email: 892768447@qq.com"""
|
from PyQt5.QtWidgets import QLabel, QWidget, QApplication
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
except ImportError:
|
||||||
__Version__ = 1.0
|
from PySide2.QtCore import Qt, QRect
|
||||||
|
from PySide2.QtGui import QPainter, QPen, QCursor, QColor
|
||||||
|
from PySide2.QtWidgets import QLabel, QWidget, QApplication
|
||||||
|
|
||||||
|
|
||||||
class FrameWidget(QWidget):
|
class FrameWidget(QWidget):
|
||||||
|
@ -111,11 +110,12 @@ class Label(QLabel):
|
||||||
painter.setPen(Qt.white)
|
painter.setPen(Qt.white)
|
||||||
painter.drawText(self.rect(), Qt.AlignLeft |
|
painter.drawText(self.rect(), Qt.AlignLeft |
|
||||||
Qt.AlignBottom, '({}, {})\nRGB: ({}, {}, {})\n{}'.format(
|
Qt.AlignBottom, '({}, {})\nRGB: ({}, {}, {})\n{}'.format(
|
||||||
pos.x(), pos.y(), r, g, b, QColor(r, g, b).name()))
|
pos.x(), pos.y(), r, g, b, QColor(r, g, b).name()))
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QObject, pyqtSignal, QTimer, Qt
|
try:
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QProgressBar
|
from PyQt5.QtCore import QObject, pyqtSignal, QTimer, Qt
|
||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QProgressBar, QApplication
|
||||||
|
except ImportError:
|
||||||
__Author__ = """By: Irony
|
from PySide2.QtCore import QObject, Signal as pyqtSignal, QTimer, Qt
|
||||||
QQ: 892768447
|
from PySide2.QtWidgets import QWidget, QVBoxLayout, QProgressBar, QApplication
|
||||||
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()
|
||||||
|
|
|
@ -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: 窗口重启
|
||||||
'''
|
"""
|
||||||
from PyQt5.QtCore import pyqtSignal
|
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit,\
|
|
||||||
QMessageBox
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
from PyQt5.QtCore import pyqtSignal
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit, \
|
||||||
__Version__ = "Version 1.0"
|
QMessageBox, QApplication
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Signal as pyqtSignal
|
||||||
|
from PySide2.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit, \
|
||||||
|
QMessageBox, QApplication
|
||||||
|
|
||||||
|
|
||||||
class RestartWindow(QWidget):
|
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QTimer, QRect
|
try:
|
||||||
from PyQt5.QtWidgets import QApplication, QPlainTextEdit, qApp
|
from PyQt5.QtCore import QTimer, QRect
|
||||||
|
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}), '
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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():
|
||||||
|
|
|
@ -4,20 +4,18 @@
|
||||||
"""
|
"""
|
||||||
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: 调整窗口显示边框
|
||||||
"""
|
"""
|
||||||
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()
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, qrand, QPointF, QPoint, QBasicTimer
|
try:
|
||||||
from PyQt5.QtGui import QPainter, QBrush, QPen, QPalette, QFontMetrics
|
from PyQt5.QtCore import Qt, qrand, QPointF, QPoint, QBasicTimer
|
||||||
from PyQt5.QtWidgets import QLabel
|
from PyQt5.QtGui import QPainter, QBrush, QPen, QPalette, QFontMetrics, QFontDatabase
|
||||||
|
from PyQt5.QtWidgets import QLabel, QApplication, QWidget, QHBoxLayout, QLineEdit
|
||||||
|
except ImportError:
|
||||||
__version__ = "0.0.1"
|
from PySide2.QtCore import Qt, qrand, QPointF, QPoint, QBasicTimer
|
||||||
|
from PySide2.QtGui import QPainter, QBrush, QPen, QPalette, QFontMetrics, QFontDatabase
|
||||||
|
from PySide2.QtWidgets import QLabel, QApplication, QWidget, QHBoxLayout, QLineEdit
|
||||||
|
|
||||||
DEF_NOISYPOINTCOUNT = 60 # 噪点数量
|
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):
|
||||||
|
@ -58,11 +61,11 @@ class WidgetCode(QLabel):
|
||||||
def setSensitive(self, sensitive):
|
def setSensitive(self, sensitive):
|
||||||
self._sensitive = sensitive
|
self._sensitive = sensitive
|
||||||
|
|
||||||
# def setText(self, text):
|
# def setText(self, text):
|
||||||
# text = text if (text and len(text) == 4) else "".join(sample(WORDS, 4)) # 随机4个字符
|
# text = text if (text and len(text) == 4) else "".join(sample(WORDS, 4)) # 随机4个字符
|
||||||
# self._code = str(text)
|
# self._code = str(text)
|
||||||
# html = "".join([FONT.format(color=COLORLIST[qrand() % 6], word=t) for t in text])
|
# html = "".join([FONT.format(color=COLORLIST[qrand() % 6], word=t) for t in text])
|
||||||
# super(WidgetCode, self).setText(HTML.format(html=html))
|
# super(WidgetCode, self).setText(HTML.format(html=html))
|
||||||
|
|
||||||
def mouseReleaseEvent(self, event):
|
def mouseReleaseEvent(self, event):
|
||||||
super(WidgetCode, self).mouseReleaseEvent(event)
|
super(WidgetCode, self).mouseReleaseEvent(event)
|
||||||
|
@ -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")
|
||||||
|
@ -121,7 +123,7 @@ if __name__ == "__main__":
|
||||||
cwidget = WidgetCode(w, minimumHeight=35, minimumWidth=80)
|
cwidget = WidgetCode(w, minimumHeight=35, minimumWidth=80)
|
||||||
layout.addWidget(cwidget)
|
layout.addWidget(cwidget)
|
||||||
lineEdit = QLineEdit(w, maxLength=4, placeholderText="请输入验证码并按回车验证",
|
lineEdit = QLineEdit(w, maxLength=4, placeholderText="请输入验证码并按回车验证",
|
||||||
returnPressed=lambda:print(cwidget.check(lineEdit.text())))
|
returnPressed=lambda: print(cwidget.check(lineEdit.text())))
|
||||||
layout.addWidget(lineEdit)
|
layout.addWidget(lineEdit)
|
||||||
w.show()
|
w.show()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
|
@ -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: 简单的窗口贴边隐藏
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import Qt
|
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = 'By: Irony\nQQ: 892768447\nEmail: 892768447@qq.com'
|
from PyQt5.QtCore import Qt
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
|
||||||
__Version__ = 1.0
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Qt
|
||||||
|
from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QPropertyAnimation, QPoint, QTimer, pyqtSignal
|
try:
|
||||||
from PyQt5.QtWidgets import QWidget, QPushButton
|
from PyQt5.QtCore import Qt, QPropertyAnimation, QPoint, QTimer, pyqtSignal
|
||||||
|
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):
|
||||||
|
@ -60,10 +60,10 @@ class WindowNotify(QWidget, Ui_NotifyForm):
|
||||||
webbrowser.open_new_tab("http://alyl.vip")
|
webbrowser.open_new_tab("http://alyl.vip")
|
||||||
|
|
||||||
def onClose(self):
|
def onClose(self):
|
||||||
#点击关闭按钮时
|
# 点击关闭按钮时
|
||||||
print("onClose")
|
print("onClose")
|
||||||
self.isShow = False
|
self.isShow = False
|
||||||
QTimer.singleShot(100, self.closeAnimation)#启动弹回动画
|
QTimer.singleShot(100, self.closeAnimation) # 启动弹回动画
|
||||||
|
|
||||||
def _init(self):
|
def _init(self):
|
||||||
# 隐藏任务栏|去掉边框|顶层显示
|
# 隐藏任务栏|去掉边框|顶层显示
|
||||||
|
@ -112,13 +112,14 @@ class WindowNotify(QWidget, Ui_NotifyForm):
|
||||||
print("showAnimation isShow = True")
|
print("showAnimation isShow = True")
|
||||||
# 显示动画
|
# 显示动画
|
||||||
self.isShow = True
|
self.isShow = True
|
||||||
self.animation.stop()#先停止之前的动画,重新开始
|
self.animation.stop() # 先停止之前的动画,重新开始
|
||||||
self.animation.setStartValue(self.pos())
|
self.animation.setStartValue(self.pos())
|
||||||
self.animation.setEndValue(self._endPos)
|
self.animation.setEndValue(self._endPos)
|
||||||
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):
|
||||||
print("closeAnimation hasFocus", self.hasFocus())
|
print("closeAnimation hasFocus", self.hasFocus())
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -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:
|
||||||
'''
|
"""
|
||||||
|
|
|
@ -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"))
|
||||||
|
|
||||||
|
|
|
@ -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", "分析"))
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -27,11 +30,12 @@ class CustomViewBox(pg.ViewBox):
|
||||||
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):
|
||||||
# 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__()
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
@ -39,34 +43,36 @@ 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))
|
||||||
ticks = [list(zip(range(4), tuple(time)))]
|
ticks = [list(zip(range(4), tuple(time)))]
|
||||||
vb = CustomViewBox()
|
vb = CustomViewBox()
|
||||||
plt = pg.PlotWidget(title="标题这里填写",viewBox=vb)
|
plt = pg.PlotWidget(title="标题这里填写", viewBox=vb)
|
||||||
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()
|
||||||
w.show()
|
w.show()
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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,38 +27,41 @@ 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__()
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.pushButton_7.clicked.connect(self.test)
|
self.pushButton_7.clicked.connect(self.test)
|
||||||
self.tabWidget.clear()
|
self.tabWidget.clear()
|
||||||
|
|
||||||
def handleChanged(self,item,column):
|
def handleChanged(self, item, column):
|
||||||
count = item.childCount()
|
count = item.childCount()
|
||||||
if item.checkState(column) == Qt.Checked:
|
if item.checkState(column) == Qt.Checked:
|
||||||
for index in range(count):
|
for index in range(count):
|
||||||
item.child(index).setCheckState(0,Qt.Checked)
|
item.child(index).setCheckState(0, Qt.Checked)
|
||||||
if item.checkState(column) == Qt.Unchecked:
|
if item.checkState(column) == Qt.Unchecked:
|
||||||
for index in range(count):
|
for index in range(count):
|
||||||
item.child(index).setCheckState(0,Qt.Unchecked)
|
item.child(index).setCheckState(0, Qt.Unchecked)
|
||||||
|
|
||||||
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]
|
||||||
|
@ -65,25 +69,27 @@ class graphAnalysis(QDialog,graph_Form):
|
||||||
ticks = [list(zip(range(4), tuple(time)))]
|
ticks = [list(zip(range(4), tuple(time)))]
|
||||||
for i in range(11):
|
for i in range(11):
|
||||||
vb1 = CustomViewBox()
|
vb1 = CustomViewBox()
|
||||||
plt1 = pg.PlotWidget(title="Basic array plotting%s"%i, viewBox=vb1)
|
plt1 = pg.PlotWidget(title="Basic array plotting%s" % i, viewBox=vb1)
|
||||||
plt1.resize(500, 500)
|
plt1.resize(500, 500)
|
||||||
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()
|
||||||
w.show()
|
w.show()
|
||||||
|
|
|
@ -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,11 +46,14 @@ 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):
|
||||||
pg.AxisItem.__init__(self, *args, **kwargs)
|
pg.AxisItem.__init__(self, *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):
|
||||||
|
@ -76,5 +85,5 @@ class CustomViewBox(pg.ViewBox):
|
||||||
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):
|
||||||
pg.ViewBox.wheelEvent(self, ev, axis)
|
pg.ViewBox.wheelEvent(self, ev, axis)
|
|
@ -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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
try:
|
||||||
from PyQt5.QtGui import QTextCharFormat, QBrush, QColor
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import QApplication, QCalendarWidget
|
from PyQt5.QtGui import QTextCharFormat, QBrush, QColor
|
||||||
|
from PyQt5.QtWidgets import QApplication, QCalendarWidget
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Qt
|
||||||
|
from PySide2.QtGui import QTextCharFormat, QBrush, QColor
|
||||||
|
from PySide2.QtWidgets import QApplication, QCalendarWidget
|
||||||
|
|
||||||
|
StyleSheet = """
|
||||||
StyleSheet = '''
|
|
||||||
/*顶部导航区域*/
|
/*顶部导航区域*/
|
||||||
#qt_calendar_navigationbar {
|
#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):
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QSortFilterProxyModel, QRegExp
|
|
||||||
from PyQt5.QtGui import QStandardItemModel, QStandardItem
|
|
||||||
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QComboBox,\
|
|
||||||
QLabel, QSpacerItem, QSizePolicy
|
|
||||||
import chardet
|
import chardet
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
from PyQt5.QtCore import Qt, QSortFilterProxyModel, QRegExp
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
from PyQt5.QtGui import QStandardItemModel, QStandardItem
|
||||||
__Version__ = "Version 1.0"
|
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QComboBox, \
|
||||||
|
QLabel, QSpacerItem, QSizePolicy
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Qt, QSortFilterProxyModel, QRegExp
|
||||||
|
from PySide2.QtGui import QStandardItemModel, QStandardItem
|
||||||
|
from PySide2.QtWidgets import QWidget, QApplication, QHBoxLayout, QComboBox, \
|
||||||
|
QLabel, QSpacerItem, QSizePolicy
|
||||||
|
|
||||||
|
|
||||||
class SortFilterProxyModel(QSortFilterProxyModel):
|
class SortFilterProxyModel(QSortFilterProxyModel):
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QFileInfo
|
try:
|
||||||
from PyQt5.QtGui import QIcon
|
from PyQt5.QtCore import QFileInfo
|
||||||
from PyQt5.QtWidgets import QFileSystemModel, QFileIconProvider, QApplication,\
|
from PyQt5.QtGui import QIcon
|
||||||
QTreeView
|
from PyQt5.QtWidgets import QFileSystemModel, QFileIconProvider, QApplication, \
|
||||||
|
QTreeView
|
||||||
|
except ImportError:
|
||||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
from PySide2.QtCore import QFileInfo
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
from PySide2.QtGui import QIcon
|
||||||
__Version__ = "Version 1.0"
|
from PySide2.QtWidgets import QFileSystemModel, QFileIconProvider, QApplication, \
|
||||||
|
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)
|
||||||
|
|
|
@ -1,33 +1,28 @@
|
||||||
#!/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
|
||||||
|
|
||||||
from PyQt5.QtCore import QSize, Qt, QUrl, QTimer, pyqtSignal
|
from PyQt5.QtCore import QSize, Qt, QUrl, QTimer, pyqtSignal
|
||||||
from PyQt5.QtGui import QPainter, QFont, QLinearGradient, QGradient, QColor,\
|
from PyQt5.QtGui import QPainter, QFont, QLinearGradient, QGradient, QColor, \
|
||||||
QBrush, QPaintEvent, QPixmap
|
QBrush, QPaintEvent, QPixmap
|
||||||
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
|
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}"
|
||||||
|
@ -78,8 +73,8 @@ class CoverLabel(QLabel):
|
||||||
|
|
||||||
def __init__(self, cover_path, cover_title, video_url, *args, **kwargs):
|
def __init__(self, cover_path, cover_title, video_url, *args, **kwargs):
|
||||||
super(CoverLabel, self).__init__(*args, **kwargs)
|
super(CoverLabel, self).__init__(*args, **kwargs)
|
||||||
# super(CoverLabel, self).__init__(
|
# super(CoverLabel, self).__init__(
|
||||||
# '<html><head/><body><img src="{0}"/></body></html>'.format(os.path.abspath(cover_path)), *args, **kwargs)
|
# '<html><head/><body><img src="{0}"/></body></html>'.format(os.path.abspath(cover_path)), *args, **kwargs)
|
||||||
self.setCursor(Qt.PointingHandCursor)
|
self.setCursor(Qt.PointingHandCursor)
|
||||||
self.setScaledContents(True)
|
self.setScaledContents(True)
|
||||||
self.setMinimumSize(220, 308)
|
self.setMinimumSize(220, 308)
|
||||||
|
@ -168,7 +163,8 @@ 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):
|
||||||
# 每个item控件的大小
|
# 每个item控件的大小
|
||||||
|
@ -188,7 +184,6 @@ class ItemWidget(QWidget):
|
||||||
|
|
||||||
|
|
||||||
class GridWidget(QWidget):
|
class GridWidget(QWidget):
|
||||||
|
|
||||||
Page = 0
|
Page = 0
|
||||||
loadStarted = pyqtSignal(bool)
|
loadStarted = pyqtSignal(bool)
|
||||||
|
|
||||||
|
@ -252,11 +247,11 @@ class GridWidget(QWidget):
|
||||||
figure_score = "".join(li.xpath(".//em/text()")) # 评分
|
figure_score = "".join(li.xpath(".//em/text()")) # 评分
|
||||||
# 主演
|
# 主演
|
||||||
figure_desc = "<span style=\"font-size: 12px;\">主演:</span>" + \
|
figure_desc = "<span style=\"font-size: 12px;\">主演:</span>" + \
|
||||||
"".join([Actor.format(**dict(fd.items()))
|
"".join([Actor.format(**dict(fd.items()))
|
||||||
for fd in li.xpath(".//div[@class='figure_desc']/a")])
|
for fd in li.xpath(".//div[@class='figure_desc']/a")])
|
||||||
# 播放数
|
# 播放数
|
||||||
figure_count = (
|
figure_count = (
|
||||||
li.xpath(".//div[@class='figure_count']/span/text()") or [""])[0]
|
li.xpath(".//div[@class='figure_count']/span/text()") or [""])[0]
|
||||||
path = "cache/{0}.jpg".format(
|
path = "cache/{0}.jpg".format(
|
||||||
os.path.splitext(os.path.basename(video_url))[0])
|
os.path.splitext(os.path.basename(video_url))[0])
|
||||||
cover_path = "Data/pic_v.png"
|
cover_path = "Data/pic_v.png"
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtGui import QFontDatabase, QFont
|
try:
|
||||||
from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout,\
|
from PyQt5.QtGui import QFontDatabase, QFont
|
||||||
QScrollArea, QPushButton
|
from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, \
|
||||||
|
QScrollArea, QPushButton
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtGui import QFontDatabase, QFont
|
||||||
|
from PySide2.QtWidgets import QApplication, QWidget, QGridLayout, \
|
||||||
|
QScrollArea, QPushButton
|
||||||
|
|
||||||
from Lib.FontAwesome import FontAwesomes # @UnresolvedImport
|
from Lib.FontAwesome import FontAwesomes # @UnresolvedImport
|
||||||
|
|
||||||
|
|
|
@ -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(.*)")
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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: 边框动画阴影动画
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import QPropertyAnimation, pyqtProperty
|
|
||||||
from PyQt5.QtWidgets import QGraphicsDropShadowEffect
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import QPropertyAnimation, pyqtProperty
|
||||||
QQ: 892768447
|
from PyQt5.QtWidgets import QGraphicsDropShadowEffect
|
||||||
Email: 892768447@qq.com"""
|
except ImportError:
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
from PySide2.QtCore import QPropertyAnimation, Property as pyqtProperty
|
||||||
__Version__ = 1.0
|
from PySide2.QtWidgets import QGraphicsDropShadowEffect
|
||||||
|
|
||||||
|
|
||||||
class AnimationShadowEffect(QGraphicsDropShadowEffect):
|
class AnimationShadowEffect(QGraphicsDropShadowEffect):
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import Qt
|
|
||||||
from PyQt5.QtGui import QPixmap
|
try:
|
||||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QPushButton, QLineEdit
|
from PyQt5.QtCore import Qt
|
||||||
|
from PyQt5.QtGui import QPixmap
|
||||||
|
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
try:
|
||||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QVBoxLayout,\
|
from PyQt5.QtCore import Qt
|
||||||
QApplication, QGraphicsView, QGraphicsScene
|
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QVBoxLayout, \
|
||||||
|
QApplication, QGraphicsView, QGraphicsScene
|
||||||
|
except ImportError:
|
||||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
from PySide2.QtCore import Qt
|
||||||
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
|
from PySide2.QtWidgets import QWidget, QHBoxLayout, QLabel, QVBoxLayout, \
|
||||||
__Version__ = "Version 1.0"
|
QApplication, QGraphicsView, QGraphicsScene
|
||||||
|
|
||||||
|
|
||||||
class ToolTipItem(QWidget):
|
class ToolTipItem(QWidget):
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF
|
try:
|
||||||
from PyQt5.QtGui import QPainter, QColor, QImage, QPixmap
|
from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF
|
||||||
from PyQt5.QtWidgets import QGraphicsView, QGraphicsPixmapItem, QGraphicsScene
|
from PyQt5.QtGui import QPainter, QColor, QImage, QPixmap
|
||||||
|
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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QPointF, QRectF
|
try:
|
||||||
from PyQt5.QtGui import QColor, QPainter, QPolygonF, QPen, QBrush
|
from PyQt5.QtCore import Qt, QPointF, QRectF
|
||||||
from PyQt5.QtOpenGL import QGLFormat
|
from PyQt5.QtGui import QColor, QPainter, QPolygonF, QPen, QBrush
|
||||||
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsPolygonItem
|
from PyQt5.QtOpenGL import QGLFormat
|
||||||
|
from PyQt5.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsPolygonItem
|
||||||
|
except ImportError:
|
||||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
from PySide2.QtCore import Qt, QPointF, QRectF
|
||||||
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
|
from PySide2.QtGui import QColor, QPainter, QPolygonF, QPen, QBrush
|
||||||
__Version__ = "Version 1.0"
|
from PySide2.QtOpenGL import QGLFormat
|
||||||
|
from PySide2.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsPolygonItem
|
||||||
|
|
||||||
|
|
||||||
class GraphicsView(QGraphicsView):
|
class GraphicsView(QGraphicsView):
|
||||||
|
|
||||||
# 背景区域颜色
|
# 背景区域颜色
|
||||||
backgroundColor = QColor(31, 31, 47)
|
backgroundColor = QColor(31, 31, 47)
|
||||||
# 边框颜色
|
# 边框颜色
|
||||||
|
@ -94,8 +94,8 @@ class GraphicsView(QGraphicsView):
|
||||||
AnchorUnderMouse 鼠标当前位置被用作锚点
|
AnchorUnderMouse 鼠标当前位置被用作锚点
|
||||||
'''
|
'''
|
||||||
self.setTransformationAnchor(self.AnchorUnderMouse)
|
self.setTransformationAnchor(self.AnchorUnderMouse)
|
||||||
# if QGLFormat.hasOpenGL(): # 如果开启了OpenGL则使用OpenGL Widget
|
# if QGLFormat.hasOpenGL(): # 如果开启了OpenGL则使用OpenGL Widget
|
||||||
# self.setViewport(QGLWidget(QGLFormat(QGL.SampleBuffers)))
|
# self.setViewport(QGLWidget(QGLFormat(QGL.SampleBuffers)))
|
||||||
'''
|
'''
|
||||||
#参考 http://doc.qt.io/qt-5/qgraphicsview.html#ViewportUpdateMode-enum
|
#参考 http://doc.qt.io/qt-5/qgraphicsview.html#ViewportUpdateMode-enum
|
||||||
FullViewportUpdate 当场景的任何可见部分改变或重新显示时,QGraphicsView将更新整个视口。 当QGraphicsView花费更多的时间来计算绘制的内容(比如重复更新很多小项目)时,这种方法是最快的。 这是不支持部分更新(如QGLWidget)的视口以及需要禁用滚动优化的视口的首选更新模式。
|
FullViewportUpdate 当场景的任何可见部分改变或重新显示时,QGraphicsView将更新整个视口。 当QGraphicsView花费更多的时间来计算绘制的内容(比如重复更新很多小项目)时,这种方法是最快的。 这是不支持部分更新(如QGLWidget)的视口以及需要禁用滚动优化的视口的首选更新模式。
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -1,34 +1,28 @@
|
||||||
#!/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
|
||||||
|
|
||||||
from PyQt5.QtCore import QSize, Qt, QUrl, QTimer, pyqtSignal
|
from PyQt5.QtCore import QSize, Qt, QUrl, QTimer, pyqtSignal
|
||||||
from PyQt5.QtGui import QPainter, QFont, QLinearGradient, QGradient, QColor,\
|
from PyQt5.QtGui import QPainter, QFont, QLinearGradient, QGradient, QColor, \
|
||||||
QBrush, QPaintEvent, QPixmap
|
QBrush, QPaintEvent, QPixmap
|
||||||
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
|
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, 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,7 +160,8 @@ 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):
|
||||||
# 每个item控件的大小
|
# 每个item控件的大小
|
||||||
|
@ -186,7 +181,6 @@ class ItemWidget(QWidget):
|
||||||
|
|
||||||
|
|
||||||
class GridWidget(QWidget):
|
class GridWidget(QWidget):
|
||||||
|
|
||||||
Page = 0
|
Page = 0
|
||||||
loadStarted = pyqtSignal(bool)
|
loadStarted = pyqtSignal(bool)
|
||||||
|
|
||||||
|
@ -268,18 +262,19 @@ class GridWidget(QWidget):
|
||||||
figure_score = "".join(li.xpath(".//em/text()")) # 评分
|
figure_score = "".join(li.xpath(".//em/text()")) # 评分
|
||||||
# 主演
|
# 主演
|
||||||
figure_desc = "<span style=\"font-size: 12px;\">主演:</span>" + \
|
figure_desc = "<span style=\"font-size: 12px;\">主演:</span>" + \
|
||||||
"".join([Actor.format(**dict(fd.items()))
|
"".join([Actor.format(**dict(fd.items()))
|
||||||
for fd in li.xpath(".//div[@class='figure_desc']/a")])
|
for fd in li.xpath(".//div[@class='figure_desc']/a")])
|
||||||
# 播放数
|
# 播放数
|
||||||
figure_count = (
|
figure_count = (
|
||||||
li.xpath(".//div[@class='figure_count']/span/text()") or [""])[0]
|
li.xpath(".//div[@class='figure_count']/span/text()") or [""])[0]
|
||||||
path = "cache/{0}.jpg".format(
|
path = "cache/{0}.jpg".format(
|
||||||
os.path.splitext(os.path.basename(video_url))[0])
|
os.path.splitext(os.path.basename(video_url))[0])
|
||||||
cover_path = "Data/pic_v.png"
|
cover_path = "Data/pic_v.png"
|
||||||
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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: 圆形图片
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import Qt
|
|
||||||
from PyQt5.QtGui import QPixmap, QPainter, QPainterPath
|
|
||||||
from PyQt5.QtWidgets import QLabel, QWidget, QHBoxLayout
|
|
||||||
|
|
||||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
try:
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
|
from PyQt5.QtCore import Qt
|
||||||
__Version__ = "Version 1.0"
|
from PyQt5.QtGui import QPixmap, QPainter, QPainterPath
|
||||||
|
from PyQt5.QtWidgets import QLabel, QWidget, QHBoxLayout, QApplication
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Qt
|
||||||
|
from PySide2.QtGui import QPixmap, QPainter, QPainterPath
|
||||||
|
from PySide2.QtWidgets import QLabel, QWidget, QHBoxLayout, QApplication
|
||||||
|
|
||||||
|
|
||||||
class Label(QLabel):
|
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()
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import Qt
|
|
||||||
from PyQt5.QtGui import QPixmap, QPainter, QImage
|
|
||||||
from PyQt5.QtWidgets import QWidget, QLabel, QPushButton,\
|
|
||||||
QVBoxLayout, QHBoxLayout, QSpacerItem, QSizePolicy
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import Qt
|
||||||
QQ: 892768447
|
from PyQt5.QtGui import QPixmap, QPainter, QImage
|
||||||
Email: 892768447@qq.com"""
|
from PyQt5.QtWidgets import QWidget, QLabel, QPushButton, \
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
QVBoxLayout, QHBoxLayout, QSpacerItem, QSizePolicy, QApplication
|
||||||
__Version__ = "Version 1.0"
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Qt
|
||||||
|
from PySide2.QtGui import QPixmap, QPainter, QImage
|
||||||
|
from PySide2.QtWidgets import QWidget, QLabel, QPushButton, \
|
||||||
|
QVBoxLayout, QHBoxLayout, QSpacerItem, QSizePolicy, QApplication
|
||||||
|
|
||||||
|
|
||||||
class Window(QWidget):
|
class Window(QWidget):
|
||||||
|
@ -73,12 +73,12 @@ 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)
|
||||||
# self.srcImage = self.srcImage.transformed(
|
# self.srcImage = self.srcImage.transformed(
|
||||||
# trans, Qt.SmoothTransformation)
|
# trans, Qt.SmoothTransformation)
|
||||||
# self.imageLabel.setPixmap(QPixmap.fromImage(self.srcImage))
|
# self.imageLabel.setPixmap(QPixmap.fromImage(self.srcImage))
|
||||||
|
|
||||||
def doAnticlockwise(self):
|
def doAnticlockwise(self):
|
||||||
# 逆时针45度
|
# 逆时针45度
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtGui import QPixmap, QPainter
|
|
||||||
from PyQt5.QtWidgets import QWidget
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtGui import QPixmap, QPainter
|
||||||
QQ: 892768447
|
from PyQt5.QtWidgets import QWidget, QApplication
|
||||||
Email: 892768447@qq.com"""
|
except ImportError:
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
from PySide2.QtGui import QPixmap, QPainter
|
||||||
__Version__ = "Version 1.0"
|
from PySide2.QtWidgets import QWidget, QApplication
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QRect
|
try:
|
||||||
from PyQt5.QtGui import QImage, QColor, QPainter, qRed, qGreen, qBlue, qAlpha
|
from PyQt5.QtCore import QRect
|
||||||
|
from PyQt5.QtGui import QImage, QColor, QPainter, qRed, qGreen, qBlue, qAlpha
|
||||||
|
except ImportError:
|
||||||
__Author__ = """By: Irony
|
from PySide2.QtCore import QRect
|
||||||
QQ: 892768447
|
from PySide2.QtGui import QImage, QColor, QPainter, qRed, qGreen, qBlue, qAlpha
|
||||||
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):
|
||||||
|
@ -62,11 +60,11 @@ class ExceptionNot9Patch(Exception):
|
||||||
class NinePatch:
|
class NinePatch:
|
||||||
|
|
||||||
def __init__(self, fileName):
|
def __init__(self, fileName):
|
||||||
self.CachedImage = None # 缓存图片
|
self.CachedImage = None # 缓存图片
|
||||||
self.OldWidth = -1
|
self.OldWidth = -1
|
||||||
self.OldHeight = -1
|
self.OldHeight = -1
|
||||||
self.ResizeDistancesX = []
|
self.ResizeDistancesX = []
|
||||||
self.ResizeDistancesY = [] # [(int,int)]数组
|
self.ResizeDistancesY = [] # [(int,int)]数组
|
||||||
self.setImage(fileName)
|
self.setImage(fileName)
|
||||||
|
|
||||||
def width(self):
|
def width(self):
|
||||||
|
@ -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)
|
||||||
|
@ -241,10 +243,10 @@ class NinePatch:
|
||||||
# print("after GetFactor: ", width, height, factorX, factorY)
|
# print("after GetFactor: ", width, height, factorX, factorY)
|
||||||
lostX = 0.0
|
lostX = 0.0
|
||||||
lostY = 0.0
|
lostY = 0.0
|
||||||
x1 = 0 # for image parts X
|
x1 = 0 # for image parts X
|
||||||
y1 = 0 # for image parts Y
|
y1 = 0 # for image parts Y
|
||||||
# widthResize # width for image parts
|
# widthResize # width for image parts
|
||||||
# heightResize # height for image parts
|
# heightResize # height for image parts
|
||||||
resizeX = 0
|
resizeX = 0
|
||||||
resizeY = 0
|
resizeY = 0
|
||||||
offsetX = 0
|
offsetX = 0
|
||||||
|
@ -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)
|
||||||
|
|
|
@ -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'
|
||||||
|
@ -35,14 +34,13 @@ sip_cmd = ' '.join([
|
||||||
'-b', "build/" + build_file,
|
'-b', "build/" + build_file,
|
||||||
'-I', config.default_sip_dir + '/PyQt5',
|
'-I', config.default_sip_dir + '/PyQt5',
|
||||||
PYQT_CONFIGURATION.get('sip_flags', ''),
|
PYQT_CONFIGURATION.get('sip_flags', ''),
|
||||||
'%s.sip' % moduleName,
|
'%s.sip' % moduleName,
|
||||||
])
|
])
|
||||||
|
|
||||||
os.makedirs('build', exist_ok=True)
|
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'
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QRect
|
try:
|
||||||
from PyQt5.QtGui import qAlpha, QPixmap, QPainter
|
from PyQt5.QtCore import Qt, QRect
|
||||||
|
from PyQt5.QtGui import qAlpha, QPixmap, QPainter
|
||||||
|
except ImportError:
|
||||||
__Author__ = """By: Irony
|
from PySide2.QtCore import Qt, QRect
|
||||||
QQ: 892768447
|
from PySide2.QtGui import qAlpha, QPixmap, QPainter
|
||||||
Email: 892768447@qq.com"""
|
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
|
||||||
__Version__ = "Version 1.0"
|
|
||||||
|
|
||||||
|
|
||||||
class Part:
|
class Part:
|
||||||
|
|
|
@ -6,7 +6,10 @@
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PyQt5 import QtCore
|
try:
|
||||||
|
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()
|
||||||
|
|
|
@ -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文件中当做一个变量
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -29,7 +26,7 @@ class Label(QWidget):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Label, self).__init__(*args, **kwargs)
|
super(Label, self).__init__(*args, **kwargs)
|
||||||
#.9 格式的图片
|
# .9 格式的图片
|
||||||
self.image = NinePatch('Data/skin_aio_friend_bubble_pressed.9.png')
|
self.image = NinePatch('Data/skin_aio_friend_bubble_pressed.9.png')
|
||||||
|
|
||||||
def paintEvent(self, event):
|
def paintEvent(self, event):
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -32,7 +25,7 @@ class Label(QLabel):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Label, self).__init__(*args, **kwargs)
|
super(Label, self).__init__(*args, **kwargs)
|
||||||
#.9 格式的图片
|
# .9 格式的图片
|
||||||
self.image = QImage('Data/skin_aio_friend_bubble_pressed.9.png')
|
self.image = QImage('Data/skin_aio_friend_bubble_pressed.9.png')
|
||||||
|
|
||||||
def showEvent(self, event):
|
def showEvent(self, event):
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtGui import QImage
|
try:
|
||||||
from PyQt5.QtWidgets import QApplication, QLabel
|
from PyQt5.QtGui import QImage
|
||||||
|
from PyQt5.QtWidgets import QApplication, QLabel
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtGui import QImage
|
||||||
|
from PySide2.QtWidgets import QApplication, QLabel
|
||||||
|
|
||||||
from Lib import QtNinePatch2
|
from Lib import QtNinePatch2
|
||||||
|
|
||||||
|
@ -29,7 +26,7 @@ class Label(QLabel):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Label, self).__init__(*args, **kwargs)
|
super(Label, self).__init__(*args, **kwargs)
|
||||||
#.9 格式的图片
|
# .9 格式的图片
|
||||||
self.image = QImage('Data/skin_aio_friend_bubble_pressed.9.png')
|
self.image = QImage('Data/skin_aio_friend_bubble_pressed.9.png')
|
||||||
|
|
||||||
def showEvent(self, event):
|
def showEvent(self, event):
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QResource
|
try:
|
||||||
from PyQt5.QtGui import QPixmap, QMovie
|
from PyQt5.QtCore import QResource
|
||||||
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QLabel
|
from PyQt5.QtGui import QPixmap, QMovie
|
||||||
|
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout, QLabel
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QResource
|
||||||
|
from PySide2.QtGui import QPixmap, QMovie
|
||||||
|
from PySide2.QtWidgets import QWidget, QApplication, QHBoxLayout, QLabel
|
||||||
|
|
||||||
from Lib import res_rc # @UnresolvedImport @UnusedImport
|
|
||||||
from Lib.xpmres import image_head # @UnresolvedImport
|
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):
|
||||||
|
|
|
@ -1,22 +1,26 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from PyQt5.QtCore import QSize
|
|
||||||
from PyQt5.QtGui import QStandardItemModel, QStandardItem
|
|
||||||
from PyQt5.QtWidgets import QListView, QWidget, QHBoxLayout, QLineEdit,\
|
|
||||||
QPushButton
|
|
||||||
|
|
||||||
|
|
||||||
# Created on 2018年8月4日
|
"""
|
||||||
# author: Irony
|
Created on 2018年8月4日
|
||||||
# site: https://pyqt5.com , https://github.com/892768447
|
@author: Irony
|
||||||
# email: 892768447@qq.com
|
@site: https://pyqt.site , https://github.com/PyQt5
|
||||||
# file: QListView.显示自定义Widget
|
@email: 892768447@qq.com
|
||||||
# description:
|
@file: QListView.显示自定义Widget
|
||||||
__Author__ = """By: Irony
|
@description:
|
||||||
QQ: 892768447
|
"""
|
||||||
Email: 892768447@qq.com"""
|
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
try:
|
||||||
__Version__ = 1.0
|
from PyQt5.QtCore import QSize
|
||||||
|
from PyQt5.QtGui import QStandardItemModel, QStandardItem
|
||||||
|
from PyQt5.QtWidgets import QListView, QWidget, QHBoxLayout, QLineEdit, \
|
||||||
|
QPushButton, QApplication
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QSize
|
||||||
|
from PySide2.QtGui import QStandardItemModel, QStandardItem
|
||||||
|
from PySide2.QtWidgets import QListView, QWidget, QHBoxLayout, QLineEdit, \
|
||||||
|
QPushButton, QApplication
|
||||||
|
|
||||||
|
|
||||||
class CustomWidget(QWidget):
|
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QSortFilterProxyModel, Qt, QSize
|
try:
|
||||||
from PyQt5.QtGui import QStandardItem, QStandardItemModel
|
from PyQt5.QtCore import QSortFilterProxyModel, Qt, QSize
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListView,\
|
from PyQt5.QtGui import QStandardItem, QStandardItemModel
|
||||||
QHBoxLayout, QLineEdit
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListView, \
|
||||||
|
QHBoxLayout, QLineEdit, QApplication
|
||||||
|
except ImportError:
|
||||||
# Created on 2018年8月4日
|
from PySide2.QtCore import QSortFilterProxyModel, Qt, QSize
|
||||||
# author: Irony
|
from PySide2.QtGui import QStandardItem, QStandardItemModel
|
||||||
# site: https://pyqt5.com , https://github.com/892768447
|
from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListView, \
|
||||||
# email: 892768447@qq.com
|
QHBoxLayout, QLineEdit, QApplication
|
||||||
# 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):
|
||||||
|
@ -55,11 +58,11 @@ class SortFilterProxyModel(QSortFilterProxyModel):
|
||||||
leftData = leftData.split('-')[-1]
|
leftData = leftData.split('-')[-1]
|
||||||
rightData = rightData.split('-')[-1]
|
rightData = rightData.split('-')[-1]
|
||||||
return leftData < rightData
|
return leftData < rightData
|
||||||
# elif self.sortOrder() == Qt.AscendingOrder:
|
# elif self.sortOrder() == Qt.AscendingOrder:
|
||||||
# #按照名字升序排序
|
# #按照名字升序排序
|
||||||
# leftData = leftData.split('-')[0]
|
# leftData = leftData.split('-')[0]
|
||||||
# rightData = rightData.split('-')[0]
|
# rightData = rightData.split('-')[0]
|
||||||
# return leftData < rightData
|
# return leftData < rightData
|
||||||
return super(SortFilterProxyModel, self).lessThan(source_left, source_right)
|
return super(SortFilterProxyModel, self).lessThan(source_left, source_right)
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +92,7 @@ class Window(QWidget):
|
||||||
times = time() + randint(0, 30) # 当前时间随机+
|
times = time() + randint(0, 30) # 当前时间随机+
|
||||||
value = '{}-{}'.format(name, times) # 内容用-分开
|
value = '{}-{}'.format(name, times) # 内容用-分开
|
||||||
item = QStandardItem(value)
|
item = QStandardItem(value)
|
||||||
# item.setData(value, Qt.UserRole + 2)
|
# item.setData(value, Qt.UserRole + 2)
|
||||||
self.dmodel.appendRow(item)
|
self.dmodel.appendRow(item)
|
||||||
# 索引
|
# 索引
|
||||||
index = self.fmodel.mapFromSource(item.index())
|
index = self.fmodel.mapFromSource(item.index())
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF
|
try:
|
||||||
from PyQt5.QtGui import QStandardItem, QStandardItemModel, QPainter, QColor, QImage, QPixmap
|
from PyQt5.QtCore import QPointF, Qt, QRectF, QSizeF
|
||||||
from PyQt5.QtWidgets import QListView, QGraphicsView, QGraphicsPixmapItem, QGraphicsScene
|
from PyQt5.QtGui import QStandardItem, QStandardItemModel, QPainter, QColor, QImage, QPixmap
|
||||||
|
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QSortFilterProxyModel, Qt
|
try:
|
||||||
from PyQt5.QtGui import QStandardItem, QStandardItemModel
|
from PyQt5.QtCore import QSortFilterProxyModel, Qt
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QListView, QPushButton
|
from PyQt5.QtGui import QStandardItem, QStandardItemModel
|
||||||
|
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QListView, QPushButton
|
||||||
|
except ImportError:
|
||||||
__Author__ = """By: Irony
|
from PySide2.QtCore import QSortFilterProxyModel, Qt
|
||||||
QQ: 892768447
|
from PySide2.QtGui import QStandardItem, QStandardItemModel
|
||||||
Email: 892768447@qq.com"""
|
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QListView, QPushButton
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
|
||||||
__Version__ = "Version 1.0"
|
|
||||||
|
|
||||||
|
|
||||||
class SortFilterProxyModel(QSortFilterProxyModel):
|
class SortFilterProxyModel(QSortFilterProxyModel):
|
||||||
|
@ -72,8 +70,8 @@ IndexDict = {
|
||||||
4: '清',
|
4: '清',
|
||||||
}
|
}
|
||||||
|
|
||||||
IdRole = Qt.UserRole + 1 # 用于恢复排序
|
IdRole = Qt.UserRole + 1 # 用于恢复排序
|
||||||
ClassifyRole = Qt.UserRole + 2 # 用于按照分类序号排序
|
ClassifyRole = Qt.UserRole + 2 # 用于按照分类序号排序
|
||||||
|
|
||||||
|
|
||||||
class Window(QWidget):
|
class Window(QWidget):
|
||||||
|
@ -96,8 +94,8 @@ class Window(QWidget):
|
||||||
|
|
||||||
def restoreSort(self):
|
def restoreSort(self):
|
||||||
# 恢复默认排序
|
# 恢复默认排序
|
||||||
self.fmodel.setSortRole(IdRole) # 必须设置排序角色为ID
|
self.fmodel.setSortRole(IdRole) # 必须设置排序角色为ID
|
||||||
self.fmodel.sort(0) # 排序第一列按照ID升序
|
self.fmodel.sort(0) # 排序第一列按照ID升序
|
||||||
|
|
||||||
def sortByClassify(self):
|
def sortByClassify(self):
|
||||||
self.fmodel.setSortIndex(NameDict.get(
|
self.fmodel.setSortIndex(NameDict.get(
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import QSize, pyqtSignal
|
|
||||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLineEdit, QPushButton,\
|
|
||||||
QListWidgetItem, QVBoxLayout, QListWidget
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import QSize, pyqtSignal
|
||||||
QQ: 892768447
|
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLineEdit, QPushButton, \
|
||||||
Email: 892768447@qq.com"""
|
QListWidgetItem, QVBoxLayout, QListWidget, QApplication
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
except ImportError:
|
||||||
__Version__ = 1.0
|
from PySide2.QtCore import QSize, Signal as pyqtSignal
|
||||||
|
from PySide2.QtWidgets import QWidget, QHBoxLayout, QLineEdit, QPushButton, \
|
||||||
|
QListWidgetItem, QVBoxLayout, QListWidget, QApplication
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import Qt, QSize, QRect, QPoint
|
|
||||||
from PyQt5.QtGui import QColor, QPixmap, QDrag, QPainter, QCursor
|
|
||||||
from PyQt5.QtWidgets import QListWidget, QListWidgetItem, QLabel, QRubberBand
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import Qt, QSize, QRect, QPoint
|
||||||
QQ: 892768447
|
from PyQt5.QtGui import QColor, QPixmap, QDrag, QPainter, QCursor
|
||||||
Email: 892768447@qq.com"""
|
from PyQt5.QtWidgets import QListWidget, QListWidgetItem, QLabel, QRubberBand, QApplication
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
except ImportError:
|
||||||
__Version__ = "Version 1.0"
|
from PySide2.QtCore import Qt, QSize, QRect, QPoint
|
||||||
|
from PySide2.QtGui import QColor, QPixmap, QDrag, QPainter, QCursor
|
||||||
|
from PySide2.QtWidgets import QListWidget, QListWidgetItem, QLabel, QRubberBand, QApplication
|
||||||
|
|
||||||
|
|
||||||
class DropListWidget(QListWidget):
|
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;
|
||||||
|
|
|
@ -4,22 +4,17 @@
|
||||||
"""
|
"""
|
||||||
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
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from PyQt5.QtCore import QSize
|
from PyQt5.QtCore import QSize
|
||||||
from PyQt5.QtWidgets import QWidget, QPushButton, QFormLayout,\
|
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;}')
|
||||||
|
|
|
@ -1,34 +1,28 @@
|
||||||
#!/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
|
||||||
|
|
||||||
from PyQt5.QtCore import QSize, Qt, QUrl, QTimer
|
from PyQt5.QtCore import QSize, Qt, QUrl, QTimer
|
||||||
from PyQt5.QtGui import QPainter, QFont, QLinearGradient, QGradient, QColor,\
|
from PyQt5.QtGui import QPainter, QFont, QLinearGradient, QGradient, QColor, \
|
||||||
QBrush, QPaintEvent, QPixmap
|
QBrush, QPaintEvent, QPixmap
|
||||||
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
|
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, 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}"
|
||||||
|
|
||||||
|
@ -78,8 +72,8 @@ class CoverLabel(QLabel):
|
||||||
|
|
||||||
def __init__(self, cover_path, cover_title, video_url, *args, **kwargs):
|
def __init__(self, cover_path, cover_title, video_url, *args, **kwargs):
|
||||||
super(CoverLabel, self).__init__(*args, **kwargs)
|
super(CoverLabel, self).__init__(*args, **kwargs)
|
||||||
# super(CoverLabel, self).__init__(
|
# super(CoverLabel, self).__init__(
|
||||||
# '<html><head/><body><img src="{0}"/></body></html>'.format(os.path.abspath(cover_path)), *args, **kwargs)
|
# '<html><head/><body><img src="{0}"/></body></html>'.format(os.path.abspath(cover_path)), *args, **kwargs)
|
||||||
self.setCursor(Qt.PointingHandCursor)
|
self.setCursor(Qt.PointingHandCursor)
|
||||||
self.setScaledContents(True)
|
self.setScaledContents(True)
|
||||||
self.setMinimumSize(220, 308)
|
self.setMinimumSize(220, 308)
|
||||||
|
@ -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,7 +164,8 @@ 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):
|
||||||
# 每个item控件的大小
|
# 每个item控件的大小
|
||||||
|
@ -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):
|
||||||
|
@ -267,18 +262,19 @@ class Window(QListWidget):
|
||||||
figure_score = "".join(li.xpath(".//em/text()")) # 评分
|
figure_score = "".join(li.xpath(".//em/text()")) # 评分
|
||||||
# 主演
|
# 主演
|
||||||
figure_desc = "<span style=\"font-size: 12px;\">主演:</span>" + \
|
figure_desc = "<span style=\"font-size: 12px;\">主演:</span>" + \
|
||||||
"".join([Actor.format(**dict(fd.items()))
|
"".join([Actor.format(**dict(fd.items()))
|
||||||
for fd in li.xpath(".//div[@class='figure_desc']/a")])
|
for fd in li.xpath(".//div[@class='figure_desc']/a")])
|
||||||
# 播放数
|
# 播放数
|
||||||
figure_count = (
|
figure_count = (
|
||||||
li.xpath(".//div[@class='figure_count']/span/text()") or [""])[0]
|
li.xpath(".//div[@class='figure_count']/span/text()") or [""])[0]
|
||||||
path = "cache/{0}.jpg".format(
|
path = "cache/{0}.jpg".format(
|
||||||
os.path.splitext(os.path.basename(video_url))[0])
|
os.path.splitext(os.path.basename(video_url))[0])
|
||||||
cover_path = "Data/pic_v.png"
|
cover_path = "Data/pic_v.png"
|
||||||
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)
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import Qt
|
|
||||||
from PyQt5.QtGui import QColor
|
|
||||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QListWidget, QPlainTextEdit,\
|
|
||||||
QListWidgetItem, QAbstractItemView, QListView
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = "Irony"
|
from PyQt5.QtCore import Qt
|
||||||
__Copyright__ = "Copyright (c) 2019"
|
from PyQt5.QtGui import QColor
|
||||||
__Version__ = "Version 1.0"
|
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QListWidget, QPlainTextEdit, \
|
||||||
|
QListWidgetItem, QAbstractItemView, QListView, QApplication
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Qt
|
||||||
|
from PySide2.QtGui import QColor
|
||||||
|
from PySide2.QtWidgets import QWidget, QHBoxLayout, QListWidget, QPlainTextEdit, \
|
||||||
|
QListWidgetItem, QAbstractItemView, QListView, QApplication
|
||||||
|
|
||||||
|
|
||||||
def formatColor(text, color):
|
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()
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
try:
|
||||||
from PyQt5.QtGui import QPixmap, QPainter, QFont, QIcon
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import QLabel, QMenu, QApplication
|
from PyQt5.QtGui import QPixmap, QPainter, QFont, QIcon
|
||||||
|
from PyQt5.QtWidgets import QLabel, QMenu, QApplication
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Qt
|
||||||
|
from PySide2.QtGui import QPixmap, QPainter, QFont, QIcon
|
||||||
|
from PySide2.QtWidgets import QLabel, QMenu, QApplication
|
||||||
|
|
||||||
Style = """
|
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QApplication, QMessageBox
|
try:
|
||||||
|
from PyQt5.QtWidgets import QApplication, QMessageBox
|
||||||
|
except ImportError:
|
||||||
__Author__ = 'Irony'
|
from PySide2.QtWidgets import QApplication, QMessageBox
|
||||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
|
||||||
__Version__ = 1.0
|
|
||||||
|
|
||||||
TextStyle = """
|
TextStyle = """
|
||||||
QMessageBox QPushButton[text="OK"] {
|
QMessageBox QPushButton[text="OK"] {
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QTimer
|
try:
|
||||||
from PyQt5.QtWidgets import QMessageBox
|
from PyQt5.QtCore import QTimer
|
||||||
|
from PyQt5.QtWidgets import QApplication, QMessageBox, QPushButton
|
||||||
|
except ImportError:
|
||||||
__Author__ = """By: Irony
|
from PySide2.QtCore import QTimer
|
||||||
QQ: 892768447
|
from PySide2.QtWidgets import QApplication, QMessageBox, QPushButton
|
||||||
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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QApplication, QMessageBox
|
try:
|
||||||
|
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 {
|
||||||
|
@ -62,15 +60,15 @@ QMessageBox QPushButton[text="Apply"] {
|
||||||
}
|
}
|
||||||
''')
|
''')
|
||||||
QMessageBox.information(None, "information", "消息",
|
QMessageBox.information(None, "information", "消息",
|
||||||
QMessageBox.Apply |
|
QMessageBox.Apply |
|
||||||
QMessageBox.Cancel |
|
QMessageBox.Cancel |
|
||||||
QMessageBox.Close |
|
QMessageBox.Close |
|
||||||
QMessageBox.Discard |
|
QMessageBox.Discard |
|
||||||
QMessageBox.Help |
|
QMessageBox.Help |
|
||||||
QMessageBox.No |
|
QMessageBox.No |
|
||||||
QMessageBox.Ok |
|
QMessageBox.Ok |
|
||||||
QMessageBox.Open |
|
QMessageBox.Open |
|
||||||
QMessageBox.Reset |
|
QMessageBox.Reset |
|
||||||
QMessageBox.Save |
|
QMessageBox.Save |
|
||||||
QMessageBox.Yes)
|
QMessageBox.Yes)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot, QTimer, QSizeF, Qt, QRectF, QPointF, QRect, QPoint, QSize
|
try:
|
||||||
from PyQt5.QtGui import QImage, QColor, QPainter, QLinearGradient, QGradient, QPainterPath, QPixmap, QBrush, QPen
|
from PyQt5.QtCore import pyqtSlot, QTimer, QSizeF, Qt, QRectF, QPointF, QRect, QPoint, QSize
|
||||||
from PyQt5.QtSvg import QSvgRenderer
|
from PyQt5.QtGui import QImage, QColor, QPainter, QLinearGradient, QGradient, QPainterPath, QPixmap, \
|
||||||
from PyQt5.QtWidgets import QProgressBar, QGraphicsDropShadowEffect
|
QBrush, QPen
|
||||||
|
from PyQt5.QtSvg import QSvgRenderer
|
||||||
|
from PyQt5.QtWidgets import QProgressBar, QGraphicsDropShadowEffect
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Slot as pyqtSlot, QTimer, QSizeF, Qt, QRectF, QPointF, QRect, QPoint, QSize
|
||||||
|
from PySide2.QtGui import QImage, QColor, QPainter, QLinearGradient, QGradient, QPainterPath, QPixmap, \
|
||||||
|
QBrush, QPen
|
||||||
|
from PySide2.QtSvg import QSvgRenderer
|
||||||
|
from PySide2.QtWidgets import QProgressBar, QGraphicsDropShadowEffect
|
||||||
|
|
||||||
WATER_FRONT = """<svg xmlns="http://www.w3.org/2000/svg" width="383" height="115" viewBox="0 0 383 115">
|
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:
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QTimer, Qt, QRectF, QSize
|
try:
|
||||||
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QFont
|
from PyQt5.QtCore import QTimer, Qt, QRectF, QSize
|
||||||
from PyQt5.QtWidgets import QProgressBar
|
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QFont
|
||||||
|
from PyQt5.QtWidgets import QProgressBar
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QTimer, Qt, QRectF, QSize
|
||||||
|
from PySide2.QtGui import QPainter, QPainterPath, QColor, QFont
|
||||||
|
from PySide2.QtWidgets import QProgressBar
|
||||||
|
|
||||||
|
|
||||||
class WaterRippleProgressBar(QProgressBar):
|
class WaterRippleProgressBar(QProgressBar):
|
||||||
|
|
||||||
# 浪高百分比
|
# 浪高百分比
|
||||||
waterHeight = 1
|
waterHeight = 1
|
||||||
# 密度
|
# 密度
|
||||||
|
@ -84,7 +84,7 @@ class WaterRippleProgressBar(QProgressBar):
|
||||||
# 正弦曲线公式 y = A * sin(ωx + φ) + k
|
# 正弦曲线公式 y = A * sin(ωx + φ) + k
|
||||||
# 当前值所占百分比
|
# 当前值所占百分比
|
||||||
percent = 1 - (self.value() - self.minimum()) / \
|
percent = 1 - (self.value() - self.minimum()) / \
|
||||||
(self.maximum() - self.minimum())
|
(self.maximum() - self.minimum())
|
||||||
# w表示周期,6为人为定义
|
# w表示周期,6为人为定义
|
||||||
w = 6 * self.waterDensity * math.pi / self.width()
|
w = 6 * self.waterDensity * math.pi / self.width()
|
||||||
# A振幅 高度百分比,1/26为人为定义
|
# A振幅 高度百分比,1/26为人为定义
|
||||||
|
|
|
@ -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,\
|
|
||||||
QObject, QSize, Qt, pyqtSignal, QRectF
|
|
||||||
from PyQt5.QtGui import QPainter, QColor
|
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import QSequentialAnimationGroup, QPauseAnimation, QPropertyAnimation, \
|
||||||
QQ: 892768447
|
QParallelAnimationGroup, QObject, QSize, Qt, QRectF, pyqtSignal, pyqtProperty
|
||||||
Email: 892768447@qq.com"""
|
from PyQt5.QtGui import QPainter, QColor
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||||
__Version__ = 1.0
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QSequentialAnimationGroup, QPauseAnimation, QPropertyAnimation, \
|
||||||
|
QParallelAnimationGroup, QObject, QSize, Qt, QRectF, Signal as pyqtSignal, Property as pyqtProperty
|
||||||
|
from PySide2.QtGui import QPainter, QColor
|
||||||
|
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||||
|
|
||||||
|
|
||||||
class CircleItem(QObject):
|
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()
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import pyqtProperty, QSize, Qt, QRectF, QTimer
|
|
||||||
from PyQt5.QtGui import QColor, QPainter, QFont
|
|
||||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QSlider
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import pyqtProperty, QSize, Qt, QRectF, QTimer
|
||||||
QQ: 892768447
|
from PyQt5.QtGui import QColor, QPainter, QFont
|
||||||
Email: 892768447@qq.com"""
|
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout, QSlider
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
except ImportError:
|
||||||
__Version__ = "Version 1.0"
|
from PySide2.QtCore import Property as pyqtProperty, QSize, Qt, QRectF, QTimer
|
||||||
|
from PySide2.QtGui import QColor, QPainter, QFont
|
||||||
|
from PySide2.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout, QSlider
|
||||||
|
|
||||||
|
|
||||||
class PercentProgressBar(QWidget):
|
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()
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import QSize, pyqtProperty, QTimer, Qt
|
|
||||||
from PyQt5.QtGui import QColor, QPainter
|
|
||||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import QSize, pyqtProperty, QTimer, Qt
|
||||||
QQ: 892768447
|
from PyQt5.QtGui import QColor, QPainter
|
||||||
Email: 892768447@qq.com"""
|
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
except ImportError:
|
||||||
__Version__ = "Version 1.0"
|
from PySide2.QtCore import QSize, Property as pyqtProperty, QTimer, Qt
|
||||||
|
from PySide2.QtGui import QColor, QPainter
|
||||||
|
from PySide2.QtWidgets import QApplication, QWidget, QHBoxLayout
|
||||||
|
|
||||||
|
|
||||||
class CircleProgressBar(QWidget):
|
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QTimer
|
try:
|
||||||
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QProgressBar
|
from PyQt5.QtCore import QTimer
|
||||||
|
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QProgressBar
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QTimer
|
||||||
|
from PySide2.QtWidgets import QWidget, QApplication, QVBoxLayout, QProgressBar
|
||||||
|
|
||||||
|
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):
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
try:
|
||||||
|
from PyQt5.QtCore import QTimer
|
||||||
|
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QTimer
|
||||||
|
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||||
|
|
||||||
from Lib.DWaterProgress import DWaterProgress
|
from Lib.DWaterProgress import DWaterProgress
|
||||||
from PyQt5.QtCore import QTimer
|
|
||||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
|
|
||||||
|
|
||||||
|
|
||||||
class WaterProgressWindow(QWidget):
|
class WaterProgressWindow(QWidget):
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from PyQt5.QtCore import QPropertyAnimation
|
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
|
||||||
|
|
||||||
|
|
||||||
# Created on 2018年6月14日
|
"""
|
||||||
# author: Irony
|
Created on 2018年6月14日
|
||||||
# site: https://pyqt5.com , https://github.com/892768447
|
@author: Irony
|
||||||
# email: 892768447@qq.com
|
@site: https://pyqt.site , https://github.com/PyQt5
|
||||||
# file: FadeInOut
|
@email: 892768447@qq.com
|
||||||
# description:
|
@file: FadeInOut
|
||||||
__Author__ = """By: Irony
|
@description:
|
||||||
QQ: 892768447
|
"""
|
||||||
Email: 892768447@qq.com"""
|
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
try:
|
||||||
__Version__ = 1.0
|
from PyQt5.QtCore import QPropertyAnimation
|
||||||
|
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QPropertyAnimation
|
||||||
|
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
|
||||||
|
|
||||||
|
|
||||||
class Window(QWidget):
|
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()
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import Qt, pyqtSignal, QTimer
|
|
||||||
from PyQt5.QtGui import QPixmap
|
try:
|
||||||
from PyQt5.QtWidgets import QStackedWidget, QLabel
|
from PyQt5.QtCore import Qt, pyqtSignal, QTimer
|
||||||
|
from PyQt5.QtGui import QPixmap
|
||||||
|
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):
|
||||||
# 只是显示登录界面截图
|
# 只是显示登录界面截图
|
||||||
|
|
||||||
|
@ -97,22 +98,22 @@ class Window(QStackedWidget):
|
||||||
|
|
||||||
def jumpLoginWidget(self):
|
def jumpLoginWidget(self):
|
||||||
# 翻转到登录界面
|
# 翻转到登录界面
|
||||||
self.setWindowOpacity(0) # 类似隐藏,但是保留了任务栏
|
self.setWindowOpacity(0) # 类似隐藏,但是保留了任务栏
|
||||||
self.setCurrentWidget(self.loginWidget) # 很重要,一定要先切换过去,不然会导致第一次截图有误
|
self.setCurrentWidget(self.loginWidget) # 很重要,一定要先切换过去,不然会导致第一次截图有误
|
||||||
image1 = self.loginWidget.grab() # 截图1
|
image1 = self.loginWidget.grab() # 截图1
|
||||||
image2 = self.settingWidget.grab() # 截图2
|
image2 = self.settingWidget.grab() # 截图2
|
||||||
padding = 100 # 扩大边距 @UnusedVariable
|
padding = 100 # 扩大边距 @UnusedVariable
|
||||||
self.flipWidget.setGeometry(self.geometry())
|
self.flipWidget.setGeometry(self.geometry())
|
||||||
# .adjusted(-padding, -padding, padding, padding))
|
# .adjusted(-padding, -padding, padding, padding))
|
||||||
self.flipWidget.updateImages(FlipWidget.Right, image2, image1)
|
self.flipWidget.updateImages(FlipWidget.Right, image2, image1)
|
||||||
|
|
||||||
def jumpSettingWidget(self):
|
def jumpSettingWidget(self):
|
||||||
# 翻转到设置界面
|
# 翻转到设置界面
|
||||||
self.setWindowOpacity(0) # 类似隐藏,但是保留了任务栏
|
self.setWindowOpacity(0) # 类似隐藏,但是保留了任务栏
|
||||||
self.setCurrentWidget(self.settingWidget) # 很重要,一定要先切换过去,不然会导致第一次截图有误
|
self.setCurrentWidget(self.settingWidget) # 很重要,一定要先切换过去,不然会导致第一次截图有误
|
||||||
image1 = self.loginWidget.grab() # 截图1
|
image1 = self.loginWidget.grab() # 截图1
|
||||||
image2 = self.settingWidget.grab() # 截图2
|
image2 = self.settingWidget.grab() # 截图2
|
||||||
padding = 100 # 扩大边距 @UnusedVariable
|
padding = 100 # 扩大边距 @UnusedVariable
|
||||||
self.flipWidget.setGeometry(self.geometry())
|
self.flipWidget.setGeometry(self.geometry())
|
||||||
# .adjusted(-padding, -padding, padding, padding))
|
# .adjusted(-padding, -padding, padding, padding))
|
||||||
self.flipWidget.updateImages(FlipWidget.Left, image1, image2)
|
self.flipWidget.updateImages(FlipWidget.Left, image1, image2)
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -4,26 +4,27 @@
|
||||||
"""
|
"""
|
||||||
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
|
|
||||||
from PyQt5.QtGui import QPainter, QTransform
|
|
||||||
from PyQt5.QtWidgets import QWidget
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = 'Irony'
|
from PyQt5.QtCore import pyqtSignal, pyqtProperty, Qt, QPropertyAnimation, QEasingCurve, QPointF
|
||||||
__Copyright__ = 'Copyright (c) 2019'
|
from PyQt5.QtGui import QPainter, QTransform
|
||||||
|
from PyQt5.QtWidgets import QWidget
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import Signal as pyqtSignal, Property as pyqtProperty, Qt, QPropertyAnimation, \
|
||||||
|
QEasingCurve, QPointF
|
||||||
|
from PySide2.QtGui import QPainter, QTransform
|
||||||
|
from PySide2.QtWidgets import QWidget
|
||||||
|
|
||||||
|
|
||||||
class FlipWidget(QWidget):
|
class FlipWidget(QWidget):
|
||||||
|
Left = 0 # 从右往左
|
||||||
Left = 0 # 从右往左
|
Right = 1 # 从左往右
|
||||||
Right = 1 # 从左往右
|
Scale = 3 # 图片缩放比例
|
||||||
Scale = 3 # 图片缩放比例
|
|
||||||
finished = pyqtSignal()
|
finished = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
|
@ -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
|
|
||||||
from PyQt5.QtWidgets import QStackedWidget
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import Qt, pyqtProperty, QEasingCurve, QPoint, QPropertyAnimation, \
|
||||||
QQ: 892768447
|
QParallelAnimationGroup, QTimer
|
||||||
Email: 892768447@qq.com"""
|
from PyQt5.QtWidgets import QStackedWidget
|
||||||
__Copyright__ = 'Copyright (c) 2018 Irony'
|
except ImportError:
|
||||||
__Version__ = 1.0
|
from PySide2.QtCore import Qt, Property as pyqtProperty, QEasingCurve, QPoint, QPropertyAnimation, \
|
||||||
|
QParallelAnimationGroup, QTimer
|
||||||
|
from PySide2.QtWidgets import QStackedWidget
|
||||||
|
|
||||||
|
|
||||||
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):
|
||||||
|
@ -210,7 +208,7 @@ class SlidingStackedWidget(QStackedWidget):
|
||||||
def animationDoneSlot(self):
|
def animationDoneSlot(self):
|
||||||
"""动画结束处理函数"""
|
"""动画结束处理函数"""
|
||||||
# 由于重写了setCurrentIndex方法所以这里要用父类本身的方法
|
# 由于重写了setCurrentIndex方法所以这里要用父类本身的方法
|
||||||
# self.setCurrentIndex(self._next)
|
# self.setCurrentIndex(self._next)
|
||||||
QStackedWidget.setCurrentIndex(self, self._next)
|
QStackedWidget.setCurrentIndex(self, self._next)
|
||||||
w = self.widget(self._now)
|
w = self.widget(self._now)
|
||||||
w.hide()
|
w.hide()
|
||||||
|
|
|
@ -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_())
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve, QRect
|
|
||||||
from PyQt5.QtWidgets import QWidget, QMenu, QApplication
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = """By: Irony
|
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve, QRect
|
||||||
QQ: 892768447
|
from PyQt5.QtWidgets import QWidget, QMenu, QApplication
|
||||||
Email: 892768447@qq.com"""
|
except ImportError:
|
||||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
from PySide2.QtCore import QPropertyAnimation, QEasingCurve, QRect
|
||||||
__Version__ = "Version 1.0"
|
from PySide2.QtWidgets import QWidget, QMenu, QApplication
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
from PyQt5.QtCore import QEasingCurve, Qt
|
try:
|
||||||
from PyQt5.QtGui import QPixmap
|
from PyQt5.QtCore import QEasingCurve, Qt
|
||||||
from PyQt5.QtWidgets import QWidget, QLabel
|
from PyQt5.QtGui import QPixmap
|
||||||
|
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()
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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: 抖动动画
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import QPropertyAnimation, QPoint
|
|
||||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
|
||||||
|
|
||||||
|
try:
|
||||||
__Author__ = 'Irony'
|
from PyQt5.QtCore import QPropertyAnimation, QPoint
|
||||||
__Copyright__ = 'Copyright (c) 2019 Irony'
|
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
|
||||||
__Version__ = 1.0
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QPropertyAnimation, QPoint
|
||||||
|
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -9,8 +9,13 @@ Created on 2021年06月23日
|
||||||
@file: TabCornerStyle
|
@file: TabCornerStyle
|
||||||
@description:
|
@description:
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtCore import QRect
|
|
||||||
from PyQt5.QtWidgets import QProxyStyle, QStyle
|
try:
|
||||||
|
from PyQt5.QtCore import QRect
|
||||||
|
from PyQt5.QtWidgets import QProxyStyle, QStyle
|
||||||
|
except ImportError:
|
||||||
|
from PySide2.QtCore import QRect
|
||||||
|
from PySide2.QtWidgets import QProxyStyle, QStyle
|
||||||
|
|
||||||
|
|
||||||
class TabCornerStyle(QProxyStyle):
|
class TabCornerStyle(QProxyStyle):
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue