Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonzorn committed Apr 2, 2022
1 parent 568eaa7 commit 39441d7
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 82 deletions.
4 changes: 4 additions & 0 deletions const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
HEADERS = {'User-Agent': 'Desu'}


lib_lists_en = ['planned', 'completed', 'watching', 'rewatching', 'on_hold', 'dropped']
lib_lists_ru = ['запланированно', 'прочитано', 'читаю', 'перечитываю', 'отложено', 'брошено']


app_icon_path = os.path.join(Path(__file__).parent, "images/icon.png")
library_icon_path = os.path.join(Path(__file__).parent, "images/library.png")
main_icon_path = os.path.join(Path(__file__).parent, "images/main.png")
Expand Down
11 changes: 6 additions & 5 deletions database.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sqlite3
import os

from const import lib_lists_en
from items import Chapter, Image, Manga


Expand Down Expand Up @@ -46,12 +47,12 @@ def get_images(self, chapter_id: int) -> list:
a = self.cur.execute(f"SELECT * FROM images WHERE chapter_id = {chapter_id} ORDER by index_n").fetchall()
return [Image({'id': i[0], 'page': i[1], 'width': i[2], 'height': i[3], 'img': i[4]}) for i in a]

def add_manga_library(self, manga_id: int):
self.cur.execute(f"INSERT INTO library VALUES(?, ?);", (manga_id, "list"))
def add_manga_library(self, manga_id: int, lib_list: str = "planned"):
self.cur.execute(f"INSERT INTO library VALUES(?, ?);", (manga_id, lib_list))
self.con.commit()

def get_manga_library(self) -> [Manga]:
a = self.cur.execute(f"SELECT id FROM library WHERE list not Null;").fetchall()
def get_manga_library(self, lib_list) -> [Manga]:
a = self.cur.execute(f"SELECT id FROM library WHERE list = '{lib_list}';").fetchall()
manga = []
for i in a[::-1]:
x = self.cur.execute(f"SELECT * FROM manga WHERE id = {i[0]}").fetchall()[0]
Expand All @@ -62,7 +63,7 @@ def get_manga_library(self) -> [Manga]:
def check_manga_library(self, manga_id: int) -> bool:
a = self.cur.execute(f"SELECT list FROM library WHERE id = {manga_id};").fetchall()
self.con.commit()
if a and a[0][0]:
if a and a[0][0] in lib_lists_en:
return True
return False

