GithubHelp home page GithubHelp logo

titusjan / objbrowser Goto Github PK

View Code? Open in Web Editor NEW
129.0 8.0 16.0 544 KB

GUI for Python object introspection

License: MIT License

Python 99.69% Batchfile 0.11% Shell 0.20%
python introspection inspection objects

objbrowser's People

Contributors

titusjan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

objbrowser's Issues

Python 3.10 Won't Run browse

Python 3.9 seems to work totally fine, but with Python 3.10 when calling the browse function:

Python 3.10.9 (main, Dec  7 2022, 01:11:56) [GCC 7.5.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from objbrowser import browse

In [2]: browse({"Hello": 1})
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 browse({"Hello": 1})

File ~/Git/hardware-tooling/venv-10/lib/python3.10/site-packages/objbrowser/__init__.py:45, in browse(*args, **kwargs)
     42 def browse(*args, **kwargs):
     43     """ Opens and executes an ObjectBrowser window
     44     """
---> 45     ObjectBrowser.browse(*args, **kwargs)

File ~/Git/hardware-tooling/venv-10/lib/python3.10/site-packages/objbrowser/objectbrowser.py:627, in ObjectBrowser.browse(cls, *args, **kwargs)
    624 logger.info("Using Python {}".format(PYTHON_VERSION))
    625 logger.info("Using {} (api {}, qtpy: {})".format(QT_API_NAME, QT_API, QTPY_VERSION))
--> 627 cls.create_browser(*args, **kwargs)
    628 exit_code = cls.execute()
    629 return exit_code

File ~/Git/hardware-tooling/venv-10/lib/python3.10/site-packages/objbrowser/objectbrowser.py:598, in ObjectBrowser.create_browser(cls, *args, **kwargs)
    594     logger.debug("Reusing existing QApplication instance")
    596 cls._q_app = q_app # keeping reference to prevent garbage collection. 
--> 598 object_browser = cls(*args, **kwargs)
    599 object_browser.show()
    600 object_browser.raise_()

File ~/Git/hardware-tooling/venv-10/lib/python3.10/site-packages/objbrowser/objectbrowser.py:107, in ObjectBrowser.__init__(self, obj, name, attribute_columns, attribute_details, show_callable_attributes, show_special_attributes, auto_refresh, refresh_rate, reset)
    105 assert self._refresh_rate > 0, "refresh_rate must be > 0. Got: {}".format(self._refresh_rate)
    106 self._refresh_timer = QtCore.QTimer(self)
--> 107 self._refresh_timer.setInterval(self._refresh_rate * 1000)
    108 self._refresh_timer.timeout.connect(self.refresh)
    110 # Update views with model

TypeError: setInterval(self, int): argument 1 has unexpected type 'float'

Version:
objbrowser==1.3.0
Tested on 3.9 and 3.10

Feature request: search by key

Thank you for providing the object browser.
It'd nice to have a search field where one can look for specific methods and fields.

addAction(self, action: typing.Optional[QAction]): argument 1 has unexpected type 'str'

I install PyQt6 and use this code:

from objbrowser import browse
a = 16; b = 'hello'
browse(locals())

It gives this error:

Traceback (most recent call last):
  File "D:\QC supplements\Code\Apps\Trấn Kỳ\test.py", line 3, in <module>
    browse(locals())
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\__init__.py", line 45, in browse
    ObjectBrowser.browse(*args, **kwargs)     
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 627, in browse        
    cls.create_browser(*args, **kwargs)       
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 598, in create_browser
    object_browser = cls(*args, **kwargs)     
                     ^^^^^^^^^^^^^^^^^^^^     
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 99, in __init__       
    self._setup_menu()
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 202, in _setup_menu   
    file_menu.addAction("C&lose", self.close, "Ctrl+W")
TypeError: arguments did not match any overloaded call:
  addAction(self, icon: QIcon, text: Optional[str]): argument 1 has unexpected type 'str'   
  addAction(self, icon: QIcon, text: Optional[str], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 1 has unexpected type 'str'
  addAction(self, icon: QIcon, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int]): argument 1 has unexpected type 'str'
  addAction(self, icon: QIcon, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 1 has unexpected type 'str'  
  addAction(self, text: Optional[str]): too many arguments
  addAction(self, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int]): argument 2 has unexpected type 'builtin_function_or_method'        
  addAction(self, text: Optional[str], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 3 has unexpected type 'str'  addAction(self, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 2 has unexpected type 'builtin_function_or_method'
  addAction(self, action: typing.Optional[QAction]): argument 1 has unexpected type 'str' 

Why is that?

How to run browser without blocking the REPL

Hey there!
Thank you for this, it's extremely useful!

Still I'm trying to figure out how I can run the browser without blocking the REPL, so that I can check the dumped data for what I need and go on in the REPL with the window open as a reference if I need it again.

I'm a bit naive and don't know much about QT, is it possible to launch the browser in a separate thread or something similar so to have the REPL free to continue?

Thank you for time!

Error with Python 3.11 and PySide 6.4 and possible fix

Hello,

I've tried objbrowser with Python 3.11 and PySide 6.4, but throws following exception:

  File "C:\path\objbrowser\objectbrowser.py", line 275, in _setup_views
    self.button_group.buttonClicked[int].connect(self._change_details_field)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
IndexError: Signature "buttonClicked(int)" not found for signal: "buttonClicked". Available candidates: "buttonClicked(QAbstractButton*)"

If i replace that with self.button_group.buttonClicked.connect(self._change_details_field) and it's running now without issues.

I've also replaced line 539 with self.button_group.buttonClicked.disconnect(self._change_details_field), or it throws the same error.

I have no idea about compatibility with other Pyside or Python versions for that fix ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.