-
Notifications
You must be signed in to change notification settings - Fork 57
Upgrade rose edit to Python 3 #2808
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
base: master
Are you sure you want to change the base?
Upgrade rose edit to Python 3 #2808
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have made a first pass over the code, looking good.
There's 186 commits here! We could do with squashing these down a bit to make it a bit more manageable.
5684ff9
to
4cf6267
Compare
d7fb376
to
07cd350
Compare
c5a6ee7
to
edd7db0
Compare
8d1aef1
to
f345292
Compare
There are some flaky tests lurking in the battery at the moment (nothing to do with this PR), the following Mac OS failures can be ignored:
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
44e54eb
to
3704bd5
Compare
Gtk.ResponseType.ACCEPT, | ||
) | ||
self.window = Gtk.Dialog(buttons=buttons) | ||
self.set_transient_for(parent_window) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relates to bug 15:
self.set_transient_for(parent_window) | |
self.window.set_transient_for(parent_window) |
column.pack_start(cell, True, True, 0) | ||
else: | ||
column.pack_start(cell, False, True, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that pack_start
only takes 3 vars (including self.)
These extra variables arent in the old code and don't look like they match the reference material
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For long term reference, @astroDimitrios explained to me that pack_start
can have 2 or 4 (non self
) args depending on which widget the message is attached to. 😢
ee95f20
to
6734a5e
Compare
This comment was marked as outdated.
This comment was marked as outdated.
@@ -99,12 +99,17 @@ rosa = [] | |||
# Tornado 6. | |||
# tornado | |||
# ] | |||
rose-edit = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(needs to match the metomi-rose[edit]
below)
rose-edit = [ | |
edit = [ |
@@ -99,12 +99,17 @@ rosa = [] | |||
# Tornado 6. | |||
# tornado | |||
# ] | |||
rose-edit = [ | |||
"pygobject>=3.50.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This totally failed to pip install for me, but it worked when I conda installed pygobject
.
Failure with pip:
Dependency 'gobject-introspection-1.0' is required but not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is to be expected.
It's the same as trying to pip install pygraphviz
if you don't have graphviz
itself installed. If you are installing from pip
, then you need to satisfy the system dependencies yourself, otherwise pip-installation will likely fail.
I've been through all the issues previously raised, and only 12, 15 are problems. 18 is the same as was too, but I think that the stash panel is out of scope of this PR. I've created an issue where we can dump follow on, so that only essential for merge stuff goes in this PR: I have not (yet) manually retested stuff. |
- pygobject >=3.50.0 | ||
- gtk3 >=3.24.43 | ||
- libgirepository >=1.84.0 | ||
- gobject-introspection >=1.84.0 | ||
- cairo >=1.18.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if all of these dependencies need to be listed here.
The pygobject
feedstock on conda-forge has the following dependencies:
- libgirepository (dependencies)
- cairo
- libiconv
- pycairo (dependencies)
- cairo
So libgirepository
and cairo
are dependencies of pygobject
. Unless we need to specify a minimum version (for compatibility reasons), we can remove these as explicit dependencies of metomi-rose.
Is gobject-introspection necessary? Tim seems to be running fine without it, I think I got myself setup without installing this too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be:
- pygobject >=3.50.0
- gtk3 >=3.24.43
Dropping these dependencies:
- libgirepository (transitive dependency)
- cairo (transitive dependency)
- gobject-introspection (developer tool?)
Re-reviewBugs19. Array pulled to the rightWhen accessing 20. Enable/Ignore sectionEnabling or ignoring a section which is already enabled or ignored causes traceback. 21. Create New ConfigRight click on "suite info > create > create new configuration": Any input into the "new config name box gives:
22. MacroChangesDialog._set_markup()Priority - bad - I had to use ctrl-z to escape. Error message "tasks 5 positional arguments but 6 were given - to access error navigate to `14-compulsory > right click compulsory_section > Auto-fix configuration. 23. Stash Widget: Menu ItemsUsing the UM with centralized metadata. Pick any stash panel and right click on an item, click on remove:
|
if col_index == 0: | ||
cell.set_property("visible", (len(model.get_path(r_iter)) == 1)) | ||
|
||
def _handle_treeview_activation(self, view, path, column): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
column var used for?
text = self.MODE_TEXT[macro_mode] | ||
return '<span foreground="{0}">{1}</span>'.format(colour, text) | ||
|
||
def _set_markup(self, column, cell, model, r_iter, col_index): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
column var used for?
tip.set_text(view.get_model().get_value(row_iter, col_index)) | ||
return True | ||
|
||
def _set_type_markup(self, column, cell, model, r_iter, col_index): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
column var used for?
dialog.destroy() | ||
return None | ||
|
||
def launch_prefs(self, somewidget=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this var do: somewidget=None
?
if _path: | ||
table.add_row(_path) | ||
|
||
button.connect("clicked", lambda b: add_path()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
button.connect("clicked", lambda b: add_path()) | |
button.connect("clicked", lambda _: add_path()) |
import metomi.rose.config | ||
import metomi.rose.gtk.dialog | ||
import metomi.rose.gtk.util | ||
import metomi.rose.resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used?
import os | ||
import re | ||
import webbrowser | ||
|
||
import gi | ||
|
||
gi.require_version("Gtk", "3.0") | ||
from gi.repository import Gtk | ||
|
||
import metomi.rose.config | ||
import metomi.rose.gtk.dialog | ||
import metomi.rose.gtk.util | ||
import metomi.rose.resource | ||
|
||
from functools import cmp_to_key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import os | |
import re | |
import webbrowser | |
import gi | |
gi.require_version("Gtk", "3.0") | |
from gi.repository import Gtk | |
import metomi.rose.config | |
import metomi.rose.gtk.dialog | |
import metomi.rose.gtk.util | |
import metomi.rose.resource | |
from functools import cmp_to_key | |
import gi | |
import os | |
import re | |
import webbrowser | |
from functools import cmp_to_key | |
import metomi.rose.config | |
import metomi.rose.gtk.dialog | |
import metomi.rose.gtk.util | |
gi.require_version("Gtk", "3.0") | |
from gi.repository import Gtk # noqa:E402 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this file actually get called anywhere? Analogy with other .*Widget
classes would make me expect to find them in metomi/rose/config_editor/valuewidget/__init__.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this file actually get called anywhere? Analogy with other .*Widget classes would make me expect to find them in metomi/rose/config_editor/valuewidget/init.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this file actually get called anywhere? Analogy with other .*Widget classes would make me expect to find them in metomi/rose/config_editor/valuewidget/init.py.
# determine widget by presence of environment variables | ||
if contains_env and (not m_type or m_type in NON_TEXT_TYPES or is_list): | ||
# it is not safe to display the widget as intended due to an env var | ||
if "\n" in value: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if "\n" in value: | |
if r"\n" in value: |
Manual TestingI've managed to achieve just under 78% coverage, though I think that there are sig chunks of code which are unreachable, or not covered by the demo, notably the stash panel.
|
Bug SummaryNote Updated 2025-04-14 12. double_quoted_string_with_backslashSeverity: Should fix: Will be very annoying to anyone who has a backslash in a string. Unclear from the docs whether this is a bug, but it certainly doesn't happen in the old version: Try to change my_quoted to
@astroDimitrios Said
15.
|
Thanks for the summary @wxtim. Looks like we have two show stoppers (15 & 21), a few major issues (but better than no GUI at all), and maybe some minor stuff.
@astroDimitrios commented that there seems to be an issue with the example in demo-metadata (or at least it causes a traceback with the old GUI too apparently), so isn't useful for comparison. Here's an example (stolen from the tutorial) which does work with the old GUI (but sadly crashes on this branch): meta=rose-demo-upgrade/garden0.1
[env]
FOREST=true
[namelist:features]
rose_bushes=2 |
As discussed this change updates
rose config-edit
(or justrose edit
) to Python 3 / Gtk3.All seems to function par some cosmetic bugs which are outlined in the Issues on my fork.