Skip to content
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

Remove UI elements deprecated since 3.9 #3256

Merged
merged 10 commits into from
Oct 28, 2024
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ Cubeviz

- Add missing styling to API hints entry for aperture_method in the spectral extraction plugin. [#3231]

- Remove the ``save as fits`` option from the Collapse and Moment Maps plugin; use the Export plugin instead. [#3256]


Imviz
^^^^^

Expand Down
2 changes: 1 addition & 1 deletion jdaviz/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<div v-if="trayItem.is_relevant && trayItemVisible(trayItem, state.tray_items_filter)">
<v-expansion-panel-header >
<j-tooltip :tipid="trayItem.name">
{{ trayItem.label == 'Orientation' ? 'Orientation (prev. Links Control)' : trayItem.label }}
{{ trayItem.label }}
</j-tooltip>
</v-expansion-panel-header>
<v-expansion-panel-content style="margin-left: -12px; margin-right: -12px;">
Expand Down
2 changes: 0 additions & 2 deletions jdaviz/components/tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ const tooltips = {
'plugin-line-lists-spectral-range': 'Toggle filter to only lines observable within the range of the Spectrum Viewer',
'plugin-line-analysis-sync-identify': 'Lock/unlock selection with identified line',
'plugin-line-analysis-assign': 'Assign the centroid wavelength and update the redshift',
'plugin-moment-save-fits': 'Save moment map as FITS file',
'plugin-extract-save-fits': 'Save spectral extraction as FITS file',
'plugin-collapse-save-fits': 'Save collapsed cube as FITS file',
'plugin-link-apply': 'Apply linking to data',
'plugin-footprints-color-picker': 'Change the color of the footprint overlay',
'plugin-dq-show-all': 'Show all quality flags',
Expand Down
43 changes: 0 additions & 43 deletions jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,46 +359,3 @@ def spectral_unit_selected(self):

def vue_calculate_moment(self, *args):
self.calculate_moment(add_data=True)

def vue_save_as_fits(self, *args):
self._write_moment_to_fits()

def vue_overwrite_fits(self, *args):
"""Attempt to force writing the moment map if the user confirms the desire to overwrite."""
self.overwrite_warn = False
self._write_moment_to_fits(overwrite=True)

def _write_moment_to_fits(self, overwrite=False, *args):
if self.moment is None or not self.filename: # pragma: no cover
return
if not self.export_enabled:
# this should never be triggered since this is intended for UI-disabling and the
# UI section is hidden, but would prevent any JS-hacking
raise ValueError("Writing out moment map to file is currently disabled")

# Make sure file does not end up in weird places in standalone mode.
path = os.path.dirname(self.filename)
if path and not os.path.exists(path):
raise ValueError(f"Invalid path={path}")
elif (not path or path.startswith("..")) and os.environ.get("JDAVIZ_START_DIR", ""): # noqa: E501 # pragma: no cover
filename = Path(os.environ["JDAVIZ_START_DIR"]) / self.filename
else:
filename = Path(self.filename).resolve()

if filename.exists():
if overwrite:
# Try to delete the file
filename.unlink()
if filename.exists():
# Warn the user if the file still exists
raise FileExistsError(f"Unable to delete {filename}. Check user permissions.")
else:
self.overwrite_warn = True
return

filename = str(filename)
self.moment.write(filename)

# Let the user know where we saved the file.
self.hub.broadcast(SnackbarMessage(
f"Moment map saved to {os.path.abspath(filename)}", sender=self, color="success"))
60 changes: 0 additions & 60 deletions jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,65 +173,5 @@
Cannot calculate moment: Must set reference wavelength for output in velocity units.
</span>
</v-row>

<j-plugin-section-header v-if="moment_available && export_enabled">Results</j-plugin-section-header>

<div style="display: grid; position: relative"> <!-- overlay container -->
<div style="grid-area: 1/1">
<div v-if="moment_available && export_enabled">
<v-row>
<v-text-field
v-model="filename"
label="Filename"
hint="Export the latest calculated moment map"
:rules="[() => !!filename || 'This field is required']"
persistent-hint>
</v-text-field>
</v-row>

<v-row>
<span class="v-messages v-messages__message text--secondary" style="color: red !important">
DeprecationWarning: Save as FITS functionality has moved to the Export plugin as of v3.9 and will be removed from Moment Maps plugin in a future release.
</span>
</v-row>

<v-row justify="end">
<j-tooltip tipid='plugin-moment-save-fits'>
<v-btn color="primary" text @click="save_as_fits">Save as FITS</v-btn>

</j-tooltip>
</v-row>

</div>
</div>

<v-overlay
absolute
opacity=1.0
:value="overwrite_warn && export_enabled"
:zIndex=3
style="grid-area: 1/1;
margin-left: -24px;
margin-right: -24px">

<v-card color="transparent" elevation=0 >
<v-card-text width="100%">
<div class="white--text">
A file with this name is already on disk. Overwrite?
</div>
</v-card-text>

<v-card-actions>
<v-row justify="end">
<v-btn tile small color="primary" class="mr-2" @click="overwrite_warn=false">Cancel</v-btn>
<v-btn tile small color="accent" class="mr-4" @click="overwrite_fits" >Overwrite</v-btn>
</v-row>
</v-card-actions>
</v-card>

</v-overlay>


</div>
</j-tray-plugin>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -672,50 +672,6 @@ def vue_spectral_extraction(self, *args, **kwargs):
def vue_create_bg_spec(self, *args, **kwargs):
self.extract_bg_spectrum(add_data=True)

def vue_save_as_fits(self, *args):
self._save_extracted_spec_to_fits()

def vue_overwrite_fits(self, *args):
"""Attempt to force writing the spectral extraction if the user
confirms the desire to overwrite."""
self.overwrite_warn = False
kecnry marked this conversation as resolved.
Show resolved Hide resolved
self._save_extracted_spec_to_fits(overwrite=True)

def _save_extracted_spec_to_fits(self, overwrite=False, *args):

if not self.export_enabled:
# this should never be triggered since this is intended for UI-disabling and the
# UI section is hidden, but would prevent any JS-hacking
raise ValueError(f"Writing out extracted {self.resulting_product_name} to file is currently disabled") # noqa

# Make sure file does not end up in weird places in standalone mode.
path = os.path.dirname(self.filename)
if path and not os.path.exists(path):
raise ValueError(f"Invalid path={path}")
elif (not path or path.startswith("..")) and os.environ.get("JDAVIZ_START_DIR", ""): # noqa: E501 # pragma: no cover
filename = Path(os.environ["JDAVIZ_START_DIR"]) / self.filename
else:
filename = Path(self.filename).resolve()

if filename.exists():
if overwrite:
# Try to delete the file
filename.unlink()
if filename.exists():
# Warn the user if the file still exists
raise FileExistsError(f"Unable to delete {filename}. Check user permissions.")
else:
self.overwrite_warn = True
return

filename = str(filename)
self.extracted_spec.write(filename)

# Let the user know where we saved the file.
self.hub.broadcast(SnackbarMessage(
f"Extracted {self.resulting_product_name} saved to {os.path.abspath(filename)}",
sender=self, color="success"))

@observe('aperture_selected', 'function_selected')
def _set_default_results_label(self, event={}):
if not hasattr(self, 'aperture'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,65 +271,5 @@
</v-alert>
</plugin-add-results>

<j-plugin-section-header v-if="extraction_available && export_enabled">Results</j-plugin-section-header>

<div style="display: grid; position: relative"> <!-- overlay container -->
<div style="grid-area: 1/1">
<div v-if="extraction_available && export_enabled">

<v-row>
<v-text-field
v-model="filename"
label="Filename"
hint="Export the latest extracted spectrum."
:rules="[() => !!filename || 'This field is required']"
persistent-hint>
</v-text-field>
</v-row>

<v-row>
<span class="v-messages v-messages__message text--secondary" style="color: red !important">
DeprecationWarning: Save as FITS functionality has moved to the Export plugin as of v3.9 and will be removed from here in a future release.
</span>
</v-row>

<v-row justify="end">
<j-tooltip tipid='plugin-extract-save-fits'>
<v-btn color="primary" text @click="save_as_fits">Save as FITS</v-btn>

</j-tooltip>
</v-row>

</div>
</div>

<v-overlay
absolute
opacity=1.0
:value="overwrite_warn && export_enabled"
:zIndex=3
style="grid-area: 1/1;
margin-left: -24px;
margin-right: -24px">

<v-card color="transparent" elevation=0 >
<v-card-text width="100%">
<div class="white--text">
A file with this name is already on disk. Overwrite?
</div>
</v-card-text>

<v-card-actions>
<v-row justify="end">
<v-btn tile small color="primary" class="mr-2" @click="overwrite_warn=false">Cancel</v-btn>
<v-btn tile small color="accent" class="mr-4" @click="overwrite_fits" >Overwrite</v-btn>
</v-row>
</v-card-actions>
</v-card>

</v-overlay>
</div>
</div>

</j-tray-plugin>
</template>
43 changes: 0 additions & 43 deletions jdaviz/configs/default/plugins/collapse/collapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,46 +143,3 @@ def collapse(self, add_data=True):

def vue_collapse(self, *args, **kwargs):
self.collapse(add_data=True)

def vue_save_as_fits(self, *args):
self._save_collapsed_spec_to_fits()

def vue_overwrite_fits(self, *args):
"""Attempt to force writing the file if the user confirms the desire to overwrite."""
self.overwrite_warn = False
self._save_collapsed_spec_to_fits(overwrite=True)

def _save_collapsed_spec_to_fits(self, overwrite=False, *args):

if not self.export_enabled:
# this should never be triggered since this is intended for UI-disabling and the
# UI section is hidden, but would prevent any JS-hacking
raise ValueError("Writing out collapsed cube to file is currently disabled")

# Make sure file does not end up in weird places in standalone mode.
path = os.path.dirname(self.filename)
if path and not os.path.exists(path):
raise ValueError(f"Invalid path={path}")
elif (not path or path.startswith("..")) and os.environ.get("JDAVIZ_START_DIR", ""): # noqa: E501 # pragma: no cover
filename = Path(os.environ["JDAVIZ_START_DIR"]) / self.filename
else:
filename = Path(self.filename).resolve()

if filename.exists():
if overwrite:
# Try to delete the file
filename.unlink()
if filename.exists():
# Warn the user if the file still exists
raise FileExistsError(f"Unable to delete {filename}. Check user permissions.")
else:
self.overwrite_warn = True
return

filename = str(filename)
self.collapsed_spec.write(filename)

# Let the user know where we saved the file.
self.hub.broadcast(SnackbarMessage(
f"Collapsed cube saved to {os.path.abspath(filename)}",
sender=self, color="success"))
60 changes: 0 additions & 60 deletions jdaviz/configs/default/plugins/collapse/collapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,65 +59,5 @@
:api_hints_enabled="api_hints_enabled"
@click:action="collapse"
></plugin-add-results>

<j-plugin-section-header v-if="collapsed_spec_available && export_enabled">Results</j-plugin-section-header>

<div style="display: grid; position: relative"> <!-- overlay container -->
<div style="grid-area: 1/1">
<div v-if="collapsed_spec_available && export_enabled">

<v-row>
<v-text-field
v-model="filename"
label="Filename"
hint="Export the latest collapsed spectrum."
:rules="[() => !!filename || 'This field is required']"
persistent-hint>
</v-text-field>
</v-row>

<v-row>
<span class="v-messages v-messages__message text--secondary" style="color: red !important">
DeprecationWarning: Save as FITS functionality has moved to the Export plugin as of v3.9 and will be removed from here in a future release.
</span>
</v-row>

<v-row justify="end">
<j-tooltip tipid='plugin-collapse-save-fits'>
<v-btn color="primary" text @click="save_as_fits">Save as FITS</v-btn>

</j-tooltip>
</v-row>

</div>
</div>

<v-overlay
absolute
opacity=1.0
:value="overwrite_warn && export_enabled"
:zIndex=3
style="grid-area: 1/1;
margin-left: -24px;
margin-right: -24px">

<v-card color="transparent" elevation=0 >
<v-card-text width="100%">
<div class="white--text">
A file with this name is already on disk. Overwrite?
</div>
</v-card-text>

<v-card-actions>
<v-row justify="end">
<v-btn tile small color="primary" class="mr-2" @click="overwrite_warn=false">Cancel</v-btn>
<v-btn tile small color="accent" class="mr-4" @click="overwrite_fits" >Overwrite</v-btn>
</v-row>
</v-card-actions>
</v-card>

</v-overlay>

</div>
</j-tray-plugin>
</template>
Loading
Loading