Skip to content

Commit

Permalink
更新版本
Browse files Browse the repository at this point in the history
  • Loading branch information
tonquer committed Apr 21, 2024
1 parent a96b720 commit 5f8e5fb
Show file tree
Hide file tree
Showing 37 changed files with 1,408 additions and 142 deletions.
4 changes: 2 additions & 2 deletions res/appimage/AppRun
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ if [ ! -f ~/.picacg/db/version ];then
echo "mkdir version"
fi

if [ ! -f ~/.picacg/db/book.db ] || [ "`cat ~/.picacg/db/version`" != "v1.4.8" ] ; then
if [ ! -f ~/.picacg/db/book.db ] || [ "`cat ~/.picacg/db/version`" != "v1.4.9" ] ; then
cp ${HERE}/db/book.db ~/.picacg/db/
echo "v1.4.8" > ~/.picacg/db/version
echo "v1.4.9" > ~/.picacg/db/version
echo "copy db"
fi

Expand Down
2 changes: 1 addition & 1 deletion src/component/dialog/base_mask_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def showEvent(self, e):
opacityAni.setEasingCurve(QEasingCurve.InSine)
opacityAni.finished.connect(opacityEffect.deleteLater)
opacityAni.start()
super().showEvent(e)
QWidget.showEvent(self, e)

# def closeEvent(self, e):
# """ 淡出 """
Expand Down
67 changes: 53 additions & 14 deletions src/component/scroll/read_scroll.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import weakref

from PySide6.QtCore import QPropertyAnimation, QEasingCurve, QAbstractAnimation
from PySide6.QtCore import QPropertyAnimation, QEasingCurve, QAbstractAnimation, Qt
from PySide6.QtWidgets import QScrollBar

from qt_owner import QtOwner
Expand Down Expand Up @@ -35,10 +35,22 @@ def __init__(self, parent):
# self.valueChanged.connect(self.ValueChange)
self.oldv = 0

# def ValueChange(self,value):
# self.oldv = value
# print("2, {}".format(value))
@property
def stripModel(self):
return self._owner().qtTool.stripModel

@property
def isCurReadModel(self):
if self.orientation() == Qt.Orientation.Vertical:
return self.stripModel == ReadMode.UpDown
else:
return True

#
# def ValueChange(self,value):
# # self.oldv = value
# print("2, {}".format(value))
#
# def AniValueChange(self, value):
# print("1, {}".format(value))

Expand All @@ -57,9 +69,11 @@ def ResetAniValueByAdd(self, oldV, addV):
scrollTime = min(self.maxScrollTme, int(laveV / changeV * self.lastScrollTime))
if scrollTime > 0:
self.ani.stop()
# print("ani stop 5")
self.StartAni(self.value(), self.lastAniEndV, scrollTime)
else:
self.ani.stop()
# print("ani stop 6")
self.StartAni(self.value(), self.value(), self.scrollTime)

def AniValueByAdd(self, addV):
Expand All @@ -73,14 +87,15 @@ def AniValueByAdd(self, addV):
self.lastAniEndV = self.lastAniStartV + v
laveV = self.lastAniEndV - self.lastAniStartV

scrollTime = 0
if changeV != 0:
scrollTime = min(self.maxScrollTme, int(laveV / changeV * self.lastScrollTime))
if scrollTime <= 0:
scrollTime = self.scrollTime
scrollTime = self.scrollTime
# if changeV != 0:
# scrollTime = min(self.maxScrollTme, int(laveV / changeV * self.lastScrollTime))
# if scrollTime <= 0:
# scrollTime = self.scrollTime

# print("add setV, {}".format(self.lastAniEndV))
# print("add setV, {}, {}, {}".format(scrollTime,self.value(), self.lastAniEndV))
self.ani.stop()
# print("ani stop 1")
self.StartAni(self.value(), self.lastAniEndV, scrollTime)

# def AniValueChange(self, value):
Expand Down Expand Up @@ -108,6 +123,7 @@ def Finished(self):

def StopScroll(self):
self.ani.stop()
# print("ani stop 2")
#
# def Scroll(self, value, time=0):
# if self.ani.state() == QAbstractAnimation.State.Running:
Expand All @@ -123,6 +139,20 @@ def StopScroll(self):

