Skip to content

Commit

Permalink
update v1.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
tonquer committed Jun 5, 2021
1 parent f1c3a13 commit 8f0d278
Show file tree
Hide file tree
Showing 84 changed files with 13,062 additions and 773 deletions.
4 changes: 2 additions & 2 deletions conf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

UpdateUrl = "https://github.com/tonquer/picacg-windows/releases/latest"
UpdateUrl2 = "https://github.com/tonquer/picacg-windows/releases"
UpdateVersion = "v1.1.6"
UpdateVersion = "v1.1.7"

# waifu2x
CanWaifu2x = True
Expand All @@ -41,7 +41,7 @@
Waifu2xThread = 2
Format = "jpg"
Waifu2xPath = "waifu2x"
IsOpenWaifu = True
IsOpenWaifu = False

LookModel = 0 # 默认值
DownloadModel = 0 # 默认值
Expand Down
Binary file modified data/book.db
Binary file not shown.
Empty file added qss/__init__.py
Empty file.
34 changes: 34 additions & 0 deletions qss/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import base64
import os
import subprocess

fw = open("qss.py", "w+")
fw.write("import base64\n\n\n")
fw.write("class QssDataMgr(object):\n")

files = []
for root, dirs, filenames in os.walk("./"):
for name in filenames:
if name[-3:] != "qss":
continue
if len(name.split(".")) >= 3:
continue
f = open(name, "r", encoding="utf-8")
# fw.write("def get():\r\n return )
i = 0
data = base64.b64encode(f.read().encode("utf-8"))
# if i % 2 == 0:
# fw.write("\\x")
fw.write(" {}".format(name[:-4]))
files.append(name[:-4])
fw.write(" = \"")
fw.write(data.decode("utf-8"))
fw.write("\"\n\n")
f.close()

fw.write(" files = {}\n\n".format(files))
fw.write(" @classmethod\n")
fw.write(" def GetData(cls, name):\n")
fw.write(" data = getattr(cls, name)\n")
fw.write(" return base64.b64decode(data.encode('utf-8')).decode('utf-8')\n")
fw.close()
12 changes: 12 additions & 0 deletions qss/qss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import base64


class QssDataMgr(object):
qt_list_scrollbar = "UVNjcm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R5rua5Yqo5p2h5Y+z5L6n5LiJ6KeS5b2i5Zu+5qCHIOm8oOagh+aMieS4iyovClFTY3JvbGxCYXI6OnJpZ2h0LWFycm93Omhvcml6b250YWw6cHJlc3NlZCB7CiAgICBpbWFnZTogdXJsKHJlc291cmNlcy9zY3JvbGxiYXIvc2Nyb2xsYmFyX2Fycm93cmlnaHRfaGlnaGxpZ2h0LnBuZyk7Cn0="

files = ['qt_list_scrollbar']

@classmethod
def GetData(cls, name):
data = getattr(cls, name)
return base64.b64decode(data.encode('utf-8')).decode('utf-8')
139 changes: 139 additions & 0 deletions qss/qt_list_scrollbar.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
QScrollBar:vertical {
background: transparent; /*背景透明*/
width: 10px; /*宽度*/
margin: 0px 0px 0px 0px; /**/
padding-top: 12px; /*距离上面12px*/
padding-bottom: 12px; /*距离底部12px*/
}
/*横向滚动条*/
QScrollBar:horizontal {
background: transparent;
height: 10px; /*高度*/
margin: 0px 0px 0px 0px;
padding-left: 12px; /*距离左边12px*/
padding-right: 12px; /*距离右边12px*/
}

/*当鼠标放到纵向或者横向滚动条上面时*/
QScrollBar:vertical:hover,QScrollBar:horizontal:hover {
background: rgba(0, 0, 0, 30); /*修改背景透明度 30*/
border-radius: 5px; /*圆角*/
}

/*纵向滚动条上面的滑块*/
QScrollBar::handle:vertical {
background: rgba(0, 0, 0, 50);
width: 10px;
border-radius: 5px;
border: none;
}
/*横向滚动条上面的滑块*/
QScrollBar::handle:horizontal {
background: rgba(0, 0, 0, 50);
height: 10px;
border-radius: 5px;
border: none;
}

/*当鼠标放到滚动条滑块上面时改变透明度实现颜色的深浅变化*/
QScrollBar::handle:vertical:hover,QScrollBar::handle:horizontal:hover {
background: rgba(0, 0, 0, 100);
}

/*纵向滚动条下部分块*/
QScrollBar::add-page:vertical {
width: 10px;
background: transparent;
}
/*横向滚动条后面部分块*/
QScrollBar::add-page:horizontal {
height: 10px;
background: transparent;
}
/*纵向滚动条上面部分块*/
QScrollBar::sub-page:vertical {
width: 10px;
background: transparent;
}
/*横向滚动条左部分块*/
QScrollBar::sub-page:horizontal {
height: 10px;
background: transparent;
}
/*纵向滚动条顶部三角形位置*/
QScrollBar::sub-line:vertical {
height: 12px;
width: 10px;
background: transparent;
subcontrol-position: top;
}
/*横向滚动条左侧三角形位置*/
QScrollBar::sub-line:horizontal {
height: 10px;
width: 12px;
background: transparent;
subcontrol-position: left;
}
/*纵向滚动条向上的三角形小图标*/
QScrollBar::up-arrow:vertical {
image: url(Data/scrollbar/scrollbar_arrowup_normal.png);
}
/*横向滚动条左边的三角形小图标*/
QScrollBar::left-arrow:horizontal {
image: url(Data/scrollbar/scrollbar_arrowleft_normal.png);
}
/*纵向滚动条向上的三角形小图标 鼠标悬停*/
QScrollBar::up-arrow:vertical:hover {
image: url(Data/scrollbar/scrollbar_arrowup_down.png);
}
/*横向滚动条左边的三角形小图标 鼠标悬停*/
QScrollBar::left-arrow:horizontal:hover {
image: url(Data/scrollbar/scrollbar_arrowleft_down.png);
}
/*纵向滚动条向上的三角形小图标 鼠标按下*/
QScrollBar::up-arrow:vertical:pressed {
image: url(Data/scrollbar/scrollbar_arrowup_highlight.png);
}
/*横向滚动条左边的三角形小图标 鼠标按下*/
QScrollBar::left-arrow:horizontal:pressed {
image: url(Data/scrollbar/scrollbar_arrowleft_highlight.png);
}

/*纵向滚动条下面三角形部分*/
QScrollBar::add-line:vertical {
height: 12px;
width: 10px;
background: transparent;
subcontrol-position: bottom;
}
/*横向滚动条右边的三角形部分*/
QScrollBar::add-line:horizontal {
height: 10px;
width: 12px;
background: transparent;
subcontrol-position: right;
}
/*纵向滚动条下面三角形图标*/
QScrollBar::down-arrow:vertical {
image: url(resources/scrollbar/scrollbar_arrowdown_normal.png);
}
/*横向滚动条右侧三角形图标*/
QScrollBar::right-arrow:horizontal {
image: url(resources/scrollbar/scrollbar_arrowright_normal.png);
}
/*纵向滚动条下面三角形图标 鼠标悬停*/
QScrollBar::down-arrow:vertical:hover {
image: url(resources/scrollbar/scrollbar_arrowdown_down.png);
}
/*横向滚动条右侧三角形图标 鼠标悬停*/
QScrollBar::right-arrow:horizontal:hover {
image: url(resources/scrollbar/scrollbar_arrowright_down.png);
}
/*纵向滚动条下面三角形图标 鼠标按下*/
QScrollBar::down-arrow:vertical:pressed {
image: url(resources/scrollbar/scrollbar_arrowdown_highlight.png);
}
/*横向滚动条右侧三角形图标 鼠标按下*/
QScrollBar::right-arrow:horizontal:pressed {
image: url(resources/scrollbar/scrollbar_arrowright_highlight.png);
}
2 changes: 2 additions & 0 deletions resources/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
for name in filenames:
if name[-3:] != "png":
continue
if len(name.split(".")) >= 3:
continue
f = open(name, "rb")
# fw.write("def get():\r\n return )
i = 0
Expand Down
Binary file added resources/scrollbar/scrollbar_arrowdown_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_arrowdown_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_arrowleft_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_arrowleft_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_arrowright_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_arrowright_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_arrowup_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_arrowup_highlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_arrowup_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_bar_highlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_bar_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_bkg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_horzbar_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_horzbar_highlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/scrollbar/scrollbar_horzbar_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 12 additions & 8 deletions src/qt/chat/qtchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,36 @@
from PySide2.QtWidgets import QGridLayout

