Skip to content

Conversation

@UrtsiSantsi
Copy link
Contributor

I ported a few demos to Python, but keep in mind that I know very little Python and even less Gtk :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

The second popover menu items are disabled - it is the same for Rust, but JavaScript works correctly
CC @Hofer-Julian

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's because it's a separate process with Rust and Python

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference seems to be, that in JavaScript the window is associated with a GtkApplication that has the actions added to it (see actions.js). That's not the case in Python (and Rust, I guess). Try:

win = workbench.window
print(win)
app = win.get_application()
print(app)

The latter prints None.

The same problems occurs in #705. @theCapypara

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sonnyp
Copy link
Contributor

sonnyp commented Oct 29, 2023

Let's make sure to use "Rebase and merge" strategy for this one.

image

@sonnyp
Copy link
Contributor

sonnyp commented Oct 29, 2023

@UrtsiSantsi in the future please open one PR per demo 🙏

@UrtsiSantsi
Copy link
Contributor Author

@UrtsiSantsi in the future please open one PR per demo 🙏

Sure, I just didn't want to create too much noise with such simple commit (and it was easier this way 😄)

@theCapypara
Copy link
Contributor

Thanks!
Just a note: This is blocked until #716 is done (prepare for some re-formatting 😛 😅) and possibly #110. You may want to split the Popover demo into a new PR so the rest isn't blocked by #110.

@UrtsiSantsi
Copy link
Contributor Author

Thanks! Just a note: This is blocked until #716 is done (prepare for some re-formatting 😛 😅) and possibly #110. You may want to split the Popover demo into a new PR so the rest isn't blocked by #110.

I used Black for all the demos and just removed the last empty line, since you also didn't have one in the "Welcome" demo, but auto formatting will be wonderful.

As for blocking on #110 - I don't think we should do it:

  • The demo Python code works as intended and instead other functionality doesn't. So even if Allow using actions in the external preview #110 is fixed the Python demo code will not change.
  • All externally previewed languages has the same problem and they are checked in, along with other demos that has similar problem

@theCapypara
Copy link
Contributor

I'll check all the demos later. Just a note for now: This does in fact already pass black.

@theCapypara theCapypara changed the title Moar python More Python demos Oct 30, 2023
@theCapypara theCapypara merged commit 7fb8191 into main Oct 30, 2023
@theCapypara theCapypara deleted the moar_python branch October 30, 2023 10:08
lw64 pushed a commit that referenced this pull request Dec 18, 2023
* Library: Port 'Styling with CSS' to Python

* Library: Port 'Breakpoints' to Python

* Library: Port 'Overlay' to Python

* Library: Port 'Popovers' to Python

* Library: Port 'Emoji Chooser' to Python

* Library: Port 'Image' to Python

* Library: Port 'Separator' to Python

* Library: Port 'Menu Button' to Python

* Library: Port 'Radio Buttons' to Python

* Library: Port 'Link Button' to Python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants