kindle manager
This commit is contained in:
49
kmanapp.py
49
kmanapp.py
@@ -52,7 +52,7 @@ infos_temp = """<table border="0">
|
||||
</td>
|
||||
<td style="border-left:1px solid lightgray;"> </td>
|
||||
<td width=100> </td>
|
||||
<td> <img style="max-width:220px;" src="./downimg/{img}" > </td>
|
||||
<td> <img style="max-width:220px;" src="{currpath}/downimg/{img}" > </td>
|
||||
</tr>
|
||||
</table>"""
|
||||
|
||||
@@ -90,13 +90,10 @@ class kmanWindow(QMainWindow):
|
||||
self.km = kMan()
|
||||
self.spide = bookInfoSpide()
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
### in order to smaller the package,
|
||||
### substitute pandas table with mTable
|
||||
self.mt = mTable()
|
||||
|
||||
>>>>>>> 2d53124ab9aa26c9733646348174311d0967c8c0
|
||||
self.books_info = defaultdict(dict)
|
||||
# initial check order:
|
||||
# 1. backup file bk.data ->
|
||||
@@ -120,19 +117,10 @@ class kmanWindow(QMainWindow):
|
||||
[self.filter_books, self.filter_list] = self.km.filter_clips(self.books_data)
|
||||
#self.filter_list = self.km.filter_words(self.words_data)
|
||||
|
||||
self.create_books_info_daemon()
|
||||
|
||||
###############################################################
|
||||
## move to create_books_info_daemon
|
||||
###############################################################
|
||||
# initial books information which grab from douban or amazon
|
||||
# if the information exist in backup file, initial with this file,
|
||||
# and grap new book's information from douban
|
||||
# else grap all book information from douban
|
||||
<<<<<<< HEAD
|
||||
"""
|
||||
=======
|
||||
>>>>>>> 2d53124ab9aa26c9733646348174311d0967c8c0
|
||||
try:
|
||||
if os.path.exists(BACKUPINFOFN):
|
||||
self.books_info = self.km.json2dict(BACKUPINFOFN)
|
||||
@@ -150,7 +138,6 @@ class kmanWindow(QMainWindow):
|
||||
print(e)
|
||||
finally:
|
||||
pass
|
||||
"""
|
||||
|
||||
self.fill_treeview()
|
||||
self.refresh_ui_component(comp=1)
|
||||
@@ -344,7 +331,8 @@ class kmanWindow(QMainWindow):
|
||||
publisher=vv['publisher'],
|
||||
publishing=vv['publishing'],
|
||||
description=vv['description'],
|
||||
img=vv['img'].split('/')[-1]))
|
||||
img=vv['img'].split('/')[-1],
|
||||
currpath=CURRPATH))
|
||||
|
||||
self.copyinfo = """ 1 | :green_book: | [{bookname}]({link}) | """ \
|
||||
"""{author}/{score}/{publisher}/{publishing} {description}""" \
|
||||
@@ -596,8 +584,6 @@ class kmanWindow(QMainWindow):
|
||||
[self.filter_books, self.filter_list] = self.km.filter_clips(self.books_data)
|
||||
self.filter_wordlist = self.km.filter_words(self.words_data)
|
||||
|
||||
#self.create_books_info_daemon()
|
||||
|
||||
self.fill_treeview()
|
||||
self.refresh_ui_component(1)
|
||||
|
||||
@@ -611,8 +597,6 @@ class kmanWindow(QMainWindow):
|
||||
self.books_data = self.km.import_clips(fn)
|
||||
[self.filter_books, self.filter_list] = self.km.filter_clips(self.books_data)
|
||||
|
||||
#self.create_books_info_daemon()
|
||||
|
||||
self.fill_treeview()
|
||||
self.refresh_ui_component(1)
|
||||
|
||||
@@ -830,33 +814,6 @@ class kmanWindow(QMainWindow):
|
||||
|
||||
if bks_info: return self.books_info.update(bks_info)
|
||||
|
||||
def create_books_info_daemon(self):
|
||||
|
||||
# initial books information which grab from douban or amazon
|
||||
# if the information exist in backup file, initial with this file,
|
||||
# and grap new book's information from douban
|
||||
# else grap all book information from douban
|
||||
try:
|
||||
if os.path.exists(BACKUPINFOFN):
|
||||
self.books_info = self.km.json2dict(BACKUPINFOFN)
|
||||
increase_book_list = self.check_increase_books(self.books_data, self.books_info)
|
||||
if len(increase_book_list) > 0:
|
||||
trd = threading.Thread(target=self.grab_books_info, args=(increase_book_list,))
|
||||
trd.setDaemon(True)
|
||||
trd.start()
|
||||
else:
|
||||
booklist = list(self.books_data.keys())
|
||||
trd = threading.Thread(target=self.grab_books_info, args=(book_list,))
|
||||
trd.setDaemon(True)
|
||||
trd.start()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
finally:
|
||||
self.fill_treeview()
|
||||
self.refresh_ui_component(1)
|
||||
|
||||
pass
|
||||
|
||||
# thanks Martin Fitzpatrick ^_^
|
||||
# https://www.learnpyqt.com/courses/model-views/qtableview-modelviews-numpy-pandas/
|
||||
class nTableModel(QAbstractTableModel):
|
||||
|
||||
Reference in New Issue
Block a user