Expand Down
18 changes: 12 additions & 6 deletions desuUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def setupUi(self, Dialog):
brush = QtGui.QBrush(QtGui.QColor(236, 240, 241))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(199, 203, 203, 128))
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.PlaceholderText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
Expand Down Expand Up @@ -109,7 +109,7 @@ def setupUi(self, Dialog):
brush = QtGui.QBrush(QtGui.QColor(236, 240, 241))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(199, 203, 203, 128))
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
Expand Down Expand Up @@ -157,7 +157,7 @@ def setupUi(self, Dialog):
brush = QtGui.QBrush(QtGui.QColor(236, 240, 241))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(199, 203, 203, 128))
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.PlaceholderText, brush)
Dialog.setPalette(palette)
Expand Down Expand Up @@ -195,12 +195,18 @@ def setupUi(self, Dialog):
self.btn_mylist.setStyleSheet("background-color: rgb(0, 133, 52);\n"
"color: rgb(255, 255, 255);")
self.btn_mylist.setText("")
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("images/library.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btn_mylist.setIcon(icon)
self.btn_mylist.setObjectName("btn_mylist")
self.gridLayout_2.addWidget(self.btn_mylist, 0, 0, 1, 1)
self.btn_main = QtWidgets.QPushButton(Dialog)
self.btn_main.setStyleSheet("background-color: rgb(0, 133, 52);\n"
"color: rgb(255, 255, 255);")
self.btn_main.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap("images/main.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btn_main.setIcon(icon1)
self.btn_main.setObjectName("btn_main")
self.gridLayout_2.addWidget(self.btn_main, 1, 0, 1, 1)
self.horizontalLayout = QtWidgets.QHBoxLayout()
Expand Down Expand Up @@ -263,7 +269,7 @@ def setupUi(self, Dialog):
brush = QtGui.QBrush(QtGui.QColor(236, 240, 241))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(199, 203, 203, 128))
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.PlaceholderText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
Expand Down Expand Up @@ -311,7 +317,7 @@ def setupUi(self, Dialog):
brush = QtGui.QBrush(QtGui.QColor(236, 240, 241))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(199, 203, 203, 128))
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
Expand Down Expand Up @@ -359,7 +365,7 @@ def setupUi(self, Dialog):
brush = QtGui.QBrush(QtGui.QColor(236, 240, 241))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(199, 203, 203, 128))
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.PlaceholderText, brush)
self.list_manga.setPalette(palette)
Expand Down
58 changes: 34 additions & 24 deletions desuUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@
</colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="SolidPattern">
<color alpha="128">
<red>199</red>
<green>203</green>
<blue>203</blue>
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
Expand Down Expand Up @@ -296,10 +296,10 @@
</colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="SolidPattern">
<color alpha="128">
<red>199</red>
<green>203</green>
<blue>203</blue>
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
Expand Down Expand Up @@ -442,10 +442,10 @@
</colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="SolidPattern">
<color alpha="128">
<red>199</red>
<green>203</green>
<blue>203</blue>
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
Expand Down Expand Up @@ -521,6 +521,11 @@ color: rgb(255, 255, 255);</string>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>images/library.png</normalon>
</iconset>
</property>
</widget>
</item>
<item row="1" column="0">
Expand All @@ -532,6 +537,11 @@ color: rgb(255, 255, 255);</string>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>images/main.png</normalon>
</iconset>
</property>
</widget>
</item>
<item row="4" column="2">
Expand Down Expand Up @@ -702,10 +712,10 @@ color: rgb(255, 255, 255);</string>
</colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="SolidPattern">
<color alpha="128">
<red>199</red>
<green>203</green>
<blue>203</blue>
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
Expand Down Expand Up @@ -848,10 +858,10 @@ color: rgb(255, 255, 255);</string>
</colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="SolidPattern">
<color alpha="128">
<red>199</red>
<green>203</green>
<blue>203</blue>
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
Expand Down Expand Up @@ -994,10 +1004,10 @@ color: rgb(255, 255, 255);</string>
</colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="SolidPattern">
<color alpha="128">
<red>199</red>
<green>203</green>
<blue>203</blue>
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
Expand Down
29 changes: 26 additions & 3 deletions desu_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def setupUi(self, Dialog):
"background-color: rgb(45, 45, 45);")
self.gridLayout_3 = QtWidgets.QGridLayout(Dialog)
self.gridLayout_3.setObjectName("gridLayout_3")
self.chapters = QtWidgets.QListWidget(Dialog)
self.chapters.setObjectName("chapters")
self.gridLayout_3.addWidget(self.chapters, 0, 1, 1, 1)
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.horizontalLayout = QtWidgets.QHBoxLayout()
Expand All @@ -92,14 +95,31 @@ def setupUi(self, Dialog):
self.btn_back.setStyleSheet("background-color: rgb(0, 133, 52);\n"
"color: rgb(255, 255, 255);")
self.btn_back.setText("")
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("images/back.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btn_back.setIcon(icon)
self.btn_back.setObjectName("btn_back")
self.horizontalLayout.addWidget(self.btn_back)
spacerItem = QtWidgets.QSpacerItem(37, 17, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.lib_list = QtWidgets.QComboBox(Dialog)
self.lib_list.setStyleSheet("background-color: rgb(0, 133, 52);\n"
"color: rgb(255, 255, 255);")
self.lib_list.setObjectName("lib_list")
self.lib_list.addItem("")
self.lib_list.addItem("")
self.lib_list.addItem("")
self.lib_list.addItem("")
self.lib_list.addItem("")
self.lib_list.addItem("")
self.horizontalLayout.addWidget(self.lib_list)
self.btn_mylist = QtWidgets.QPushButton(Dialog)
self.btn_mylist.setStyleSheet("background-color: rgb(0, 133, 52);\n"
"color: rgb(255, 255, 255);")
self.btn_mylist.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap("images/favorite.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btn_mylist.setIcon(icon1)
self.btn_mylist.setObjectName("btn_mylist")
self.horizontalLayout.addWidget(self.btn_mylist)
self.verticalLayout_3.addLayout(self.horizontalLayout)
Expand Down Expand Up @@ -188,14 +208,17 @@ def setupUi(self, Dialog):
self.gridLayout.addWidget(self.description, 0, 0, 1, 1)
self.verticalLayout_3.addLayout(self.gridLayout)
self.gridLayout_3.addLayout(self.verticalLayout_3, 0, 0, 1, 1)
self.chapters = QtWidgets.QListWidget(Dialog)
self.chapters.setObjectName("chapters")
self.gridLayout_3.addWidget(self.chapters, 0, 1, 1, 1)

self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)

def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.lib_list.setItemText(0, _translate("Dialog", "Запланированно"))
self.lib_list.setItemText(1, _translate("Dialog", "Прочитано"))
self.lib_list.setItemText(2, _translate("Dialog", "Читаю"))
self.lib_list.setItemText(3, _translate("Dialog", "Перечитываю"))
self.lib_list.setItemText(4, _translate("Dialog", "Отложено"))
self.lib_list.setItemText(5, _translate("Dialog", "Брошено"))
self.rate.setText(_translate("Dialog", "Рейтинг:"))
54 changes: 51 additions & 3 deletions desu_info.ui
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@
background-color: rgb(45, 45, 45);</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QListWidget" name="chapters"/>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
Expand All @@ -230,6 +233,11 @@ color: rgb(255, 255, 255);</string>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>images/back.png</normalon>
</iconset>
</property>
</widget>
</item>
<item>
Expand All @@ -245,6 +253,44 @@ color: rgb(255, 255, 255);</string>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="lib_list">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 133, 52);
color: rgb(255, 255, 255);</string>
</property>
<item>
<property name="text">
<string>Запланированно</string>
</property>
</item>
<item>
<property name="text">
<string>Прочитано</string>
</property>
</item>
<item>
<property name="text">
<string>Читаю</string>
</property>
</item>
<item>
<property name="text">
<string>Перечитываю</string>
</property>
</item>
<item>
<property name="text">
<string>Отложено</string>
</property>
</item>
<item>
<property name="text">
<string>Брошено</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_mylist">
<property name="styleSheet">
Expand All @@ -254,6 +300,11 @@ color: rgb(255, 255, 255);</string>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>images/favorite.png</normalon>
</iconset>
</property>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -457,9 +508,6 @@ background-color: rgb(45, 45, 45);</string>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QListWidget" name="chapters"/>
</item>
</layout>
</widget>
<resources/>
Expand Down
Loading

0 comments on commit 39441d7

Please sign in to comment.