def ForceSetValue(self, value):
self.ani.stop()
# print("ani stop 3")
# print("force setV, {}".format(value))
QScrollBar.setValue(self, value)
self.StartAni(value, value, self.scrollTime)

def ForceSetValue2(self, value, isAdd):
if value == self.value():
if isAdd and self.stripModel != ReadMode.RightLeftScroll:
self.__value = self.__value + 1
else:
self.__value = self.__value - 1

self.ani.stop()
# print("ani stop 3")
# print("force setV, {}".format(value))
QScrollBar.setValue(self, value)
self.StartAni(value, value, self.scrollTime)
Expand All @@ -144,8 +174,11 @@ def setValue(self, value: int):
# stop running animation
if self.ani.state() == self.ani.State.Running:
self.AniValueByAdd(value-self.value())
# print("ani stop 1")
# self.StartAni(self.value(), value, self.scrollTime)
else:
self.ani.stop()
# print("ani stop 4")
self.StartAni(self.value(), value, self.scrollTime)

def scrollValue(self, value: int):
Expand All @@ -167,14 +200,16 @@ def OnValueChange(self, value):
# self.UpdateScrollBar(value)
self.__value = value

if not self.isCurReadModel:
return
if not ReadMode.isScroll(self.scrollArea.initReadMode):
return

curPictureSize = self.labelSize.get(self.readImg.curIndex)
nextPictureSize = self.labelSize.get(self.readImg.curIndex + 1, 0)
changeIndex = self.readImg.curIndex
if self.scrollArea.initReadMode == ReadMode.RightLeftScroll:
newValue = value + self.scrollArea.width()
curPictureSize = self.labelSize.get(self.readImg.curIndex)
nextPictureSize = self.labelSize.get(self.readImg.curIndex - 1, 0)
while True:
## 切换上一图片
if addValue > 0 and newValue >= nextPictureSize:
Expand All @@ -195,8 +230,10 @@ def OnValueChange(self, value):
else:
break
curPictureSize = self.labelSize.get(changeIndex)
nextPictureSize = self.labelSize.get(changeIndex + 1, 0)
nextPictureSize = self.labelSize.get(changeIndex - 1, 0)
else:
curPictureSize = self.labelSize.get(self.readImg.curIndex)
nextPictureSize = self.labelSize.get(self.readImg.curIndex + 1, 0)
while True:
## 切换上一图片
if addValue < 0 and value < curPictureSize:
Expand All @@ -217,6 +254,8 @@ def OnValueChange(self, value):
break
curPictureSize = self.labelSize.get(changeIndex)
nextPictureSize = self.labelSize.get(changeIndex + 1, 0)
print("change, {}->{}, {}->{}".format(self.readImg.curIndex, changeIndex, curPictureSize, nextPictureSize))

if self.readImg.curIndex == changeIndex:
return
elif self.readImg.curIndex > changeIndex:
Expand All @@ -225,4 +264,4 @@ def OnValueChange(self, value):
elif self.readImg.curIndex < changeIndex:
self.readImg.curIndex = changeIndex
self.scrollArea.changeNextPage.emit(self.readImg.curIndex)
return
return
1 change: 1 addition & 0 deletions src/component/widget/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(self):
FramelessMainWindow.__init__(self)
Ui_MainWindows.__init__(self)
self.setupUi(self)
self.setTitleBar(self.widget)
self.totalStackWidget.setAttribute(Qt.WA_TranslucentBackground)
self.widget.setAttribute(Qt.WA_TranslucentBackground)

Expand Down
2 changes: 1 addition & 1 deletion src/component/widget/navigation_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, parent=None):
QtTaskBase.__init__(self)
self.setupUi(self)
if Setting.IsUseTitleBar.value:
self.scrollArea.setFixedHeight(300)
self.scrollArea.setFixedHeight(380)
# self.resize(260, 800)
self.__ani = QPropertyAnimation(self, b"geometry")
self.__connect = None
Expand Down
6 changes: 3 additions & 3 deletions src/component/widget/qframelesswindow/linux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LinuxFramelessWindow(QWidget):
BORDER_WIDTH = 5

