Skip to content

Commit

Permalink
Convert missed files to gtk3 and add gtk rose dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
astroDimitrios committed Aug 2, 2024
1 parent b243093 commit cb129de
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 140 deletions.
36 changes: 18 additions & 18 deletions metomi/rose/config_editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
To override constants at runtime, place a section:
[metomi.rose.config-edit]
[rose-config-edit]
in your site or user configuration file for Rose, convert the name
of the constants to lowercase, and place constant=value lines in the
section. For example, to override the "ACCEL_HELP_GUI" constant, you
could put the following in your site or user configuration:
[metomi.rose.config-edit]
[rose-config-edit]
accel_help_gui="<Ctrl>H"
The values you enter will be cast by Python's ast.literal_eval, so:
Expand All @@ -47,8 +47,8 @@
's/^# \(.*\)\n\(^[^#].*\) = \(.*\)/'\
'\<h4 id="\L\2"\>\2\E=\3\<\/h4\>\<p\>\1\<\/p\>\n/p;' | sort
Use this text to update the doc/etc/metomi.rose.rug-config-edit/metomi.rose.conf.html
text, remembering to add the [metomi.rose.config-edit] section.
Use this text to update the doc/etc/rose-rug-config-edit/metomi.rose.conf.html
text, remembering to add the [rose-config-edit] section.
"""

Expand Down Expand Up @@ -276,7 +276,7 @@
ERROR_METADATA_CHECKER_TEXT = (
"{0} problem(s) found in metadata at {1}.\n" +
"Some functionality has been switched off.\n\n" +
"Run metomi.rose.metadata-check for more info.")
"Run rose metadata-check for more info.")
ERROR_MIN_PYGTK_VERSION = "Requires PyGTK version {0}, found {1}."
ERROR_MIN_PYGTK_VERSION_TITLE = "Need later PyGTK version to run"
ERROR_NO_OUTPUT = "No output found for {0}"
Expand Down Expand Up @@ -534,7 +534,7 @@
DIALOG_LABEL_UPGRADE = (
"Click Upgrade Version cells to change target versions.")
DIALOG_LABEL_UPGRADE_ALL = "Populate all possible versions"
DIALOG_TIP_SUITE_RUN_HELP = "Read the help for metomi.rose.suite-run"
DIALOG_TIP_SUITE_RUN_HELP = "Read the help for rose suite-run"
DIALOG_TEXT_MACRO_CHANGED = "changed"
DIALOG_TEXT_MACRO_ERROR = "error"
DIALOG_TEXT_MACRO_WARNING = "warning"
Expand All @@ -553,7 +553,7 @@
DIALOG_TITLE_EDIT_COMMENTS = "Edit comments for {0}"
DIALOG_TITLE_ENABLE = "Enable section"
DIALOG_TITLE_ERROR = "Error"
DIALOG_TITLE_GRAPH = "metomi.rose.metadata-graph"
DIALOG_TITLE_GRAPH = "rose metadata-graph"
DIALOG_TITLE_IGNORE = "Ignore section"
DIALOG_TITLE_INFO = "Information"
DIALOG_TITLE_OPEN = "Open configuration"
Expand Down Expand Up @@ -705,22 +705,22 @@

# Relevant metadata properties

META_PROP_WIDGET = "widget[metomi.rose.config-edit]"
META_PROP_WIDGET_SUB_NS = "widget[metomi.rose.config-edit:sub-ns]"
META_PROP_WIDGET = "widget[rose-config-edit]"
META_PROP_WIDGET_SUB_NS = "widget[rose-config-edit:sub-ns]"

# Miscellaneous
COPYRIGHT = (
"Copyright (C) 2012-2020 British Crown (Met Office) & Contributors.")
HELP_FILE = "metomi.rose.rug-config-edit.html"
LAUNCH_COMMAND = "metomi.rose.config-edit"
LAUNCH_COMMAND_CONFIG = "metomi.rose.config-edit -C"
LAUNCH_COMMAND_GRAPH = "metomi.rose.metadata-graph -C"
LAUNCH_SUITE_RUN = "metomi.rose.suite-run"
LAUNCH_SUITE_RUN_HELP = "metomi.rose.help suite-run"
HELP_FILE = "rose-rug-config-edit.html"
LAUNCH_COMMAND = "rose config-edit"
LAUNCH_COMMAND_CONFIG = "rose config-edit -C"
LAUNCH_COMMAND_GRAPH = "rose metadata-graph -C"
LAUNCH_SUITE_RUN = "rose suite-run"
LAUNCH_SUITE_RUN_HELP = "rose help suite-run"
MAX_APPS_THRESHOLD = 10
MIN_PYGTK_VERSION = (2, 12, 0)
PROGRAM_NAME = "metomi.rose.edit"
PROJECT_URL = "http://github.com/metomi/metomi.rose."
PROGRAM_NAME = "rose edit"
PROJECT_URL = "http://github.com/metomi/rose/"
UNTITLED_NAME = "Untitled"
VAR_ID_IN_CONFIG = "Variable id {0} from the configuration {1}"

Expand Down Expand Up @@ -767,4 +767,4 @@ def load_override_config(sections, my_globals=None):
my_globals[name] = cast_value


load_override_config(["metomi.rose.config-edit"])
load_override_config(["rose-config-edit"])
2 changes: 1 addition & 1 deletion metomi/rose/config_editor/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ def load_ignored_data(self, config_name):
state.
'Doc table' in the comments refers to
doc/metomi.rose.configuration-metadata.html#appendix-ignored-config-edit
doc/rose-configuration-metadata.html#appendix-ignored-config-edit
"""
self.trigger[config_name] = metomi.rose.macros.trigger.TriggerMacro()
Expand Down
8 changes: 4 additions & 4 deletions metomi/rose/config_editor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def generate_toolbar(self):
(metomi.rose.config_editor.TOOLBAR_VIEW_OUTPUT,
'Gtk.STOCK_DIRECTORY'),
(metomi.rose.config_editor.TOOLBAR_SUITE_GCONTROL,
'metomi.rose.gtk-scheduler')
'rose-gtk-scheduler')
],
sep_on_name=[
metomi.rose.config_editor.TOOLBAR_CHECK_AND_SAVE,
Expand Down Expand Up @@ -1146,7 +1146,7 @@ def load_from_file(self, somewidget=None):
self.data.load_top_config(dirname)
self.data.saved_config_names = set(self.data.config.keys())
self.mainwindow.window.set_title(self.data.top_level_name +
' - metomi.rose.config-editor')
' - rose-config-editor')
self.updater.update_all()
self.updater.perform_startup_check()
else:
Expand Down Expand Up @@ -1850,9 +1850,9 @@ def spawn_window(config_directory_path=None, debug_mode=False,
warnings.filterwarnings('ignore')
resourcer = metomi.rose.resource.ResourceLocator.default()
metomi.rose.gtk.util.rc_setup(
resourcer.locate('metomi.rose.config-edit/.gtkrc-2.0'))
resourcer.locate('rose-config-edit/.gtkrc-2.0'))
metomi.rose.gtk.util.setup_stock_icons()
logo = resourcer.locate('images/metomi.rose.splash-logo.png')
logo = resourcer.locate('images/rose-splash-logo.png')
if metomi.rose.config_editor.ICON_PATH_SCHEDULER is None:
gcontrol_icon = None
else:
Expand Down
6 changes: 3 additions & 3 deletions metomi/rose/config_editor/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class MenuBar(object):
metomi.rose.config_editor.ACCEL_TERMINAL),
('View Output', Gtk.STOCK_DIRECTORY,
metomi.rose.config_editor.TOP_MENU_TOOLS_VIEW_OUTPUT),
('Open Suite GControl', "metomi.rose.gtk-scheduler",
('Open Suite GControl', "rose-gtk-scheduler",
metomi.rose.config_editor.TOP_MENU_TOOLS_OPEN_SUITE_GCONTROL),
('Help', None,
metomi.rose.config_editor.TOP_MENU_HELP),
Expand Down Expand Up @@ -338,10 +338,10 @@ def add_macro(self, config_name, modulename, classname, methodname,
config_item.get_submenu().append(macro_item)
if (methodname == metomi.rose.macro.VALIDATE_METHOD):
for item in config_item.get_submenu().get_children():
if hasattr(item, "_metomi.rose.all_validators"):
if hasattr(item, "_rose_all_validators"):
return False
all_item = Gtk.ImageMenuItem(Gtk.STOCK_DIALOG_QUESTION)
all_item._metomi.rose.all_validators = True
all_item._rose_all_validators = True
all_item.set_label(metomi.rose.config_editor.MACRO_MENU_ALL_VALIDATORS)
all_item.set_tooltip_text(
metomi.rose.config_editor.MACRO_MENU_ALL_VALIDATORS_TIP)
Expand Down
16 changes: 8 additions & 8 deletions metomi/rose/config_editor/menuwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class MenuWidget(Gtk.HBox):

"""This class generates a button with a menu for variable actions."""

MENU_ICON_ERRORS = 'metomi.rose.gtk-gnome-package-system-errors'
MENU_ICON_WARNINGS = 'metomi.rose.gtk-gnome-package-system-warnings'
MENU_ICON_LATENT = 'metomi.rose.gtk-gnome-add'
MENU_ICON_LATENT_ERRORS = 'metomi.rose.gtk-gnome-add-errors'
MENU_ICON_LATENT_WARNINGS = 'metomi.rose.gtk-gnome-add-warnings'
MENU_ICON_NORMAL = 'metomi.rose.gtk-gnome-package-system-normal'
MENU_ICON_ERRORS = 'rose-gtk-gnome-package-system-errors'
MENU_ICON_WARNINGS = 'rose-gtk-gnome-package-system-warnings'
MENU_ICON_LATENT = 'rose-gtk-gnome-add'
MENU_ICON_LATENT_ERRORS = 'rose-gtk-gnome-add-errors'
MENU_ICON_LATENT_WARNINGS = 'rose-gtk-gnome-add-warnings'
MENU_ICON_NORMAL = 'rose-gtk-gnome-package-system-normal'

def __init__(self, variable, var_ops, remove_func, update_func,
launch_help_func):
Expand All @@ -63,7 +63,7 @@ def load_contents(self):
<separator name='sepRemove'/>
<menuitem action='Remove'/>
</popup> </ui>"""
actions = [('Options', 'metomi.rose.gtk-gnome-package-system', ''),
actions = [('Options', 'rose-gtk-gnome-package-system', ''),
('Info', Gtk.STOCK_INFO,
metomi.rose.config_editor.VAR_MENU_INFO),
('Help', Gtk.STOCK_HELP,
Expand All @@ -82,7 +82,7 @@ def load_contents(self):
metomi.rose.config_editor.VAR_MENU_REMOVE),
('Add', Gtk.STOCK_ADD,
metomi.rose.config_editor.VAR_MENU_ADD)]
menu_icon_id = 'metomi.rose.gtk-gnome-package-system'
menu_icon_id = 'rose-gtk-gnome-package-system'
is_comp = (self.my_variable.metadata.get(metomi.rose.META_PROP_COMPULSORY) ==
metomi.rose.META_PROP_VALUE_TRUE)
if self.is_ghost or is_comp:
Expand Down
2 changes: 1 addition & 1 deletion metomi/rose/config_editor/nav_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self, namespace_tree, launch_ns_func,
str, str, int, int, int, int,
bool, str, str, str)
resource_loc = metomi.rose.resource.ResourceLocator(paths=sys.path)
image_path = resource_loc.locate('etc/images/metomi.rose.config-edit')
image_path = resource_loc.locate('etc/images/rose-config-edit')
self.null_icon = GdkPixbuf.Pixbuf.new_from_file(image_path +
'/null_icon.xpm')
self.changed_icon = GdkPixbuf.Pixbuf.new_from_file(image_path +
Expand Down
2 changes: 1 addition & 1 deletion metomi/rose/config_editor/plugin/um/widget/stash.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_stashmaster_lookup_dict(self):
information.
Subclasses *must* override the STASH_PACKAGE_PATH attribute with an
absolute path to a directory containing a metomi.rose.app.conf file with
absolute path to a directory containing a rose-app.conf file with
STASH request package information.
Subclasses should override the STASHMASTER_PATH attribute with an
Expand Down
2 changes: 1 addition & 1 deletion metomi/rose/config_editor/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _generate_error_widget(self):
self._error_widget.show()
locator = metomi.rose.resource.ResourceLocator(paths=sys.path)
icon_path = locator.locate(
'etc/images/metomi.rose.config-edit/error_icon.xpm')
'etc/images/rose-config-edit/error_icon.xpm')
image = Gtk.image_new_from_file(icon_path)
image.show()
self._error_widget.pack_start(image, expand=False, fill=False)
Expand Down
2 changes: 1 addition & 1 deletion metomi/rose/config_editor/valuewidget/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def copy(self):
def chooser(value, metadata, error):
"""Select an appropriate widget class based on the arguments.
Note: metomi.rose.edit overrides this logic if a widget is hard coded.
Note: rose edit overrides this logic if a widget is hard coded.
"""
m_type = metadata.get(metomi.rose.META_PROP_TYPE)
Expand Down
42 changes: 21 additions & 21 deletions metomi/rose/config_editor/valuewidget/array/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

import rose.config_editor.util
import rose.gtk.util
import rose.variable
import metomi.rose.config_editor.util
import metomi.rose.gtk.util
import metomi.rose.variable


class EntryArrayValueWidget(Gtk.HBox):
Expand All @@ -45,33 +45,33 @@ def __init__(self, value, metadata, set_value, hook, arg_str=None):
self.metadata = metadata
self.set_value = set_value
self.hook = hook
self.max_length = self.metadata[rose.META_PROP_LENGTH]
self.max_length = self.metadata[metomi.rose.META_PROP_LENGTH]

value_array = rose.variable.array_split(self.value)
value_array = metomi.rose.variable.array_split(self.value)
self.chars_width = max([len(v) for v in value_array] + [1]) + 1
self.last_selected_src = None
arr_type = self.metadata.get(rose.META_PROP_TYPE)
arr_type = self.metadata.get(metomi.rose.META_PROP_TYPE)
self.is_char_array = (arr_type == "character")
self.is_quoted_array = (arr_type == "quoted")
# Do not treat character or quoted arrays specially when incorrect.
if self.is_char_array:
checker = rose.macros.value.ValueChecker()
checker = metomi.rose.macros.value.ValueChecker()
for val in value_array:
if not checker.check_character(val):
self.is_char_array = False
if self.is_quoted_array:
checker = rose.macros.value.ValueChecker()
checker = metomi.rose.macros.value.ValueChecker()
for val in value_array:
if not checker.check_quoted(val):
self.is_quoted_array = False
if self.is_char_array:
for i, val in enumerate(value_array):
value_array[i] = (
rose.config_editor.util.text_for_character_widget(val))
metomi.rose.config_editor.util.text_for_character_widget(val))
if self.is_quoted_array:
for i, val in enumerate(value_array):
value_array[i] = (
rose.config_editor.util.text_for_quoted_widget(val))
metomi.rose.config_editor.util.text_for_quoted_widget(val))
# Designate the number of allowed columns - 10 for 4 chars width
self.num_allowed_columns = 3
self.entry_table = Gtk.Table(rows=1,
Expand Down Expand Up @@ -110,9 +110,9 @@ def get_focus_index(self):
for entry in self.entries:
val = entry.get_text()
if self.is_char_array:
val = rose.config_editor.util.text_from_character_widget(val)
val = metomi.rose.config_editor.util.text_from_character_widget(val)
elif self.is_quoted_array:
val = rose.config_editor.util.text_from_quoted_widget(val)
val = metomi.rose.config_editor.util.text_from_quoted_widget(val)
prefix = get_next_delimiter(self.value[len(text):], val)
if prefix is None:
return None
Expand All @@ -125,7 +125,7 @@ def set_focus_index(self, focus_index=None):
"""Set the focus and position within the table of entries."""
if focus_index is None:
return
value_array = rose.variable.array_split(self.value)
value_array = metomi.rose.variable.array_split(self.value)
text = ''
for i, val in enumerate(value_array):
prefix = get_next_delimiter(self.value[len(text):],
Expand All @@ -146,7 +146,7 @@ def set_focus_index(self, focus_index=None):
def generate_entries(self, value_array=None):
"""Create the Gtk.Entry objects for elements in the array."""
if value_array is None:
value_array = rose.variable.array_split(self.value)
value_array = metomi.rose.variable.array_split(self.value)
entries = []
for value_item in value_array:
for entry in self.entries:
Expand Down Expand Up @@ -370,8 +370,8 @@ def add_entry(self):
self.entries.append(entry)
self._adjust_entry_length()
self.populate_table(focus_widget=entry)
if (self.metadata.get(rose.META_PROP_COMPULSORY) !=
rose.META_PROP_VALUE_TRUE):
if (self.metadata.get(metomi.rose.META_PROP_COMPULSORY) !=
metomi.rose.META_PROP_VALUE_TRUE):
self.setter(entry)

def remove_entry(self):
Expand Down Expand Up @@ -401,26 +401,26 @@ def setter(self, widget):
if self.is_char_array:
for i, val in enumerate(val_array):
val_array[i] = (
rose.config_editor.util.text_from_character_widget(val))
metomi.rose.config_editor.util.text_from_character_widget(val))
elif self.is_quoted_array:
for i, val in enumerate(val_array):
val_array[i] = (
rose.config_editor.util.text_from_quoted_widget(val))
metomi.rose.config_editor.util.text_from_quoted_widget(val))
entries_have_commas = any("," in v for v in val_array)
new_value = rose.variable.array_join(val_array)
new_value = metomi.rose.variable.array_join(val_array)
if new_value != self.value:
self.value = new_value
self.set_value(new_value)
if (entries_have_commas and
not (self.is_char_array or self.is_quoted_array)):
new_val_array = rose.variable.array_split(new_value)
new_val_array = metomi.rose.variable.array_split(new_value)
if len(new_val_array) != len(self.entries):
self.generate_entries()
focus_index = None
for i, val in enumerate(val_array):
if "," in val:
val_post_comma = val[:val.index(",") + 1]
focus_index = len(rose.variable.array_join(
focus_index = len(metomi.rose.variable.array_join(
new_val_array[:i] + [val_post_comma]))
self.populate_table()
self.set_focus_index(focus_index)
Expand Down
Loading

0 comments on commit cb129de

Please sign in to comment.