from src.qt.chat.qtchatroom import QtChatRoom
from src.qt.com.qtlistwidget import QtBookList
from src.server import Server, QtTask, req, Log, json
from ui.qtlistwidget import QtBookList
from src.server import Server, QtTask, req, Log, json, Status


class QtChat(QtWidgets.QWidget):
def __init__(self, owner):
super(self.__class__, self).__init__(owner)
self.owner = weakref.ref(owner)
self.gridLayout = QGridLayout(self)
self.listWidget = QtBookList(None, self.__class__.__name__, owner)
self.listWidget.InitUser()
self.listWidget = QtBookList(None)
self.listWidget.InitUser(self.__class__.__name__, owner)
self.gridLayout.addWidget(self.listWidget)
self.closeFlag = self.__class__.__name__
self.listWidget.doubleClicked.connect(self.OpenChatRoom)
self.chatRoom = QtChatRoom()
self.listWidget.setStyleSheet("""
QListWidget {background-color:transparent;}
""")

def SwitchCurrent(self):
if self.listWidget.count() > 0:
return
self.owner().loadingForm.show()
QtTask().AddHttpTask(
lambda x: Server().Send(req.GetChatReq(), bakParam=x),
self.GetChatBack, cleanFlag=self.closeFlag)
return

def GetChatBack(self, data):
self.owner().loadingForm.close()
try:
data = json.loads(data)
if data.get("code") == 200:
Expand All @@ -38,11 +43,10 @@ def GetChatBack(self, data):
content = info.get("description")
# avatar = info.get("_user", {}).get("avatar", {})
# createdTime = info.get("created_at")
self.listWidget.AddUserItem(info.get("url"), "", "", content, name, "", index+1,
info.get("avatar"),
"", "")
self.listWidget.AddUserItem(info, index+1)
except Exception as es:
Log.Error(es)
self.owner().msgForm.ShowMsg(Status.UnKnowError)
return

def OpenChatRoom(self, modelIndex):
Expand All @@ -53,4 +57,4 @@ def OpenChatRoom(self, modelIndex):
widget = self.listWidget.itemWidget(item)
if not widget:
return
self.chatRoom.OpenChat(widget.id, widget.nameLabel.text())
self.chatRoom.OpenChat(widget.id, widget.titleLabel.text())
2 changes: 1 addition & 1 deletion src/qt/chat/qtchatroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def SendMsg(self, imageData=None):
info['avatar'] = "https://storage.wikawika.xyz" + "/static/" + User().avatar.get("path")
info['audio'] = ""
info['block_user_id'] = ""
info['platform'] = "windows"
info['platform'] = "android"
if not imageData:
info['reply_name'] = ""
info['at'] = ""
Expand Down
15 changes: 3 additions & 12 deletions src/qt/chat/qtchatroommsg.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def __init__(self, chatRoom):
p.loadFromData(DataMgr().GetData("placeholder_avatar"))
self.commentLabel.installEventFilter(self)
self.picLabel.installEventFilter(self)
self.label.installEventFilter(self)
self.label.setText("")
self.data = None
self.picData = None
self.audioData = None
Expand Down Expand Up @@ -77,18 +75,11 @@ def setParent(self, parent):
return super(self.__class__, self).setParent(parent)

def SetPicture(self, data):
pic = QPixmap()
pic.loadFromData(data)
self.picData = data
self.picLabel.setPixmap(pic)
self.picLabel.SetPicture(data)

def SetHeadPicture(self, data):
pic = QPixmap()
pic.loadFromData(data)
self.label.setCursor(Qt.PointingHandCursor)
self.label.setScaledContents(True)
self.label.setAttribute(Qt.WA_TranslucentBackground)
self.label.setPixmap(pic)
self.picLabel.SetPicture(self.picData, data)

def SetPictureComment(self, data):
pic = QPixmap()
Expand All @@ -106,7 +97,7 @@ def SetPictureComment(self, data):
def eventFilter(self, obj, event):
if event.type() == QEvent.MouseButtonPress:
if event.button() == Qt.LeftButton:
if self.picData and (obj == self.label or obj == self.picLabel):
if self.picData and (obj == self.picLabel):
QtImgMgr().ShowImg(self.picData)
elif self.data and obj == self.commentLabel:
QtImgMgr().ShowImg(self.data)
Expand Down
Loading

0 comments on commit 8f0d278

Please sign in to comment.