mirror of
https://github.com/tonquer/picacg-qt.git
synced 2025-01-09 04:17:41 +08:00
标题栏优化
This commit is contained in:
parent
66d540887d
commit
dc6ee50d13
@ -30,6 +30,10 @@ if sys.platform == "win32":
|
||||
self.widget.setVisible(True)
|
||||
return FrameLessWidget.showNormal(self)
|
||||
|
||||
def setSubTitle(self, text):
|
||||
self.widget.subTitle.setText(text)
|
||||
return
|
||||
|
||||
Main = MainWidget
|
||||
MainType = 2
|
||||
except Exception as es:
|
||||
@ -45,5 +49,7 @@ if not Main:
|
||||
Ui_Main.__init__(self)
|
||||
self.setupUi(self)
|
||||
|
||||
def setSubTitle(self, text):
|
||||
return
|
||||
|
||||
Main = MainWidget
|
||||
|
269
src/interface/ui_register.py
Normal file
269
src/interface/ui_register.py
Normal file
@ -0,0 +1,269 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
################################################################################
|
||||
## Form generated from reading UI file 'ui_register.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.2.0
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
|
||||
from PySide6.QtCore import (QCoreApplication, QMetaObject, QSize, Qt)
|
||||
from PySide6.QtWidgets import (QButtonGroup, QDateEdit, QGridLayout,
|
||||
QHBoxLayout, QLabel, QLineEdit, QRadioButton,
|
||||
QWidget)
|
||||
|
||||
class Ui_Register(object):
|
||||
def setupUi(self, Register):
|
||||
if not Register.objectName():
|
||||
Register.setObjectName(u"Register")
|
||||
Register.resize(388, 412)
|
||||
self.gridLayout_2 = QGridLayout(Register)
|
||||
self.gridLayout_2.setObjectName(u"gridLayout_2")
|
||||
self.gridLayout = QGridLayout()
|
||||
self.gridLayout.setObjectName(u"gridLayout")
|
||||
self.horizontalLayout_12 = QHBoxLayout()
|
||||
self.horizontalLayout_12.setObjectName(u"horizontalLayout_12")
|
||||
self.question3 = QLabel(Register)
|
||||
self.question3.setObjectName(u"question3")
|
||||
self.question3.setMinimumSize(QSize(80, 0))
|
||||
self.question3.setMaximumSize(QSize(60, 16777215))
|
||||
self.question3.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_12.addWidget(self.question3)
|
||||
|
||||
self.question3Edit = QLineEdit(Register)
|
||||
self.question3Edit.setObjectName(u"question3Edit")
|
||||
|
||||
self.horizontalLayout_12.addWidget(self.question3Edit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_12, 18, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout = QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(u"horizontalLayout")
|
||||
self.name = QLabel(Register)
|
||||
self.name.setObjectName(u"name")
|
||||
self.name.setMinimumSize(QSize(80, 0))
|
||||
self.name.setMaximumSize(QSize(60, 16777215))
|
||||
self.name.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout.addWidget(self.name)
|
||||
|
||||
self.nameEdit = QLineEdit(Register)
|
||||
self.nameEdit.setObjectName(u"nameEdit")
|
||||
|
||||
self.horizontalLayout.addWidget(self.nameEdit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout, 11, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout_17 = QHBoxLayout()
|
||||
self.horizontalLayout_17.setObjectName(u"horizontalLayout_17")
|
||||
self.question1 = QLabel(Register)
|
||||
self.question1.setObjectName(u"question1")
|
||||
self.question1.setMinimumSize(QSize(80, 0))
|
||||
self.question1.setMaximumSize(QSize(60, 16777215))
|
||||
self.question1.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_17.addWidget(self.question1)
|
||||
|
||||
self.question1Edit = QLineEdit(Register)
|
||||
self.question1Edit.setObjectName(u"question1Edit")
|
||||
|
||||
self.horizontalLayout_17.addWidget(self.question1Edit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_17, 14, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout_14 = QHBoxLayout()
|
||||
self.horizontalLayout_14.setObjectName(u"horizontalLayout_14")
|
||||
self.question2 = QLabel(Register)
|
||||
self.question2.setObjectName(u"question2")
|
||||
self.question2.setMinimumSize(QSize(80, 0))
|
||||
self.question2.setMaximumSize(QSize(60, 16777215))
|
||||
self.question2.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_14.addWidget(self.question2)
|
||||
|
||||
self.question2Edit = QLineEdit(Register)
|
||||
self.question2Edit.setObjectName(u"question2Edit")
|
||||
|
||||
self.horizontalLayout_14.addWidget(self.question2Edit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_14, 16, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout_19 = QHBoxLayout()
|
||||
self.horizontalLayout_19.setObjectName(u"horizontalLayout_19")
|
||||
self.passwd = QLabel(Register)
|
||||
self.passwd.setObjectName(u"passwd")
|
||||
self.passwd.setMinimumSize(QSize(80, 0))
|
||||
self.passwd.setMaximumSize(QSize(60, 16777215))
|
||||
self.passwd.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_19.addWidget(self.passwd)
|
||||
|
||||
self.passwdEdit = QLineEdit(Register)
|
||||
self.passwdEdit.setObjectName(u"passwdEdit")
|
||||
|
||||
self.horizontalLayout_19.addWidget(self.passwdEdit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_19, 12, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout_11 = QHBoxLayout()
|
||||
self.horizontalLayout_11.setObjectName(u"horizontalLayout_11")
|
||||
self.answer3 = QLabel(Register)
|
||||
self.answer3.setObjectName(u"answer3")
|
||||
self.answer3.setMinimumSize(QSize(80, 0))
|
||||
self.answer3.setMaximumSize(QSize(60, 16777215))
|
||||
self.answer3.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_11.addWidget(self.answer3)
|
||||
|
||||
self.answer3Edit = QLineEdit(Register)
|
||||
self.answer3Edit.setObjectName(u"answer3Edit")
|
||||
|
||||
self.horizontalLayout_11.addWidget(self.answer3Edit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_11, 19, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout_13 = QHBoxLayout()
|
||||
self.horizontalLayout_13.setObjectName(u"horizontalLayout_13")
|
||||
self.answer2 = QLabel(Register)
|
||||
self.answer2.setObjectName(u"answer2")
|
||||
self.answer2.setMinimumSize(QSize(80, 0))
|
||||
self.answer2.setMaximumSize(QSize(60, 16777215))
|
||||
self.answer2.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_13.addWidget(self.answer2)
|
||||
|
||||
self.answer2Edit = QLineEdit(Register)
|
||||
self.answer2Edit.setObjectName(u"answer2Edit")
|
||||
|
||||
self.horizontalLayout_13.addWidget(self.answer2Edit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_13, 17, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout_3 = QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
|
||||
self.user = QLabel(Register)
|
||||
self.user.setObjectName(u"user")
|
||||
self.user.setMinimumSize(QSize(80, 0))
|
||||
self.user.setMaximumSize(QSize(60, 16777215))
|
||||
self.user.setLayoutDirection(Qt.LeftToRight)
|
||||
self.user.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_3.addWidget(self.user)
|
||||
|
||||
self.userEdit = QLineEdit(Register)
|
||||
self.userEdit.setObjectName(u"userEdit")
|
||||
self.userEdit.setMinimumSize(QSize(200, 0))
|
||||
|
||||
self.horizontalLayout_3.addWidget(self.userEdit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_3, 10, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout_15 = QHBoxLayout()
|
||||
self.horizontalLayout_15.setObjectName(u"horizontalLayout_15")
|
||||
self.answer1 = QLabel(Register)
|
||||
self.answer1.setObjectName(u"answer1")
|
||||
self.answer1.setMinimumSize(QSize(80, 0))
|
||||
self.answer1.setMaximumSize(QSize(60, 16777215))
|
||||
self.answer1.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_15.addWidget(self.answer1)
|
||||
|
||||
self.answer1Edit = QLineEdit(Register)
|
||||
self.answer1Edit.setObjectName(u"answer1Edit")
|
||||
|
||||
self.horizontalLayout_15.addWidget(self.answer1Edit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_15, 15, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout_10 = QHBoxLayout()
|
||||
self.horizontalLayout_10.setObjectName(u"horizontalLayout_10")
|
||||
self.gender_m = QRadioButton(Register)
|
||||
self.buttonGroup = QButtonGroup(Register)
|
||||
self.buttonGroup.setObjectName(u"buttonGroup")
|
||||
self.buttonGroup.addButton(self.gender_m)
|
||||
self.gender_m.setObjectName(u"gender_m")
|
||||
|
||||
self.horizontalLayout_10.addWidget(self.gender_m)
|
||||
|
||||
self.gender_f = QRadioButton(Register)
|
||||
self.buttonGroup.addButton(self.gender_f)
|
||||
self.gender_f.setObjectName(u"gender_f")
|
||||
|
||||
self.horizontalLayout_10.addWidget(self.gender_f)
|
||||
|
||||
self.gender_bot = QRadioButton(Register)
|
||||
self.buttonGroup.addButton(self.gender_bot)
|
||||
self.gender_bot.setObjectName(u"gender_bot")
|
||||
|
||||
self.horizontalLayout_10.addWidget(self.gender_bot)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_10, 20, 1, 1, 1)
|
||||
|
||||
self.horizontalLayout_18 = QHBoxLayout()
|
||||
self.horizontalLayout_18.setObjectName(u"horizontalLayout_18")
|
||||
self.birthday = QLabel(Register)
|
||||
self.birthday.setObjectName(u"birthday")
|
||||
self.birthday.setMinimumSize(QSize(80, 0))
|
||||
self.birthday.setMaximumSize(QSize(60, 16777215))
|
||||
self.birthday.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_18.addWidget(self.birthday)
|
||||
|
||||
self.birthdayEdit = QDateEdit(Register)
|
||||
self.birthdayEdit.setObjectName(u"birthdayEdit")
|
||||
|
||||
self.horizontalLayout_18.addWidget(self.birthdayEdit)
|
||||
|
||||
|
||||
self.gridLayout.addLayout(self.horizontalLayout_18, 13, 1, 1, 1)
|
||||
|
||||
|
||||
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
|
||||
|
||||
QWidget.setTabOrder(self.userEdit, self.nameEdit)
|
||||
QWidget.setTabOrder(self.nameEdit, self.passwdEdit)
|
||||
QWidget.setTabOrder(self.passwdEdit, self.birthdayEdit)
|
||||
QWidget.setTabOrder(self.birthdayEdit, self.question1Edit)
|
||||
QWidget.setTabOrder(self.question1Edit, self.answer1Edit)
|
||||
QWidget.setTabOrder(self.answer1Edit, self.question2Edit)
|
||||
QWidget.setTabOrder(self.question2Edit, self.answer2Edit)
|
||||
QWidget.setTabOrder(self.answer2Edit, self.question3Edit)
|
||||
QWidget.setTabOrder(self.question3Edit, self.answer3Edit)
|
||||
QWidget.setTabOrder(self.answer3Edit, self.gender_m)
|
||||
QWidget.setTabOrder(self.gender_m, self.gender_f)
|
||||
QWidget.setTabOrder(self.gender_f, self.gender_bot)
|
||||
|
||||
self.retranslateUi(Register)
|
||||
|
||||
QMetaObject.connectSlotsByName(Register)
|
||||
# setupUi
|
||||
|
||||
def retranslateUi(self, Register):
|
||||
Register.setWindowTitle(QCoreApplication.translate("Register", u"\u65b0\u7528\u6237\u6ce8\u518c", None))
|
||||
self.question3.setText(QCoreApplication.translate("Register", u"\u95ee\u98983\uff1a", None))
|
||||
self.name.setText(QCoreApplication.translate("Register", u"\u7528\u6237\u540d\uff1a", None))
|
||||
self.question1.setText(QCoreApplication.translate("Register", u"\u95ee\u98981\uff1a", None))
|
||||
self.question2.setText(QCoreApplication.translate("Register", u"\u95ee\u98982\uff1a", None))
|
||||
self.passwd.setText(QCoreApplication.translate("Register", u"\u5bc6\u7801\uff1a", None))
|
||||
self.answer3.setText(QCoreApplication.translate("Register", u"\u7b54\u68483\uff1a", None))
|
||||
self.answer2.setText(QCoreApplication.translate("Register", u"\u7b54\u68482\uff1a", None))
|
||||
self.user.setText(QCoreApplication.translate("Register", u"\u5e10\u53f7\uff1a", None))
|
||||
self.answer1.setText(QCoreApplication.translate("Register", u"\u7b54\u68481\uff1a", None))
|
||||
self.gender_m.setText(QCoreApplication.translate("Register", u"\u7537", None))
|
||||
self.gender_f.setText(QCoreApplication.translate("Register", u"\u5973", None))
|
||||
self.gender_bot.setText(QCoreApplication.translate("Register", u"\u53cc\u6027", None))
|
||||
self.birthday.setText(QCoreApplication.translate("Register", u"\u751f\u65e5\uff1a", None))
|
||||
# retranslateUi
|
||||
|
@ -24,29 +24,48 @@ class Ui_TitleBar(object):
|
||||
self.horizontalLayout_2.setSpacing(0)
|
||||
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
|
||||
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalSpacer_2 = QSpacerItem(10, 20, QSizePolicy.Minimum, QSizePolicy.Minimum)
|
||||
|
||||
self.horizontalLayout_2.addItem(self.horizontalSpacer_2)
|
||||
|
||||
self.horizontalLayout_3 = QHBoxLayout()
|
||||
self.horizontalLayout_3.setSpacing(3)
|
||||
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
|
||||
self.horizontalLayout_3.setContentsMargins(8, -1, -1, -1)
|
||||
self.label_2 = QLabel(TitleBar)
|
||||
self.label_2.setObjectName(u"label_2")
|
||||
self.label_2.setMinimumSize(QSize(25, 25))
|
||||
self.label_2.setMaximumSize(QSize(25, 25))
|
||||
self.label_2.setStyleSheet(u"border-image: url(:/png/icon/logo_round.png);")
|
||||
self.label_2.setAlignment(Qt.AlignBottom|Qt.AlignHCenter)
|
||||
self.label_2.setAlignment(Qt.AlignCenter)
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.label_2, 0, Qt.AlignHCenter|Qt.AlignBottom)
|
||||
self.horizontalLayout_3.addWidget(self.label_2)
|
||||
|
||||
self.label = QLabel(TitleBar)
|
||||
self.label.setObjectName(u"label")
|
||||
self.label.setMinimumSize(QSize(60, 40))
|
||||
font = QFont()
|
||||
font.setPointSize(12)
|
||||
self.label.setFont(font)
|
||||
self.label.setAlignment(Qt.AlignCenter)
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.label)
|
||||
self.horizontalLayout_3.addWidget(self.label)
|
||||
|
||||
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
||||
self.horizontalSpacer_3 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
||||
|
||||
self.horizontalLayout_2.addItem(self.horizontalSpacer)
|
||||
self.horizontalLayout_3.addItem(self.horizontalSpacer_3)
|
||||
|
||||
|
||||
self.horizontalLayout_2.addLayout(self.horizontalLayout_3)
|
||||
|
||||
self.subTitle = QLabel(TitleBar)
|
||||
self.subTitle.setObjectName(u"subTitle")
|
||||
self.subTitle.setAlignment(Qt.AlignCenter)
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.subTitle)
|
||||
|
||||
self.horizontalLayout_4 = QHBoxLayout()
|
||||
self.horizontalLayout_4.setSpacing(0)
|
||||
self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
|
||||
self.horizontalSpacer_4 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
||||
|
||||
self.horizontalLayout_4.addItem(self.horizontalSpacer_4)
|
||||
|
||||
self.minButton = QToolButton(TitleBar)
|
||||
self.minButton.setObjectName(u"minButton")
|
||||
@ -56,7 +75,7 @@ class Ui_TitleBar(object):
|
||||
"QToolButton:pressed{ border-image:url(:/title_bar/black_min_button_pressed_57_40.png);}\n"
|
||||
"border: none; margin: 0px")
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.minButton)
|
||||
self.horizontalLayout_4.addWidget(self.minButton)
|
||||
|
||||
self.maxBt = QToolButton(TitleBar)
|
||||
self.maxBt.setObjectName(u"maxBt")
|
||||
@ -71,7 +90,7 @@ class Ui_TitleBar(object):
|
||||
"margin: 0px")
|
||||
self.maxBt.setProperty("isMax", False)
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.maxBt)
|
||||
self.horizontalLayout_4.addWidget(self.maxBt)
|
||||
|
||||
self.closeButton = QToolButton(TitleBar)
|
||||
self.closeButton.setObjectName(u"closeButton")
|
||||
@ -81,9 +100,15 @@ class Ui_TitleBar(object):
|
||||
"QToolButton:pressed{ border-image:url(:/title_bar/close_button_pressed_57_40.png);}\n"
|
||||
"border: none; margin: 0px")
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.closeButton)
|
||||
self.horizontalLayout_4.addWidget(self.closeButton)
|
||||
|
||||
|
||||
self.horizontalLayout_2.addLayout(self.horizontalLayout_4)
|
||||
|
||||
self.horizontalLayout_2.setStretch(0, 1)
|
||||
self.horizontalLayout_2.setStretch(1, 1)
|
||||
self.horizontalLayout_2.setStretch(2, 1)
|
||||
|
||||
self.retranslateUi(TitleBar)
|
||||
|
||||
QMetaObject.connectSlotsByName(TitleBar)
|
||||
@ -93,6 +118,7 @@ class Ui_TitleBar(object):
|
||||
TitleBar.setWindowTitle(QCoreApplication.translate("TitleBar", u"Form", None))
|
||||
self.label_2.setText("")
|
||||
self.label.setText(QCoreApplication.translate("TitleBar", u"PicACG", None))
|
||||
self.subTitle.setText("")
|
||||
self.minButton.setText("")
|
||||
self.maxBt.setText("")
|
||||
self.closeButton.setText("")
|
||||
|
@ -88,6 +88,9 @@ class QtOwner(Singleton):
|
||||
def searchView(self):
|
||||
return self.owner.searchView
|
||||
|
||||
def SetSubTitle(self, text):
|
||||
return self.owner.setSubTitle(text)
|
||||
|
||||
def GetFileData(self, fileName):
|
||||
f = QFile(fileName)
|
||||
f.open(QFile.ReadOnly)
|
||||
|
@ -21,7 +21,6 @@ class CTime(object):
|
||||
if diff >= checkTime:
|
||||
text = 'CTime2 consume:{} ms, {}.{}'.format(diff, clsName, des)
|
||||
Log.Warn(text)
|
||||
# 超过0.5秒超时写入数据库
|
||||
self._t1 = t2
|
||||
return diff
|
||||
|
||||
@ -34,7 +33,6 @@ def time_me(fn):
|
||||
if diff >= 50:
|
||||
clsName = args[0]
|
||||
strLog = 'time_me consume,{} ms, {}.{}'.format(diff, clsName, fn.__name__)
|
||||
# Log.w(strLog)
|
||||
Log.Warn(strLog)
|
||||
return rt
|
||||
return _wrapper
|
||||
@ -203,7 +201,6 @@ class ToolUtil(object):
|
||||
else:
|
||||
return "{}".format(second) + Str.GetStr(Str.SecondAgo)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def GetDownloadSize(downloadLen):
|
||||
kb = downloadLen / 1024.0
|
||||
@ -217,23 +214,6 @@ class ToolUtil(object):
|
||||
size = str(round(mb, 2)) + "mb"
|
||||
return size
|
||||
|
||||
@staticmethod
|
||||
def GetScaleAndNoise(w, h):
|
||||
dot = w * h
|
||||
# 条漫不放大
|
||||
if max(w, h) >= 2561:
|
||||
return 1, 3
|
||||
if dot >= 1920 * 1440:
|
||||
return 2, 3
|
||||
if dot >= 1920 * 1080:
|
||||
return 2, 3
|
||||
elif dot >= 720 * 1080:
|
||||
return 2, 3
|
||||
elif dot >= 240 * 720:
|
||||
return 2, 3
|
||||
else:
|
||||
return 2, 3
|
||||
|
||||
@staticmethod
|
||||
def GetLookScaleModel(category):
|
||||
return ToolUtil.GetModelByIndex(Setting.LookNoise.value, Setting.LookScale.value, ToolUtil.GetLookModel(category))
|
||||
@ -246,14 +226,6 @@ class ToolUtil(object):
|
||||
return {}
|
||||
return ToolUtil.GetModelByIndex(Setting.DownloadNoise.value, Setting.DownloadScale.value, Setting.DownloadModel.value)
|
||||
|
||||
@staticmethod
|
||||
def GetPictureFormat(data):
|
||||
if data[:8] == b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a":
|
||||
return "png"
|
||||
elif data[:2] == b"\xff\xd8":
|
||||
return "jpg"
|
||||
return "jpg"
|
||||
|
||||
@staticmethod
|
||||
def GetPictureSize(data):
|
||||
if not data:
|
||||
@ -264,57 +236,6 @@ class ToolUtil(object):
|
||||
img = Image.open(a)
|
||||
a.close()
|
||||
return img.width, img.height
|
||||
# picFormat = ToolUtil.GetPictureFormat(data)
|
||||
# weight, height = 1, 1
|
||||
# if picFormat == "png":
|
||||
# # head = 8 + 4 + 4
|
||||
# data2 = data[16:24]
|
||||
# weight = int.from_bytes(data2[:4], byteorder='big', signed=False)
|
||||
# height = int.from_bytes(data2[5:], byteorder='big', signed=False)
|
||||
# elif picFormat == "jpg":
|
||||
# size = min(1000, len(data))
|
||||
#
|
||||
# index = 0
|
||||
# while index < size:
|
||||
# if data[index] == 255:
|
||||
# index += 1
|
||||
# if 192 <= data[index] <= 206:
|
||||
# index += 4
|
||||
# if index + 4 >= size:
|
||||
# continue
|
||||
# height = int.from_bytes(data[index:index + 2], byteorder='big', signed=False)
|
||||
# weight = int.from_bytes(data[index + 2:index + 4], byteorder='big', signed=False)
|
||||
# break
|
||||
# else:
|
||||
# continue
|
||||
# index += 1
|
||||
# return weight, height
|
||||
|
||||
@staticmethod
|
||||
def GetDataModel(data):
|
||||
picFormat = ToolUtil.GetPictureFormat(data)
|
||||
if picFormat == "png":
|
||||
IDATEnd = 8 + 25
|
||||
dataSize = int.from_bytes(data[IDATEnd:IDATEnd + 4], byteorder="big", signed=False)
|
||||
if dataSize >= 10:
|
||||
return ""
|
||||
dataType = data[IDATEnd + 4:IDATEnd + 8]
|
||||
if dataType == b"tEXt":
|
||||
return data[IDATEnd + 8:IDATEnd + 8 + dataSize].decode("utf-8")
|
||||
return ""
|
||||
elif picFormat == "jpg":
|
||||
if data[:4] != b"\xff\xd8\xff\xe0":
|
||||
return ""
|
||||
size = int.from_bytes(data[4:6], byteorder="big", signed=False)
|
||||
if size >= 100:
|
||||
return ""
|
||||
if data[4 + size:4 + size + 2] != b"\xff\xfe":
|
||||
return
|
||||
size2 = int.from_bytes(data[4 + size + 2:4 + size + 2 + 2], byteorder="big", signed=False) - 2
|
||||
if size2 >= 100:
|
||||
return
|
||||
return data[4 + size2 + 2 + 2:4 + size2 + 2 + 2 + size2].decode("utf-8")
|
||||
return ""
|
||||
|
||||
@staticmethod
|
||||
def GetLookModel(category):
|
||||
@ -325,7 +246,6 @@ class ToolUtil(object):
|
||||
else:
|
||||
return Setting.LookModel.value
|
||||
|
||||
|
||||
@staticmethod
|
||||
def GetModelAndScale(model):
|
||||
if not model:
|
||||
@ -341,8 +261,7 @@ class ToolUtil(object):
|
||||
model = "photo"
|
||||
else:
|
||||
model = "anime_style_art_rgb"
|
||||
return model, noise, scale
|
||||
|
||||
return model, noise, scale
|
||||
|
||||
@staticmethod
|
||||
def GetModelByIndex(noise, scale, index):
|
||||
|
@ -31,16 +31,16 @@ class MainView(Main, QtTaskBase):
|
||||
self.setWindowIcon(QIcon(":/png/icon/logo_round.png"))
|
||||
# self.setAttribute(Qt.WA_TranslucentBackground)
|
||||
|
||||
# screens = QGuiApplication.screens()
|
||||
# # print(screens[0].geometry(), screens[1].geometry())
|
||||
# if Setting.ScreenIndex.value >= len(screens):
|
||||
# desktop = QGuiApplication.primaryScreen().geometry()
|
||||
# else:
|
||||
# desktop = screens[Setting.ScreenIndex.value].geometry()
|
||||
#
|
||||
# self.adjustSize()
|
||||
# self.resize(desktop.width() // 4 * 3, desktop.height() // 4 * 3)
|
||||
# self.move(self.width() // 8+desktop.x(), max(0, desktop.height()-self.height()) // 2+desktop.y())
|
||||
screens = QGuiApplication.screens()
|
||||
# print(screens[0].geometry(), screens[1].geometry())
|
||||
if Setting.ScreenIndex.value >= len(screens):
|
||||
desktop = QGuiApplication.primaryScreen().geometry()
|
||||
else:
|
||||
desktop = screens[Setting.ScreenIndex.value].geometry()
|
||||
|
||||
self.adjustSize()
|
||||
self.resize(desktop.width() // 4 * 3, desktop.height() // 4 * 3)
|
||||
self.move(self.width() // 8+desktop.x(), max(0, desktop.height()-self.height()) // 2+desktop.y())
|
||||
# print(desktop.size(), self.size())
|
||||
self.setAttribute(Qt.WA_StyledBackground, True)
|
||||
|
||||
|
@ -361,7 +361,8 @@ class ReadTool(QtWidgets.QWidget, Ui_ReadImg):
|
||||
|
||||
def UpdateSlider(self):
|
||||
self.slider.setValue(self.readImg.curIndex+1)
|
||||
self.readImg.setWindowTitle(self.readImg.epsName + "({}/{})".format(self.slider.value(), self.slider.maximum()))
|
||||
if self.readImg.epsName:
|
||||
QtOwner().SetSubTitle(self.readImg.epsName + "({}/{})".format(self.slider.value(), self.slider.maximum()))
|
||||
|
||||
def FullScreen(self):
|
||||
if QtOwner().owner.windowState() == Qt.WindowFullScreen:
|
||||
|
@ -129,6 +129,7 @@ class ReadView(QtWidgets.QWidget, QtTaskBase):
|
||||
return self.frame.qtTool
|
||||
|
||||
def Close(self):
|
||||
QtOwner().SetSubTitle("")
|
||||
self.ReturnPage()
|
||||
self.frame.scrollArea.ClearPixItem()
|
||||
self.Clear()
|
||||
@ -187,7 +188,7 @@ class ReadView(QtWidgets.QWidget, QtTaskBase):
|
||||
self.epsName = name
|
||||
QtOwner().ShowLoading()
|
||||
self.StartLoadPicUrl(isLastEps, pageIndex)
|
||||
# self.setWindowTitle(self.epsName)
|
||||
QtOwner().SetSubTitle(self.epsName)
|
||||
# self.show()
|
||||
|
||||
# if config.LookReadFull:
|
||||
|
@ -16,7 +16,7 @@
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,1,1">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -33,56 +33,78 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
<property name="leftMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter|Qt::AlignBottom">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border-image: url(:/png/icon/logo_round.png);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border-image: url(:/png/icon/logo_round.png);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PicACG</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QLabel" name="subTitle">
|
||||
<property name="text">
|
||||
<string>PicACG</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
@ -90,47 +112,52 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="minButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{ border-image:url(:/title_bar/open_black_min_button_57_40.png);}
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="minButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{ border-image:url(:/title_bar/open_black_min_button_57_40.png);}
|
||||
QToolButton:hover{ border-image:url(:/title_bar/green_min_button_hover_57_40.png);}
|
||||
QToolButton:pressed{ border-image:url(:/title_bar/black_min_button_pressed_57_40.png);}
|
||||
border: none; margin: 0px</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="maxBt">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton[isMax=false]{ border-image:url(:/title_bar/open_black_max_button_57_40.png);}
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="maxBt">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton[isMax=false]{ border-image:url(:/title_bar/open_black_max_button_57_40.png);}
|
||||
QToolButton:hover[isMax=false]{ border-image:url(:/title_bar/green_max_button_hover_57_40.png);}
|
||||
QToolButton:pressed[isMax=false]{ border-image:url(:/title_bar/black_max_button_pressed_57_40.png);}
|
||||
QToolButton[isMax=true]{ border-image:url(:/title_bar/black_down_button_57_40.png);}
|
||||
@ -138,33 +165,35 @@ QToolButton:hover[isMax=true]{ border-image:url(:/title_bar/green_down_button_ho
|
||||
QToolButton:pressed[isMax=true]{ border-image:url(:/title_bar/down_button_pressed_57_40.png);}
|
||||
border: none;
|
||||
margin: 0px</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="isMax" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="closeButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{ border-image:url(:/title_bar/open_black_close_button_57_40.png);}
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="isMax" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="closeButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{ border-image:url(:/title_bar/open_black_close_button_57_40.png);}
|
||||
QToolButton:hover{ border-image:url(:/title_bar/close_button_hover_57_40.png);}
|
||||
QToolButton:pressed{ border-image:url(:/title_bar/close_button_pressed_57_40.png);}
|
||||
border: none; margin: 0px</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user