kindle icons

This commit is contained in:
Frost Ming
2022-06-07 21:11:23 +08:00
parent 82f8a644b5
commit 8596f4ac68
6 changed files with 105 additions and 19 deletions

86
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: Make Distribution
on:
push:
tags:
- "*"
jobs:
make_dist:
name: Make Distribution File(${{ matrix.os }})
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
include:
- os: windows
filetag: win-x86_64
- os: ubuntu
filetag: linux-x86_64
- os: macos
filetag: macos-x86_64
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: |
requirements.txt
requirements_gui.txt
- name: Install dependencies
run: |
python -m pip install -U -r requirements.txt -r requirements_gui.txt
- name: Make executable
run: |
mkdir downloads
if [[ "${{ matrix.os }}" == "windows" ]]; then
icon="kindle.ico"
else
icon="kindle.icns"
fi
pyinstaller --onefile --clean --windowed --icon=resource/${icon} kindle_download_helper.py
- name: Make dist(MacOS)
if: matrix.os == 'macos'
run: |
brew install create-dmg
create-dmg --window-pos 200 120 --window-size 800 300 --icon-size 100 --app-drop-link 600 20 downloads/kindle-${{ matrix.filetag }}.dmg dist/kindle_download_helper.app
- name: Make dist(Windows)
if: matrix.os == 'windows'
run: |
Compress-Archive -Path dist\kindle_download_helper.exe -DestinationPath downloads\kindle-${{ matrix.filetag }}.zip
- name: Make dist(Linux)
if: matrix.os == 'ubuntu'
run: |
zip -j downloads/kindle-${{ matrix.filetag }}.zip dist/kindle_download_helper
- name: Archive Distribution Files
uses: actions/upload-artifact@v2
with:
name: dist
path: downloads/*
create_release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: make_dist
steps:
- uses: actions/checkout@v3
- name: Get Dists
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: dist/*

15
Makefile Normal file
View File

@@ -0,0 +1,15 @@
all: dep ui
pyinstaller -F -w -i resource/kindle.icns kindle_download_helper.py
dep:
pip install -r requirements.txt
gui_dep:
pip install -r requirements_gui.txt
ui: gui_dep
pyside6-rcc ./icon.qrc -o kindle_rc.py
pyside6-uic ./kindle.ui -o ui_kindle.py
.PHONY: all dep gui_dep ui

View File

@@ -1,4 +1,3 @@
from contextlib import contextmanager
import logging
import os
import sys
@@ -131,7 +130,7 @@ class KindleMainDialog(QtWidgets.QDialog):
file_dialog = QtWidgets.QFileDialog()
file_dialog.setFileMode(QtWidgets.QFileDialog.Directory)
file_dialog.setOption(QtWidgets.QFileDialog.ShowDirsOnly)
if file_dialog.exec_():
if file_dialog.exec():
self.ui.outDirEdit.setText(file_dialog.selectedFiles()[0])
def on_fetch_books(self):
@@ -148,21 +147,6 @@ class KindleMainDialog(QtWidgets.QDialog):
finally:
self.ui.fetchButton.setEnabled(True)
@contextmanager
def make_progressbar(self, iterable, total):
parent = self.ui.logBrowser.parent()
progressbar = QtWidgets.QProgressBar(parent)
def gen():
for i, item in enumerate(iterable, 1):
try:
yield item
finally:
progressbar.setValue(round(i / total * 100, 2))
yield gen()
self.ui.verticalLayout_7.removeWidget(progressbar)
def on_download_books(self):
self.setup_kindle()
if not os.path.exists(self.kindle.out_dir):
@@ -193,6 +177,7 @@ class KindleMainDialog(QtWidgets.QDialog):
self.ui.downloadButton.setEnabled(True)
self.ui.verticalLayout_7.removeWidget(self.progressbar)
self.progressbar.deleteLater()
QtWidgets.QMessageBox.information(self, "下载完成", "下载完成")
def on_book_done(self, idx):
self.book_model.mark_done(idx - 1)
@@ -238,7 +223,7 @@ class BookItemModel(QtCore.QAbstractTableModel):
if role == QtCore.Qt.DisplayRole:
return value
if role == QtCore.Qt.BackgroundRole and self._data[index.row()].done:
return QtGui.QColor(65, 237, 74)
return QtGui.QColor(65, 237, 74, 128)
return None
def rowCount(self, parent):

View File

@@ -1816,7 +1816,7 @@ qt_resource_struct = b"\
\x00\x00\x00\x0e\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00$\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\x81=\xf1*T\
\x00\x00\x01\x81>\xa82\xca\
"
def qInitResources():

BIN
resource/kindle.icns Normal file

Binary file not shown.

BIN
resource/kindle.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB