-
Notifications
You must be signed in to change notification settings - Fork 53
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
…e config-edit and an alias for edit.
…rsion script on Rose 2019.
* 33 vertical padding added to widgets for a 'soft' distinction * Vertical padding removed, line disctinctions added using css styling
This means that they get included in the wheel file when the package is built, and they actually get found at runtime. Fixes #37
…ose into feature/rose-config-py3
…dding an array element
…ose into feature/rose-config-py3
…ose into feature/rose-config-py3
…eck (#48) * Removing instances of 'SuiteRunner' for flake8 undefined name F821 check * Removed launch_scheduler function as no longer required
…ose into feature/rose-config-py3
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.
@@ -697,7 +697,8 @@ def get_dialog_parent(): | |||
"""Find the currently active window, if any, and reparent dialog.""" | |||
ok_windows = [] | |||
max_size = -1 | |||
for window in Gtk.window_list_toplevels(): | |||
# not sure if this window change is correct |
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.
TODO
if new_size[i] < max_size[i]: | ||
# Factor in existence of a scrollbar in the other dimension. | ||
# For horizontal dimension, add width of vertical scroll bar + 2 | ||
# For vertical dimension, add height of horizontal scroll bar + 2 | ||
new_size[i] += scrollbar_cls().size_request()[i] + 2 | ||
# What is the value in rose 2019? - here it is zero on load. |
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.
TODO
locator = metomi.rose.resource.ResourceLocator(paths=sys.path) | ||
iname = "rose-gtk-scheduler" | ||
# iname = "rose-gtk-scheduler" |
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.
TODO
# None of this works anymore and needs to be set by CSS | ||
# which does not look simple | ||
# style = Gtk.RcStyle() | ||
# style.xthickness = 0 | ||
# style.ythickness = 0 | ||
# setattr(style, "inner-border", [0, 0, 0, 0]) | ||
# self._console_launcher.modify_style(style) |
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.
TODO
metomi/rose/gtk/splash.py
Outdated
@@ -228,8 +228,7 @@ def _update_buffered(self, *args, **kwargs): | |||
__call__ = update | |||
|
|||
def start(self): | |||
file_name = __file__.rsplit(".", 1)[0] + ".py" | |||
self.process = Popen([file_name] + list(self.args), stdin=PIPE) | |||
self.process = Popen(" ".join(["rose launch-splash-screen"] + list(self.args)), shell=True, stdin=PIPE) |
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.
We should be able to avoid using shell=True
here (security implications).
I think this should work:
self.process = Popen(["rose", "launch-splash-screen"] + self.args), stdin=PIPE)
entry { | ||
background-color: coral; | ||
} | ||
|
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 module_prefix is None: | ||
as_name = module_name |
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.
The module_prefix
support appears to have been removed.
This might be ok, I have no idea if this is used. If we are removing this, we should probably remove the kwarg
with it though.
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.
@@ -465,7 +465,7 @@ def popup_panel_menu(self, base_ns, event): | |||
( | |||
action_name, | |||
Gtk.STOCK_ADD, | |||
metomi.rose.config_editor.TREE_PANEL_ADD_SECTION.format( | |||
metomi.rose.config_editor.TREE_PANEL_ADD_SECTION.format( # noqa: E501 |
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.
These lines can be wrapped, e.g:
foo.bar.baz
foo
.bar
.baz
(
foo
).bar.baz
@@ -723,7 +723,7 @@ | |||
META_PROP_WIDGET_SUB_NS = "widget[rose-config-edit:sub-ns]" | |||
|
|||
# Miscellaneous | |||
COPYRIGHT = """Copyright (C) 2012-2024 British Crown (Met Office) & Contributors. | |||
COPYRIGHT = """Crown Copyright (C) 2012-2024 (Met Office) & Contributors. |
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.
COPYRIGHT = """Crown Copyright (C) 2012-2024 (Met Office) & Contributors. | |
COPYRIGHT = """Copyright (C) British Crown (Met Office) & Contributors. |
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.