def __init__(self, parent=None):
super().__init__(parent=parent)
QWidget.__init__(self, parent=parent)
self.windowEffect = LinuxWindowEffect(self)
self.titleBar = TitleBar(self)
self._isResizeEnabled = True
Expand All @@ -26,7 +26,7 @@ def __init__(self, parent=None):
self.resize(500, 500)

def resizeEvent(self, e):
super().resizeEvent(e)
QWidget.resizeEvent(self, e)
self.titleBar.resize(self.width(), self.titleBar.height())

def updateFrameless(self):
Expand Down Expand Up @@ -82,4 +82,4 @@ def eventFilter(self, obj, event):
elif obj in (self, self.titleBar) and et == QEvent.MouseButtonPress and edges:
LinuxMoveResize.starSystemResize(self, event.globalPos(), edges)

return super().eventFilter(obj, event)
return QWidget.eventFilter(self, obj, event)
10 changes: 5 additions & 5 deletions src/component/widget/qframelesswindow/mac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MacFramelessWindow(QWidget):
""" Frameless window for Linux system """

def __init__(self, parent=None):
super().__init__(parent=parent)
QWidget.__init__(self, parent=parent)
self.windowEffect = MacWindowEffect(self)
# must enable acrylic effect before creating title bar
if isinstance(self, AcrylicWindow):
Expand Down Expand Up @@ -53,15 +53,15 @@ def setResizeEnabled(self, isEnabled: bool):
self._isResizeEnabled = isEnabled

def resizeEvent(self, e):
super().resizeEvent(e)
QWidget.resizeEvent(self, e)
self.titleBar.resize(self.width(), self.titleBar.height())

def paintEvent(self, e):
super().paintEvent(e)
QWidget.paintEvent(self, e)
self.__hideSystemTitleBar()

def changeEvent(self, event):
super().changeEvent(event)
QWidget.changeEvent(self, event)
if event.type() == QEvent.WindowStateChange:
self.__hideSystemTitleBar()

Expand All @@ -87,7 +87,7 @@ class AcrylicWindow(MacFramelessWindow):
""" A frameless window with acrylic effect """

def __init__(self, parent=None):
super().__init__(parent)
MacFramelessWindow.__init__(self, parent)
self.setAttribute(Qt.WA_TranslucentBackground)
self.windowEffect.setAcrylicEffect(self.winId())
self.setStyleSheet("background: transparent")
8 changes: 4 additions & 4 deletions src/component/widget/qframelesswindow/titlebar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TitleBarBase(QWidget):
""" Title bar base class """

def __init__(self, parent):
super().__init__(parent)
QWidget.__init__(self, parent)
self.minBtn = MinimizeButton(parent=self)
self.closeBtn = CloseButton(parent=self)
self.maxBtn = MaximizeButton(parent=self)
Expand All @@ -37,7 +37,7 @@ def eventFilter(self, obj, e):
self.maxBtn.setMaxState(self.window().isMaximized())
return False

return super().eventFilter(obj, e)
return QWidget.eventFilter(self, obj, e)

def mouseDoubleClickEvent(self, event):
""" Toggles the maximization state of the window """
Expand Down Expand Up @@ -98,7 +98,7 @@ class TitleBar(TitleBarBase):
""" Title bar with minimize, maximum and close button """

def __init__(self, parent):
super().__init__(parent)
TitleBarBase.__init__(self, parent)
self.hBoxLayout = QHBoxLayout(self)

# add buttons to layout
Expand All @@ -115,7 +115,7 @@ class StandardTitleBar(TitleBar):
""" Title bar with icon and title """

def __init__(self, parent):
super().__init__(parent)
TitleBar.__init__(self,parent)
# add window icon
self.iconLabel = QLabel(self)
self.iconLabel.setFixedSize(20, 20)
Expand Down
16 changes: 8 additions & 8 deletions src/component/widget/qframelesswindow/windows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class WindowsFramelessWindow(QWidget):
BORDER_WIDTH = 5

def __init__(self, parent=None):
super().__init__(parent=parent)
QWidget.__init__(self, parent)
self.windowEffect = WindowsWindowEffect(self)
self.titleBar = TitleBar(self)
self._isResizeEnabled = True
Expand Down Expand Up @@ -69,14 +69,14 @@ def setResizeEnabled(self, isEnabled: bool):
self._isResizeEnabled = isEnabled

