Skip to content

Commit

Permalink
fix scroll bar in zoom; show version in title
Browse files Browse the repository at this point in the history
  • Loading branch information
xinntao committed Jul 27, 2022
1 parent db25a60 commit a1d0361
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## <div align="center"><b><a href="README.md">English</a> | <a href="README_CN.md">简体中文</a></b></div>

<div align="center">

[![download](https://img.shields.io/github/downloads/xinntao/HandyView/total)](https://github.com/xinntao/HandyView/releases)
![visitors](https://visitor-badge.glitch.me/badge?page_id=xinntao/HandyView)
[![PyPI](https://img.shields.io/pypi/v/handyview)](https://pypi.org/project/handyview/)
Expand All @@ -12,9 +14,11 @@
[![Publish-pip](https://github.com/xinntao/HandyView/actions/workflows/publish-pip.yml/badge.svg)](https://github.com/xinntao/HandyView/blob/master/.github/workflows/publish-pip.yml)
[![Release](https://github.com/xinntao/HandyView/actions/workflows/release.yml/badge.svg)](https://github.com/xinntao/HandyView/blob/master/.github/workflows/release.yml)

</div>

<div align="center">

[**Executable files**](https://github.com/xinntao/HandyView/releases) **|** 🔧[**Usage**](#-Usage)
🔻[**Executable files**](https://github.com/xinntao/HandyView/releases) **|** 🔧[**Usage**](#-Usage)
</div>

HandyView is a **handy image viewer** for convenient viewing and comparing. It is developed with PyQt5.
Expand Down
8 changes: 6 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## <div align="center"><b><a href="README.md">English</a> | <a href="README_CN.md">简体中文</a></b></div>

<div align="center">

[![download](https://img.shields.io/github/downloads/xinntao/HandyView/total)](https://github.com/xinntao/HandyView/releases)
![visitors](https://visitor-badge.glitch.me/badge?page_id=xinntao/HandyView)
[![PyPI](https://img.shields.io/pypi/v/handyview)](https://pypi.org/project/handyview/)
Expand All @@ -12,10 +14,12 @@
[![Publish-pip](https://github.com/xinntao/HandyView/actions/workflows/publish-pip.yml/badge.svg)](https://github.com/xinntao/HandyView/blob/master/.github/workflows/publish-pip.yml)
[![Release](https://github.com/xinntao/HandyView/actions/workflows/release.yml/badge.svg)](https://github.com/xinntao/HandyView/blob/master/.github/workflows/release.yml)

</div>

<div align="center">

[**下载安装文件**](https://github.com/xinntao/HandyView/releases) **|** 🔧[**用法**](#-使用)
</div>
🔻[**下载安装文件**](https://github.com/xinntao/HandyView/releases) **|** 🔧[**用法**](#-使用)


HandyView 是一款基于 PyQt5 开发的方便的图像查看和比对工具

Expand Down
5 changes: 4 additions & 1 deletion handyview/handyviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def __init__(self, init_path=None):
self.center_canvas = CenterWidget(self, self.hvdb)

# initialize UI
self.setWindowTitle('HandyView')
# read version from file
with open(os.path.join(ROOT_DIR, 'VERSION')) as f:
title = 'HandyView @ V' + f.readline().strip()
self.setWindowTitle(title)
self.init_menubar()
self.init_toolbar()
# self.init_statusbar()
Expand Down
8 changes: 8 additions & 0 deletions handyview/view_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ def zoom_in(self, scale=1.05, emit_signal=False):
self.parent.zoom_label.setText(f'Zoom: {self.zoom:.2f}')
self.set_transform()

# update the scroller bar values when zoom in/out
self.vertical_scroll_value = self.verticalScrollBar().value()
self.horizontal_scroll_value = self.horizontalScrollBar().value()

def zoom_out(self, scale=1.05, emit_signal=False):
self.zoom /= scale
if emit_signal:
Expand All @@ -199,6 +203,10 @@ def zoom_out(self, scale=1.05, emit_signal=False):
self.parent.zoom_label.setText(f'Zoom: {self.zoom:.2f}')
self.set_transform()

# update the scroller bar values when zoom in/out
self.vertical_scroll_value = self.verticalScrollBar().value()
self.horizontal_scroll_value = self.horizontalScrollBar().value()

def set_zoom(self, ratio):
self.zoom = ratio
if self.show_info:
Expand Down
1 change: 1 addition & 0 deletions pyinstaller_install_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pyinstaller -D handyview/handyviewer.py \
--add-data="handyview:handyview" \
--add-data="icons:icons" \
--add-data="icon.png:." \
--add-data="VERSION:." \
--windowed \
--noconfirm \
--hidden-import="PIL.Image" \
Expand Down
1 change: 1 addition & 0 deletions pyinstaller_install_win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pyinstaller -D handyview/handyviewer.py \
--add-data="icons;icons" \
--add-data="icon.png;." \
--add-data="icon.ico;." \
--add-data="VERSION;." \
--windowed \
--noconfirm \
--hidden-import="PIL.Image" \
Expand Down

0 comments on commit a1d0361

Please sign in to comment.