{"id":15784684,"url":"https://github.com/yjg30737/pyqt-viewer-widget","last_synced_at":"2025-09-08T03:31:30.006Z","repository":{"id":62591590,"uuid":"435742178","full_name":"yjg30737/pyqt-viewer-widget","owner":"yjg30737","description":"PyQt viewer widget","archived":false,"fork":false,"pushed_at":"2022-07-30T06:17:43.000Z","size":903,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-18T02:40:47.398Z","etag":null,"topics":["pyqt","pyqt-examples","pyqt-gui","pyqt-viewer","pyqt-viewer-widget","pyqt5","pyqt5-examples","pyqt5-gui","pyqt5-tutorial","pyqt5-viewer","pyqt5-viewer-widget","python","python3","qgraphicsview","qt"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yjg30737.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-07T04:28:14.000Z","updated_at":"2024-06-04T12:54:44.000Z","dependencies_parsed_at":"2022-11-03T22:49:25.961Z","dependency_job_id":null,"html_url":"https://github.com/yjg30737/pyqt-viewer-widget","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yjg30737/pyqt-viewer-widget","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-viewer-widget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-viewer-widget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-viewer-widget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-viewer-widget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yjg30737","download_url":"https://codeload.github.com/yjg30737/pyqt-viewer-widget/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-viewer-widget/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274128212,"owners_count":25226967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pyqt","pyqt-examples","pyqt-gui","pyqt-viewer","pyqt-viewer-widget","pyqt5","pyqt5-examples","pyqt5-gui","pyqt5-tutorial","pyqt5-viewer","pyqt5-viewer-widget","python","python3","qgraphicsview","qt"],"created_at":"2024-10-04T20:04:55.384Z","updated_at":"2025-09-08T03:31:29.760Z","avatar_url":"https://github.com/yjg30737.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyqt-viewer-widget\nPyQt viewer widget which helps you make viewer application easily\n\n## Requirements\nPyQt5 \u003e= 5.8\n\n## Overview\nThis is image viewer widget, not an application itself. But you can make image viewer application out of this.\n\nFor example, apps below are using this efficiently.\n\n* \u003ca href=\"https://github.com/yjg30737/pyqt-comic-viewer.git\"\u003epyqt-comic-viewer\u003c/a\u003e - Comic reading app \n* \u003ca href=\"https://github.com/yjg30737/pyqt-html-viewer.git\"\u003epyqt-html-viewer\u003c/a\u003e - HTML viewer app\n* \u003ca href=\"https://github.com/yjg30737/pyqt-svg-viewer.git\"\u003epyqt-svg-viewer\u003c/a\u003e - SVG viewer app\n\n## Setup\n`python -m pip install pyqt-viewer-widget`\n\n## Included Package\n* \u003ca href=\"https://github.com/yjg30737/pyqt-toast.git\"\u003epyqt-toast\u003c/a\u003e - to notify user the very beginning/last page when flip the page\n* \u003ca href=\"https://github.com/yjg30737/pyqt-single-image-graphics-view.git\"\u003epyqt-single-image-graphics-view\u003c/a\u003e - main view\n\n## Feature\n* `setExtensions(extensions: list)` to set file extensions to show on the view (e.g. ['.html'])\n* `addFilenames(filenames: list, cur_filename: str = '')` - Add filenames. ```cur_filename``` is file's name which you want to set as current file.\n* `setFilenames(filenames: list, cur_filename: str = '')` - Clear file list before adding files.\n* `addDirectory(dirname: str, cur_filename: str = '')` - Add files in the directory\n* `setDirectory(dirname: str, cur_filename: str = '')` - Clear file list before adding files in the directory\n* `setCurrentIndex(idx: int)`, `getCurrentIndex() -\u003e int`. The latter one can be used for checking at least one file exists or not.\n* `setCurrentFilename(filename: str)`, `getCurrentFilename() -\u003e str`.\n* `clear()`\n* Flip the page back and forth with prev, next button on bottom navigation widget, mouse wheel, left and right pad of keyboards.\n* Being able to check the current page\n* Being able to toggle the visibility of the bottom widget\n* Give the emitting signal when clicked prev, next, close buttons: ```prevSignal(str), nextSignal(str), closeSignal(bool)``` - prev/next signals' arguments are previous/next file's name. close signal's bool value is always `False` to set the visibility of bottom widget (navigation widget) of viewer widget `False`. There's also `clearSignal` which is emitted when there is no file. (except for init moment)\n* When you've got the absoulte beginning/last of the files list, toast(\u003ca href=\"https://github.com/yjg30737/pyqt-toast.git\"\u003epyqt-toast\u003c/a\u003e) will show up. You can get either direction of toast with ```getFirstPageToast```, ```getLastPageToast``` to change the toast's style such as font, color.\n* `setView(view: QWidget)`, `getView() -\u003e QWidget`\n* `setBottomWidgetVisible(f: bool)` to toggle the visibility of bottom navigation bar. \n* `getFirstPageToast() -\u003e Toast`, `getLastPageToast() -\u003e Toast`\n* `setWindowTitleBasedOnCurrentFileEnabled(f: bool, prefix: str)` to set the title based on current file like \"Prefix - def.png\" if current file of viewer is \"def.png\". You can activate the feature by giving `True` to first argument `f`. You can give the default window title to `prefix`.\n* `isWindowTitleBasedOnCurrentFileEnabled() -\u003e bool`\n* `removeSomeFilesFromViewer(filenames_to_remove: list)` is used when you want to remove some files in viewer, not all files. If `filenames_to_remove` includes the file name which was not included in list, error will be occured.\n* `setHome(widget: QWidget)` to set home page widget, `goHome()`.\n\n## Simple Example\nCode Example (Extremely basic image viewer)\n```python\nimport os\n\nfrom PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton\nfrom pyqt_viewer_widget import ViewerWidget\n\n\nclass MainWindow(QMainWindow):\n    def __init__(self):\n        super().__init__()\n        self.__initUi()\n\n    def __initUi(self):\n        self.__viewerWidget = ViewerWidget()\n        dirname = os.path.join(os.getcwd(), 'viewerWidgetExampleImagesDir')\n        self.__viewerWidget.setExtensions(['.jpg'])\n        self.__viewerWidget.setDirectory(dirname)\n        self.__viewerWidget.closeSignal.connect(self.__bottomWidgetClosed)\n\n        self.setCentralWidget(self.__viewerWidget)\n        self.__setToolBar()\n\n    def __setToolBar(self):\n        self.__bottomWidgetToggleBtn = QPushButton('Show')\n        self.__bottomWidgetToggleBtn.setCheckable(True)\n        self.__bottomWidgetToggleBtn.setChecked(True)\n        self.__bottomWidgetToggleBtn.toggled.connect(self.__viewerWidget.setBottomWidgetVisible)\n\n        fileToolbar = self.addToolBar('File')\n        fileToolbar.addWidget(self.__bottomWidgetToggleBtn)\n        fileToolbar.setMovable(False)\n\n    def __bottomWidgetClosed(self):\n        self.__bottomWidgetToggleBtn.setChecked(False)\n\n\nif __name__ == \"__main__\":\n    import sys\n\n    app = QApplication(sys.argv)\n    mainWindow = MainWindow()\n    mainWindow.show()\n    sys.exit(app.exec_())\n```\n\nResult\n\nhttps://user-images.githubusercontent.com/55078043/145040849-0c7326ed-e043-4a8b-8c55-c9b7e1d1756e.mp4\n\nNote: This is result of very first version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fpyqt-viewer-widget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjg30737%2Fpyqt-viewer-widget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fpyqt-viewer-widget/lists"}