def resizeEvent(self, e):
super().resizeEvent(e)
QWidget.resizeEvent(self, e)
self.titleBar.resize(self.width(), self.titleBar.height())

def nativeEvent(self, eventType, message):
""" Handle the Windows message """
msg = MSG.from_address(message.__int__())
if not msg.hWnd:
return super().nativeEvent(eventType, message)
return QWidget.nativeEvent(self, eventType, message)

if msg.message == win32con.WM_NCHITTEST and self._isResizeEnabled:
pos = QCursor.pos()
Expand Down Expand Up @@ -141,7 +141,7 @@ def nativeEvent(self, eventType, message):
result = 0 if not msg.wParam else win32con.WVR_REDRAW
return True, result

return super().nativeEvent(eventType, message)
return QWidget.nativeEvent(self, eventType, message)

def __onScreenChanged(self):
hWnd = int(self.windowHandle().winId())
Expand All @@ -153,12 +153,12 @@ class AcrylicWindow(WindowsFramelessWindow):
""" A frameless window with acrylic effect """

def __init__(self, parent=None):
super().__init__(parent=parent)
QWidget.__init__(self, parent=parent)
self.__closedByKey = False
self.setStyleSheet("AcrylicWindow{background:transparent}")

def updateFrameless(self):
super().updateFrameless()
WindowsFramelessWindow.updateFrameless(self)
self.windowEffect.enableBlurBehindWindow(self.winId())

if win_utils.isWin7() and self.parent():
Expand Down Expand Up @@ -187,12 +187,12 @@ def nativeEvent(self, eventType, message):
QApplication.sendEvent(self, QCloseEvent())
return False, 0

return super().nativeEvent(eventType, message)
return WindowsFramelessWindow.nativeEvent(self, eventType, message)

def closeEvent(self, e):
if not self.__closedByKey or QApplication.quitOnLastWindowClosed():
self.__closedByKey = False
return super().closeEvent(e)
return WindowsFramelessWindow.closeEvent(self,e)

# system tray icon
self.__closedByKey = False
Expand Down
2 changes: 1 addition & 1 deletion src/component/widget/windows/frame_less_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FrameLessWidget(QWidget):
BORDER_WIDTH = 10

def __init__(self, parent=None):
super().__init__(parent)
QWidget.__init__(self, parent)
self.setWindowFlags(Qt.FramelessWindowHint |
Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint)
# self.setWindowFlags(Qt.FramelessWindowHint)
Expand Down
1 change: 1 addition & 0 deletions src/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@

ImageDomain = [
"s3.picacomic.com",
"s2.picacomic.com",
"storage.diwodiwo.xyz",
# "img.diwodiwo.xyz",
"storage1.picacomic.com",
Expand Down
2 changes: 1 addition & 1 deletion src/config/global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GlobalConfig:
Address = GlobalItem(["104.21.91.145", "188.114.98.153"])
AddressIpv6 = GlobalItem(["2606:4700:d:28:dbf4:26f3:c265:73bc", "2a06:98c1:3120:ca71:be2c:c721:d2b5:5dbf"])
ImageUrl = GlobalItem("s3.picacomic.com")
ImageServerList = GlobalItem(["s3.picacomic.com", "storage.diwodiwo.xyz", "storage-b.picacomic.com", "storage1.picacomic.com"])
ImageServerList = GlobalItem(["s3.picacomic.com", "storage.diwodiwo.xyz", "s2.picacomic.com", "storage1.picacomic.com", "storage-b.picacomic.com"])
ImageJumList = GlobalItem(["img.picacomic.com", "img.diwodiwo.xyz"])

def __init__(self):
Expand Down
1 change: 1 addition & 0 deletions src/config/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class Setting:
TurnSpeed = SettingValue("ReadSetting", 5000, False)
ScrollSpeed = SettingValue("ReadSetting", 400, False)
PreDownWaifu2x = SettingValue("ReadSetting", 1, False)
IsOpenOpenGL = SettingValue("ReadSetting", 1, True)

# Other
UserId = SettingValue("Other", "", False)
Expand Down
Binary file modified src/db/book.db
Binary file not shown.
Loading

0 comments on commit 5f8e5fb

Please sign in to comment.