-
Notifications
You must be signed in to change notification settings - Fork 54
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
Upgrade rose edit to Python 3 #2808
base: master
Are you sure you want to change the base?
Upgrade rose edit to Python 3 #2808
Conversation
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.
val_array = [] | ||
# Prevent str without "" breaking the underlying Python syntax | ||
for e in self.entries: | ||
v = e.get_text() | ||
if v in ("False", "True"): # Boolean | ||
val_array.append(v) | ||
elif (len(v) == 0) or (v[:1].isdigit()): # Empty or numeric | ||
val_array.append(v) | ||
elif not v.startswith('"'): # Str - add in leading and trailing " | ||
val_array.append('"' + v + '"') | ||
e.set_text('"' + v + '"') | ||
e.set_position(len(v)+1) | ||
elif (not v.endswith('"')) or (len(v) == 1): # Str - add in trailing " | ||
val_array.append(v + '"') | ||
e.set_text(v + '"') | ||
e.set_position(len(v)) | ||
else: |
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.
@oliver-sanders, please go through this.
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:
|
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.
Sorry for the delay, back looking at this...
Have tested this out on Mac OS using conda install gtk3 pygobject
, worked a charm. Much, much easier to install than the old version 🚀
Anyway looking good 👍
I did find some issues during testing, a couple of tracebacks and some minor things (some of which might just go on the issue tracker for another day)....
1) The "file" sections don't seem to be working:
I did hit this issue when I tried to open any of the file sections:
2) The right-click menu for "duplicate" items is too narrow and has broken icons
Example: demo-meta/10-duplicate/namelist/strawberry icecream
Spotted one minor thing with "duplicate" items (see example in the demo metadata), where the right click menu opened too narrow to display the whole text:
The icons seem to be scrambled too.
3) Multi-line text fields raise traceback when edited
Example: demo-meta/01-types/namelist/manytypes/my_raw_with_newlines
4) Focusing on a long text box causes horizontal scrolling
Example: demo-meta/01-types/namelist/many types/my_char
Before clicking on the text box:
After clicking on the text box (Rose 2019 didn't scroll horizontally in this situation):
5) char types get quotes added when focused
Example: demo-meta/01-types/namelist/many types/my_char_array
Before I click on the text box, there are no quote symbols in it. After I click in the text box, quote symbols appear:
(left: this PR, right: deployed Rose 2019)
I need to double check this one as I have some vague memory that we changed something to do with the quotes for char types at some point...
6) Scrolls to the top of the page when warnings are raised on field change
Example: demo-meta/01-types/namelist/many types/my_int_range
Before changing the value from 2->3 (by pressing the increment button):
After pressing the increment button (scrolls to the top of the page):
7) Raw strings don't change appearance when env vars are present
Example: demo-meta/01-types/namelist/many types/my_raw
(left: this PR, right: deployed Rose 2019)
The field used to go purple to show that an environment variable is present. This is useful information for the user as some checks cannot be performed when env vars are present.
8) Bug fixed: adding an item to a char array caused a crash
Example: demo-meta/01-types/namelist/many types/my_repeat_char_array
I spotted one bug in the old GUI that has been fixed on this branch 👏, thanks! Adding an item to the array caused a crash!
9) Clicking anywhere in my_repeat_real_array causes it to be flagged as an error
Example: demo-meta/01-types/namelist/many types/my_real_repeat_array
10) Widget changed for multiple select
Example: demo-meta/01-types/namelist/many types/my_values_lots_toggle
Used to be a dropdown, now it's a radio button list.
The above commits fix 1, 3, and 9. |
@astroDimitrios - simple de-confliction required. |
Note Not finished, will update Tim's Functional ReviewNew BugsNumbering cont'd from Oliver's bugs. 11. Annoying quotesSeverity: Likely to cause complaint, but not fatal. Concerned about how systematic this is. (Bit like Oliver's bug 5.)
If one replaces the value with 12.
|
path = self.treeview.get_cursor()[0] |
16. Single char focus stealing
Priority: Low - it's annoying, but shouldn't block release
Found on suite info section, all three text boxes - On deletion of the last char, or insertion of a single char, the focus moves to the cog button.
(also seen in 01-types/namelist/many types/my-derived
second element·)
Note
This may be related to Number 6
17. Failure on invalid widget[rose-config-edit]
value
Priority: Can be spun out - shouldn't be a problem if Suite developers don't mess up or don't use this setting.
Replicate -
In etc/demo/rose-config-edit/demo_meta/app/01-types/meta/rose-meta.conf
replace widget[rose-config-edit]=metomi.rose.config_editor.valuewidget.radiobuttons.RadioButtonsValueWidget
with a garbage value (I was trying to check coverage by using widget[rose-config-edit]=metomi.rose.config_editor.valuewidget.choice.ChoicesValueWidget
.
Try opening this config in the editor. In the old version nothing much happens differently in the new version the whole gui freezes.
Alternative standalone replication:
#!/bin/bash
TMP=$(mktemp -d)
echo Files extracted to ${TMP}
mkdir "${TMP}/."
mkdir "${TMP}/./meta"
cat > "${TMP}/./meta/rose-meta.conf" <<__ICI__
[namelist:one=foo]
widget[rose-config-edit]=metomi.rose.config_editor.valuewidget.choice.ChoicesValueWidget
=--editable__ICI__
cat > "${TMP}/./rose-app.conf" <<__ICI__
[namelist:one]
foo=3,3,3__ICI__
cd ${TMP}
rose edit -C examples/one/
should return
[FAIL] Could not import widget: Gtk.Box.pack_start() takes exactly 5 non-keyword arguments (2 given)
No obvious sign of line numbers, but I'd guess it'd be in
metomi.rose.config_editor.valuewidget.choice.ChoicesValueWidget
067084a
to
44e54eb
Compare
…e config-edit and an alias for edit.
…rsion script on Rose 2019.
Fixes issue with duplicate ns sorting app 10
If either section or option in the namespace (ns) are None then this doesn't sort properly with other values. This change ensures None is converted to a string to compare with normal string section/option values.
Fixes invisible text in the stash diag panel
…le for Rose 2.0 Removes the extra rose config-edit section from the rose api docs and prevented the splash-screen entry points getting into the docs
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. 😢
self.window.set_focus(self.ok_button) | ||
self._set_ok_to_upgrade() | ||
max_size = metomi.rose.config_editor.SIZE_MACRO_DIALOG_MAX | ||
my_size = self.window.size_request() |
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 struggling to navigate the GTK docs, but I don't think get_size_request
returns the same type as it did at GTK2. I'm also not clear, but suspect it's marked for deprecation.
my_size = self.window.size_request() | |
my_size = self.window.get_size() |
@oliver-sanders - I'm not sure number 10 is correct: I think that something has gone wrong in the old version given that the metadata explicitly sets the toggle to radio buttons. What's worse, I can't get the radio buttons like you have on either new or old vdi.
If you remove this line you do get a dropdown box in the new version. |
Bug SummaryIncludes recapitulation of Olivers bugs Have they been fixed? What priority?
|
list_frame.show() | ||
list_frame.add(self._listview) | ||
list_vbox.pack_start(list_frame, expand=False, fill=False, padding=0) | ||
self.pack_start(list_vbox, expand=True, fill=True) |
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.
might need
self.pack_start(list_vbox, expand=True, fill=True) | |
self.pack_start(list_vbox, expand=True, fill=True, padding=0) |
|
||
def _get_add_widget(self): | ||
add_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) | ||
add_entry = Gtk.ComboBoxEntry() |
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 line fails when https://github.com/metomi/rose/pull/2808/files#r1920339780 is fixed. 😢
Looks like some of the GTK interfaces have changed.
(Relates to Bug 17)
How I'm looking at coverageThe following diff allows us to monitor which code manual testing is hitting: To use > export CYLC_COVERAGE=1
> rose edit -C path/to/app/or/suite
> # Do some manual testing, then close the GUI
> coverage combine
> coverage html
> firefox htmlcov/index.html |
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.