Improve comic view

This commit is contained in:
BasioMeusPuga
2019-01-17 23:03:28 +05:30
parent 5b8bc1d707
commit 5e3987dc04
3 changed files with 22 additions and 16 deletions

View File

@@ -779,6 +779,10 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
#____________________________________________ #____________________________________________
def change_page_view(self, key_pressed=False): def change_page_view(self, key_pressed=False):
# Set zoom mode to best fit to
# make the transition less jarring
self.comic_profile['zoom_mode'] = 'bestFit'
# Toggle Double page mode / manga mode on keypress # Toggle Double page mode / manga mode on keypress
if key_pressed == QtCore.Qt.Key_D: if key_pressed == QtCore.Qt.Key_D:
self.bookToolBar.doublePageButton.setChecked( self.bookToolBar.doublePageButton.setChecked(

View File

@@ -220,6 +220,9 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
self.setScene(graphicsScene) self.setScene(graphicsScene)
self.show() self.show()
# This prevents a partial page scroll on first load
self.verticalScrollBar().setValue(0)
def wheelEvent(self, event): def wheelEvent(self, event):
self.common_functions.wheelEvent(event) self.common_functions.wheelEvent(event)
@@ -281,29 +284,24 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
def generate_graphicsview_context_menu(self, position): def generate_graphicsview_context_menu(self, position):
contextMenu = QtWidgets.QMenu() contextMenu = QtWidgets.QMenu()
saveAction = contextMenu.addAction(
self.main_window.QImageFactory.get_image('filesaveas'),
self._translate('PliantQGraphicsView', 'Save page as...'))
fsToggleAction = dfToggleAction = 'Caesar si viveret, ad remum dareris' fsToggleAction = dfToggleAction = 'Caesar si viveret, ad remum dareris'
if self.parent.is_fullscreen: if self.parent.is_fullscreen:
fsToggleAction = contextMenu.addAction( fsToggleAction = contextMenu.addAction(
self.main_window.QImageFactory.get_image('view-fullscreen'), self.main_window.QImageFactory.get_image('view-fullscreen'),
self._translate('PliantQGraphicsView', 'Exit fullscreen')) self._translate('PliantQGraphicsView', 'Exit fullscreen'))
else: elif not self.main_window.settings['show_bars']:
if self.main_window.settings['show_bars']: distraction_free_prompt = self._translate(
distraction_free_prompt = self._translate( 'PliantQGraphicsView', 'Exit Distraction Free mode')
'PliantQGraphicsView', 'Distraction Free mode')
else:
distraction_free_prompt = self._translate(
'PliantQGraphicsView', 'Exit Distraction Free mode')
dfToggleAction = contextMenu.addAction( dfToggleAction = contextMenu.addAction(
self.main_window.QImageFactory.get_image('visibility'), self.main_window.QImageFactory.get_image('visibility'),
distraction_free_prompt) distraction_free_prompt)
saveAction = contextMenu.addAction(
self.main_window.QImageFactory.get_image('filesaveas'),
self._translate('PliantQGraphicsView', 'Save page as...'))
view_submenu_string = self._translate('PliantQGraphicsView', 'View') view_submenu_string = self._translate('PliantQGraphicsView', 'View')
viewSubMenu = contextMenu.addMenu(view_submenu_string) viewSubMenu = contextMenu.addMenu(view_submenu_string)
viewSubMenu.setIcon( viewSubMenu.setIcon(

View File

@@ -116,11 +116,15 @@ class Tab(QtWidgets.QWidget):
self.main_window.settings['scroll_speed']) self.main_window.settings['scroll_speed'])
if self.main_window.settings['hide_scrollbars']: if self.main_window.settings['hide_scrollbars']:
self.contentView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.contentView.setHorizontalScrollBarPolicy(
self.contentView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) QtCore.Qt.ScrollBarAlwaysOff)
self.contentView.setVerticalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)
else: else:
self.contentView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.contentView.setHorizontalScrollBarPolicy(
self.contentView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) QtCore.Qt.ScrollBarAsNeeded)
self.contentView.setVerticalScrollBarPolicy(
QtCore.Qt.ScrollBarAsNeeded)
# Create a common dock for annotations and bookmarks # Create a common dock for annotations and bookmarks
# And add a vertical layout to it for requisite widgets # And add a vertical layout to it for requisite widgets