mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Add manga bundle announcements (#1083)
* add announcements * fix url * don't check version if frozen * comment * update * use bindle and python 3.11 * privacy update
This commit is contained in:
@@ -406,7 +406,7 @@ Older links (dead):
|
|||||||
|
|
||||||
## PRIVACY
|
## PRIVACY
|
||||||
**KCC** is initiating internet connections in two cases:
|
**KCC** is initiating internet connections in two cases:
|
||||||
* During startup - Version check.
|
* During startup - Version check and announcement check.
|
||||||
* When error occurs - Automatic reporting on Windows and macOS.
|
* When error occurs - Automatic reporting on Windows and macOS.
|
||||||
|
|
||||||
## KNOWN ISSUES
|
## KNOWN ISSUES
|
||||||
|
|||||||
@@ -27,6 +27,10 @@
|
|||||||
<file>../icons/convert.png</file>
|
<file>../icons/convert.png</file>
|
||||||
<file>../icons/document_new.png</file>
|
<file>../icons/document_new.png</file>
|
||||||
<file>../icons/folder_new.png</file>
|
<file>../icons/folder_new.png</file>
|
||||||
|
</qresource>
|
||||||
|
<qresource prefix="Brand">
|
||||||
<file>../icons/kofi_symbol.png</file>
|
<file>../icons/kofi_symbol.png</file>
|
||||||
|
<file>../icons/Humble_H-Red.png</file>
|
||||||
|
<file>../icons/Bindle_Red.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -24,6 +24,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QListWidget" name="jobList">
|
<widget class="QListWidget" name="jobList">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>150</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
@@ -86,7 +92,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="KCC.qrc">
|
<iconset resource="KCC.qrc">
|
||||||
<normaloff>:/Other/icons/kofi_symbol.png</normaloff>:/Other/icons/kofi_symbol.png</iconset>
|
<normaloff>:/Brand/icons/kofi_symbol.png</normaloff>:/Other/icons/kofi_symbol.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
|
|||||||
BIN
icons/Bindle_Red.png
Normal file
BIN
icons/Bindle_Red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
BIN
icons/Humble_H-Red.png
Normal file
BIN
icons/Humble_H-Red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -17,6 +17,7 @@
|
|||||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
from datetime import datetime, timezone
|
||||||
import itertools
|
import itertools
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PySide6.QtCore import (QSize, QUrl, Qt, Signal, QIODeviceBase, QEvent, QThread, QSettings)
|
from PySide6.QtCore import (QSize, QUrl, Qt, Signal, QIODeviceBase, QEvent, QThread, QSettings)
|
||||||
@@ -124,7 +125,7 @@ class Icons:
|
|||||||
self.EPUBFormat = QIcon()
|
self.EPUBFormat = QIcon()
|
||||||
self.EPUBFormat.addPixmap(QPixmap(":/Formats/icons/EPUB.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
self.EPUBFormat.addPixmap(QPixmap(":/Formats/icons/EPUB.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
self.KFXFormat = QIcon()
|
self.KFXFormat = QIcon()
|
||||||
self.KFXFormat.addPixmap(QPixmap(":/Formats/icons/KFX.png"), QIcon.Normal, QIcon.Off)
|
self.KFXFormat.addPixmap(QPixmap(":/Formats/icons/KFX.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
|
|
||||||
self.info = QIcon()
|
self.info = QIcon()
|
||||||
self.info.addPixmap(QPixmap(":/Status/icons/info.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
self.info.addPixmap(QPixmap(":/Status/icons/info.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
@@ -136,6 +137,15 @@ class Icons:
|
|||||||
self.programIcon = QIcon()
|
self.programIcon = QIcon()
|
||||||
self.programIcon.addPixmap(QPixmap(":/Icon/icons/comic2ebook.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
self.programIcon.addPixmap(QPixmap(":/Icon/icons/comic2ebook.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
|
|
||||||
|
self.kofi = QIcon()
|
||||||
|
self.kofi.addPixmap(QPixmap(":/Brand/icons/kofi_symbol.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
|
|
||||||
|
self.humble = QIcon()
|
||||||
|
self.humble.addPixmap(QPixmap(":/Brand/icons/Humble_H-Red.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
|
|
||||||
|
self.bindle = QIcon()
|
||||||
|
self.bindle.addPixmap(QPixmap(":/Brand/icons/Bindle_Red.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
|
|
||||||
|
|
||||||
class VersionThread(QThread):
|
class VersionThread(QThread):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -150,19 +160,50 @@ class VersionThread(QThread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
json_parser = requests.get("https://api.github.com/repos/ciromattia/kcc/releases/latest").json()
|
# unauthenticated API requests limit is 60 req/hour
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
json_parser = requests.get("https://api.github.com/repos/ciromattia/kcc/releases/latest").json()
|
||||||
|
|
||||||
html_url = json_parser["html_url"]
|
html_url = json_parser["html_url"]
|
||||||
latest_version = json_parser["tag_name"]
|
latest_version = json_parser["tag_name"]
|
||||||
latest_version = re.sub(r'^v', "", latest_version)
|
latest_version = re.sub(r'^v', "", latest_version)
|
||||||
|
|
||||||
if ("b" not in __version__ and Version(latest_version) > Version(__version__)) \
|
if ("b" not in __version__ and Version(latest_version) > Version(__version__)) \
|
||||||
or ("b" in __version__
|
or ("b" in __version__
|
||||||
and Version(latest_version) >= Version(re.sub(r'b.*', '', __version__))):
|
and Version(latest_version) >= Version(re.sub(r'b.*', '', __version__))):
|
||||||
MW.addMessage.emit('<a href="' + html_url + '"><b>The new version is available!</b></a>', 'warning',
|
MW.addMessage.emit('<a href="' + html_url + '"><b>The new version is available!</b></a>', 'warning',
|
||||||
False)
|
False)
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
announcements = requests.get('https://api.github.com/repos/axu2/kcc-messages/contents/links.json',
|
||||||
|
headers={
|
||||||
|
'Accept': 'application/vnd.github.raw+json',
|
||||||
|
'X-GitHub-Api-Version': '2022-11-28'}).json()
|
||||||
|
for category, payloads in announcements.items():
|
||||||
|
for payload in payloads:
|
||||||
|
expiration = datetime.fromisoformat(payload['expiration'])
|
||||||
|
if expiration < datetime.now(timezone.utc):
|
||||||
|
continue
|
||||||
|
delta = expiration - datetime.now(timezone.utc)
|
||||||
|
time_left = f"{delta.days} day(s) left"
|
||||||
|
icon = 'info'
|
||||||
|
if category == 'humbleBundles':
|
||||||
|
icon = 'bindle'
|
||||||
|
if category == 'kofi':
|
||||||
|
icon = 'kofi'
|
||||||
|
message = f"<b>{payload.get('name')}</b>"
|
||||||
|
if payload.get('link'):
|
||||||
|
message = '<a href="{}"><b>{}</b></a>'.format(payload.get('link'), payload.get('name'))
|
||||||
|
if payload.get('showDeadline'):
|
||||||
|
message += f': {time_left}'
|
||||||
|
if category == 'humbleBundles':
|
||||||
|
message += ' [referral]'
|
||||||
|
MW.addMessage.emit(message, icon , False)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
def setAnswer(self, dialoganswer):
|
def setAnswer(self, dialoganswer):
|
||||||
self.answer = dialoganswer
|
self.answer = dialoganswer
|
||||||
@@ -1185,7 +1226,6 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
statusBarLabel.setOpenExternalLinks(True)
|
statusBarLabel.setOpenExternalLinks(True)
|
||||||
GUI.statusBar.addPermanentWidget(statusBarLabel, 1)
|
GUI.statusBar.addPermanentWidget(statusBarLabel, 1)
|
||||||
|
|
||||||
self.addMessage('<b>Welcome!</b>', 'info')
|
|
||||||
self.addMessage('<b>Tip:</b> Hover mouse over options to see additional information in tooltips.', 'info')
|
self.addMessage('<b>Tip:</b> Hover mouse over options to see additional information in tooltips.', 'info')
|
||||||
self.addMessage('<b>Tip:</b> You can drag and drop image folders or comic files/archives into this window to convert.', 'info')
|
self.addMessage('<b>Tip:</b> You can drag and drop image folders or comic files/archives into this window to convert.', 'info')
|
||||||
if self.startNumber < 5:
|
if self.startNumber < 5:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,7 @@ class Ui_mainWindow(object):
|
|||||||
self.gridLayout.setContentsMargins(-1, -1, -1, 5)
|
self.gridLayout.setContentsMargins(-1, -1, -1, 5)
|
||||||
self.jobList = QListWidget(self.centralWidget)
|
self.jobList = QListWidget(self.centralWidget)
|
||||||
self.jobList.setObjectName(u"jobList")
|
self.jobList.setObjectName(u"jobList")
|
||||||
|
self.jobList.setMinimumSize(QSize(0, 150))
|
||||||
self.jobList.setStyleSheet(u"")
|
self.jobList.setStyleSheet(u"")
|
||||||
self.jobList.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
self.jobList.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
||||||
self.jobList.setVerticalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel)
|
self.jobList.setVerticalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel)
|
||||||
@@ -62,7 +63,7 @@ class Ui_mainWindow(object):
|
|||||||
self.kofiButton.setObjectName(u"kofiButton")
|
self.kofiButton.setObjectName(u"kofiButton")
|
||||||
self.kofiButton.setMinimumSize(QSize(0, 30))
|
self.kofiButton.setMinimumSize(QSize(0, 30))
|
||||||
icon2 = QIcon()
|
icon2 = QIcon()
|
||||||
icon2.addFile(u":/Other/icons/kofi_symbol.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
icon2.addFile(u":/Brand/icons/kofi_symbol.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
self.kofiButton.setIcon(icon2)
|
self.kofiButton.setIcon(icon2)
|
||||||
self.kofiButton.setIconSize(QSize(19, 16))
|
self.kofiButton.setIconSize(QSize(19, 16))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user