Skip to main content

pyqt-find-path-widget

PyQt find path widget (QLabel - QLineEdit - QPushButton)

Requirements

PyQt5 >= 5.8

Setup

python -m pip install pyqt-find-path-widget

Included Packages

Feature

  • findClicked Signal will be emitted when find button clicks

  • added Signal will be emitted when file's name is set in the QLineEdit

  • "Open path" feature in context menu

  • Showing tooltip to show full path when QLineEdit is too short to do so

  • QLineEdit is set to read only in order to prevent malfunction from wrong input.

  • Being able to use setLabel(label: str) method to set the label. Label doesn't exist as default.

Example

from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QTextBrowser

from pyqt_find_path_widget import FindPathWidget





class FindPathWidgetExample(QWidget):

    def __init__(self):

        super().__init__()

        self.__initUi()



    def __initUi(self):

        findPathWidget = FindPathWidget()

        findPathWidget.setExtOfFiles('Text Files (*.txt)') # Restrict file's extension to find



        findPathWidget.findClicked.connect(self.__findClicked) # Signal will be emitted when find button clicks

        findPathWidget.added.connect(self.__added) # Signal will be emitted when file's name is set in the QLineEdit



        self.__textBrowser = QTextBrowser() # Widget to show text file's content

        self.__textBrowser.setStyleSheet('QTextBrowser '

                                          '{'

                                          'color: #DDD;'

                                          'background-color: #444;'

                                          'border: 1px solid #222;'

                                          '}') # To match the style with FindPathWidget



        self.setStyleSheet('QWidget { background-color: #666; }') # To match the style with FindPathWidget



        lay = QVBoxLayout()

        lay.addWidget(findPathWidget)

        lay.addWidget(self.__textBrowser)



        self.setLayout(lay)



    def __findClicked(self):

        print('find clicked')



    def __added(self, filename):

        f = open(filename, 'r')

        text = f.read()

        f.close()

        self.__textBrowser.setText(text)





if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    searchMultiple = FindPathWidgetExample()

    searchMultiple.show()

    app.exec_()

Result

image

Mouse cursor should be next to that tooltip. Windows screenshot feature doesn't show the mouse cursor.

Metadata

Release files for pyqt-find-path-widget 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyqt-find-path-widget 0.0.1
File Size Uploaded
pyqt-find-path-widget-0.0.1.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyqt-find-path-widget 0.0.1
File Interpreter ABI Platform
pyqt_find_path_widget-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / pyqt-find-path-widget-0.0.1.tar.gz

Download URL pyqt-find-path-widget-0.0.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e81202f277b40a6316dcda2b13de3f1f69857984e881c90ea2709b88547b17fa
BLAKE2b-256 checksum
How to use checksums
d1215d8aa32819e0ba7e4c22850e73a9d8afcfb3a6c02e50cec32efc0a468957
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release files / pyqt_find_path_widget-0.0.1-py3-none-any.whl

Download URL pyqt_find_path_widget-0.0.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5648778ecc7c39d3832a62484e6b05e7082e024cc82ac83ab40f24979f753b72
BLAKE2b-256 checksum
How to use checksums
44368eb9e2f729e5eb1ef4df3c615916e74e4dce30f0821f5411cb339ca3c5a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page