Skip to content

Commit

Permalink
Merge branch 'release/2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mstuttgart committed Aug 17, 2017
2 parents 8fd45b8 + 0546cc7 commit c7ee3ef
Show file tree
Hide file tree
Showing 9 changed files with 4,047 additions and 3,950 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ deploy:
provider: releases
api_key:
secure: FbZOk633cPQK70SwNHV29vddB48pQhZYXK6tBi6rNOQFCmtsRltiAZx1mn9cBA89yYcbiEGi8SKNTUKFAOtn8xsftXtRQbh7NLH+1S1rXoFLTKqd/e2K8V+I3qPnSIflXgw4jipkVJEtaTnYjjM39Dd9LYVlOfzTdDS3gePGOGKvLIx+T7nmzNTfPb/jVmBo9d68vlcMvDApMcocURXXHPK2Yoz4cjfGU1s674GOycoPPxE0Ovmdhj/PHLYqnSL0Q78UQ9luL8q6Lv15PeDKynpsi5ajm6p8p7DKp6ilvwWN+iKZA9ged8E8FbA7eLu3DA3pPmghph0dlRpYwbanosccTlbeFrNM6p3s6huxUzHt6Fkdzk5ubtz30FkA0LzvxwxOn6u1W4iTTI1Z1p07SpoyNrRw8wZY/hqcPkD+rDhQX1jmxfzaro8M0QRZ92cOI1nX3N8HRwMTZ2o+vMvaTvmHglfLN1aTpm3z/Pbp2gqj/uxE1aQlXKc3b+V5cGCEmsJKNp3TFhKyRdI7pMNF6E+vWfOLjTjif6h8Vy4nYkCX0C5h8eVmL6y8qfVMS1yATAM8B8K1dXvP3JaDKJoNUvH3VHgH/AxZGYHgycObU7GVUc/XhpCErBuMv1JZmLYE3tEGVFpt93RX2/MVmO8yp7/X6hxeIvfpsFUp2yk1q6k=
file: "pynocchio_2.2.0_amd64.deb"
file: "pynocchio_2.2.1_amd64.deb"
skip_cleanup: true
on:
tags: true
Expand Down
2 changes: 1 addition & 1 deletion pynocchio/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__title__ = 'Pynocchio'
__description__ = 'Pynocchio is a image viewer specialized in comic reading'
__version__ = '2.2.0'
__version__ = '2.2.1'
__url__ = 'https://github.com/pynocchio/pynocchio'
__download_url__ = 'https://github.com/pynocchio/pynocchio/releases'
__author__ = 'Michell Stuttgart'
Expand Down
48 changes: 31 additions & 17 deletions pynocchio/bookmark_database_manager.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-

from peewee import OperationalError, IntegrityError
import peewee
import sqlite3
from .bookmark import Bookmark, TemporaryBookmark, BookmarkBaseModel, db

import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


TABLES = {
False: Bookmark,
True: TemporaryBookmark,
}


class BookmarkManager(BookmarkBaseModel):

@staticmethod
def connect():
try:
Expand All @@ -24,7 +24,9 @@ def connect():
db.create_tables([Bookmark, TemporaryBookmark], safe=True)
logger.info('Table Bookmark and TemporaryBookmark create/updates '
'successfully!')
except OperationalError as exc:
except peewee.OperationalError as exc:
logger.exception(exc)
except sqlite3.OperationalError as exc:
logger.exception(exc)

@staticmethod
Expand All @@ -41,7 +43,7 @@ def add_bookmark(name, path, page, data=None, table=Bookmark):
comic_page=page, page_data=data)
q.execute()
logger.info('%s item inserted.' % table.__class__)
except IntegrityError:
except peewee.IntegrityError:
q = table.update(comic_page=page, page_data=data).where(
table.comic_path == path)
q.execute()
Expand All @@ -55,26 +57,38 @@ def remove_bookmark(path, table=Bookmark):
q = table.delete().where(table.comic_path == path)
q.execute()
logger.info('Bookmark deleted.')
except IntegrityError:
except peewee.IntegrityError:
logger.exception('Bookmark not find!')
BookmarkManager.close()

@staticmethod
def get_bookmarks(rows_number, table=Bookmark):
query = table.select().order_by(table.comic_id.desc()).limit(
rows_number)
return list(query)
try:
query = table.select().order_by(table.comic_id.desc()).limit(
rows_number)
return list(query)
except peewee.OperationalError as exc:
logger.exception(exc)
return []

@staticmethod
def get_bookmark_by_path(path, table=Bookmark):
BookmarkManager.connect()
bk_list = table.select().where(table.comic_path == path)
BookmarkManager.close()
return bk_list[0] if bk_list else None
try:
BookmarkManager.connect()
bk_list = table.select().where(table.comic_path == path)
BookmarkManager.close()
return bk_list[0] if bk_list else None
except peewee.OperationalError as exc:
logger.exception(exc)
return None

@staticmethod
def is_bookmark(path, table=Bookmark):
BookmarkManager.connect()
bk_list = table.select().where(table.comic_path == path)
BookmarkManager.close()
return True if bk_list else False
try:
BookmarkManager.connect()
bk_list = table.select().where(table.comic_path == path)
BookmarkManager.close()
return True if bk_list else False
except peewee.OperationalError as exc:
logger.exception(exc)
return False
2 changes: 1 addition & 1 deletion pynocchio/uic_files/about_dialog_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file './forms/about_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!

Expand Down
2 changes: 1 addition & 1 deletion pynocchio/uic_files/bookmark_manager_dialog_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file './forms/bookmark_manager_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!

Expand Down
2 changes: 1 addition & 1 deletion pynocchio/uic_files/go_to_page_dialog_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file './forms/go_to_page_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!

Expand Down
Loading

0 comments on commit c7ee3ef

Please sign in to comment.