Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] pythonconsole: Import plugin from Pluma #658

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jefferyto
Copy link

Having the Python Console available makes experimenting and writing Python plugins much easier.

I have tested the plugin in Xed 3.6.6 (Linux Mint 22 MATE Edition) by manually installing the plugin, I have not done a full build/install test though.

@mtwebster
Copy link
Member

Hi, this works ok, but it seems like we should import a few of the most useful modules by default (os, sys, etc...).

@jefferyto
Copy link
Author

I'm not sure that would be a good idea in practice:

  • The user/programmer is expected to explicitly import any necessary modules in every other Python context, including Python in command-line interactive mode
  • Any definition of which modules are the most useful/used/etc. would be anecdotal/arbitrary

@clefebvre
Copy link
Member

Don't modify po/ files in the PR. It would just get overwritten again on PO imports from Launchpad.

Can you explain the steps required for a user to execute code? This is not obvious at all in Pluma, despite the plugin being mentioned in the help contents.

@clefebvre clefebvre changed the title pythonconsole: Import plugin from Pluma [WIP] pythonconsole: Import plugin from Pluma Nov 25, 2024
@jefferyto
Copy link
Author

Don't modify po/ files in the PR. It would just get overwritten again on PO imports from Launchpad.

The changes have been removed.

Can you explain the steps required for a user to execute code? This is not obvious at all in Pluma, despite the plugin being mentioned in the help contents.

  1. Enable the plugin
  2. Show the bottom panel
  3. Select the Python Console tab
  4. Enter code at the >>> prompt

@clefebvre
Copy link
Member

Papercut bug: The very first time you enable the plugin and click the bottom bar toggle button, the bar doesn't expand properly.

OK, so.. as a user I see python console in the plugin list. Its description is clear enough, it gives me a console in the bottom bar. I click on the bottom bar and a python console appears (assuming we fix the issue above).

As a Python dev I recognize the fact that this is an interpreter session and my Xed window has already been instantiated for me and is available as window.

What do I do now? I'm not trying to be smart by asking this. It's not obvious to me why I would want to use a python console in Xed, even as a Python dev. If it's just to mess with Python I can do that in a terminal.. if it's to run what's in my document I'd rather right-click -> Run either on the whole document or on a text selection..

I'm also not sure Xed aims at being an IDE. It can highlight code but its main purpose is to just be a text editor.

@jefferyto
Copy link
Author

It's not obvious to me why I would want to use a python console in Xed

The purpose of the console is to make writing Python plugins for Xed easier. It is much easier and faster to explore APIs and try ideas out in the console rather than:

  • Create a test plugin
  • Restart Xed from a terminal
  • Enable the plugin
  • Check the terminal for error messages
  • Repeat the process

Before I updated my plugin to support Xed I had to add the Python Console for myself to test things out inside Xed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants